From 002422dd9363c9a1b6915d7ff002dcaefecaec52 Mon Sep 17 00:00:00 2001 From: Koos85 Date: Tue, 26 Mar 2024 10:25:12 +0100 Subject: [PATCH] volume used and percentage metrics --- lib/check/volume.py | 7 +++++++ lib/version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/check/volume.py b/lib/check/volume.py index b1af1af..07a8080 100644 --- a/lib/check/volume.py +++ b/lib/check/volume.py @@ -13,4 +13,11 @@ async def check_volume( check_config: dict): state = await get_data(asset, asset_config, check_config, QUERIES) + for vol in state.get('volumeEntry', []): + free = vol['volumeFreeSpace'] + total = vol['volumeSize'] + vol['volumeUsedSpace'] = used = total - free + vol['volumeUsedPercentage'] = 100 * used / total if total else None + vol['volumeFreePercentage'] = 100 * free / total if total else None + return state diff --git a/lib/version.py b/lib/version.py index 14a5c96..cf3327f 100644 --- a/lib/version.py +++ b/lib/version.py @@ -1,4 +1,4 @@ # Version string. Examples: # '3.0.0' # '3.0.0-alpha9' -__version__ = '3.0.0-alpha2' +__version__ = '3.0.0-alpha3'