[hobbit] MRTG-based Graphs in Trends Section
Schwimmer, Eric E *HS
EES2Y at hscmail.mcc.virginia.edu
Tue May 17 20:53:19 CEST 2005
Henrik,
Works great! Thanks so much!
For those that dont want to read the c code, you need to replace the title
in your [mrtg] stanza in the hobbitgraph.cgi file with something like the following:
TITLE exec:/usr/local/hobbit/server/bin/mrtg-title.sh
... or wherever you saved the shell script below to.
One small change I made to the shell script was to change the MRTGTITLE capture line to:
MRTGTITLE=`grep -i "Title\[$MRTGSET\]:" /usr/local/mrtg/cfg/$HOSTNAME.cfg | cut -d: -f2-`
...since our hosts our configured on a per-file basis and included from the main mrtg.conf
Thanks again!
-Eric
-----Original Message-----
From: Henrik Stoerner [mailto:henrik at hswn.dk]
Sent: Sun 5/15/2005 3:53 AM
To: hobbit at hswn.dk
Cc:
Subject: Re: [hobbit] MRTG-based Graphs in Trends Section
On Thu, May 12, 2005 at 12:28:31PM -0400, Oktay, Alan F. *HS wrote:
> Any way to have Hobbit read the Title Tag in the MRTG Configuration File
> and thus label the graphs accordingly?
Not directly, but the attached patch lets you have an external
script decide what the title is.
I've tried it on my own MRTG setup and it appears to work fine.
I used this script to generate the title from mrtg.cfg (note that
you may have to change the permissions on mrtg.cfg to let the
CGI user read it):
#!/bin/sh
HOSTNAME="$1"; shift
GTYPE="$1"; shift
LEGEND="$1"; shift
RRD="$1"; shift
#echo "RRD=$RRD, rest is $*" >>/tmp/title.log
MRTGSET="`echo $RRD | sed -e's/\.rrd$//'`"
#echo "MRTGSET=$MRTGSET" >>/tmp/title.log
MRTGTITLE=`grep -i "Title\[$MRTGSET\]:" /etc/mrtg.cfg | cut -d: -f2-`
#echo "TITLE=$MRTGTITLE" >>/tmp/title.log
echo "$MRTGTITLE $LEGEND"
exit 0
Regards,
Henrik
More information about the Xymon
mailing list