Openwrt Collectd.conf not stable


I am using collectd.conf for last one year for sending metrics to remote server . Everything works great. But sometimes when I reboot or poweroff the device, collectd.conf changing to old content. How resolve this issue?

Where is it stored? I hope not under /tmp ...

no, it is stored in /etc/collectd.conf. But /etc/collectd.conf softlinked with /var/etc/collectd.conf

rm -rf /etc/collectd.conf ; cp /var/etc/collectd.conf /etc/collectd.conf ;

I will check and let you know, Thanks !!

It's the same...

root@xeli:~# ls -la /var
lrwxrwxrwx    1 root     root             3 Jan 30 13:21 /var -> tmp

yes, both tmp and var are same.I delete /etc/collectd.conf and copy from /var/etc/collectd.conf. Then I updated the file. Then poweroff. Again it went to its old content.

I don't have collectd to check what the init script does. But maybe it is using config from /etc/config/collectd to create the file?
The /etc/collectd.conf is again symlink to /var/etc/collectd.conf after the reboot?

1 Like

No, there is no /etc/config/collectd file. init script just calling its collectd process from /usr/sbin/collectd .

Yes, It got symlinked again after reboot/poweroff. So because of /var/etc/collect.conf file, /etc/collectd.conf getting overwritten.

I removed simlink between both the files, updated /etc/collectd.conf, still it changing to its old content.

It is very confusing that from where old files getting written to /etc/collectd.conf, where old content gets stored? Is it due to /tmp folder?

It is unlikely due to /tmp/ as for most devices in standard configuration, it is a memory-backed file system. Turn off the power or reboot, it gets wiped.

Here's a couple commands that might help -- I've showed then with opkg.conf as I don't have collectd.conf on my router. The argument after -name is in single quotes out of habit as find will also take "globs" like '*.conf' which do need to be in quotes so it is find that checks them, not the shell

root@OpenWrt:~# find / -name 'opkg.conf' -exec ls -l {} \;
-rw-r--r--    1 root     root           108 Apr 13 22:53 /etc/opkg.conf
-rw-r--r--    1 root     root           108 Apr 13 22:53 /rom/etc/opkg.conf

root@OpenWrt:~# find / -name 'opkg.conf' -exec md5sum {} \;
8cbc24aad7706b74356246612a3860ad  /etc/opkg.conf
8cbc24aad7706b74356246612a3860ad  /rom/etc/opkg.conf

One copy in the ROM and where it is expected to be is "normal". Te second one, md5sum, gives you a checksum that lets you quickly tell if two files are the same, or are almost certainly different (even by one character).


Thanks for the reply guys, I will check once and will let you know !

luci_statistics creates its own config for collectd when it starts, like vgaetera links above. That will overwrite the existing one. A likely reason for you.

If you want to use collectd for other purposes than LuCI stats displays, just remove luci_statistics (or disable it in the service config).

Note that you can also set the collectd remote server network config in the LuCI statistics config, so if that is the only incompatibility, you can do that config and continue to also have that LuCI stats.

Statistics / Setup / Output plugins / Network
(settings get stored in /etc/config/luci_statistics)


As @hnyman said, it is due to luci_statistics file. I was trying to change hostname and server address. I just changed the content of the /etc/init.d/luci_statistics file and added hostnama and server address to /etc/config/luci_statistics file. Now everything works as excpectd!! Thanks Guys.

1 Like

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