Can't get Nagios Core to work with PNP4Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Sholmo
Posts: 4
Joined: Wed May 25, 2016 12:13 pm

Can't get Nagios Core to work with PNP4Nagios

Post by Sholmo »

Hello,

I've read thru some similar topics on this forum but haven't found an answer.

Both Nagios and PNP installed with yum. I think I have set everything up correctly yet on ..1/pnp4nagios I'm greeted with:

Code: Select all

PNP4Nagios Version 0.6.25
Please check the documentation for information about the following error.
perfdata directory "/var/lib/pnp4nagios/" is empty. Please check your Nagios config. <a href="http://docs.pnp4nagios.org/faq/3">Read FAQ online</a>

file [line]:
application/models/data.php [109]:
And tbh I'm out of ideas. I'm gonna dump (hopefully) all related cfgs.

Paths:

Code: Select all

/etc/nagios
/etc/pnp4nagios
/usr/libexec/pnp4nagios/
/etc/pnp4nagios
/var/lib/pnp4nagios
/var/log/pnp4nagios
/var/spool/pnp4nagios
/usr/share/nagios/html/pnp4nagios
nagios.cfg

Code: Select all

cfg_file=/etc/nagios/objects/localhost.cfg
cfg_dir=/etc/nagios/servers
cfg_dir=/etc/nagios/conf.d
object_cache_file=/var/log/nagios/objects.cache
precached_object_file=/var/log/nagios/objects.precache
resource_file=/etc/nagios/private/resource.cfg
status_file=/var/log/nagios/status.dat
status_update_interval=10
nagios_user=nagios
nagios_group=nagios
check_external_commands=1
command_file=/var/spool/nagios/cmd/nagios.cmd
query_socket=/var/spool/nagios/cmd/nagios.qh
lock_file=/var/run/nagios/nagios.pid
temp_file=/var/log/nagios/nagios.tmp
temp_path=/tmp
event_broker_options=-1
log_rotation_method=d
log_archive_path=/var/log/nagios/archives
use_syslog=1
log_notifications=1
log_service_retries=1
log_host_retries=1
log_event_handlers=1
log_initial_states=0
log_current_states=1
log_external_commands=1
log_passive_checks=1
service_inter_check_delay_method=s
max_service_check_spread=30
service_interleave_factor=s
host_inter_check_delay_method=s
max_host_check_spread=30
max_concurrent_checks=0
check_result_reaper_frequency=10
max_check_result_reaper_time=30
check_result_path=/var/log/nagios/spool/checkresults
max_check_result_file_age=3600
cached_host_check_horizon=15
cached_service_check_horizon=15
enable_predictive_host_dependency_checks=1
enable_predictive_service_dependency_checks=1
soft_state_dependencies=0
auto_reschedule_checks=0
auto_rescheduling_interval=30
auto_rescheduling_window=180
service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5
retain_state_information=1
state_retention_file=/var/log/nagios/retention.dat
retention_update_interval=60
use_retained_program_state=1
use_retained_scheduling_info=1
retained_host_attribute_mask=0
retained_service_attribute_mask=0
retained_process_host_attribute_mask=0
retained_process_service_attribute_mask=0
retained_contact_host_attribute_mask=0
retained_contact_service_attribute_mask=0
interval_length=60
check_for_updates=1
bare_update_check=0
use_aggressive_host_checking=0
execute_service_checks=1
accept_passive_service_checks=1
execute_host_checks=1
accept_passive_host_checks=1
enable_notifications=1
enable_event_handlers=1
obsess_over_services=0
obsess_over_hosts=0
translate_passive_host_checks=0
passive_host_checks_are_soft=0
check_for_orphaned_services=1
check_for_orphaned_hosts=1
check_service_freshness=1
service_freshness_check_interval=60
service_check_timeout_state=c
check_host_freshness=0
host_freshness_check_interval=60
additional_freshness_latency=15
enable_flap_detection=1
low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0
date_format=us
illegal_object_name_chars=`~!$%^&*|'"<>?,()=
illegal_macro_output_chars=`~$&|'"<>
use_regexp_matching=0
use_true_regexp_matching=0
admin_email=nagios@localhost
admin_pager=pagenagios@localhost
daemon_dumps_core=0
use_large_installation_tweaks=0
enable_environment_macros=1
debug_level=0
debug_verbosity=1
debug_file=/var/log/nagios/nagios.debug
max_debug_file_size=1000000
allow_empty_hostgroup_assignment=0
process_performance_data=1
service_perfdata_file=/var/log/pnp4nagios/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATAtTIMET::$TIMET$tHOSTNAME::$HOSTNAME$tSERVICEDESC::$SERVICEDESC$tSERVICEPERFDATA::$SERVICEPERFDATA$tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$tHOSTSTATE::$HOSTSTATE$tHOSTSTATETYPE::$HOSTSTATETYPE$tSERVICESTATE::$SERVICESTATE$tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
host_perfdata_file=/var/log/pnp4nagios/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATAtTIMET::$TIMET$tHOSTNAME::$HOSTNAME$tHOSTPERFDATA::$HOSTPERFDATA$tHOSTCHECKCOMMAND::$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
log_file=/var/log/nagios/nagios.log
cfg_file=/etc/nagios/objects/commands.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
cfg_file=/etc/nagios/objects/templates.cfg
commands.cfg

