From 019cb24e9faa2ace682eba89a993156550c132c3 Mon Sep 17 00:00:00 2001 From: petya-vasileva Date: Fri, 13 Dec 2024 08:10:22 +0000 Subject: [PATCH] Put the tag on the host name --- ps-host-unresolvable.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ps-host-unresolvable.py b/ps-host-unresolvable.py index de95740..7e5d76a 100755 --- a/ps-host-unresolvable.py +++ b/ps-host-unresolvable.py @@ -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.")