Commit a211965d authored by kpetersn's avatar kpetersn
Browse files

Modified an.py to use new XML elements (status and duration) rather than the old timers

parent de58b952
...@@ -120,10 +120,10 @@ for ioc in root.iter('IOC'): ...@@ -120,10 +120,10 @@ for ioc in root.iter('IOC'):
#print ET.tostring(ioc) #print ET.tostring(ioc)
for elem in ioc: for elem in ioc:
if elem.tag == 'ping_timer': if elem.tag == 'status':
ping_timer = int(elem.text) status = elem.text.upper()
if elem.tag == 'boot_timer': if elem.tag == 'duration':
boot_timer = int(elem.text) duration = int(elem.text)
if elem.tag == 'env': if elem.tag == 'env':
if elem.attrib['name'] == 'ENGINEER': if elem.attrib['name'] == 'ENGINEER':
if elem.text == engineer: if elem.text == engineer:
...@@ -137,14 +137,23 @@ for ioc in root.iter('IOC'): ...@@ -137,14 +137,23 @@ for ioc in root.iter('IOC'):
#!print "engineer =", engineer #!print "engineer =", engineer
#!print #!print
if ( ping_timer > hb_period ) and ( ping_timer <= (hb_period + period) ): if status == "UP":
# ioc went down since last poll if duration <= period:
ioc_list[name] = 'DOWN' #!print status, "-- UP expected"
elif boot_timer <= period: ioc_list[name] = 'UP'
# ioc booted since last poll else:
ioc_list[name] = 'UP' #!print status, "-- (UP for too long)"
pass
elif status == "DOWN":
if duration > period and duration <= (2 * period):
#!print status, "-- DOWN expected"
ioc_list[name] = 'DOWN'
else:
#!print status, "-- (DOWN for too long)"
pass
else: else:
# ioc's state is old, no notification necessary # Don't send notification
#!print status, "-- OTHER STATE"
pass pass
iocs = ioc_list.keys() iocs = ioc_list.keys()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment