Skip to content

Commit

Permalink
-v flag / exception testing 2
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-pickin-epi committed Sep 4, 2024
1 parent d6a2957 commit 88a4bde
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sensu-alertmanager
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ def post(msg, retry=0):
log("Retry: {}".format(retry))

try:
# if (args.verbose > 0):
# log("Forwarding to {}".format(args.alertmanager), alert)
r = requests.post(args.alertmanager, json = alert, timeout = args.timeout)
# log(r.text)
except requests.Timeout:
if (retry < args.retries):
post(msg, retry+1)
Expand Down Expand Up @@ -136,7 +133,7 @@ def process(data):
if 'sensu' in msg['annotations'].keys():
msg['generatorURL'] ='https://{}/c/~/n/{}/events/{}/{}'.format(msg['annotations'].pop('sensu'), md['namespace'], entity_name, md['name'])

if ((md['name'] != "keepalive") or (args.verbose > 0)):
if ((args.verbose > 0 and md['name'] != "keepalive") or (args.verbose > 1)):
log("Post:{}".format(json.dumps(msg)))

post(msg)
Expand Down

0 comments on commit 88a4bde

Please sign in to comment.