X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=findbad.py;h=77dd1208a65b960b6818fffd7e9f90f790dacd46;hb=9ea6c9bfc825a684654837886af4291780673eb7;hp=1e412bc83799a70d76ffbca8a122abad7d6b9823;hpb=90b2e8e7cb145cb1f6b3780867617084441b6ca9;p=monitor.git diff --git a/findbad.py b/findbad.py index 1e412bc..77dd120 100755 --- a/findbad.py +++ b/findbad.py @@ -11,7 +11,9 @@ import threading from monitor import util from monitor.util import command from monitor import config -from monitor.database import FindbadNodeRecordSync, FindbadNodeRecord + +from monitor.database.info.model import FindbadNodeRecordSync, FindbadNodeRecord, session + from monitor.sources import comon from monitor.wrapper import plc, plccache @@ -277,6 +279,9 @@ def recordPingAndSSH(request, result): observed_category = values['category'], ) fbnodesync.round = global_round + fbnodesync.flush() + fbsync.flush() + fbrec.flush() count += 1 print "%d %s %s" % (count, nodename, values) @@ -300,8 +305,9 @@ def checkAndRecordState(l_nodes, cohash): # CREATE all the work requests for nodename in l_nodes: fbnodesync = FindbadNodeRecordSync.findby_or_create(hostname=nodename, if_new_set={'round':0}) - node_round = fbnodesync.round + fbnodesync.flush() + if node_round < global_round: # recreate node stats when refreshed #print "%s" % nodename @@ -333,6 +339,7 @@ def checkAndRecordState(l_nodes, cohash): print FindbadNodeRecordSync.query.count() print FindbadNodeRecord.query.count() + session.flush() def main(): global global_round @@ -346,14 +353,16 @@ def main(): global_round += 1 fbsync.round = global_round + fbsync.flush() + cotop = comon.Comon() # lastcotop measures whether cotop is actually running. this is a better # metric than sshstatus, or other values from CoMon cotop_url = COMON_COTOPURL # history information for all nodes - #cohash = {} - cohash = cotop.coget(cotop_url) + cohash = {} + #cohash = cotop.coget(cotop_url) l_nodes = plccache.l_nodes if config.nodelist: f_nodes = util.file.getListFromFile(config.nodelist)