25 Mar 2020 07:23 PM - last edited on 29 May 2023 10:26 AM by MaciejNeumann
Hello Folks,
I'm pushing one dummy problem notification through event API and I'm using following URL to test "https://myenv.live.dynatrace.com/api/v1/events ".
Below is configuration done under HTTP monitor to generate test/dummy problem.
"timeoutMinutes": 05,
"attachRules": { "entityIds": ["HTTP_CHECK-XYZ"] },
"source": "OpsControl",
"description": "XYZ service is Down" }
But, when I run this monitor the event/problem is not generated and logs entry says "POST https://myenv.live.dynatrace.com/api/v1/events | Failed to resolve hostname for myenv.live.dynatrace.com: Search domain query failed. Original hostname: 'myenv.live.dynatrace.com' failed to resolve 'myenv.live.dynatrace.com' after 12 queries -> [/192.xxx.y.z:53] failed to send a query via UDP (no stack trace available)".
I have tested this under postman and successfully able to generate the problem with desired details.
I don't know why its not working when I configured it through HTTP monitor.
Can anybody please throw some light here.
Thanks...
Solved! Go to Solution.
25 Mar 2020 07:25 PM
You are trying to generate problem via HTTP Monitor executed on the same DT Instance? In such case maybe try using localhost or IP instead.
Sebastian
26 Mar 2020 08:13 AM
Do you mean IP of dynatrace SaaS instance?
26 Mar 2020 08:28 AM
Yes I was thinking about it. I suppose DT is not able to resolve public domain, you can try as well 127.0.0.1 but I don't know if this work. It's only idea.
26 Mar 2020 09:54 AM
no its not working :(. Any alternate way which should try?
26 Mar 2020 10:12 AM
Why do you want to generate problem using http monitor? What is use case? Maybe I will have better idea
01 Apr 2020 05:58 AM
In HTTP monitor, Request 1 will have some condition and Request 2 will have post request for event API.
If condition in Request 1 is true then Request 2 will send a notification. This notification will have some extra details.
Thanks...
01 Apr 2020 02:34 PM
But there is no option to execute second request in synthetic monitor if first one has failed. You have option to use post execution script in JS but I don't think you can place there HTTP request because it may be limited. I rather suggest custom WebHook integration for Problems raised from those synthetic monitors. You will have to create simple nodejs/python/php script that will receive payload with problem from DT and then send event to DT via API.
Sebastian
01 Apr 2020 07:59 PM
If condition in Request 1 is failed then then I will call skip request so that it wont execute the next request i.e event API step/request2 (post) and that the trick I'm planning to implement. (Let me know your thoughts on this)
Well, webhook integration could also be a workaround I will check on that too.
Thanks...
01 Apr 2020 03:38 PM
Hello,
I haven't tried this myself but you may be able to achieve this by using JavaScript events. Through the use of the JavaScript API you should have the ability to create a more dynamic workflow. I'll provide a link with documentation on this below.
https://www.dynatrace.com/support/help/shortlink/id_brower-clickpath-events#javascript-
01 Apr 2020 08:00 PM
Sure. I will go thought link and check for this option as well..
Thanks...
23 Apr 2020 12:45 PM
Well, when I tried the same in our production environment it worked like a charm.
It might be because, I was testing the test problem generation using my local machine which has active gate along with one agent. Although I'm not sure if one agent is causing this issue or not but yes it works.
Drafting my use case here, could be helpful for other if they have such similar requirements.
I was generating test problem generation because I have to add that as a step/request under one HTTP monitor.
The logic is, Request 1 will have some condition and Request 2 will have post request of event API to generate a problem.
If condition in Request 1 is true then Request 2 will be skipped else Request 2 will trigger a Problem notification. This generated problem notification will have some extra details which we need to pass to ticketing tool to cut a tickets.
Thanks...