Xymon Mailing List Archive search

integration of foreign graphs

6 messages in this thread

list Martin Flemming · Tue, 19 Jun 2012 22:03:54 +0200 (CEST) ·
Hi !

Is there any "easy" method to integrate foreign graphs
into xymon or rather into of an existing page of a host ?

The background is, i've got an script from my colleagues,
which gathers data from ibm-Scale-Out-network-storage (SONAS),
generats rrd's and corresponding png's which i want integrated in one page 
of xymon .....

Any hint is welcome ...


thanks & cheers

        Martin
list David Baldwin · Wed, 20 Jun 2012 11:00:39 +1000 ·
Martin,
quoted from Martin Flemming
Is there any "easy" method to integrate foreign graphs
into xymon or rather into of an existing page of a host ?

The background is, i've got an script from my colleagues,
which gathers data from ibm-Scale-Out-network-storage (SONAS),
generats rrd's and corresponding png's which i want integrated in one page 
of xymon .....

Any hint is welcome ...
If the RRDs are already being generated, you can put symlinks from the
respective host directory to the RRDs wherever they are as long as you
have read access. Then add a section to graphs.cfg (you may need to use
'rrdtool info' to look at the variables and data) and make sure the
graph name is added to GRAPHS variable in server.cfg so they will appear
in the trends. A small gotcha is that the start of the file name of the
RRD file has to match the graph name.

For example, I just created a bunch of symlinks under various SAN
devices to point to the RRDs being generated for the interface they were
connected to on the switch:

$ ls -l /var/lib/hobbit/rrd/fc01-1.fc.ausport.gov.au/
total 40
lrwxrwxrwx 1 root   root      44 Jun  8 16:49 if_load.c0pA.rrd ->
../fcsw01.fc.ausport.gov.au/if_load.10_1.rrd
lrwxrwxrwx 1 root   root      43 Jun  8 16:50 if_load.c0pB.rrd ->
../fcsw01.fc.ausport.gov.au/if_load.9_1.rrd
lrwxrwxrwx 1 root   root      44 Jun  8 16:49 if_load.c1pA.rrd ->
../fcsw01.fc.ausport.gov.au/if_load.10_2.rrd
lrwxrwxrwx 1 root   root      43 Jun  8 16:50 if_load.c1pB.rrd ->
../fcsw01.fc.ausport.gov.au/if_load.9_2.rrd

$ rrdtool info
/var/lib/hobbit/rrd/fc01-1.fc.ausport.gov.au/if_load.c0pA.rrd
filename = "/var/lib/hobbit/rrd/fc01-1.fc.ausport.gov.au/if_load.c0pA.rrd"
rrd_version = "0003"
step = 300
last_update = 1340153686
ds[ds0].type = "COUNTER"
ds[ds0].minimal_heartbeat = 600
ds[ds0].min = 0.0000000000e+00
ds[ds0].max = NaN
ds[ds0].last_ds = "3927680624"
ds[ds0].value = 0.0000000000e+00
ds[ds0].unknown_sec = 0
ds[ds1].type = "COUNTER"
ds[ds1].minimal_heartbeat = 600
ds[ds1].min = 0.0000000000e+00
ds[ds1].max = NaN
ds[ds1].last_ds = "2279001344"
ds[ds1].value = 0.0000000000e+00
ds[ds1].unknown_sec = 0
...


graphs.cfg section

[if_load]
        FNPATTERN ^if_load\.(.+).rrd
        TITLE Network Traffic (MRTG-style)
        YAXIS Bits/second
        DEF:inbytes at RRDIDX@=@RRDFN@:ds0:AVERAGE
        CDEF:in at RRDIDX@=inbytes at RRDIDX@,8,*
        DEF:outbytes at RRDIDX@=@RRDFN@:ds1:AVERAGE
        CDEF:out at RRDIDX@=outbytes at RRDIDX@,8,*
        LINE2:in at RRDIDX@#@COLOR@:@RRDPARAM@  inbound
        GPRINT:in at RRDIDX@:LAST: \: %10.1lf (cur)
        GPRINT:in at RRDIDX@:MAX: \: %10.1lf (max)
        GPRINT:in at RRDIDX@:MIN: \: %10.1lf (min)
        GPRINT:in at RRDIDX@:AVERAGE: \: %10.1lf (avg)\n
        LINE2:out at RRDIDX@#@COLOR@:@RRDPARAM@ outbound
        GPRINT:out at RRDIDX@:LAST: \: %10.1lf (cur)
        GPRINT:out at RRDIDX@:MAX: \: %10.1lf (max)
        GPRINT:out at RRDIDX@:MIN: \: %10.1lf (min)
        GPRINT:out at RRDIDX@:AVERAGE: \: %10.1lf (avg)\n

