]> arthur.barton.de Git - netdata.git/blob - plugins.d/alarm-notify.sh
Merge pull request #960 from ktsaou/master
[netdata.git] / plugins.d / alarm-notify.sh
1 #!/usr/bin/env bash
2
3 # (C) Costa Tsaousis
4 # pushover support by Jan Arnold
5
6 me="${0}"
7
8 if [ $(( ${BASH_VERSINFO[0]} )) -lt 4 ]
9 then
10     echo >&2
11     echo >&2 "$me: ERROR"
12     echo >&2 "BASH version 4 or later is required."
13     echo >&2 "You are running version: ${BASH_VERSION}"
14     echo >&2 "Please upgrade."
15     echo >&2
16     exit 1
17 fi
18
19 # -----------------------------------------------------------------------------
20 # parse command line parameters
21
22 recipient="${1}"   # the recepient of the email
23 host="${2}"        # the host this event refers to
24 unique_id="${3}"   # the unique id of this event
25 alarm_id="${4}"    # the unique id of the alarm that generated this event
26 event_id="${5}"    # the incremental id of the event, for this alarm
27 when="${6}"        # the timestamp this event occured
28 name="${7}"        # the name of the alarm, as given in netdata health.d entries
29 chart="${8}"       # the name of the chart (type.id)
30 family="${9}"      # the family of the chart
31 status="${10}"     # the current status : REMOVED, UNITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
32 old_status="${11}" # the previous status: REMOVED, UNITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
33 value="${12}"      # the current value
34 old_value="${13}"  # the previous value
35 src="${14}"        # the line number and file the alarm has been configured
36 duration="${15}"   # the duration in seconds the previous state took
37 non_clear_duration="${16}" # the total duration in seconds this is non-clear
38 units="${17}"      # the units of the value
39 info="${18}"       # a short description of the alarm
40
41 # -----------------------------------------------------------------------------
42 # screen statuses we don't need to send a notification
43
44 # don't do anything if this is not WARNING, CRITICAL or CLEAR
45 if [ "${status}" != "WARNING" -a "${status}" != "CRITICAL" -a "${status}" != "CLEAR" ]
46 then
47     echo >&2 "${me}: not sending notification for ${status} on '${chart}.${name}'"
48     exit 1
49 fi
50
51 # don't do anything if this is CLEAR, but it was not WARNING or CRITICAL
52 if [ "${old_status}" != "WARNING" -a "${old_status}" != "CRITICAL" -a "${status}" = "CLEAR" ]
53 then
54     echo >&2 "${me}: not sending notification for ${status} on '${chart}.${name}' (last status was ${old_status})"
55     exit 1
56 fi
57
58 # -----------------------------------------------------------------------------
59 # load configuration
60
61 # this is defined here so that private registries
62 # can setup their own
63 # images_base_url="${NETDATA_REGISTRY_URL}"
64 images_base_url="https://registry.my-netdata.io"
65
66 # needed commands
67 # if empty they will be searched in the system path
68 curl=
69 sendmail=
70
71 # enable / disable features
72 SEND_SLACK="YES"
73 SEND_PUSHOVER="YES"
74 SEND_EMAIL="YES"
75
76 # slack configs
77 SLACK_WEBHOOK_URL=
78 DEFAULT_RECIPIENT_SLACK=
79 declare -A role_recipients_slack=()
80
81 # pushover configs
82 PUSHOVER_APP_TOKEN=
83 DEFAULT_RECIPIENT_PUSHOVER=
84 declare -A role_recipients_pushover=()
85
86 # email configs
87 DEFAULT_RECIPIENT_EMAIL="root"
88 declare -A role_recipients_email=()
89
90 # load the user configuration
91 # this will overwrite the variables above
92 if [ -f "${NETDATA_CONFIG_DIR}/health_alarm_notify.conf" ]
93     then
94     source "${NETDATA_CONFIG_DIR}/health_alarm_notify.conf"
95 fi
96
97 # -----------------------------------------------------------------------------
98 # find the recipient's addresses per method
99
100 declare -A arr_slack=()
101 declare -A arr_pushover=()
102 declare -A arr_email=()
103
104 # netdata may call us with multiple recipients
105 # so, here we find the unique ones
106 for x in ${recipient//,/ }
107 do
108     # email
109     a="${role_recipients_email[${recipient}]}"
110     [ -z "${a}" ] && a="${DEFAULT_RECIPIENT_EMAIL}"
111     for r in ${a//,/ }; do arr_email[${r}]="1"; done
112
113     # pushover
114     a="${role_recipients_pushover[${recipient}]}"
115     [ -z "${a}" ] && a="${DEFAULT_RECIPIENT_PUSHOVER}"
116     for r in ${a//,/ }; do arr_pushover[${r}]="1"; done
117
118     # slack
119     a="${role_recipients_slack[${recipient}]}"
120     [ -z "${a}" ] && a="${DEFAULT_RECIPIENT_SLACK}"
121     for r in ${a//,/ }; do arr_slack[${r}]="1"; done
122 done
123
124 # build the list of slack recipients (channels)
125 to_slack="${!arr_slack[*]}"
126 [ -z "${to_slack}" ] && SEND_SLACK="NO"
127
128 # build the list of pushover recipients (user tokens)
129 to_pushover="${!arr_pushover[*]}"
130 [ -z "${to_pushover}" ] && SEND_PUSHOVER="NO"
131
132 # build the list of email recipients (email addresses)
133 to_email=
134 for x in "${!arr_email[@]}"
135 do
136     [ ! -z "${to_email}" ] && to_email="${to_email}, "
137     to_email="${to_email}${x}"
138 done
139 [ -z "${to_email}" ] && to_email="root"
140
141
142 # -----------------------------------------------------------------------------
143 # verify the delivery methods supported
144
145 # check slack
146 [ -z "${SLACK_WEBHOOK_URL}" ] && SEND_SLACK="NO"
147
148 # check pushover
149 [ -z "${PUSHOVER_APP_TOKEN}" ] && SEND_PUSHOVER="NO"
150
151 if [ \( "${SEND_PUSHOVER}" = "YES" -o "${SEND_SLACK}" = "YES" \) -a -z "${curl}" ]
152     then
153     curl="$(which curl 2>/dev/null || command -v curl 2>/dev/null)"
154     if [ -z "${curl}" ]
155         then
156         SEND_PUSHOVER="NO"
157         SEND_SLACK="NO"
158     fi
159 fi
160
161 if [ "${SEND_EMAIL}" = "YES" -a -z "${sendmail}" ]
162     then
163     sendmail="$(which sendmail 2>/dev/null || command -v sendmail 2>/dev/null)"
164     [ -z "${sendmail}" ] && SEND_EMAIL="NO"
165 fi
166
167 # check that we have at least a method enabled
168 if [ "${SEND_EMAIL}" != "YES" -a "${SEND_PUSHOVER}" != "YES" -a "${SEND_SLACK}" != "YES" ]
169     then
170     echo >&2 "I don't have a means to send a notification. Sorry!"
171     exit 1
172 fi
173
174 # -----------------------------------------------------------------------------
175 # get the system hostname
176
177 [ -z "${host}" ] && host="${NETDATA_HOSTNAME}"
178 [ -z "${host}" ] && host="${NETDATA_REGISTRY_HOSTNAME}"
179 [ -z "${host}" ] && host="$(hostname 2>/dev/null)"
180
181 # -----------------------------------------------------------------------------
182 # get the date the alarm happened
183
184 date="$(date --date=@${when} 2>/dev/null)"
185 [ -z "${date}" ] && date="$(date 2>/dev/null)"
186
187 # -----------------------------------------------------------------------------
188 # URL encode a string
189
190 urlencode() {
191     local string="${1}" strlen encoded pos c o
192
193     strlen=${#string}
194     for (( pos=0 ; pos<strlen ; pos++ ))
195     do
196         c=${string:$pos:1}
197         case "$c" in
198             [-_.~a-zA-Z0-9])
199                 o="${c}"
200                 ;;
201
202             *)
203                 printf -v o '%%%02x' "'$c"
204                 ;;
205         esac
206         encoded+="${o}"
207     done
208
209     REPLY="${encoded}"
210     echo "${REPLY}"
211 }
212
213 # -----------------------------------------------------------------------------
214 # convert a duration in seconds, to a human readable duration
215 # using DAYS, MINUTES, SECONDS
216
217 duration4human() {
218     local s="${1}" d=0 h=0 m=0 ds="day" hs="hour" ms="minute" ss="second" ret
219     d=$(( s / 86400 ))
220     s=$(( s - (d * 86400) ))
221     h=$(( s / 3600 ))
222     s=$(( s - (h * 3600) ))
223     m=$(( s / 60 ))
224     s=$(( s - (m * 60) ))
225
226     if [ ${d} -gt 0 ]
227     then
228         [ ${m} -ge 30 ] && h=$(( h + 1 ))
229         [ ${d} -gt 1 ] && ds="days"
230         [ ${h} -gt 1 ] && hs="hours"
231         if [ ${h} -gt 0 ]
232         then
233             ret="${d} ${ds} and ${h} ${hs}"
234         else
235             ret="${d} ${ds}"
236         fi
237     elif [ ${h} -gt 0 ]
238     then
239         [ ${s} -ge 30 ] && m=$(( m + 1 ))
240         [ ${h} -gt 1 ] && hs="hours"
241         [ ${m} -gt 1 ] && ms="minutes"
242         if [ ${m} -gt 0 ]
243         then
244             ret="${h} ${hs} and ${m} ${ms}"
245         else
246             ret="${h} ${hs}"
247         fi
248     elif [ ${m} -gt 0 ]
249     then
250         [ ${m} -gt 1 ] && ms="minutes"
251         [ ${s} -gt 1 ] && ss="seconds"
252         if [ ${s} -gt 0 ]
253         then
254             ret="${m} ${ms} and ${s} ${ss}"
255         else
256             ret="${m} ${ms}"
257         fi
258     else
259         [ ${s} -gt 1 ] && ss="seconds"
260         ret="${s} ${ss}"
261     fi
262
263     REPLY="${ret}"
264     echo "${REPLY}"
265 }
266
267 # -----------------------------------------------------------------------------
268 # email sender
269
270 send_email() {
271     local ret=
272     if [ "${SEND_EMAIL}" = "YES" ]
273         then
274
275         "${sendmail}" -t
276         ret=$?
277
278         if [ $ret -eq 0 ]
279         then
280             echo >&2 "${me}: Sent email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}'"
281             return 0
282         else
283             echo >&2 "${me}: Failed to send email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}' with error code ${ret}."
284             return 1
285         fi
286     fi
287
288     return 1
289 }
290
291 # -----------------------------------------------------------------------------
292 # pushover sender
293
294 send_pushover() {
295     local apptoken="${1}" usertokens="${2}" when="${3}" url="${4}" status="${5}" title="${6}" message="${7}" httpcode sent=0 user priority
296
297     if [ "${SEND_PUSHOVER}" = "YES" -a ! -z "${apptoken}" -a ! -z "${usertokens}" -a ! -z "${title}" -a ! -z "${message}" ]
298         then
299
300         # https://pushover.net/api
301         priority=-2
302         case "${status}" in
303             CLEAR) priority=-1;;   # low priority: no sound or vibration
304             WARNING) priotity=0;;  # normal priority: respect quiet hours
305             CRITICAL) priority=1;; # high priority: bypass quiet hours
306             *) priority=-2;;       # lowest priority: no notification at all
307         esac
308
309         for user in ${usertokens}
310         do
311             httpcode=$(${curl} --write-out %{http_code} --silent --output /dev/null \
312                 --form-string "token=${apptoken}" \
313                 --form-string "user=${user}" \
314                 --form-string "html=1" \
315                 --form-string "title=${title}" \
316                 --form-string "message=${message}" \
317                 --form-string "timestamp=${when}" \
318                 --form-string "url=${url}" \
319                 --form-string "url_title=Open netdata dashboard to view the alarm" \
320                 --form-string "priority=${priority}" \
321                 https://api.pushover.net/1/messages.json)
322
323             if [ "${httpcode}" == "200" ]
324             then
325                 echo >&2 "${me}: Sent pushover notification for: ${host} ${chart}.${name} is ${status} to '${user}'"
326                 sent=$((sent + 1))
327             else
328                 echo >&2 "${me}: Failed to send pushover notification for: ${host} ${chart}.${name} is ${status} to '${user}' with HTTP error code ${httpcode}."
329             fi
330         done
331
332         [ ${sent} -gt 0 ] && return 0
333     fi
334
335     return 1
336 }
337
338 # -----------------------------------------------------------------------------
339 # slack sender
340
341 send_slack() {
342     local webhook="${1}" channels="${2}" when="${3}" username="${4}" image="${5}" author="${6}" httpcode sent=0 channel color
343
344     if [ "${SEND_SLACK}" = "YES" -a ! -z "${webhook}" -a ! -z "${channels}" -a ! -z "${username}" -a ! -z "${image}" -a ! -z "${author}" ]
345         then
346
347         case "${status}" in
348             WARNING) color="warning" ;;
349             CRITICAL) color="danger" ;;
350             CLEAR) color="good" ;;
351             *) color="#777777" ;;
352         esac
353
354         for channel in ${channels}
355         do
356             httpcode=$(${curl} --write-out %{http_code} --silent --output /dev/null -X POST --data-urlencode \
357                 "payload={\"channel\": \"#${channel}\", \"username\": \"${username}\", \"text\": \"${host} ${status_message} - ${author} ${raised_for} - click <${goto_url}|here> to view the netdata dashboard.\", \"icon_url\": \"${image}\", \"attachments\": [{\"fallback\": \"${alarm} - ${info}\", \"color\": \"${color}\", \"title\": \"${alarm}\", \"title_link\": \"${goto_url}\", \"text\": \"${info}\", \"footer\": \"netdata\", \"footer_icon\": \"${images_base_url}/images/seo-performance-128.png\", \"ts\": ${when}}]}" \
358                 "${webhook}")
359
360             if [ "${httpcode}" == "200" ]
361             then
362                 echo >&2 "${me}: Sent slack notification for: ${host} ${chart}.${name} is ${status} to '${channel}'"
363                 sent=$((sent + 1))
364             else
365                 echo >&2 "${me}: Failed to send slack notification for: ${host} ${chart}.${name} is ${status} to '${channel}', with HTTP error code ${httpcode}."
366             fi
367         done
368
369         [ ${sent} -gt 0 ] && return 0
370     fi
371
372     return 1
373 }
374
375
376 # -----------------------------------------------------------------------------
377 # prepare the content of the notification
378
379 # the url to send the user on click
380 urlencode "${NETDATA_REGISTRY_HOSTNAME}" >/dev/null; url_host="${REPLY}"
381 urlencode "${chart}" >/dev/null; url_chart="${REPLY}"
382 urlencode "${family}" >/dev/null; url_family="${REPLY}"
383 urlencode "${name}" >/dev/null; url_name="${REPLY}"
384 goto_url="${NETDATA_REGISTRY_URL}/goto-host-from-alarm.html?host=${url_host}&chart=${url_chart}&family=${url_family}&alarm=${url_name}&alarm_unique_id=${unique_id}&alarm_id=${alarm_id}&alarm_event_id=${event_id}"
385
386 # the severity of the alarm
387 severity="${status}"
388
389 # the time the alarm was raised
390 duration4human ${duration} >/dev/null; duration_txt="${REPLY}"
391 duration4human ${non_clear_duration} >/dev/null; non_clear_duration_txt="${REPLY}"
392 raised_for="(was ${old_status,,} for ${duration_txt}"
393
394 # the key status message
395 status_message="status unknown"
396
397 # the color of the alarm
398 color="grey"
399
400 # the alarm value
401 alarm="${name//_/ } = ${value} ${units}"
402
403 # the image of the alarm
404 image="${images_base_url}/images/seo-performance-128.png"
405
406 # prepare the title based on status
407 case "${status}" in
408         CRITICAL)
409         image="${images_base_url}/images/alert-128-red.png"
410         status_message="is critical"
411         color="#ca414b"
412         ;;
413
414     WARNING)
415         image="${images_base_url}/images/alert-128-orange.png"
416         status_message="needs attention"
417         color="#caca4b"
418                 ;;
419
420         CLEAR)
421         image="${images_base_url}/images/check-mark-2-128-green.png"
422         status_message="recovered"
423                 color="#77ca6d"
424
425                 # don't show the value when the status is CLEAR
426                 # for certain alarms, this value might not have any meaning
427                 alarm="${name//_/ }"
428                 ;;
429 esac
430
431 if [ "${status}" = "CLEAR" ]
432 then
433     severity="Recovered from ${old_status}"
434     if [ $non_clear_duration -gt $duration ]
435     then
436         raised_for="(alarm was raised for ${non_clear_duration_txt})"
437     fi
438
439 elif [ "${old_status}" = "WARNING" -a "${status}" = "CRITICAL" ]
440 then
441     severity="Escalated to ${status}"
442     if [ $non_clear_duration -gt $duration ]
443     then
444         raised_for="(alarm is raised for ${non_clear_duration_txt})"
445     fi
446
447 elif [ "${old_status}" = "CRITICAL" -a "${status}" = "WARNING" ]
448 then
449     severity="Demoted to ${status}"
450     if [ $non_clear_duration -gt $duration ]
451     then
452         raised_for="(alarm is raised for ${non_clear_duration_txt})"
453     fi
454
455 else
456     raised_for=
457 fi
458
459 # prepare HTML versions of elements
460 info_html=
461 [ ! -z "${info}" ] && info_html=" <small><br/>${info}</small>"
462
463 raised_for_html=
464 [ ! -z "${raised_for}" ] && raised_for_html="<br/><small>${raised_for}</small>"
465
466 # -----------------------------------------------------------------------------
467 # send the slack notification
468
469 # slack aggregates posts from the same username
470 # so we use "${host} ${status}" as the bot username, to make them diff
471
472 send_slack "${SLACK_WEBHOOK_URL}" "${to_slack}" "${when}" "${host} ${status}" "${image}" "${chart} (${family})"
473 SENT_SLACK=$?
474
475 # -----------------------------------------------------------------------------
476 # send the pushover notification
477
478 send_pushover "${PUSHOVER_APP_TOKEN}" "${to_pushover}" "${when}" "${goto_url}" "${status}" "${host} ${status_message} - ${name//_/ } - ${chart}" "
479 <font color=\"${color}\"><b>${alarm}</b></font>${info_html}<br/>&nbsp;
480 <small><b>${chart}</b><br/>Chart<br/>&nbsp;</small>
481 <small><b>${family}</b><br/>Family<br/>&nbsp;</small>
482 <small><b>${severity}</b><br/>Severity<br/>&nbsp;</small>
483 <small><b>${date}${raised_for_html}</b><br/>Time<br/>&nbsp;</small>
484 <a href=\"${goto_url}\">View Netdata</a><br/>&nbsp;
485 <small><small>The source of this alarm is line ${src}</small></small>
486 "
487
488 SENT_PUSHOVER=$?
489
490 # -----------------------------------------------------------------------------
491 # send the email
492
493 send_email <<EOF
494 To: ${to_email}
495 Subject: ${host} ${status_message} - ${name//_/ } - ${chart}
496 Content-Type: text/html
497
498 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
499 <html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;">
500 <body style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; width: 100% !important; min-height: 100%; line-height: 1.6; background: #f6f6f6; margin:0; padding: 0;">
501 <table>
502     <tbody>
503     <tr>
504         <td style="vertical-align: top;" valign="top"></td>
505         <td width="700" style="vertical-align: top; display: block !important; max-width: 700px !important; clear: both !important; margin: 0 auto; padding: 0;" valign="top">
506             <div style="max-width: 700px; display: block; margin: 0 auto; padding: 20px;">
507                 <table width="100%" cellpadding="0" cellspacing="0" style="background: #fff; border: 1px solid #e9e9e9;">
508                     <tbody>
509                     <tr>
510                         <td bgcolor="#eee" style="padding: 5px 20px 5px 20px; background-color: #eee;">
511                             <div style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 20px; color: #777; font-weight: bold;">netdata notification</div>
512                         </td>
513                     </tr>
514                     <tr>
515                         <td bgcolor="${color}" style="font-size: 16px; vertical-align: top; font-weight: 400; text-align: center; margin: 0; padding: 10px; color: #ffffff; background: ${color} !important; border: 1px solid ${color}; border-top-color: ${color};" align="center" valign="top">
516                             <h1 style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: 400; margin: 0;">${host} ${status_message}</h1>
517                         </td>
518                     </tr>
519                     <tr>
520                         <td style="vertical-align: top;" valign="top">
521                             <div style="margin: 0; padding: 20px; max-width: 700px;">
522                                 <table width="100%" cellpadding="0" cellspacing="0" style="max-width:700px">
523                                     <tbody>
524                                     <tr>
525                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 18px; vertical-align: top; margin: 0; padding:0 0 20px;" align="left" valign="top">
526                                             <span>${chart}</span>
527                                             <span style="display: block; color: #666666; font-size: 12px; font-weight: 300; line-height: 1; text-transform: uppercase;">Chart</span>
528                                         </td>
529                                     </tr>
530                                     <tr style="margin: 0; padding: 0;">
531                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 18px; vertical-align: top; margin: 0; padding: 0 0 20px;" align="left" valign="top">
532                                             <span><b>${alarm}</b>${info_html}</span>
533                                             <span style="display: block; color: #666666; font-size: 12px; font-weight: 300; line-height: 1; text-transform: uppercase;">Alarm</span>
534                                         </td>
535                                     </tr>
536                                     <tr>
537                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 18px; vertical-align: top; margin: 0; padding: 0 0 20px;" align="left" valign="top">
538                                             <span>${family}</span>
539                                             <span style="display: block; color: #666666; font-size: 12px; font-weight: 300; line-height: 1; text-transform: uppercase;">Family</span>
540                                         </td>
541                                     </tr>
542                                     <tr style="margin: 0; padding: 0;">
543                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 18px; vertical-align: top; margin: 0; padding: 0 0 20px;" align="left" valign="top">
544                                             <span>${severity}</span>
545                                             <span style="display: block; color: #666666; font-size: 12px; font-weight: 300; line-height: 1; text-transform: uppercase;">Severity</span>
546                                         </td>
547                                     </tr>
548                                     <tr style="margin: 0; padding: 0;">
549                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 18px; vertical-align: top; margin: 0; padding: 0 0 20px;" align="left" valign="top"><span>${date}</span>
550                                             <span>${raised_for_html}</span> <span style="display: block; color: #666666; font-size: 12px; font-weight: 300; line-height: 1; text-transform: uppercase;">Time</span>
551                                         </td>
552                                     </tr>
553                                     <tr style="margin: 0; padding: 0;">
554                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 18px; vertical-align: top; margin: 0; padding: 0 0 20px;">
555                                             <a href="${goto_url}" style="font-size: 14px; color: #ffffff; text-decoration: none; line-height: 1.5; font-weight: bold; text-align: center; display: inline-block; text-transform: capitalize; background: #35568d; border-width: 1px; border-style: solid; border-color: #2b4c86; margin: 0; padding: 10px 15px;" target="_blank">View Netdata</a>
556                                         </td>
557                                     </tr>
558                                     <tr style="text-align: center; margin: 0; padding: 0;">
559                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 11px; vertical-align: top; margin: 0; padding: 10px 0 0 0; color: #666666;" align="center" valign="bottom">The source of this alarm is line <code>${src}</code>
560                                         </td>
561                                     </tr>
562                                     <tr style="text-align: center; margin: 0; padding: 0;">
563                                         <td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 12px; vertical-align: top; margin:0; padding: 20px 0 0 0; color: #666666; border-top: 1px solid #f0f0f0;" align="center" valign="bottom">Sent by
564                                             <a href="https://mynetdata.io/" target="_blank">netdata</a>, the real-time performance monitoring.
565                                         </td>
566                                     </tr>
567                                     </tbody>
568                                 </table>
569                             </div>
570                         </td>
571                     </tr>
572                     </tbody>
573                 </table>
574             </div>
575         </td>
576     </tr>
577     </tbody>
578 </table>
579 </body>
580 </html>
581 EOF
582
583 SENT_EMAIL=$?
584
585 # -----------------------------------------------------------------------------
586 # let netdata know
587
588 # we did send somehting
589 [ ${SENT_EMAIL} -eq 0 -o ${SENT_PUSHOVER} -eq 0 -o ${SENT_SLACK} -eq 0 ] && exit 0
590
591 # we did not send anything
592 exit 1