Xymon Mailing List Archive search

CUSTOM RRD DATA VIA SCRIPTS

10 messages in this thread

list Subhash Gada · Mon, 13 Mar 2006 17:22:39 +0530 ·
Hi,

We have few custom tests that measures printq of the print server
(windows).

How can I write a script to create a rrd file and generate graphs.

For example

P Server 1 
3/13/2006 Total queued jobs: 0
PRN324:0
PRN323:0
PRN142:0
PRN141:0
PRN140:0
PRN139:0
PRN138:0

P Server 2
3/13/2006 Total queued jobs: 0
PRN314:0
PRN137:0
PRN136:0

How to count the number of columns that vary from host to host.

The column names are not common for all the hosts.

Can any one help me further ?

if [ "$TESTNAME"="printq" ]
then

p1=`grep "^PRN*:" $FNAME | awk '{print $2}'`
p2=`grep "^PRN*:" $FNAME | awk '{print $2}'`
p3=`grep "^PRN*:" $FNAME | awk '{print $2}'` 

# The RRD dataset definitions
echo "DS:p1:GAUGE:600:0:U"
echo "DS:p2:GAUGE:600:0:U"
echo "DS:p3:GAUGE:600:0:U" 
# The filename 
echo "printq.rrd" 
# The data
echo "$p1:$p2:$p3"

 Regards,
 Subhash Gada
  

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.
list Subhash Gada · Tue, 14 Mar 2006 12:19:19 +0530 ·
Hi,
 May be I need to put this more clearly.
 Few custom test are running on the host side on windows systems which
measures print queue length of the print server.
 Hobbit is receiving data in the following format from the host systems.
 From Server 1  3/13/2006 Total queued jobs: 0 PRN324:0 PRN323:0 PRN142:0 PRN141:0 PRN140:0 PRN139:0 PRN138:0  From server 2
 3/13/2006 Total queued jobs: 0 PRN327:0 PRN203:0 PRN202:0   Initially I could thought of the following script to create rrd file but
if I use this script the data existing in all the rrd files of different
host is similar as am using the NAMES PRN327, PRN203, PRN202 to capture
the values (different hosts has different names). The length of the
NAMES are also not consistent across the hosts i.e. for server1   7
name:value are sent to hobbit  & for server 2 only 3 name:value
 How can I make the script dynamic ?
 #!/bin/sh
 # Input parameters: Hostname, testname (column), and messagefile
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
 if [ "$TESTNAME" = "printq" ]
then
 p1=`grep "^PRN327:" $FNAME | awk '{print $2}'`
p2=`grep "^PRN203:" $FNAME | awk '{print $2}'`
p3=`grep "^PRN202:" $FNAME | awk '{print $2}'`
quoted from Subhash Gada
  # The RRD dataset definitions
echo "DS:p1:GAUGE:600:0:U"
echo "DS:p2:GAUGE:600:0:U"
echo "DS:p3:GAUGE:600:0:U"
 # The filename
echo "printq.rrd"
 # The data
        echo "$p1:$p2:$p3"

        fi
       exit 0
 And how can I make the configuration even dynamic in the hobbitgraph.cfg
 [printq]
        TITLE Print Queue Status
        YAXIS Print Queue Length
        DEF:p1=printq.rrd:PRN327:AVERAGE
        DEF:p2=printq.rrd:PRN203:AVERAGE
        DEF:p3=printq.rrd:PRN202:AVERAGE
        AREA:p1#00FF00:        PRN 327
        GPRINT:p1:LAST: \: %5.1lf (cur)
        GPRINT:p1:MAX: \: %5.1lf (max)
        GPRINT:p1:MIN: \: %5.1lf (min)
        GPRINT:p1:AVERAGE: \: %5.1lf (avg)\n
        AREA:p2#FF0000:        PRN 230
        GPRINT:p2:LAST: \: %5.1lf (cur)
        GPRINT:p2:MAX: \: %5.1lf (max)
        GPRINT:p2:MIN: \: %5.1lf (min)
        GPRINT:p2:AVERAGE: \: %5.1lf (avg)\n
        AREA:p3#0000FF:        PRN 202
        GPRINT:p3:LAST: \: %5.1lf (cur)
        GPRINT:p3:MAX: \: %5.1lf (max)
        GPRINT:p3:MIN: \: %5.1lf (min)
        GPRINT:p3:AVERAGE: \: %5.1lf (avg)\n

