Cacti Network Management Installation Tutorial

Cacti Network Management Installation Tutorial

Cacti Nms

Cacti Network Management Installation Tutorial

Network management has to be, one of the most neglected pieces of networking. I am sure we all have our hypotheses as to why but that is for another day. This tutorial is for installing the latest stable release 0.8.8a, released on 04/29/12. I needed to proof Cacti and get a scripted installation together. Cacti has been around a long time and has a nice ecosystem of plugins. Like any open source there is much more code then documentation. That said, the Cacti community forum is fantastic and full of community contributions. I tested the installation on both current CentOS and RHEL. It could be easily ported to Ubuntu s/yum/apt-get/g.

Cacti Network Management Plugins

Here are some supported and user built plugins part of this install.

  • Discovery – Auto Host Discovery
  • Mactrack – End Device Port Tracker and General Network Toolkit
  • Monitor – Monitoring for Cacti
  • Realtime – Realtime Graph Viewer
  • Routerconfigs – Router Config Backup
  • Syslog – Sylog Viewer for Cacti
  • Weathermap – Generate maps and diagrams using data collected by Cacti or other sources

Examples of Cacti

A couple of my friends in have some public examples of similar Cacti network management deployments using the Weathermap plugin for Cacti.

Cacti Installation ScreenCast

Cacti Network Management Installation Script

I started writing my own script from the doc and realized I needed better documentation. Poking around on the forum I found a nice script that had already done most of the work on the forums. I modified it for the latest releases, modified a couple of PHP configs and updated a couple of plugins.

#!/bin/sh
# Testing script for install cacti 0.8.7i and spine 0.8.7i on Centos Linux Release 6.x
# Version : 1.0.4
# Make by Patrick.Ru @ China
# E-Mail : patrick.ru@hotmail.com
# Date : 28-Dec-2011
# Thanks to Patrick Ru of China for posting this script.
# I modified the script add the latest version 0.8.8a, released 04/29/12.
# Along with updating a couple plugins and 
# changing the php config at the end s//g -Brent Salisbury
chkconfig iptables off
service iptables stop
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
/usr/sbin/setenforce 0
yum update -y
yum install -y wget
mkdir -p /usr/src/cacti
cd /usr/src/cacti
yum install -y httpd
chkconfig httpd on
service httpd start
yum install -y mysql-server
chkconfig mysqld on
service mysqld start
mysqladmin -u root password dbadmin
yum install -y php php-gd php-mysql php-cli php-ldap php-snmp php-mbstring php-mcrypt
service httpd restart
yum install -y rrdtool
yum install -y net-snmp-utils
yum install -y tftp-server
chkconfig xinetd on
service xinetd start
wget http://www.cacti.net/downloads/cacti-0.8.7i-PIA-3.1.tar.gz
tar zxvf cacti-0.8.7i-PIA-3.1.tar.gz
wget http://www.cacti.net/downloads/patches/0.8.7i/settings_checkbox.patch
cd cacti-0.8.7i-PIA-3.1
yum install -y patch
patch -p1 -N < ../settings_checkbox.patch
cd ..
mv -f cacti-0.8.7i-PIA-3.1/* /var/www/html/
rm -rf cacti-0.8.7i-PIA-3.1
chown -R apache:apache /var/www/html/
service httpd restart
mysql -u root -pdbadmin -e 'CREATE DATABASE cacti DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql -u root -pdbadmin -e "CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';"
mysql -u root -pdbadmin -e 'GRANT ALL PRIVILEGES ON cacti . * TO 'cactiuser'@'localhost';'
mysql -u cactiuser -pcactiuser cacti < /var/www/html/cacti.sql
cat > /etc/cron.d/cacti <<EOF
*/5 * * * * apache /usr/bin/php /var/www/html/poller.php > /dev/null 2>&1
EOF
yum install -y gcc gcc-c++ make automake patch libtool net-snmp-devel openssl-devel mysql mysql-devel
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7i.tar.gz
tar zxvf cacti-spine-0.8.7i.tar.gz
cd cacti-spine-0.8.7i
./configure
make && make install
cp /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf
cd /usr/src/cacti
wget http://docs.cacti.net/_media/plugin:settings-v0.71-1.tgz -O settings.tgz
tar zxvf settings*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/settings
wget http://docs.cacti.net/_media/plugin:clog-v1.7-1.tgz -O clog.tgz
tar zxvf clog*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/clog
wget http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz -O thold.tgz
tar zxvf thold*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/thold
wget http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz -O monitor.tgz
tar zxvf monitor*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/monitor
wget http://docs.cacti.net/_media/plugin:realtime-v0.5-1.tgz -O realtime.tgz
tar zxvf realtime*.tgz -C /var/www/html/plugins
mkdir -p /var/www/html/plugins/realtime/cache
chown -R apache:apache /var/www/html/plugins/realtime
yum install -y unzip
wget http://www.network-weathermap.com/files/php-weathermap-0.97a.zip
unzip php-weathermap-0.97a.zip -d /var/www/html/plugins/
chown -R apache:apache /var/www/html/plugins/weathermap
wget http://docs.cacti.net/_media/plugin:mactrack-v2.9-1.tgz -O mactrack.tgz
tar zxvf mactrack*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/mactrack
wget http://docs.cacti.net/_media/plugin:syslog-v1.22-2.tgz -O syslog.tgz
tar zxvf syslog*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/syslog
wget http://docs.cacti.net/_media/plugin:routerconfigs-v0.3-1.tgz -O routerconfigs.tgz
tar zxvf routerconfigs*.tgz -C /var/www/html/plugins
mkdir -p /var/www/html/plugins/routerconfigs/backups
chown -R apache:apache /var/www/html/plugins/routerconfigs
wget http://docs.cacti.net/_media/plugin:docs-v0.4-1.tgz -O docs.tgz
tar zxvf docs*.tgz -C /var/www/html/plugins
mv -f /var/www/html/plugins/docs* /var/www/html/plugins/docs
chown -R apache:apache /var/www/html/plugins/docs
wget http://nchc.dl.sourceforge.net/project/cacti-reportit/cacti-reportit/reportit_v073/reportit_v073.tar.gz -O reportit.tar.gz
tar zxvf reportit*.tar.gz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/reportit
wget http://docs.cacti.net/_media/plugin:rrdclean-v0.41.tgz -O rrdclean.tgz
tar zxvf rrdclean*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/rrdclean
wget http://docs.cacti.net/_media/plugin:discovery-v1.5-1.tgz -O discovery.tgz
tar zxvf discovery*.tgz -C /var/www/html/plugins
chown -R apache:apache /var/www/html/plugins/discovery
if [ "$HOSTTYPE" == "x86_64" ]; then
wget http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/wmi-1.3.14-2.el6.art.x86_64.rpm
rpm -Uvh wmi-1.3.14-2.el6.art.x86_64.rpm
elif [ "$HOSTTYPE" == "i386" ]; then
wget http://www6.atomicorp.com/channels/atomic/centos/6/i386/RPMS/wmi-1.3.14-2.el6.art.i686.rpm
rpm -Uvh wmi-1.3.14-2.el6.art.i686.rpm
fi
wget http://svn.parkingdenied.com/CactiWMI/trunk/wmi.php -O /var/www/html/scripts/wmi.php
chown -R apache:apache /var/www/html/scripts/wmi.php
service httpd restart

