Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(whmcs-status): handle null correctly in whmcs api response #820

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion check-plugins/whmcs-status/unit-test/stdout/EXAMPLE02
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
"severityLevel": "info",
"body": "<p>Your PHP version <strong>8.1.31</strong> is supported by WHMCS. </p><p>Your PHP version does not receive regular updates but is the latest supported by WHMCS.</p>"
}
]
],
"warning": null,
"danger": null
}
}
4 changes: 3 additions & 1 deletion check-plugins/whmcs-status/unit-test/stdout/EXAMPLE03
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
"severityLevel": "notice",
"body": "WHMCS is not running behind a CloudFlare proxy."
}
]
],
"warning": null,
"danger": null
}
}
4 changes: 3 additions & 1 deletion check-plugins/whmcs-status/whmcs-status
Original file line number Diff line number Diff line change
Expand Up @@ -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.'''
Expand Down Expand Up @@ -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
Expand Down