lvs-rrd 0.7

lvs-rrd is a tool to collect connection data from an LVS, store them in RRD files, and later graph that data.
  3 Screenshots
lvs-rrd is a tool to collect connection data from an LVS, store them in RRD files, and later graph that data so that trends can be observed.

I wrote these scripts because I realized that the other methods of collecting data for other monitors (cpu, memory, load, etc) was not directly applicable to collecting LVS data, because the number of real servers could fluctuate depending on scheduled downtime, or adding servers to handle load.

I didn't want to have to rewrite my scripts each time to add in another server, especially considering that an RRD file, once created, can't have data sources added. Also, there would be data loss between the time I added a new server and the time that I got around to adding the server to the collection scripts.

Ok... so I knew that I was gonna be lazy in the future and wouldn't to deal with this, or re-learn all the RRD stuff I know now, when in 6 months someone decides they want to add a server.


At least one LVS director (the script goes on each director, for now).
Bash v2 - as these are bash scripts. (It reportedly doesn't work w/ bash1)
bc - Should be included w/ your distro, but is apparently not installed by default on RH7.3, at least.
Optional: a web server of some sort, somewhere, to display the data. Many people put web servers on their directors for a final failover in case all of the real servers are down, so this shouldn't be a problem. Alternatly, you could rsync or otherwise transfer the RRDs to another server to be graphed, if you wish. Or you can NFS mount the directories, or sync just the /proc/net/ip_vs file over, or make it available via a web server, or via inetd/xinetd/tcpserver... Whatever. (You'll need to modify the update script slightly in those cases. Feel free to ask if you need help.)
Optional: PHP. This is by no means necessary and I use it simply to run the graphing script when the page is requested, this way the graphs are only generated when they are needed.


Extract the file to your web root. It will create a directory called 'lvs-rrd'.

Check the top of both scripts (lvs.rrd.update and and change the variables there to match your setup.

Add this line to your crontab (It is no longer necessary to do this as root, as /proc/net/ip_vs is world readable) changing WEBROOT to the appropriate path.

* * * * * WEBROOT/lvs-rrd/lvs.rrd.update 2> /dev/null > /dev/null

This update script should collect data from any real servers in the cluster.

Change the permissions on the 'graphs' directory to be writable by your webserver. It will write the graphs here when the graphing script is called by PHP. If you're using some other method to display the graphs, this step may or may not be necessary.

That's it! You'll have to wait a few minutes to start seeing data, so be patient.

What's New in This Release:

The script is now updated to work with rrdtool v1.2.x. I'm not sure if it still works with 1.0.x. Feel free to let me know if it does/doesn't. There are no bugfixes in this release, so if you're still using 1.0.x, there's no compelling reason to upgrade.
Added the '-E' option to the rrd command line to create more 'organic' looking graphs.
Added in a 3 year graph as some of my data has long since scrolled off the 1 year graph.

last updated on:
February 1st, 2006, 16:49 GMT
license type:
developed by:
Salvatore D. Tepedino
ROOT \ Utilities
Download Button

In a hurry? Add it to your Download Basket!

user rating



Rate it!
3 Screenshots

Add your review!