[mrtg] Re: mrtg log file

Danny Brando dannyb at dannyb.net
Tue Sep 4 16:32:54 MEST 2001



I've had the same problem, it causes spike or dip in the graph if the
difference of the counter and -1 fall within MaxBytes.   I edited the MRTG
source and made my own little patch to stop it from happening.  Basically,
if the interface is unreachable, I have it exit so it doesn't write
anything to the logfile causing a flatline in the graphs rather than a
false dip/spike.  I also have it email me so I know there is a problem.

Its not a perfect workaround because if one interface is unreachable, it
exits the entire process so anything within that config file also exits.
If anybody knows a better way, please let us know....

Here is the section of code I edited:
<SNIP>
  # in and out should be numbers only
    for my $ri (0..1){
        # for folks using rrdtool I am allowing numbers 
        # with decimals here
        if ( $res[$ri] !~ /^[-+]?\d+(.\d+)?$/ ) {
            warn "WARNING: Expected a number but got '$res[$ri]'\n";
            $res[$ri] = -1;
    ####<DANNYB PATCH>####
    `/usr/bin/mail -s "ERROR - MRTG" dannyb\@dannyb.net</usr/local/mrtg/txt/error.txt`;
    exit;
    ####</DANNYB PATCH>####

        }
    }
    return @res;
}
</SNIP>

On Mon, 3 Sep 2001, Edgardo Mina wrote:

> 
> 
> Hi Tobi and rest of the MRTG gurus,
> 
> I am having this problem on the new version of mrtg (2.9.17), on log file, 
> I know that the first line of the log file is referring to the counters of 
> interface on the recent run of mrtg, but when the interface is not 
> reachable it gives a value of minus 1 ( -1 ), when having snmp no response 
> or link going to the machine which I poll could have some network problem. 
> Is there a way that I can removed this minus 1 ( -1 ) value of the first 
> line and instead put the recent value before the error on snmp occur. can 
> anyone help me to work on this problem how to solve and do  need to go on 
> the source code of the mrtg.
> 
> hope to here from anyone of you mrtg gurus out there.
> 
> thanks and regards,
> edgardo
> 
> 
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://www.ee.ethz.ch/~slist/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
> 


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



More information about the mrtg mailing list