# How to get total memory (RAM) per host?

**URL:** <https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902>\
**Category:** Dynatrace API\
**Tags:** hosts-classic, dynatrace-api\
**Created:** [April 21, 2022, 5:49am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902 "2022-04-21T05:49:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nakb](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@nakb](https://community.dynatrace.com/u/nakb)\
**Post date:** [April 21, 2022, 5:49am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/1 "2022-04-21T05:49:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [April 21, 2022, 6:14am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/2 "2022-04-21T06:14:47Z")

</div>

Hi&nbsp;[@nakb](https://community.dynatrace.com/user/41100)

Please check&nbsp;[Metrics API - GET metric data points](https://www.dynatrace.com/support/help/shortlink/api-metrics-v2-get-datapoints)&nbsp;with&nbsp;_ **metricSelector** _ =&nbsp;_**builtin:host.mem.total:splitBy(“dt.entity.host”)**_

HTH

Yos

---

<div class="post-metadata">

**Author:** ![nakb](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@nakb](https://community.dynatrace.com/u/nakb)\
**Post date:** [April 26, 2022, 9:38am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/3 "2022-04-26T09:38:29Z")

</div>

Hi&nbsp;[@Yosi\_Neuman](https://community.dynatrace.com/user/6931),

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…

---

<div class="post-metadata">

**Author:** ![avdveen](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@avdveen](https://community.dynatrace.com/u/avdveen)\
**Post date:** [April 26, 2022, 10:30am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/4 "2022-04-26T10:30:15Z")

</div>

Hi&nbsp;[@nakb](https://community.dynatrace.com/user/41100),

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é

---

<div class="post-metadata">

**Author:** ![nakb](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@nakb](https://community.dynatrace.com/u/nakb)\
**Post date:** [April 27, 2022, 8:57am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/5 "2022-04-27T08:57:50Z")

</div>

Hi&nbsp;[@andre\_vdveen](https://community.dynatrace.com/user/11931)&nbsp;,

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 :

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

---

<div class="post-metadata">

**Author:** ![Yosi\_Neuman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yosi_neuman/32/9845_2.png) [@Yosi\_Neuman](https://community.dynatrace.com/u/Yosi_Neuman)\
**Post date:** [April 27, 2022, 10:39am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/6 "2022-04-27T10:39:30Z")

</div>

HI&nbsp;[@nakb](https://community.dynatrace.com/user/41100)

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&nbsp;(((411957420068.33966 / 1024 ) / 1024) / 1024 ) =&nbsp;383.66524508968 and if you will round it you will get the 384GB

HTH

Yos

---

<div class="post-metadata">

**Author:** ![nakb](https://avatars.discourse-cdn.com/v4/letter/n/8edcca/32.png) [@nakb](https://community.dynatrace.com/u/nakb)\
**Post date:** [April 27, 2022, 11:04am UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/7 "2022-04-27T11:04:59Z")

</div>

Hi&nbsp;[@Yosi\_Neuman](https://community.dynatrace.com/user/6931),

Thanks that’s perfect.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [April 27, 2022, 6:20pm UTC](https://community.dynatrace.com/t/how-to-get-total-memory-ram-per-host/34902/8 "2022-04-27T18:20:02Z")

</div>

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