Debian with cacti 0.8.8a no graph

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
oneoneonepig
Posts: 7
Joined: Thu Feb 13, 2014 7:09 am
Location: TW

Debian with cacti 0.8.8a no graph

Post by oneoneonepig »

Hi everyone, I've issued a problem on viewing or maybe even generating graphs with rrdtool
I installed it with ' apt-get install cacti '
Apt-get also installed mysql, php packages as independents and configured the mysql password with dbconfig during installation
btw , I've installed apache2 and squirrelmail before cacti was installed.(maybe effects the installation?)

After installed cacti, all five default graphs displayed error with a small tiny ' X '
I've seen many documents saying about the permission of user ' cacti '
but also there is a user for the web daemon ' www-data '
I'm quite confused by those two user's permissions, some times www-data, some times cacti
and ' cacti ' doesn't even exist in /etc/passwd , only www-data exists in debian
All other configurations are set as default, nothing changed .

The cron command also confused me ..
# vim /etc/cron.d/cacti
*/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 >> /var/log/cacti/poller-error.log
Cause I'm only learning system administrating and networking,
programming, php, mysql ... not any concepts with them , maybe it's the biggest problem
Cacti is my first contact to php and mysql.

Here are the logfiles

1. ./cron
It doesn't seems wrong in the cron , but all the commands are highlighted in red
Feb 13 20:20:01 Debian7 /USR/SBIN/CRON[8958] : (www-data) CMD (php --define ...
all in red , but no errors

2. ./cacti/cacti.log
02/13/2014 08:32:01 PM - SYSTEM STATS: Time 0.1219 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:0 RRDsProcessed:0
all lines are approximately the same but the time

3. ./cacti/poller-error.log,rrd.log
both empty

4. ./apache2/error.log

ERROR: opening '/var/lib/cacti/rra/localhost_proc_7.rrd': No such file or directory
ERROR: opening '/var/lib/cacti/rra/localhost_load_1min_5.rrd': No such file or directory
ERROR: opening '/var/lib/cacti/rra/localhost_mem_buffers_3.rrd': No such file or directory
ERROR: opening '/var/lib/cacti/rra/localhost_load_1min_5.rrd': No such file or directory
ERROR: opening '/var/lib/cacti/rra/localhost_users_6.rrd': No such file or directory
ERROR: opening '/var/lib/cacti/rra/localhost_proc_7.rrd': No such file or directory
ERROR: opening '/var/lib/cacti/rra/localhost_mem_buffers_3.rrd': No such file or directory

these things shows every time I click something that show the graph

thanks for help, be free to ask requests for more informations or logs
rejnol
Posts: 6
Joined: Thu Feb 13, 2014 2:05 am

Re: Debian with cacti 0.8.8a no graph

Post by rejnol »

Hi
Probably, you have established wrong permission for the folder /patch_to_cacti_folder/rra. Are there any rrd-files in this folder?
oneoneonepig
Posts: 7
Joined: Thu Feb 13, 2014 7:09 am
Location: TW

Re: Debian with cacti 0.8.8a no graph

Post by oneoneonepig »

Nope , /rrd contains nothing
I think that's why we got errors in error.log
I think it's permission is 770 for user root and group www-data .
rejnol
Posts: 6
Joined: Thu Feb 13, 2014 2:05 am

Re: Debian with cacti 0.8.8a no graph

Post by rejnol »

Please check the Settings->Paths page. You should specify correct path for each tools.
maybe your cron is not working. Check "ps axw | grep cron".

1. Create user "my_cacti_user". - adduser my_cacti_user
2. use this line in cron "*/5 * * * * my_cacti_user php /usr/share/cacti/site/poller.php 2>&1 >/dev/null". hmm, "/usr/share/cacti/site/poller.php" is correct path?
3. make permissions on the log and rra directories
chown -R my_cacti_user rra log
chmod 775 rra log
oneoneonepig
Posts: 7
Joined: Thu Feb 13, 2014 7:09 am
Location: TW

Re: Debian with cacti 0.8.8a no graph

Post by oneoneonepig »

Here you go

# ls -d /var /var/lib /var/lib/cacti /var/lib/cacti/rra
drwxrwxrwx 12 root root 4096 Feb 10 14:03 /var
drwxrwxrwx 39 root root 4096 Feb 14 12:36 /var/lib
drwxr-xr-x 3 root root 4096 Feb 14 12:36 /var/lib/cacti/
drwxrwx--- 2 root www-data 4096 Aug 29 03:16 /var/lib/cacti/rra/
oneoneonepig
Posts: 7
Joined: Thu Feb 13, 2014 7:09 am
Location: TW

Re: Debian with cacti 0.8.8a no graph

Post by oneoneonepig »

I think the paths are right, all paths have a [OK: FILE FOUND] below
except Alternate Poller Path, it has [ERROR: FILE NOT FOUND], but I'm not using spine as poller.
Cron was good
# ps aux | grep cron
root 2234 0.0 0.1 3840 1004 ? Ss 12:30 0:00 /usr/bin/cron
root 8365 0.0 0.1 3556 784 tty1 S+ 14:36 0:00 grep cron


# useradd my_cacti_user
# vim /etc/cron.d/cacti
MAILTO=root
*/5 * * * * my_cacti_user php /usr/share/cacti/site/poller.php 2>&1 >/dev/null
# chown -R my_cacti_user /var/lib/cacti/rra
# chmod 775 /var/lib/cacti/rra
# chown -R my_cacti_user /var/log/cacti
# chmod 775 /var/log/cacti
# ls -d /var/lib/cacti/rra/ /var/log/cacti

drwxrwxr-x 2 my_cacti_user www-data 4096 Aug 29 03:16 /var/lib/cacti/rra/
drwxrwxr-x 2 my_cacti_user www-data 4096 Feb 14 12:37 /var/log/cacti/

But after that I've got mail for root that contains errors for php

PHP Warning: include(/etc/cacti/debian.php): failed to open stream: Permission denied in /usr/share/cacti/site/include/global.php on line 49
PHP Warning: include(): Failed opening '/usr/share/cacti/site/include/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/cacti/site/include/global.php on line 49
PHP Warning: mysql_pconnect(): Access denied for user 'cactiuser'@'localhost' (using password: YES) in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Access denied for user 'cactiuser'@'localhost' (using password: YES) in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Access denied for user 'cactiuser'@'localhost' (using password: YES) in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Access denied for user 'cactiuser'@'localhost' (using password: YES) in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383

I still don't get any graphs shown.
Here are the variable parts in /etc/cacti/debian.php
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "BpWvqeLL7D3H";
$database_port = "";
$database_ssl = false;


Does those effects anything ?
paulgevers
Cacti Pro User
Posts: 613
Joined: Tue Aug 29, 2006 4:09 pm
Location: NL

Re: Debian with cacti 0.8.8a no graph

Post by paulgevers »

oneoneonepig wrote: 2. ./cacti/cacti.log
02/13/2014 08:32:01 PM - SYSTEM STATS: Time 0.1219 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:0 RRDsProcessed:0
all lines are approximately the same but the time
Now, this is the important line. It says DataSources: 0 RRDsProcessed: 0.

I think you need to "Rebuild Poller Cache" in "System Utilities".

Please let me know if this solves your problem. I thought the Debian package did this properly on install.

And please read the doc in signature about the differences between the Debian package and most of the help and forum texts that you find when you use google. In your case: Debian uses www-data instead of cacti as user.
Maintainer of cacti in Debian (and Ubuntu).
Cacti 1.* is now officially supported on Debian Stretch via Debian backports
FAQ Ubuntu and Debian differences
Generic cacti debugging
oneoneonepig
Posts: 7
Joined: Thu Feb 13, 2014 7:09 am
Location: TW

Re: Debian with cacti 0.8.8a no graph

Post by oneoneonepig »

oh I see ... www-data means cacti in debian
But don't we need to change the database_username to www-data in debian.php ?
I've tried it before but it doesn't work.
Here are the procedure, I changed them back to default


System: Debian 7.1.0
Version: Cacti 0.8.8a

# apt-get remove --purge cacti
# apt-get autoremove
# userdel my_cacti_user (the one I've made before)
# apt-get install cacti
"System Utilities" > "Rebuild Poller Cache" > "Localhost - Load Average" > "save"


Oh ... Graphs appear !!!
How did that happened ??

Here are some new logs and messages

#tail -n5 /var/log/cacti/cacti.log
02/16/2014 11:33:02 AM - AUTH LOGIN: User 'admin' Authenticated
02/16/2014 11:35:01 AM - SYSTEM STATS: Time:0.1128 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:0 RRDsProcessed:0
02/16/2014 11:40:02 AM - SYSTEM STATS: Time:0.2392 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
02/16/2014 11:45:01 AM - SYSTEM STATS: Time:0.1624 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5

#tail -n5 /var/log/cacti/poller-error.log
PHP Strict Standards: Only variables should be passed by reference in /usr/share/cacti/site/lib/ping.php on line 382
PHP Strict Standards: Only variables should be passed by reference in /usr/share/cacti/site/lib/ping.php on line 382
PHP Strict Standards: Only variables should be passed by reference in /usr/share/cacti/site/lib/ping.php on line 382
PHP Strict Standards: Only variables should be passed by reference in /usr/share/cacti/site/lib/ping.php on line 382
PHP Strict Standards: Only variables should be passed by reference in /usr/share/cacti/site/lib/ping.php on line 382

#ls /var/lib/cacti/rra
drwxrwx--- 2 root www-data 4096 Feb 16 11:45 .
drwxr-xr-x 3 root root 4096 Feb 16 11:31 ..
-rw-r--r-- 1 www-data www-data 141488 Feb 16 11:50 localhost_load_1min_5.rrd
-rw-r--r-- 1 www-data www-data 47840 Feb 16 11:50 localhost_mem_buffers_3.rrd
-rw-r--r-- 1 www-data www-data 47840 Feb 16 11:50 localhost_mem_swap_4.rrd
-rw-r--r-- 1 www-data www-data 47840 Feb 16 11:50 localhost_proc_7.rrd
-rw-r--r-- 1 www-data www-data 47840 Feb 16 11:50 localhost_users_6.rrd

# tail -n5 /var/log/cron.log
# (these commands are still highlighted by red, maybe some error, but no error message, only highlighted)
Feb 16 11:39:01 Debian7-2 /USR/SBIN/CRON[12953]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)
Feb 16 11:40:01 Debian7-2 /USR/SBIN/CRON[12962]: (www-data) CMD (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 >> /var/log/cacti/poller-error.log)
Feb 16 11:45:01 Debian7-2 /USR/SBIN/CRON[13233]: (www-data) CMD (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 >> /var/log/cacti/poller-error.log)
Feb 16 11:50:01 Debian7-2 /USR/SBIN/CRON[13482]: (www-data) CMD (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 >> /var/log/cacti/poller-error.log)
Feb 16 11:55:01 Debian7-2 /USR/SBIN/CRON[13654]: (www-data) CMD (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 >> /var/log/cacti/poller-error.log)