Please let me know, if more information is required.

 Regards Subhash 
quoted from Subhash Gada

From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid] Sent: Monday, March 13, 2006 5:23 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: [hobbit] CUSTOM RRD DATA VIA SCRIPTS


Hi, 
We have few custom tests that measures printq of the print server
(windows). 
How can I write a script to create a rrd file and generate graphs. 
For example 
P Server 1 3/13/2006 Total queued jobs: 0 PRN324:0 PRN323:0 PRN142:0 PRN141:0 PRN140:0 PRN139:0 PRN138:0 
P Server 2 3/13/2006 Total queued jobs: 0 PRN314:0 PRN137:0 PRN136:0 
How to count the number of columns that vary from host to host. 
The column names are not common for all the hosts. 
Can any one help me further ? 
if [ "$TESTNAME"="printq" ]
then

p1=`grep "^PRN*:" $FNAME | awk '{print $2}'`
p2=`grep "^PRN*:" $FNAME | awk '{print $2}'`
p3=`grep "^PRN*:" $FNAME | awk '{print $2}'` 
# The RRD dataset definitions
echo "DS:p1:GAUGE:600:0:U"
echo "DS:p2:GAUGE:600:0:U"
echo "DS:p3:GAUGE:600:0:U" # The filename echo "printq.rrd" # The data
echo "$p1:$p2:$p3"

 Regards,  Subhash Gada   


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.
list Greg L Hubbard · Tue, 14 Mar 2006 08:53:55 -0600 ·
Subhash,
 Check out how data is collected for disk volumes.  I think you want to
create a different data set for each element, and then you can use the
matching items (like is used for the disk graphs) to plot all of the
relevant items in the same set of graphs.
 GLH
quoted from Subhash Gada


	From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid] 	Sent: Tuesday, March 14, 2006 12:49 AM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: FW: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
	
	
	Hi,
	 	May be I need to put this more clearly.
	 	Few custom test are running on the host side on windows systems
which measures print queue length of the print server.
	 	Hobbit is receiving data in the following format from the host
systems.
	 	From Server 1 	 	3/13/2006 Total queued jobs: 0 	PRN324:0 	PRN323:0 	PRN142:0 	PRN141:0 	PRN140:0 	PRN139:0 	PRN138:0 	 	From server 2
	 	3/13/2006 Total queued jobs: 0 	PRN327:0 	PRN203:0 	PRN202:0 	 	 	Initially I could thought of the following script to create rrd
file but if I use this script the data existing in all the rrd files of
different host is similar as am using the NAMES PRN327, PRN203, PRN202
to capture the values (different hosts has different names). The length
of the NAMES are also not consistent across the hosts i.e. for server1
7 name:value are sent to hobbit  & for server 2 only 3 name:value
	 	How can I make the script dynamic ?
	 	#!/bin/sh
	 	# Input parameters: Hostname, testname (column), and messagefile
	HOSTNAME="$1"
	TESTNAME="$2"
	FNAME="$3"
	 	if [ "$TESTNAME" = "printq" ]
	then
	 	p1=`grep "^PRN327:" $FNAME | awk '{print $2}'`
	p2=`grep "^PRN203:" $FNAME | awk '{print $2}'`
	p3=`grep "^PRN202:" $FNAME | awk '{print $2}'`
	 	 	# The RRD dataset definitions
	echo "DS:p1:GAUGE:600:0:U"
	echo "DS:p2:GAUGE:600:0:U"
	echo "DS:p3:GAUGE:600:0:U"
	 	# The filename
	echo "printq.rrd"
	 	# The data
	        echo "$p1:$p2:$p3"
	        fi
	       exit 0
	 	And how can I make the configuration even dynamic in the
