From f21ed0dd8ef511da83adbe2a54dcd5aa503a2460 Mon Sep 17 00:00:00 2001 From: hias Date: Wed, 12 Jun 2024 16:53:15 +0200 Subject: [PATCH 1/2] fix of decimal places in plugin output --- checkvsphere/vcmd/perf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checkvsphere/vcmd/perf.py b/checkvsphere/vcmd/perf.py index 2a3ce83..3ccbad6 100644 --- a/checkvsphere/vcmd/perf.py +++ b/checkvsphere/vcmd/perf.py @@ -150,7 +150,7 @@ def run(): ) check.exit( code=check.check_threshold(val), - message=f'Counter {args.perfcounter} on {args.vimtype}:{args.vimname or props["name"]} reported {val} {counterInfo["unit"]}', + message=f'Counter {args.perfcounter} on {args.vimtype}:{args.vimname or props["name"]} reported {val:.2f} {counterInfo["unit"]}', ) else: for instance in values.value: @@ -167,7 +167,7 @@ def run(): ) check.add_message( check.threshold.get_status(val), - f"'{instance.id.instance} {args.perfcounter}' has value {val} {counterInfo['unit']}", + f"'{instance.id.instance} {args.perfcounter}' has value {val:.2f} {counterInfo['unit']}", ) (code, message) = check.check_messages(separator='\n ') From 10f8e7a38d0ee58a5373e0f7343cda3c20e61613 Mon Sep 17 00:00:00 2001 From: Danijel Tasov Date: Fri, 14 Jun 2024 11:55:04 +0200 Subject: [PATCH 2/2] limit value in text to 8 significant digits --- checkvsphere/vcmd/perf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checkvsphere/vcmd/perf.py b/checkvsphere/vcmd/perf.py index 3ccbad6..80439ce 100644 --- a/checkvsphere/vcmd/perf.py +++ b/checkvsphere/vcmd/perf.py @@ -150,7 +150,7 @@ def run(): ) check.exit( code=check.check_threshold(val), - message=f'Counter {args.perfcounter} on {args.vimtype}:{args.vimname or props["name"]} reported {val:.2f} {counterInfo["unit"]}', + message=f'Counter {args.perfcounter} on {args.vimtype}:{args.vimname or props["name"]} reported {val:.8g} {counterInfo["unit"]}', ) else: for instance in values.value: @@ -167,7 +167,7 @@ def run(): ) check.add_message( check.threshold.get_status(val), - f"'{instance.id.instance} {args.perfcounter}' has value {val:.2f} {counterInfo['unit']}", + f"'{instance.id.instance} {args.perfcounter}' has value {val:.8g} {counterInfo['unit']}", ) (code, message) = check.check_messages(separator='\n ')