BB Unix Network Monitor - Message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
{bb} How to make MRTG taste like LARRD. or... MRTG with RRDTOOL and Big Brother integration.
I wrote this ext pretty quickly (in less time than it took me to write
this message). It's really basic but it does what I need it to do. Using the
RRDTool option in mrtg is faster (because the all the graphs are not created
every five minutes) and the graphs look more like LARRD graphs. Threshold
alerts are not implemented at all, which is kind of a bummer (anyone,
anyone, Bueller.... Bueller?). But the result is still kinda cool.... It
makes MRTG look, feel, smell and even taste just like larrd (I had to say
it). Enjoy... Feedback is, of course, always welcome.
------------ begin basic instructions to install and configure ----------
You have to set up MRTG and the 14all.cgi script per the MRTG instructions.
Get the latest from the author's
site...(http://www.uni-ulm.de/~rbawidam/mrtg-rrd/). The one that comes with
MRTG (in the contrib section) is old and sucks. Also get the latest version
of RRDTool (http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/). Avoid RRD
version 1.0.9 like the plague (trust me). You will of course, need MRTG
(http://ee-staff.ethz.ch/~oetiker/webtools/mrtg)
When you set up mrtg, create a subdir for each router (or whatever yer
monitoring) in your WorkDir and use the Directory tag in each Target
section. Basically... set up MRTG the way that 14all.cgi likes it to be,
here's part of mine.....
------------ begin sample mrtg.cfg ----------------------
# Add a WorkDir: /some/path line to this file
Workdir: /usr/local/mrtg/rrd
IconDir: /images
UseRRDTool:Yes # <-- very important.. you must use RRDTool for 14all.cgi
and you must have 14all.cgi working to use ext/mrtg.sh
Interval:5
Options[_]: bits #<--- default is bytes... why?
Target[INSERT.HOST.NAME1.HERE]: 19:mrtg@INSERT.IP.ADDRESS1.HERE
Directory[INSERT.HOST.NAME1.HERE]: msp1
MaxBytes[INSERT.HOST.NAME1.HERE]: 193000
Title[INSERT.HOST.NAME1.HERE]: msp1: Serial1/7:0
PageTop[INSERT.HOST.NAME1.HERE]: Traffic Analysis for Serial1/7:0 on msp1
Target[INSERT.HOST.NAME2.HERE]: 2:mrtg@INSERT.IP.ADDRESS2.HERE
Directory[INSERT.HOST.NAME2.HERE]: gw
MaxBytes[INSERT.HOST.NAME2.HERE]: 193000
Title[INSERT.HOST.NAME2.HERE]: gw: Serial0
PageTop[INSERT.HOST.NAME2.HERE]: Traffic Analysis for Serial0 on gw
--------------------end sample mrtg.cfg -----------------------
----------------------continue basic instructions to install and
configure ---------
See those 'Directory' tags? those end up being the name of my target in BB.
I put in entries in bb-hosts for each router (msp1 and gw) and add 'mrtg' bb
directives tags.
---------------------end basic instructions to install and
configure --------------
----------------------- begin the script
($BBHOME/ext/mrtg.sh)-----------------------------------
#!/bin/sh
#set some handy variables.
LYNX_DUMP="/usr/local/bin/lynx --dump"; export LYNX_DUMP
LYNX_SOURCE="/usr/local/bin/lynx --source"; export LYNX_SOURCE
PERL=/usr/local/bin/perl ;export PERL
MRTG_HOME=/usr/local/mrtg; export MRTG_HOME
MRTG_CFG=$MRTG_HOME/mrtg.cfg; export MRTG_CFG
MRTG_CGI=https://mspprdmon01.webhelp.com/cgi-bin/14all.cgi; export MRTG_CGI
BBPROG=mrtg ;export BBPROG
BBHOME=/usr/local/bb ;export BBHOME
if test "$BBHOME" = ""
then
echo "BBHOME is not set... exiting"
exit 1
fi
if test ! "$BBTMP" # GET DEFINITIONS IF NEEDED
then
# echo "*** LOADING BBDEF ***"
. $BBHOME/etc/bbdef.sh # INCLUDE STANDARD DEFINITIONS
fi
# --- First Run MRTG's 5 minute cycle... make sure you don't have daemon
mode set
# --- Running MRTG through this script is optional (and I'm sure some would
argue stupid)
# `$MRTG_HOME/run/mrtg $MRTG_CFG`
# --- Next run a lynx dump against 14all.cgi to get the group paths
# --- The groups are created with directory entries in mrtg.cfg
# --- Create a directory line for each router you have in bb-hosts
for I in `$LYNX_DUMP $MRTG_CGI | $GREP Group |$SED 's/ \[.*\]Group
file://'`
do
CGI_DUMP=`$LYNX_SOURCE $MRTG_CGI?dir=$I | $SED 's/.*DOCTYPE.*//' | $SED
's/\<HTML\>//' | $SED 's/\<HEAD\>//' | $SED 's/\<TITLE.*TITLE\>//' | $SED
's/.*REV\=MADE.*//' | $SED 's/\<\/HEAD\>//' | $SED 's/\<BODY
BGCOLOR\=\".*\"\>//' | $SED 's/\<\/BODY\>\<\/HTML>//'`
#--- send the status
$BB $BBDISP "status $I.mrtg green `$DATE` - MRTG is accumulating `echo
$CGI_DUMP`"
done
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.
Home |
Main Index |
Thread Index