27 Oct 2023 12:11 PM - last edited on 20 Dec 2023 03:10 PM by Michal_Gebacki
Hello guys,
you can use the curl call below to track host units (this requires jq tool in linux)
Have a nice day.
Solved! Go to Solution.
27 Oct 2023 12:12 PM - last edited on 07 Nov 2023 08:00 AM by MaciejNeumann
curl -k -s "https://YOURMCN/e/YOURENVID/api/v1/oneagents?Api-Token=YOURTOKEN&includeDetails=true&availabilitySta... " | jq | grep '^\s*"consumedHostUnits":' | sed 's/"consumedHostUnits": //' | sed 's/,//' | paste -s -d+ - | bc
27 Oct 2023 12:59 PM - edited 27 Oct 2023 01:00 PM
Hi,
You can use also this built metric for that dsfm:billing.hostunit.connected.
JSON
curl -X GET "https://{ENV_ID}.live.dynatrace.com/api/v2/metrics/query?metricSelector=(dsfm:billing.hostunit.connected:splitBy():sort(value(auto,descending))):names&from=-2h&to=now&resolution=Inf" -H "accept: application/json" -H "Authorization: Api-Token XXXX-XXXX"
CSV
curl -X GET "https://{ENV_ID}.live.dynatrace.com/api/v2/metrics/query?metricSelector=(dsfm:billing.hostunit.connected:splitBy():sort(value(auto,descending))):names&from=-2h&to=now&resolution=Inf" -H "accept: text/csv, application/json; q=0.1" -H "Authorization: Api-Token XXXX-XXXX"
Best regards