diff --git a/README.md b/README.md index f623f41..8b4b109 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,12 @@ object NotificationCommand "mattermost_service" { "required" = true "value" = "$mattermost_notificationtype$" } + "--author" = { + "value" = "$mattermost_author$" + } + "--comment" = { + "value" = "$mattermost_comment$" + } "--oneline" = { "set_if" = "$mattermost_oneline$" } @@ -58,6 +64,8 @@ object NotificationCommand "mattermost_service" { "mattermost_channel" = "$user.vars.channel$" "mattermost_hostalias" = "$host.display_name$" "mattermost_notificationtype" = "$notification.type$" + "mattermost_author" = "$notification.author$" + "mattermost_comment" = "$notification.comment$" "mattermost_oneline" = "$user.vars.oneline$" "mattermost_servicedesc" = "$service.display_name$" "mattermost_serviceoutput" = "$service.output$" @@ -93,6 +101,12 @@ object NotificationCommand "mattermost_host" { "required" = true "value" = "$mattermost_notificationtype$" } + "--author" = { + "value" = "$mattermost_author$" + } + "--comment" = { + "value" = "$mattermost_comment$" + } "--oneline" = { "set_if" = "$mattermost_oneline$" } @@ -109,6 +123,8 @@ object NotificationCommand "mattermost_host" { "mattermost_hostoutput" = "$host.output$" "mattermost_hoststate" = "$host.state$" "mattermost_notificationtype" = "$notification.type$" + "mattermost_author" = "$notification.author$" + "mattermost_comment" = "$notification.comment$" "mattermost_oneline" = "$user.vars.oneline$" "mattermost_url" = "$user.vars.url$" } diff --git a/mattermost.py b/mattermost.py index b88f533..749b66a 100755 --- a/mattermost.py +++ b/mattermost.py @@ -52,6 +52,8 @@ def parse(): parser.add_argument('--servicedesc', help='Service Description') parser.add_argument('--servicestate', help='Service State') parser.add_argument('--serviceoutput', help='Service Output') + parser.add_argument('--author', help='Author') + parser.add_argument('--comment', help='Comment') parser.add_argument('--oneline', action='store_true', help='Print only one line') parser.add_argument('--version', action='version', version='%(prog)s {version}'.format(version=VERSION)) @@ -80,6 +82,10 @@ def make_data(args): if args.oneline: text = text.splitlines()[0] + if args.author: + text += " authored by " + args.author + if args.comment: + text += " commented with " + args.comment payload = { "username": args.username,