Skip to content

Commit

Permalink
Reworked logging
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-pickin-epi committed Oct 23, 2024
1 parent 4c8e327 commit 6b1c2b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sensu-alertmanager
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To debug create a new sensu handler configured a tcp port 31337
# on host the host start nc -l
# pipe the output from this to stdin of this script.
# or run a working version with --verbose=2 and reparse .message.Data
# or run a working version with --verbose=2 and reparse received alert

import argparse
import datetime
Expand All @@ -28,7 +28,7 @@ def report(level, msg, alert=None):
print(json.dumps(event))

def debug(msg, alert=None):
report("debug", msg)
report("debug", msg, alert)

def log(msg, alert=None):
report("info", msg, alert)
Expand Down Expand Up @@ -97,7 +97,7 @@ def post(msg, retry=0):
alert.append(msg)

if retry:
log("Retry: {}".format(retry))
log("Retry: {}".format(retry), alert)
else:
log("Sending to {}".format(args.alertmanager), alert)

Expand All @@ -123,7 +123,7 @@ def post(msg, retry=0):

def process(data):
if (args.verbose > 1):
debug('Alert Received')
debug('Alert Received', data)
md = data['check']['metadata']

entity_name = entity(data)
Expand Down

0 comments on commit 6b1c2b5

Please sign in to comment.