Ubuntu – Setting up PNP4nagios – Cant find Nagios Environment

nagiosUbuntu

My system is configured as follows:
Ubuntu 14.04LTS
Nagios Core 4.0.8
Plugins @ ver 2.0.3
PNP 0.4.13

The latest apache, perl, rrdtool, etc.
Nagios has been working normally, just added a remote host for testing purposes.

I followed the PNP docs but I'm sure I did something wrong.

After installing PNP4nagios, the website was not reachable and I realized that pnp4nagios.conf was in /etc/httpd/conf.d/ so I executed ./configure --with-httpd-conf=/etc/apache2/conf-available and installed it again.

The install page then showed good and everything was green. I renamed install.php into install.done.php and configured nagios to work in Synchronous Mode.

Loading http:///pnp4nagios/ I got an error telling me that perfdata dir is empty and indeed it is.

So I ran verify_pnp_config as follows:
perl verify_pnp_config -m sync -c /usr/local/nagios/etc/nagios.cfg -p /usr/local/pnp4nagios/etc that gave the followinf output:

http://pastebin.com/m4revFW8

Maybe these lines are wrong?

[INFO] host_query =
[INFO] service_query =

Then I set in process_perfdata.cfg LOG_LEVEL 2, who tells me in perfdata.log

2014-11-05 04:37:30 [9049] [2] Using Config File /usr/local/pnp4nagios/etc/process_perfdata.cfg parameters

2014-11-05 04:37:30 [9049] [2] Default Timeout: 15 secs.

2014-11-05 04:37:30 [9049] [2] Config Timeout: 15 secs.

2014-11-05 04:37:30 [9049] [2] Actual Timeout: 15 secs.

2014-11-05 04:37:30 [9049] [1] process_perfdata.pl-0.6.24 starting in SYNC Mode

2014-11-05 04:37:30 [9049] [1] Cant find Nagios Environment. Exiting ....

I used in commands.cfg (for host and service) the commands:

command_line    /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl

command_line    /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA

or

command_line    /usr/local/pnp4nagios/libexec/process_perfdata.pl

command_line    /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA

or

command_line    perl /usr/local/pnp4nagios/libexec/process_perfdata.pl

command_line    perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA

But I didn't make any difference.

TL;DR

+perfdata dir is empty.
+verify_pnp_config output is http://pastebin.com/m4revFW8
+perfdata.log says:

2014-11-05 04:37:30 [9049] [2] Using Config File /usr/local/pnp4nagios/etc/process_perfdata.cfg parameters

2014-11-05 04:37:30 [9049] [2] Default Timeout: 15 secs.

2014-11-05 04:37:30 [9049] [2] Config Timeout: 15 secs.

2014-11-05 04:37:30 [9049] [2] Actual Timeout: 15 secs.

2014-11-05 04:37:30 [9049] [1] process_perfdata.pl-0.6.24 starting in SYNC Mode

2014-11-05 04:37:30 [9049] [1] Cant find Nagios Environment. Exiting ....

Best Answer

Apparently it's a Nagios 4 bug, where environment data used by pnp4nagios is not provided in sync mode.

http://www.monitoring-portal.org/wbb/index.php?page=Thread&postID=210275#post210275

Switching to bulk+npcd mode, solved the problem.