1 |
# |
2 |
# The hobbit-alerts.cfg file controls who receives alerts |
3 |
# when a status in the BB system goes into a critical |
4 |
# state (usually: red, yellow or purple). |
5 |
# |
6 |
# This file is made up from RULES and RECIPIENTS. |
7 |
# |
8 |
# A RULE is a filter made from the PAGE where a host |
9 |
# is located in BB; the HOST name, the SERVICE name, |
10 |
# the COLOR of the status, the TIME of day, and the |
11 |
# DURATION of the event. |
12 |
# |
13 |
# A RECIPIENT can be a MAIL address, or a SCRIPT. |
14 |
# |
15 |
# Recipients can also have rules associated with them, |
16 |
# that modify the rules for a single recipient, e.g. |
17 |
# you can define a rule for alerting, then add an |
18 |
# extra criteria e.g. so a single recipient does not get |
19 |
# alerted until after 20 minutes. |
20 |
# |
21 |
# A sample rule: |
22 |
# |
23 |
# HOST=www.foo.com SERVICE=http |
24 |
# MAIL webadmin@foo.com REPEAT=20 RECOVERED |
25 |
# MAIL cio@foo.com DURATION>60 COLOR=red |
26 |
# SCRIPT /usr/local/bin/sendsms 1234567890 FORMAT=SMS |
27 |
# |
28 |
# The first line sets up a rule that catches alerts |
29 |
# for the host "www.foo.com" and the "http" service. |
30 |
# There are three recipients for these alerts: The first |
31 |
# one is the "webadmin@foo.com" - they get alerted |
32 |
# immediately when the status goes into an alert state, |
33 |
# and the alert is repeated every 20 minutes until it |
34 |
# recovers. When it recovers, a message is sent about |
35 |
# the recovery. |
36 |
# |
37 |
# The second recipient is "cio@foo.com". He gets alerted |
38 |
# only when the service goes "red" for more than 60 minutes. |
39 |
# |
40 |
# The third recipient is a script, "/usr/local/bin/sendsms". |
41 |
# The real recipient is "1234567890", but it is handled |
42 |
# by the script - the script receives a set of environment |
43 |
# variables with the details about the alert, including the |
44 |
# real recipient. The alert message is preformatted for |
45 |
# an SMS recipient. |
46 |
# |
47 |
# You can use Perl-compatible "regular expressions" for |
48 |
# the PAGE, HOST and SERVICE definitions, by putting a "%" |
49 |
# in front of the regex. E.g. |
50 |
# |
51 |
# HOST=%^www.* |
52 |
# MAIL webadmin@foo.com EXHOST=www.testsite.foo.com |
53 |
# |
54 |
# This sets up a rule so that alerts from any hostname |
55 |
# beginning with "www" goes to "webadmin@foo.com", EXCEPT |
56 |
# alerts from "www.testsite.foo.com" |
57 |
# |
58 |
# The following keywords are recognized: |
59 |
# PAGE - rule matching an alert by the name of the |
60 |
# page in BB. This is the name following |
61 |
# the "page", "subpage" or "subparent" keyword |
62 |
# in the bb-hosts file. |
63 |
# EXPAGE - rule excluding an alert if the pagename matches. |
64 |
# HOST - rule matching an alert by the hostname. |
65 |
# EXHOST - rule excluding an alert by matching the hostname. |
66 |
# SERVICE - rule matching an alert by the service name. |
67 |
# EXSERVICE - rule excluding an alert by matching the hostname. |
68 |
# GROUP - rule matching an alert by the group ID. |
69 |
# (Group ID's are associated with a status through the |
70 |
# hobbit-clients.cfg configuration). |
71 |
# EXGROUP - rule excluding an alert by matching the group ID. |
72 |
# COLOR - rule matching an alert by color. Can be "red", |
73 |
# "yellow", or "purple". |
74 |
# TIME - rule matching an alert by the time-of-day. This |
75 |
# is specified as the DOWNTIME timespecification |
76 |
# in the bb-hosts file (see bb-hosts(5)). |
77 |
# DURATION - Rule matcing an alert if the event has lasted |
78 |
# longer/shorter than the given duration. E.g. |
79 |
# DURATION>10 (lasted longer than 10 minutes) or |
80 |
# DURARION<30 (only sends alerts the first 30 minutes). |
81 |
# RECOVERED - Rule matches if the alert has recovered from an |
82 |
# alert state. |
83 |
# NOTICE - Rule matches if the message is a "notify" message |
84 |
# (typically sent when a status is enabled or disabled). |
85 |
# MAIL - Recipient who receives an e-mail alert. This takes |
86 |
# one parameter, the e-mail address. |
87 |
# SCRIPT - Recipient that invokes a script. This takes two |
88 |
# parameters: The script filename, and the recipient |
89 |
# that gets passed to the script. |
90 |
# FORMAT - format of the text message with the alert. Default |
91 |
# is "TEXT" (suitable for e-mail alerts). "SMS" is |
92 |
# a short message with no subject for SMS alerts. |
93 |
# "SCRIPT" is a brief message template for scripts. |
94 |
# REPEAT - How often an alert gets repeated, in minutes. |
95 |
# STOP - Valid for a recipient: If this recipient gets an |
96 |
# alert, recipients further down in hobbit-alerts.cfg |
97 |
# are ignored. |
98 |
# UNMATCHED - Matches if no alerts have been sent so far. |
99 |
# |
100 |
# |
101 |
# Script get the following environment variables pre-defined so |
102 |
# that they can send a meaningful alert: |
103 |
# |
104 |
# BBCOLORLEVEL - The color of the alert: "red", "yellow" or "purple" |
105 |
# BBALPHAMSG - The full text of the status log triggering the alert |
106 |
# ACKCODE - The "cookie" that can be used to acknowledge the alert |
107 |
# RCPT - The recipient, from the SCRIPT entry |
108 |
# BBHOSTNAME - The name of the host that the alert is about |
109 |
# MACHIP - The IP-address of the host that has a problem |
110 |
# BBSVCNAME - The name of the service that the alert is about |
111 |
# BBSVCNUM - The numeric code for the service. From SVCCODES definition. |
112 |
# BBHOSTSVC - HOSTNAME.SERVICE that the alert is about. |
113 |
# BBHOSTSVCCOMMAS - As BBHOSTSVC, but dots in the hostname replaced with commas |
114 |
# BBNUMERIC - A 22-digit number made by BBSVCNUM, MACHIP and ACKCODE. |
115 |
# RECOVERED - Is "1" if the service has recovered. |
116 |
# DOWNSECS - Number of seconds the service has been down. |
117 |
# DOWNSECSMSG - When recovered, holds the text "Event duration : N" where |
118 |
# N is the DOWNSECS value. |
119 |
|
120 |
<% |
121 |
builder = ['jonund','ecosse','rabbit'] |
122 |
builders = builder.map{|x| x + "." + domain }.join(',') |
123 |
%> |
124 |
HOST=<%= builders %> SERVICE=cpu |
125 |
MAIL=sysadmin-reports@ml.<%= domain %> DURATION>6h RECOVERED NOTICE REPEAT=3h STOP |
126 |
|
127 |
HOST=%.*.<%= domain %> |
128 |
MAIL=sysadmin-reports@ml.<%= domain %> DURATION>5 RECOVERED NOTICE REPEAT=3h |