Code: Select all

...
define command{
command_name process-service-perfdata-file
command_line /usr/libexec/pnp4nagios/process_perfdata.pl --bulk=/var/log/pnp4nagios/service-perfdata
}
define command{
command_name process-host-perfdata-file
command_line /usr/libexec/pnp4nagios/process_perfdata.pl --bulk=/var/log/pnp4nagios/host-perfdata
}
Check

Code: Select all

[INFO]  ========== Starting Environment Checks ============
[INFO]  My version is: verify_pnp_config-0.6.25-R.40
[INFO]  Start Options: verify_pnp_config --mode bulk --config=/etc/nagios/nagios.cfg --pnpcfg=/etc/pnp4nagios
[INFO]  Reading /etc/nagios/nagios.cfg
[OK  ]  Running product is 'nagios'
[OK  ]  object_cache_file is defined
[OK  ]  object_cache_file=/var/log/nagios/objects.cache
[INFO]  Reading /var/log/nagios/objects.cache
[OK  ]  resource_file is defined
[OK  ]  resource_file=/etc/nagios/private/resource.cfg
[INFO]  Reading /etc/nagios/private/resource.cfg
[INFO]  Reading /etc/pnp4nagios/process_perfdata.cfg
[INFO]  Reading /etc/pnp4nagios/pnp4nagios_release
[OK  ]  Found PNP4Nagios version "0.6.25"
[OK  ]  ./configure Options '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--bindir=/usr/sbin' '--libexecdir=/usr/libexec/pnp4nagios' '--sysconfdir=/etc/pnp4nagios' '--localstatedir=/var/log/pnp4nagios' '--datadir=/usr/share/nagios/html/pnp4nagios' '--datarootdir=/usr/share/nagios/html/pnp4nagios' '--with-perfdata-dir=/var/lib/pnp4nagios' '--with-perfdata-spool-dir=/var/spool/pnp4nagios' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro '
[OK  ]  Effective User is 'nagios'
[OK  ]  User nagios exists with ID '1001'
[OK  ]  Effective group is 'nagios'
[OK  ]  Group nagios exists with ID '1001'
[INFO]  ========== Checking Bulk Mode Config  ============
[OK  ]  process_performance_data is 1 compared with '/1/'
[OK  ]  service_perfdata_file is defined
[OK  ]  service_perfdata_file=/var/log/pnp4nagios/service-perfdata
[OK  ]  service_perfdata_file_template is defined
[OK  ]  service_perfdata_file_template=DATATYPE::SERVICEPERFDATAtTIMET::$TIMET$tHOSTNAME::$HOSTNAME$tSERVICEDESC::$SERVICEDESC$tSERVICEPERFDATA::$SERVICEPERFDATA$tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$tHOSTSTATE::$HOSTSTATE$tHOSTSTATETYPE::$HOSTSTATETYPE$tSERVICESTATE::$SERVICESTATE$tSERVICESTATETYPE::$SERVICESTATETYPE$
[OK  ]  PERFDATA template looks good
[OK  ]  service_perfdata_file_mode is defined
[OK  ]  service_perfdata_file_mode=a
[OK  ]  service_perfdata_file_processing_interval is defined
[OK  ]  service_perfdata_file_processing_interval=15
[OK  ]  service_perfdata_file_processing_command is defined
[OK  ]  service_perfdata_file_processing_command=process-service-perfdata-file
[OK  ]  host_perfdata_file is defined
[OK  ]  host_perfdata_file=/var/log/pnp4nagios/host-perfdata
[OK  ]  host_perfdata_file_template is defined
[OK  ]  host_perfdata_file_template=DATATYPE::HOSTPERFDATAtTIMET::$TIMET$tHOSTNAME::$HOSTNAME$tHOSTPERFDATA::$HOSTPERFDATA$tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$tHOSTSTATE::$HOSTSTATE$tHOSTSTATETYPE::$HOSTSTATETYPE$
[OK  ]  PERFDATA template looks good
[OK  ]  host_perfdata_file_mode is defined
[OK  ]  host_perfdata_file_mode=a
[OK  ]  host_perfdata_file_processing_interval is defined
[OK  ]  host_perfdata_file_processing_interval=15
[OK  ]  host_perfdata_file_processing_command is defined
[OK  ]  host_perfdata_file_processing_command=process-host-perfdata-file
[INFO]  Nagios config looks good so far
[INFO]  ========== Checking config values ============
service_perfdata_file_processing_command at verify_pnp_config line 462.
[OK  ]  Command process-service-perfdata-file is defined
[OK  ]  '/usr/libexec/pnp4nagios/process_perfdata.pl --bulk=/var/log/pnp4nagios/service-perfdata'
[OK  ]  Command looks good
[OK  ]  Script /usr/libexec/pnp4nagios/process_perfdata.pl is executable
host_perfdata_file_processing_command at verify_pnp_config line 462.
[OK  ]  Command process-host-perfdata-file is defined
[OK  ]  '/usr/libexec/pnp4nagios/process_perfdata.pl --bulk=/var/log/pnp4nagios/host-perfdata'
[OK  ]  Command looks good
[OK  ]  Script /usr/libexec/pnp4nagios/process_perfdata.pl is executable
[INFO]  ========== Starting global checks ============
[OK  ]  status_file is defined
[OK  ]  status_file=/var/log/nagios/status.dat
[INFO]  host_query = 
[INFO]  service_query = 
[INFO]  Reading /var/log/nagios/status.dat
[INFO]  ==== Starting rrdtool checks ====
[OK  ]  RRDTOOL is defined
[OK  ]  RRDTOOL=/usr/bin/rrdtool
[OK  ]  /usr/bin/rrdtool is executable
[OK  ]  RRDtool 1.4.8  Copyright 1997-2013 by Tobias Oetiker <[email protected]>
[OK  ]  USE_RRDs is defined
[OK  ]  USE_RRDs=1
[OK  ]  Perl RRDs modules are loadable
[INFO]  ==== Starting directory checks ====
[OK  ]  RRDPATH is defined
[OK  ]  RRDPATH=/var/lib/pnp4nagios
[OK  ]  Perfdata directory '/var/lib/pnp4nagios' exists
[WARN]  5 hosts/services are not providing performance data
[WARN]  'process_perf_data 1' is set for 6 hosts/services which are not providing performance data!
[OK  ]  'process_perf_data 1' is set for 24 of your hosts/services
[INFO]  ==== System sizing ====
[OK  ]  23 hosts/service objects defined
[INFO]  ==== Check statistics ====
[WARN]  Warning: 2, Critical: 0
[WARN]  Checks finished...
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Can't get Nagios Core to work with PNP4Nagios

