How to get total memory (RAM) per host?

Is there any api available to get total memory per host.

Hi @nakb

Please check Metrics API - GET metric data points with metricSelector = builtin:host.mem.total:splitBy(“dt.entity.host”)

HTH

Yos

Hi @Yosi_Neuman,

I have checked this but I have got series of values based on timestamp but is it possible to get just single number like Host A=16GB memory, Host B=4GB memory and so on…

Hi @nakb,

You could use a resolution of 1 day (resolution = 1d) and run the report for the last day (now-1d), which will give you a single value for each host if you’re only interested in the current memory assignment for each of the hosts.

If you want the hostnames too instead of just the Dynatrace host ID, use the following:
builtin:host.mem.total:splitBy(“dt.entity.host”):names

HTH
André

Hi @andre_vdveen ,

Thanks could you please let me know whether values in bytes or kb.

Also the total memory in host and the value I got is mismatched.

Example:

Host1 = 384 GB RAM

Api result :

{    “dimensions”: [        “Host1”,        “HOST-9999994599E1FNN”    ],    “dimensionMap”: {        “dt.entity.host.name”: “Host1”,        “dt.entity.host”: “HOST-9999994599E1FNN”    },    “timestamps”: [        1651104000000    ],    “values”: [        411957420068.33966    ]}

HI @nakb

If I’m not mistaken the numbers are in bytes.

If you will dived the number you get by 1024 three times (1 for KB , 2 for MG, 3 for GB) you will get the number you are looking for, and in your case (((411957420068.33966 / 1024 ) / 1024) / 1024 ) = 383.66524508968 and if you will round it you will get the 384GB

HTH

Yos

Hi @Yosi_Neuman,

Thanks that’s perfect.

Hadn’t noticed that this was already available. Great!