Skip to content

Instantly share code, notes, and snippets.

@MudraR
Created April 15, 2025 14:54
Show Gist options
  • Select an option

  • Save MudraR/df19685500b93a6cc5ad307dd16f87ed to your computer and use it in GitHub Desktop.

Select an option

Save MudraR/df19685500b93a6cc5ad307dd16f87ed to your computer and use it in GitHub Desktop.
Push Custom Info to Dynatrace (PowerShell)
$token = "" # DT Token
$hostname = hostname
$processName = "process-name" #replace process name #by default is an IIS app pool
$headers = @{
"Authorization" = "Api-Token $token"
}
# Proprerties you want to log
$customObject = @{
test = "This is a test"
hello = "Hello, world!"
}
$body = @{
eventType = "CUSTOM_INFO"
title = "Testing Custom Info"
timeout = 30
entitySelector = "type(process_group_instance),entityName.contains(${processName}),fromRelationships.isProcessOf(type(HOST),entityName.contains($hostname))"
properties = $customObject
}
Invoke-RestMethod -Method Post -Uri "https://wkf10640.live.dynatrace.com/api/v2/events/ingest" -Headers $headers -ContentType "application/json" -Body ($body | ConvertTo-Json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment