Page 1 of 1
Can we pass additional description in alert for Nagios XI
Posted: Wed Jan 20, 2021 1:20 am
by pratikmehta003
Hi There,
We have a requirement to pass additional description in the alert. We currently have the default alerting in place like this:
OK - Memory Utilization is 61 % on pmichbvsiml001.pmintl.net Memory Usage is OK
WARNING - Memory Utilization is 95 % on pmichbvshn004.pmintl.net Memory Usage is WARNING
Is there a way to pass the threshold variable which shows what is configured. Like Warning is 80% and Critical is 90%.. OR can the text be sent as hardcoded?
We need this mainly for CPU, Memory and Disk parameter so in that case how can it be mapped?
Re: Can we pass additional description in alert for Nagios X
Posted: Wed Jan 20, 2021 4:59 pm
by benjaminsmith
Hi
@pratikmehta003,
Is there a way to pass the threshold variable which shows what is configured. Like Warning is 80% and Critical is 90%.. OR can the text be sent as hardcoded?
One option here would be to add the thresholds for those checks as free variables into the service object. For example, _warning = 80% and _critical = 90, and apply these to the appropriate services. You can use the Bulk Mods Tool to apply free variables to multiple host or service objects at one time.
Then you would have to modify the notification commands and notification templates to insert these variables into the actual notifications. There are a few steps here, but it's covered in the following guide.
Nagios XI Understanding Notification Variables
To understand how custom variables work, take a look at the following Nagiso Core page:
https://assets.nagios.com/downloads/nag ... tvars.html
Let me know if you need help with anything or have more questions.
--Benjamin
Re: Can we pass additional description in alert for Nagios X
Posted: Thu Jan 21, 2021 11:35 am
by SteveBeauchemin
I have some thoughts on this as I need to also pass along extra data in the messages people get.
Look at the Misc Settings tab for your Host and Service definitions.
(I prefer using Templates actually so All host and All services inherit the definitions from one place)
Add data to the Notes field.
Using the Command definition for Notify, I have added HOSTNOTES and SERVICENOTES to the alerting definitions.
Command Name: notify-host-by-email
Command Line:
/usr/bin/printf "%b" "***** CORE03 Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n$HOSTNOTES$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
Command Name: notify-service-by-email
Command Line:
/usr/bin/printf "%b" "***** CORE03 Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n$SERVICENOTES$\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\n$LONGSERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
You can also use these variables and pass along the data. Of course you would have to teach people how to interpret the information properly.
$HOSTPERFDATA$
$SERVICEPERFDATA$
Typically the output is Semicolon delimited. First variable is the actual measurement. 2nd and 3rd variables are the Warning and Critical thresholds.
Thinking out of the box... There is no box.
Steve B
Re: Can we pass additional description in alert for Nagios X
Posted: Thu Jan 21, 2021 7:49 pm
by ssax
@SteveBeauchemin that is some great out-of-the-box thinking, thanks for posting that!
You could also pass in this:
Code: Select all
$SERVICECHECKCOMMAND$ This macro contains the name of the command (along with any arguments passed to it) used to perform the service check.
But that may contain passwords/etc if they are defined in the command.
Re: Can we pass additional description in alert for Nagios X
Posted: Thu Feb 04, 2021 11:51 pm
by pratikmehta003
Hi Benjamin,
Let me go through the document and will let u know
Re: Can we pass additional description in alert for Nagios X
Posted: Fri Feb 05, 2021 3:27 pm
by ssax
Sounds good. We'll keep an eye out for any updates.