diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e8058af..dec2d38f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Monitoring Plugins: * grassfish-\*: Add new parameters `--insecure` `--no-proxy` `--timeout` * haproxy-status: Add new parameters `--insecure` `--no-proxy` * huawei-dorado-\*: Add new parameter `--insecure` +* infomaniak-\*: Add new parameters `--insecure` `--no-proxy` `--timeout` * infomaniak-swiss-backup-products: Improve output * journald-query: Remove hard-coded `--boot` parameter from query * logfile: Add new parameters `--insecure` `--no-proxy` `--timeout` diff --git a/check-plugins/infomaniak-events/README.rst b/check-plugins/infomaniak-events/README.rst index 8f4a6714..b60ef14e 100644 --- a/check-plugins/infomaniak-events/README.rst +++ b/check-plugins/infomaniak-events/README.rst @@ -44,8 +44,9 @@ Help .. code-block:: text - usage: infomaniak-events [-h] [-V] [--always-ok] [--service SERVICE] --token - TOKEN [--test TEST] + usage: infomaniak-events [-h] [-V] [--always-ok] [--insecure] [--no-proxy] + [--service SERVICE] [--timeout TIMEOUT] --token TOKEN + [--test TEST] Informs you about open events at Infomaniak. @@ -53,9 +54,13 @@ 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 --service SERVICE Only report this service category (repeating). Example: `--service=swiss_backup --service=public_cloud`. Default: none (so report all) + --timeout TIMEOUT Network timeout in seconds. Default: 8 (seconds) --token TOKEN Infomaniak API token --test TEST For unit tests. Needs "path-to-stdout-file,path-to- stderr-file,expected-retc". diff --git a/check-plugins/infomaniak-events/icingaweb2-module-director/infomaniak-events.json b/check-plugins/infomaniak-events/icingaweb2-module-director/infomaniak-events.json index 7a67ca28..c43f73a4 100644 --- a/check-plugins/infomaniak-events/icingaweb2-module-director/infomaniak-events.json +++ b/check-plugins/infomaniak-events/icingaweb2-module-director/infomaniak-events.json @@ -5,10 +5,19 @@ "--always-ok": { "set_if": "$infomaniak_events_always_ok$" }, + "--insecure": { + "set_if": "$infomaniak_events_insecure$" + }, + "--no-proxy": { + "set_if": "$infomaniak_events_no_proxy$" + }, "--service": { "value": "$infomaniak_events_service$", "repeat_key": true }, + "--timeout": { + "value": "$infomaniak_events_timeout$" + }, "--token": { "value": "$infomaniak_events_token$" } @@ -28,6 +37,21 @@ }, { "datafield_id": 3, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 4, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 5, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 6, "is_required": "y", "var_filter": null } @@ -47,10 +71,19 @@ "--always-ok": { "set_if": "$infomaniak_events_windows_always_ok$" }, + "--insecure": { + "set_if": "$infomaniak_events_windows_insecure$" + }, + "--no-proxy": { + "set_if": "$infomaniak_events_windows_no_proxy$" + }, "--service": { "value": "$infomaniak_events_windows_service$", "repeat_key": true }, + "--timeout": { + "value": "$infomaniak_events_windows_timeout$" + }, "--token": { "value": "$infomaniak_events_windows_token$" } @@ -59,17 +92,32 @@ "disabled": false, "fields": [ { - "datafield_id": 4, + "datafield_id": 7, "is_required": "n", "var_filter": null }, { - "datafield_id": 5, + "datafield_id": 8, "is_required": "n", "var_filter": null }, { - "datafield_id": 6, + "datafield_id": 9, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 10, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 11, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 12, "is_required": "y", "var_filter": null } @@ -143,7 +191,10 @@ "use_var_overrides": null, "vars": { "criticality": "A", - "infomaniak_events_always_ok": false + "infomaniak_events_always_ok": false, + "infomaniak_events_insecure": false, + "infomaniak_events_no_proxy": false, + "infomaniak_events_timeout": 8 }, "volatile": null, "zone": null, @@ -189,7 +240,10 @@ "use_var_overrides": null, "vars": { "criticality": "C", - "infomaniak_events_windows_always_ok": false + "infomaniak_events_windows_always_ok": false, + "infomaniak_events_windows_insecure": false, + "infomaniak_events_windows_no_proxy": false, + "infomaniak_events_windows_timeout": 8 }, "volatile": null, "zone": null, @@ -207,6 +261,24 @@ "uuid": "4e98a980-eff7-4d71-9afb-71817f460e82" }, "2": { + "varname": "infomaniak_events_insecure", + "caption": "Infomaniak Events: Insecure?", + "description": "This option explicitly allows to perform \"insecure\" SSL connections.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "9b7d00e9-065b-460e-9c73-94f63e501977" + }, + "3": { + "varname": "infomaniak_events_no_proxy", + "caption": "Infomaniak Events: No Proxy?", + "description": "Do not use a proxy.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "a8038cc2-3cd7-42a3-8457-f8288307f0f2" + }, + "4": { "varname": "infomaniak_events_service", "caption": "Infomaniak Events: Service", "description": "Only report this service category (repeating). Example: `--service=swiss_backup --service=public_cloud`. Default: none (so report all)", @@ -217,7 +289,18 @@ }, "uuid": "9a649d44-1c9c-43d1-9c5f-e0b5eb15da9e" }, - "3": { + "5": { + "varname": "infomaniak_events_timeout", + "caption": "Infomaniak Events: Timeout", + "description": "Network timeout in seconds.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString", + "format": null, + "settings": { + "visibility": "visible" + }, + "uuid": "a363e2d8-d2f9-4cdf-9d05-9e58c6ffb20c" + }, + "6": { "varname": "infomaniak_events_token", "caption": "Infomaniak Events: Token", "description": "Infomaniak API token", @@ -228,7 +311,7 @@ }, "uuid": "8e095449-0ffc-427e-9353-49ea5fab4fde" }, - "4": { + "7": { "varname": "infomaniak_events_windows_always_ok", "caption": "Infomaniak Events: Always OK?", "description": "Always returns OK.", @@ -237,7 +320,25 @@ "settings": {}, "uuid": "4eb625e5-7da0-4d67-81cf-bf7718d50022" }, - "5": { + "8": { + "varname": "infomaniak_events_windows_insecure", + "caption": "Infomaniak Events: Insecure?", + "description": "This option explicitly allows to perform \"insecure\" SSL connections.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "dc34616a-8434-4f39-936b-a0a43464e422" + }, + "9": { + "varname": "infomaniak_events_windows_no_proxy", + "caption": "Infomaniak Events: No Proxy?", + "description": "Do not use a proxy.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "77b6badb-9505-4166-af71-c9c21f71bbd8" + }, + "10": { "varname": "infomaniak_events_windows_service", "caption": "Infomaniak Events: Service", "description": "Only report this service category (repeating). Example: `--service=swiss_backup --service=public_cloud`. Default: none (so report all)", @@ -248,7 +349,18 @@ }, "uuid": "a1cbcead-df18-46aa-ad90-16ad5c389b08" }, - "6": { + "11": { + "varname": "infomaniak_events_windows_timeout", + "caption": "Infomaniak Events: Timeout", + "description": "Network timeout in seconds.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString", + "format": null, + "settings": { + "visibility": "visible" + }, + "uuid": "dac8584d-ef4a-42e1-bbb9-f00ca7ee260a" + }, + "12": { "varname": "infomaniak_events_windows_token", "caption": "Infomaniak Events: Token", "description": "Infomaniak API token", diff --git a/check-plugins/infomaniak-events/infomaniak-events b/check-plugins/infomaniak-events/infomaniak-events index c2e189fd..640fb3e0 100755 --- a/check-plugins/infomaniak-events/infomaniak-events +++ b/check-plugins/infomaniak-events/infomaniak-events @@ -26,10 +26,14 @@ from lib.globals import (STATE_OK, STATE_UNKNOWN, # pylint: disable=C0413 STATE_WARN) __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2023120601' +__version__ = '2024031401' DESCRIPTION = """Informs you about open events at Infomaniak.""" +DEFAULT_INSECURE = False +DEFAULT_NO_PROXY = False +DEFAULT_TIMEOUT = 8 + def parse_args(): """Parse command line arguments using argparse. @@ -50,6 +54,24 @@ 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', + dest='NO_PROXY', + action='store_true', + default=DEFAULT_NO_PROXY, + ) + parser.add_argument( '--service', help='Only report this service category (repeating). ' @@ -60,6 +82,15 @@ def parse_args(): default=None, ) + parser.add_argument( + '--timeout', + help='Network timeout in seconds. ' + 'Default: %(default)s (seconds)', + dest='TIMEOUT', + type=int, + default=DEFAULT_TIMEOUT, + ) + parser.add_argument( '--token', help='Infomaniak API token', @@ -89,7 +120,12 @@ def main(): # fetch data if args.TEST is None: - result = lib.base.coe(lib.infomaniak.get_events(args.TOKEN)) + result = lib.base.coe(lib.infomaniak.get_events( + args.TOKEN, + insecure=args.INSECURE, + no_proxy=args.NO_PROXY, + timeout=args.TIMEOUT, + )) else: # do not call the command, put in test data stdout, stderr, retc = lib.test.test(args.TEST) diff --git a/check-plugins/infomaniak-swiss-backup-devices/README.rst b/check-plugins/infomaniak-swiss-backup-devices/README.rst index 4a523815..0518747f 100644 --- a/check-plugins/infomaniak-swiss-backup-devices/README.rst +++ b/check-plugins/infomaniak-swiss-backup-devices/README.rst @@ -38,8 +38,9 @@ Help .. code-block:: text usage: infomaniak-swiss-backup-devices [-h] [-V] --account-id ACCOUNT_ID - [--always-ok] [-c CRIT] - [--severity {warn,crit}] --token TOKEN + [--always-ok] [-c CRIT] [--insecure] + [--no-proxy] [--severity {warn,crit}] + [--timeout TIMEOUT] --token TOKEN [--test TEST] [-w WARN] Checks each device / slot of all your Infomaniak Swiss backup products via the @@ -53,8 +54,12 @@ Help --always-ok Always returns OK. -c CRIT, --critical CRIT Set the CRIT threshold as a percentage. Default: >= 95 + --insecure This option explicitly allows to perform "insecure" + SSL connections. Default: False + --no-proxy Do not use a proxy. Default: False --severity {warn,crit} Severity for alerting other values. Default: warn + --timeout TIMEOUT Network timeout in seconds. Default: 8 (seconds) --token TOKEN Infomaniak API token --test TEST For unit tests. Needs "path-to-stdout-file,path-to- stderr-file,expected-retc". diff --git a/check-plugins/infomaniak-swiss-backup-devices/icingaweb2-module-director/infomaniak-swiss-backup-devices.json b/check-plugins/infomaniak-swiss-backup-devices/icingaweb2-module-director/infomaniak-swiss-backup-devices.json index cfa90832..b0eec167 100644 --- a/check-plugins/infomaniak-swiss-backup-devices/icingaweb2-module-director/infomaniak-swiss-backup-devices.json +++ b/check-plugins/infomaniak-swiss-backup-devices/icingaweb2-module-director/infomaniak-swiss-backup-devices.json @@ -11,9 +11,18 @@ "--critical": { "value": "$infomaniak_swiss_backup_devices_critical$" }, + "--insecure": { + "set_if": "$infomaniak_swiss_backup_devices_insecure$" + }, + "--no-proxy": { + "set_if": "$infomaniak_swiss_backup_devices_no_proxy$" + }, "--severity": { "value": "$infomaniak_swiss_backup_devices_severity$" }, + "--timeout": { + "value": "$infomaniak_swiss_backup_devices_timeout$" + }, "--token": { "value": "$infomaniak_swiss_backup_devices_token$" }, @@ -25,32 +34,47 @@ "disabled": false, "fields": [ { - "datafield_id": 338, + "datafield_id": 1, "is_required": "y", "var_filter": null }, { - "datafield_id": 339, + "datafield_id": 2, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 3, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 4, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 5, "is_required": "n", "var_filter": null }, { - "datafield_id": 340, + "datafield_id": 6, "is_required": "n", "var_filter": null }, { - "datafield_id": 341, + "datafield_id": 7, "is_required": "n", "var_filter": null }, { - "datafield_id": 342, + "datafield_id": 8, "is_required": "y", "var_filter": null }, { - "datafield_id": 343, + "datafield_id": 9, "is_required": "n", "var_filter": null } @@ -76,9 +100,18 @@ "--critical": { "value": "$infomaniak_swiss_backup_devices_windows_critical$" }, + "--insecure": { + "set_if": "$infomaniak_swiss_backup_devices_windows_insecure$" + }, + "--no-proxy": { + "set_if": "$infomaniak_swiss_backup_devices_windows_no_proxy$" + }, "--severity": { "value": "$infomaniak_swiss_backup_devices_windows_severity$" }, + "--timeout": { + "value": "$infomaniak_swiss_backup_devices_windows_timeout$" + }, "--token": { "value": "$infomaniak_swiss_backup_devices_windows_token$" }, @@ -90,32 +123,47 @@ "disabled": false, "fields": [ { - "datafield_id": 344, + "datafield_id": 10, "is_required": "y", "var_filter": null }, { - "datafield_id": 345, + "datafield_id": 11, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 12, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 13, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 14, "is_required": "n", "var_filter": null }, { - "datafield_id": 346, + "datafield_id": 15, "is_required": "n", "var_filter": null }, { - "datafield_id": 347, + "datafield_id": 16, "is_required": "n", "var_filter": null }, { - "datafield_id": 348, + "datafield_id": 17, "is_required": "y", "var_filter": null }, { - "datafield_id": 349, + "datafield_id": 18, "is_required": "n", "var_filter": null } @@ -191,7 +239,10 @@ "criticality": "C", "infomaniak_swiss_backup_devices_always_ok": false, "infomaniak_swiss_backup_devices_critical": 95, + "infomaniak_swiss_backup_devices_insecure": false, + "infomaniak_swiss_backup_devices_no_proxy": false, "infomaniak_swiss_backup_devices_severity": "warn", + "infomaniak_swiss_backup_devices_timeout": 8, "infomaniak_swiss_backup_devices_warning": 90 }, "volatile": null, @@ -240,7 +291,10 @@ "criticality": "C", "infomaniak_swiss_backup_devices_windows_always_ok": false, "infomaniak_swiss_backup_devices_windows_critical": 95, + "infomaniak_swiss_backup_devices_windows_insecure": false, + "infomaniak_swiss_backup_devices_windows_no_proxy": false, "infomaniak_swiss_backup_devices_windows_severity": "warn", + "infomaniak_swiss_backup_devices_windows_timeout": 8, "infomaniak_swiss_backup_devices_windows_warning": 90 }, "volatile": null, @@ -289,7 +343,7 @@ } }, "Datafield": { - "338": { + "1": { "varname": "infomaniak_swiss_backup_devices_account_id", "caption": "Infomaniak Swiss Backup Devices: Account ID", "description": "Infomaniak Account-ID", @@ -300,7 +354,7 @@ }, "uuid": "7c47c566-299b-474f-a7c7-45171b88ed8c" }, - "339": { + "2": { "varname": "infomaniak_swiss_backup_devices_always_ok", "caption": "Infomaniak Swiss Backup Devices: Always OK?", "description": "Always returns OK.", @@ -309,7 +363,7 @@ "settings": {}, "uuid": "0d379548-911f-495b-8745-442852aa4c6b" }, - "340": { + "3": { "varname": "infomaniak_swiss_backup_devices_critical", "caption": "Infomaniak Swiss Backup Devices: Critical", "description": "Set the CRIT threshold as a percentage.", @@ -320,7 +374,25 @@ }, "uuid": "fbf2e094-69b6-4980-a44b-7d51bb25aaa2" }, - "341": { + "4": { + "varname": "infomaniak_swiss_backup_devices_insecure", + "caption": "Infomaniak Swiss Backup Devices: Insecure?", + "description": "This option explicitly allows to perform \"insecure\" SSL connections.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "09c71db3-5fab-4416-8409-4f9a4a7579c9" + }, + "5": { + "varname": "infomaniak_swiss_backup_devices_no_proxy", + "caption": "Infomaniak Swiss Backup Devices: No Proxy?", + "description": "Do not use a proxy.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "ab403a98-e0cb-43c8-b795-9fb05f2d72d8" + }, + "6": { "varname": "infomaniak_swiss_backup_devices_severity", "caption": "Infomaniak Swiss Backup Devices: Severity", "description": "Severity for alerting other values.", @@ -333,7 +405,18 @@ }, "uuid": "530ab425-b4f7-4168-9ae0-ed6d49f9762a" }, - "342": { + "7": { + "varname": "infomaniak_swiss_backup_devices_timeout", + "caption": "Infomaniak Swiss Backup Devices: Timeout", + "description": "Network timeout in seconds.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString", + "format": null, + "settings": { + "visibility": "visible" + }, + "uuid": "e42f3e1f-e915-4f96-956e-768745629b32" + }, + "8": { "varname": "infomaniak_swiss_backup_devices_token", "caption": "Infomaniak Swiss Backup Devices: Token", "description": "Infomaniak API token", @@ -344,7 +427,7 @@ }, "uuid": "af1fbc6f-68ec-4c76-856e-fdf7853208af" }, - "343": { + "9": { "varname": "infomaniak_swiss_backup_devices_warning", "caption": "Infomaniak Swiss Backup Devices: Warning", "description": "Set the WARN threshold as a percentage.", @@ -355,7 +438,7 @@ }, "uuid": "bbdaf8de-585c-49c5-8ede-52806fbfb641" }, - "344": { + "10": { "varname": "infomaniak_swiss_backup_devices_windows_account_id", "caption": "Infomaniak Swiss Backup Devices: Account ID", "description": "Infomaniak Account-ID", @@ -366,7 +449,7 @@ }, "uuid": "32219f9c-f7cb-4c26-b95f-ec4a97f6fa64" }, - "345": { + "11": { "varname": "infomaniak_swiss_backup_devices_windows_always_ok", "caption": "Infomaniak Swiss Backup Devices: Always OK?", "description": "Always returns OK.", @@ -375,7 +458,7 @@ "settings": {}, "uuid": "f7c5b027-e1c2-46f5-8dcf-cb8483d6b2f0" }, - "346": { + "12": { "varname": "infomaniak_swiss_backup_devices_windows_critical", "caption": "Infomaniak Swiss Backup Devices: Critical", "description": "Set the CRIT threshold as a percentage.", @@ -386,7 +469,25 @@ }, "uuid": "e292d490-3432-4362-9898-5604f8954b59" }, - "347": { + "13": { + "varname": "infomaniak_swiss_backup_devices_windows_insecure", + "caption": "Infomaniak Swiss Backup Devices: Insecure?", + "description": "This option explicitly allows to perform \"insecure\" SSL connections.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "74b1e139-996a-40e1-b6dd-6c77aefc3e23" + }, + "14": { + "varname": "infomaniak_swiss_backup_devices_windows_no_proxy", + "caption": "Infomaniak Swiss Backup Devices: No Proxy?", + "description": "Do not use a proxy.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "57935d95-86ec-4b85-b716-8bddbdc4b419" + }, + "15": { "varname": "infomaniak_swiss_backup_devices_windows_severity", "caption": "Infomaniak Swiss Backup Devices: Severity", "description": "Severity for alerting other values.", @@ -399,7 +500,18 @@ }, "uuid": "7a7e9cc9-867f-4429-b005-10337cb038c5" }, - "348": { + "16": { + "varname": "infomaniak_swiss_backup_devices_windows_timeout", + "caption": "Infomaniak Swiss Backup Devices: Timeout", + "description": "Network timeout in seconds.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString", + "format": null, + "settings": { + "visibility": "visible" + }, + "uuid": "93bb40de-a4c0-4455-a7e3-273752fd7e00" + }, + "17": { "varname": "infomaniak_swiss_backup_devices_windows_token", "caption": "Infomaniak Swiss Backup Devices: Token", "description": "Infomaniak API token", @@ -410,7 +522,7 @@ }, "uuid": "196d617c-de82-4d21-8b01-f5330dcaa5da" }, - "349": { + "18": { "varname": "infomaniak_swiss_backup_devices_windows_warning", "caption": "Infomaniak Swiss Backup Devices: Warning", "description": "Set the WARN threshold as a percentage.", diff --git a/check-plugins/infomaniak-swiss-backup-devices/infomaniak-swiss-backup-devices b/check-plugins/infomaniak-swiss-backup-devices/infomaniak-swiss-backup-devices index 6c19cea7..dadeba48 100755 --- a/check-plugins/infomaniak-swiss-backup-devices/infomaniak-swiss-backup-devices +++ b/check-plugins/infomaniak-swiss-backup-devices/infomaniak-swiss-backup-devices @@ -26,13 +26,16 @@ from lib.globals import (STATE_CRIT, STATE_OK, # pylint: disable=C0413 STATE_UNKNOWN, STATE_WARN) __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2023112901' +__version__ = '2024031401' DESCRIPTION = """Checks each device / slot of all your Infomaniak Swiss backup products via the Infomaniak API.""" DEFAULT_CRIT = 95 +DEFAULT_INSECURE = False +DEFAULT_NO_PROXY = False DEFAULT_SEVERITY = 'warn' +DEFAULT_TIMEOUT = 8 DEFAULT_WARN = 90 @@ -64,20 +67,49 @@ def parse_args(): parser.add_argument( '-c', '--critical', - help='Set the CRIT threshold as a percentage. Default: >= %(default)s', + help='Set the CRIT threshold as a percentage. ' + 'Default: >= %(default)s', dest='CRIT', type=int, default=DEFAULT_CRIT, ) + 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', + dest='NO_PROXY', + action='store_true', + default=DEFAULT_NO_PROXY, + ) + parser.add_argument( '--severity', - help='Severity for alerting other values. Default: %(default)s', + help='Severity for alerting other values. ' + 'Default: %(default)s', dest='SEVERITY', default=DEFAULT_SEVERITY, choices=['warn', 'crit'], ) + parser.add_argument( + '--timeout', + help='Network timeout in seconds. ' + 'Default: %(default)s (seconds)', + dest='TIMEOUT', + type=int, + default=DEFAULT_TIMEOUT, + ) + parser.add_argument( '--token', help='Infomaniak API token', @@ -94,7 +126,8 @@ def parse_args(): parser.add_argument( '-w', '--warning', - help='Set the WARN threshold as a percentage. Default: >= %(default)s', + help='Set the WARN threshold as a percentage. ' + 'Default: >= %(default)s', dest='WARN', type=int, default=DEFAULT_WARN, @@ -115,7 +148,13 @@ def main(): # fetch list of products if args.TEST is None: - slots = lib.base.coe(lib.infomaniak.get_swiss_backup_slots(args.ACCOUNT_ID, args.TOKEN)) + slots = lib.base.coe(lib.infomaniak.get_swiss_backup_slots( + args.ACCOUNT_ID, + args.TOKEN, + insecure=args.INSECURE, + no_proxy=args.NO_PROXY, + timeout=args.TIMEOUT, + )) else: # do not call the command, put in test data stdout, stderr, retc = lib.test.test(args.TEST) diff --git a/check-plugins/infomaniak-swiss-backup-devices/unit-test/run b/check-plugins/infomaniak-swiss-backup-devices/unit-test/run index 3fb804fa..8be251cf 100755 --- a/check-plugins/infomaniak-swiss-backup-devices/unit-test/run +++ b/check-plugins/infomaniak-swiss-backup-devices/unit-test/run @@ -31,18 +31,18 @@ class TestCheck(unittest.TestCase): def test_if_check_runs_EXAMPLE01(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --test=stdout/EXAMPLE01,,0')) self.assertIn('There are warnings.', stdout) - self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Used % ! Used', stdout) - self.assertIn('------+--------------+-------+--------------+--------+-------+-----------------+---------------------', stdout) - self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! 50.5% ! 4.6TiB / 9.1TiB', stdout) + self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Locked ! ', stdout) + self.assertIn('------+--------------+-------+--------------+--------+-------+--------+-', stdout) + self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! False ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_WARN) def test_if_check_runs_EXAMPLE02(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --test=stdout/EXAMPLE02,,0')) self.assertIn('Everything is ok.', stdout) - self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Used % ! Used', stdout) - self.assertIn('------+--------------+-------+--------------+--------+-------+--------+---------------------', stdout) - self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! 50.5% ! 4.6TiB / 9.1TiB', stdout) + self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Locked ! ', stdout) + self.assertIn('------+--------------+-------+--------------+--------+-------+--------+-', stdout) + self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! False ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_OK) @@ -55,18 +55,18 @@ class TestCheck(unittest.TestCase): def test_if_check_runs_EXAMPLE04_severity_warn(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --severity=warn --test=stdout/EXAMPLE04,,0')) self.assertIn('There are warnings.', stdout) - self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Used % ! Used', stdout) - self.assertIn('------+--------------+-------+--------------+--------+-------+--------+---------------------', stdout) - self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! 50.5% ! 4.6TiB / 9.1TiB', stdout) + self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Locked ! ', stdout) + self.assertIn('------+--------------+-------+--------------+--------+-------+----------------+-', stdout) + self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! True [WARNING] ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_WARN) def test_if_check_runs_EXAMPLE04_severity_crit(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --severity=crit --test=stdout/EXAMPLE04,,0')) self.assertIn('There are critical errors.', stdout) - self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Used % ! Used', stdout) - self.assertIn('------+--------------+-------+--------------+--------+-------+--------+---------------------', stdout) - self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! 50.5% ! 4.6TiB / 9.1TiB', stdout) + self.assertIn('ID ! Customer ! Tag ! User ! Name ! Type ! Locked ! ', stdout) + self.assertIn('------+--------------+-------+--------------+--------+-------+-----------------+-', stdout) + self.assertIn('99904 ! BK-200999-1 ! tag01 ! SBI-AB123456 ! bucket ! swift ! True [CRITICAL] ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_CRIT) diff --git a/check-plugins/infomaniak-swiss-backup-products/README.rst b/check-plugins/infomaniak-swiss-backup-products/README.rst index ef03fe1d..144237c1 100644 --- a/check-plugins/infomaniak-swiss-backup-products/README.rst +++ b/check-plugins/infomaniak-swiss-backup-products/README.rst @@ -37,9 +37,10 @@ Help .. code-block:: text usage: infomaniak-swiss-backup-products [-h] [-V] --account-id ACCOUNT_ID - [--always-ok] [-c CRIT] - [--severity {warn,crit}] --token - TOKEN [--test TEST] [-w WARN] + [--always-ok] [-c CRIT] [--insecure] + [--no-proxy] [--severity {warn,crit}] + [--timeout TIMEOUT] --token TOKEN + [--test TEST] [-w WARN] Checks your Infomaniak Swiss Backup product details via the Infomaniak API. @@ -51,15 +52,19 @@ Help --always-ok Always returns OK. -c CRIT, --critical CRIT Set the critical for the expiration date in days. - Default: 5 + Default: 3 + --insecure This option explicitly allows to perform "insecure" + SSL connections. Default: False + --no-proxy Do not use a proxy. Default: False --severity {warn,crit} Severity for alerting other values. Default: warn + --timeout TIMEOUT Network timeout in seconds. Default: 8 (seconds) --token TOKEN Infomaniak API token --test TEST For unit tests. Needs "path-to-stdout-file,path-to- stderr-file,expected-retc". -w WARN, --warning WARN Set the warning for the expiration date in days. - Default: 14 + Default: 5 Usage Examples diff --git a/check-plugins/infomaniak-swiss-backup-products/icingaweb2-module-director/infomaniak-swiss-backup-products.json b/check-plugins/infomaniak-swiss-backup-products/icingaweb2-module-director/infomaniak-swiss-backup-products.json index 6041819a..1978e05e 100644 --- a/check-plugins/infomaniak-swiss-backup-products/icingaweb2-module-director/infomaniak-swiss-backup-products.json +++ b/check-plugins/infomaniak-swiss-backup-products/icingaweb2-module-director/infomaniak-swiss-backup-products.json @@ -11,9 +11,18 @@ "--critical": { "value": "$infomaniak_swiss_backup_products_critical$" }, + "--insecure": { + "set_if": "$infomaniak_swiss_backup_products_insecure$" + }, + "--no-proxy": { + "set_if": "$infomaniak_swiss_backup_products_no_proxy$" + }, "--severity": { "value": "$infomaniak_swiss_backup_products_severity$" }, + "--timeout": { + "value": "$infomaniak_swiss_backup_products_timeout$" + }, "--token": { "value": "$infomaniak_swiss_backup_products_token$" }, @@ -25,32 +34,47 @@ "disabled": false, "fields": [ { - "datafield_id": 142, + "datafield_id": 1, "is_required": "y", "var_filter": null }, { - "datafield_id": 143, + "datafield_id": 2, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 3, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 4, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 5, "is_required": "n", "var_filter": null }, { - "datafield_id": 144, + "datafield_id": 6, "is_required": "n", "var_filter": null }, { - "datafield_id": 145, + "datafield_id": 7, "is_required": "n", "var_filter": null }, { - "datafield_id": 146, + "datafield_id": 8, "is_required": "y", "var_filter": null }, { - "datafield_id": 147, + "datafield_id": 9, "is_required": "n", "var_filter": null } @@ -76,9 +100,18 @@ "--critical": { "value": "$infomaniak_swiss_backup_products_windows_critical$" }, + "--insecure": { + "set_if": "$infomaniak_swiss_backup_products_windows_insecure$" + }, + "--no-proxy": { + "set_if": "$infomaniak_swiss_backup_products_windows_no_proxy$" + }, "--severity": { "value": "$infomaniak_swiss_backup_products_windows_severity$" }, + "--timeout": { + "value": "$infomaniak_swiss_backup_products_windows_timeout$" + }, "--token": { "value": "$infomaniak_swiss_backup_products_windows_token$" }, @@ -90,32 +123,47 @@ "disabled": false, "fields": [ { - "datafield_id": 148, + "datafield_id": 10, "is_required": "y", "var_filter": null }, { - "datafield_id": 149, + "datafield_id": 11, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 12, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 13, + "is_required": "n", + "var_filter": null + }, + { + "datafield_id": 14, "is_required": "n", "var_filter": null }, { - "datafield_id": 150, + "datafield_id": 15, "is_required": "n", "var_filter": null }, { - "datafield_id": 151, + "datafield_id": 16, "is_required": "n", "var_filter": null }, { - "datafield_id": 152, + "datafield_id": 17, "is_required": "y", "var_filter": null }, { - "datafield_id": 153, + "datafield_id": 18, "is_required": "n", "var_filter": null } @@ -191,7 +239,10 @@ "criticality": "C", "infomaniak_swiss_backup_products_always_ok": false, "infomaniak_swiss_backup_products_critical": 3, + "infomaniak_swiss_backup_products_insecure": false, + "infomaniak_swiss_backup_products_no_proxy": false, "infomaniak_swiss_backup_products_severity": "warn", + "infomaniak_swiss_backup_products_timeout": 8, "infomaniak_swiss_backup_products_warning": 5 }, "volatile": null, @@ -240,7 +291,10 @@ "criticality": "C", "infomaniak_swiss_backup_products_windows_always_ok": false, "infomaniak_swiss_backup_products_windows_critical": 3, + "infomaniak_swiss_backup_products_windows_insecure": false, + "infomaniak_swiss_backup_products_windows_no_proxy": false, "infomaniak_swiss_backup_products_windows_severity": "warn", + "infomaniak_swiss_backup_products_windows_timeout": 8, "infomaniak_swiss_backup_products_windows_warning": 5 }, "volatile": null, @@ -289,7 +343,7 @@ } }, "Datafield": { - "142": { + "1": { "varname": "infomaniak_swiss_backup_products_account_id", "caption": "Infomaniak Swiss Backup Products: Account ID", "description": "Infomaniak Account-ID", @@ -300,7 +354,7 @@ }, "uuid": "49949544-50f6-4b37-9ae0-8c28fe6f6f47" }, - "143": { + "2": { "varname": "infomaniak_swiss_backup_products_always_ok", "caption": "Infomaniak Swiss Backup Products: Always OK?", "description": "Always returns OK.", @@ -309,7 +363,7 @@ "settings": {}, "uuid": "2eb557cd-98bc-4020-9122-149fed4c8335" }, - "144": { + "3": { "varname": "infomaniak_swiss_backup_products_critical", "caption": "Infomaniak Swiss Backup Products: Critical", "description": "Set the critical for the expiration date in days.", @@ -320,7 +374,25 @@ }, "uuid": "76a05455-b038-42f7-bce5-e5481d2bf5de" }, - "145": { + "4": { + "varname": "infomaniak_swiss_backup_products_insecure", + "caption": "Infomaniak Swiss Backup Products: Insecure?", + "description": "This option explicitly allows to perform \"insecure\" SSL connections.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "48300e2a-b48e-4bd0-8798-bff2644d501d" + }, + "5": { + "varname": "infomaniak_swiss_backup_products_no_proxy", + "caption": "Infomaniak Swiss Backup Products: No Proxy?", + "description": "Do not use a proxy.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "c71a3e44-fa1d-4cce-a766-50860ed9d5a1" + }, + "6": { "varname": "infomaniak_swiss_backup_products_severity", "caption": "Infomaniak Swiss Backup Products: Severity", "description": "Severity for alerting other values.", @@ -333,7 +405,18 @@ }, "uuid": "3b29820b-fb09-4755-9f87-6b15484c1337" }, - "146": { + "7": { + "varname": "infomaniak_swiss_backup_products_timeout", + "caption": "Infomaniak Swiss Backup Products: Timeout", + "description": "Network timeout in seconds.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString", + "format": null, + "settings": { + "visibility": "visible" + }, + "uuid": "68ca2a79-ca12-4b2c-a326-ba22479a4a50" + }, + "8": { "varname": "infomaniak_swiss_backup_products_token", "caption": "Infomaniak Swiss Backup Products: Token", "description": "Infomaniak API token", @@ -344,7 +427,7 @@ }, "uuid": "012e5339-a577-468a-9182-423b1005cee1" }, - "147": { + "9": { "varname": "infomaniak_swiss_backup_products_warning", "caption": "Infomaniak Swiss Backup Products: Warning", "description": "Set the warning for the expiration date in days.", @@ -355,7 +438,7 @@ }, "uuid": "fcfbd97f-b3b3-4d6c-aa2c-fea9ebe69669" }, - "148": { + "10": { "varname": "infomaniak_swiss_backup_products_windows_account_id", "caption": "Infomaniak Swiss Backup Products: Account ID", "description": "Infomaniak Account-ID", @@ -366,7 +449,7 @@ }, "uuid": "098d8b07-00aa-48fb-8fac-3a3aa21e949f" }, - "149": { + "11": { "varname": "infomaniak_swiss_backup_products_windows_always_ok", "caption": "Infomaniak Swiss Backup Products: Always OK?", "description": "Always returns OK.", @@ -375,7 +458,7 @@ "settings": {}, "uuid": "fc0f486d-fe2f-4f86-ba09-6fa652dff131" }, - "150": { + "12": { "varname": "infomaniak_swiss_backup_products_windows_critical", "caption": "Infomaniak Swiss Backup Products: Critical", "description": "Set the critical for the expiration date in days.", @@ -386,7 +469,25 @@ }, "uuid": "b876066c-2e57-4586-9f78-3ba436706f6c" }, - "151": { + "13": { + "varname": "infomaniak_swiss_backup_products_windows_insecure", + "caption": "Infomaniak Swiss Backup Products: Insecure?", + "description": "This option explicitly allows to perform \"insecure\" SSL connections.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "dd1eff49-575b-4666-a08f-e5498a22f55c" + }, + "14": { + "varname": "infomaniak_swiss_backup_products_windows_no_proxy", + "caption": "Infomaniak Swiss Backup Products: No Proxy?", + "description": "Do not use a proxy.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeBoolean", + "format": null, + "settings": {}, + "uuid": "730cadb0-46ec-44ba-9328-51e2faf42774" + }, + "15": { "varname": "infomaniak_swiss_backup_products_windows_severity", "caption": "Infomaniak Swiss Backup Products: Severity", "description": "Severity for alerting other values.", @@ -399,7 +500,18 @@ }, "uuid": "21deb8f6-fd0e-4ca6-82c5-01c3aacab963" }, - "152": { + "16": { + "varname": "infomaniak_swiss_backup_products_windows_timeout", + "caption": "Infomaniak Swiss Backup Products: Timeout", + "description": "Network timeout in seconds.", + "datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString", + "format": null, + "settings": { + "visibility": "visible" + }, + "uuid": "55243feb-42df-4ebd-881d-c2960ed972fe" + }, + "17": { "varname": "infomaniak_swiss_backup_products_windows_token", "caption": "Infomaniak Swiss Backup Products: Token", "description": "Infomaniak API token", @@ -410,7 +522,7 @@ }, "uuid": "66fb11da-4018-4648-a206-d80de2456aa6" }, - "153": { + "18": { "varname": "infomaniak_swiss_backup_products_windows_warning", "caption": "Infomaniak Swiss Backup Products: Warning", "description": "Set the warning for the expiration date in days.", diff --git a/check-plugins/infomaniak-swiss-backup-products/infomaniak-swiss-backup-products b/check-plugins/infomaniak-swiss-backup-products/infomaniak-swiss-backup-products index e9a8d23c..7cc1646e 100755 --- a/check-plugins/infomaniak-swiss-backup-products/infomaniak-swiss-backup-products +++ b/check-plugins/infomaniak-swiss-backup-products/infomaniak-swiss-backup-products @@ -26,12 +26,15 @@ from lib.globals import (STATE_CRIT, STATE_OK, # pylint: disable=C0413 STATE_UNKNOWN, STATE_WARN) __author__ = 'Linuxfabrik GmbH, Zurich/Switzerland' -__version__ = '2024021501' +__version__ = '2024031401' DESCRIPTION = """Checks your Infomaniak Swiss Backup product details via the Infomaniak API.""" DEFAULT_CRIT = 3 # days +DEFAULT_INSECURE = False +DEFAULT_NO_PROXY = False DEFAULT_SEVERITY = 'warn' +DEFAULT_TIMEOUT = 8 DEFAULT_WARN = 5 # days @@ -63,20 +66,49 @@ def parse_args(): parser.add_argument( '-c', '--critical', - help='Set the critical for the expiration date in days. Default: %(default)s', + help='Set the critical for the expiration date in days. ' + 'Default: %(default)s', dest='CRIT', type=int, default=DEFAULT_CRIT, ) + 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', + dest='NO_PROXY', + action='store_true', + default=DEFAULT_NO_PROXY, + ) + parser.add_argument( '--severity', - help='Severity for alerting other values. Default: %(default)s', + help='Severity for alerting other values. ' + 'Default: %(default)s', dest='SEVERITY', default=DEFAULT_SEVERITY, choices=['warn', 'crit'], ) + parser.add_argument( + '--timeout', + help='Network timeout in seconds. ' + 'Default: %(default)s (seconds)', + dest='TIMEOUT', + type=int, + default=DEFAULT_TIMEOUT, + ) + parser.add_argument( '--token', help='Infomaniak API token', @@ -93,7 +125,8 @@ def parse_args(): parser.add_argument( '-w', '--warning', - help='Set the warning for the expiration date in days. Default: %(default)s', + help='Set the warning for the expiration date in days. ' + 'Default: %(default)s', dest='WARN', type=int, default=DEFAULT_WARN, @@ -114,7 +147,13 @@ def main(): # fetch data if args.TEST is None: - result = lib.base.coe(lib.infomaniak.get_swiss_backup_products(args.ACCOUNT_ID, args.TOKEN)) + result = lib.base.coe(lib.infomaniak.get_swiss_backup_products( + args.ACCOUNT_ID, + args.TOKEN, + insecure=args.INSECURE, + no_proxy=args.NO_PROXY, + timeout=args.TIMEOUT, + )) else: # do not call the command, put in test data stdout, stderr, retc = lib.test.test(args.TEST) diff --git a/check-plugins/infomaniak-swiss-backup-products/unit-test/run b/check-plugins/infomaniak-swiss-backup-products/unit-test/run index 1d995bd5..b12a0792 100755 --- a/check-plugins/infomaniak-swiss-backup-products/unit-test/run +++ b/check-plugins/infomaniak-swiss-backup-products/unit-test/run @@ -31,18 +31,18 @@ class TestCheck(unittest.TestCase): def test_if_check_runs_EXAMPLE01(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --test=stdout/EXAMPLE01,,0')) self.assertIn('There are critical errors.', stdout) - self.assertIn('ID ! Customer ! Tag ! Size (alloc/avail) ! Dev ! Expires in', stdout) - self.assertIn('------+--------------+--------------+---------------------+-----+-----------', stdout) - self.assertIn('34567 ! BK-200999-1 ! tag01, tag02 ! 9.1TiB / 9.1TiB ! 1 ! ', stdout) + self.assertIn('ID ! Customer ! Tag ! Size (alloc/avail) ! Dev ! Maint. ! Locked ! Busy ! ', stdout) + self.assertIn('------+--------------+--------------+---------------------+-----+--------+--------+-------+-', stdout) + self.assertIn('34567 ! BK-200999-1 ! tag01, tag02 ! 9.1TiB / 9.1TiB ! 1 ! False ! False ! False ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_CRIT) def test_if_check_runs_EXAMPLE02(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --test=stdout/EXAMPLE02,,0')) self.assertIn('Everything is ok.', stdout) - self.assertIn('ID ! Customer ! Tag ! Size (alloc/avail) ! Dev ! Expires in', stdout) - self.assertIn('------+--------------+--------------+---------------------+-----+-----------', stdout) - self.assertIn('34567 ! BK-200999-1 ! tag01, tag02 ! 9.1TiB / 9.1TiB ! 1 ! ', stdout) + self.assertIn('ID ! Customer ! Tag ! Size (alloc/avail) ! Dev ! Maint. ! Locked ! Busy ! ', stdout) + self.assertIn('------+--------------+--------------+---------------------+-----+--------+--------+-------+-', stdout) + self.assertIn('34567 ! BK-200999-1 ! tag01, tag02 ! 9.1TiB / 9.1TiB ! 1 ! False ! False ! False ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_OK) @@ -55,9 +55,9 @@ class TestCheck(unittest.TestCase): def test_if_check_runs_EXAMPLE04_severity_crit(self): stdout, stderr, retc = lib.base.coe(lib.shell.shell_exec(self.check + ' --token=TOKEN --account-id=ACCOUNT-ID --severity=crit --test=stdout/EXAMPLE04,,0')) self.assertIn('There are critical errors.', stdout) - self.assertIn('ID ! Customer ! Tag ! Size (alloc/avail) ! Dev ! Expires in', stdout) - self.assertIn('------+--------------+--------------+---------------------+-----+-----------', stdout) - self.assertIn('34567 ! BK-200999-1 ! tag01, tag02 ! 9.1TiB / 9.1TiB ! 1 ! ', stdout) + self.assertIn('ID ! Customer ! Tag ! Size (alloc/avail) ! Dev ! Maint. ! Locked ! Busy ! ', stdout) + self.assertIn('------+--------------+--------------+---------------------+-----+--------+--------+-------+-', stdout) + self.assertIn('34567 ! BK-200999-1 ! tag01, tag02 ! 9.1TiB / 9.1TiB ! 1 ! False ! False ! False ! ', stdout) self.assertEqual(stderr, '') self.assertEqual(retc, STATE_CRIT)