diff --git a/CHANGELOG.md b/CHANGELOG.md index b1df7bf2b..bfa7dcc37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,7 @@ Monitoring Plugins: * 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)) +* whmcs-status: handle null correctly in whmcs api response ([#820](https://github.com/Linuxfabrik/monitoring-plugins/pull/820)) ## 2024060401 diff --git a/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE02 b/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE02 index 911320fbc..3aacfd54d 100644 --- a/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE02 +++ b/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE02 @@ -170,6 +170,8 @@ "severityLevel": "info", "body": "
Your PHP version 8.1.31 is supported by WHMCS.
Your PHP version does not receive regular updates but is the latest supported by WHMCS.
" } - ] + ], + "warning": null, + "danger": null } } diff --git a/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE03 b/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE03 index a5f8cb86d..08573fdb2 100644 --- a/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE03 +++ b/check-plugins/whmcs-status/unit-test/stdout/EXAMPLE03 @@ -164,6 +164,8 @@ "severityLevel": "notice", "body": "WHMCS is not running behind a CloudFlare proxy." } - ] + ], + "warning": null, + "danger": null } } diff --git a/check-plugins/whmcs-status/whmcs-status b/check-plugins/whmcs-status/whmcs-status index 297c78897..f3611297e 100755 --- a/check-plugins/whmcs-status/whmcs-status +++ b/check-plugins/whmcs-status/whmcs-status @@ -24,7 +24,7 @@ import lib.url # pylint: disable=C0413 from lib.globals import (STATE_OK, STATE_WARN, STATE_UNKNOWN) # pylint: disable=C0413 __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2025011901' +__version__ = '2025013101' DESCRIPTION = '''Returns the health status of a WHMCS server using its HTTP-based API.''' @@ -149,6 +149,8 @@ def get_failed_checks(checks): """ failed_checks = [] for _, items in checks.get('checks', {}).items(): + if items is None: + continue for item in items: if item.get('severityLevel') == 'notice': continue