- Check out System Utilities, View Cacti Log files
- Check rrd file exists /var/lib/cacti/rra/
- Check content of the rrd file /usr/bin/rrdtool info /var/lib/cacti/rra/localhost_time_26.rrd
- Check that your perl script is working correctly
- Check which user is running crontab root@raspberrypi:/var/lib/cacti# more /etc/cron.d/cacti MAILTO=root */5 * * * * www-data php –define suhosin.memory_limit=512M /usr/share/cacti/site/poller.php 2>&1 >/dev/null | if [ -f /usr/bin/ts ] ; then ts ; else tee ; fi >
- Changing crontab user www-data to root resolved my issue
- Check /var/log/cacti/poller-error.log
- Check that output is correctly shown in the cacti.log
Log File [Total Lines: 70 – All Items Shown] |
12/31/2018 01:32:06 AM – SYSTEM STATS: Time:4.8849 Method:cmd.php Processes:2 Threads:N/A Hosts:2 HostsPerProcess:1 DataSources:16 RRDsProcessed:11 |
12/31/2018 01:32:06 AM – CMDPHP: Poller[0] Time: 1.9014 s, Theads: N/A, Hosts: 1 |
12/31/2018 01:32:06 AM – CMDPHP: Poller[0] Host[1] DS[25] CMD: perl /usr/share/cacti/site/scripts/cpu_temp.pl, output: 52 |
12/31/2018 01:32:06 AM – CMDPHP: Poller[0] Host[1] DS[22] CMD: perl /usr/share/cacti/site/scripts/query_unix_partitions.pl get used /dev/mmcblk0p1, output: 22541 |
12/31/2018 01:32:06 AM – CMDPHP: Poller[0] Host[1] DS[22] CMD: perl /usr/share/cacti/site/scripts/query_unix_partitions.pl get available /dev/mmcblk0p1, output: 21679 |
12/31/2018 01:32:06 AM – CMDPHP: Poller[0] Host[1] DS[21] CMD: perl /usr/share/cacti/site/scripts/query_unix_partitions.pl get used /dev/root, output: 5292472 |
12/31/2018 01:32:06 AM – CMDPHP: Poller[0] Host[1] DS[21] CMD: perl /usr/share/cacti/site/scripts/query_unix_partitions.pl get available /dev/root, output: 8914312 |
There are two main „process“ with cacti.
1/ Running the website.
This is frequently done with the user „www-data“ or „apache“ running the Apache daemon
2/ Running the poller with a task in the crontab.
The poller updates the rrd files in rra/
when you install cacti with an apt-get (which splits dirs in 4 places, i’m not mentionning /etc/cacti here) notice:
– /var/log/cacti/ contains log files owned by www-data:www-data, the dir is given: drwxr-xr-x rights
– /usr/share/cacti/ contains the website files owned by root:root, the dir is given: drwxr-xr-x rights
– /var/lib/cacti/rra/ contains rrd files owned by root:www-data, the dir is given: drwxrwx— rights
– /etc/cron.d/cacti (the cron script), uses www-data user to run the poller which perfectly makes sense then.
If you install cacti „manually“ (using apt-get, aptitude, yum, yast or whatever for the LAMP but building cacti form sources), the apache user will be www-data or apache, the webserver rootdir will probably be /var/www/ and the correct user rights will be given to the apache user on that dir.
Then you can run the poller with either www-data or cactiuser but you’ll have to allow this user to Read/Write in rra/.
In short :
– rra/ has to be writable for the user running cron, and readable by the user running apache
– logs/ has to be writable for both users (cacti does some logging too), because both users have to write in that dir, you have to make sure the user running cacti and the user running apache are in the same group. using www-data for the polling is probably the most convenient way to do that.
Hope this helps.
My configuration:
root@raspberrypi:/etc# ls -ltr /usr/share/cacti/site/scripts/cpu_temp.pl
-rwxr-xr-x 1 pi pi 170 Jan 3 22:19 /usr/share/cacti/site/scripts/cpu_temp.pl
root@raspberrypi:/etc# more /usr/share/cacti/site/scripts/cpu_temp.pl
!/usr/bin/perl
open(PROCESS, „/usr/bin/vcgencmd measure_temp | /usr/bin/cut -c 6-7|“);
$output = ;
close(PROCESS);
chomp($output);
print „temp:“;print $output;
root@raspberrypi:/etc# /usr/share/cacti/site/scripts/cpu_temp.pl
temp:51
Sources: