2

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

xperator
  • 457
  • 2
  • 12
  • 24
  • I haven't used Cacti for a while but I remember there's a "Debug mode" where you define the graphs. This tells you the command given to `rrdtool` and any error messages it returned. Probably click on one of the wrench icons in your screenshot and look for a link that says "Debug". There's also a Cacti log but this tends to be for the poller, not the front end. The php error log may also contain useful information. When you find some, add it to your question. – Ladadadada May 13 '12 at 19:23
  • You normally need the poller in a cron job. It's probably best to get that working first. You can check that it's working by using `rrdtool --dump` (I *think* that's the right option) on one of the `.rra` files. – Ladadadada May 13 '12 at 19:27
  • @Ladadadada Sorry but I have no Idea what rrdtool is and how it is related to cacti. I can't find any rra file. And I can't find Debug mode anywhere. I just wanted to have a monitoring app for checking my system's traffic usage, server load, etc... . Maybe cacti is not what I am looking for ? – xperator May 13 '12 at 19:57
  • 1
    [`rrdtool`](http://en.wikipedia.org/wiki/RRDtool) is used for dealing with round robin archives (RRA). RRA files are the "database" that Cacti stores the data in that it turns into the graphs. It should have been installed as a dependency of Cacti. Cacti does do what you want but its flaws are in configuration and error reporting. [Munin](http://munin-monitoring.org/) and [Zabbix](http://www.zabbix.com/) do similar jobs and have different flaws. You may find them easier to configure for your first time. – Ladadadada May 13 '12 at 20:09
  • Thanks a lot. I tried zabbix but couldn't manage to compile and install it properly. And munin was super easy. but it's web gui has no security. I will stick to Munin for now to see if it does what I want. – xperator May 13 '12 at 21:03

1 Answers1

2

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 
aseq
  • 4,610
  • 1
  • 24
  • 48
  • Thanks for reply I didn't know I should have set the snmp configs. What did you mean by "Your Location" ? Ip address ? I am setting cacti on my vps, So I guess it's remote. I used `127.0.0.1` for location anyway. and my real email address. and in `/etc/default/snmpd` I added `127.0.0.1` at the end of string. Then I went to cacti web gui, changed snmp settings to version 3. enter my user pass But when trying to save, I get `SNMP error`. here is what `syslog` is showing : ` ruleset=check_relay, arg1=localhost.localdomain, arg2=127.0.0.1, relay=localhost.localdomain [127.0.0.1], reject=451 4.3.0` – xperator May 16 '12 at 11:22
  • When I run `php poller.php` I get warnings and errors. And I think I am doing this completely wrong, both at cacti and snmp settings. If it's possible I would like to check every setting page in cacti with you. – xperator May 16 '12 at 15:48
  • With location I meant the place the server is located, it's just for informational purposes. If your cacti server and the snmp daemon that supplies it with data are both on the same server you can use 127.0.0.1 as the IP to poll data from. – aseq May 16 '12 at 18:15
  • Don't forget to use the IP address of the snmpd server in the hostname field. Make sure to check if the snmp daemon is actually running and listening to port 161 (use: nmap -sU -p 161 x.x.x.x). – aseq May 16 '12 at 18:27
  • Here is my whole `snmpd.conf` file : http://pastebin.com/Le3W7Jrs And my `snmpd`file : http://pastebin.com/tbaXpX26 And this is my Cacti device settings : http://i49.tinypic.com/a3p3cj.jpg and this is the output when I run `php poller.php` http://pastebin.com/8D7VVwGt And I have a firewall called csf, Do I need to allow that port 161 as ingoing or outgoing? Should I Run Nmap in the same server ? if yes what ip address should be used ? I am very grateful that you keep replying. – xperator May 16 '12 at 18:44
  • Your configurations look fine. I think it may just be that the snmpd can't be reached. Are both cacti and snmpd running on the same server? If not then use the IP address of the server that runs snmpd and make sure snmpd listens to the LAN interface. Make sure port 161 UDP is not blocked for incoming and outgoing traffic. Please test whether port 161 can be reached using the nmap command I showed. From the cacti server, whether snmpd is on the same server or another. It's a good way to test the port is open. – aseq May 17 '12 at 07:59
  • By the way the poller output you showed looks fine too, the errors there are not critical. And syslocation should be the place your server is located (i.e. New York) but it's not essential since it's for informational purposes only. – aseq May 17 '12 at 08:00
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/3469/discussion-between-xperator-and-aseq) – xperator May 17 '12 at 09:03