David.

-- 
David Baldwin - Senior Systems Administrator (Datacentres + Networks)
Information and Communication Technology Services
Australian Sports Commission          http://ausport.gov.au
Tel 02 62147830 Fax 02 62141830       PO Box 176 Belconnen ACT 2616
user-cbbf693f2c89@xymon.invalid          Leverrier Street Bruce ACT 2617


Keep up to date with what's happening in Australian sport visit http://www.ausport.gov.au

This message is intended for the addressee named and may contain confidential and privileged information. If you are not the intended recipient please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you receive this message in error, please delete it and notify the sender.
list Mark Hinkle · Wed, 20 Jun 2012 12:24:10 -0700 ·
If you need to deal directly with the rrd's, then David's response has you covered nicely.

If you don't need to deal with the rrd's directly, i.e. you have images already (png) or a UI for accessing the graphs (Cacti), then another approach *might* be easier. YMMV, of course. We use Cacti for our graphing needs and incorporate those graph(s) into Xymon via an updated "svcstatus.sh" cgi script. There is a config file that we have created to hold the "mapping" info:

~xymon/server/etc/cacti.cfg
host1.cpu:2345
host1.disk:745

host2.cpu:13
host2.disk:456
host2.disk:457
host2.disk:458
etc.
etc.

where, above, the host and service are clear and are mapped to the local_graph_id in Cacti. The other side of the ":" could be anything though, as you will see. Assuming you are using the xymon dynamic status page setup, when you go to a particular status page in xymon you can see the host and service in the URL as parameters passed to svcstatus.sh. I have updated the svcstatus.sh to use the above config file to add a link into the displayed xymon page based on those parameters:

~xymon/cgi-bin/svcstatus.sh
#!/usr/bin/bash

# This is a wrapper for the Xymon svcstatus.cgi script

. /usr/xymon/server/etc/cgioptions.cfg

# Get HOST and SERVICE
export `echo $QUERY_STRING | sed -e "s/\&.*$//"`
export `echo $QUERY_STRING | sed -e "s/^[^\&]*\&//"`

for i in `cat /usr/xymon/server/etc/cacti.cfg | grep "$HOST\.$SERVICE" | awk -F: '{ print $2 }'`; do

   # Just appends multiple links/images/whatever to a temp file so you can get multiple images/graphs on the same page
   echo -n "<\/TD><\/TR><\/TABLE><TABLE><TR><TD align=center><a href='http:\/\/our.cacti.host\/cacti\/graph.php?local_graph_id=$i\&rra_id=all' target='_blank'><img src='http:\/\/our.cacti.host\/cacti\/graph_image.php?local_graph_id=$i\&rra_id=1' border=0><\/a>" >> /tmp/cactigraph.$$
done

# Get the temp file contents into a env variable for easy regexp use below
if [ -r /tmp/cactigraph.$$ ] ; then
   CACTI=`cat /tmp/cactigraph.$$`
else
   CACTI=""
fi
rm -f /tmp/cactigraph.$$

# Insert the links in the output of the status page for display
if [ ! -z "$CACTI" ] ; then
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS | sed -e "s/<PRE>/$CACTI<PRE>/"
else
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS
fi


You can really make that link anything you need; for us it is a call to cacti using the local_graph_id but for an existing png you could make the other side of the ":" in the config file the png filename and just use a straight <img> tag. Hope this helps.

-- 
Mark L. Hinkle
user-9816e24cee8c@xymon.invalid
list Japheth Cleaver · Wed, 20 Jun 2012 22:00:26 -0700 (PDT) ·
Xymond_rrd also has an option for an "external processor", which you can
use to inject metrics data elsewhere as well. I was inserting directly
into an OpenTSDB instance for a while using that and it worked fine.

-jc
quoted from Mark Hinkle

If you need to deal directly with the rrd's, then David's response has you
covered nicely.

If you don't need to deal with the rrd's directly, i.e. you have images
already (png) or a UI for accessing the graphs (Cacti), then another
approach *might* be easier. YMMV, of course. We use Cacti for our graphing
needs and incorporate those graph(s) into Xymon via an updated
"svcstatus.sh" cgi script. There is a config file that we have created to
hold the "mapping" info:

~xymon/server/etc/cacti.cfg
host1.cpu:2345
host1.disk:745

host2.cpu:13
host2.disk:456
host2.disk:457
host2.disk:458
etc.
etc.

where, above, the host and service are clear and are mapped to the
local_graph_id in Cacti. The other side of the ":" could be anything
though, as you will see. Assuming you are using the xymon dynamic status
page setup, when you go to a particular status page in xymon you can see
the host and service in the URL as parameters passed to svcstatus.sh. I
have updated the svcstatus.sh to use the above config file to add a link
into the displayed xymon page based on those parameters:

