Nagiosgraph Howto
Nagiosgraph Howto
------------------------------
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.
- 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 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
- 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
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
define command {
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/insert.pl
}
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- Restart nagios
/etc/init.d/nagios restart
http://server/nagios/cgi-bin/showconfig.cgi
http://server/nagios/cgi-bin/show.cgi
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
<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>
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- Restart nagios
/etc/init.d/nagios restart