Skip to content

Commit

Permalink
Put the tag on the host name
Browse files Browse the repository at this point in the history
  • Loading branch information
petya-vasileva committed Dec 13, 2024
1 parent eb41938 commit 019cb24
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions ps-host-unresolvable.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,12 @@ def main():
'host': host,
'site': site,
'configurations': host_configs,
'alarm_type': alarmType
}
current_datetime = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
toHash = ','.join([host] + host_configs + [current_datetime])
doc['alarm_id'] = hashlib.sha224(toHash.encode('utf-8')).hexdigest()

tags = host_configs
# prevent insertion of empty site names
if site:
tags = [host_configs, site]

alarmOnHost.addAlarm(body=alarmType, tags=tags, source=doc)
alarmOnHost.addAlarm(body=alarmType, tags=host, source=doc)
print(f"Host '{host}' at {site} needs updates in configurations: {', '.join(host_configs)}")
else:
print("All hosts are resolvable. No updates needed.")
Expand Down

0 comments on commit 019cb24

Please sign in to comment.