NRDP server side ==> GET OK , POST not OK

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.
macling66
Posts: 6
Joined: Tue Feb 12, 2013 10:12 pm

NRDP server side ==> GET OK , POST not OK

Post 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 ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRDP server side ==> GET OK , POST not OK

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
macling66
Posts: 6
Joined: Tue Feb 12, 2013 10:12 pm

Re: NRDP server side ==> GET OK , POST not OK

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: NRDP server side ==> GET OK , POST not OK

Post by slansing »

What version of NRDP are you currently running?
macling66
Posts: 6
Joined: Tue Feb 12, 2013 10:12 pm

Re: NRDP server side ==> GET OK , POST not OK

Post 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 $
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRDP server side ==> GET OK , POST not OK

Post by scottwilkerson »

Are you sure you have a host/service setup in Nagios core already with the name you are submitting?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
macling66
Posts: 6
Joined: Tue Feb 12, 2013 10:12 pm

Re: NRDP server side ==> GET OK , POST not OK

Post 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"
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRDP server side ==> GET OK , POST not OK

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
macling66
Posts: 6
Joined: Tue Feb 12, 2013 10:12 pm

Re: NRDP server side ==> GET OK , POST not OK

Post 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:x:10:root,nagios
nagios:x:498:apache
nagcmd:x:501:nagios
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRDP server side ==> GET OK , POST not OK

Post 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:x:10:root,nagios
nagios:x:498:apache
nagcmd:x: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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked