add scrappy statistics gathering scripts
[monitor.git] / statistics / parserpms.py
diff --git a/statistics/parserpms.py b/statistics/parserpms.py
new file mode 100755 (executable)
index 0000000..6ca34b2
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import sys
+import os
+import md5
+
+def list_to_md5(strlist):
+       digest = md5.new()
+       for f in strlist:
+               digest.update(f)
+
+       return digest.hexdigest()
+
+while True:
+       line = sys.stdin.readline()
+       if not line:
+               break
+       line = line.strip()
+       fields = line.split()
+       host = fields[1]
+       rpms = fields[2:]
+       rpms.sort()
+       if len(rpms) != 0:
+               sum = list_to_md5(rpms)
+               print sum, host