alerting macros
list Bruce Lysik
Hi, I'm not sure if this is possible, but may be a good feature to add: I'd like to be able to define a macro which replaces several recipient lines. So for example, if many host groups always have a set of four SCRIPT recipients, it would be nice to be able to just define $STANDARDSCRIPTS at the top, and use that macro later. It seems possible to define a macro for a single recipient line, but not multiple. -- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
list Henrik Størner
▸
In <user-9658aec83bba@xymon.invalid> "Bruce Lysik" <user-4e63a10f8934@xymon.invalid> writes:
I'd like to be able to define a macro which replaces several recipient lines. So for example, if many host groups always have a set of four SCRIPT recipients, it would be nice to be able to just define $STANDARDSCRIPTS at the top, and use that macro later.
Why not simply have one script that calls the other four ?
▸
It seems possible to define a macro for a single recipient line, but not multiple.
Correct. Henrik
list Bruce Lysik
▸
I'd like to be able to define a macro which replaces several recipient lines. So for example, if many host groups always have a set of four SCRIPT recipients, it would be nice to be able to just define $STANDARDSCRIPTS at the top, and use that macro later.Why not simply have one script that calls the other four ?
Well, it's probably easier if I show you: # SCRIPT /opt/bb/server/ext/email onduty SERVICE=procs RECOVERED # SCRIPT /opt/bb/server/ext/email ops SERVICE=procs RECOVERED # SCRIPT /opt/bb/server/ext/email onduty SERVICE=http,ping DURATION>6 RECOVERED # SCRIPT /opt/bb/server/ext/email ops SERVICE=http,ping DURATION>6 RECOVERED # SCRIPT /opt/bb/server/ext/email ops EXSERVICE=procs,http,ping RECOVERED This set of recipient lines shows up often in my hobbit-alerts.cfg. I could trim it a bit if I modified the 'email' script to accept multiple addresses (5 lines to 3). A related question: If I don't define COLOR anywhere in the rule, it should by default alert on 'red', correct? -- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
list Henrik Størner
▸
On Mon, Jan 31, 2005 at 01:06:00PM -0800, Bruce Lysik wrote:
I'd like to be able to define a macro which replaces several recipient lines. So for example, if many host groups always have a set of four SCRIPT recipients, it would be nice to be able to just define $STANDARDSCRIPTS at the top, and use that macro later.Why not simply have one script that calls the other four ?Well, it's probably easier if I show you: # SCRIPT /opt/bb/server/ext/email onduty SERVICE=procs RECOVERED # SCRIPT /opt/bb/server/ext/email ops SERVICE=procs RECOVERED # SCRIPT /opt/bb/server/ext/email onduty SERVICE=http,ping DURATION>6 RECOVERED # SCRIPT /opt/bb/server/ext/email ops SERVICE=http,ping DURATION>6 RECOVERED # SCRIPT /opt/bb/server/ext/email ops EXSERVICE=procs,http,ping RECOVERED
OK, I see. You can't define multi-line macros, but as your example shows it would be useful. I'll see what I can do.
▸
A related question: If I don't define COLOR anywhere in the rule, it should by default alert on 'red', correct?
To be exact, it will alert on the colors defined with the "--alert-colors" option, but the default for that is to alert on red, yellow and purple. Henrik
list Bruce Lysik
▸
A related question: If I don't define COLOR anywhere in the rule, it should by default alert on 'red', correct?To be exact, it will alert on the colors defined with the "--alert-colors" option, but the default for that is to alert on red, yellow and purple.
Aha. That's useful. Is that a switch to hobbitd that I can add in hobbitlaunch.cfg? (I want to set it to just red and purple.) And if I do make that change, can I override it on a per alert basis with the COLOR option? Thanks! -- Bruce Z. Lysik <user-4e63a10f8934@xymon.invalid> Operations Engineer
list Henrik Størner
▸
On Tue, Feb 01, 2005 at 10:19:27AM -0800, Bruce Lysik wrote:
A related question: If I don't define COLOR anywhere in the rule, it should by default alert on 'red', correct?To be exact, it will alert on the colors defined with the "--alert-colors" option, but the default for that is to alert on red, yellow and purple.Aha. That's useful. Is that a switch to hobbitd that I can add in hobbitlaunch.cfg? (I want to set it to just red and purple.) And if I do make that change, can I override it on a per alert basis with the COLOR option?
This option exists for both hobbitd and hobbitd_alert, and yes - you do set it in the hobbitlaunch.cfg file. For hobbitd, it defines what colors of a status are sent off to the hobbitd_alert module, which handles alerts. hobbitd has both a --alertcolors option to define which colors indicate a critical state, and a --okcolors option to define which are OK. (A color can be neither an alert- nor an ok-color - e.g. you can have "red" as an alert-color, and "green" as OK, but "yellow" as neither of these, meaning that alerts will start to go out when a status goes red, but the recovery-message will only appear when it goes green - not if it only goes yellow). So for hobbitd, you must specify the --alertcolors option to include any color that you want to get alerts for. You cannot override it on a per-alert basis, because the alert module will never see e.g. a message with color "yellow", if you run hobbitd with "--alertcolors=red,purple". For hobbitd_alert, the --alertcolors option is only used to determine if an incoming message is for an alert or a recovery message. So the --alertcolors option for hobbitd and hobbitd_alert must match. Henrik