Nginx – Cacti doesn’t show graph

cactidebiangraphnginx

Installed on Debian 6 – 64bit. Webserver : Nginx

Here is what I did so far:

  1. apt-get install cacti and apt-get install snmpd
  2. chmod 644 /etc/cacti/debian.php
  3. Set date.timezone in php.ini
  4. Added extension=gd.so in php.ini
  5. Tried running php poller.php

enter image description here

Best Answer

Assuming cacti has been set up correctly, which it should since you used apt-get et al, you could use snmp to get graphs, then configure cacti to poll the snmp daemon. This is a procedure I use to set up a host to be monitored by cacti. This can be a localhost or a remote server.

apt-get install snmp snmpd libsnmp9-dev
mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_old
echo 'syslocation "Your location"'   > /etc/snmp/snmpd.conf
echo 'syscontact email@example.com' >> /etc/snmp/snmpd.conf
/etc/init.d/snmpd stop
net-snmp-config --create-snmpv3-user -ro -a "passWORD" username
/etc/init.d/snmpd start

For snmpd to listen on anything else besides 127.0.0.1 edit /etc/default/snmpd. Assuming the LAN ip of the server is 10.11.11.2

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 10.11.11.2'

Restart:

/etc/init.d/snmpd restart

Now on the cacti web interface you add the host with IP 10.11.11.2. Use following settings, these can be changed of course by changing above commands accordingly:

Hostname: 10.11.11.2
SNMP Username (v3): username you gave above
SNMP Password (v3): password you gave above
SNMP Version: Version 3
SNMP Auth Protocol (v3): MD5
SNMP Privacy Passphrase (v3): leave empty
Choose the SNMPv3 Authorization Protocol: none
SNMP Port: 161

Save and configure the rest the way you want. The host information from devices menu should show you information it got from the snmpd server under "SNMP Information", such as uptime and hostname as well as location.

You can check logs (/var/log/syslog) on snmpd server whether cacti is polling, it shows up like this (UDP traffic), assuming cacti server has IP 10.11.11.11:

May 11 06:28:59 example snmpd[1881]: Connection from UDP: [10.11.11.11]:56247->[10.11.11.2]

Update: for the template you can create something like this, call it "Linux_server" if you want. This is just what I use, but you may have different requirements:

Associated Graph Templates
1) Host MIB - Logged in Users 
2) ucd/net - CPU Usage 
3) ucd/net - Load Average 
4) ucd/net - Memory Usage 

Associated Data Queries
1) SNMP - Get Mounted Partitions 
2) SNMP - Get Processor Information 
3) SNMP - Interface Statistics