Post by bwallace »

Thanks for all of the details, but what OS/version is the Nagios Server?

For starters, I'm curious to see if npcd is running on it. Could you post the output of ps -ef | grep npcd

If it is not running can you start it ?
service npcd start
Be sure to check out the Knowledgebase for helpful articles and solutions!
Sholmo
Posts: 4
Joined: Wed May 25, 2016 12:13 pm

Re: Can't get Nagios Core to work with PNP4Nagios

Post by Sholmo »

It is CentOS 7 x64.
NPCD is up and running

Code: Select all

● npcd.service - LSB: Nagios Performancedata C Daemon
   Loaded: loaded (/etc/rc.d/init.d/npcd)
   Active: active (running) since Wed 2016-05-25 20:10:57 CEST; 2h 56min ago
..
nagios   32437     1  0 20:10 ?        00:00:00 /usr/sbin/npcd -f /etc/pnp4nagios/npcd.cfg -d
npcd.cfg

Code: Select all

user = nagios
group = nagios
log_type = syslog
log_file = /var/log/pnp4nagios/npcd.log
max_logfile_size = 10485760
log_level = 0
perfdata_spool_dir = /var/spool/pnp4nagios
perfdata_file_run_cmd = /usr/libexec/pnp4nagios/process_perfdata.pl
perfdata_file_run_cmd_args = --bulk
identify_npcd = 1
npcd_max_threads = 5
sleep_time = 15
load_threshold = 0.0
pid_file=/var/run/npcd.pid
perfdata_file = /var/log/pnp4nagios/perfdata.dump
perfdata_spool_filename = perfdata
perfdata_file_processing_interval = 15
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Can't get Nagios Core to work with PNP4Nagios