~xymon/cgi-bin/svcstatus.sh
#!/usr/bin/bash

# This is a wrapper for the Xymon svcstatus.cgi script

. /usr/xymon/server/etc/cgioptions.cfg

# Get HOST and SERVICE
export `echo $QUERY_STRING | sed -e "s/\&.*$//"`
export `echo $QUERY_STRING | sed -e "s/^[^\&]*\&//"`

for i in `cat /usr/xymon/server/etc/cacti.cfg | grep "$HOST\.$SERVICE" |
awk -F: '{ print $2 }'`; do

   # Just appends multiple links/images/whatever to a temp file so you can
get multiple images/graphs on the same page
   echo -n "<\/TD><\/TR><\/TABLE><TABLE><TR><TD align=center><a
href='http:\/\/our.cacti.host\/cacti\/graph.php?local_graph_id=$i\&rra_id=all'
target='_blank'><img
src='http:\/\/our.cacti.host\/cacti\/graph_image.php?local_graph_id=$i\&rra_id=1'
border=0><\/a>" >> /tmp/cactigraph.$$
done

# Get the temp file contents into a env variable for easy regexp use below
if [ -r /tmp/cactigraph.$$ ] ; then
   CACTI=`cat /tmp/cactigraph.$$`
else
   CACTI=""
fi
rm -f /tmp/cactigraph.$$

# Insert the links in the output of the status page for display
if [ ! -z "$CACTI" ] ; then
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS | sed -e
"s/<PRE>/$CACTI<PRE>/"
else
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS
fi


You can really make that link anything you need; for us it is a call to
cacti using the local_graph_id but for an existing png you could make the
other side of the ":" in the config file the png filename and just use a
straight <img> tag. Hope this helps.

--
Mark L. Hinkle
user-9816e24cee8c@xymon.invalid

list Martin Flemming · Thu, 21 Jun 2012 13:40:09 +0200 (CEST) ·
Thanks a lot for answering !

David's suggestion was the hint which lead me to success,
although i don't wanted to create graph definitions for the rrd's,
because almost it sucks me :-)

Mark's solution is very interesting,
and if i've got some time i will test it also ..

