/usr/share/check_mk/web/plugins/wato/notifications.py is in check-mk-multisite 1.2.8p16-1ubuntu0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | #!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# tails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
register_notification_parameters(
"mail",
Dictionary(
elements = [
( "from",
TextAscii(
title = _("From: Address"),
size = 40,
allow_empty = False,
)
),
( "reply_to",
TextAscii(
title = _("Reply-To: Address"),
size = 40,
allow_empty = False,
)
),
( "host_subject",
TextUnicode(
title = _("Subject for host notifications"),
help = _("Here you are allowed to use all macros that are defined in the "
"notification context."),
default_value = "Check_MK: $HOSTNAME$ - $EVENT_TXT$",
size = 64,
)
),
( "service_subject",
TextUnicode(
title = _("Subject for service notifications"),
help = _("Here you are allowed to use all macros that are defined in the "
"notification context."),
default_value = "Check_MK: $HOSTNAME$/$SERVICEDESC$ $EVENT_TXT$",
size = 64,
)
),
( "elements",
ListChoice(
title = _("Information to be displayed in the email body"),
choices = [
( "address", _("IP Address of Host") ),
( "abstime", _("Absolute Time of Alert") ),
( "reltime", _("Relative Time of Alert") ),
( "longoutput", _("Additional Plugin Output") ),
( "ack_author", _("Acknowledgement Author") ),
( "ack_comment", _("Acknowledgement Comment") ),
( "perfdata", _("Performance Data") ),
( "graph", _("Performance Graphs") ),
( "notesurl", _("Custom Host/Service Notes URL") ),
( "context", _("Complete variable list (for testing)" ) ),
],
default_value = [ "perfdata", "graph", "abstime", "address", "longoutput" ],
)
),
( "url_prefix",
TextAscii(
title = _("URL prefix for links to Check_MK"),
help = _("If you specify an URL prefix here, then several parts of the "
"email body are armed with hyperlinks to your Check_MK GUI, so "
"that the recipient of the email can directly visit the host or "
"service in question in Check_MK. Specify an absolute URL including "
"the <tt>.../check_mk/</tt>"),
regex = "^(http|https)://.*/check_mk/$",
regex_error = _("The URL must begin with <tt>http</tt> or "
"<tt>https</tt> and end with <tt>/check_mk/</tt>."),
size = 64,
default_value = "http://" + socket.gethostname() + "/" + (
defaults.omd_site and defaults.omd_site + "/" or "") + "check_mk/",
)
),
( "no_floating_graphs",
FixedValue(
True,
title = _("Display graphs among each other"),
totext = _("Graphs are shown among each other"),
help = _("By default all multiple graphs in emails are displayed floating "
"nearby. You can enable this option to show the graphs among each "
"other."),
)
),
('bulk_sort_order',
DropdownChoice(
choices = [
('oldest_first', _('Oldest first')),
('newest_first', _('Newest first')),
],
help = _("With this option you can specify, whether the oldest (default) or "
"the newest notification should get shown at the top of the notification mail."),
title = _("Notification sort order for bulk notifications"),
default = "oldest_first"
)
)
]
)
)
register_notification_parameters(
"asciimail",
Dictionary(
elements = [
( "from",
EmailAddress(
title = _("From: Address"),
size = 40,
allow_empty = False,
)
),
( "reply_to",
EmailAddress(
title = _("Reply-To: Address"),
size = 40,
allow_empty = False,
)
),
( "host_subject",
TextUnicode(
title = _("Subject for host notifications"),
help = _("Here you are allowed to use all macros that are defined in the "
"notification context."),
default_value = "Check_MK: $HOSTNAME$ - $EVENT_TXT$",
size = 64,
)
),
( "service_subject",
TextUnicode(
title = _("Subject for service notifications"),
help = _("Here you are allowed to use all macros that are defined in the "
"notification context."),
default_value = "Check_MK: $HOSTNAME$/$SERVICEDESC$ $EVENT_TXT$",
size = 64,
)
),
( "common_body",
TextAreaUnicode(
title = _("Body head for both host and service notifications"),
rows = 7,
cols = 58,
monospaced = True,
default_value =
"""Host: $HOSTNAME$
Alias: $HOSTALIAS$
Address: $HOSTADDRESS$
""",
)
),
( "host_body",
TextAreaUnicode(
title = _("Body tail for host notifications"),
rows = 9,
cols = 58,
monospaced = True,
default_value =
"""Event: $EVENT_TXT$
Output: $HOSTOUTPUT$
Perfdata: $HOSTPERFDATA$
$LONGHOSTOUTPUT$
""",
)
),
( "service_body",
TextAreaUnicode(
title = _("Body tail for service notifications"),
rows = 11,
cols = 58,
monospaced = True,
default_value =
"""Service: $SERVICEDESC$
Event: $EVENT_TXT$
Output: $SERVICEOUTPUT$
Perfdata: $SERVICEPERFDATA$
$LONGSERVICEOUTPUT$
""",
)
),
('bulk_sort_order',
DropdownChoice(
choices = [
('oldest_first', _('Oldest first')),
('newest_first', _('Newest first')),
],
help = _("With this option you can specify, whether the oldest (default) or "
"the newest notification should get shown at the top of the notification mail."),
title = _("Notification sort order for bulk notifications"),
default = "oldest_first"
)
)
]
)
)
register_notification_parameters(
"mkeventd",
Dictionary(
elements = [
( "facility",
DropdownChoice(
title = _("Syslog Facility to use"),
help = _("The notifications will be converted into syslog messages with "
"the facility that you choose here. In the Event Console you can "
"later create a rule matching this facility."),
choices = syslog_facilities,
)
),
( "remote",
IPv4Address(
title = _("IP Address of remote Event Console"),
help = _("If you set this parameter then the notifications will be sent via "
"syslog/UDP (port 514) to a remote Event Console or syslog server."),
)
),
]
)
)
register_notification_parameters(
"spectrum",
Dictionary(
optional_keys = None,
elements = [
( "destination",
IPv4Address(
title = _("Destination IP"),
help = _("IP Address of the Spectrum server receiving the SNMP trap")
),
),
( "community",
Password(
title = _("SNMP Community"),
help = _("SNMP Community for the SNMP trap")
)
),
( "baseoid",
TextAscii(
title = _("Base OID"),
help = _("The base OID for the trap content"),
default_value = "1.3.6.1.4.1.1234"
),
),
]
)
)
register_notification_parameters("pushover", Dictionary(
optional_keys = ["url_prefix", "priority"],
elements = [
("api_key", TextAscii(
title = _("API Key"),
help = _("You need to provide a valid API key to be able to send push notifications "
"using Pushover. Register and login to <a href=\"https://www.pushover.net\" "
"target=\"_blank\">Pushover</a>, thn create your Check_MK installation as "
"application and obtain your API key."),
size = 40,
allow_empty = False,
regex = "[a-zA-Z0-9]{30}",
)),
("recipient_key", TextAscii(
title = _("User / Group Key"),
help = _("Configure the user or group to receive the notifications by providing "
"the user or group key here. The key can be obtained from the Pushover "
"website."),
size = 40,
allow_empty = False,
regex = "[a-zA-Z0-9]{30}",
)),
("url_prefix", TextAscii(
title = _("URL prefix for links to Check_MK"),
help = _("If you specify an URL prefix here, then several parts of the "
"email body are armed with hyperlinks to your Check_MK GUI, so "
"that the recipient of the email can directly visit the host or "
"service in question in Check_MK. Specify an absolute URL including "
"the <tt>.../check_mk/</tt>"),
regex = "^(http|https)://.*/check_mk/$",
regex_error = _("The URL must begin with <tt>http</tt> or "
"<tt>https</tt> and end with <tt>/check_mk/</tt>."),
size = 64,
default_value = "http://" + socket.gethostname() + "/" + (
defaults.omd_site and defaults.omd_site + "/" or "") + "check_mk/",
)),
("priority", DropdownChoice(
title = _("Priority"),
choices = [
("1", _("High: Push notification alerts bypass quiet hours")),
("0", _("Normal: Regular push notification (default)")),
("-1", _("Low: No sound/vibration but show popup")),
("-2", _("Lowest: No notification, update badge number")),
],
default_value = "0",
)),
]
))
|