| 0 comments ]

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 :

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>

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.

http://bobcares.com/blog/?p=68


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.

0 comments

Post a Comment