you can find here a short post, with a full description of adding graphs to Nagios
- apt-get update
- apt-get install nagios3 gcc php5-gd rrdtool librrds-perl make -y
- cd /usr/src/
- wget http://downloads.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.16.tar.gz?r=http%3A%2F%2Fdocs.pnp4nagios.org%2Fpnp-0.6%2Fdwnld&ts=1330609501&use_mirror=garr
- mv pnp4nagios-0.6.16.tar.gz\?r\=http\:%2F%2Fdocs.pnp4nagios.org%2Fpnp-0.6%2Fdwnld pnp4nagios-0.6.16.tar.gz
- tar zxvf pnp4nagios-0.6.16.tar.gz
- cd pnp4nagios-0.6.16
- ./configure
- make all
- make fullinstall
- mv /etc/apache2/conf.d/pnp4nagios.conf /etc/apache2/pnp4nagios.ORIG
- cat /etc/apache2/pnp4nagios.ORIG | sed -e '/Auth.*/d' | sed -e '/Require valid-user/d' | tee /etc/apache2/conf.d/pnp4nagios.conf
- /etc/init.d/apache2 reload
- curl http://localhost/pnp4nagios
- mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.ORIG
- cd /etc/nagios3/conf.d/
- vi graphs.cfg
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
- vi /etc/nagios3/nagios.cfg (uncomment the following)
process_performance_data=1
enable_environment_macros=1
use_regexp_matching=1
check_external_command=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
user=root
group=root
- vi /usr/local/pnp4nagios/libexec/process_perfdata.pl (comment the following)
#if( $< == 0 ){
# print "dont try this as root \n";
# exit 1;
#}
- vi /etc/nagios3/commands.cfg
define command{
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
# command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
#command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out
}
- vi /etc/nagios3/conf.d/hostgroups_nagios2.cfg
- members .*
- vi /etc/nagios3/conf.d/hosts.cfg
define host{
use generic-host,host-pnp
host_name linux-monitor
alias linux-monitor
address localhost
}
- vi /etc/nagios3/conf.d/services.cfg
define service{
use generic-service,srv-pnp
host_name linux-*
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
- vi /etc/ssh/ssh_config (in order to prevent ssh check)
- StrictHostKeyChecking no
- UserKnownHostsFile=/dev/null

Great!!! Really this is the Step by step process for pnp4nagios !:)
ReplyDelete=================
Configuration is bit change for RHEL/ Centos:
Just skip the below part as it is not needed on these Distros:
## Skip1 ##
vi nagios.cfg
## user=root
## group=root
vi hostgroups_nagios2.cfg
## members .*
## A Modification
Comment/ Remove the previous definitions for "process-host-perfdata" and "process-service-perfdata" commands in commands.cfg file.
## Few things for Newbies:
## Apache conf file in RHEL/CENTOS is "/etc/httpd/conf/httpd.conf"