Go to web, download and extract source code:
http://sourceforge.net/projects/pnp4nagios/
SETUP
Go to superuser mode
sudo -s
install rrdtool and RRDs Perl Modules (dependences for pnp4nagios)
apt-get install libcgi-pm-perl librrds-perl libgd-gd2-perl libnagios-object-perl rrdtool
Download and extract (in present this is the lastest version)
cd ~/downloads (if not exists: mkdir downloads)
wget http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.21.tar.gz
tar -xzvf pnp4nagios-0.6.21.tar.gz
Compile and Install
cd pnp4nagios-0.6.21/
./configure
make all
make fullinstall
Restart nagios and apache2 services
service nagios restart
service apache2 restart
FIX ERRORS
go to 127.0.0.1/pnp4nagios
and see like this image:
Fix:
a2enmod rewriteand do like info in below webpage:
/etc/init.d/apache2 restart (like service apache2 restart)
Your environment passed all requirements. Remove or rename the /usr/local/pnp4nagios/share/install.php file now.go to terminal: sudo nautilus -> go to this page and rename file
Config
Still go to terminal: sudo nautilus.
Go to /usr/local/nagios/etc/nagios.cfg,
Change default fields to this content:
process_performance_data=1
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tHOSTOUTPUT::$HOSTOUTPUT$
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$
host_perfdata_file_mode=a
service_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
service_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
service_perfdata_file_processing_command=process-service-perfdata-file
Go to /usr/local/nagios/etc/objects/commands.cfg, append the command definitions:
define command {go to /usr/local/pnp4nagios/etc/ , rename rra.cfg-sample files to rra.cfg.
command_name process-service-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command {
command_name process-host-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata
}
Append two entries to /usr/local/nagios/etc/objects/templates.cfg:
define host {Add above templates to any host or service you want like I change /usr/local/nagios/etc/objects/localhost.cfg
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name service-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
.......
define host{
use linux-server,host-pnp ; Name of host template to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
......
define service{
use local-service,service-pnp ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
........
Restart nagios and apache2 services like aboves and we will see graph icon in hosts and services was added template.
This is the result:
No comments:
Post a Comment