clearer names for actions, and infer actions better
[monitor.git] / statistics / usedtickets.py
1 #!/usr/bin/python
2
3 from monitor.model import *
4
5 sql = database.dbLoad("idTickets")
6 for db in ["monitor", "pcu", "bootcd", "hardware", "unknown", 
7                   "suspect", "baddns", "nodenet", "nodeid"]:
8         db = "%s_persistmessages" % db
9         #print db
10         try:
11                 pm = database.dbLoad(db)
12         except:
13                 continue
14         for host in pm.keys():
15                 m = pm[host]
16                 id = str(m.ticket_id)
17                 if m.ticket_id > 0:
18                         if id in sql:
19                                 print "%s %6s %s" % (m.ticket_id, sql[id]['status'], host)
20                         else:
21                                 print "%s closed %s" % ( m.ticket_id, host)