Commit d9e91de9 authored by Bernhard Geier's avatar Bernhard Geier
Browse files

rename argument --brief (-B) to --short (-S)

remove icinga2 server url from short output
parent a07049b2
......@@ -26,8 +26,8 @@ template NotificationCommand "xmpp-notification-base" {
required = true
value = "$notification_type$"
}
"-B" = {
set_if = "$notification_brief$"
"-S" = {
set_if = "$notification_short$"
}
}
......@@ -41,7 +41,7 @@ template NotificationCommand "xmpp-notification-base" {
notification_hostname = "$host.name$"
notification_hostdisplayname = "$host.display_name$"
notification_useremail = "$user.vars.xmpp$"
notification_brief = "$user.vars.xmpp_brief$"
notification_short = "$user.vars.xmpp_short$"
}
}
......
......@@ -64,7 +64,7 @@ def build_message(args):
output=output
)
if not args.brief:
if not args.short:
message += """\nWhen: {longdatetime}\nRef: {hostname}!{servicename}\nMonitoring host: {monitoringhostname}""".format(
longdatetime=args.longdatetime,
hostname=args.hostname,
......@@ -78,17 +78,17 @@ def build_message(args):
hoststate=args.state,
output=output
)
if not args.brief:
if not args.short:
message += """\nWhen: {longdatetime}\nRef: {hostname}\nMonitoring host: {monitoringhostname}""".format(
longdatetime=args.longdatetime,
hostname=args.hostname,
monitoringhostname=gethostname()
)
if not args.brief and args.hostaddress:
if not args.short and args.hostaddress:
message += "\nIPv4: {}".format(args.hostaddress)
if not args.brief and args.hostaddress6:
if not args.short and args.hostaddress6:
message += "\nIPv6: {}".format(args.hostaddress6)
if args.notificationcomment:
......@@ -102,19 +102,20 @@ Comment by {notificationauthorname}
comment=comment
)
if args.icingaweb2url and args.servicename:
message += "\n" + args.icingaweb2url + \
"/monitoring/service/show?host={hostname}&service={servicename}" \
.format(
hostname=args.hostname,
servicename=args.servicename
)
elif args.icingaweb2url:
message += "\n" + args.icingaweb2url + \
"/monitoring/host/show?host={hostname}" \
.format(
hostname=args.hostname,
)
if not args.short:
if args.icingaweb2url and args.servicename:
message += "\n" + args.icingaweb2url + \
"/monitoring/service/show?host={hostname}&service={servicename}" \
.format(
hostname=args.hostname,
servicename=args.servicename
)
elif args.icingaweb2url:
message += "\n" + args.icingaweb2url + \
"/monitoring/host/show?host={hostname}" \
.format(
hostname=args.hostname,
)
return message
......@@ -139,7 +140,7 @@ def build_argparser():
parser.add_argument('-b', '--notificationauthorname')
parser.add_argument('-c', '--notificationcomment')
parser.add_argument('-i', '--icingaweb2url')
parser.add_argument('-B', '--brief', default=False, action='store_true')
parser.add_argument('-S', '--short', default=False, action='store_true')
return parser
......
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