Skip to content

Commit

Permalink
statuspal: Add new parameters --insecure
Browse files Browse the repository at this point in the history
  • Loading branch information
markuslf committed Mar 14, 2024
1 parent 77a7769 commit 28fa47f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Monitoring Plugins:
* redfish-sel: Add new parameters `--insecure` `--no-proxy` `--timeout`
* redfish-sensor: Add new parameters `--insecure` `--no-proxy` `--timeout`
* sap-open-concur: Add new parameters `--insecure`
* statuspal: Add new parameters `--no-proxy` `--timeout`
* statuspal: Add new parameters `--insecure` `--no-proxy` `--timeout`
* swap-usage: Report the top 3 processes causing the usage (Linux only)
* xml: Add new parameter `--insecure`

Expand Down
8 changes: 5 additions & 3 deletions check-plugins/statuspal/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Help

.. code-block:: text
usage: statuspal [-h] [-V] [--always-ok] [--no-proxy] [--test TEST]
[--timeout TIMEOUT] [--url URL]
usage: statuspal [-h] [-V] [--always-ok] [--insecure] [--no-proxy]
[--test TEST] [--timeout TIMEOUT] [--url URL]
Statuspal is a status page provider from Germany. This check plugin gets the
summary of a Statuspal status page, checks its status, services, active
Expand All @@ -78,10 +78,12 @@ Help
-h, --help show this help message and exit
-V, --version show program's version number and exit
--always-ok Always returns OK.
--insecure This option explicitly allows to perform "insecure" SSL
connections. Default: False
--no-proxy Do not use a proxy. Default: False
--test TEST For unit tests. Needs "path-to-stdout-file,path-to-
stderr-file,expected-retc".
--timeout TIMEOUT Network timeout in seconds. Default: 7 (seconds)
--timeout TIMEOUT Network timeout in seconds. Default: 8 (seconds)
--url URL Statuspal API URL. Default: https://statuspal.eu/api/v2/s
tatus_pages/exoscalestatus/summary
Expand Down
60 changes: 48 additions & 12 deletions check-plugins/statuspal/icingaweb2-module-director/statuspal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"--always-ok": {
"set_if": "$statuspal_always_ok$"
},
"--insecure": {
"set_if": "$statuspal_insecure$"
},
"--no-proxy": {
"set_if": "$statuspal_no_proxy$"
},
Expand Down Expand Up @@ -37,6 +40,11 @@
"datafield_id": 4,
"is_required": "n",
"var_filter": null
},
{
"datafield_id": 5,
"is_required": "n",
"var_filter": null
}
],
"imports": [],
Expand All @@ -54,6 +62,9 @@
"--always-ok": {
"set_if": "$statuspal_windows_always_ok$"
},
"--insecure": {
"set_if": "$statuspal_windows_insecure$"
},
"--no-proxy": {
"set_if": "$statuspal_windows_no_proxy$"
},
Expand All @@ -68,22 +79,27 @@
"disabled": false,
"fields": [
{
"datafield_id": 5,
"datafield_id": 6,
"is_required": "n",
"var_filter": null
},
{
"datafield_id": 6,
"datafield_id": 7,
"is_required": "n",
"var_filter": null
},
{
"datafield_id": 7,
"datafield_id": 8,
"is_required": "n",
"var_filter": null
},
{
"datafield_id": 8,
"datafield_id": 9,
"is_required": "n",
"var_filter": null
},
{
"datafield_id": 10,
"is_required": "n",
"var_filter": null
}
Expand Down Expand Up @@ -158,8 +174,9 @@
"vars": {
"criticality": "A",
"statuspal_always_ok": false,
"statuspal_insecure": false,
"statuspal_no_proxy": false,
"statuspal_timeout": 7,
"statuspal_timeout": 8,
"statuspal_url": "https://statuspal.eu/api/v2/status_pages/exoscalestatus/summary"
},
"volatile": null,
Expand Down Expand Up @@ -207,8 +224,9 @@
"vars": {
"criticality": "C",
"statuspal_windows_always_ok": false,
"statuspal_windows_insecure": false,
"statuspal_windows_no_proxy": false,
"statuspal_windows_timeout": 7,
"statuspal_windows_timeout": 8,
"statuspal_windows_url": "https://statuspal.eu/api/v2/status_pages/exoscalestatus/summary"
},
"volatile": null,
Expand All @@ -227,6 +245,15 @@
"uuid": "828c1950-96e9-49c9-8ea4-f0ab08c03198"
},
"2": {
"varname": "statuspal_insecure",
"caption": "Statuspal: Insecure?",
"description": "This option explicitly allows to perform \"insecure\" SSL connections.",
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean",
"format": null,
"settings": {},
"uuid": "1a92202d-afb7-4d9a-be98-5ad7334004d4"
},
"3": {
"varname": "statuspal_no_proxy",
"caption": "Statuspal: No Proxy?",
"description": "Do not use a proxy.",
Expand All @@ -235,7 +262,7 @@
"settings": {},
"uuid": "a05b85c1-aea8-4723-adcd-50200c2a0229"
},
"3": {
"4": {
"varname": "statuspal_timeout",
"caption": "Statuspal: Timeout",
"description": "Network timeout in seconds.",
Expand All @@ -246,7 +273,7 @@
},
"uuid": "dfab5f87-db79-43f2-97b8-9cb0c5e4f3d5"
},
"4": {
"5": {
"varname": "statuspal_url",
"caption": "Statuspal: URL",
"description": "Statuspal API URL.",
Expand All @@ -257,7 +284,7 @@
},
"uuid": "610d0458-53e2-440a-89ab-93e8ab4a6893"
},
"5": {
"6": {
"varname": "statuspal_windows_always_ok",
"caption": "Statuspal: Always OK?",
"description": "Always returns OK.",
Expand All @@ -266,7 +293,16 @@
"settings": {},
"uuid": "f09dc8c1-d2c5-4000-b370-22f81f2131d4"
},
"6": {
"7": {
"varname": "statuspal_windows_insecure",
"caption": "Statuspal: Insecure?",
"description": "This option explicitly allows to perform \"insecure\" SSL connections.",
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean",
"format": null,
"settings": {},
"uuid": "08029e15-860b-4190-aaef-d84bae1eed44"
},
"8": {
"varname": "statuspal_windows_no_proxy",
"caption": "Statuspal: No Proxy?",
"description": "Do not use a proxy.",
Expand All @@ -275,7 +311,7 @@
"settings": {},
"uuid": "1a489d32-6e9f-4f14-a641-a126321c80ad"
},
"7": {
"9": {
"varname": "statuspal_windows_timeout",
"caption": "Statuspal: Timeout",
"description": "Network timeout in seconds.",
Expand All @@ -286,7 +322,7 @@
},
"uuid": "22652789-f185-475f-b877-f9bb0abc2ef9"
},
"8": {
"10": {
"varname": "statuspal_windows_url",
"caption": "Statuspal: URL",
"description": "Statuspal API URL.",
Expand Down
24 changes: 19 additions & 5 deletions check-plugins/statuspal/statuspal
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ from lib.globals import (STATE_CRIT, STATE_OK, # pylint: disable=C0413
STATE_UNKNOWN, STATE_WARN)

__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
__version__ = '2024031201'
__version__ = '2024031401'

DESCRIPTION = """Statuspal is a status page provider from Germany. This check plugin gets
the summary of a Statuspal status page, checks its status, services,
active incidents and lists maintenances. You need to provide the
URL to the Statuspal API `summary` endpoint."""

DEFAULT_INSECURE = False
DEFAULT_NO_PROXY = False
DEFAULT_TIMEOUT = 7
DEFAULT_TIMEOUT = 8
DEFAULT_URL = 'https://statuspal.eu/api/v2/status_pages/exoscalestatus/summary'


Expand All @@ -57,9 +58,19 @@ def parse_args():
default=False,
)

parser.add_argument(
'--insecure',
help='This option explicitly allows to perform "insecure" SSL connections. '
'Default: %(default)s',
dest='INSECURE',
action='store_true',
default=DEFAULT_INSECURE,
)

parser.add_argument(
'--no-proxy',
help='Do not use a proxy. Default: %(default)s',
help='Do not use a proxy. '
'Default: %(default)s',
dest='NO_PROXY',
action='store_true',
default=DEFAULT_NO_PROXY,
Expand All @@ -74,15 +85,17 @@ def parse_args():

parser.add_argument(
'--timeout',
help='Network timeout in seconds. Default: %(default)s (seconds)',
help='Network timeout in seconds. '
'Default: %(default)s (seconds)',
dest='TIMEOUT',
type=int,
default=DEFAULT_TIMEOUT,
)

parser.add_argument(
'--url',
help='Statuspal API URL. Default: %(default)s',
help='Statuspal API URL. '
'Default: %(default)s',
dest='URL',
default=DEFAULT_URL,
)
Expand Down Expand Up @@ -152,6 +165,7 @@ def main():
if args.TEST is None:
result = lib.base.coe(lib.url.fetch_json(
args.URL,
insecure=args.INSECURE,
no_proxy=args.NO_PROXY,
timeout=args.TIMEOUT,
))
Expand Down

0 comments on commit 28fa47f

Please sign in to comment.