Categories
cacti Cacti Examples CactiEZ

Cacti Plugins

The advantages of the Cacti are having many plugins that is provided by a wide community of Cactiusers.org.

List of Cacti plugins:

  • Boost: To increase Cacti performance
  • Clogs: To add a view tab to view  Cacti log
  • Discovery: auto discovery to detect the SNMP devices on the network with diferent subnet.
  • Docs: To create a document in Cacti
  • Flowviewer: Viewer to see the flow of data dicapture by netflow on cisco router.
  • Host Info: Displays information about the server Cacti’s version
  • Login Mod: To change the Cacti login page
  • Mac Track: track a MAC Address and Port on the device to enable the SNMP
  • Monitor: monitors the condition of up/down from the monitored device, is also accompanied by sound alerts.
  • Ntop: shows ntop application on Cacti tab
  • Realtime: Displaying graphs in realtime Cacti every 5 seconds.
  • Router Configs: backup display configuration and router
  • Settings: Settings and configure Cacti
  • SSL: SSL access with Cacti
  • Syslog: Displays syslog Cacti database
  • Thold: Showing up down from the host
  • Tools: Tool to check the service HTTP, FTP, POP3 and SMTP
  • Update: Showing all the plugins installed and check for updates

CactiEZ is a self installing Linux Distribution based off CentOS that sets up and configures a customized Cacti install. Everything is designed to be completely automated and working directly out of the box. This compact distro is loaded with extra features such as Syslog and Netflow data collection, Weathermaps, Reports, Auto Discovery, Router Config backup, Nagios, and much more! Both 32 Bit and 64 Bit installations are possible from the same CD.  The CactiEZ ISO or torrent can be downloaded here.

Categories
cacti Cacti Examples CactiEZ Linux

Multi-CPU Utilization Graphing in Cacti

The past couple days I’ve been installing and configuring a new version of Cacti (0.8.7c) from a CactiEZ v0.6 installation. I’ve been using Cacti for years now and love what it does, however I’ve found that tweaking it is sometimes problematic.  Since I may go several months or a year or more between tweaking my install I have to rely heavily on the community.  While the Cacti forums are great they often have an overload of information and even out-dated information.

One aspect I’ve tried to get working before in Cacti is multi-CPU graphing, but I’ve never had great success.  Today though I found a great post by Peter at goldfisch.at on the subject – along with some other pretty good gems as well, such as extending Cacti by adding a 5-year graph, configuring Cacti to gather disk I/O and using advanced ping.  He had a great, concise set of steps to download the correct templates (which I’ve done before) and get them working correctly (this is where I’ve had trouble).  I’m going to list those steps with a little tweaking of my own mainly so I have them as a ready reference so somewhere down the road I can do this again, but the credit is all his.  Thanks Peter.

This originates from the Cacti forums post “Multi CPU Utilization Graph” which has links to the templates referenced here.  In fact, you may want to go there to find the latest and greatest on this topic.

Begin by downloading the template(s) you need (these links are all from the thread above which were the most current at the time of this post):

Next, import the template(s) in Cacti (Import Templates under Import/Export on the Console tab).  Before creating graphs for devices using any of these new templates they need to be modified a bit, otherwise they may report incorrect data.  To correct this issue click on Graph Management / CDEFs. You should see Average All data sources – X sources (X depending on your setup and the template(s) you imported).  If for some reason you don’t see these listed type average in the search field and click Go.

In turn click on each of the Average All data sources – X sources and perform the following:

  • Delete the current CDEF items, such as, “Item #1 Custom String: a,b,+,2,/”
  • Add the following three items:
    • Item #1 – Special Data Source: ALL_DATA_SOURCES_NODUPS (AKA “All Data Sources (Don’t Include Duplicates))
    • Item #2 – Custom String: 2/4/8 (depending on X above)
    • Item #3 – Operator: /

Each should like something like this:

Now you can create the graphs for each device.  Click Devices / <Host Name> / create graphs for this host.  Under Graph Templates for the selected host click the drop-down box next to create and select “Host MIB – Multi CPU Utilization on X Processor Box” then click Create. On the next screen you will be asked the Index Type, Index Value and Output Type ID – you don’t need to enter any values, just click Create.  You aren’t done yet – one more important step.

Click Graph Management and locate the graph you just created.  Under Supplemental Graph Template Data select the CPUs you wish to graph in your multi-CPU graph. This is most likely HOSTNAME – CPU Utilization – CPU0 (cpu), HOSTNAME – CPU Utilization – CPU1 (cpu) and so on …

