Bläddra i källkod

Refined output with excluding more attributes

Michael Honkoop 4 månader sedan
förälder
incheckning
2037a4f27f
1 ändrade filer med 13 tillägg och 10 borttagningar
  1. 13 10
      edir-monitor.py

+ 13 - 10
edir-monitor.py

@@ -35,23 +35,26 @@ def print_list(the_list):
                     # sanitize the timestamps if they are present
                     valueresult = re.sub('(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})([Z])', r'\3-\2-\1 \4:\5:\6', valueresult)
                     # usecases of formatting data differently
-                    if "BackGroundProc" in keytxtresult:
-                        resultArray.append("- ")
-                        resultArray.append(k + ":" + valueresult)
-                        resultArray.append(' ')
-                    if "Agent Status" in keytxtresult:
+                    if "BackGroundProc" in keytxtresult or "Agent Status" in keytxtresult:
                         resultArray.append("- ")
                         resultArray.append(k + ":" + valueresult)
                         resultArray.append(' ')
                     else:
-                        # append items to resultArray
-                        resultArray.append(k + "=" + valueresult)
-                        resultArray.append('|')
-                        detailArray.append(k + ":" + valueresult)
+                        # append items to resultArray, but skip non-interesting items
+                        if "CheckPointThreadForceStartTime" in k or "CheckPointThreadStartTime" in k:
+                            continue
+                        else:
+                            resultArray.append(k + "=" + valueresult)
+                            resultArray.append('|')
+                            detailArray.append(k + ":" + valueresult)
             #remove last item from array
             resultArray.pop()
             # print the resulting array as a string removing unwanted text
-            print(''.join(str(e) for e in resultArray).replace(" Bytes", "").replace(" KB", "") + " " + ' '.join(str(e) for e in detailArray))
+            resultStr = ''.join(str(e) for e in resultArray).replace(" Bytes", "").replace(" KB", "") + " " + ' '.join(str(e) for e in detailArray)
+            if "BackGroundProc" in resultStr:
+                continue
+            else:
+                print(resultStr)
 
 
 l = ldap.initialize('ldaps://localhost:636')