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?
Can we pass additional description in alert for Nagios xi
-
- Posts: 105
- Joined: Thu Apr 09, 2020 7:35 am
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Can we pass additional description in alert for Nagios X
Hi @pratikmehta003,
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
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.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?
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
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!
-
- Posts: 524
- Joined: Mon Oct 14, 2013 7:19 pm
Re: Can we pass additional description in alert for Nagios X
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
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
xi 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
-
- Dreams In Code
- Posts: 7682
- Joined: Wed Feb 11, 2015 12:54 pm
Re: Can we pass additional description in alert for Nagios X
@SteveBeauchemin that is some great out-of-the-box thinking, thanks for posting that!
You could also pass in this:
But that may contain passwords/etc if they are defined in the command.
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.
-
- Posts: 105
- Joined: Thu Apr 09, 2020 7:35 am
Re: Can we pass additional description in alert for Nagios X
Hi Benjamin,
Let me go through the document and will let u know
Let me go through the document and will let u know
-
- Dreams In Code
- Posts: 7682
- Joined: Wed Feb 11, 2015 12:54 pm
Re: Can we pass additional description in alert for Nagios X
Sounds good. We'll keep an eye out for any updates.