hobbitgraph.cfg
	 	[printq]
	        TITLE Print Queue Status
	        YAXIS Print Queue Length
	        DEF:p1=printq.rrd:PRN327:AVERAGE
	        DEF:p2=printq.rrd:PRN203:AVERAGE
	        DEF:p3=printq.rrd:PRN202:AVERAGE
	        AREA:p1#00FF00:        PRN 327
	        GPRINT:p1:LAST: \: %5.1lf (cur)
	        GPRINT:p1:MAX: \: %5.1lf (max)
	        GPRINT:p1:MIN: \: %5.1lf (min)
	        GPRINT:p1:AVERAGE: \: %5.1lf (avg)\n
	        AREA:p2#FF0000:        PRN 230
	        GPRINT:p2:LAST: \: %5.1lf (cur)
	        GPRINT:p2:MAX: \: %5.1lf (max)
	        GPRINT:p2:MIN: \: %5.1lf (min)
	        GPRINT:p2:AVERAGE: \: %5.1lf (avg)\n
	        AREA:p3#0000FF:        PRN 202
	        GPRINT:p3:LAST: \: %5.1lf (cur)
	        GPRINT:p3:MAX: \: %5.1lf (max)
	        GPRINT:p3:MIN: \: %5.1lf (min)
	        GPRINT:p3:AVERAGE: \: %5.1lf (avg)\n
	
	Please let me know, if more information is required.
	
	 	Regards 	Subhash 	

	From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid] 	Sent: Monday, March 13, 2006 5:23 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
	
	
	Hi, 
	We have few custom tests that measures printq of the print
server (windows). 
	How can I write a script to create a rrd file and generate
graphs. 
	For example 
	P Server 1 	3/13/2006 Total queued jobs: 0 	PRN324:0 	PRN323:0 	PRN142:0 	PRN141:0 	PRN140:0 	PRN139:0 	PRN138:0 
	P Server 2 	3/13/2006 Total queued jobs: 0 	PRN314:0 	PRN137:0 	PRN136:0 
	How to count the number of columns that vary from host to host. 
	The column names are not common for all the hosts. 
	Can any one help me further ? 
	if [ "$TESTNAME"="printq" ]
	then
	
	p1=`grep "^PRN*:" $FNAME | awk '{print $2}'`
	p2=`grep "^PRN*:" $FNAME | awk '{print $2}'`
	p3=`grep "^PRN*:" $FNAME | awk '{print $2}'` 
	# The RRD dataset definitions
	echo "DS:p1:GAUGE:600:0:U"
	echo "DS:p2:GAUGE:600:0:U"
	echo "DS:p3:GAUGE:600:0:U" 	# The filename 	echo "printq.rrd" 	# The data
	echo "$p1:$p2:$p3"
	
	 Regards, 	 Subhash Gada 	  


	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.
list Subhash Gada · Wed, 15 Mar 2006 12:47:17 +0530 ·
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 
quoted from Greg L Hubbard


From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid] Sent: Tuesday, March 14, 2006 8:24 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] CUSTOM RRD DATA VIA SCRIPTS


Subhash,
 Check out how data is collected for disk volumes.  I think you want to
create a different data set for each element, and then you can use the
matching items (like is used for the disk graphs) to plot all of the
relevant items in the same set of graphs.
 GLH


	From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid] 	Sent: Tuesday, March 14, 2006 12:49 AM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: FW: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
	
	
	Hi,
	 	May be I need to put this more clearly.
	 	Few custom test are running on the host side on windows systems
which measures print queue length of the print server.
	 	Hobbit is receiving data in the following format from the host
systems.
	 	From Server 1 	 	3/13/2006 Total queued jobs: 0 	PRN324:0 	PRN323:0 	PRN142:0 	PRN141:0 	PRN140:0 	PRN139:0 	PRN138:0 	 	From server 2
	 	3/13/2006 Total queued jobs: 0 	PRN327:0 	PRN203:0 	PRN202:0 	 	 	Initially I could thought of the following script to create rrd
file but if I use this script the data existing in all the rrd files of
different host is similar as am using the NAMES PRN327, PRN203, PRN202
to capture the values (different hosts has different names). The length
of the NAMES are also not consistent across the hosts i.e. for server1
7 name:value are sent to hobbit  & for server 2 only 3 name:value
	 	How can I make the script dynamic ?
	 	#!/bin/sh
	 	# Input parameters: Hostname, testname (column), and messagefile
	HOSTNAME="$1"
	TESTNAME="$2"
	FNAME="$3"
	 	if [ "$TESTNAME" = "printq" ]
	then
	 	p1=`grep "^PRN327:" $FNAME | awk '{print $2}'`
	p2=`grep "^PRN203:" $FNAME | awk '{print $2}'`
	p3=`grep "^PRN202:" $FNAME | awk '{print $2}'`
	 	 	# The RRD dataset definitions
	echo "DS:p1:GAUGE:600:0:U"
	echo "DS:p2:GAUGE:600:0:U"
	echo "DS:p3:GAUGE:600:0:U"
	 	# The filename
	echo "printq.rrd"
	 	# The data
	        echo "$p1:$p2:$p3"
	        fi
	       exit 0
	 	And how can I make the configuration even dynamic in the
