MRTG Config
MRTG Config
Hello,
I want to monitor my switch using MRTG, but something is not well configured, I followed some of the topics for the error that I have which is : "check_mrtgtraf: Unable to open MRTG log file "
knowing that /var/www/mrtg contains some interface logs
I read in some forums that /var/lib/mrtg/ must contain the log file that nagios reads, but in my case it contains only cfg files
can you guys help me through this config
I want to monitor my switch using MRTG, but something is not well configured, I followed some of the topics for the error that I have which is : "check_mrtgtraf: Unable to open MRTG log file "
knowing that /var/www/mrtg contains some interface logs
I read in some forums that /var/lib/mrtg/ must contain the log file that nagios reads, but in my case it contains only cfg files
can you guys help me through this config
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: MRTG Config
Hello @koumni,
Have you checked permissions on that directory to make sure it is writable/accessible by the nagios account on the server? Please post the output to the following commands.
Have you checked permissions on that directory to make sure it is writable/accessible by the nagios account on the server? Please post the output to the following commands.
Code: Select all
ls -ld /var/lib/mrtg
ls -l /var/lib/mrtg
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: MRTG Config
I would also look at the /etc/mrtg/mrtg.cfg file which will have information about the log location and format.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: MRTG Config
benjaminsmith wrote:Hello @koumni,
Have you checked permissions on that directory to make sure it is writable/accessible by the nagios account on the server? Please post the output to the following commands.
Code: Select all
ls -ld /var/lib/mrtg ls -l /var/lib/mrtg
Code: Select all
nagios@sn-srv-nagios:~$ ls -ld /var/lib/mrtg
drwxrwxrwx 2 nagios nagios 12288 Oct 27 15:04 /var/lib/mrtg
- Attachments
-
- ls-l.txt
- ls -l /var/lib/mrtg
- (9.63 KiB) Downloaded 163 times
Re: MRTG Config
Here it iscdienger wrote:I would also look at the /etc/mrtg/mrtg.cfg file which will have information about the log location and format.
- Attachments
-
- mrtg.cfg
- (39.82 KiB) Downloaded 148 times
Re: MRTG Config
Can you post the Nagios configuration you are using for the Port 1 Bandwidth Usage check?
Did you setup a cron job to run the MRTG application which gathers the Bandwidth information the check_mrtgtraf plugin needs to calculate the bandwidth?
Check this link for instructions for MRTG.
https://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html
If you run the following as root, it will run the MRTG application in debug mode which you can use to troubleshoot the MRTG application.
Did you setup a cron job to run the MRTG application which gathers the Bandwidth information the check_mrtgtraf plugin needs to calculate the bandwidth?
Check this link for instructions for MRTG.
https://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html
If you run the following as root, it will run the MRTG application in debug mode which you can use to troubleshoot the MRTG application.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: MRTG Config
This is the service conftgriep wrote:Can you post the Nagios configuration you are using for the Port 1 Bandwidth Usage check?
Did you setup a cron job to run the MRTG application which gathers the Bandwidth information the check_mrtgtraf plugin needs to calculate the bandwidth?
Check this link for instructions for MRTG.
https://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html
If you run the following as root, it will run the MRTG application in debug mode which you can use to troubleshoot the MRTG application.
Code: Select all
# Monitor bandwidth via MRTG logs
define service {
use generic-service ; Inherit values from a template
host_name HP-DATA-CORE
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/172.20.232.1_1.log!AVG!1000000,1000000!5000000,5000000!10
}
Code: Select all
define command {
command_name check_local_mrtgtraf
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}
Code: Select all
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log
Re: MRTG Config
Your Nagios check is setup to use this file to gather the Bandwidth but is does not exist on your system.
The closest file I saw in the ls output is this named this.
Is this the MRTG log file you should be using for that check?
If not, you will have to re-run the cfgmaker command to create a new entry for that interface and then the plugin will find the file.
Else, edit the check and remove the _1 from the filename.
Code: Select all
/var/lib/mrtg/172.20.232.1_1.log
Code: Select all
/var/lib/mrtg/172.20.232.1.log
If not, you will have to re-run the cfgmaker command to create a new entry for that interface and then the plugin will find the file.
Else, edit the check and remove the _1 from the filename.
Be sure to check out our Knowledgebase for helpful articles and solutions!