# JVM/system memory monitor graphs

**URL:** <https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082>\
**Category:** APM\
**Tags:** java, ui\
**Created:** [February 3, 2021, 7:25am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082 "2021-02-03T07:25:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [February 3, 2021, 7:25am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/1 "2021-02-03T07:25:56Z")

</div>

Kibana version : 7.9

Elasticsearch version : 7.9

APM Server version : 7.9

APM Agent language and version : java 1.8

Fresh install or upgraded from other version? fresh install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc. :-no

I am trying to build a separate dashboard which looks similar to below screen shot .  
Is this dashboard/visualizations available out of the box so that I can reuse and create a dashboard out of this.  
Is it possible to save this graphs to my dashboard.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4e65c375c01a69cb05d2032a4255c9d5e5333986.png)

---

<div class="post-metadata">

**Author:** ![sqren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sqren/32/26110_2.png) [@sqren](https://discuss.elastic.co/u/sqren)\
**Post date:** [February 3, 2021, 1:21pm UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/2 "2021-02-03T13:21:58Z")

</div>

> Is it possible to save this graphs to my dashboard.

Unfortunately it is not possible to export the graphs from the curated APM ui to dashboard. This is something we planning to add but I unfortunately do not have a timeline for you.

Feel free to comment and/or subscribe to [this issue](https://github.com/elastic/kibana/issues/82388) to get notified when the feature lands.

---

<div class="post-metadata">

**Author:** ![sqren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sqren/32/26110_2.png) [@sqren](https://discuss.elastic.co/u/sqren)\
**Post date:** [February 3, 2021, 1:30pm UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/3 "2021-02-03T13:30:32Z")

</div>

Btw if you are interested this is the queries for calculating CPU and memory:

```auto
GET apm*/_search
{
  "aggs": {
    "systemCPUAverage": { "avg": { "field": "system.cpu.total.norm.pct" } },
    "systemCPUMax": { "max": { "field": "system.cpu.total.norm.pct" } },
    "processCPUAverage": {
      "avg": { "field": "system.process.cpu.total.norm.pct" }
    },
    "processCPUMax": { "max": { "field": "system.process.cpu.total.norm.pct" } }
  }
}

```

```auto
GET apm*/_search
{
    "aggs": {
      "memoryUsedAvg": {
        "avg": {
          "script": {
            "lang": "expression",
            "source": "1 - doc['system.memory.actual.free'] / doc['system.memory.total']"
          }
        }
      },
      "memoryUsedMax": {
        "max": {
          "script": {
            "lang": "expression",
            "source": "1 - doc['system.memory.actual.free'] / doc['system.memory.total']"
          }
        }
      }
    }
  }

```

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [February 4, 2021, 1:55pm UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/4 "2021-02-04T13:55:58Z")

</div>

Also, I tend to forget that we also have the [apm-contrib](https://github.com/elastic/apm-contrib) repository where some [sample dashboards are available](https://github.com/elastic/apm-contrib/tree/master/apm-agent-java/dashboards).

While not being 100% identical to the ones you can see in the JVM tab, that should get you started faster than starting from scratch !

---

<div class="post-metadata">

**Author:** ![sqren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sqren/32/26110_2.png) [@sqren](https://discuss.elastic.co/u/sqren)\
**Post date:** [February 4, 2021, 4:03pm UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/5 "2021-02-04T16:03:54Z")

</div>

Good point. Thanks for adding that!

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [February 5, 2021, 6:58am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/6 "2021-02-05T06:58:49Z")

</div>

> [@sqren](#):
>
> `system.memory.actual.free`

Thanks Can you Also provide the algorithms used for garbage Collection, PS Marksweep and PSScavenge

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [February 5, 2021, 7:44am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/7 "2021-02-05T07:44:18Z")

</div>

The metrics `jvm.gc.count` and `jvm.gc.time` have a field `labels.name` that contains the GC algorithm name. See also [Metrics | APM Java Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/java/current/metrics.html#metrics-jvm).

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [February 5, 2021, 7:46am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/8 "2021-02-05T07:46:25Z")

</div>

But if I am creating my own dashboards , then I only have access to fields like jvm.gc.count . I wont be able to access the labels with it correct ?

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [February 5, 2021, 10:10am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/9 "2021-02-05T10:10:57Z")

</div>

You should be able to access `labels.name`. It's just a regular field. You might have to refresh your index pattern to see it though.

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [February 8, 2021, 7:19am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/10 "2021-02-08T07:19:19Z")

</div>

Thanks

So what about the graphs Garbage collection per minute and Garbage collection time spent per minute in APM screen .. How are the values calculated ? is it just displaying jvm.gc.time for an algorithm name? I wanted to recreate the graphs

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [February 9, 2021, 4:58am UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/11 "2021-02-09T04:58:55Z")

</div>

@sqren Could you pls assist on my above query . How are these graphs plotted ? I mean is there nay calculations or just raw data?

---

<div class="post-metadata">

**Author:** ![sqren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sqren/32/26110_2.png) [@sqren](https://discuss.elastic.co/u/sqren)\
**Post date:** [February 10, 2021, 4:34pm UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/12 "2021-02-10T16:34:37Z")

</div>

Sure, you can find the queries for the java calculations here:

> **[elastic/kibana](https://github.com/elastic/kibana/tree/d1653bc42583ba1ced34b59c7408f719713c08ab/x-pack/plugins/apm/server/lib/metrics/by_agent/java)**
>
> d1653bc42583ba1ced34b59c7408f719713c08ab/x-pack/plugins/apm/server/lib/metrics/by\_agent/java

For instance, for gc:

> <https://github.com/elastic/kibana/blob/d1653bc42583ba1ced34b59c7408f719713c08ab/x-pack/plugins/apm/server/lib/metrics/by_agent/java/gc/fetch_and_transform_gc_metrics.ts#L51-L102>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 3, 2021, 12:34pm UTC](https://discuss.elastic.co/t/jvm-system-memory-monitor-graphs/263082/13 "2021-03-03T12:34:59Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
