Nagios core 3.4.1 and pnp4nagios 0.6
Posted: Fri Jun 12, 2015 6:41 am
Hi All,
I was up late last night trying to get nagios to work with pnp4nagios 0.6 in sync mode. I'm stuck at a dead end and need some help.
I have a debian 7.3 box that I installed nagios from package. Agt-get nagios3 install, etc, and pnp4nagios from package too. Nagios web interface is up and running and all looks well but when I click on the graph button I get the following error:
"PNP4Nagios Version 0.6.16
Please check the documentation for information about the following error.
perfdata directory "/var/lib/pnp4nagios/perfdata/localhost" for host "localhost" does not exist. Read FAQ online
file [line]:
application/models/data.php [148]:
back"
Here is the perl check script:
PNP4Nagios Version 0.6.16
Please check the documentation for information about the following error.
perfdata directory "/var/lib/pnp4nagios/perfdata/localhost" for host "localhost" does not exist. Read FAQ online
file [line]:
application/models/data.php [148]:
back
***Note that nagios and pnp4nagios are install in the /etc/nagios3 and /etc/pnp4nagios because installing from package and not the standard /usr/local/nagios when compiled and installed from source.
Here is my perl check script:
root@centreon-test:/tmp# perl verify_pnp_config --mode sync --config=/etc/nagios3/nagios.cfg --pnpcfg=/etc/pnp4nagios
[INFO] ========== Starting Environment Checks ============
[INFO] My version is: verify_pnp_config-0.6.25-R.40
[INFO] Start Options: verify_pnp_config --mode sync --config=/etc/nagios3/nagios.cfg --pnpcfg=/etc/pnp4nagios
[INFO] Reading /etc/nagios3/nagios.cfg
[OK ] Running product is 'nagios'
[OK ] object_cache_file is defined
[OK ] object_cache_file=/var/cache/nagios3/objects.cache
[INFO] Reading /var/cache/nagios3/objects.cache
[OK ] resource_file is defined
[OK ] resource_file=/etc/nagios3/resource.cfg
[INFO] Reading /etc/nagios3/resource.cfg
[INFO] Reading /etc/pnp4nagios/process_perfdata.cfg
[INFO] Reading /etc/pnp4nagios/pnp4nagios_release
[OK ] Found PNP4Nagios version "0.6.16"
[OK ] Effective User is 'nagios'
[OK ] User nagios exists with ID '104'
[OK ] Effective group is 'nagios'
[OK ] Group nagios exists with ID '106'
[INFO] ========== Checking Sync Mode Config ============
[OK ] process_performance_data is 1 compared with '/1/'
[OK ] enable_environment_macros is 1 compared with '/1/'
[CRIT] service_perfdata_command is not defined
[CRIT] host_perfdata_command is not defined
[HINT] Needed config options are missing. (2)
I thought I've updated my commands.cfg file correctly:
################################################################################
# NOTIFICATION COMMANDS
################################################################################
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
################### added by AK for pnp4nagios#######################
define command{
command_name process-host-perfdata-file
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl
}
define command{
command_name process-service-perfdata-file
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl
}
################################################################################
# HOST CHECK COMMANDS
################################################################################
# On Debian, check-host-alive is being defined from within the
# nagios-plugins-basic package
################################################################################
# PERFORMANCE DATA COMMANDS
################################################################################
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/pnp4nagios/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
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/pnp4nagios/service-perfdata.out
}
Any help would be greatly appreciated!
I was up late last night trying to get nagios to work with pnp4nagios 0.6 in sync mode. I'm stuck at a dead end and need some help.
I have a debian 7.3 box that I installed nagios from package. Agt-get nagios3 install, etc, and pnp4nagios from package too. Nagios web interface is up and running and all looks well but when I click on the graph button I get the following error:
"PNP4Nagios Version 0.6.16
Please check the documentation for information about the following error.
perfdata directory "/var/lib/pnp4nagios/perfdata/localhost" for host "localhost" does not exist. Read FAQ online
file [line]:
application/models/data.php [148]:
back"
Here is the perl check script:
PNP4Nagios Version 0.6.16
Please check the documentation for information about the following error.
perfdata directory "/var/lib/pnp4nagios/perfdata/localhost" for host "localhost" does not exist. Read FAQ online
file [line]:
application/models/data.php [148]:
back
***Note that nagios and pnp4nagios are install in the /etc/nagios3 and /etc/pnp4nagios because installing from package and not the standard /usr/local/nagios when compiled and installed from source.
Here is my perl check script:
root@centreon-test:/tmp# perl verify_pnp_config --mode sync --config=/etc/nagios3/nagios.cfg --pnpcfg=/etc/pnp4nagios
[INFO] ========== Starting Environment Checks ============
[INFO] My version is: verify_pnp_config-0.6.25-R.40
[INFO] Start Options: verify_pnp_config --mode sync --config=/etc/nagios3/nagios.cfg --pnpcfg=/etc/pnp4nagios
[INFO] Reading /etc/nagios3/nagios.cfg
[OK ] Running product is 'nagios'
[OK ] object_cache_file is defined
[OK ] object_cache_file=/var/cache/nagios3/objects.cache
[INFO] Reading /var/cache/nagios3/objects.cache
[OK ] resource_file is defined
[OK ] resource_file=/etc/nagios3/resource.cfg
[INFO] Reading /etc/nagios3/resource.cfg
[INFO] Reading /etc/pnp4nagios/process_perfdata.cfg
[INFO] Reading /etc/pnp4nagios/pnp4nagios_release
[OK ] Found PNP4Nagios version "0.6.16"
[OK ] Effective User is 'nagios'
[OK ] User nagios exists with ID '104'
[OK ] Effective group is 'nagios'
[OK ] Group nagios exists with ID '106'
[INFO] ========== Checking Sync Mode Config ============
[OK ] process_performance_data is 1 compared with '/1/'
[OK ] enable_environment_macros is 1 compared with '/1/'
[CRIT] service_perfdata_command is not defined
[CRIT] host_perfdata_command is not defined
[HINT] Needed config options are missing. (2)
I thought I've updated my commands.cfg file correctly:
################################################################################
# NOTIFICATION COMMANDS
################################################################################
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
################### added by AK for pnp4nagios#######################
define command{
command_name process-host-perfdata-file
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl
}
define command{
command_name process-service-perfdata-file
command_line /usr/bin/perl /usr/lib/pnp4nagios/libexec/process_perfdata.pl
}
################################################################################
# HOST CHECK COMMANDS
################################################################################
# On Debian, check-host-alive is being defined from within the
# nagios-plugins-basic package
################################################################################
# PERFORMANCE DATA COMMANDS
################################################################################
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/pnp4nagios/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
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/pnp4nagios/service-perfdata.out
}
Any help would be greatly appreciated!