From 583560e57f1d3a767f5f152a9deb10ce2a71bac4 Mon Sep 17 00:00:00 2001 From: Stefan Huehner Date: Fri, 14 Dec 2018 14:43:31 +0100 Subject: [PATCH] Fix reporting of 'Permanent Generation' / Metaspace. Fix regression in last commit. While it added auto-detection of changing column position it did not take into account the known change from Java 7 > 8. Java <8 had the Permanent Generation region which jstat columns PU, PC While Java >=8 now has a Metaspace region (for similar purpose) with jstat columns MU,MC. Add re-add detection for that change to fix reporting of the values. To simplify code uses the MU,MC labels internally and when MU,MC are not found in jstat output it fills those with PU,PC values. --- plugins/jvm/jstat__heap | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/jvm/jstat__heap b/plugins/jvm/jstat__heap index 8142273d..e89d434b 100755 --- a/plugins/jvm/jstat__heap +++ b/plugins/jvm/jstat__heap @@ -124,6 +124,11 @@ print_stats() { S1F = $idx["S1C"] - $idx["S1U"]; EF = $idx["EC"] - $idx["EU"]; OF = $idx["OC"] - $idx["OU"]; + # Java <8 has Permanent Generation (PU,PC columns), while >=8 has/names it Metaspace (MU,MC) + if (idx["MU"] == "") { + idx["MU"] = idx["PU"]; + idx["MC"] = idx["PC"]; + } MF = $idx["MC"] - $idx["MU"]; print "Eden_Used.value " $idx["EU"] * 1024; print "Eden_Free.value " EF * 1024;