The Cisco Catalyst 6500 template I used for the screencast can be downloaded here. Simply copy and paste it into the templates section and then associate it to the 6500 you populate. Check the forums for more templates.

Post Installation and Plugins

If you have issues with RHEL you may need to run the following.

php -q /var/www/html/cli/rebuild_poller_cache.php

Enable plugins under settings -> Management as shown in the following screen capture. Just click the blue down arrow to add it into the console as tab.


Cacti Plugins

So checkout the forums if interested and see if any of the project can help your operations, maybe even contribute what you do back.
Thanks for stopping by.


About the Author

Brent SalisburyBrent Salisbury works as a Network Architect, CCIE #11972. He blogs at NetworkStatic.net with a focus on disruptive technologies, that have a focus on operational efficiencies. Brent can be reached on Twitter @NetworkStatic.View all posts by Brent Salisbury →

  1. sh0xsh0x12-03-2012


    A few additional “must have” plugins (for larger deployments): boost, dsstats, and autom8!

  2. Brent SalisburyBrent Salisbury12-03-2012


    Thanks will add that in! Have you used the netflow module before?

  3. Nick BuraglioNick Buraglio12-03-2012


    This is amazing. I’d done this years ago and promptly forgotten all the pieces and parts. After 30 minutes of tinkering and this script, I have a complete graphing setup for a project I was working on. Thanks.

    • Brent SalisburyBrent Salisbury12-04-2012


      Thanks Nick! And thanks for showing me the nice build your shop has.

  4. sh0xsh0x12-04-2012


    The netflow plugin in cacti is a front-end for flowtools collector, which is kind of old school now days (but still useful). Flowtools doesn’t have a GUI, so the Cacti plugin provides that… Nfsen is another open source collector that comes with its own WebUI. Neither are pretty but get the job done in a pinch :)

    Similarly the Routerconfigs plugin is a front-end for accessing data in RANCID, and alternatively RANCID configs can be viewed and diffed using ViewVC.

  5. sh0xsh0x12-04-2012


    Another thing, flowtools only supported netflow. Nfsen supports netflow and sflow. To use sflow with flowtools, flows have to be converted.

  6. Brent SalisburyBrent Salisbury12-04-2012


    Thanks Shox. Appreciate the info. Great stuff. Will add it in and important insight for us.

  7. Anthony @pandom_Anthony @pandom_12-10-2012


    Mate. Super post. There are some solid custom builds around that are compiled. I am currently investigating http://cactiez.cactiusers.org/ – It is built with a raft of popular plugins and scripted deployment.

    Great post Brent.

  8. Brent SalisburyBrent Salisbury12-10-2012


    Now thats cool! thanks bro.

  9. erteckerteck01-10-2013


    ,how about the installation of CactiWMI in cacti Version 0.8.8a in CentOS,
    anyone here knows how to install the WMI???

    plsss,,help me :(

  10. daviddavid01-30-2013


    Hi Brent,

    Nice article, but I think the title doesn’t meet with cacti, as far I know cacti isn’t a network management it’s only network monitoring system.

    cheers :)

Leave a Reply