check_send_receive: Improve error reporting on receive path.
(imported from commit 54eed4286c5ee4830670306be7c018f41dd4f906)
This commit is contained in:
parent
77c2452813
commit
ea57a5151c
|
@ -76,13 +76,16 @@ def report(state, time, msg=None):
|
|||
print "%s: send time was %s" % (state, time)
|
||||
exit(states[state])
|
||||
|
||||
def send_humbug(sender, message, nagios):
|
||||
def send_humbug(sender, message):
|
||||
result = sender.send_message(message)
|
||||
if result["result"] != "success" and nagios:
|
||||
if result["result"] != "success" and options.nagios:
|
||||
report("CRITICAL", "Error sending Humbug, args were: %s, %s" % (message, result))
|
||||
|
||||
def get_humbug(recipient, max_message_id):
|
||||
return recipient.get_messages({'last': str(max_message_id)})['messages']
|
||||
result = recipient.get_messages({'last': str(max_message_id)})
|
||||
if result['result'] != "success" and options.nagios:
|
||||
report("CRITICAL", "Error receiving Humbugs, args were: %s, %s" % (max_message_id, result))
|
||||
return result['messages']
|
||||
|
||||
# hamlet and othello are default users
|
||||
sender = "hamlet@humbughq.com"
|
||||
|
@ -112,7 +115,7 @@ send_humbug(humbug_sender, {
|
|||
"content": msg_to_send,
|
||||
"subject": "time to send",
|
||||
"to": recipient,
|
||||
}, options.nagios)
|
||||
})
|
||||
|
||||
msg_content = []
|
||||
|
||||
|
|
Loading…
Reference in a new issue