[rrd-users] Re: rrdtool create question

Daniel Tepas daniel at the-temple.de
Thu Oct 5 19:08:30 MEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Ashley M. Kirchner wrote:

> I've read, and I've read, and I'm about to go read again, but it's
> still all pretty much greek to me. I'm venturing into rrdtool for
> the first time and am at the moment stuck. As a start project, I
> decided to chart a server's used space across its various
> partitions. So, let's assume I want to log the following partition
> usages:
>
> /, /home, and /var/log
>
> And I get the percentage used via SNMP's IODs
> .1.3.6.1.4.1.2021.9.1.9.1 , .2, and .3 respectively. The returned
> value is an integer.
>
> How can I: a) create an rrd file that can contain all three of
> those values, and


rrdtool create...

> b) individually update each one.
>
No, as far as i know you have to insert all values for the 3 values at
once. I use the following:

hda1=`df | grep "/dev/hda1"`
hda1p=`echo $hda1 | cut -f 5 -d " " | sed -e "s/%//g"`

After this the variable hda1p contains the usage of partition
/dev/hda1 in percent.

Maybe collect some other data like this:

load=`w | head -1`
loadvals=`echo $load | cut -f 11 -d " " | sed -e "s/\.//g" | sed -e
"s/,//g"`
if [ "$loadvals" == "" ] ; then
        loadvals=`echo $load | cut -f 9 -d " " | sed -e "s/\.//g" |
sed -e "s/,//g"`
fi
mem=`free | grep "Mem:"`
ramtot=`echo $mem | cut -f 2  -d " "`
ramused=`echo $mem | cut -f 3  -d " "`
let rampercent=ramused*100/ramtot
swap=`free | grep "Swap:"`
swaptot=`echo $swap | cut -f 2  -d " "`
swapused=`echo $swap | cut -f 3  -d " "`
let swappercent=swapused*100/swaptot

to get the system load, memory & swap used.
Collect all data you need, then do:

rrdtool update /usr/local/rrdtool/system.rrd -t load:mem:swap:hda1
N:$loadvals:$rampercent:$swappercent:$hda1p

> And I guess as a future exercise (perhaps for me), can that same
> rrd file contain multiple data tables for multiple servers (so I
> can poll other servers and store them in the same file.) Can I ADD
> more DSs to an rrd file at a later date, or can I only do that when
> I first create the rrd file?

It works, for sure. But it's a pain in the ass to extend an existing
rrd file to cover more servers, so I think you would be goin better to
use different rrd files with standard values for several servers. Perl
scripts for extension have been posted here, if U really need them I
may dig it. You have to dump the rrd to xml, use the script, and then
import it again. I tell you: use one file for one server. That's what
I do.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
iD8DBQFFJTwN34dQ9W8Dyg4RAvbNAJ49p2CeeVFDloz4eNiPCDtcG4/TWgCfeud4
1HsJkYXu9axrOguAFgyUD/U=
=Df2H
-----END PGP SIGNATURE-----

--
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://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list