Page 2 of 3

Re: NRDP Config Problem

Posted: Tue Mar 17, 2015 1:05 pm
by ssax
Can you delete those check files out of /tmp and see if they get recreated after you submit a check result.

One test you might do after you've deleted them out of temp is to stop the nagios service and then submit the check through the NRDP interface and see if they show up in /tmp, /usr/local/nagios/var/tmp, or in /usr/local/nagios/var/spool/checkresults.

Re: NRDP Config Problem

Posted: Wed Mar 18, 2015 9:35 am
by tacchino
Still fighting the /tmp problem. Further detail

grep -r check_results_dir /usr/local/nrdp

Code: Select all

/usr/local/nrdp/server/index.php:	if(!isset($cfg["check_results_dir"]))
/usr/local/nrdp/server/index.php:	if(!file_exists($cfg["check_results_dir"]))
/usr/local/nrdp/server/index.php:		$tmpname=tempnam($cfg["check_results_dir"],"c");
/usr/local/nrdp/server/config.inc.php:$cfg["check_results_dir"]="/usr/local/nagios/var/spool/checkresults";
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:	if(!isset($cfg["check_results_dir"]))
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:	if(!file_exists($cfg["check_results_dir"]))
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:		$tmpname=tempnam($cfg["check_results_dir"],"c");
grep -r tmp /usr/local/nrdp

Code: Select all

/usr/local/nrdp/server/index.php:		$tmpname=tempnam($cfg["check_results_dir"],"c");
/usr/local/nrdp/server/index.php:		$fh=fopen($tmpname,"w");
/usr/local/nrdp/server/index.php:		chgrp($tmpname,$cfg["nagios_command_group"]);
/usr/local/nrdp/server/index.php:		chmod($tmpname,0770);
/usr/local/nrdp/server/index.php:		$fh=fopen($tmpname.".ok","w+");
/usr/local/nrdp/server/config.inc.php:// NOTE: the Apache user need to be able create files here, and the Nagios user needs to read/delete those same files, so the /tmp system directory won't work (it has a sticky bit on it)
/usr/local/nrdp/server/config.inc.php:$cfg["tmp_dir"]="/usr/local/nagios/var/tmp";
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:		$tmpname=tempnam($cfg["check_results_dir"],"c");
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:		$fh=fopen($tmpname,"w");
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:		chgrp($tmpname,$cfg["nagios_command_group"]);
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:		chmod($tmpname,0770);
/usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php:		$fh=fopen($tmpname.".ok","w+");

Re: NRDP Config Problem

Posted: Wed Mar 18, 2015 9:45 am
by tacchino
ssax wrote:Can you delete those check files out of /tmp and see if they get recreated after you submit a check result.
Yep, they do get recreated. Two new files for each check.
ssax wrote:One test you might do after you've deleted them out of temp is to stop the nagios service and then submit the check through the NRDP interface and see if they show up in /tmp, /usr/local/nagios/var/tmp, or in /usr/local/nagios/var/spool/checkresults.
No change in behavior, files still written to /tmp

Re: NRDP Config Problem

Posted: Wed Mar 18, 2015 10:59 am
by ssax
There is only one place that it can pull that file location from, it's defined in /usr/local/nrdp/server/config.inc.php and it's defined properly in yours.

Are these the temp files created from your manually entry through the NRDP web interface? If not, let's just focus on submitting through the NRDP web interface just for troubleshooting purposes.

Please post your /etc/httpd/conf.d/nrdp.conf

Re: NRDP Config Problem

Posted: Wed Mar 18, 2015 12:14 pm
by tacchino
Yes, in these tests I've only been using the /nrdp/ web interface.

cat /etc/httpd/conf.d/nrdp.conf

Code: Select all

<Directory "/usr/local/nrdp">
#  SSLRequireSSL
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
#   AuthName "NRDP"
#   AuthType Basic
#   AuthUserFile /usr/local/nrdp/htpasswd.users
#  Require valid-user
</Directory>

Alias /nrdp "/usr/local/nrdp/server"

Re: NRDP Config Problem

Posted: Wed Mar 18, 2015 1:07 pm
by ssax
Let's see what NRDP is getting.

Edit /usr/local/nrdp/server/plugins/nagioscorepassivecheck/nagioscorepassivecheck.inc.php

Change line 134 from:

Code: Select all

echo "  <message>OK</message>\n";
To:

Code: Select all

echo "  <message>OK ".print_r($cfg)."</message>\n";
Submit one and post the XML output.

Change the file back when done.

Re: NRDP Config Problem

Posted: Wed Mar 18, 2015 3:33 pm
by tacchino

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<result>
  <status>0</status>
Array
(
    [authorized_tokens] => Array
        (
            [0] => xxxxxxx
        )

    [require_https] => 
    [require_basic_auth] => 
    [valid_basic_auth_users] => Array
        (
        )

    [nagios_command_group] => nagios
    [command_file] => /usr/local/nagios/var/rw/nagios.cmd
    [check_results_dir] => /usr/local/nagios/var/spool/checkresults
    [tmp_dir] => /usr/local/nagios/var/tmp
    [product_name] => nrdp
    [product_version] => 1.0
)
  <message>OK 1</message>
    <meta>
       <output>2 checks processed.</output>
    </meta>
</result>

Re: NRDP Config Problem

Posted: Thu Mar 19, 2015 9:05 am
by tacchino
So, I set up clean on a new Nagios core box and get the same behavior, files still written to /tmp/

Re: NRDP Config Problem

Posted: Thu Mar 19, 2015 9:34 am
by ssax
Hmm, I'd like to lab this up.

What distro/version are you using, and is it full/minimal install?

What guide are you following (post a link) to install it or how exactly are you installing it?

Re: NRDP Config Problem

Posted: Thu Mar 19, 2015 11:03 am
by tacchino
I didn't set up either server but here is what I can tell you.

Box 1
Red Hat Enterprise Linux Server release 5.11 (Tikanga)
Nagios Core 4.0.2
NRDP 1.2
Apache/2.2.3
PHP 5.1.6

Box 2
Oracle Linux Server release 6.6
Nagios Core 3.5.1
NRDP 1.2
Apache/2.2.15
PHP 5.3.3

For comparison, the specs for the XI box that works as expected:

CentOS release 6.6 (Final)
Nagios Core 4.0.8
NRDP 1.3.1
Apache/2.2.15
PHP 5.3.3

For set up I'm following the instructions here http://assets.nagios.com/downloads/nrdp ... erview.pdf