Submitting a passive check using a curl command

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Submitting a passive check using a curl command

Post by corkyman »

I am trying to test submitting a check to NRDP using a curl command. Here is what I constructed and ran manually as a test:

curl -X POST --data-urlencode 'token=wspwebfarm&cmd=submitcheck&XMLDATA=<?xml version='\''1.0'\''?><checkresults><checkresult type='\''service'\''><hostname>VHLPNWSAS001</hostname><servicename>GWS_Timeouts</servicename><state>0</state><output>Ok|timeouts=0</output></checkresult></checkresults>' http://vhlgnngxi001.tvlport.net/nrdp

Here is a reply back:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://vhlgnngxi001.tvlport.net/nrdp/">here</a>.</p>
<hr>
<address>Apache/2.2.15 (Red Hat) Server at vhlgnngxi001.tvlport.net Port 80</address>
</body></html>

What am I doing wrong? Please help.
Last edited by dwhitfield on Wed Apr 26, 2017 9:43 am, edited 1 time in total.
Reason: marking with green check mark
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Submitting a passive check using a curl command

Post by cdienger »

Looks like you just need a "/" at the end. Try:

curl -X POST --data-urlencode 'token=wspwebfarm&cmd=submitcheck&XMLDATA=<?xml version='\''1.0'\''?><checkresults><checkresult type='\''service'\''><hostname>VHLPNWSAS001</hostname><servicename>GWS_Timeouts</servicename><state>0</state><output>Ok|timeouts=0</output></checkresult></checkresults>' http://vhlgnngxi001.tvlport.net/nrdp/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Re: Submitting a passive check using a curl command

Post by corkyman »

Additional info:
I am getting the same results on my Windows system when using the curl command. Submitting the command using the browser and using a VBScript works fine. I also replaced blanks with %20 in the XML data but this did not help.
corkyman
Posts: 120
Joined: Wed Jul 13, 2016 12:58 pm

Re: Submitting a passive check using a curl command

Post by corkyman »

Yes, thank you very much! Working now.
Locked