I've read the official manual documents, but can't really connect them to debian's environment.
I think apt-get tool integrated them too well.
Thanks for the help, @paulgevers and @rejnol
Thanks you for all your assistance.

btw, could you explain why can't cacti generate graphs without any actions by default,
why do we NEED to rebuild the caches ?
I really appreciate for your help.
paulgevers
Cacti Pro User
Posts: 613
Joined: Tue Aug 29, 2006 4:09 pm
Location: NL

Re: Debian with cacti 0.8.8a no graph

Post by paulgevers »

oneoneonepig wrote:oh I see ... www-data means cacti in debian
But don't we need to change the database_username to www-data in debian.php ?
No, because you can choose that freely. The database can even be on another server with pre-configured user.
# tail -n5 /var/log/cron.log
# (these commands are still highlighted by red, maybe some error, but no error message, only highlighted)
I didn't know tail could highlight things. And I for sure have now clue what it decides to highlight. I guess it might be triggering on some regular expression, but the log looks normal.
btw, could you explain why can't cacti generate graphs without any actions by default,
why do we NEED to rebuild the caches ?
Well, I fixed it. So probably in a later version. There was a (closed) bug about this. Seems like you are caught by a the fact that Debian stable (of course) is somewhat behind the latest bug fixes.
Maintainer of cacti in Debian (and Ubuntu).
Cacti 1.* is now officially supported on Debian Stretch via Debian backports
FAQ Ubuntu and Debian differences
Generic cacti debugging
oneoneonepig
Posts: 7
Joined: Thu Feb 13, 2014 7:09 am
Location: TW

Re: Debian with cacti 0.8.8a no graph

Post by oneoneonepig »

oh it's not the tail command that made it highlighted
I tail it then redirected it so I can past it here.
I've uncommented the "syntax on" in /etc/vim/vimrc
I actually saw it highlighted in red when I vim /var/log/cron.log
Lots and lots of bright red lines

I see ... at lease we got a way to fix it
Maybe it's the different between 0.8.8a and 0.8.8b ?

Now I'm working on adding cisco 2811 graph to cacti,
and it doesn't work right with normal procedure I found online
I'll keep testing with that .

Thanks anyway
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests