diff --git a/bundles/icinga2/files/scripts/icinga_notification_wrapper b/bundles/icinga2/files/scripts/icinga_notification_wrapper index 612882d..fbecd8e 100644 --- a/bundles/icinga2/files/scripts/icinga_notification_wrapper +++ b/bundles/icinga2/files/scripts/icinga_notification_wrapper @@ -129,11 +129,14 @@ def notify_per_ntfy(): data=message_text, headers=headers, auth=(CONFIG['ntfy']['user'], CONFIG['ntfy']['password']), + timeout=10, ) r.raise_for_status() except Exception as e: log_to_syslog('Sending a Notification failed: {}'.format(repr(e))) + return False + return True def notify_per_mail(): @@ -199,7 +202,8 @@ if __name__ == '__main__': notify_per_mail() if args.sms: - if not args.service_name: - notify_per_sms() + ntfy_worked = False if CONFIG['ntfy']['user']: - notify_per_ntfy() + ntfy_worked = notify_per_ntfy() + if not args.service_name or not ntfy_worked: + notify_per_sms()