0% found this document useful (0 votes)
204 views

Nagiosgraph Howto

This document provides instructions for manually installing NagiosGraph to add graphical monitoring capabilities to Nagios. It involves downloading and extracting NagiosGraph, copying files to Nagios directories, editing configuration files, setting permissions, and restarting Nagios. Key steps include configuring Nagios to log performance data, adding commands to process this data, and modifying templates and web interfaces to display service graphs.

Uploaded by

Joel Gacosta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
204 views

Nagiosgraph Howto

This document provides instructions for manually installing NagiosGraph to add graphical monitoring capabilities to Nagios. It involves downloading and extracting NagiosGraph, copying files to Nagios directories, editing configuration files, setting permissions, and restarting Nagios. Key steps include configuring Nagios to log performance data, adding commands to process this data, and modifying templates and web interfaces to display service graphs.

Uploaded by

Joel Gacosta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Recipe for Manual Installation

------------------------------

These instructions assume an overlay layout, with nagios at /usr/local/nagios,


with additional notes for deployment under the Homebrew nagios package on OS X.

The Icinga 1 re-write of Nagios uses the same configuration files, so these
steps may apply by replacing the nagios paths with icinga paths, but has not
been tested.

-Download latest nagiosgraph


wget
https://sourceforge.net/projects/nagiosgraph/files/nagiosgraph/1.5.2/nagiosgraph-
1.5.2.tar.gz
- Extract nagiosgraph into a temporary location:
cd /tmp
tar xzvf nagiosgraph-x.y.z.tgz
cd nagiosgraph-x.y.z

- Copy the contents of etc into your preferred configuration location:


mkdir /etc/nagiosgraph
cp etc/* /etc/nagiosgraph

- Edit the perl scripts in the cgi and lib directories, modifying the
"use lib" line to point to the directory from the previous step
(/etc/nagiosgraph).
vi cgi/*.cgi lib/insert.pl

- Copy insert.pl to a location from which it can be executed:


cp lib/insert.pl /usr/local/nagios/libexec
or for Homebrew:
cp lib/insert.pl /usr/local/opt/nagios/bin

- Copy CGI scripts to a script directory served by the web server:


cp cgi/*.cgi /usr/local/nagios/sbin
or for Homebrew:
cp cgi/*.cgi /usr/local/opt/nagios/cgi-bin

- Copy CSS and JavaScript files to a directory served by the web server:
cp share/nagiosgraph.css /usr/local/nagios/share
cp share/nagiosgraph.js /usr/local/nagios/share
or for Homebrew:
cp share/nagiosgraph.css /usr/local/opt/nagios/share/nagios/htdocs
cp share/nagiosgraph.js /usr/local/opt/nagios/share/nagios/htdocs

- Edit /etc/nagiosgraph/nagiosgraph.conf. Set at least the following:


logfile = /var/log/nagiosgraph.log
cgilogfile = /var/log/nagiosgraph-cgi.log
perflog = /var/nagios/perfdata.log
rrddir = /var/nagios/rrd
mapfile = /etc/nagiosgraph/map
nagiosgraphcgiurl = /nagios/cgi-bin
javascript = /nagios/nagiosgraph.js
stylesheet = /nagios/nagiosgraph.css

- Set permissions of "rrddir" (as defined in nagiosgraph.conf) so that


the *nagios* user can write to it and the *www* user can read it:
mkdir /var/nagios/rrd
chown nagios /var/nagios/rrd
chmod 755 /var/nagios/rrd

- Set permissions of "logfile" so that the *nagios* user can write to it:
touch /var/log/nagiosgraph.log
chown nagios /var/log/nagiosgraph.log
chmod 644 /var/log/nagiosgraph.log

- Set permissions of "cgilogfile" so that the *www* user can write to it:
touch /var/log/nagiosgraph-cgi.log
chown apache /var/log/nagiosgraph-cgi.log
chmod 644 /var/log/nagiosgraph-cgi.log

- Ensure that the *nagios* user can create and delete perfdata files:
chown nagios /var/nagios
chmod 755 /var/nagios

- In the Nagios configuration file (nagios.cfg) add this:

process_performance_data=1
service_perfdata_file=/var/nagios/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||
$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata

- In the Nagios commands file (commands.cfg) add this:

define command {
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/insert.pl
}

- Check the nagios configuration

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

- Restart nagios

/etc/init.d/nagios restart

- Verify that nagiosgraph is working by running showconfig.cgi

http://server/nagios/cgi-bin/showconfig.cgi

- Try graphing some data by running show.cgi

http://server/nagios/cgi-bin/show.cgi

- In the Nagios configuration (template.cfg), add a template for graphed services:

define service {
name graphed-service
action_url /nagios/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$'
onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()'
rel='/nagiosgraph/cgi-bin/showgraph.cgi?
host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-w+450+-j
register 0
}
- Enable graph links for services by appending the graphed-service to existing
service definitions in the Nagios configuration:

define service {
use local-service,graphed-service
...
}

- Replace the Nagios action icon with the nagiosgraph graph icon:
mv /usr/local/nagios/share/images/action.gif
/usr/local/nagios/share/images/action.gif-orig
cp share/graph.gif /usr/local/nagios/share/images/action.gif

- In the nagiosgraph SSI file, set the URL for nagiosgraph.js:


vi share/nagiosgraph.ssi
src="/nagiosgraph/nagiosgraph.js" -> src="/nagios/nagiosgraph.js"

- Install the nagiosgraph SSI file:


cp share/nagiosgraph.ssi /usr/local/nagios/share/ssi/common-header.ssi

- Add links to graphs in the Nagios sidebar (side.php or side.html):

<ul>
<li><a href="/nagios/cgi-bin/show.cgi" target="main">Graphs</a></li>
<li><a href="/nagios/cgi-bin/showhost.cgi" target="main">Graphs by Host</a></li>
<li><a href="/nagios/cgi-bin/showservice.cgi" target="main">Graphs by
Service</a></li>
<li><a href="/nagios/cgi-bin/showgroup.cgi" target="main">Graphs by Group</a></li>
</ul>

- Check the nagios configuration

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

- Restart nagios

/etc/init.d/nagios restart

You might also like