hobbitgraph.cfg
	 	[printq]
	        TITLE Print Queue Status
	        YAXIS Print Queue Length
	        DEF:p1=printq.rrd:PRN327:AVERAGE
	        DEF:p2=printq.rrd:PRN203:AVERAGE
	        DEF:p3=printq.rrd:PRN202:AVERAGE
	        AREA:p1#00FF00:        PRN 327
	        GPRINT:p1:LAST: \: %5.1lf (cur)
	        GPRINT:p1:MAX: \: %5.1lf (max)
	        GPRINT:p1:MIN: \: %5.1lf (min)
	        GPRINT:p1:AVERAGE: \: %5.1lf (avg)\n
	        AREA:p2#FF0000:        PRN 230
	        GPRINT:p2:LAST: \: %5.1lf (cur)
	        GPRINT:p2:MAX: \: %5.1lf (max)
	        GPRINT:p2:MIN: \: %5.1lf (min)
	        GPRINT:p2:AVERAGE: \: %5.1lf (avg)\n
	        AREA:p3#0000FF:        PRN 202
	        GPRINT:p3:LAST: \: %5.1lf (cur)
	        GPRINT:p3:MAX: \: %5.1lf (max)
	        GPRINT:p3:MIN: \: %5.1lf (min)
	        GPRINT:p3:AVERAGE: \: %5.1lf (avg)\n
	
	Please let me know, if more information is required.
	
	 	Regards 	Subhash 	

	From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid] 	Sent: Monday, March 13, 2006 5:23 PM
	To: user-ae9b8668bcde@xymon.invalid
	Subject: [hobbit] CUSTOM RRD DATA VIA SCRIPTS
	
	
	Hi, 
	We have few custom tests that measures printq of the print
server (windows). 
	How can I write a script to create a rrd file and generate
graphs. 
	For example 
	P Server 1 	3/13/2006 Total queued jobs: 0 	PRN324:0 	PRN323:0 	PRN142:0 	PRN141:0 	PRN140:0 	PRN139:0 	PRN138:0 
	P Server 2 	3/13/2006 Total queued jobs: 0 	PRN314:0 	PRN137:0 	PRN136:0 
	How to count the number of columns that vary from host to host. 
	The column names are not common for all the hosts. 
	Can any one help me further ? 
	if [ "$TESTNAME"="printq" ]
	then
	
	p1=`grep "^PRN*:" $FNAME | awk '{print $2}'`
	p2=`grep "^PRN*:" $FNAME | awk '{print $2}'`
	p3=`grep "^PRN*:" $FNAME | awk '{print $2}'` 
	# The RRD dataset definitions
	echo "DS:p1:GAUGE:600:0:U"
	echo "DS:p2:GAUGE:600:0:U"
	echo "DS:p3:GAUGE:600:0:U" 	# The filename 	echo "printq.rrd" 	# The data
	echo "$p1:$p2:$p3"
	
	 Regards, 	 Subhash Gada 	  


	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.
list Werner Michels · Wed, 15 Mar 2006 09:08:34 -0300 ·
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
quoted from Subhash Gada
"Gada, Subhash" <user-9bc6f87e5088@xymon.invalid> 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 
list Greg L Hubbard · Wed, 15 Mar 2006 10:07:19 -0600 ·
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
quoted from Werner Michels


-----Original Message-----
From: Werner (Ext Lists) [mailto:user-a58d6bcc049e@xymon.invalid] 
Sent: Wednesday, March 15, 2006 6:09 AM
To: user-ae9b8668bcde@xymon.invalid
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" <user-9bc6f87e5088@xymon.invalid> 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

