[rrd-users] Simple method to get a list of data sources in a single RRD

Bruce Campbell bruce.campbell at apnic.net
Tue Feb 8 08:06:45 MET 2000


Greetings.

The question is:

	Is there a program currently to do a simple 'is this a valid data
	source' or to list the available data sources, in a given rrd
	file?

The detail of the question is:

Given input similar to:

	Feb  8 15:31:16 whois:1 named[66643]: NSTATS 949987876 949622387 0=11
	A=2606897 NS=4182 CNAME=4567 SOA=104103 MG=15 PTR=46360894 HINFO=19
	MX=445281 TXT=6 X25=81 NSAP=9 AAAA=1189 LOC=564 EID=1 SRV=1309 121=1 136=1
	245=1 AXFR=112 MAILB=6 ANY=406563

I wish to graph all of the name=value pairs in the above.  To complicate
matters (and those familar with bind will see the problem), a given
'name=value' pair will not appear in the NSTATS output until a query for
that 'name' has been received.

Currently, I'm using a shell script (yes, I will be moving it to perl ;) )
which does:

	curtime=`echo $nstatsline | cut -d ' ' -f 7`
	allnames=""
	allvalues=""
	for namval in `echo $nstatsline` ; do
		name=`echo $nameval | cut -sd '=' -f 1`
		value=`echo $nameval | cut -sd '=' -f 1`
		if [ "$value" ] ; then
			allnames="$allnames:rec_$name"
			allvalues="$allvalues:$value"
		fi
	done
	rrdtool update rrdfile -t $allnames $curtime:$allvalues

( The rrd file has been set up with data sources of rec_A, rec_PTR etc )

Of course, this then runs into the problem of what happens when you run
into 'unknown-name=number'; ie, your rrd file has not been set up with the
'unknown-name' data source.  (ie, in the above, there is 245=1 .  I don't
think its worthy of graphing on its own )

I'd like to be able to:

	othervalue=0
		if [ "$value" ] ; then
			if ! rrdtool validDS rrd.file rec_$name ; then
				othervalue="$[ $othervalue + $value ]"
	[snip]

	rrdtool update rrdfile -t $allnames:rec_OTHER \
		$curtime:$allvalues:$othervalue

My question (before I write such a script) is:

	Is there a program currently to do a simple 'is this a valid data
	source' on a given rrd file?

or to simply list the data sources in a given rrd file? (which would be
better when I shift to perl - simple string comparison)

Regards,

-- 
  Bruce Campbell <bruce.campbell at apnic.net>                +61-7-3367-0490
                      Systems Administrator     Regional Internet Registry
    Asia Pacific Network Information Centre    For the Asia Pacific Region

--
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



More information about the rrd-users mailing list