Email Notification - Is there a way to display the error?
-
JohnnieDaimler
- Posts: 7
- Joined: Wed Aug 02, 2017 8:38 am
Email Notification - Is there a way to display the error?
I want my email notification to display the error it finds. Is there a way?
Re: Email Notification - Is there a way to display the error
You would have to edit the command definition associated with your notification handler. This documentation describes all the macros you will have available for Host Notifications and Service Notifications:
https://assets.nagios.com/downloads/nag ... olist.html
You might find the documentation for these macros particularly relevant as they give the output of the plugin associated with the host/service:
In my mind, you could just append the $SERVICEOUTPUT$ or $HOSTOUTPUT$ to your message body.
https://assets.nagios.com/downloads/nag ... olist.html
You might find the documentation for these macros particularly relevant as they give the output of the plugin associated with the host/service:
Code: Select all
$SERVICEOUTPUT$
$LONGSERVICEOUTPUT$
$HOSTOUTPUT$
$LONGHOSTOUTPUT$Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Email Notification - Is there a way to display the error
Thanks for the assist, @mcapra! OP, let us know if you need further assistance.
Former Nagios employee
-
JohnnieDaimler
- Posts: 7
- Joined: Wed Aug 02, 2017 8:38 am
Re: Email Notification - Is there a way to display the error
I already attached the SERVICEOUTPUT macro. I'm getting the following on my email body.
WARNING - (1 warnings) - 08-01 20:36:37.553
I want a more detailed message of the error. Is there a way to edit the SERVICEOUTPUT response to display what the warning is? Note, that I'm scanning a .log file searching for an err pattern.
WARNING - (1 warnings) - 08-01 20:36:37.553
I want a more detailed message of the error. Is there a way to edit the SERVICEOUTPUT response to display what the warning is? Note, that I'm scanning a .log file searching for an err pattern.
Re: Email Notification - Is there a way to display the error
Try $LONGSERVICEOUTPUT$. Those macros only return whatever the plugin your check uses returned to stdout. If your plugin isn't returning specific enough data, there's no modification that can be made to the macro to work around that.JohnnieDaimler wrote: I want a more detailed message of the error. Is there a way to edit the SERVICEOUTPUT response to display what the warning is?.
If that doesn't give you what you're looking for, can you share the output of your check command executed from the CLI of your Nagios Core machine?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
JohnnieDaimler
- Posts: 7
- Joined: Wed Aug 02, 2017 8:38 am
Re: Email Notification - Is there a way to display the error
I attached the command as a screenshot. I'm getting a nothing back on the LONGSERVICEOUT marco
-
JohnnieDaimler
- Posts: 7
- Joined: Wed Aug 02, 2017 8:38 am
Re: Email Notification - Is there a way to display the error
I'm guessing there isn't a way to attach the log file to the email is there?
Re: Email Notification - Is there a way to display the error
I'm actually looking for the command that produces this output:
Not the command you are using for your notifications. Again, the various OUTPUT macros rely completely and entirely on what the plugin gives you, so it's valuable to know what, if anything, a given plugin produces.
For example, here's the output for an execution of the check_http plugin:
If I were to include this plugin in a service definition as part of it's check_command, I would expect notifications for this service to have $SERVICEOUTPUT$ return something like the following:
Code: Select all
WARNING - (1 warnings) - 08-01 20:36:37.553For example, here's the output for an execution of the check_http plugin:
Code: Select all
[root@nagios ~]# /usr/local/nagios/libexec/check_http -H www.google.com
HTTP OK: HTTP/1.1 200 OK - 11974 bytes in 0.086 second response time |time=0.085856s;;;0.000000 size=11974B;;;0Code: Select all
HTTP OK: HTTP/1.1 200 OK - 11974 bytes in 0.086 second response time Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
JohnnieDaimler
- Posts: 7
- Joined: Wed Aug 02, 2017 8:38 am
Re: Email Notification - Is there a way to display the error
Ok, where would I find out what plugin the service uses?
-
JohnnieDaimler
- Posts: 7
- Joined: Wed Aug 02, 2017 8:38 am
Re: Email Notification - Is there a way to display the error
I believe that this service is using the check_nrpe plugin....note that I didn't create all the commands and services