Bobcares

Catching Cacti : Network Administrator’s Guide

by | Nov 25, 2006

My dad once told me, “Even if you are holding on a thorn, hold it tightly“. Thats what came to mind , as I saw Cacti. I chose Cacti, after considering different options for resource monitoring of our linux servers. This article is all about , how I tightened my grip on the cacti , and made it work in our servers. If you are a newbie network administrator, this writeup would be really useful for a head start on resource and network monitoring using cacti.

 

Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers

See how we do it!

 

 

Contents

cacti

1 Background study

1.1 Resource monitoring in Linux servers

Our server was working pretty well, until it went down one day. Reason , one partition of the harddisk became full. Two days later, my boss got an invoice from our datacenter. We are being charged for the extra bandwidth utilisation in our servers. Same week, servers started acting crazy. The response would become really slow, for 1-2 hours and then as soon as I start checking to see whats wrong, everything would be back to normal.

That one week, was enough for me, to see the bigger picture. Either we install a good resource monitoring software or else, look for a new job. Since there wasn’t much of a choice, I went after the first option.

1.2 What is RRDTOOL and SNMPD?

Searching and researching, took me to the world of RRDtool, which eluded me till then. Wikipedia defines RRDtool as

RRDtool is a round-robin database tool designed to handle time-series data like network bandwidth, temperatures, CPU load etc. The data is stored in round-robin database so that system storage footprint remains constant over the time.

If you are still trying to make a head or tail out of the above technical jargon, here is my explanation in a very simple sentence. RRDtool is a software which can store data and present it graphically, without eating up much space.

Who provides the data to RRDtool ? In our case , its done by SNMP (The Simple Network Management Protocol). Though the name contains “simple” , SNMP is not that easy to understand. This is clearly stated in the FAQ of SNMP. http://www.snmp.com/FAQs/snmp-faq-part1.txt

“It will take you at least 6 months or so of studying and usage to comprehend SNMP very well”.

For our purpose, ie resource monitoring , we dont have to dwell too much with SNMP. It is only used to send data to the server having RRDtool.

2 Holding Cacti

2.1 What is cacti and its features?

Cacti is a resource monitoring software. It uses RRDtool to store data and the data is used create graphs. Cacti’s greatest strength is in providing complex graphing easily. 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.

2.2 Why cacti?

In a single sentence, “Cacti, because its easy”. Installing and using Cacti is a very simple task and does not require indepth knowledge in networking or resource management. You can install and configure it in simple steps, which makes it an ideal software for newbie network administrators. Never-the-less , its so powerful and scalable that you can use it even in large networks with hundreds of devices. Now you know , why I went for Cacti.

3 Tightening the grip on Cacti

3.1 Installation.

The easiest part of setting up cacti is the installation. It gets over in less than 5 minutes. All you need is a webserver with RRDtool & MySQL installed. Detailed steps for installation in a *nix server ( henceforth called cacti server) is available at :

http://www.cacti.net/downloads/docs/html/install_unix.html

After installation, login as admin and make sure that you are filling in all path variables correctly. Confirm that you are selecting the correct version of RRDtool as installed in the cacti server. Finally decide how “poller” should work.

Tip: If you are monitoring more than 10 servers , its better to use “cactid” instead of cmd.php for polling.

3.2 Adding Devices and Graphs.

To start viewing the graphs , you need to perform two tasks

  • Add the Device/Resource for which graphs need to be generated.
  • Create graphs for each device you’ve added.

These two tasks are explained in detail at http://www.cacti.net/downloads/docs/html/graph_howto.html

After you’ve read the above documentation, proceed to configure resource monitoring of localhost.

3.3 Configuring for localhost

Cacti comes with many device types and graph templates. A newbie administrator can configure cacti for the network, with the options available out of the box. First and easiest one is configuring for localhost or the cacti server.

  • After the installation and initial configuration is over, Create a device with the hostname of the localhost.
  • From the list of “Host Template” select “Local Linux Machine”. That pretty much take cares of all the settings of the localhost.
  • Now click on the “New Graphs” link on the menu and create graphs for “localhost”.

