[mrtg] Re: multiple configs

Chris Josephes cjoseph at mr.net
Wed Oct 13 18:06:40 MEST 1999


On Wed, 13 Oct 1999, Nail, Thomas wrote:

> Hello all,
> just a quick request: Does anyone have a script that will let you monitor
> more than one cfg at a time? I'm monitoring 6 different cfg's for various
> elements on over 150 machines and I'm running out of space to do them in a
> crontab. Any help would be appreciated.


The following script should spawn MRTG processes in parallel.

When running it, give it the name of a subdirectory where your *.cfg files
are.  It also pipes stderr to a file, and emails it out if it contains any
information.

I usually break the groups out into the monitoring interval, so I can have
a simple crontab like this:

0,15,30,45 * * * * /usr/local/mrtg/[script] /usr/local/mrtg/cfg/cluster1
0,10,20,30,40,50 * * * * /usr/local/mrtg/[script] \
/usr/local/mrtg/cfg/cluster2
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/mrtg/[script] \
/usr/local/mrtg/cluster3

#!/bin/sh

# Runs through the MRTG config files

HOME=/usr/local/mrtg
export HOME

if [ -e "$HOME/NORUN" ]; then
        echo "Can't run Config update in progess"
        exit 1
fi

if [ ! $1 ]; then
        echo "Error: No config dir specified"
        exit 2
fi

DIR=$HOME/cfg/$1
export DIR

if [ ! -d $DIR ]; then
        echo "Error: $DIR is not a directory"
        exit 2
fi

echo "Using directory $DIR"

for i in `ls -1 $DIR/*.cfg`
do
        echo "Running mrtg against $i"
        $HOME/mrtg $i 2> $HOME/$$.errors &
done

if [ -s $HOME/$$.errors ]; then
        cat $HOME/$$.errors | mail -s "MRTG Errors" mrtg at mr.net
fi
rm $HOME/$$.errors


--                      _______________
 Chris Josephes      __/ MRNet/Onvoy   \
 chrisj at mr.net    __/   www.onvoy.com  /
\________________/

--
* To unsubscribe from the mrtg mailing list, send a message with the
  subject: unsubscribe to mrtg-request at list.ee.ethz.ch
* The mailing list archive is at http://www.ee.ethz.ch/~slist/mrtg


More information about the mrtg mailing list