Proper format for HTTP POST body

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
tstarr
Posts: 4
Joined: Mon Sep 16, 2019 2:59 pm

Proper format for HTTP POST body

Post by tstarr »

Hello,

I'm trying to create an http request as an action after a "bad" result for an alarm. Specifically, using the service nexmo (https://developer.nexmo.com/messaging/sms/overview), though I don't think the service is the issue here.

I must be putting something in the wrong format for HostMonitor, as testing is successful doing a POST from outside the application.

HostMonitor version is v9.10

Host is https://rest.nexmo.com/sms/json
Port is 443 (for https)

Request is as follows:
POST https://rest.nexmo.com/sms/json
Host: rest.nexmo.com
Content-Type: application/json

{"from": "1[10 digit from number redacted here]",
"text": "A text Host Monitor message sent using the Nexmo",
"to": "1[10 digit to number redacted here]",
"api_key": "[8 character alphanumeric key redacted here]",
"api_secret": "[16 character alphanumeric secret redacted here]"}


Again, this format is successful in a post request outside the HostMonitor application. Does anyone have any thoughts as to what I'm doing wrong?

Appreciate any insights you can give.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Version 9.10 is very old and does not support HTTPS protocol for this action (only HTTP)

Regards
Alex
tstarr
Posts: 4
Joined: Mon Sep 16, 2019 2:59 pm

Post by tstarr »

Ha, there's always something. Thanks for your help, will likely be upgrading.
tstarr
Posts: 4
Joined: Mon Sep 16, 2019 2:59 pm

Post by tstarr »

I'm going to be looking at this some more tomorrow, but I just finishing upgrading to v11.98 and it is still failing the POST. An email alert attached to that same test goes off fine, so I know it must be some quirk of the http request that's causing issues.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

What result/error do you see in the log?

Regards
Alex
tstarr
Posts: 4
Joined: Mon Sep 16, 2019 2:59 pm

Post by tstarr »

There don't appear to be any errors relating to the actions taken on test failure in the log. The failing of the test itself shows up as:
<tr class="bad">
<td align="center"> <!--KSIM--><!--KSFD-18092019004720-->9/18/2019 12:47:20 AM<!--KSIM--> </td>
<td align="left"> <!--KSIM-->Test Failure<!--TI3692--><!--KSIM--> </td>
<td align="left"> <!--KSIM-->Bad<!--KSIM--> </td>
<td align="center"> <!--KSIM-->6.85895538330078<!--KSIM--> </td>
<td align="left"> <!--KSIM-->[db name]<!--KSIM--> </td>
</tr>
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Wrong log file, you should check "system" log file (menu View->System Log)
or check Quick Log related to the test using Quick Log pane (menu View->QuickLog then use "Show action" popup menu item)
or check Quick Log using Test Info dialog (select and press Ctrl+I or use "Test info" popup menu item)

Regards
Alex
Post Reply