Commit 424d00e1 authored by Christian Tacke's avatar Christian Tacke
Browse files

Add notification type to message, little cleanup

icinga2 has a "notification type". This is usually
"PROBLEM" or "RECOVERY".

Changed the first line of the message to be like the
Subject of the common notification mails. Especially having
the notification type at the beginning is great for reading
messages on the go ("RECOVERY? Don't even need to read the
remainder NOW").

Basicly removed the "*** monitoring" line. The only
relevant information in it was the monitoringhost.
I could argue that admins probably don't really need that
info at all (the affected host(displayname) should be more
unique, really), but nevertheless re-added the monitoring
host at the end in a smaller line for now.
parent ba126ceb
......@@ -29,16 +29,16 @@ class XMPPNotify(ClientXMPP):
def build_message(args):
if args.servicename:
# service
message = """***** Service Monitoring on {monitoringhostname} *****
{servicedisplayname} on {hostdisplayname} is {servicestate}!
message = """[{notificationtype}] {servicedisplayname} on {hostdisplayname} is {servicestate}!
Info: {serviceoutput}
When: {longdatetime}
Service: {servicename}
Host: {hostname}
Monitoring host: {monitoringhostname}\
""".format(
notificationtype=args.notificationtype,
monitoringhostname=gethostname(),
servicedisplayname=args.servicedisplayname,
hostdisplayname=args.hostdisplayname,
......@@ -49,15 +49,15 @@ Host: {hostname}
hostname=args.hostname
)
else:
message = """***** Host Monitoring on {monitoringhostname} *****
{hostdisplayname} is {hoststate}!
message = """[{notificationtype}] {hostdisplayname} is {hoststate}!
Info: {hostoutput}
When: {longdatetime}
Host: {hostname}
Monitoring host: {monitoringhostname}\
""".format(
notificationtype=args.notificationtype,
monitoringhostname=gethostname(),
hostdisplayname=args.hostdisplayname,
hoststate=args.state,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment