Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor changes to the handling of 'zombi alarms'
  • Loading branch information
weiher committed Aug 7, 2017
1 parent 49b4c7b commit 230e5fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
18 changes: 0 additions & 18 deletions testAlarms.txt

This file was deleted.

1 change: 1 addition & 0 deletions testAlarms.txt
18 changes: 9 additions & 9 deletions wc_checkAlarms.py
Expand Up @@ -186,11 +186,11 @@ def main(args):
print fault
sys.exit(1)

#lines = report.split("\n")
#lines = lines[1:]
lines = report.split("\n")
lines = lines[1:]
# Comment above two lines and uncomment below two lines in order to test the program
file = open("testAlarms.txt", "r")
lines = file.read().split("\n")
#file = open("testAlarms.txt", "r")
#lines = file.read().split("\n")

# Go through the report and create alarm objects distinguishing by their current alarm status.
# Start looping from the last line in order to process the oldest alarms first.
Expand Down Expand Up @@ -240,7 +240,6 @@ def main(args):
# the check/solution to a prior alarm with status e.g. 'unnormal':
removedAlarm = False
for a in alarmsActive:

if a.quelle == quelle:
# Remove alarm from running and do not append to checked
removedAlarm = True
Expand Down Expand Up @@ -280,11 +279,12 @@ def main(args):
if alarmsActive:
for a in alarmsActive:

# Remove "Zombi alarms":
#if a.age == a.oldAge:
# Remove "Zombi alarms", that is, alarms that are still marked as active but do not appear in the retrieved
# alarms list anymore. So, these alarms were acknowledged/solved AND deleted between two alarms retrievals
if not a.stillActive:
print("This alarm seems to have been solved and deleted so we're removing it from the list of active alarms:")
print(a)
if verbosity:
print("This alarm seems to have been solved and deleted so we're removing it from the list of active alarms:")
print(a.date, a.standort, a.message, a.quelle, a.bestaetigtVon, a.kategorie, a.status)
alarmsActive.remove(a)
continue

Expand Down

0 comments on commit 230e5fb

Please sign in to comment.