[Xymon] integration of foreign graphs

cleaver at terabithia.org cleaver at terabithia.org
Thu Jun 21 07:00:26 CEST 2012


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
> hinkman at hinkman.com
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>





More information about the Xymon mailing list