Cacti Graphs for Apache Not Working? Check Your IPv6

I was wondering earlier why my Apache Cacti graphs were all graphing 0s. Looking to test manually, I see it’s either 0s or -1s like below.

[revin@forge ~]# /usr/bin/php -q /usr/share/cacti/scripts/ss_get_by_ssh.php --host xx.xx.xxx.xxx --type apache --items g1,g3
g1:-1 g3:-1

Looking at the Apache access log on the target server, I noticed Cacti was trying to connect to the IPv6 loopback address “::1”.

::1 - - [13/Oct/2012:22:00:02 -0400] "GET /server-status?auto HTTP/1.0" 403 290 "-" "Cacti/1.0"

Fortunately this was easy to fix, either disable IPv6 on Apache or allow access to /server-status via the IPv6 loopback address.

From your httpd.conf, you can disable IPv6 by changing the Listen directive to:

Listen 0.0.0.0:80

Or adding the below Allow directive for /server-status section:

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
</Location>

And voila!

[revin@forge ~]# /usr/bin/php -q /usr/share/cacti/scripts/ss_get_by_ssh.php --host 95.211.156.71 --type apache --items g1,g3
g1:83968 g3:6