From 5bfe29537a510ac89193de600213eccb7d4b10d6 Mon Sep 17 00:00:00 2001 From: czet Date: Tue, 6 Apr 2021 18:44:39 +0200 Subject: [PATCH 1/2] Fixes: ncpa hangs if mounted nfs partition has a problems (#757) and follow_symlinks doesnt work because type conversion bool(config.get(...)) of a string returns True. --- CHANGES.rst | 4 ++++ VERSION | 2 +- agent/listener/database.py | 2 +- agent/listener/pluginnodes.py | 6 +++--- agent/listener/psapi.py | 2 +- agent/listener/server.py | 2 +- agent/ncpa_windows.py | 4 ++-- agent/passive/nagioshandler.py | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0b3a94dac..eabc8a525 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,10 @@ Changelog +++++++++ +2.3.2 - ??/??/2021 +================== +- Fixed ncpa hangs if mounted nfs partition has a problems (#757) (ccztux) + 2.3.1 - 02/11/2021 ================== - Fixed uninstalling DEB package leaves systemd service active (#651) (ccztux) diff --git a/VERSION b/VERSION index 2bf1c1ccf..f90b1afc0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.1 +2.3.2 diff --git a/agent/listener/database.py b/agent/listener/database.py index 3fee0c36a..a7eb5f163 100644 --- a/agent/listener/database.py +++ b/agent/listener/database.py @@ -46,7 +46,7 @@ def setup(self): def run_db_maintenance(self, config): try: - days = int(config.get('general', 'check_logging_time')) + days = config.getint('general', 'check_logging_time') except Exception as e: days = 30; timestamp = time.time() - (days * 86400) diff --git a/agent/listener/pluginnodes.py b/agent/listener/pluginnodes.py index 59b74a832..8b7161785 100644 --- a/agent/listener/pluginnodes.py +++ b/agent/listener/pluginnodes.py @@ -84,13 +84,13 @@ def execute_plugin(self, config, *args, **kwargs): # Get plugin command timeout value, if it exists try: - timeout = int(config.get('plugin directives', 'plugin_timeout')) + timeout = config.getint('plugin directives', 'plugin_timeout') except Exception as e: timeout = 60 # Get the check logging value try: - check_logging = int(config.get('general', 'check_logging')) + check_logging = config.getint('general', 'check_logging') except Exception as e: check_logging = 1 @@ -197,7 +197,7 @@ def setup_plugin_children(self, config): # Get the follow_symlinks value try: - follow_symlinks = bool(config.get('plugin directives', 'follow_symlinks')) + follow_symlinks = config.getboolean('plugin directives', 'follow_symlinks') except Exception as e: follow_symlinks = False diff --git a/agent/listener/psapi.py b/agent/listener/psapi.py index 092c6c06b..82a4e3317 100644 --- a/agent/listener/psapi.py +++ b/agent/listener/psapi.py @@ -191,7 +191,7 @@ def get_disk_node(config): # Get the all partitions value try: - all_partitions = bool(config.get('general', 'all_partitions')) + all_partitions = config.getboolean('general', 'all_partitions') except Exception as e: all_partitions = True diff --git a/agent/listener/server.py b/agent/listener/server.py index 59595dfd1..a54319fea 100755 --- a/agent/listener/server.py +++ b/agent/listener/server.py @@ -24,7 +24,7 @@ import socket -__VERSION__ = '2.3.1' +__VERSION__ = '2.3.2' __STARTED__ = datetime.datetime.now() __INTERNAL__ = False diff --git a/agent/ncpa_windows.py b/agent/ncpa_windows.py index 88bc04a93..514c2202f 100755 --- a/agent/ncpa_windows.py +++ b/agent/ncpa_windows.py @@ -84,8 +84,8 @@ def setup_logging(self, *args, **kwargs): logging.getLogger().handlers = [] # Max size of log files will be 20MB, and we'll keep one of them as backup - max_log_size_bytes = int(config.get('logmaxmb', 5)) - max_log_rollovers = int(config.get('logbackups', 5)) + max_log_size_bytes = config.getint('logmaxmb', 5) + max_log_rollovers = config.getint('logbackups', 5) max_file_size = max_log_size_bytes * 1024 * 1024 file_handler = logging.handlers.RotatingFileHandler(log_file, maxBytes=max_file_size, diff --git a/agent/passive/nagioshandler.py b/agent/passive/nagioshandler.py index bfaf57fd2..6b637681c 100644 --- a/agent/passive/nagioshandler.py +++ b/agent/passive/nagioshandler.py @@ -45,7 +45,7 @@ def get_commands_from_config(self): duration = values[2] else: try: - duration = int(self.config.get('passive', 'sleep')) + duration = self.config.getint('passive', 'sleep') except Exception: duration = 300 From a85f3a801e4d83cbe37b05c2a9b5b3bc33ba07f7 Mon Sep 17 00:00:00 2001 From: czet Date: Wed, 7 Apr 2021 07:52:41 +0200 Subject: [PATCH 2/2] Changelog updated. --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index eabc8a525..8f25c34d6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,7 +3,7 @@ Changelog 2.3.2 - ??/??/2021 ================== -- Fixed ncpa hangs if mounted nfs partition has a problems (#757) (ccztux) +- Fixed some configuration directives doesnt work, e.g. all_partitions and follow_symlinks (#757) (ccztux) 2.3.1 - 02/11/2021 ==================