Luci_statistics - collectd - rrd - not displaying graphs

Hi everyone,

I run into following issue when trying to display graphs from luci-app-statistics. I have browsed through forum topics but did not find a solution.

I am running OpenWrt 19.07.2 r10947-65030d81f3 on an x86 box.

Error message when trying to load a given graph, where XXX stands for plugin name, I get the error with every plugin:

Failed to execute call dispatcher target for entry '/admin/statistics/graph/XXX'.
The called action terminated with an exception:
/usr/lib/lua/luci/util.lua:221: attempt to get length of local 'str' (a nil value)
stack traceback:
	/usr/lib/lua/luci/util.lua:221: in function 'split'
	.../luci/controller/luci_statistics/luci_statistics.lua:124: in function <.../luci/controller/luci_statistics/luci_statistics.lua:114>
	(tail call): ?

The only thing I modified from out-of-box config is that I set a different directory than /tmp for the RRDTool plugin (/opt/wdir/rrd/, I can see that there is now a folder in there containing folders name after plugins, which contain an .rrd file).

I have checked through Luci that collectd and luci_statistics are started.

I also checked

ls /etc/rc*.d
K10collectd         S00sysfixtime       S19firewall         S80collectd
K10gpio_switch      S00urngd            S19mwan3            S80ucitrack
K50dropbear         S10boot             S20network          S94gpio_switch
K85odhcpd           S10system           S30adblock          S95done
K89log              S11sysctl           S35odhcpd           S96led
K90boot             S12log              S50cron             S98sysntpd
K90network          S12rpcd             S50sqm              S99sudo
K90sysfixtime       S19dnsmasq          S50uhttpd           S99urandom_seed
K90umount           S19dropbear         S79luci_statistics

The storage directory and all its parent directories are world readable (they are 755 all the way to the top). I am not storing anything on a USB drive, the x86 box has enough disk space on the SSD.

I have read the startup scripts, total newbie here, and only "weird" thing I have seen is that (no change from my side) /etc/init.d/collectd creates a collectd.conf link in /tmp to /etc/collectd.conf and that /etc/init.d/luci_statistics itself replaces /etc/collectd.conf with a link to /var/etc/collectd.conf.

Don't know in which order this is being done (from above luci_statistics starts first) but when I check, the links are indeed present and 777, so I guess this is being processed in the correct order upon startup and with correct permissions.

From what I have read, the error is likely related to read permissions but these seem to be correct so I am at loss.

Sorry I am quite new to Linux. If anyone has a clue they are willing to share I already express my gratitude.

The non-default directory and its permissions has been a typical reason for problems like you have. But you have checked the first obvious things.

That means that luci_statistics starts ok ( = configures collectd and starts it ok). collectd then monitors that given stats inputs and stores them in rrd database.

That should be enough to say that the init scripts work ok, but you could also use "rrdtool dump" to see the contents of some of those rrd files in order to see that they do contain data.

That would mean that this is not a collectd problem, but a LuCI display problem.

You could also test the directory thing by temporarily configuring to use the normal /tmp/rrd and see if that fixes things.

If I'd need to guess I'd say the RRATimespans option of /etc/config/luci_statistics is to blame. Make sure it uses space separated option notation (option RRATimespans '1hour 1day 1week 1month 1year') instead of uci list notation (list RRATimespans 1hour, list RRATimespans 1day, ...).


Thank you for your input. I looked in both /etc/config/luci_statistics and /var/etc/collectd.conf but could not find RATimespans; I only have this in /etc/config/luci_statistics:

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

You should have itemes like there:

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

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

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

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

config statistics 'collectd_csv'
        option enable '0'
        option StoreRates '0'
        option DataDir '/tmp'
...all the plugin configs...

Note this line in the collectd_rrdtool section:

option RRATimespans '1hour 1day 1week 1month 1year'


Thank you :slight_smile:

I tried:

rrdtool dump /opt/wdir/rrd/wrtx/memory/memory-free.rrd

and that yields several line of this kind:

	<!-- 2020-03-25 14:00:00 CET / 1585141200 --> <row><v> NaN </v></row>

So it would seem to work. I will try resetting the working directory to its default value.


All is OK except for collectd_rrdtool where only have this:

config statistics 'collectd_rrdtool'
	option enable '1'
	option DataDir '/opt/wdir/rrd'
	option RRASingle '1'

Should I just add the missing lines?

That defines the time periods used in the data storage, and right now you are missing those.

Hi, it works after having added those lines. I never touched this file and I am not savvy enough to be able to figure what went wrong during install.

Many thanks to you hnyman and to jow :smiley:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.