20 Apr 2022
10:49 PM
- last edited on
27 Apr 2022
04:48 AM
by
MaciejNeumann
Is there any api available to get total memory per host.
Solved! Go to Solution.
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 :
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
Hadn't noticed that this was already available. Great!