features at the header; shorter bash version error
Costa Tsaousis (ktsaou) committed
Sep 28, 2016 at 23:45 UTC
6e8b20ae6180bf86456662f80928921cb9095a5e
1 file changed
+22
-11
plugins.d/alarm-notify.sh
+22
-11
@@ -1,20 +1,31 @@
1
#!/usr/bin/env bash
2
3
-# (C) Costa Tsaousis
4
-# pushover support by Jan Arnold
3
+# netdata
4
+# real-time performance and health monitoring, done right!
5
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6
+# GPL v3+
7
+#
8
+# Script the send alarm notifications for netdata
9
+#
10
+# Features:
11
+# - multiple notification methods
12
+# - multiple roles per alarm
13
+# - multiple recipients per role
14
+# - severity filtering per recipient
15
+#
16
+# Supported notification methods:
17
+# - emails
18
+# - pushover.net notifications
19
+# - slack.com notifications
20
+# - telegram.org notifications
21
+#
22
23
me="${0}"
24
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
25
+# check for BASH v4+ (required for associative arrays)
26
+[ $(( ${BASH_VERSINFO[0]} )) -lt 4 ] && \
27
+ echo >&2 "${me}: BASH version 4 or later is required (this is ${BASH_VERSION})." && \
28
exit 1
17
-fi
29
30
# defaults to allow running this script by hand
31
NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"