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

Track consumed host units for licensing usage

realdynatrace
Visitor

Hello guys,

you can use the curl call below to track host units (this requires jq tool in linux)

Have a nice day.

 

2 REPLIES 2

realdynatrace
Visitor

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

AntonPineiro
DynaMight Guru
DynaMight Guru

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

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Featured Posts