How to post json with check_http

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.
jraj90
Posts: 7
Joined: Thu Feb 27, 2014 2:27 am

Re: How to post json with check_http

Post by jraj90 »

HI ssax,

I have tried posting using the output from both the websites you provided and the outcome is the same as before:-

Code: Select all

./check_http -H test.com -S -k 'Authorization: Bearer fdb6ffsdfdfseerwcxvxcvcvx' -u '/smsmessaging/v1/outbound/212830/requests' --method=POST --post='{\"outboundSMSMessageRequest\": {\"address\": [\"tel:+8801847149927\"],\"senderAddress\": \"tel:12345678\",\"outboundSMSTextMessage\": {\"message\": \"Hello World-jaya\"},\"clientCorrelator\": \"123456\",\"senderName\": \"ACME Inc.\"}}'

HTTP CRITICAL: HTTP/1.1 500 Internal Server Error - 1382 bytes in 0.476 second response time |time=0.476173s;;;0.000000 size=1382B;;;0

Code: Select all

./check_http -H test.com -S -k 'Authorization: Bearer fdb6ffsdfdfseerwcxvxcvcvx' -u '/smsmessaging/v1/outbound/212830/requests' --method=POST --post='%7B%22outboundSMSMessageRequest%22%3A%20%7B%22address%22%3A%20%5B%22tel%3A%2B8801847149927%22%5D%2C%22senderAddress%22%3A%20%22tel%3A12345678%22%2C%22outboundSMSTextMessage%22%3A%20%7B%22message%22%3A%20%22Hello%20World-jaya%22%7D%2C%22clientCorrelator%22%3A%20%22123456%22%2C%22senderName%22%3A%20%22ACME%20Inc.%22%7D%7D'

HTTP CRITICAL: HTTP/1.1 500 Internal Server Error - 1382 bytes in 0.554 second response time |time=0.553926s;;;0.000000 size=1382B;;;0

Thanks

Regards
Last edited by tmcdonald on Wed Aug 19, 2015 3:47 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to post json with check_http

Post by tmcdonald »

When you run this command, can you also tail -f the Apache logs on the remote server to see what the 500 might be caused by?
Former Nagios employee
jraj90
Posts: 7
Joined: Thu Feb 27, 2014 2:27 am

Re: How to post json with check_http

Post by jraj90 »

Hi guys,

Thank you for all the responses and help.

Finally I got it working by adding "-T 'application/json'" in the request.

Regards,
- Jaya -
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to post json with check_http

Post by tmcdonald »

Glad to see it is working!

I'll be closing this thread now, but feel free to open another if you need anything in the future!
Former Nagios employee
Locked