Let us take a closer look at how to add mrtg graph to Nagios in a few simple steps with the assistance of our Server management support services at Bobcares.
MRTG graph Configuration for Nagios
MRTG setup files example The mrtg.cfg file in the sample-config/ subdirectory of the Nagios package contains snippets for graphing various Nagios performance information.
We can make graphs of other performance data if desired; the samples only serve as a nice starting point.
We should see some new graphs the next time we run MRTG after we add these example entries to the MRTG configuration file (/etc/mrtg/mrtg.cfg).
Add MRTG to Nagios
Mrtg software may be installed during the initial installation; we can tell if MRTG is installed by using the following RPM command as the initial stepto add mrtg graph to Nagios:
rpm -qa | grep mrtg
Then, use rpmfind.net to locate MRTG RPMs or the up2date command to install MRTG software:
# up2date -v -i mrtg
To install MRTG on Fedora Linux, execute the yum command as follows:
# yum install mrtg
Commands to Configure mrtg
We have to configure the mrtg graph to add it to Nagios. Follow the steps given below for configurations:
- Make a document root in which to store mrtg graphs/html pages:
# mkdir -p /var/www/html/mymrtg/
- Use any of the following cfgmaker commands to generate a mrtg configuration file:
—global 'WorkDir: /var/www/html/mymrtg' —output /etc/mrtg/mymrtg.cfg public@localhost
OR (we must ensure that the FQDN resolves; in the following example, I’m using rh9.test.com, which is my router’s FQDN address).
# cfgmaker 'WorkDir: /var/www/html/mymrtg' —output /etc/mrtg/mymrtg1.cfg public@rh9.test.com
- Create the MRTG configuration’s default index page with indexmaker:
# indexmaker —output=/var/www/html/mymrtg/index.html /etc/mrtg/mymrtg.cfg.
- Copy the following tiny png files to the mrtg path:
# cp -av /var/www/html/mrtg/*.png /var/www/html/mymrtg/ /var/www/html/mymrtg/
Using the configuration file, run the mrtg command from the command line:
# mrtg /etc/mrtg/mymrtg.cfg
For the first time, we may receive a few caution messages con the configurations for adding the mrtg graph to Nagios; disregard them.
We can use our preferred web browser (such as FireFox:D) and type http://www.user.com/mymrtg/ or http://your-ip/mymrtg/ into the address bar.
Now Your MRTG is running fine. Integrate it to Nagios.
Procedure to monitor Bandwidth Usage in Nagios:
1. Nagios’s default installation directory is /usr/local/nagios/
.
2. Open the switch.cfg configuration file by typing in the following:
vi /usr/local/nagios/etc/objects/switch.cfg
3. Make the necessary adjustments in accordance with the router’s requirements. Follow the commands given below:
define host{
use generic-switch
host_name Router_1
alias Router 1
address 172.17.42.22
hostgroups switches
}
4. We may also configure PING, Uptime, Ports Link Status, and so on. Make sure to go through all of the configuration steps for addibng mrtg graph to nagios quickly.
define service{
use generic-service ; Inherit values from a template
host_name Router_1 ; The name of the host the service is associated with
service_description PING ; The service description
check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}
define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0 -H 172.17.42.22
}
define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Port 2 Link Status
check_command check_snmp!-C public -o ifOperStatus.2 -r 1 -H 172.17.42.22
}
define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Port 2 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/html/mrtg/172.17.42.22_2.log!AVG!1000000,1000000!5000000,5000000
!10
}
5. Check the Nagios configuration.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
6. Finally restart the Nagios service by typing in the following command line:
/etc/init.d/nagios restart
[Need assistance with similar queries? We are here to help]
Conclusion
To conclude we have now learned more about how to add mrtg graph to Nagios and the configuration steps necessary to add it to add the mrtg graph to Nagios with the assistance of our Server Management Support Services at Bobcares.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments