Page 1 of 2
NRDP server side ==> GET OK , POST not OK
Posted: Tue Feb 12, 2013 10:18 pm
by macling66
I have Configure NRDP in Server side
Submit Nagios Command / http get request ==> OK
<result><status>0</status><message>OK</message></result>
[1360724821] EXTERNAL COMMAND: DISABLE_HOST_NOTIFICATIONS;somehost
Submit Check Data / http post request ==> NOT OK
<result><status>0</status><message>OK</message><meta><output>2 checks processed.</output></meta></result>
No response in nagios.log
Anybody can give me advice ?
Re: NRDP server side ==> GET OK , POST not OK
Posted: Wed Feb 13, 2013 8:24 am
by scottwilkerson
Check your check_result_path in your nagios.cfg
then look in /usr/local/nrdp/server/config.inc.php and verify $cfg["check_results_dir"] is set to the same path
Re: NRDP server side ==> GET OK , POST not OK
Posted: Thu Feb 14, 2013 1:09 am
by macling66
the directory is same.
config.inc.php
$cfg["check_results_dir"]="/usr/local/nagios/var/spool/checkresults";
nagios.cfg
check_result_path=/usr/local/nagios/var/spool/checkresults
Re: NRDP server side ==> GET OK , POST not OK
Posted: Thu Feb 14, 2013 2:21 pm
by slansing
What version of NRDP are you currently running?
Re: NRDP server side ==> GET OK , POST not OK
Posted: Thu Feb 14, 2013 8:48 pm
by macling66
more index.php
<?php
//
// Nagios Remote Data Processor (NRDP)
// Copyright (c) 2010 Nagios Enterprises, LLC.
//
// License: Nagios Open Software License <
http://www.nagios.com/legal/licenses>
//
// $Id: index.php 12 2010-06-19 04:19:35Z egalstad $
more config.inc.php
<?php
// NRDP Config File
// Copyright (c) 2010 Nagios Enterprises, LLC.
// License: Nagios Open Software License <
http://www.nagios.com/legal/licenses>
//
// $Id: config.inc.php 12 2010-06-19 04:19:35Z egalstad $
$cfg['product_name']='nrdp';
$cfg['product_version']='1.0'
more includes/utils.inc.php
<?php
//
// NRDP Utils
// Copyright (c) 2008-2010 Nagios Enterprises, LLC.
// License: Nagios Open Software License <
http://www.nagios.com/legal/licenses>
//
// $Id: utils.inc.php 12 2010-06-19 04:19:35Z egalstad $
Re: NRDP server side ==> GET OK , POST not OK
Posted: Mon Feb 18, 2013 8:25 am
by scottwilkerson
Are you sure you have a host/service setup in Nagios core already with the name you are submitting?
Re: NRDP server side ==> GET OK , POST not OK
Posted: Tue Feb 19, 2013 9:37 pm
by macling66
sure ...
echo command :
echo "`date +[%s]` PROCESS_SERVICE_CHECK_RESULT;NMS1-10.147.252.11;03_Current_Users_Pnrdp;0;test" > /usr/local/nagios/var/rw/nagios.cmd
nagios.log
[1361327411] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;NMS1-10.147.252.11;03_Current_Users_Pnrdp;0;test
[1361327413] PASSIVE SERVICE CHECK: NMS1-10.147.252.11;03_Current_Users_Pnrdp;0;test
nrdp post :
<?xml version='1.0'?>
<checkresults>
<checkresult type='host'>
<hostname>NMS1-10.147.252.11</hostname>
<state>0</state>
<output>Everything looks okay!|perfdata</output>
</checkresult>
<checkresult type='service'>
<hostname>NMS1-10.147.252.11</hostname>
<servicename>03_Current_Users_Pnrdp</servicename>
<state>0</state>
<output>WARNING: Danger Will Robinson!|perfdata</output>
</checkresult>
</checkresults>
<result><status>0</status><message>OK</message><meta><output>2 checks processed.</output></meta></result>
access.log
xx.xxx.xxx.xx - - [20/Feb/2013:09:35:42 +0700] "POST /nrdp/ HTTP/1.1" 200 170 "
http://192.168.31.168/nrdp/" "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"
Re: NRDP server side ==> GET OK , POST not OK
Posted: Wed Feb 20, 2013 4:32 pm
by scottwilkerson
Let's check a couple other things
Code: Select all
ls -ld /usr/local/nagios/var/spool/checkresults
cat /etc/group|grep nag
should look like this
Code: Select all
[root@localhost libexec]# ls -ld /usr/local/nagios/var/spool/checkresults
drwxrwxr-x 2 nagios nagios 73728 Feb 20 15:26 /usr/local/nagios/var/spool/checkresults
[root@localhost libexec]# cat /etc/group|grep nag
nagios:x:500:nagios,apache
nagcmd:x:501:nagios,apache
nagioscmd:x:502:nagios
Re: NRDP server side ==> GET OK , POST not OK
Posted: Wed Feb 20, 2013 11:26 pm
by macling66
ls -ld /usr/local/nagios/var/spool/checkresults
drwxr-xr-x 2 nagios nagios 4096 Feb 21 11:23 /usr/local/nagios/var/spool/checkresults
cat /etc/group|grep nag
wheel

10:root,nagios
nagios

498:apache
nagcmd

501:nagios
Re: NRDP server side ==> GET OK , POST not OK
Posted: Thu Feb 21, 2013 12:48 pm
by scottwilkerson
macling66 wrote:ls -ld /usr/local/nagios/var/spool/checkresults
drwxr-xr-x 2 nagios nagios 4096 Feb 21 11:23 /usr/local/nagios/var/spool/checkresults
cat /etc/group|grep nag
wheel

10:root,nagios
nagios

498:apache
nagcmd

501:nagios
This is the problem, permissions are wrong, in multiple ways
Code: Select all
chmod g+w /usr/local/nagios/var/spool/checkresults
useradd -G nagcmd apache