Last active
August 12, 2022 20:23
-
-
Save tukanuk/0683ad423210c531c45280993b0cdaca to your computer and use it in GitHub Desktop.
OneAgent Local API and Metric Scripting Integration Examples
This file contains 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
$Params = @{ | |
Method = "Post" | |
Uri = "http://localhost:14499/metrics/ingest" | |
Body = "test.temperature,sensor=basement 15" | |
ContentType = "text/plain; charset=utf-8" | |
} | |
Invoke-RestMethod @Params | |
# For more info see: | |
# https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/ingestion-methods/oneagent-metric-api |
This file contains 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
# You will be prompted to enter for the user password | |
Get-WmiObject -Query 'SELECT DeviceID, FreeSpace, Size FROM Win32_LogicalDisk' -ComputerName <ip-address> \ | |
-Credential <full-user-name> | Format-Table -p DeviceID, FreeSpace, Size | |
# If you are able to sucessfully execute this command from an ActiveGate to a remote host, | |
# you should be able to remotely monitor a Window's host with a WMI Extension. | |
# For more info on proper configuration see: | |
# https://www.dynatrace.com/support/help/extend-dynatrace/extensions20/data-sources/wmi-extensions |
This file contains 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
# Basic Metric Scripting Integration | |
$query = 'SELECT DeviceID, FreeSpace, Size FROM Win32_LogicalDisk' | |
$WMIObject = Get-WMIObject -Query $query | |
echo "test.free_space,deviceid=$($WMIObject.deviceid) $($WMIObject.freespace)" | .\dynatrace_ingest -v | |
# For more info see: | |
# https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/ingestion-methods/oneagent-pipe | |
# https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment