Nagios 4.1.1: Adding MRTG to Nagios Core 4.1.1 Server



We are going to use MRTG to create some information about how Nagios is running. It shows you stats about how many checks run and how long they take. This gives you insight in your monitoring system.

Installing MRTG and dependencies:

# yum install mrtg* -y 

Copy the included configuration from Nagios:
# cp /root/nagios-4.1.1/sample-config/mrtg.cfg /usr/local/nagios/etc/
Create a folder for the graphs and files:
# mkdir -p /usr/local/nagios/share/stats
Configure MRTG to use this folder:
# vim /usr/local/nagios/etc/mrtg.cfg

Add the following at the top of the file:

WorkDir: /usr/local/nagios/share/stats

Do the initial run:

# env LANG=C /usr/bin/mrtg /usr/local/nagios/etc/mrtg.cfg
Create the HTML pages:
#/usr/bin/indexmaker /usr/local/nagios/etc/mrtg.cfg --output=/usr/local/nagios/share/stats/index.html
Finally create a cron job to run MRTG every 5 minutes:
# vim /etc/cron.d/mrtg-nagios
Add the following:
*/5 * * * *  root  env LANG=C /usr/bin/mrtg /usr/local/nagios/etc/mrtg.cfg

You can now navigate to https://your-ip-address/nagios/stats/ to see the graphs. or https://FQDN/nagios/stats/

Adding Menu to Nagios Core:
Now we'll add two links to the Nagios menu to these new tools.

Edit the sidebar file:

# vim /usr/local/nagios/share/side.php
And add the following somewhere in the menu:

<div class="navsection">
    <div class="navsectiontitle">Extra Tools</div>
        <div class="navsectionlinks">
            <ul class="navsectionlinks">
                <li><a href="/nagios/stats" target="<?php echo $link_target;?>">MRTG stats</a></li>
                <li><a href="/nagiosgraph/cgi-bin/show.cgi" target="<?php echo $link_target;?>">Nagios Graph</a></li>
            </ul>
        </div>
    </div>
</div>

Finally, verify Nagios Configuration files for any errors and restart the nagios services

#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

# service nagios restart

Open the Nagios core in the web browser http://your-ip-address/nagios






Nagios 4.1.1 other links


Installing Nagios Core 4.1.1 on Centos 6.7

Adding Nagios Linux host to Nagios core server

Adding Windows host to Nagios Core server

Adding MRTG to Nagios Core 4.1.1

Adding Nagios Graph to Nagios core 4.1.1


Keywords: Nagios, Monitoring, Linux host, Ading Linux host, MTG Graphs, Graphs

Comments

Popular posts from this blog

Observium: Configuring Microsoft Windows 2008 Server SNMP Agent

AWS: Upgrade PV Drivers on Windows Instances

How to configure Incremental backups for MSSQL Database