[rrd-users] newbie

Simon Hobson linux at thehobsons.co.uk
Mon Jun 3 14:16:31 CEST 2013

Khapare Joshi wrote:
> I wanted to create rrdgraph number of total login users in the server by hour, day, month and year.
> I would collect the data by doing who |wc -l then like to update the rrd database - produce graph.

> This must be very easy !!! throw me your simple tips!!!

Guess what, you've just outlined all the steps needed. Just take each of those steps, and expand them into working scripts.
Decide what step you want to work with, and what consolidations - then create database.
Wrap up your collection of logged in users in a script - and either call it from cron, or make it an endless loop and start it from inittab.
Then read up on making graphs. I'd start by making it a script run from command line to start with, and once you've got it working you can start to think about how to make it more usable :
Simple but wasteful is to run the script periodically to update staic files and embed the URLs in a web page.
Or you can make a CGI page that calls the script and generates the images - which are still static images referenced in the page.
Or you can go the whole hog and make a CGI script that generates the image on the fly and returns it - so each image is just a URL you can embed in a page (and reuse in different pages) which automatically updates the relevant image file as required. Hint - see the --lazy option to rrd graph, andLast-Modified & Expires http headers.

If you get stuck at a particular point then feel free to ask - but all you've asked so far sounds like "do it for me".

More information about the rrd-users mailing list