LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   MRTG page not updating statistics. (https://www.linuxquestions.org/questions/linux-software-2/mrtg-page-not-updating-statistics-687813/)

ncsuapex 12-02-2008 02:42 PM

MRTG page not updating statistics.
 
I just set up MRTG to use with nagios and the Traffic Analysis page for my router is not updating therefore causing nagios to spit out this error:


The statistics were last updated Tuesday, 2 December 2008 at 14:45,
at which time '*router*' had been up for 0:29:59.

*changed*, it is the valid router name



***** Nagios *****

Notification Type: PROBLEM

Service: Port 1 Bandwidth Usage
Host: hostname
Address: 127.0.0.1
State: WARNING

Date/Time: Tue Dec 2 15:21:18 EST 2008

Additional Info:

MRTG data has expired (36 minutes old)


*hostname had been changed. It is a valid hostname on my network


crontab entry to have mrtg run every 5 minutes:

*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log


tail -f /var/log/mrtg.log
2008-12-02 15:15:02 -- Started mrtg with config '/etc/mrtg/mrtg.cfg'
2008-12-02 15:20:01 -- Started mrtg with config '/etc/mrtg/mrtg.cfg'
2008-12-02 15:25:02 -- Started mrtg with config '/etc/mrtg/mrtg.cfg'
2008-12-02 15:30:01 -- Started mrtg with config '/etc/mrtg/mrtg.cfg'
2008-12-02 15:35:01 -- Started mrtg with config '/etc/mrtg/mrtg.cfg'

last update to the mrtg analysis page was 14:45, which is probably when I first started mrtg.

The router logs in /var/www/html/mrtg are updating every 5 minutes.




created the config file by:
cfgmaker --global 'WorkDir: /var/www/html/mrtg' --output /etc/mrtg/mrtg.cfg community@router

*community and router are correct in the command, changed for security.

created the index pages by:

indexmaker --output=/var/www/html/mrtg/index.html /etc/mrtg/mrtg.cfg


Centos 5.1
mrtg-2.14.5-2

Why are the log files updating but the webpage isn't?


thanks!

ncsuapex 12-02-2008 03:22 PM

SOLVED

For some reason the first time I tried to set MRTG up I choose /var/www whereas the document root is /var/www/html. I then reran my index scripts and the logs were updating in /var/www/html/mrtg, BUT /etc/httpd/conf.d/mrtg.conf still had an alias for /mrtg /var/www

once I corrected that everything updated as fine.

ncsuapex 12-03-2008 09:17 AM

Ok this is weird... my mrtg router log files keep disappearing/reappearing...

as you can see
Dec 3 09:10:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;OK;HARD;3;Traffic OK - Avg. In = 325.6 KB/s, Avg. Out = 30.4 KB/s
Dec 3 09:20:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:44:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;OK;HARD;3;Traffic OK - Avg. In = 288.8 KB/s, Avg. Out = 26.5 KB/s

at at 9:10 the log file was there, 9:20 the log file was not there and at 9:44 the log file was there.. What's making the log files go away?
The mrtg webpage seems to still be updating but nagios complains.





Dec 3 09:20:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:20:38 hostname nagios: SERVICE ALERT: hostname;em3 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:22:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:22:38 hostname nagios: SERVICE ALERT: hostname;em3 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:24:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;UNKNOWN;HARD;3;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:24:38 hostname nagios: SERVICE ALERT: hostname;em3 Bandwidth Usage;UNKNOWN;HARD;3;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:31:28 hostname nagios: SERVICE ALERT: hostname;em0 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:33:08 hostname nagios: SERVICE ALERT: hostname;em1 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:33:28 hostname nagios: SERVICE ALERT: hostname;em0 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:35:08 hostname nagios: SERVICE ALERT: hostname;em1 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:35:28 hostname nagios: SERVICE ALERT: hostname;em0 Bandwidth Usage;OK;SOFT;3;Traffic OK - Avg. In = 10.4 KB/s, Avg. Out = 4.7 KB/s
Dec 3 09:37:08 hostname nagios: SERVICE ALERT: hostname;em1 Bandwidth Usage;OK;SOFT;3;Traffic OK - Avg. In = 33.8 KB/s, Avg. Out = 241.9 KB/s
Dec 3 09:40:48 hostname nagios: Auto-save of retention data completed successfully.
Dec 3 09:44:38 hostname nagios: SERVICE ALERT: hostname;em2 Bandwidth Usage;OK;HARD;3;Traffic OK - Avg. In = 288.8 KB/s, Avg. Out = 26.5 KB/s
Dec 3 09:44:38 hostname nagios: SERVICE ALERT: hostname;em3 Bandwidth Usage;OK;HARD;3;Traffic OK - Avg. In = 282.2 KB/s, Avg. Out = 317.3 KB/s
Dec 3 09:57:08 hostname nagios: SERVICE ALERT: hostname;em1 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 09:59:08 hostname nagios: SERVICE ALERT: hostname;em1 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
Dec 3 10:01:08 hostname nagios: SERVICE ALERT: hostname;em1 Bandwidth Usage;OK;SOFT;3;Traffic OK - Avg. In = 39.7 KB/s, Avg. Out = 346.0 KB/s
Dec 3 10:05:28 hostname nagios: SERVICE ALERT: hostname;em0 Bandwidth Usage;UNKNOWN;SOFT;1;check_mrtgtraf: Unable to open MRTG log file
Dec 3 10:07:28 hostname nagios: SERVICE ALERT: hostname;em0 Bandwidth Usage;UNKNOWN;SOFT;2;check_mrtgtraf: Unable to open MRTG log file
Dec 3 10:09:28 hostname nagios: SERVICE ALERT: hostname;em0 Bandwidth Usage;UNKNOWN;HARD;3;check_mrtgtraf: Unable to open MRTG log file

ncsuapex 12-08-2008 03:38 PM

Ok so it looks like putting:

RunAsDaemon: yes

in the mrtg.cfg file fixed the log files disappearing problem.


All times are GMT -5. The time now is 11:02 AM.