Assume that, If you have installed MRTG for monitoring network device(switch) on Linux system, also you would like to monitoring MRTG on Nagios just following below steps,
Its Nagios shows monitoring network status from MRTG ports log,
How to Configure:
Login into your Nagios Server,create a new file mrtgmonitor.cfg for configure mrtg host. File creation location already discussed on nagios server installation post.
# cd /usr/local/nagios/etc/servers
# touch mrtgmonitor.cfg
# touch mrtgmonitor.cfg
Note : /var/www/html/mrtg/mrtg-192.168.0.2_1.log and /var/www/html/mrtg/192.168.0.2_2.log this is mrtg log files.
Add below lines
define host{
use MRTG-SERVER
host_name host.mrtg-server.com
alias host.mrtg-server
address 192.168.0.105
}
define service{
use generic-service
host_name host.mrtg-server.com
service_description PORT-1
check_command
check_nrpe!check_mrtg_1!/var/www/html/mrtg/mrtg-192.168.0.2_1.log!MAX!5,10!6,11!mbyte!
}
define service{
use generic-service
host_name host.mrtg-server.com
service_description PORT-2
check_command
check_nrpe!check_mrtg_2!/var/www/html/mrtg/192.168.0.2_2.log!MAX!10,20!11,21!mbyte!
}
Save the file :wq!
then go to /usr/local/nagios/etc/objects/ path and open the command.cfg file.
# cd /usr/local/nagios/etc/objects
# vim command.cfg
# vim command.cfg
#command definition #
define command{
command_name check_mrtgtraf.pl
command_line $USER1$/check_mrtgtraf.pl -L $ARG1$ -F $ARG2$ -w $ARG3$ -c $ARG4$ -u $ARG5$
}
Finally in Nagios server side configuration completed, then test the configuration and restart it.
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# /etc/init.d/nagios restart
# /etc/init.d/nagios restart
Running configuration check...
Stopping nagios:. done.
Starting nagios: done.
Client side configure (MRTG Installed Server):
Download the check_mrtgtraf.pl file from Nagios and move the script to /usr/loca/nagios/libexec directory
Before add the command in nrpe.cfg file check on your terminal whether working on or not?
# /usr/local/nagios/libexec/check_mrtgtraf.pl -FUNCT AVG -LOG /var/www/html/mrtg/yourmrtg_port_log.log -WARN 10,10 -CRIT 15,15 -u megabytes
Traffic OK: AVG. in = 4.32478332519531 Mbyte/s, AVG. out = 1.71255493164062 Mbyte/s.
Now you will update in nrpe.cfg file
# cd /usr/local/nagios/etc/
# vim nrpe.cfg
# vim nrpe.cfg
command[check_switch]= /usr/local/nagios/libexec/check_mrtgtraf.pl -FUNCT AVG -LOG /var/www/html/mrtg/yourmrtg_port_log.log -WARN 10,10 -CRIT 15,15 -u megabytes
Now, save that file :wq!
Comments (0)