Always wanted to know how your ISP monitor server traffic? Then this document will be interesting for you. In this document I will guide you to configure a SNMP host and graphics using Cacti. You will need at least one clean Debian Lenny server (minimal install preferred).
You need root privileges to start with. Now login to your server using either SSH or KVM. After logging in you ready to go!
What are we going to install?
SNMPd and Cacti do also require a webserver with PHP support. MySQL server will also be installed as this is the database engine where Cacti will save it’s statistics. We will use aptitude to install these packages. It will also install some dependencies (if not installed by default). But don’t worry, aptitude will install them for you.
To begin the installation just type:
apt-get update ; apt-get install snmpd cacti
On a fresh installed Debian machine this will install the following packages all together:
apache2 apache2-mpm-prefork apache2-utils apache2.2-common bsd-mailx cacti dbconfig-common defoma exim4 exim4-base exim4-config
exim4-daemon-light file fontconfig fontconfig-config libapache2-mod-php5 libapr1 libaprutil1 libcairo2 libdatrie0 libdb4.5 libdbd-mysql-perl
libdbi-perl libdirectfb-1.0-0 libexpat1 libfontconfig1 libfontenc1 libfreetype6 libglib2.0-0 libglib2.0-data libhtml-template-perl
liblockfile1 libmagic1 libmysqlclient15off libnet-daemon-perl libpango1.0-0 libpango1.0-common libpcre3 libperl5.10 libphp-adodb
libpixman-1-0 libplrpc-perl libpng12-0 libpq5 librrd4 libsensors3 libsnmp-base libsnmp15 libsqlite3-0 libsysfs2 libterm-readkey-perl
libthai-data libthai0 libts-0.0-0 libxcb-render-util0 libxcb-render0 libxfont1 libxft2 libxml2 libxrender1 mailx mime-support
mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 openssl openssl-blacklist perl perl-modules php5-cli php5-common php5-mysql
php5-snmp psmisc python python-minimal python2.5 python2.5-minimal rrdtool sgml-base snmp snmpd ssl-cert ttf-dejavu ttf-dejavu-core
ttf-dejavu-extra ucf x-ttcidfont-conf xfonts-encodings xfonts-utils xml-core
While installing you will see these dialog’s asking your input.
The first one will be request for a new MySQL password.
Next simply retype the MySQL password you just configuered.
The third screen will warn you that the PHP include path is going to be changed. Just hit enter as there is no other option.
The next dialog will ask you for which webserver application you would like to install Cacti. Choose for Apache2 in here and hit enter.
Choose yes when promted that Cacti needs a database.
Enter the MySQL password to allow Cacti to use MySQL as database engine
Next it will ask for a Cacti account password for the database. In this case we just use the MySQL password as you have entered earlier.
Now you need to re-enter the password you just assigned to the Cacti database account.
If you read:
Creating config file /etc/cacti/apache.conf with new version
Reloading web server config: apache2.
Congratulations, the installation has been finished. We can start to configure SNMP and Cacti.
What to do if the installation fails?
In that case, please check this document step by step again. I’m sure you did, but you might have made a mistake. If you really sure that this is not the problem. Please check which packages are already installed. We can’t help you with that for now. Therefore you will need to dig deeper into your system. As suggested in this post before you will need a clean Debian 5 (Lenny) server. Also check your /etc/apt/sources.list for correct repositories. If all won’t help, please leave a comment below this page.
Configuring SNMPd
There are two files that needs to be modified. The first one is the SNMPd server configuration file. To make it all simple you just need to modify 1 line in this huge nasty file.
nano /etc/snmp/snmpd.conf
Look for the line that reads:
com2sec paranoid default public
Change this to:
com2sec readonly default public
Save and exit nano (Ctrl + X answer with “y” then
Next, we need to modify the SNMPd options for the start file to allow other computers to read the SNMP data from this server. If only this local machine needs to collect the data you can skip this step. In other case just open:
nano /etc/default/snmpd
You will find a line ending with “127.0.0.1″ like:
SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1′
Remove the 127.0.0.1 part so it read:
SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid’
Save and exit nano
To activate the new configuration:
/etc/init.d/snmpd restart
Setting up Cacti
First we make a cronjob for Cacti’s poller. This poller tool is used to collect data from every SNMP host that is configured in Cacti. We need to run this cronjob every 5 minutes. To do so:
crontab -e
Add the following line to crontab:
*/5 * * * * /usr/bin/php /usr/share/cacti/site/poller.php
Save and exit crontab (Ctrl + X “y” then
Now where done with the CLI part. You can leave the shell and start a browser. Enter the IP address of your server (for a local machine enter: 127.0.0.1 as IP address) http://ip.ad.dr.ess/cacti/install/
If there is no description above a screenshot, then you can follow to arrows.
We choose a new installation and hit next:

Everything should be alright by default. Hit the “Finnish” button:

Enter the default username and password (user: admin password: admin):

Change the admin password to your private password:

Please take over all the form details into your cacti. Of course, you can specify a remote IP if SNMPd is installed on a remote server:

Select (SNMP – Interface statistics) from the drop down menu. Then click on the “Add” button

Verify “Success” as shown in the circle. Click the “Create Graphs for this Host” link to configure the graphics:

On this screen choose your network adapter with your local or remote IP. (On this test host we used OpenVZ server software therefore it might look different in your screen/setup). Next select in the drop down menu to option with te green marker (In/Out Bits with 95th Percentile) and continue with “Create”:

Graphs succesfully created. Click the menu item as shown below:

Select “Host” in “Tree Item Type” and click “Create” to continue:

Click on Graphs to open the graphs, then click on the Default Tree (your host) to open the graphics:

Since we created the graph just a few second ago, it will take cacti some time to collect data. Every 5 minutes the graphs will be updated. However, it will take a few days to create a good looking graph like the one below:
That’s it for now. Congratulations, you now have a successfull Cacti SNMP server configured.
If you have any questions related to this topic, please leave your comments.
















