[rrd-users] Re: please help a lost newbie

Gerhard Ecaroh Froehlich gerhard.froehlich at produktion.gis-online.de
Wed Dec 11 18:08:56 MET 2002


Hi Dan!

Dan Gahlinger wrote:
> 
> Ok I wrote a shell script to collect data from our boxes,

[...]

> How do I get this graphing the data ?
> 
> Dan.
> 

Oh, there were some good answers in the meantime. An additional hint how you can
get it quick, remember there are a lot of ways to do a thing. My sugesstion
should work without writing in a file as step between:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$ vi /etc/monitored_servers.conf
server1
server2
server3

then

$ vi /opt/myscripts/whos-on.sh

#!/bin/bash

HOSTLIST=/etc/monitored_servers.conf
DS=usercount
RRDTOOL=/my/path/to/rrdtool
DATADIR=/my/path/to/datadir/

for HOST in $HOSTLIST
do
USERS=`finger @$HOSTLIST | grep -c tty`
RRDTOOL update $DATADIR$HOST.rrd  $DS $USERS
done

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

and run whos-on.sh from cron every 300 seconds. Then set up a script which polls
out
the data with rrdgraph and writes a graph and html for easy viewing in a
browser. Run it from cron too.

Same loop for graphing means:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
#!/bin/bash
# quick sometimes pseudocode

# define your settings
HOSTLIST=/etc/monitored_servers.conf
DS=usercount
RRDTOOL=/my/path/to/rrdtool
DATADIR=/my/path/to/datadir/

# quick hack to get unixtime in seconds (needs perl, don't know it better)
NOW=`perl -e 'print time'`

#Timespan is one day (86400 seconds):
let THEN=$NOW-86400

# let the shell do the work
for HOST in $HOSTLIST
do

$RRDTOOL graph $HOST.png --start $THEN --title='Users on $HOST' \
DEF:d$DS=$HOST.rrd:$DS:AVERAGE \
LINE2:d$DS#00FF00:"Users"

done

exit 0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Create one static HTML page. Done. There are lots of ways, you may glue both
togather to simplify.

Hope this is alright cause i am not a programmer. Any suggestions and
corrections are welcome.

Bye, Ecaroh

-- 
Gerhard Ecaroh Froehlich, Systemadministrator

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list