===== NagiosGraph =====
**Graphical representation of Nagios data**
Web Site: http://nagiosgraph.sourceforge.net/
License: OSI Artistic License \\
Author: (c) 2005 Soren Dossing \\
Author: (c) 2008 Alan Brenner, Ithaka Harbors \\
Author: (c) 2010 Matthew Wall
===== Prerequisites =====
*RRDTool - Round-Robin Database Tool
=== RRD - Round Robin Database Tool ===
RRDTool handles temporal series and stores data in Round-Robin databases (circular buffer), so the size of DB file remains constant - the oldest data is replaced by new ones. \\
In Suse the package it's included in the distribution, so just install it via **yast** (**yast2** if you want the graphical version).
===== Installation =====
[[http://nagiosgraph.sourceforge.net/|download the tarball]] in **''/download''** (for example)
Installation is a three-step process:
-Install the nagiosgraph files
-Configure Nagios for data collection
-Customize the graphs and links as needed
Installation can be done manually by copying files and modifying configuration files, or automatically using the install.pl script. \\
For installation details, upgrading instructions, customization options, and troubleshooting, see the README file in ///usr/local/nagiosgraph/share/doc//.
==== Easy Install (not Suse !) ====
install.pl
To see a list of options:
install.pl --help
To see if pre-requisites are installed:
install.pl --check-prerequisites
To install on a redhat system:
install.pl --layout redhat
To install on a debian or ubuntu system:
install.pl --layout debian
==== Manual Installation (Suse) ====
These instructions assume an overlay layout, with nagios at ///usr/local/nagios//.
Extract nagiosgraph into a temporary location:
cd /download
tar xzvf nagiosgraph-x.y.z.tgz
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.
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
Copy CGI scripts to a script directory served by the web server:
cp cgi/*.cgi /usr/local/nagios/sbin
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
Edit ///usr/local/nagiosgraph/etc/nagiosgraph.conf//. Set at least the following:
perflog = /usr/local/nagios/var/perfdata.log
rrddir = /usr/local/nagiosgraph/var/spool/rrd
mapfile = /usr/local/nagiosgraph/etc/map
nagiosgraphcgiurl = /nagiosgraph/cgi-bin
javascript = /nagios/nagiosgraph.js
stylesheet = /nagios/nagiosgraph.css
logfile = /usr/local/nagiosgraph/var/log/nagiosgraph.log
cgilogfile = /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
Set permissions of "rrddir" (as defined in nagiosgraph.conf) so that the **nagios** user can write to it and the **wwwrun** (Suse) user can read it:
mkdir /usr/local/nagiosgraph/var/spool/rrd
chown nagios /usr/local/nagiosgraph/var/spool/rrd
chmod 755 /usr/local/nagiosgraph/var/spool/rrd
Set permissions of "logfile" so that the **nagios** user can write to it:
touch /usr/local/nagiosgraph/var/log/nagiosgraph.log
chown nagios /usr/local/nagiosgraph/var/log/nagiosgraph.log
chmod 664 /usr/local/nagiosgraph/var/log/nagiosgraph.log
Set permissions of "cgilogfile" so that the **wwwrun** (Suse) user can write to it:
touch /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
chown wwwrun /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
chmod 664 /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log
In the Nagios configuration file (///usr/local/nagios/etc/nagios.cfg//) add this:
################################################################################
# Process Nagios performance data using Nagiosgraph
################################################################################
process_performance_data=1
service_perfdata_file=/usr/local/nagios/var/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-for-nagiosgraph
################################################################################
In the Nagios commands file (///usr/local/nagios/etc/objects/commands.cfg//) add this:
################################################################################
# command to process nagios performance data for nagiosgraph
################################################################################
define command {
command_name process-service-perfdata-for-nagiosgraph
command_line /usr/local/nagios/libexec/insert.pl
}
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 template configuration file (///usr/local/nagios/etc/objects/templates.cfg//), add a template for graphed services:
###############################################################################
# NagiosGraph - Template for graphed Services and Hosts
###############################################################################
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
}
define host {
name graphed-host
action_url /nagios/cgi-bin/showhost.cgi?host=$HOSTNAME$'
onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()'
rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&period=day&rrdopts=-w+450+-j
}
###############################################################################
Enable graph links for services by appending the graphed-service to existing service definitions in the Nagios configuration. \\
For Techint configuration, add the keyword //use// to service template //techint-service// in ///usr/local/nagios/etc/objects/techint.cfg//:
# TECHINT - Service definition template - This is NOT a real service, just a template!
define service{
name techint-service ; The 'name' of this service template
use graphed-service ; NagiosGraph Template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
is_volatile 0 ; The service is not volatile
check_period techint_24x7 ; The service can be checked at any time of the day
max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
normal_check_interval 6 ; Actively check the service every 10 minutes
retry_check_interval 2 ; Re-check the service every two minutes until a hard state can be determined
###### contact_groups admins ; Definito a livello di service
notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events
notification_interval 120 ; Re-notify about service problems every 120 min
notification_period techint_14x7 ; Notifications can be sent out at any time
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
Enable graph links for hosts by appending the graphed-host to existing service definitions in the Nagios configuration. \\
For Techint configuration, add the keyword //use// to host template //techint-windows-server// in ///usr/local/nagios/etc/objects/techint.cfg//:
# TECHINT - Windows host definition template - This is NOT a real host, just a template!
define host{
name techint-windows-server ; The name of this host template
use graphed-host ; NagiosGraph Template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_period techint_24x7 ; By default, Windows servers are monitored round the clock
check_interval 5 ; Actively check the server every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if servers are "alive"
notification_period techint_14x7 ; Send notification out at any time - day or night
notification_interval 120 ; Resend notifications every 120 minutes
notification_options d,r ; Only send notifications for specific host states
########### contact_groups admins ; Definito a livello di Host
########### hostgroups windows-servers ; Definito a livello di Host
register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
}
Replace the Nagios action icon with the nagiosgraph graph icon:
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
Modify the Nagios sidebar (e.g. ///usr/local/nagios/share/side.php//) by inserting bullets under the 'Trends' heading:
/trends.cgi" target="">Trends
Restart nagios
etc/init.d/nagios restart
==== Install Summary (Suse) ====
^ Parameter ^ Value ^
| ng_layout | suse |
| ng_prefix | / |
| ng_etc_dir | /usr/local/nagiosgraph/etc |
| ng_bin_dir | /usr/local/nagiosgraph/lib |
| ng_cgi_dir | /usr/local/nagiosgraph/cgi-bin |
| ng_doc_dir | /usr/local/nagiosgraph/share/doc |
| ng_examples_dir | /usr/local/nagiosgraph/share/example |
| ng_www_dir | /usr/local/nagiosgraph/share/htdocs |
| ng_util_dir | /usr/local/nagiosgraph/share/util |
| ng_var_dir | /usr/local/nagiosgraph/var/spool |
| ng_rrd_dir | /usr/local/nagiosgraph/var/spool/rrd |
| ng_log_dir | /usr/local/nagiosgraph/var/log |
| ng_log_file | /usr/local/nagiosgraph/var/log/nagiosgraph.log |
| ng_cgilog_file | /usr/local/nagiosgraph/var/log/nagiosgraph-cgi.log |
| ng_url | /nagiosgraph |
| ng_cgi_url | /nagiosgraph/cgi-bin |
| ng_css_url | /nagios/nagiosgraph.css |
| ng_js_url | /nagios/nagiosgraph.js |
| nagios_cgi_url | /nagios |
| nagios_perfdata_file | /usr/local/nagios/var/perfdata.log |
| nagios_user | nagios |
| www_user | wwwrun |
| modify_nagios_config | n |
| nagios_config_file | /usr/local/nagios/etc/nagios.cfg |
| nagios_commands_file | /usr/local/nagios/etc/objects/commands.cfg |
| modify_apache_config | n |
| apache_config_dir | /etc/apache2/conf.d |