Hi , I have writen a RESTFull web service accept JSON format. This service works on local server in company. Any client in company can post data(HTTP POST) to url. All successful. BUT.I configure a notification for EXECUTE HTTP ACTION. I enter the url and post data. Then test notification , There is no affect.
EXECUTE HTTP ACTION not take effect in PRGT
Votes:
0
Best Answer
Votes:
0
Dear nogay_42
If you enter any postdata, HTTP POST will be used. Otherwise, it is HTTP GET.
13 Replies
Votes:
0
Dear nogay_42
The HTTP Action does allow custom HTTP headers, so it canot send the content type "application/json". As a workaround, please perform this HTTP action via a powershell script which you can run as an Exe notification. This small snippet demonstrates how the HTTP action is done:
$postjson="{ "test_id": 1, "name": "A test" }" Invoke-WebRequest -Uri http:/127.0.0.1:5051/api -Method POST -ContentType application/json -Body $postjson
Votes:
0
Thanks Arne Seifert , I try to post via powershell is working but parameter $postjson="{"details":"testdata"}" give error like "Unexpexted token 'details':"testdata" } in expression or statement"
Votes:
0
Dear nogay_42
Our support for customization is limited, we are unable to going this through with you to debug this. It could be the case that you need to escape quotation marks, or use different quotation marks.
Votes:
0
Thanks Arne Seifert, Maybe I have asked my question wrong. Ok. What Http methot does PRTG use for HTTP ACTİON. (GET,POST,DELETE). This can solve may problem. How to send parameter to url. I can design my Restful service for this.
Votes:
0
Dear nogay_42
If you enter any postdata, HTTP POST will be used. Otherwise, it is HTTP GET.
Votes:
0
Thanks , I can send any data via PRTG by HTTP GET. But I have an new problem . Placaholders not working like below. %device is transmitted %device. No replace there
http://mydomain/prgt/signal.svc/signal?sender=ABABABA&test=Alert For device %device
Created on Jun 21, 2017 12:35:50 PM
Last change on Jun 22, 2017 11:59:57 AM by
Arne Seifert [Paessler Support]
Votes:
0
In this case, please update PRTG as the placeholders used in the postdata field should be resolved.
Votes:
0
I don't understand . Where can I update placaholders. Is it not nececassry to use in URL query string. like %device,%message etc..
Votes:
0
Dear nogay_42
I am sorry, I am lost now. Do you use the postdata field at all?
Votes:
0
No. I don't use postdata field. I use only Url field like http://mydomain/prgt/signal.svc/signal?test=%device , But %device not replaced by any device name. This field came to my server like '%device'. There is no replace on placeholder.
Votes:
0
Dear nogay_42
Please let me know, if /prgt/ is correct (instead of /prtg/). Please also let me know if you test the HTTP action via the "Test" button of the notification, or via an (simulated) error?
Votes:
0
Dear Arne Seifert, /prgt is correct. I have written mistake :) But web service works well. I use Test button of notification.
Votes:
0
Dear nogay_42
With the test button, there is no triggering device, hence the unresolved placeholder. You can test it with putting the notification on a sensor, and then use the context drop down menu to simulate an error in order to trigger the notification.
Add comment