Skip to content

Commit

Permalink
added author and comment in notification (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reamer authored Aug 1, 2019
1 parent 5c1896d commit 8a82a9f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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$"
}
Expand All @@ -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$"
Expand Down Expand Up @@ -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$"
}
Expand All @@ -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$"
}
Expand Down
6 changes: 6 additions & 0 deletions mattermost.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8a82a9f

Please sign in to comment.