list Subhash Gada · Thu, 16 Mar 2006 10:27:58 +0530 ·
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
quoted from Greg L Hubbard


-----Original Message-----
From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid] 
Sent: Wednesday, March 15, 2006 9:37 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-a58d6bcc049e@xymon.invalid]
Sent: Wednesday, March 15, 2006 6:09 AM
To: user-ae9b8668bcde@xymon.invalid
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" <user-9bc6f87e5088@xymon.invalid> 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

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.
list Greg L Hubbard · Thu, 16 Mar 2006 08:18:33 -0600 ·
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 
quoted from Subhash Gada

-----Original Message-----
From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid] 
Sent: Wednesday, March 15, 2006 10:58 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-d970b5e56ec9@xymon.invalid]
Sent: Wednesday, March 15, 2006 9:37 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-a58d6bcc049e@xymon.invalid]
Sent: Wednesday, March 15, 2006 6:09 AM
To: user-ae9b8668bcde@xymon.invalid
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" <user-9bc6f87e5088@xymon.invalid> 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

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.
list Subhash Gada · Fri, 17 Mar 2006 15:06:25 +0530 ·
 
Hi,

If any one has implemented this, Could you please share with me? 
quoted from Greg L Hubbard


Regards
Subhash


-----Original Message-----
From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid] 
Sent: Thursday, March 16, 2006 7:49 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] CUSTOM RRD DATA VIA SCRIPTS

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:user-9bc6f87e5088@xymon.invalid]
Sent: Wednesday, March 15, 2006 10:58 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-d970b5e56ec9@xymon.invalid]
Sent: Wednesday, March 15, 2006 9:37 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-a58d6bcc049e@xymon.invalid]
Sent: Wednesday, March 15, 2006 6:09 AM
To: user-ae9b8668bcde@xymon.invalid
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" <user-9bc6f87e5088@xymon.invalid> 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

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.
list Robert Taylor · Fri, 17 Mar 2006 08:04:13 -0500 ·
Here is my poor attempt to help.  From what I understand you have the output of this test that has a number of values being sent in the form form of Name:Value.  You want to seperate out the name and the value so that you can create an RRD of the values witht the DS being the name.  If that is the case then you can loop through the returned values with something like:
 
GREP="/bin/grep"
MSGFILE="<whatever conains your data>"
cat $MSGFILE | $GREP "^PRN*" | sed 's/\:/ /g'
while read linein
do
 set $linein
 $PRN_NAME=$1
 $PRN_VALUE=$2
 <Whatever you want to do with values $PRN_NAME and $PRN_VALUE>
done
 
 I think that there is a way for Hobbit to send the script the output of the test message, I just don't recall what that is.  If it does in fact send the output of the test message, which would have all of your data:value pairs, then just replace the $MSGFILE variable with whatever the variable is that sends the data.
 
Then within the "while" statement enter in process that you wish to execute with each line pair.  This while process will basically go line by line through the $MSGFILE looking for lines that begin with PRN.  It will replace the ":" with a blank space so that it can be pulled apart later.
 
I am trying to write this from memory so there may be a bit of troubleshooting left to do, but it should get you close on how to use a loop to break apart and take action on some basic information.
 
Robert
quoted from Subhash Gada


From: Gada, Subhash [mailto:user-9bc6f87e5088@xymon.invalid]
Sent: Fri 3/17/2006 4:36 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] CUSTOM RRD DATA VIA SCRIPTS


Hi,

If any one has implemented this, Could you please share with me?


Regards
Subhash


-----Original Message-----
From: Hubbard, Greg L [mailto:user-d970b5e56ec9@xymon.invalid]
Sent: Thursday, March 16, 2006 7:49 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] CUSTOM RRD DATA VIA SCRIPTS

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:user-9bc6f87e5088@xymon.invalid]
Sent: Wednesday, March 15, 2006 10:58 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-d970b5e56ec9@xymon.invalid]
Sent: Wednesday, March 15, 2006 9:37 PM
To: user-ae9b8668bcde@xymon.invalid
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:user-a58d6bcc049e@xymon.invalid]
Sent: Wednesday, March 15, 2006 6:09 AM
To: user-ae9b8668bcde@xymon.invalid
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" <user-9bc6f87e5088@xymon.invalid> 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

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.