Cacti is a system monitoring tool that uses rrdtool and made to be able and query SNMP-enabled hardware or services. The result is a platform that allows to write scripts and create graphs for various resources that are accessible from a web-based (apache) interface.
On Debian, one can install Cacti using the following commands:
aptitude install cacti snmp snmpd cacti-spine
which will download the necessary tools and set-up Cacti.
By default, this will create a file an apache alias in /etc/apache2/conf.d/cacti.conf
that will serve cacti from any URL served by Apache and by /cacti
. A good decision is to restrict that to the local network. In order to do so, we edit /etc/apache2/conf.d/cacti.conf
and encompass the configuration in an IP based virtual host by using the directives:
<VirtualHost 192.168.0.1:80> ... </VirtualHost>
The SNMP that ships with Debian Squeeze does not supply the MIB
files that are required for the snmpd
daemon to work. For that, we have to edit the apt
sources and add the non-free
term so we can pull the snmp-mibs-downloader
package.
Editing /etc/apt/sources.list
we append the term non-free
on every line. For example:
deb http://ftp.sv.debian.org/debian/ squeeze main non-free
This has to be done for every line.
Then, we update the sources:
aptitude update
and install snmp-mibs-downloader
. During the setup of the snmp-mibs-downloader
package, the necessary MIBs are downloaded.
Next, we edit /etc/default/snmpd
and comment out the MIBs line:
#export MIBS=
then, comment out the line:
#mibs :
in /etc/snmp/snmp.conf
.
Finally, to enable SNMP for the local host, we edit /etc/snmp/snmpd.conf
and enable the line:
rocommunity public localhost
Now we can start the snmpd
daemon by issuing:
service snmpd restart
We can query the SNMP server by issuing the command:
snmpwalk -v1 -cpublic localhost
if you get Cannot adopt OID
then track back and install the snmp-mibs-downloader
package. Otherwise, SNMP works fine.
To configure cacti, you can now log-in using a browser and pointing it to http://192.168.0.1/cacti
(assuming that 192.168.0.1
is the IP of the server you are installing Cacti on).
The default credentials when logging in the first time are:
username: admin password: admin
which will prompt you to change the password.
Next, make the following configuration changes to enable the spine
poller:
Now, we enable SNMP by following:
The order is important: setting SNMP version 2, will allow you to set the downed device detection to SNMP as well.
Now we can create new graphs by using SNMP. At the top, follow the Create Graphs for this Host
and you are ready to go.
The Cacti template section contains a full complement of templates that can be added.