浏览代码

Update 'plugins/edirectory_monitor/libexec/agent_edirectory_monitor'

Michael Honkoop 3 月之前
父节点
当前提交
6d2a1969bb
共有 1 个文件被更改,包括 11 次插入7 次删除
  1. 11 7
      plugins/edirectory_monitor/libexec/agent_edirectory_monitor

+ 11 - 7
plugins/edirectory_monitor/libexec/agent_edirectory_monitor

@@ -1,10 +1,17 @@
 #!/usr/bin/env python3
+
 # -*- mode: Python; encoding: utf-8; indent-offset: 4; autowrap: nil -*-
 
+# (c) Michael Honkoop <mhonkoop@comsolve.nl>
+
+# License: GNU General Public License v2
+
 import sys
 import ldap
-import json
 import re
+from cmk_addons.plugins.edirectory_monitor.lib import (
+    format_partition_data,
+)
 
 def clean_key(key):
     """Clean and format the key by removing unwanted parts."""
@@ -12,7 +19,9 @@ def clean_key(key):
     return cleaned_key
 
 def clean_value(value):
-    cleaned_value = value.replace(" Bytes", "").replace(" KB", "")
+    cleaned_value = re.sub(' Bytes| KB', '', value)
+    #cleaned_value = re.sub(' Bytes| KB|CN=|OU=|O=', '', value)
+    
     return cleaned_value
 
 def print_sections(raw_result):
@@ -114,11 +123,6 @@ def main():
         for i in range(len(result_set)):
             print_sections(result_set[i])
 
-        #parse_data(result_set)
-        #print_sections(result_set)
-        
-
-
     except ldap.LDAPError as e:
         print(f"LDAP search failed: {e}")