[hobbit] CUSTOM RRD DATA VIA SCRIPTS
Hubbard, Greg L
greg.hubbard at eds.com
Thu Mar 16 15:18:33 CET 2006
Subhash,
I think you are on the right track. But since your script needs to
recognize each line and process it independently, you need to send the
grep output through some sort of a loop, and then unpack each line. I
am not exactly a shell wizard, but at least two approaches come to mind:
A) send the output of the grep to a temporary file, then process the
temporary file line by line.
B) process the output of the grep line by line in a loop (skipping the
temporary file).
There is nothing that says that you have to process the output in shell
-- you could also use Perl. Just keep in mind that you can only have
one processor on your server and it has to be able to deal with
everyone's needs.
Or, as Henrik suggests, you can dig out a C book and write a new module
to recognize all of this. I would take a swing a Perl before I would do
that, since my C skills are nil.
Anyone care to donate a few lines of Bourne that would help Subhash over
the hump?
GLH
-----Original Message-----
From: Gada, Subhash [mailto:subhash.gada at logicacmg.com]
Sent: Wednesday, March 15, 2006 10:58 PM
To: hobbit at hswn.dk
Subject: RE: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
Hi Greg,
I Apologise for bothering you all with script debugging!
I thought of the following script, however I could not debug the script.
I have the following questions?
I thought of taking advantage of the common letters PRN and grep it with
"PRN*". Is this the correct way to grep the value?
Example data from server1
PRN327:0
PRN203:1
PRN202:0
Example data from server2
PRN123:3 #-----------------------name:value
PRN314:0
PRN137:0
PRN136:0
The idea is to create separate rrd files of each value.
The host which send the data to hobbit does not have a fixed number of
name:values but maximum of 30
If I trigger the script with hobbd_rrd nothing is happening and the CPU
utilisation is growing up to 90%
Around 25 hosts have the test "printq" running.
#!/bin/sh
# Input parameters: Hostname, testname (column), and messagefile
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
index=0
if [ "$TESTNAME" = "printq" ]
then
# For test purpose looping fixed number of times.
while [ $index -lt 30 ]
do
p[index]=`grep "^PRN*:" $FNAME | awk '{print $2}'`
# The RRD dataset definitions
echo "DS:$index:GAUGE:600:0:U"
# The filename
echo "printq.$index.rrd"
#The data
echo ${p[index]}
let index=$index+1
#exit the loop when the value of $p{[index]} is null if [ $p{[index]}
-eq "" ]
then
exit
fi
done
fi
exit 0
Regards
Subhash
-----Original Message-----
From: Hubbard, Greg L [mailto:greg.hubbard at eds.com]
Sent: Wednesday, March 15, 2006 9:37 PM
To: hobbit at hswn.dk
Subject: RE: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
Well, it does not appear to be that difficult. For each data element,
you need to put out the DS line, then the file name, then the values.
Make the file name match the element.
So, if F070 = 1, F001 = 2, F037 = 5
"DS:value:GAUGE:600:0:U"
"F070.rrd"
"1"
"DS:value:GAUGE:600:0:U"
"F001.rrd"
"2"
"DS:value:GAUGE:600:0:U"
"F037.rrd"
"5"
The Hobbit RRD support will do the right thing, creating these datasets
in the directory for the associated host.
Then, in the Hobbit graph definition, you have to figure out how to use
the wildcard mechanism to find all the F*.rrd files. The file names can
be used to replace the parameter value "value" in the dataset would
become F070, F001, F037, etc. This seems to be how the disk magic
works.
Good luck!
GLH
-----Original Message-----
From: Werner (Ext Lists) [mailto:wmlist_ext at terra.com.br]
Sent: Wednesday, March 15, 2006 6:09 AM
To: hobbit at hswn.dk
Subject: Re: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
Hi
You can see the disk rrd handler in
<source_code_home_dir>hobbitd/rrd/do_disk.c , who`s an include to
hobbitd/rrd/do_rrd.c
-wm
On Wed, 15 Mar 2006 12:47:17 +0530
"Gada, Subhash" <subhash.gada at logicacmg.com> wrote:
> Hi,
>
> Yes the graph mechanism of disk suites similarly to the requirement.
>
> Can any one explain how the the separate rrd files are created for
> different disk volumes. I couldn't trace how this is happening.
>
>
>
> Regards
> Subhash
>
>
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are
not an intended recipient then please promptly delete this e-mail and
any attachment and all copies and inform the sender. Thank you.
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list