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

Infrastructural event ingestion, unknown host (not yet in Dynatrace environment)

xstreur
Frequent Guest

Hello,

I'm looking for a solution to post new events from infrastructural components (Element Managers) that  can use the Events API to post new (error) events. I'm trying to post new events but they seem to only accept them if the hostname already exists in the Dynatrace environment. How should I post these events so they will be visible in  
DT so I can use the notifier to send them to a service management solution like ServiceNow.

 

 

4 REPLIES 4

Julius_Loman
DynaMight Legend
DynaMight Legend

A normal lifecycle is problem problem-opening event resulting in a Dynatrace problem. Problems can be then sent using alerting profiles and integrations to 3rd party tools such as Service Now.

Dynatrace works on the SmartScape entity model. This model can be enriched using custom topology and then you can send such problem opening events to those entities. So basically you need to create those custom entities first to be able to send events to them and raise problems. 

There are also other possible solutions such as sending just log events and having problems created from logs only. 

What element manager is the source of your events? Does it know at least a list of the devices it is managing?

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Hello @xstreur 

As simple as that:

  1. As long as, the hosts aren't monitored within the monitoring tenant, you can create custom devices through the Rest Api or the UI as well both are applicable based on your preferences and the best suitable for your team.
  2. To create custom devices through Rest Api, create access token with "entities.wite" and use it to create a custom device through Environment APi v2 or the curl command as per preferences.
  3. Create access token with "events.ingest" to utilize it while using the API to ingest events into the custom devices.

Peter_Youssef_1-1727358258057.png

Peter_Youssef_0-1727358183983.png

Peter_Youssef_2-1727358547561.png

Then Execute > upon successful execution > you should receive one of the below Response codes.

Peter_Youssef_3-1727358693688.png

To create custom device through UI

Under Infrastructure Observability > Technologies and processes > Custom Devices 

Peter_Youssef_4-1727358804155.png

Peter_Youssef_5-1727358848895.png

Peter_Youssef_6-1727358918275.png

After that proceed with Events ingestion through Environment Api v2, just an example, you can customize as per actual requirements:

Peter_Youssef_7-1727359111949.png

Peter_Youssef_8-1727359174489.png

  • you can utilize rest Api externally to create custom devices and ingest events as well without need to access the UI through the generated Curl command from the monitoring tenant.

Finally

You have options to either:

  • Continue with current integration with ServiceNow to keep posting notifications to SNow URL.
  • Enable the below options in Dynatrace integration side

Peter_Youssef_9-1727359485188.png

For event Integration

So, all events will be correlated to the impacted entities, you will be notified in case of any impact or issues.

Or

You can configure CMDB integration between Dynatrace and Service Now it will figure out a comprehensive monitoring and integration Landscape.

Kind Regards,

Peter.

Please evaluate te script here below. The cutome device is added but no events are accepted (reportCount 0):

#!/bin/bash

# set -x

CiTkn="Token1"

CrtTkn="Token2"

# ##############################################################

# Add Custom Device

# ##############################################################

curl -k -X 'POST' \

  "https://10.224.73.9/e/9b3c1c96-fbed-4434-b713-c063b98ba1d7/api/v2/entities/custom?uiBased=true" \

  -H 'accept: application/json; charset=utf-8' \

  -H "Authorization: Api-Token ${CiTkn}" \

  -H 'Content-Type: application/json; charset=utf-8' \

  -d '{

  "configUrl": "",

  "customDeviceId": "v5060mgt1234",

  "displayName": "Router1234",

  "dnsNames": [

    "v5060mgt1234.grit-ot.nl"

  ],

  "group": "myCustomDeviceGroup",

  "ipAddresses": [

    "10.224.73.123"

  ],

  "listenPorts": [

    80

  ],

  "properties": {},

  "type": "Router"

}'

 

# ##############################################################

# Report Event

# ##############################################################

curl -k -X 'POST' \

  "https://10.224.73.9/e/9b3c1c96-fbed-4434-b713-c063b98ba1d7/api/v2/events/ingest" \

  -H 'accept: application/json; charset=utf-8' \

  -H "Authorization: Api-Token ${CrtTkn} "\

  -H 'Content-Type: application/json; charset=utf-8' \

  -d '{

  "entitySelector": "type(SERVICE),entityName.startsWith(v5060mgt1234)",

  "eventType": "ERROR_EVENT",

  "properties": {

    "dt.event.allow_davis_merge": "false",

    "componentName": "Power Supply",

    "eventDescription": "Device temperature above 105 degrees"

  },

  "title": "CustomEvent",

  "timeout": 360

}'

Event when creating the CI (Host) the ingest of a related event does not work. I made a shell script that first adds the CI to the Dynatrace environment (Works and is seen in DynaTrace) but an event for this host gets reportCount 0. When I use the same event to for an existing host (that have an OneAgent installed). it does work. See the reply with my script for the used API's

Featured Posts