Now that that’s done you should have nice multi-CPU graphs.  You could even delete any previously created CPU utilization graphs, but be careful not to delete the data-sources because the multi-cpu-graph needs these sources.  The multi-CPU graphs will even read data from existing sources.

Cacti multi-CPU utilization graph showing device with two CPUs graphed over the past 24 hours and 7 days:

Cacti multi-CPU utilization graph showing device with eight CPUs graphed over the past month and year:

Categories
cacti Cacti Examples CactiEZ Linux WGET

Upgrade Cacti on CactiEZ Installation

After installing CactiEZ v0.6 (as a VM on Windows 2008 Hyper-V) which includes Cacti 0.8.7c I wanted to upgrade to the latest version of Cacti (0.8.7e as of this post). However I was not able to locate any good directions. Jimmy Conner who put together CactiEZ said to follow the directions for upgrading Cacti in the Cacti manual, but they weren’t exactly easy to follow. So, after mucking through the upgrade I thought I’d put down my notes.  Here they are.

  • Backup the existing Cacti database (I wasn’t too worried about this as I upgraded a new installation):

mysqldump -l --add-drop-table cacti > mysql.cacti

Note: You will probably have to specify the -u and -p flags for the MySQL username and password. This user must have permission to read from Cacti's database or you will end up with an empty backup.

  • Backup the existing Cacti directory (again, since I have a new installation I wasn’t too worried about this).  The root for Cacti in CactiEZ is /var/www/html so I executed all the following commands from the /var/www directory:

mv html cacti_backup

  • Download the latest Cacti tarball (0.8.7e as of this writing):

    wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz

  • Extract the Cacti tarball.

tar xzvf cacti-0.8.7e.tar.gz

  • Rename the new Cacti directory to match the old one.

mv cacti-0.8.7e html

  • Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.

    vi html/include/config.php

    Default CactiEZ include/config.php configuration (vi cacti_backup/include/config.php to view your current config if necessary):

$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “CactiMadeEZ“;

/* Default session name – Session name must contain alpha characters */
$cacti_session_name = “CactiEZ“;

  • Copy the *.rrd files from the old Cacti directory.

