cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to generate test problem through event API

AK
Pro

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.

  1. The request URL is - 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  | 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...

11 REPLIES 11

skrystosik
DynaMight Guru
DynaMight Guru

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

Regards, Sebastian

Do you mean IP of dynatrace SaaS instance?

skrystosik
DynaMight Guru
DynaMight Guru

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.

Regards, Sebastian

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

skrystosik
DynaMight Guru
DynaMight Guru

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

Regards, Sebastian

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...

skrystosik
DynaMight Guru
DynaMight Guru

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

Regards, Sebastian

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...

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-

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

Thanks...

AK
Pro

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...

Featured Posts