jc's pointer i didn't understand it .. :-(
perhaps do you mean the option --extra-script for xymond_rrd ?

Thanks a lot & cheers

 	martin
quoted from Japheth Cleaver


On Wed, 20 Jun 2012, user-87556346d4af@xymon.invalid wrote:
Xymond_rrd also has an option for an "external processor", which you can
use to inject metrics data elsewhere as well. I was inserting directly
into an OpenTSDB instance for a while using that and it worked fine.

-jc

If you need to deal directly with the rrd's, then David's response has you
covered nicely.

If you don't need to deal with the rrd's directly, i.e. you have images
already (png) or a UI for accessing the graphs (Cacti), then another
approach *might* be easier. YMMV, of course. We use Cacti for our graphing
needs and incorporate those graph(s) into Xymon via an updated
"svcstatus.sh" cgi script. There is a config file that we have created to
hold the "mapping" info:

~xymon/server/etc/cacti.cfg
host1.cpu:2345
host1.disk:745

host2.cpu:13
host2.disk:456
host2.disk:457
host2.disk:458
etc.
etc.

where, above, the host and service are clear and are mapped to the
local_graph_id in Cacti. The other side of the ":" could be anything
though, as you will see. Assuming you are using the xymon dynamic status
page setup, when you go to a particular status page in xymon you can see
the host and service in the URL as parameters passed to svcstatus.sh. I
have updated the svcstatus.sh to use the above config file to add a link
into the displayed xymon page based on those parameters:

~xymon/cgi-bin/svcstatus.sh
#!/usr/bin/bash

# This is a wrapper for the Xymon svcstatus.cgi script

. /usr/xymon/server/etc/cgioptions.cfg

# Get HOST and SERVICE
export `echo $QUERY_STRING | sed -e "s/\&.*$//"`
export `echo $QUERY_STRING | sed -e "s/^[^\&]*\&//"`

for i in `cat /usr/xymon/server/etc/cacti.cfg | grep "$HOST\.$SERVICE" |
awk -F: '{ print $2 }'`; do

   # Just appends multiple links/images/whatever to a temp file so you can
get multiple images/graphs on the same page
   echo -n "<\/TD><\/TR><\/TABLE><TABLE><TR><TD align=center><a
href='http:\/\/our.cacti.host\/cacti\/graph.php?local_graph_id=$i\&rra_id=all'
target='_blank'><img
src='http:\/\/our.cacti.host\/cacti\/graph_image.php?local_graph_id=$i\&rra_id=1'
border=0><\/a>" >> /tmp/cactigraph.$$
done

# Get the temp file contents into a env variable for easy regexp use below
if [ -r /tmp/cactigraph.$$ ] ; then
   CACTI=`cat /tmp/cactigraph.$$`
else
   CACTI=""
fi
rm -f /tmp/cactigraph.$$

# Insert the links in the output of the status page for display
if [ ! -z "$CACTI" ] ; then
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS | sed -e
"s/<PRE>/$CACTI<PRE>/"
else
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS
fi


You can really make that link anything you need; for us it is a call to
cacti using the local_graph_id but for an existing png you could make the
other side of the ":" in the config file the png filename and just use a
straight <img> tag. Hope this helps.

--
Mark L. Hinkle
user-9816e24cee8c@xymon.invalid

list Japheth Cleaver · Fri, 22 Jun 2012 07:38:09 -0700 (PDT) ·
quoted from Martin Flemming
jc's pointer i didn't understand it .. :-(
perhaps do you mean the option --extra-script for xymond_rrd ?

Thanks a lot & cheers

 	martin
Yep. It can be used to intercept the data rrd is about to send off to
rrdtool and send it to something else as well. I had a small script that
converted lines from (say) disk utilization to relevant OpenTSDB metrics.

-jc
quoted from Martin Flemming

On Wed, 20 Jun 2012, user-87556346d4af@xymon.invalid wrote:
Xymond_rrd also has an option for an "external processor", which you can
use to inject metrics data elsewhere as well. I was inserting directly
into an OpenTSDB instance for a while using that and it worked fine.

-jc

If you need to deal directly with the rrd's, then David's response has
you
covered nicely.

If you don't need to deal with the rrd's directly, i.e. you have images
already (png) or a UI for accessing the graphs (Cacti), then another
approach *might* be easier. YMMV, of course. We use Cacti for our
graphing
needs and incorporate those graph(s) into Xymon via an updated
"svcstatus.sh" cgi script. There is a config file that we have created
to
hold the "mapping" info:

~xymon/server/etc/cacti.cfg
host1.cpu:2345
host1.disk:745

host2.cpu:13
host2.disk:456
host2.disk:457
host2.disk:458
etc.
etc.

where, above, the host and service are clear and are mapped to the
local_graph_id in Cacti. The other side of the ":" could be anything
though, as you will see. Assuming you are using the xymon dynamic
status
page setup, when you go to a particular status page in xymon you can
see
the host and service in the URL as parameters passed to svcstatus.sh. I
have updated the svcstatus.sh to use the above config file to add a
link
into the displayed xymon page based on those parameters:

~xymon/cgi-bin/svcstatus.sh
#!/usr/bin/bash

# This is a wrapper for the Xymon svcstatus.cgi script

. /usr/xymon/server/etc/cgioptions.cfg

# Get HOST and SERVICE
export `echo $QUERY_STRING | sed -e "s/\&.*$//"`
export `echo $QUERY_STRING | sed -e "s/^[^\&]*\&//"`

for i in `cat /usr/xymon/server/etc/cacti.cfg | grep "$HOST\.$SERVICE"
|
awk -F: '{ print $2 }'`; do

   # Just appends multiple links/images/whatever to a temp file so you
can
get multiple images/graphs on the same page
   echo -n "<\/TD><\/TR><\/TABLE><TABLE><TR><TD align=center><a
href='http:\/\/our.cacti.host\/cacti\/graph.php?local_graph_id=$i\&rra_id=all'
target='_blank'><img
src='http:\/\/our.cacti.host\/cacti\/graph_image.php?local_graph_id=$i\&rra_id=1'
border=0><\/a>" >> /tmp/cactigraph.$$
done

# Get the temp file contents into a env variable for easy regexp use
below
if [ -r /tmp/cactigraph.$$ ] ; then
   CACTI=`cat /tmp/cactigraph.$$`
else
   CACTI=""
fi
rm -f /tmp/cactigraph.$$

# Insert the links in the output of the status page for display
if [ ! -z "$CACTI" ] ; then
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS | sed -e
"s/<PRE>/$CACTI<PRE>/"
else
   exec /usr/xymon/server/bin/svcstatus.cgi $CGI_SVC_OPTS
fi


You can really make that link anything you need; for us it is a call to
cacti using the local_graph_id but for an existing png you could make
the
other side of the ":" in the config file the png filename and just use
a
straight <img> tag. Hope this helps.

--
Mark L. Hinkle
user-9816e24cee8c@xymon.invalid