[mrtg] Log files says I'm running 2 copies

Alan McKay alan.mckay at gmail.com
Sat Mar 2 16:37:14 CET 2013


OK I fixed the 32 bit problem thanks to feedback - just had to change my
runmrtg to call for the right counter.

But now my log file says I have 2 jobs running for one of my switches but
that makes no sense.  I did not change anything in my cron tabs and this
never showed up before the change.

2013-03-02 10:30:02 -- Started mrtg with config
'/var/www/mrtg/192.168.160.3.cfg'
2013-03-02 10:30:02 -- Started mrtg with config
'/var/www/mrtg/192.168.160.9.cfg'
2013-03-02 10:30:02 -- Saturday, 2 March 2013 at 10:30: ERROR: It looks as
if you are running two copies of mrtg in parallel on
       the same config file. There is a lockfile (/var/lock/mrtg/mrtg_l)
and it is
       is only 0 seconds old ... Check your crontab.
       (/etc/crontab and /var/spool/cron/root)

All I did was change my script that calls cfgmaker then ran it manually
(otherwise it gets run nightly in case there were any changes on the switch
that day)

[root at solexa-db mrtg]# more runmrtgcfgmaker
#!/bin/bash
#
# this needs to be run periodically so that MRTG will pick up any new
# ports that were previously not being used, but are now.  Once to thrice
# daily is sufficient.  Here is the Linux crontab entry for once daily
# at 2:01 AM :
#
# 01 02 * * *     /localdisk/opt/bin/runmrtgcfgmaker

BASEDIR=/var/www/mrtg

if [ $# -ne 0 ]
then
DIRNAME=`dirname $0`
ETCDIR="$DIRNAME/../etc"
NODEFILE="$ETCDIR/MRTGnodes"
STACKS=`grep -v "^#" $NODEFILE`
else
STACKS="192.168.160.9 192.168.160.3"
while [ $# -gt 0 ]
do
STACKS="$1 $STACKS"
shift
done
fi

for stack in $STACKS
do
echo $stack
pw=public
echo "cfgmaker --global 'WorkDir: /var/www/mrtg' --global 'Options[_]:
bits,growright' --output /var/www/mrtg/$stack.cfg $pw@$stack:::::2"
cfgmaker --global 'WorkDir: /var/www/mrtg' --global 'Options[_]:
bits,growright' --output /var/www/mrtg/$stack.cfg $pw@$stack:::::2
done
[root at solexa-db mrtg]#



[root at solexa-db mrtg]# cat /etc/cron.d/mrtg
MAILTO=""
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg
/var/www/mrtg/192.168.160.9.cfg --lock-file /var/lock/mrtg/mrtg_l
--confcache-file /var/lib/mrtg/mrtg.ok --logging /var/log/mrtg.log
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg
/var/www/mrtg/192.168.160.3.cfg --lock-file /var/lock/mrtg/mrtg_l
--confcache-file /var/lib/mrtg/mrtg.ok --logging /var/log/mrtg.log



-- 
“Don't eat anything you've ever seen advertised on TV”
         - Michael Pollan, author of "In Defense of Food"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20130302/71aec1bb/attachment-0001.htm 


More information about the mrtg mailing list