# Unable to generate test problem through event API

**URL:** <https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896>\
**Category:** Alerting\
**Tags:** problem-notification, http-monitor, problems-classic, dynatrace-api\
**Created:** [March 25, 2020, 7:23pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896 "2020-03-25T19:23:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [March 25, 2020, 7:23pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/1 "2020-03-25T19:23:05Z")

</div>

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](https://myenv.live.dynatrace.com/api/v1/events)&nbsp;".

Below is configuration done under HTTP monitor to generate test/dummy problem.

1. The request URL is -&nbsp;https: [//myenv.live.dynatrace.com/api/v1/events](https://myenv.live.dynatrace.com/api/v1/events)
2. HTTP method - POST
3. Additional HTTP Header - Authorization API token
4. Request Body - { “eventType”: “AVAILABILITY\_EVENT”,

“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](https://myenv.live.dynatrace.com/api/v1/events)&nbsp; | Failed to resolve hostname for [myenv.live.dynatrace.com](http://myenv.live.dynatrace.com): Search domain query failed. Original hostname: ‘[myenv.live.dynatrace.com](http://myenv.live.dynatrace.com)’ failed to resolve ‘[myenv.live.dynatrace.com](http://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…

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [March 25, 2020, 7:25pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/2 "2020-03-25T19:25:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [March 26, 2020, 8:13am UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/3 "2020-03-26T08:13:02Z")

</div>

Do you mean IP of dynatrace SaaS instance?

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [March 26, 2020, 8:28am UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/4 "2020-03-26T08:28:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [March 26, 2020, 9:54am UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/5 "2020-03-26T09:54:48Z")

</div>

no its not working :(. Any alternate way which should try?

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [March 26, 2020, 10:12am UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/6 "2020-03-26T10:12:46Z")

</div>

Why do you want to generate problem using http monitor? What is use case? Maybe I will have better idea

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [April 1, 2020, 4:58am UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/7 "2020-04-01T04:58:00Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![skrystosik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/skrystosik/32/21133_2.png) [@skrystosik](https://community.dynatrace.com/u/skrystosik)\
**Post date:** [April 1, 2020, 1:34pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/8 "2020-04-01T13:34:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justin\_hogue](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/justin_hogue/32/19679_2.png) [@justin\_hogue](https://community.dynatrace.com/u/justin_hogue)\
**Post date:** [April 1, 2020, 2:38pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/9 "2020-04-01T14:38:53Z")

</div>

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-](https://www.dynatrace.com/support/help/shortlink/id_brower-clickpath-events?_ga=2.199259950.1693856804.1585574684-1909602575.1571679112#javascript-)

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [April 1, 2020, 6:59pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/10 "2020-04-01T18:59:32Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [April 1, 2020, 7:00pm UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/11 "2020-04-01T19:00:26Z")

</div>

Sure. I will go thought link and check for this option as well..

Thanks…

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [April 23, 2020, 11:45am UTC](https://community.dynatrace.com/t/unable-to-generate-test-problem-through-event-api/18896/12 "2020-04-23T11:45:22Z")

</div>

**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…
