Home > General Articles, Security, Suite Reviews > Cacti and rrdtool – a boon to the SysAdmins

Cacti and rrdtool – a boon to the SysAdmins

February 14th, 2010 Leave a comment Go to comments

Regrett that I got familiarized with the cacti system only a week back. And once a clean installation was ready and running, the bottle necks started. Running snmpd for monitoring cpu, disk and network was an overkill. Though the snmp helped when we could add our WiFi Access Points, Routers and Switches. Even the traffic from our ISP Load balancer (pfsense) could be added for monitoring. All this was excellent. We got bottle necked at one point though.

Most of our colocated servers were behind heavy firewalls, and or running in virtual box machines inside real hardwares. True that we could use a single snmpd with multiple community id to collect data. But I was just reluctant. Just out of curiosity, the last one week day and night, at home, at work over IRC I was after getting the insides of both cacti and rrdtool. Thanks to the developers of both, and to all those who have contributed towards it. I did find better cacti templates on google code. This was one good step. The MySQL templates are simply superb. Also there is a script in php which does do ssh to remote servers and collect data. Good enough, but needed the cacti host root user to have a public key published on all of our servers.

Then only I thought about having a web based agent, to run the collector. Use a php-curl wrapper to invoke the web based agent through http requests. I made a couple of mods in the ss_get_mysql_stats.php, pulling out the mysql connection, and query part, and wrapping the same with an encrypted (key based), request to the agent. The agent will return serialized, gzcompressed, base64_encoded data from the server. The data will be decoded, uncompressed and unserialized inside the wrapper before returning to the base code. Once the above was setup, I could use the MySQL templates as developed by original developer.

Aah.. I was getting some where. Okay just firedup the favorite editor (gedit), and checked out on the scripts available in the /scripts/, wow the perl scripts, and the php scripts all tickled me quite. And about the whole of last night and today, the agent was modified to provide CPU, Load average, disk statistics, memory info, network traffic, by reading certain files in the /proc and running ‘/bin/df’. Combined the data extracted and did the same base64_encode, gzcompress. Then created a cacti script ss_serverstats.php to act as the mediatory between cacti and the agent (serverstats.php).

The whole package is provided for download. I gave the name ‘Colocated Server’ for the host template, just to remind me that this is best for the external servers. The templates and scripts were tested and devloped on cacti-0.8.7d.

Download Cacti http data collection kit (562)

  1. No comments yet.
  1. No trackbacks yet.

+ six = fourteen