Passo 1. Voltando para o diretório
/opt:
# cd /opt
Passo 2. Download do PNP4Nagios:
# wget http://sourceforge.net/projects/pnp4nagios/files/latest/download
Passo 3. Extração do pacote:
# tar -xvf pnp4nagios-0.6.22.tar.gz
# rm -rf pnp4nagios-0.6.22.tar.gz
Passo 4. Acessando o diretório:
# cd pnp4nagios-0.6.22
Passo 5. Compilando o PNP4Nagios:
# ./configure
# make all; make fullinstall; make install-webconf; make install-config; make install-init
Passo 6. Reiniciando o servidor Apache:
# /etc/init.d/httpd restart
Passo 7. Renomeando o arquivo
install.php para
install.php.old:
# mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.old
Passo 8. Iniciando o PNP4Nagios:
# /etc/init.d/npcd start
Passo 9. Configurando o PNP4Nagios para iniciar na inicialização do servidor:
# chkconfig npcd on
Passo 10. Voltando para o diretório do Nagios:
# cd /usr/local/nagios/etc/
Passo 11. Configurando o arquivo
nagios.cfg:
# vim nagios.cfg
Altere a variável abaixo:
process_performance_data=1
Insira no final do arquivo:
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERF
DATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tS
ERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCO
MMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
Passo 12. Acessando o diretório
objects:
# cd objects/
Passo 13. Alterando o arquivo
commands.cfg:
# vim commands.cfg
# pnp4nagios
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
# fim do pnp4nagios
Passo 14. Alterando o arquivo
templates.cfg:
# vim templates.cfg
#inicio pnp4nagios
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?
host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?
host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
# fim do pnp4nagios
Passo 15. Copiando o arquivos
status-header.ssi para o diretório
ssi do Nagios:
# cp /opt/pnp4nagios-0.6.22/contrib/ssi/status-header.ssi /usr/local/nagios/share/ssi/
Passo 16. Reiniciando o
npcd e o Nagios:
# service npcd restart && service nagios restart