This article describes how to modify Nagios/Icinga configuration files, create templates, use the Nagios Perfdata C Daemon (NPCD) and modify Apache files to run PNP4nagios, a data presentation package that uses the RRDTool graphing package.
PNP4Nagios packages
Begin by installing the required packages:- # aptitude install pnp4nagios icinga-web-pnp
Modify the /etc/icinga/icinga.cfg file
RRDtool uses performance data generated by pnp4nagios to build graphs. The lines required are in the icinga.cfg file, but commented out. You may either edit the existing commented lines or append the following to the end:
# performance data
process_performance_data=1
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
service_perfdata_file_mode=a
host_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
host_perfdata_file_processing_interval=30
service_perfdata_file=/var/spool/pnp4nagios/nagios/service-perfdata
host_perfdata_file=/var/spool/pnp4nagios/nagios/host-perfdata
service_perfdata_file_processing_command=pnp-bulknpcd-service
host_perfdata_file_processing_command=pnp-bulknpcd-host
Add PNP4Nagios Commands and Host and Service Templates
If you are using the standard installation and preparing configuration files yourself, the commands will be located in /etc/icinga/commands.cfg. However, if you preparing your own configuration files (either manually or using tools such as NConf), add the following commands:
# pnp4nagios
define command{
command_name pnp-bulknpcd-service
command_line /bin/mv /var/spool/pnp4nagios/nagios/service-perfdata /var/spool/pnp4nagios/npcd/service-perfdata.$TIMET$
}
define command{
command_name pnp-bulknpcd-host
command_line /bin/mv /var/spool/pnp4nagios/nagios/host-perfdata /var/spool/pnp4nagios/npcd/host-perfdata.$TIMET$
}
The following Host Template defines and action URL that will be used for any hosts to which the template is applied:
define host {
name pnp-hst
register 0
action_url /pnp4nagios/graph?host=$HOSTNAME$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=_HOST_
}
define service {
name pnp-svc
register 0
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
}
define host{
name generic-host
use pnp-hst
define service{
name generic-service
use pnp-svc
Enable the Nagios-Perfdata-C-Daemon
The Nagios-Perfadata-C-Daemon provides bulk mode processing. If you process performance data using only commands in the nagios.cfg or icinga.cfg file -- Synchronous Mode Processing -- there is a heavy load on the server. Each time a service check executed, it calls process_perfdata.pl. Bulk mode processing temporarily saves performance data to a file and uses NPCD to process it all at once.
Enabling NPCD requires only modifying the /etc/default/npcd file and setting "Run=yes."
Copy Web Server Files
Copy the Web Server Files and Clear the Icinga-Web CacheFinally, integrate PNP4Nagios with the web applications by copying two files
# cp /usr/share/doc/pnp4nagios/examples/ssi/status-header.ssi /usr/share/icinga/htdocs/ssi/status-header.ssi
# chmod 644 /usr/share/icinga/htdocs/ssi/status-header.ssi
/usr/local/icingaweb/bin/clearcache.shThe video below demonstrates PNP4Nagios integrated with Icinga and Icinga-Web.
Most of this information comes from the Icinga Wiki entry for PNP4Nagios on Icinga.
No comments :
Post a Comment