cp cacti_backup/rra/* html/rra/

  • Copy any relevant custom scripts from the old Cacti directory. Some script are updated between versions. Therefore, make sure you only over write if the scripts either don’t exist or are newer than the distribution’s.

cp -u cacti_backup/scripts/* html/scripts/

  • Copy any relevant custom resource XML files from the old Cacti directory. Some resource XML files are updated between versions. Therefore, make sure you only over write if the XML files either don’t exist or are newer than the distribution’s.

cp -u -R cacti_backup/resource/* html/resource/

  • Set the appropriate permissions on Cacti’s directories for graph/log generation. You should execute these commands from inside Cacti’s directory to change the permissions.

chown -R cactiuser rra/ log/

(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.)

  • Finally, point your web browser to:

    http://your-server/

    Follow the on-screen instructions so your database can be updated to the new version.

Wait, there’s more. . .

Now we need to download and install the Cacti Official Patches [0.8.7e].  You may want to check the previous link for the latest. NOTE: download and execute these from /var/www/html which is the default root directory for Cacti on CactiEZ.

wget http://www.cacti.net/downloads/patches/0.8.7e/cli_add_graph.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/snmp_invalid_response.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/template_duplication.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/fix_icmp_on_windows_iis_servers.patch
wget http://www.cacti.net/downloads/patches/0.8.7e/cross_site_fix.patch
patch -p1 -N < cli_add_graph.patch
patch -p1 -N < snmp_invalid_response.patch
patch -p1 -N < template_duplication.patch
patch -p1 -N < fix_icmp_on_windows_iis_servers.patch
patch -p1 -N < cross_site_fix.patch

NOTE: While this upgrade works fine to upgrade Cacti itself you will have to upgrade other CactiEZ components for them to work properly, such as THold, Monitor, Discover, WeatherMap, MACTrack and the Plugin Architecture.  For now you are on your own for those. . .

See Also

Categories
cacti Cacti Examples CactiEZ Linux SSH Ubuntu

Install CactiEZ on Windows 2008 Hyper-V

CactiEZ (Cacti Made Easy) is a self installing Linux Distribution based off CentOS that sets up and configures a customized Cacti install. Everything is designed to be completely automated and working directly out of the box. This compact distro is loaded with extra features such as Syslog and Netflow data collection, Weathermaps, Reports, Auto Discovery, Router Config backup, Nagios, and much more!

This guide provides instructions for installing CactiEZ as a VM on Windows 2008 Hyper-V.

This contains some fairly detailed instructions so someone new to this setup should have enough info to get completely running.  However, since I know some of you out there are in a hurry here’s the Cliff Notes version:
  1. Don’t use the default network adapter – DELETE it!
  2. Add a legacy network adapter.
  3. Install CactiEZ.
Full Instructions for Installing CactiEZ on Windows 2008 Hyper-V
Download the CactiEZ ISO – get this started now so it will be done by the time your’re ready for it.  By default the CactiEZ ISO is a tarred file so you will have to untar (unzip) it before you can use it.  If you don’t already have a Windows-based program that can handle tarred files 7-zip is a great, FREE, utility.  NOTE: in Windows you may have to unzip twice; CactiEZ-v0.6.tar.gz will unzip to CactiEZ-v0.6.tar from which you can extract CactiEZ-v0.6.iso.
Step One: Create the VM on Hyper-V
  • Launch the Windows Hyper-V Manager (Start, All Programs, Administrative Tools, Hyper-V Manager).
  • Select NewVirtual Machine.  Give it a name.  Click Next.
  • Specify memory (RAM).  In this example I’m using 1024 MB.
  • On the “Configure Networking” screen just click Next – we will delete this later anyway.
  • Create a new virtual hard disk using the name, location and size of your choosing.  I created a 10GB virtual HD which should be more than enough for CactiEZ.
  • On the “Installation Options” screen make sure to choose “Install and operating system later.”
  • Click Next, uncheck “Start the virtual machine after it is created” and verify your settings, then click Finish.
    At this point if your VM started you will receive a boot failure message.  Don’t worry, you can safely ignore this and Turn Off the VM.
    Step Two: Customize VM Settings
    • From Hyper-V Manager right-click your new VM, then select Settings.
    • Remove the current Network Adapter.
    • Click Add Hardware and select Legacy Network Adapter, then Add.
    • On the Legacy Network Adapter select the correct adapter from the Network drop-down list
    • Click OK to save settings.
    Step Three: Install CactiEZ
    • Double-click your VM to open the Virtual Machine Connection window.
    • Click Media, DVD Drive, Insert Disk and browse to your (extracted/unzipped) CactiEZ ISO.
    • Start (Power On) the VM & it will begin the CactiEZ server installation.
    • Select whether to install the 32 or 64-bit version and let her rip.  The CactiEZ installation is almost completely automated so just let it run.  When prompted reboot the VM.
    After the system reboots its IP address will be displayed (assuming you have a DHCP server available on the network).  You can certainly change the IP address to a static one if you’d like (instructions below).
    Step Four: Logon to Your CactiEZ Server
    Now that your server is installed logon through the Virtual Machine Connection window.  The default username and password are root, CactiEZ.

    Once logged on the first thing I did was set a static IP address using:

    netconfig

    With the IP address and related settings set appropriately restart the network using:

    service network restart

    You may also want to synchronize your time using:

    ntpdate -u 0.pool.ntp.org

    And set your timezone with:

    yum install system-config-date
    system-config-date

    See more CactiEZ tips and hints here.

    NOTE: By default CactiEZ installs SSH so you can connect remotely with something like PuTTY.
    Step Five: Connect to and Configure Cacti

    Using a browser connect to your new installation of Cacti using http://<IP Address>.  The default user is ‘admin’ and the default password is ‘admin’ as well.  You will be prompted to change the password.

    Now you can knock yourself out configuring and using Cacti.  Here’s more logon information from CactiEZ.

    See also

    Categories
    cacti Cacti Examples Iperf Linux Ubuntu WGET

    Bandwidth Monitoring Tools for Ubuntu

    • bmon – Bandwidth monitor and rate estimator
    • bwm-ng – Bandwidth Monitor NG (Next Generation), a live bandwidth
      monitor for network and disk IO
    • cbm – displays the current traffic on all network devices
    • iftop – Real-time bandwidth usage information on a specified interface
    • iperf – Tool for measuring maximum TCP and UDP bandwidth performance
    • ibmonitor – interactive bandwidth monitor
    • pktstat – shows the bandwidth being consumed by packets of various kinds in realtime
    • tcptrack – sniffer which displays information about TCP connections
    • MRTG – see traffic load on a network over time in graphical form
    • Cacti – network graphing solution

    Details on each tool.

    bmon
    bmon is a portable bandwidth monitor and rate estimator. It supports various input methods for different architectures. Various output modes exist, including an interactive curses interface, lightweight HTML output, and simple ASCII output. Statistics may be distributed over a network using multicast or unicast and collected at some point to generate a summary of statistics for a set of nodes.

    Install bmon on Ubuntu:

    sudo apt-get install bmon

    To launch bmon just enter bmon at the terminal.

    You can select a specific interface to view traffic details. In the screen shot below I selected eth0, ‘g’ for graphical statistics and ‘d’ for detailed statistics.

    bwm-ng
    bwm-ng can be used to monitor the current bandwidth of all or some specific network interfaces or disks (or partitions). It shows total of in and out as well as total of all interfaces/devices.

    Install bwm-ng on Ubuntu:

    sudo apt-get install bwm-ng

    To launch bwm-ng just enter bwm-ng at the terminal.

    cbm

    cbm (Color Bandwidth Meter) displays the current traffic on all network devices.
    Install cbm on Ubuntu:
    sudo apt-get install cbm
    To launch cbm just enter sudo cbm at the terminal.

    iftop

    iftop provides real-time bandwidth usage information on a specified interface, listed by host pairs.

    Install iftop on Ubuntu:

    sudo apt-get install iftop

    To launch iftop just enter iftop at the terminal.

    Iperf
    Iperf was developed by NLANR/DAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss.

    Install iperf on Ubuntu:
    sudo apt-get install iperf
    Iperf supports several options, but generally you would run it on one device as a “server” and another as a “client.”
    To launch iperf in server mode just enter iperf -s at the terminal.  It will report, “Server listening on TCP port 5001. . .”

    From another system launch iperf in client mode with iperf -c <server IP>. By default Iperf will run a 10 second test and report amount of data transferred and bandwidth speed.

    Note: Iperf can be used to test LAN speeds as well as over the Internet.

    ibmonitor
    ibmonitor is an interactive linux console application which shows bandwidth consumed and total data transferred on all interfaces.

    Its main features are:

    • Shows received, transmitted and total bandwidth of each interface
    • Calculates and displays the combined value of all interfaces
    • Displays total data transferred per interface in KB/MB/GB
    • Values can be displayed in Kbits/sec(Kbps) and/or KBytes/sec(KBps)
    • Can show maximum bandwidth consumed on each interface since start of utility
    • Can show average bandwidth consumption on each interface since start of utility
    • The output with all features (max, avg and display in Kbps and KBps) easily fits on a 80×24 console or xterm
    • Can interactively change its output display format depending on key pressed by user.

    Install ibmonitor on Ubuntu”

    First you need to download the latest version:

    wget http://ovh.dl.sourceforge.net/sourceforge/ibmonitor/ibmonitor-1.4.tar.gz

    Extract this file using the following commands

    tar xvfz ibmonitor-1.4.tar.gz

    cd ibmonitor

    If you want to run the application use the following command

    Once you are in ibmonitor folder use

    ./ibmonitor

    pktstat
    pktstat listens to the network and shows the bandwidth being consumed by packets of various kinds in realtime. It understands some protocols (including FTP, HTTP, and X11) and adds a descriptive name next to the entry (e.g., ‘RETR cd8.iso’, ‘GET http://slashdot.org/’ or ‘xclock -fg blue’).

    Install pktstat on Ubuntu:

    sudo apt-get install pktstat

    To launch pktstat just enter pktstat at the terminal.

    tcptrack
    tcptrack is a sniffer which displays information about TCP connections it sees on a network interface. It passively watches for connections on the network interface, keeps track of their state and displays a list of connections in a manner similar to the unix ‘top’ command. It displays source and destination addresses and ports, connection state, idle time, and bandwidth usage.

    Install tcptrack on Ubuntu:

    sudo apt-get install tcptrack

    To launch tcptrack just enter sudo tcptrack -i eth0 at the terminal.

    tcptrack can also take a pcap filter expression as an argument. The format of this filter expression is the same as that of tcpdump and other libpcap-based sniffers. The following example will only show connections from host 10.1.1.2

    tcptrack -i eth0 src or dst 10.1.1.2

    The next example will only show web traffic (ie, traffic on port 80)

    tcptrack -i eth0 port 80

    MRTG
    MRTG (Multi Router Traffic Grapher) is free software for monitoring the traffic load on network links. It allows the user to see traffic load on a network over time in graphical form.  MRTG is used by programs like Cacti to gather and graph stats over time.

    Cacti
    Cacti is a complete network graphing solution designed to harness the power of RRDTool’s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive,easy to use interface that makes sense for LAN-sized installations up to complex networks with hundreds of devices.

    Cacti is great for gathering stats over time (using both MRTG and RRDTool) and creating hourly, daily, weekly, monthly and yearly graphs.  These graphs can be invaluable in identifying trends and potential problems.  In fact, just today I used the following graphs to identify a problem on my corporate network:

    Here’s another one showing network utilization over time.

    See also Multi-CPU Utilization Graphing in Cacti.
    Categories
    cacti Cacti Examples CentOS Grep Linux RedHad WPA

    Install and Configure Cacti Network Graphing Tool on RedHat / CentOS

    How do I install and configure common options to collect SNMP data and various other data (such as system load, network link status, hard disk space, logged in users etc) into an RRD?

    From the official project site:

    Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

    Cacti is a network graphing tool which uses MRTG.

    Required software

    You need to install the following software on RHEL / Fedora / CentOS Linux:

    1. MySQL Server : Store cacti data.
    2. NET-SNMP server – SNMP (Simple Network Management Protocol) is a protocol used for network management.
    3. PHP with net-snmp module – Access SNMP data using PHP.
    4. Apache / lighttpd / ngnix webserver : Web server to display graphs created with PHP and RRDTOOL.

    Install the software

    Login as root user and type the following command to install mysql, apache and php:
    # yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd

    Configure MySQL server

    First, set root password:
    # mysqladmin -u root password NEWPASSWORD

    Create cacti MySQL database

    Create a database called cacti, enter:
    # mysql -u root -p -e 'create database cacti'

    Create a user called cacti with a password called cactipass (or one of your choosing), enter:
    # mysql -u root -p

    mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipass';
    mysql> FLUSH privileges;
    mysql> q

    Install snmpd

    Type the following command to install net-snmpd
    # yum install net-snmp-utils php-snmp net-snmp-libs

    Configure snmpd, open /etc/snmp/snmpd.conf
    # vi /etc/snmp/snmpd.conf

    Append / modify it as follows (see snmpd.conf man page for details):

    com2sec local     localhost           public
    group MyRWGroup v1 local
    group MyRWGroup v2c local
    group MyRWGroup usm local
    view all included .1 80
    access MyRWGroup "" any noauth exact all all none
    syslocation Unknown (edit /etc/snmp/snmpd.conf)
    syscontact Root (configure /etc/snmp/snmp.local.conf)
    pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat

    Save and close the file. Turn on snmpd service:
    # /etc/init.d/snmpd start
    # chkconfig snmpd on

    Make sure you are getting information from snmpd:
    # snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

    Sample ouptut:

    IP-MIB::ipAdEntIfIndex.10.10.29.68 = INTEGER: 2
    IP-MIB::ipAdEntIfIndex.67.yy.zz.eee = INTEGER: 3
    IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1

    Install cacti

    First, make sure EPEL repo is enabled. Type the following command to install cacti:
    # yum install cacti

    Install cacti tables

    Type the following command to find out cacti.sql path:
    # rpm -ql cacti | grep cacti.sql

    Sample output:

    /usr/share/doc/cacti-0.8.7d/cacti.sql

    Type the following command to install cacti tables (you need to type the cacti user password):
    # mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.7d/cacti.sql

    Configure cacti

    Open /etc/cacti/db.php file, enter:
    # vi /etc/cacti/db.php

    Make the following changes:

     
    /* make sure these values refect your actual database/host/user/password */
    $database_type = "mysql";
    $database_default = "cacti";
    $database_hostname = "localhost";
    $database_username = "cacti";
    $database_password = "cactipass";
    $database_port = "3306";
     

    Save and close the file.

    Configure httpd

    Open /etc/httpd/conf.d/cacti.conf file, enter:
    # vi /etc/httpd/conf.d/cacti.conf

    You need to update allow from line. Either set to ALL or your LAN subnet to allow access to cacti:

     
    #
    # Cacti: An rrd based graphing tool
    #
    Alias /cacti /usr/share/cacti
     

    Order Deny,Allow
    Deny from all
    Allow from 10.0.0.0/8

     

    Another option is create /usr/share/cacti/.htaccess file and password protect the directory. Finally, restart httpd:
    # service httpd restart

    Setup cacti cronjob

    Open /etc/cron.d/cacti file, enter:
    # vi /etc/cron.d/cacti

    Uncomment the line:

    */5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

    Save and close the file.

    Run cacti installer

    Now cacti is ready to install. Fire a webbrowser and type the url:
    http://your.example.com/cacti/

    OR
    http://your.server.ip.address/cacti/

    Just follow on screen instructions. The default username and password for cacti is admin / admin. Upon first login, you will be force to change the default password.

    How do I configure SNMP data collection?

    SNMP can be used to monitor server traffic. Once installed login to cacti.
    => Click on Devices
    => Select Localhost
    => Make sure SNMP options are selected as follows:

    Fig.01: SNMP configuration

    Fig.01: SNMP configuration

    Finally, click on Save button.

    How do I create SNMP graphs?

    Click on “Create Graphs for this Host” link on top right side.
    Select SNMP – Interface Statistics
    Select a graph type (such as In/Out bytes with total bandwidth)
    Finally, click on Create button.

    How do I view graphs?

    To view graphs click on Graphs tab. Here is sample graph from one my own box:

    Fig.02: Cacti in Action - Memory, CPU and Network Usage

    Fig.02: Cacti in Action – Memory, CPU and Network Usage

    (Fig.02: Cacti in action)

    Fig.03: Cacti in Action Disk, Load average and User stats

    Fig.03: Cacti in Action Disk, Load average and User stats

    See also Multi-CPU Utilization Graphing in Cacti.

    Categories
    Apache cacti Cacti Examples graphing Linux monitor Passwords rrdtool Ubuntu Windows

    How to install Cacti on Debian or Ubuntu

    Cacti is a web based PHP/MySql graphing solution using the RRDtool engine. Classically, it can graph network bandwidthes with SNMP. But in fact, a lot of different graphs can be done with snmp, shell or perl scripts.

    Cacti’s strength lies in the fact that it can be installed and used incredibly easily. You don’t need to be a guru or spend tons of hours on the tool to configure it. Even a beginner can use it very quickly. On the very active Cacti forum, you can share “Cacti templates” with other users which can can save you a lot of time. You can very easily add plugins to the Cacti too enabling the possiblility to integrate other free tools like ntop or php weathermap. In our opinion, this is by far the best RRDtool frontend.

    For details about how to use Cacti, see the very good Cacti Manual.
    RRDtool is a program developed by the Swiss Tobi Oeticker who was already the creator of the famous MRTG. RRDtool is developed using the “C” programming language and it stores the collected data on “.rrd” files.

    The number of records in a “.rrd” file never increases, meaning that old records are frequently removed. This implies that one obtains precise figures for recently logged data, whereas figures based on very old data are mean value approximations. By default, you can have daily, weekly, monthy and yearly graphs.
    Some of the advantages of RRDtool over MRTG are the following:

    • it is much quicker
    • it can use negative values
    • it can use more than one data source in a graph
    • the generated graphes are very customizable
    • it can be used by a wide variety of front-ends such as Cacti
    • the RRDtool records stored in .rrd files keep the same size and do not increase.

    The following programs are needed to run cacti:

    • apache2 for the web server
    • mysql-server for the database
    • php5 for the server-based script
    • php5-common
    • php5-cgi
    • php5-cli
    • php5-mysql
    • snmp – snmp tools used to collect data to the remote hosts
    • rrdtool – a perl script to format collected data to rrdtool files
    • php5-gd – the graphical library used by a Cacti plugin named php weathermap

    INSTALL PROGRAMS
    Use apt-get to install the programs
    #apt-get install apache2
    #apt-get install mysql-server
    #apt-get install php5
    #apt-get install php5-common
    #apt-get install php5-cgi
    #apt-get install php5-cli
    #apt-get install php5-mysql
    #apt-get install snmp
    #apt-get install rrdtool

    INSTALL CACTI WITH APT-GET (recommanded)

    #apt-get install cacti

    You will have to configure the mysql settings through a little wizard.

    At the end of the tutorial, a mysql database and user named cacti will be automatically created.

    Now Cacti is ready to be used via: http://localhost/cacti The default login and password are admin.
    Cacti will check if all the required tools are correctly installed.

    Initial Cacti Configuration
    Select “New Install”

    Verify the required tools are correcty seen by cacti

    Note that the poller.php script which send the requests to the remote hosts is lauched by the apache2 user, it means www-data.

    To reconfigure cacti, use the following command:

    #dpkg-reconfigure cacti

    If you want to activate the poller manually run:

    #/usr/share/cacti/site/php5 poller.php

    Sometimes you need to activate it the first time, then it should run automatically every 5 minutes by default.

    rrdtool install on debian

    See also Multi-CPU Utilization Graphing in Cacti.