Wait for 10 -15 minutes and you’ll be able to view the graphs by clicking on “Graphs” tab on top. Simple , right ?

3.4 Configuring for SNMPD host

Now comes the challenge, monitoring the resources of a remote server.Before creating the device or graph, you will have to setup SNMPD in the remote server.

Detailed installation instructions are available at http://netophilia.net/snmpd.html . Go ahead and install SNMPD in the remote server. Just make sure that you are changing the “community-string” (by default it’ll be public). This community string is to be used later while configuring Cacti.

After testing the working of net-snmpd in the remote server, do a test from cacti server too. For that you can use the command

[root@cacti ~]# snmpwalk -v 2c -c <community-string> <remote-server-ip>

The above test will come handy, especially if your servers are heavily secured using firewalls.( I lost over 4 hours because of ignoring firewalls)

If everything is working fine w.r.t snmpd , move ahead and configure cacti for the remote server. To add the remote server

1. Click on Devices -> “Add” .

2. Give hostname and description

3. Select “ucd/net snmp host” from Host Template list

4. Fill SNMP community with your “community-string

5. Click on “Create”

6. Proceed to add “graphs” for the newly added device.

Thats all for one server. Repeat the steps for adding as many servers as you want.

3.5 Customizing

For better readability, its suggested that you use graph trees in cacti to organize your graphs. You can read more about graph trees and its management at http://www.cacti.net/downloads/docs/html/graph_viewing.html

Cacti also allows addon scripts incase we need to monitor some special services . Common addon scripts used in webhosting servers are Bind9-stats, Apache stats etc. A complete list of all the addon scripts is available at

http://forums.cacti.net/about15067.html

4 Other options

There are many other Resource Monitoring Softwares available in the market. MRTG is another free software, which has RRDtool as its back-end. MRTG is not suggested for a newbie, because of its long learning curve and amount of man hours required to set it up.

Another alternative to Cacti is OpenNMS which is gaining popularity amongst the administrators.

5 Hold me tight

If you are looking for a easy to use , plug and play monitoring software , then Cacti is the best option currently available. Another strength of Cacti is its scalability and flexibility which makes it powerful enough to use in complex networks too. Just go ahead and hold the Cacti tightly.


Articles by Sojish KrishnanAbout the author:
Sojish Krishnan works as Sr. Engineer in Bobcares.com. Sojish has worked in Bobcares for over 4 years and is a passionate advocate of superior Customer support. He graduated Bachelors in Computer Science in 2001.

 


5 Comments

  1. Steven

    Hi
    I encounter a problem about using cacti with Cisco Switch for monitoring CPU, Memory usage, I got no display for them.
    So I wonder can I import Cisco MIB into cacti in order to snmpwalk getting the more information to display.
    Do you think that is workable ?
    Best Regards

  2. Sojish

    Cacti supports Cisco MIB , if my memory is right. I’ve added CISCO switches to my Cacti installations with ease . You might consider using their templates feature to chose the apt one.

    Regards,
    Sojish

  3. Rumi

    Dear Sir,
    I want to use cacti-0.8.7b.tar.gz. I have install and configure it i get localhost graphs but i am not geting any remort host graphs. Please help me to solve the problem.

  4. Sojish

    SNMP needs UDP 161, 162 ports for communicating. You might want to check your iptables to make sure they are open in the remote server as well as the localhost.

  5. Bhasker

    Hello sir,

    I have sucessfully configured the cati. But i was struck in the middle while i am adding the new device. when i called the http://localhost/cacti
    The page is displaying like this

    You are now logged into Cacti. You can follow these basic steps to get started.

    * Create devices for network
    * Create graphs for your new devices
    * View your new graphs
    when i am clicking the create device for network it is displaying the PHP code in the browser.
    can you help me from this problem.

    Thankyou,
    Bhasker.

Never again lose customers to poor
server speed! Let us help you.