Centos 6.x / RHEL 6.x – Apache / Nagios 4.x – Install nagiosgraph plugin

Published on Author gryzli4 Comments

Nagiosgraph gets performance data from Nagios and by using RRDtool generates nice graphics for this data. The plugin’s home page is here:

http://nagiosgraph.sourceforge.net/

Prerequisites

Here I assume that you already have Nagios Core 4.x installed with the appropriate Apache configurations.

 

Installing yum packages

yum install perl-CGI rrdtool-perl perl-Time-HiRes perl-GD perl-CPAN perl-Module-Build

 

Install Nagios::Config by cpan

cpan> install Nagios::Config

 

1. Download and untar the source

The current version of nagiosgraph is 1.5.2  and can be downloaded from here:

http://downloads.sourceforge.net/project/nagiosgraph/nagiosgraph/1.5.2/nagiosgraph-1.5.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnagiosgraph%2F&ts=1416475526&use_mirror=switch

 

 

 

2. Run prerequisites check and install

 

2.1 Run prerequisites check

First we need to run the prerequisites check, which is an option supported by the install.pl script.

If everything is OKAY, then the command above must return something like that:

 

2.2 Install the plugin

If everything went okay with the prereq check, then you can go on withe installation. I personally prefer to install the plugin in a separate directory: /usr/local/nagiosgraph

The install command is as simple as:

During the installation you will be asked some questions, and most of them you can leave with their default values.

In my case I choose  YES to  modify_apache_config and modify_nagios_config . Choosing yes in these steps will do the following:

Automatically add nagiosgraph.conf in /etc/httpd/conf.d/  (If you have default Apache installation) with the following conent

 

Automatically Modify nagios.conf (/usr/local/nagios/etc/nagios.conf in my case) and add some perfdata settings:

Automatically modify /usr/local/nagios/etc/objects/commands.cfg

 

Finally after the install.pl completes, I have the following output:

 

 3. Fine-Tune and enable  Graph Icons in Nagios + Graphs in Nagios Mouseover

In order to enable Graph icons in nagios, and also enable Graphs Mouseover  I have done the following modificatoins:

1. Add service definition which contains the right action_url

Add the following service definition in your service config file:

 

2. Modify all services to include “graphed-service”

You must modify all of the services you want to use graphing on, by changing the following:

 

3. Modify all hosts which want to include graphs

In your host {} configuration sections, you must add the following:

 

4. Finally  create the common-header.ssh in order to activate javascript mouseover graphs

 

5. At the end make sure to restart your Nagios and Apache servers

 

 

 

4 Responses to Centos 6.x / RHEL 6.x – Apache / Nagios 4.x – Install nagiosgraph plugin

  1. Fine-Tune and enable Graph Icons in Nagios + Graphs in Nagios Mouseover in this section Point number1 in which you said you have to add service definition to service config file I have two questions with you .

    I am new to nagios kindly let me know soon

    1, what is service config file ? is it /usr/local/nagios/etc/nagios.cfg ?? and where to add “define service {
    name graphed-service
    action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
    action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$’ onMouseOver=’showGraphPopup(this)’ onMouseOut=’hideGraphPopup()’ rel=’/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$

    register 0
    }” in this file .

    2. and in action_url action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
    should i have to put my hostname of machine or what ?

  2. Hi Salman,

    1. Yes you can use “/usr/local/nagios/etc/nagios.cfg” file for adding the configuration directives.
    2. No, you must not change the “$HOSTNAME$ , it is special keyword, which is used by Nagios , so it must be written as it is

    Regards

  3. Thanks for your reply . Actually I am a bit confused in your step 3. Fine-Tune and enable Graph Icons in Nagios + Graphs in Nagios Mouseover in step 1 which is

    1. Add service definition which contains the right action_url

    Add the following service definition in your service config file:

    Can you please tell me in which file I have to add this ???

  4. Hello,

    I am facing an issue with the step 2.1.
    When I run the perl install.pl –check-prereq, I got the output with “CGI… ***FAIL***”

    but when I tred to install the CGI package it returns:
    ” package perl-CGI.pm-2.56-6.i386 is already installed”

    Do you have any idea how I can fix this issue?

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.