[Buggy builds] luci_statistics Error while Showing Graphs

#1

I have flashed a custom compiled OpenWrt SNAPSHOT image to my HomeHub 5A a couple hours ago and configured it from scartch knowing everything was working correctly but now I can't seem to open Graphs area under Stats in LuCI. It is showing the following error:

Failed to execute template dispatcher target for entry '/admin/statistics/graph'.
The called action terminated with an exception:
/usr/lib/lua/luci/template.lua:74: Failed to load template 'admin_statistics/index'.
Error while parsing template '/usr/lib/lua/luci/view/admin_statistics/index.htm':
Permission denied
stack traceback:
	[C]: in function 'error'
	/usr/lib/lua/luci/template.lua:74: in function '__init__'
	/usr/lib/lua/luci/util.lua:65: in function 'Template'
	/usr/lib/lua/luci/template.lua:27: in function 'render'
	/usr/lib/lua/luci/dispatcher.lua:852: in function </usr/lib/lua/luci/dispatcher.lua:851>

I also did try to set up 0755 permission on the said template but the error is still persistent.

My luci_statistics config is:

root@AhmarRouter:~# cat /etc/config/luci_statistics

config statistics 'collectd'
        option Include '/etc/collectd/conf.d'
        option PIDFile '/var/run/collectd.pid'
        option PluginDir '/usr/lib/collectd'
        option TypesDB '/usr/share/collectd/types.db'
        option ReadThreads '2'
        option BaseDir '/stats/collectd'
        option Interval '15'

config statistics 'rrdtool'
        option default_timespan '1hour'
        option image_width '600'
        option image_path '/tmp/rrdimg'

config statistics 'collectd_rrdtool'
        option enable '1'
        option RRARows '100'
        option RRATimespans '1hour 1day 1week 1month 1year'
        option RRASingle '0'
        option RRAMax '0'
        option DataDir '/stats/rrd'

config statistics 'collectd_csv'
        option enable '0'
        option StoreRates '0'
        option DataDir '/tmp'

config statistics 'collectd_email'
        option enable '0'
        option SocketFile '/var/run/collectd/email.sock'
        option SocketGroup 'nogroup'

config statistics 'collectd_logfile'
        option enable '0'
        option LogLevel 'notice'
        option File '/var/log/collectd.log'
        option Timestamp '1'

config statistics 'collectd_network'
        option enable '0'

config statistics 'collectd_unixsock'
        option enable '0'
        option SocketFile '/var/run/collectd/query.sock'
        option SocketGroup 'nogroup'

config statistics 'collectd_apcups'
        option enable '0'
        option Host 'localhost'
        option Port '3551'

config statistics 'collectd_conntrack'
        option enable '0'

config statistics 'collectd_contextswitch'
        option enable '0'

config statistics 'collectd_cpu'
        option enable '1'

config statistics 'collectd_cpufreq'
        option enable '0'

config statistics 'collectd_curl'
        option enable '0'

config statistics 'collectd_df'
        option enable '0'
        option Devices '/dev/mtdblock/4'
        option MountPoints '/jffs'
        option FSTypes 'tmpfs'
        option IgnoreSelected '0'

config statistics 'collectd_disk'
        option enable '0'
        option Disks 'hda1 hdb'
        option IgnoreSelected '0'

config statistics 'collectd_dns'
        option enable '0'

config statistics 'collectd_entropy'
        option enable '0'

config statistics 'collectd_exec'
        option enable '0'

config statistics 'collectd_interface'
        option enable '1'
        option IgnoreSelected '0'
        option Interfaces 'pppoe-wan'

config statistics 'collectd_iptables'
        option enable '0'

config statistics 'collectd_irq'
        option enable '0'
        option Irqs '2 3 4 7'

config statistics 'collectd_iwinfo'
        option enable '0'

config statistics 'collectd_load'
        option enable '1'

config statistics 'collectd_memory'
        option enable '1'

config statistics 'collectd_netlink'
        option enable '0'
        option IgnoreSelected '0'
        option VerboseInterfaces 'br-lan'
        option QDiscs 'br-lan'

config statistics 'collectd_nut'
        option enable '0'
        option UPS 'myupsname'

config statistics 'collectd_olsrd'
        option enable '0'
        option Port '2006'
        option Host '127.0.0.1'

config statistics 'collectd_ping'
        option enable '0'
        option TTL '127'
        option Interval '30'
        option Hosts '127.0.0.1'

config statistics 'collectd_processes'
        option enable '0'
        option Processes 'uhttpd dnsmasq dropbear'

config statistics 'collectd_sensors'
        option enable '0'

config statistics 'collectd_splash_leases'
        option enable '0'

config statistics 'collectd_tcpconns'
        option enable '0'
        option ListeningPorts '0'
        option LocalPorts '22 80'

config statistics 'collectd_thermal'
        option enable '0'
        option IgnoreSelected '0'

config statistics 'collectd_uptime'
        option enable '1'

Thanks in advance for helping.

#2
/etc/init.d/uhttpd stop
/etc/init.d/luci_statistics stop
/etc/init.d/collectd stop
rm -rf /tmp/luci*
( possible rm /etc/collectd.conf here )
/etc/init.d/collectd start
/etc/init.d/luci_statistics start
/etc/init.d/uhttpd start
#3

Done that but still the same error. Funny thing is the stats are being collected as usual and even I can change the settings and stats show up in the directory but Graphs are not being shown. I also tried to delete the index.html file and even after deleting the file the error still shows permission denied. Any clues?

