|
@@ -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}")
|
|
|
|