[mrtg] Re: crontab & MRTG emails

Peter Wirdemo (MO/EMW) peter.wirdemo at ericsson.com
Wed Oct 19 09:22:53 MEST 2005


I always use a wrapper script for mrtg...

#!/bin/sh

LOG=/var/tmp/mrtg.out.$$
rm -f ${LOG}

/usr/bin/mrtg /etc/mrtg/mrtg.cfg > ${LOG} 2>&1

if [ -s ${LOG} ]; then
        cat ${LOG} | mail -s "MRTG Report"  someone at domain.com
fi

rm -f ${LOG}

And then in cron....
0,5,10,15,20,25,30,35,40,45,50,55 * * * * wrapper.sh > /dev/null 2>&1

/Peter

> -----Original Message-----
> From: mrtg-bounce at list.ee.ethz.ch 
> [mailto:mrtg-bounce at list.ee.ethz.ch]On
> Behalf Of Shane Presley
> Sent: den 18 oktober 2005 14:38
> To: mrtg at list.ee.ethz.ch
> Subject: [mrtg] crontab & MRTG emails
> 
> 
> Hello,
> 
> I'm running MRTG on a Red Hat system, every 5 minutes through cron.
> 
> 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/mrtg 
> /etc/mrtg/mrtg.cfg
> 
> If MRTG experiences any errors (like a host is down) it sends an email
> to root.  I would prefer those e-mails to go to someone else.  So I
> tried this...
> 
> 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/mrtg
> /etc/mrtg/mrtg.cfg 2>&1 | mail -s "MRTG Report"  someone at domain.com
> 
> However, that creates an e-mail EVERY 5 minutes, even if things are
> okay.  I am guessing it has something to do with stdout vs stderr. 
> Any idea how to structure the cron so I get emails to
> someone at domain.com, not root.
> 
> Thanks
> Shane
> 
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://lists.ee.ethz.ch/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi
> 
> 

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list