#4

Don't think you should have to mess with html...

Try a;

rm -rf /tmp/rrdimg/*
and / or
chmod -R 755 /tmp/rrdimg

Maybe you smoked something mission critical?

#5

Well /tmp/rrdimg does mot exist. I think it will be created when the graphs do appear, maybe? I created it anyway and the permission is 0755 but still no Graphs screen for me.

Well I would say no to that becasue everything was working and then after a few minutes it was not.

#6

hmmmm.... only other thing would be to parse /etc/config/* for syntax errors.....

maybe even start new and put stuff in there bit by bit....

last time I tried / had to edit collectd / statistic conf's by hand.... i could never get it working.....

that is one service i am strickly gui'fied on.

#7

Well I was using LuCI so didnt need to write the /etc/config/luci_staistics by myself. But anyway I backed up the original config file and put one dummy file with basic config and one plugin and still the same error.

root@AhmarRouter:/stats# ls rrd/AhmarRouter/cpu*
rrd/AhmarRouter/cpu-0:
cpu-idle.rrd       cpu-nice.rrd       cpu-steal.rrd      cpu-user.rrd
cpu-interrupt.rrd  cpu-softirq.rrd    cpu-system.rrd     cpu-wait.rrd

rrd/AhmarRouter/cpu-1:
cpu-idle.rrd       cpu-nice.rrd       cpu-steal.rrd      cpu-user.rrd
cpu-interrupt.rrd  cpu-softirq.rrd    cpu-system.rrd     cpu-wait.rrd

The collectd itself is working fine. But the problem is with Graphs only.

Edit: Since I am using ExtRoot it should be easy to firstboot the entire thing and see if it starts working with default config and if it does start working then I'll look for any errors in my config.

1 Like
#8

You have 128 MB of FLA, no?

#9

Some that points to some directory permission thing, I think.
You have modified the directories in use, so start looking for problem there.

Note that the data directory needs to be world-readable as the graph renderer in LuCI runs as the user "nobody". Actually the whole path leading to it needs to be. So I assume that /stats and /stats/collectd have 644 or more relaxed permissions.

2 Likes
#10

Yes I do have 128mb of Flash but I use a 512 gb Hard drive with the router so I prefer ExtRoot.

I also suspected that but I gave them relaxed permissions, even 0777, but it didnt work. After that I just unplogged my external drive, rebooted the router and went back to check and everything started working so I think something was wrong with the ExtRoot maybe. But then I created another ExtRoot so I am doing okay now. I am going to keep this open for a couple of days to see how things work out and if something goes wrong again, I may return to this later.

#11
        option image_path '/tmp/rrdimg'
        option DataDir '/stats/rrd'

Next time then add this to your testing reportoire;

ln -s /stats/rrd /tmp/rrd
#12

Well the error happened again, I checked the permissions, they were default. never touched anything at all. I suspect something may be going on somewhere inside Luci Statistics.

Anyway, I unplugged ExtRoot again, rebooted without ExtRoot, copied everything from /rom, /usr, /proc to ExtRoot and when I rebooted it's working again, dont know for how long but we'll see.

I dont think the problem is within the config. I am using the same config as before, no changes except the directory is now /stats for collectd. rrd shows graphs from /tmp as usual and everything is working.

Right now:

#13

it's TZ ... or less likely hostname... seen them change?

#14

What is TZ? And no hostname did not change so far. Also the graphs screen is working so far after copying stuff to ExtRoot.

1 Like
#15

Well... just about everything else has been ruled out.... the graph code uses hostname and time..... to operate.... TZ mean't to suggest some erroneous clock skew.....

Only things that fit with your symptoms..... well... the cache code could too...... if if uses time...... you can disable the cache.... but I dunno how that would effect statistics specifically.....

One way to find out I suppose..... Glad to hear it's working.... Fingers crossed it stays that way....

I reckon next time set it up.... then do the extroot copy configuration.

#16

I dont understand why timezone may have a problem with translating a webpage. I mean the error clearly indicates that it cant show a certain page becasue of the template and it says Permission denied error but in fact the permission seems okay from SSH.

So it is possible the permissions get screwed somehow for LuCI and it cant access the template for that reason and says "Permission denied". Maybe a bug somewhere? I am using a Snapshot build after all. Or maybe the Flash can be causing issues with the filesystem but it seems unlikely becasue no other problems have popped out yet.

Edit 3: Found the source of the issue. If I install luci-app-vpn-policy-routing then the graphs screen throws permission denied error and wont show any graphs. I am not sure why it is doing it but maybe something gets broken if you are using ExtRoot and install a LuCI based package into ExtRoot. It could be a bug but I am not sure.

1 Like
#17

Had exact same issue and via GUI uninstalled "luci-app-statistics" (without dependencies checked) then reboot, installed it again and rebooted. Seems to be working now.

I also use "luci-app-vpn-policy-routing".

#18

Yes, I was about to edit my last reply becasue I fixed it by force reinstalling it. RRD graphs were not working for me either so a force reinstall did the trick anyway. But as of right now, I am using the stable builds, too many bugs for daily use in Snapshots and I need a stable connection for a few weeks. Thanks for confirming though.

#19

FWIW: I updated to Davidc502's build "OpenWrt SNAPSHOT r9886-399aa0b933 / LuCI Master (f138fc93)" when I experience the issue so maybe it was the same Snapshot.

#20

I was using self compiled firmware because of some patches but I think I am gonna wait for 19.xx version.