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