Page 1 of 1

Sending to NRPE without using send_nrdp script

Posted: Tue Apr 06, 2021 1:44 pm
by BanditBBS
I have a very weird use case here where it'd make my life extremely easier if I could send passive check results to NagiosXI using nrdp by without using the send_nrdp.pl script.

Currently in the script this line is sending the results to XI:

Code: Select all

rslt=`curl -f --silent --insecure -d "$pdata" "$url/"`
I know what the $pdata variable contains(some xml) and of course the $url. Is there any way I can turn this into just a custom URL that I could put into chrome, edge, firefox, whatever browser that would send the results to XI?

Re: Sending to NRPE without using send_nrdp script

Posted: Wed Apr 07, 2021 1:37 pm
by vtrac
Hi,
I looked at the "send_nrdp.sh" from Nagios Exchange and test the URL calls on Chrome.

I test it with this XML:

Code: Select all

<?xml version='1.0'?>
<checkresults>
    <checkresult type='host'>
        <hostname>192.168.23.63-ncpa</hostname>
        <state>0</state>
        <output>Everything looks okay! | perfdata=1;</output>
    </checkresult>
</checkresults>
Converted the XML to url-enended (ONE line):

Code: Select all

%3C%3Fxml%20version%3D'1.0'%3F%3E%0A%3Ccheckresults%3E%0A%3Ccheckresult%20type%3D'host'%3E%0A%3Chostname%3E192.168.23.63-ncpa%3C%2Fhostname%3E%0A%3Cstate%3E0%3C%2Fstate%3E%0A%3Coutput%3EEverything%20looks%20okay!%20%7C%20perfdata%3D1%3B%3C%2Foutput%3E%0A%3C%2Fcheckresult%3E%0A%3C%2Fcheckresults%3E
I tested it by pasting the URL (below) onto chrome:

Code: Select all

http://192.168.23.61/nrdp/?token=VT9900&cmd=submitcheck&xml=%3C%3Fxml%20version%3D'1.0'%3F%3E%0A%3Ccheckresults%3E%0A%3Ccheckresult%20type%3D'host'%3E%0A%3Chostname%3E192.168.23.63-ncpa%3C%2Fhostname%3E%0A%3Cstate%3E0%3C%2Fstate%3E%0A%3Coutput%3EEverything%20looks%20okay!%20%7C%20perfdata%3D1%3B%3C%2Foutput%3E%0A%3C%2Fcheckresult%3E%0A%3C%2Fcheckresults%3E
w1.png
My Nagios XI host updated:
w2.png

Regards,
Vinh

Re: Sending to NRPE without using send_nrdp script

Posted: Wed Apr 07, 2021 1:57 pm
by BanditBBS
You just made me scream in joy on a call with my boss as I read your reply.

Feel free to close this one up, thanks!

Re: Sending to NRPE without using send_nrdp script

Posted: Wed Apr 07, 2021 3:08 pm
by vtrac
Great!! .... locking post/ticket ... :-)