How to Alert using 'Execute Script' feature?

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
cowboyrx
Posts: 2
Joined: Wed Aug 26, 2015 3:11 pm

How to Alert using 'Execute Script' feature?

Post by cowboyrx »

Are there any sample scripts available and any documentation on how to use this feature, such as which variables that can be used for alerting?
Goal is to send an email/sms alert that contains the message, logsource, timestamp, etc that triggered the alert. The default 'email users' option is very generic and makes the recipient log into the dashboard to look at the alert.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: How to Alert using 'Execute Script' feature?

Post by jolson »

cowboyrx,

This is one of our most highly requested features - and one that there is a feature request in place for. Our macros currently support only what you see in the email, and are as follows:
count - The total # of events
status - The status (ok, warning, critical)
output - The output from the alert
lastrun - The timestamp of the last run
What would you like to see specifically? I assume you'd like to bind macros to particular fields in Nagios Log Server? For instance:

fieldhost - The value of the 'host' field.
fieldip - The value of the 'ip' field.
etc.

Is my above statement accurate?
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
cowboyrx
Posts: 2
Joined: Wed Aug 26, 2015 3:11 pm

Re: How to Alert using 'Execute Script' feature?

Post by cowboyrx »

Need the following:
1. Sample scripts and documentation on how to use this feature
2. Future release/update should provide an option to include all fields (message, logsource, program, timestamp, etc) that triggered the alert, so the alerted email recipient does not have to log into the dashboard to view the alert.

When is the ETA on the feature update/next release?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: How to Alert using 'Execute Script' feature?

Post by tmcdonald »

cowboyrx wrote:1. Sample scripts and documentation on how to use this feature
The scripts can be anything you want, whether it's bash, perl, python, compiled C, or just about anything else you can think of. We don't have any sample scripts for this, because there really are not many limitations on what can be done - if you can script it, you can run it. As far as documentation goes, it is covered somewhat in this doc:

https://assets.nagios.com/downloads/nag ... Server.pdf

cowboyrx wrote:2. Future release/update should provide an option to include all fields (message, logsource, program, timestamp, etc) that triggered the alert, so the alerted email recipient does not have to log into the dashboard to view the alert.

When is the ETA on the feature update/next release?
This is definitely on our radar, however I don't have an ETA for this specific request, nor for the next Logserver release. The release cycle is up to the developers, and we don't have any control over that.
Former Nagios employee
Locked