From 039d4830771ab00ccd03f46726e8ac9a8db560b4 Mon Sep 17 00:00:00 2001 From: Chriz Date: Thu, 25 May 2023 19:22:04 +0200 Subject: [PATCH 1/3] Add files via upload Check_MK Support for Local Path --- opnsense_checkmk_agent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opnsense_checkmk_agent.py b/opnsense_checkmk_agent.py index 8cc7e0d..ca43ac5 100644 --- a/opnsense_checkmk_agent.py +++ b/opnsense_checkmk_agent.py @@ -27,7 +27,7 @@ ## * smartdisk - install the mkp from https://github.com/bashclub/checkmk-smart plugins os-smart ## * squid - install the mkp from https://exchange.checkmk.com/p/squid and forwarder -> listen on loopback active -__VERSION__ = "1.0.2" +__VERSION__ = "1.0.3" import sys import os @@ -63,7 +63,7 @@ from socketserver import TCPServer,StreamRequestHandler SCRIPTPATH = os.path.abspath(__file__) SYSHOOK_METHOD = re.findall("rc\.syshook\.d\/(start|stop)/",SCRIPTPATH) -BASEDIR = "/usr/local/checkmk_agent" +BASEDIR = "/usr/local/check_mk_agent" CHECKMK_CONFIG = "/usr/local/etc/checkmk.conf" MK_CONFDIR = os.path.dirname(CHECKMK_CONFIG) LOCALDIR = os.path.join(BASEDIR,"local") @@ -952,7 +952,7 @@ class checkmk_checker(object): _required_phase2 = len(list(filter(lambda x: x.get("ikeid") == _ikeid,_phase2config))) - if _phase2_up == _required_phase2: + if _phase2_up >= _required_phase2: _ret.append("{status} \"IPsec Tunnel: {remote-name}\" if_in_octets={bytes-received}|if_out_octets={bytes-sent}|lifetime={life-time} {state} {local-id} - {remote-id}({remote-host})".format(**_con)) elif _phase2_up == 0: if _condata.keys(): From 2e8ed699bbce55e57d3ccd3d026a3c5ac6a80b54 Mon Sep 17 00:00:00 2001 From: Chriz Date: Thu, 25 May 2023 20:05:23 +0200 Subject: [PATCH 2/3] Add files via upload caching issue fixed --- opnsense_checkmk_agent.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/opnsense_checkmk_agent.py b/opnsense_checkmk_agent.py index ca43ac5..249fc4d 100644 --- a/opnsense_checkmk_agent.py +++ b/opnsense_checkmk_agent.py @@ -27,7 +27,7 @@ ## * smartdisk - install the mkp from https://github.com/bashclub/checkmk-smart plugins os-smart ## * squid - install the mkp from https://exchange.checkmk.com/p/squid and forwarder -> listen on loopback active -__VERSION__ = "1.0.3" +__VERSION__ = "1.0.4" import sys import os @@ -217,7 +217,10 @@ class checkmk_checker(object): except: _cachetime = 0 try: - _lines.append(self._run_cache_prog(_plugin_file,_cachetime)) + if _cachetime > 0: + _lines.append(self._run_cache_prog(_plugin_file,_cachetime)) + else: + _lines.append(self._run_prog(_plugin_file)) except: _errors.append(traceback.format_exc()) @@ -241,7 +244,10 @@ class checkmk_checker(object): except: _cachetime = 0 try: - _lines.append(self._run_cache_prog(_local_file,_cachetime)) + if _cachetime > 0: + _lines.append(self._run_cache_prog(_local_file,_cachetime)) + else: + _lines.append(self._run_prog(_local_file)) except: _errors.append(traceback.format_exc()) From 855c06415e149905c23fa8a3d9856d3b3b572a9b Mon Sep 17 00:00:00 2001 From: Thorsten Spille Date: Fri, 26 May 2023 21:41:42 +0200 Subject: [PATCH 3/3] v1.0.5 --- opnsense_checkmk_agent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opnsense_checkmk_agent.py b/opnsense_checkmk_agent.py index 249fc4d..2219619 100644 --- a/opnsense_checkmk_agent.py +++ b/opnsense_checkmk_agent.py @@ -27,7 +27,7 @@ ## * smartdisk - install the mkp from https://github.com/bashclub/checkmk-smart plugins os-smart ## * squid - install the mkp from https://exchange.checkmk.com/p/squid and forwarder -> listen on loopback active -__VERSION__ = "1.0.4" +__VERSION__ = "1.0.5" import sys import os @@ -70,6 +70,10 @@ LOCALDIR = os.path.join(BASEDIR,"local") PLUGINSDIR = os.path.join(BASEDIR,"plugins") SPOOLDIR = os.path.join(BASEDIR,"spool") +os.environ["MK_CONFDIR"] = MK_CONFDIR +os.environ["MK_LIBDIR"] = BASEDIR +os.environ["MK_VARDIR"] = BASEDIR + class object_dict(defaultdict): def __getattr__(self,name): return self[name] if name in self else ""