Created
April 15, 2025 14:54
-
-
Save MudraR/df19685500b93a6cc5ad307dd16f87ed to your computer and use it in GitHub Desktop.
Push Custom Info to Dynatrace (PowerShell)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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