Download Video (989 KB)
SNMP is a communication specification that defines how management information is exchanged between network management applications and management agents.
Cacti is a resource monitoring software. It uses RRDtool to store data and the data is used create graphs. It also comes with fast poller to collect data from different resources simultaneously and has many user management features. The interface and management is very userfriendly that even a layman can get it working with less effort.
This video is about how to monitor Linux and Windows hosts with SNMP (2c version) Cacti. Video tutorial consists from 4 parts:
Part 1. Setup snmpd on Linux host (3:00 min)
Part 2. Setup snmp service on Windows host (3:01 min)
Part 3. Setup Cacti (5:29 min)
Part 4. Graphing Linux and Windows hosts (5:14 min)
Installation steps.
Part 1. Setup snmpd on Linux host:
- Enable diskio MIB module for net-analyzer/net-snmp to enable to graph I/O statistics:
- Install snmpd:
- snmpd is installed, and now I have to tweak it a little bit:
- If you want snmpd to listen on all interfaces, remove the 127.0.0.1:
- Configure snmpd:
- Start snmpd and add it to runlevel default:
- Test whether SNMP can read the system MIBs using the snmpwalk command:
echo net-analyzer/net-snmp diskio > /etc/portage/package.use
emerge -av net-snmp
vi /etc/conf.d/snmpd
SNMPD_FLAGS="${SNMPD_FLAGS} -Lsd -Lf /dev/null 127.0.0.1"
wget video4admin.com/stuff/snmpd.conf -O /etc/snmp/snmpd.conf
vi /etc/snmp/snmpd.conf
/etc/init.d/snmpd start && rc-update add snmpd default
snmpwalk -v 2c -c cacti_com 127.0.0.1 system
Part 2. Setup snmp service on Windows host:
- Install snmp service. Go to Start->Run and type:
- In list find Management and Monitoring Tools and click Details. In new window check Simple Network Management Protocol and press OK. Press Next to begin installation of snmp service.
- Configure snmp service. Go to Start->Run and type:
- In list find SNMP service and double-click on it. Go to Agent Tab, fill the Contact and Location boxes and check all Service checkboxes.
Go to Security Tab and edit the community name.
Optional: you can specify from what hosts your windows machine can accept SNMP packets. - Test snmp service. In video I test it from Gentoo box: read the system MIBs with snmpwalk command. Windows host ip is 172.16.50.179:
snmpwalk -v 2c -c cacti_com 172.16.50.179 system
appwiz.cpl @,2
This will open Add/Remove Windows Components Wizard.
services.msc
This will open System Services window.
Part 3. Setup Cacti:
- Install Cacti:
emerge -av cacti
webapp-config -I -h localhost -d cacti-dir cacti 0.8.6j-r6 - Create the new cacti database:
mysqladmin -p -u root create cacti_db
- Import the default cacti database:
mysql -p cacti_db</var/www/localhost/htdocs/cacti-dir/cacti.sql
- Create a MySQL username and password for cacti:
mysql -p -u root mysql
mysql> GRANT ALL ON cacti_db.* TO cacti_user@localhost IDENTIFIED BY 'cacti db password';
mysql> flush privileges;
mysql> quit - Edit cacti config file and modify the MySQL user, password and database for your cacti configuration:
vi /var/www/localhost/htdocs/cacti-dir/include/config.php
$database_default = "cacti_db";
$database_hostname = "localhost";
$database_username = "cacti_user";
$database_password = "cacti db password"; - Point your browser to the IP address of the cacti system like http://localhost/cacti-dir/
links http://localhost/cacti-dir/
Verify all settings and paths and finish the installation. Exit links.
- Verify poller functionality:
/usr/bin/php /var/www/localhost/htdocs/cacti-dir/poller.php
- Add poller line to /etc/crontab file:
vi /etc/crontab
*/5 * * * * apache /usr/bin/php /var/www/localhost/htdocs/cacti-dir/poller.php > /dev/null 2>&1
- Also make sure that the user apache that runs poller.php has permission to create new files in cacti's 'rra/' and 'log/' directory:
cd /var/www/localhost/htdocs/cacti-dir
ls -ald rra log
chown -R apache:apache rra/ log/
Part 4. Graphing Linux and Windows hosts:
- Go to main Cacti page and login as
Username: admin
Password: admin - Create devices (this will be Linux and Windows hosts):
Go to Management->Devices and select Add
Fill fields Description, Hostname and SNMP Community. Don't forget to select Host Template and SNMP Version. - Create graphs for Windows and Linux hosts:
In Devices click on new-created Devices and select Create Graphs for this Host.
You can follow instructions in video to graph Logged in Users, Processes, Disk Space on partitions, Virtual Memory, Physical Memory, Interface Statistics etc. - Optional. You can add grapths to default tree.
Go to Management->Graph Trees and select the Default Tree to edit it.
On Tree Items by selecting Add you can add items to this tree as shown in video. - You can view your new-created graphs by selecting the Graphs tab. In video you can see how the graphs changes after 1 hour.

August 29th, 2007 at 9:52 am
cool video tutorial even a noob in linux can follow this tutorial a do very advanced monitoring
,
thanks for your work and y think you will continue to write cool tutorials
September 6th, 2008 at 11:37 pm
thanx, this tutorial was really helpful to me. I am new with cacti and the video's made it really clear how to set up monitoring both linux and windows.
November 4th, 2008 at 7:27 pm
great.
but it has several gotchas that probably pure nob will not be able to resolve…
anyhow - thanks gents