diff --git a/README.md b/README.md index 38e30f36fa0c2b093a82c94e7ceb6bc85d847acc..16d40ffa4275cfa7b747481951ef033c3b1ddfd6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[PACKAGE]: ../../raw/master/mkp/agent_ssllabs-2.0.2-20240105.mkp "agent_ssllabs-2.0.2-20240105.mkp" +[PACKAGE]: ../../raw/master/mkp/agent_ssllabs-2.0.2-20240504.mkp "agent_ssllabs-2.0.2-20240504.mkp" # Qualys SSL Labs REST API special agent This Agent uses die Qualys SSL Labs REST API to scan a list of servers for there SSL status. The plugin will check the given server and all end points reported by the SSL Labs scan. diff --git a/mkp/agent_ssllabs-2.0.2-20240504.mkp b/mkp/agent_ssllabs-2.0.2-20240504.mkp new file mode 100644 index 0000000000000000000000000000000000000000..94f11aacfe558946412d1c09b3a761dc55653ee0 Binary files /dev/null and b/mkp/agent_ssllabs-2.0.2-20240504.mkp differ diff --git a/source/agent_based/ssllabs_grade.py b/source/agent_based/ssllabs_grade.py index f2985459db5541d6c6d3428ffe8322cbbda3a771..4355f1f2c4ef8cecdb0b70d828d897693a620e6a 100644 --- a/source/agent_based/ssllabs_grade.py +++ b/source/agent_based/ssllabs_grade.py @@ -83,7 +83,7 @@ from dataclasses import dataclass from json import loads as json_loads, JSONDecodeError from typing import Tuple from re import compile as re_compile, match as re_match -from time import localtime, time as now_time, strftime +from time import time as now_time from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import ( CheckResult, @@ -110,7 +110,10 @@ def get_bool(field: str, data: Mapping[str: object]) -> bool | None: def get_int(field: str, data: Mapping[str: object]) -> bool | None: - return int(data[field]) if data.get(field) is not None else None + try: + return int(data[field]) if data.get(field) is not None else None + except ValueError: + return None @dataclass(frozen=True) @@ -366,7 +369,7 @@ def check_ssllabs_grade(item: str, params: Mapping[str: any], section: SECTION) if ssl_host.from_agent_cache is not None: yield Result(state=State.OK, notice=f'From agent cache: {ssl_host.from_agent_cache}') else: - yield Result(state=State.WARN, notice=f'Live data') + yield Result(state=State.OK, notice=f'Live data') if ssl_host.end_points: yield Result(state=State.OK, notice=f'\nEndpoints') diff --git a/source/packages/agent_ssllabs b/source/packages/agent_ssllabs index 698d35e3fcdfbac89f36c685ac2d87c980d1bf11..408362c27a373faebdf92a38ca2ee4e220745b8e 100644 --- a/source/packages/agent_ssllabs +++ b/source/packages/agent_ssllabs @@ -1,27 +1,11 @@ -{'author': 'Karsten Schoeke', - 'description': 'This check monitors the status of ssl cert checks on ' - 'ssllab.com.\n' +{'author': 'Th.L. (thl-cmk[at]outlook[dot]com)', + 'description': 'based on the work by Karsten Schoeke see\n' + 'https://github.com/lgbff/lgb_check_mk_plugins/tree/master/ssllabs\n' '\n' - 'Changelog:\n' - '- 2.0.1 modyfied for CMK 2.0 by thl-cmk[at]outlook[dot]com\n' - '- 2.0.0 insert cache for api response \n' - '- 1.6.0 insert Agent status (line[3]) \n' - '- 1.5.3 change default status\n' - '- 1.5.2 Insert Agent Header infos\n' - '- 1.5.1 cachge default settings \n' - '- 1.5.0 new data seperator (59) \n' - '- 1.4.9 fix diplay JSON Error on check result. \n' - '- 1.4.8 fix connect exeption\n' - '- 1.4.7 add default value for timeout\n' - '- 1.4.6 change timeout handling\n' - '- 1.4.5 fix inventory issue while JSON issues \n' - '- 1.4.4 change urlopen error handling\n' - '- 1.4.3 Rename check file\n' - '- 1.4.2 Fix check manpage\n' - '- 1.4.1 delete modul calls from check\n' - '- 1.4.0 changes for cmk version 1.4\n' - '- 1.3.1 improve error handling.\n', - 'download_url': 'https://github.com/lgbff/lgb_check_mk_plugins/tree/master/ssllabs', + 'This check monitors the status of ssl cert checks on ' + 'ssllab.com.\n' + '\n', + 'download_url': 'https://thl-cmk.hopto.org', 'files': {'agent_based': ['ssllabs_grade.py'], 'agents': ['special/agent_ssllabs'], 'checkman': ['ssllabs_grade'], @@ -31,7 +15,7 @@ 'web': ['plugins/wato/agent_ssllabs.py']}, 'name': 'agent_ssllabs', 'title': 'ssllabs api check', - 'version': '2.0.2-20240105', + 'version': '2.0.2-20240504', 'version.min_required': '2.2.0b1', 'version.packaged': '2.2.0p24', 'version.usable_until': None}