[mrtg] Monitoring a target only during certain hours

Daniel McDonald dan.mcdonald at austinenergy.com
Mon Jan 10 21:39:58 CET 2011




On 1/10/11 2:27 PM, "Geoff Powell" <geoff at g8kbz.demon.co.uk> wrote:

> In article <28E447343A85354483BCF7C3E9D5EAA514A5F281 at uxcn10-1.UoA.auckla
> nd.ac.nz>, Steve Shipway <s.shipway at auckland.ac.nz> writes

> 
> My idea of a "helper script" was something invoked by MRTG at each run
> which would SNMPGET IfInOctets and IfOutOctets for the WAN interface,
> and clear the IfInOctets variable between the hours of Midnight and 8
> a.m., posting the result in the usual 4 line format. But my Perl-fu
> isn't up to the task. Maybe I could do it in shell.

Just don't poll between 8am and midnight.  A crontab entry like:

*/5 8-23 * * * /usr/bin/mrtg.pl var/lib/mrtg/mrtg.cfg

Would do the trick.

If you want to skip weekends too, it would be:
*/5 8-23 * * 1-5 /usr/bin/mrtg.pl var/lib/mrtg/mrtg.cfg

As long as you have options[]: unknownaszero you should be fine with no
interpolation.  There might be some funkiness at 8:00am, but it is unlikely
to be statistically significant.


-- 
Daniel J McDonald, CCIE # 2495, CISSP # 78281




More information about the mrtg mailing list