slack.pl Author and Comments for Acknowledgement/Add Comment
slack.pl Author and Comments for Acknowledgement/Add Comment
Has anyone implemented sending comments and author info to slack when an acknowledgement or send custom notification happens in Nagios XI. It seems the default behavior at least with acknowledgment is to send a notification that there it is acknowledged but the author who submitted it is not sent nor is the comment they put. Can that be sent in the slack notification? Also with send custom notification it just resends the current state to slack. Thanks in advance!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: slack.pl Author and Comments for Acknowledgement/Add Com
Hello FullSail,
When Slack integration was setup several new notifications handlers were created for hosts and services. For example:
You can modify this command to include additional macros for $HOSTACKAUTHOR$ and $HOSTACKCOMMENT$, these system macros are explained in detail on the following page.
Standard Macros in Nagios
I hope that helps and let us know if you're able to get this working.
Reference:
Integrating Slack With Nagios XI
When Slack integration was setup several new notifications handlers were created for hosts and services. For example:
Code: Select all
Command Name:
slack_host_notification_handler
Command Line:
$USER1$/slack_nagios.pl -field slack_channel="#hosts" -field
HOSTALIAS="$HOSTNAME$" -field HOSTSTATE="$HOSTSTATE$" -field
HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
Standard Macros in Nagios
I hope that helps and let us know if you're able to get this working.
Reference:
Integrating Slack With Nagios XI
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: slack.pl Author and Comments for Acknowledgement/Add Com
Thank you for the reply. I tried adding this command but an acknowledgment does not include the author or comment:
$USER1$/slack_nagios.pl -field slack_channel="slackchannel" -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$" -field SERVICEACKCOMMENT="$SERVICEACKCOMMENT$" -field SERVICEACKAUTHOR="$SERVICEACKAUTHOR$"
With the extra variables it still only sends alerts like so:
serverx.server.com/service is ACKNOWLEDGED
I was able to get it to display by adding the variables to the SERVICEOUTPUT variable like so
-field SERVICEOUTPUT="$SERVICEOUTPUT$ $SERVICEACKCOMMENT$ $SERVICEACKAUTHOR$"
But it does add extra spaces if it's a regular notification. Don't know if I set the command wrong but it seems the variables like SERVICEACKAUTHOR and SERVICEACKCOMMENTS are setup to send through the slack app.
$USER1$/slack_nagios.pl -field slack_channel="slackchannel" -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$" -field SERVICEACKCOMMENT="$SERVICEACKCOMMENT$" -field SERVICEACKAUTHOR="$SERVICEACKAUTHOR$"
With the extra variables it still only sends alerts like so:
serverx.server.com/service is ACKNOWLEDGED
I was able to get it to display by adding the variables to the SERVICEOUTPUT variable like so
-field SERVICEOUTPUT="$SERVICEOUTPUT$ $SERVICEACKCOMMENT$ $SERVICEACKAUTHOR$"
But it does add extra spaces if it's a regular notification. Don't know if I set the command wrong but it seems the variables like SERVICEACKAUTHOR and SERVICEACKCOMMENTS are setup to send through the slack app.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: slack.pl Author and Comments for Acknowledgement/Add Com
Hello @fullsail,
Well, it sounds you have it working but not quite as desired. So just to clarify if you change the field to
It works, but it's inserting extra spaces during regular notifications.
If you add new fields in the command string for acknowledgements, they are not included, but the slack notifications still work otherwise. Is this a correct? I'm trying to replicate this on my end.
Thanks!
Benjamin
Well, it sounds you have it working but not quite as desired. So just to clarify if you change the field to
Code: Select all
-field SERVICEOUTPUT="$SERVICEOUTPUT$ $SERVICEACKCOMMENT$ $SERVICEACKAUTHOR$"If you add new fields in the command string for acknowledgements, they are not included, but the slack notifications still work otherwise. Is this a correct? I'm trying to replicate this on my end.
Thanks!
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: slack.pl Author and Comments for Acknowledgement/Add Com
Hi @fullsail,
After researching this a little more, I believe the app in Slack is not set up to take those extra fields and that's why it's showing up when you concatenate the variables into the existing field.
After researching this a little more, I believe the app in Slack is not set up to take those extra fields and that's why it's showing up when you concatenate the variables into the existing field.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: slack.pl Author and Comments for Acknowledgement/Add Com
I believe you are correct, It would be a nice feature to be able to get more information into slack like author/comments when acknowledging an issue, sending a custom notification, adding a comment, etc. as it does with the email notifications. Thanks for looking into this we will keep the configuration as it currently is since it's not possible.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: slack.pl Author and Comments for Acknowledgement/Add Com
Hi @fullsail,
Benjamin
No problem. Let me know if it's ok to close this thread or if you have any other questions.Thanks for looking into this we will keep the configuration as it currently is since it's not possible
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!