From cc3c7d16c532906c4027ec2b2f163888025c00d8 Mon Sep 17 00:00:00 2001 From: Markus Frei Date: Mon, 9 Dec 2024 18:04:37 +0100 Subject: [PATCH] fix(about-me): expanded RAM isn't updating (closes #757) --- CHANGELOG.md | 1 + check-plugins/about-me/about-me | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed359833..23e1fe14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,6 +85,7 @@ Icinga Director: Monitoring Plugins: +* about-me: expanded RAM isn't updating ([#757](https://github.com/Linuxfabrik/monitoring-plugins/issues/757)) * apache-httpd.status: failure when mod_md is enabled ([#783](https://github.com/Linuxfabrik/monitoring-plugins/issues/783)) * docker-stats: ValueError: could not convert string to float: '0B' ([#776](https://github.com/Linuxfabrik/monitoring-plugins/issues/776)) * redfish-sel: UnboundLocalError: local variable 'sel_path' referenced before assignment ([#779](https://github.com/Linuxfabrik/monitoring-plugins/issues/779)) diff --git a/check-plugins/about-me/about-me b/check-plugins/about-me/about-me index 500d0fc3..6a4449a1 100755 --- a/check-plugins/about-me/about-me +++ b/check-plugins/about-me/about-me @@ -41,7 +41,7 @@ except ImportError: __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2024112901' +__version__ = '2024120901' DESCRIPTION = 'Provides a quick overview of host dimensions and software.' @@ -798,7 +798,23 @@ def main(): dmi = lib.dmidecode.get_data() sys_dimensions = get_sys_dimensions() - if dmi: + if dmi and sys_dimensions: + # combine the best from both worlds + msg += '{} {}, '.format(lib.dmidecode.manufacturer(dmi), lib.dmidecode.model(dmi)) + msg += 'Firmware: {}, '.format(lib.dmidecode.firmware(dmi)) + msg += 'SerNo: {}, '.format(lib.dmidecode.serno(dmi)) + msg += 'Proc: {}, '.format(lib.dmidecode.cpu_type(dmi)) + msg += '#Cores: {}, '.format(lib.dmidecode.cpu_cores_enabled(dmi)) + msg += '#Threads: {}, '.format(lib.dmidecode.cpu_threads(dmi)) + msg += 'Current Speed: {} MHz, '.format(lib.dmidecode.cpu_speed(dmi)) + msg += '{}/{} RAM (virtmem/max'.format( + lib.human.bytes2human(sys_dimensions['ram']), + lib.human.bytes2human(lib.dmidecode.ram(dmi)), + ) + if sys_dimensions['ram'] > lib.dmidecode.ram(dmi): + msg += '; reboot recommended' + msg += '), ' + elif dmi: msg += '{} {}, '.format(lib.dmidecode.manufacturer(dmi), lib.dmidecode.model(dmi)) msg += 'Firmware: {}, '.format(lib.dmidecode.firmware(dmi)) msg += 'SerNo: {}, '.format(lib.dmidecode.serno(dmi)) @@ -814,7 +830,7 @@ def main(): lib.human.bytes2human(sys_dimensions['ram']) ) else: - msg += 'sys dimensions n/a (consider installing psutil), ' + msg += 'sys dimensions n/a (consider installing dmidecode/psutil), ' disk_msg, disk_count = get_disks() msg += disk_msg