21 Apr 2022 06:49 AM - last edited on 27 Apr 2022 12:48 PM by MaciejNeumann
Is there any api available to get total memory per host.
Solved! Go to Solution.
21 Apr 2022 07:14 AM
Hi @nakb
Please check Metrics API - GET metric data points with metricSelector = builtin:host.mem.total:splitBy("dt.entity.host")
HTH
Yos
26 Apr 2022 10:38 AM
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...
26 Apr 2022 11:30 AM - edited 26 Apr 2022 11:34 AM
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é
27 Apr 2022 09:57 AM
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 :
27 Apr 2022 11:39 AM
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
27 Apr 2022 07:20 PM
Hadn't noticed that this was already available. Great!