[mrtg] MRTG resets all graphs daily, why?

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Fri Jun 5 15:26:19 CEST 2009

----- Original Message ----- 
From: "Adam Williams" <awilliam at mdah.state.ms.us>
To: "Alex van den Bogaerdt" <alex at vandenbogaerdt.nl>
Cc: <mrtg at lists.oetiker.ch>
Sent: Friday, June 05, 2009 1:44 PM
Subject: Re: [mrtg] MRTG resets all graphs daily, why?

> Alex van den Bogaerdt wrote:
>> No .log files. Something happened, either at 06:15 or between 06:15 and
>> 06:20.
>> 1: next time, show "date; ls -la". This adds current local time, and last
>> directory change.
>> 2: look at "df", perhaps you have disk full
>> 3: look at your mail. Errors and warnings should arrive there.  No, "mrtg
>>  >/dev/null 2>&1" in your crontab is not a good idea.
> Here is the output of date; ls -la:
> [root at missioncontrol mrtg]# date; ls -al
> Fri Jun  5 06:41:30 CDT 2009
> total 296
> drwxr-xr-x  2 root root   4096 2009-06-05 06:40 .
[various lines snipped]
> -rw-r--r--  1 root root   2296 2009-06-05 06:40 localhost_10.1.3.1-day.png
> -rw-r--r--  1 root root   8990 2009-06-05 06:40 localhost_10.1.3.1.html
> -rw-r--r--  1 root root  50323 2009-06-05 06:40 localhost_10.1.3.1.log
> -rw-r--r--  1 root root  50305 2009-06-05 06:40 localhost_10.1.3.1.old

As you can see: there is a .log file now.

At 06:40, mrtg renamed localhost_10.1.3.1.log to localhost_10.1.3.1.old and 
created a new localhost_10.1.3.1.log file.

In your previous message, this didn't work out -or- the new 
localhost_10.1.3.1.log file was deleted afterwards. Either way, the new 
information at 06:15 was probably lost. At the very least you lost 

Previously the directory was _probably_ modified at 06:15 (in which case 
something bad happened to mrtg) but maybe the change was at, e.g., 06:19 
which _could_ indicate another program may be the culprit.

This time, the directory was last modified at 06:40, indicating that mrtg 
did its work and no other process did something to the files. That's why you 
should look at "." as well.

> Disk drive isn't full:

good.  I trust the remaining 18% does not exceed the amount of reserved 
space and/or mrtg can use that space.

> I had emailing to root disabled, my ISP blocks outbount port 25 so I
> couldn't have it email this address.  I've changed it to mail localhost,
> so I'll let it run for a bit and see what happens.  I also changed the
> cron to add logging:
> 0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
> --logging /var/log/mrtg.log


Some tips which may or may not be useful to you:

* some providers block port 25 (outbound, or both directions) except to 
their own relay. If so, you can send mail via a relay host.

* never discard all output from cron.  If you have to, filter known and 
useless messages (e.g. "grep -v 'No problems detected.'"). This way you will 
get messages only when something failed.

* as soon as problems start which you cannot explain, the first thing is to 
look at the error log or similar. Enable logging, increase the debug level, 

* Two ways to filter logs:

a) <logfile egrep "known error msg1|known error msg2|known error msg3|..." | 
mail -s errors me at example.org
b) <logfile egrep -v "unintresting msg1|unintresting msg2|unintresting 
msg3|..." | mail -s errors me at example.org

Choice (a) shows what you already know and expect. Choice (b) shows the 
unexpected problem you're hunting down.


More information about the mrtg mailing list