Post by bwallace »

Have you checked some of the items which pnpfornagios recommends?

https://docs.pnp4nagios.org/faq/3
https://docs.pnp4nagios.org/pnp-0.6/verify_pnp_config

Also, could you post /etc/pnp4nagios/npcd.cfg
Be sure to check out the Knowledgebase for helpful articles and solutions!
Sholmo
Posts: 4
Joined: Wed May 25, 2016 12:13 pm

Re: Can't get Nagios Core to work with PNP4Nagios

Post by Sholmo »

npcd.cfg is in my last post and verify dump is in my first post ;)
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Can't get Nagios Core to work with PNP4Nagios

Post by tgriep »

Are you trying to setup your server using bulk mode with NPCD?
If so, it looks like the commands are defined wrong.
Here is the example from the PNP4Nagios web site.
https://docs.pnp4nagios.org/pnp-0.6/con ... _with_npcd

Code: Select all

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$
}
Be sure to check out our Knowledgebase for helpful articles and solutions!
Sholmo
Posts: 4
Joined: Wed May 25, 2016 12:13 pm

Re: Can't get Nagios Core to work with PNP4Nagios

Post by Sholmo »

Thank you for your reply.

Now I'm kind of lost with paths you have posted, only instances of *-perfdata on my system (according to find ;) ) are:

Code: Select all

/var/lib/pnp4nagios/host-perfdata
/var/log/pnp4nagios/host-perfdata
/var/log/pnp4nagios/service-perfdata
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Can't get Nagios Core to work with PNP4Nagios

Post by rkennedy »

This is going to vary based on how you installed pnp4nagios, as we did not write pnp4nagios it is a bit difficult to support. Did you follow a specific guide when setting up your graphing?
Former Nagios Employee
Locked