Submit nrdp with curl
Posted: Tue Jun 20, 2017 10:38 am
I'm trying to replicate this post: https://support.nagios.com/forum/viewto ... 16&t=43618
I replaced the values(token, hostname, servicename, etc) and it just loads the page, it doesn't perform the POST.
And this is the output I get instead of the expected result of a successful processing:
I replaced the values(token, hostname, servicename, etc) and it just loads the page, it doesn't perform the POST.
Code: Select all
curl -X POST --data-urlencode 'token=xxxx&cmd=submitcheck&XMLDATA=<?xml version='\''1.0'\''?><checkresults><checkresult type='\''service'\''><hostname>localhost</hostname><servicename>Host Automation</servicename><state>1</state><output>Warning - this is a test</output></checkresult></checkresults>' http://xxxxx.itciss.com/nrdp/Code: Select all
<strong>Submit Nagios Command:</strong><br>
<form action="" method="get">
<input type="hidden" name="cmd" value="submitcmd">
Token: <input type="text" name="token" value="" size="15"><br>
Command: <input type="text" name="command" size="50" value="DISABLE_HOST_NOTIFICATIONS;somehost"><br>
<input type="submit" name="btnSubmit" value="Submit Command">
</form>
<hr>
<strong>Submit Check Data</strong><br>
<form action="" method="post">
<input type="hidden" name="cmd" value="submitcheck">
Token: <input type="text" name="token" value="" size="15"><br>
Check Data:<br>
<textarea cols="80" rows="15" name="XMLDATA">
<?xml version='1.0'?>
<checkresults>
<checkresult type='host'>
<hostname>somehost</hostname>
<state>0</state>
<output>Everything looks okay!|perfdata</output>
</checkresult>
<checkresult type='service'>
<hostname>somehost</hostname>
<servicename>someservice</servicename>
<state>1</state>
<output>WARNING: Danger Will Robinson!|perfdata</output>
</checkresult>
</checkresults>
</textarea><br>
<input type="submit" name="btnSubmit" value="Submit Check Data">
</form>