Skip to content

Commit

Permalink
fix(whmcs-status): handle null correctly in whmcs api response
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-benedetti committed Jan 31, 2025
1 parent 713f4df commit ccae81a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
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

0 comments on commit ccae81a

Please sign in to comment.