clearer names for actions, and infer actions better
[monitor.git] / statistics / aggregate.py
1 #!/usr/bin/python
2
3
4 from monitor import database
5 import time
6 import sys
7
8 actall = database.dbLoad("act_all_080825")
9 agg = database.dbLoad("aggregatehistory")
10
11 for node in actall.keys():
12         for record in actall[node]:
13                 if 'date_created' in record:
14                         t = record['date_created']
15                 elif 'time' in record:
16                         t = record['time']
17                 else:
18                         continue
19
20                 acttime = time.strftime("%Y-%m-%d", time.localtime(t)) 
21
22                 if acttime > '2007-11-06':
23                         if 'noop' in record['action']:
24                                 if node in agg:
25                                         for ntime,state in agg[node]:
26                                                 if state == 'BOOT':
27                                                         if ntime > acttime:
28                                                                 if type(record['action']) == type([]):
29                                                                         action = record['action'][0]
30                                                                 else:
31                                                                         action = record['action']
32                                                                 print acttime, action, ntime, state, node
33
34                                 #print time.strftime("%Y-%m-%d", time.localtime(t)), record['action'], node
35
36 #for node in agg:
37 #       for ntime,state in agg[node]:
38 #               if state == 'BOOT':
39 #                       print ntime, state, node