summaryrefslogtreecommitdiffstats
path: root/health/notifications
diff options
context:
space:
mode:
Diffstat (limited to 'health/notifications')
-rw-r--r--health/notifications/README.md3
-rwxr-xr-xhealth/notifications/alarm-notify.sh.in9
-rw-r--r--health/notifications/custom/README.md84
-rw-r--r--health/notifications/email/README.md2
4 files changed, 53 insertions, 45 deletions
diff --git a/health/notifications/README.md b/health/notifications/README.md
index 5b7b43406..8c7ab66f7 100644
--- a/health/notifications/README.md
+++ b/health/notifications/README.md
@@ -58,6 +58,9 @@ export NETDATA_ALARM_NOTIFY_DEBUG=1
# send test alarms to any role
/usr/libexec/netdata/plugins.d/alarm-notify.sh test "ROLE"
```
+
+Note that in versions before 1.16, the plugins.d directory may be installed in a different location in certain OSs (e.g. under `/usr/lib/netdata`). You can always find the location of the alarm-notify.sh script in `netdata.conf`.
+
If you need to dig even deeper, you can trace the execution with `bash -x`. Note that in test mode, alarm-notify.sh calls itself with many more arguments. So first do
```sh
bash -x /usr/libexec/netdata/plugins.d/alarm-notify.sh test
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in
index ff4b3f3dc..852718bc9 100755
--- a/health/notifications/alarm-notify.sh.in
+++ b/health/notifications/alarm-notify.sh.in
@@ -189,6 +189,7 @@ fi
[ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"
[ -z "${NETDATA_CACHE_DIR}" ] && NETDATA_CACHE_DIR="@cachedir_POST@"
[ -z "${NETDATA_REGISTRY_URL}" ] && NETDATA_REGISTRY_URL="https://registry.my-netdata.io"
+[ -z "${NETDATA_REGISTRY_CLOUD_BASE_URL}" ] && NETDATA_REGISTRY_CLOUD_BASE_URL="https://netdata.cloud"
# -----------------------------------------------------------------------------
# parse command line parameters
@@ -681,7 +682,7 @@ date=$(date --date=@${when} "${date_format}" 2>/dev/null)
# ----------------------------------------------------------------------------
# prepare some extra headers if we've been asked to thread e-mails
if [ "${SEND_EMAIL}" == "YES" ] && [ "${EMAIL_THREADING}" != "NO" ]; then
- email_thread_headers="In-Reply-To: <${chart}-${name}@${host}>\\nReferences: <${chart}-${name}@${host}>"
+ email_thread_headers="In-Reply-To: <${chart}-${name}@${host}>\\r\\nReferences: <${chart}-${name}@${host}>"
else
email_thread_headers=
fi
@@ -1790,7 +1791,7 @@ if [ "${NETDATA_REGISTRY_URL}" == "https://registry.my-netdata.io" ]; then
NETDATA_REGISTRY_UNIQUE_ID="$(cat "@registrydir_POST@/netdata.public.unique.id")"
fi
fi
- if [ ! -z "${NETDATA_REGISTRY_UNIQUE_ID}" ]; then
+ if [ -n "${NETDATA_REGISTRY_UNIQUE_ID}" ]; then
GOTOCLOUD=1
fi
fi
@@ -1798,7 +1799,7 @@ fi
if [ ${GOTOCLOUD} -eq 0 ]; then
goto_url="${NETDATA_REGISTRY_URL}/goto-host-from-alarm.html?${redirect_params}"
else
- goto_url="https://netdata.cloud/alarms/redirect?agentID=${NETDATA_REGISTRY_UNIQUE_ID}&${redirect_params}"
+ goto_url="${NETDATA_REGISTRY_CLOUD_BASE_URL}/alarms/redirect?agentID=${NETDATA_REGISTRY_UNIQUE_ID}&${redirect_params}"
fi
# the severity of the alarm
@@ -1953,7 +1954,7 @@ send_pushbullet "${PUSHBULLET_ACCESS_TOKEN}" "${PUSHBULLET_SOURCE_DEVICE}" "${to
Severity: ${severity}\\n
Chart: ${chart}\\n
Family: ${family}\\n
-$(date -d @${when})\\n
+${date}\\n
The source of this alarm is line ${src}"
SENT_PUSHBULLET=$?
diff --git a/health/notifications/custom/README.md b/health/notifications/custom/README.md
index 627dd9d48..eeaad8a60 100644
--- a/health/notifications/custom/README.md
+++ b/health/notifications/custom/README.md
@@ -1,11 +1,13 @@
# Custom
-Netdata allows you to send custom notifications, to any endpoint you choose.
-To configure custom notifications, you will need to define the `custom_sender()` function in `health_alarm_notify.conf`
-You can look at the other senders in `/usr/libexec/netdata/plugins.d/alarm-notify.sh` for examples.
+Netdata allows you to send custom notifications to any endpoint you choose.
+
+To configure custom notifications, you will need to customize `health_alarm_notify.conf`. You can look at the other senders in `/usr/libexec/netdata/plugins.d/alarm-notify.sh` for examples of how to modify the `custom_sender()` function in `health_alarm_notify.conf`. Ensure you follow the instructions of changing any configuration file to [persist your configuration](../../../docs/configuration-guide.md#persist-my-configuration).
+
As with other notifications, you will also need to define the recipient list in `DEFAULT_RECIPIENT_CUSTOM` and/or the `role_recipients_custom` array.
-The following is a sample `custom_sender` function to send an SMS via an imaginary HTTPS endpoint to the SMS gateway:
+The following is a sample `custom_sender` function in `health_alarm_notify.conf`, to send an SMS via an imaginary HTTPS endpoint to the SMS gateway:
+
```
custom_sender() {
# example human readable SMS
@@ -37,45 +39,45 @@ The following is a sample `custom_sender` function to send an SMS via an imagina
Variables available to the custom_sender:
- - ${to_custom} the list of recipients for the alarm
- - ${host} the host generated this event
- - ${url_host} same as ${host} but URL encoded
- - ${unique_id} the unique id of this event
- - ${alarm_id} the unique id of the alarm that generated this event
- - ${event_id} the incremental id of the event, for this alarm id
- - ${when} the timestamp this event occurred
- - ${name} the name of the alarm, as given in netdata health.d entries
- - ${url_name} same as ${name} but URL encoded
- - ${chart} the name of the chart (type.id)
- - ${url_chart} same as ${chart} but URL encoded
- - ${family} the family of the chart
- - ${url_family} same as ${family} but URL encoded
- - ${status} the current status : REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
- - ${old_status} the previous status: REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
- - ${value} the current value of the alarm
- - ${old_value} the previous value of the alarm
- - ${src} the line number and file the alarm has been configured
- - ${duration} the duration in seconds of the previous alarm state
- - ${duration_txt} same as ${duration} for humans
- - ${non_clear_duration} the total duration in seconds this is/was non-clear
- - ${non_clear_duration_txt} same as ${non_clear_duration} for humans
- - ${units} the units of the value
- - ${info} a short description of the alarm
- - ${value_string} friendly value (with units)
- - ${old_value_string} friendly old value (with units)
- - ${image} the URL of an image to represent the status of the alarm
- - ${color} a color in #AABBCC format for the alarm
- - ${goto_url} the URL the user can click to see the netdata dashboard
- - ${calc_expression} the expression evaluated to provide the value for the alarm
- - ${calc_param_values} the value of the variables in the evaluated expression
- - ${total_warnings} the total number of alarms in WARNING state on the host
- - ${total_critical} the total number of alarms in CRITICAL state on the host
+ - `${to_custom}` the list of recipients for the alarm
+ - `${host}` the host generated this event
+ - `${url_host}` same as `${host}` but URL encoded
+ - `${unique_id}` the unique id of this event
+ - `${alarm_id}` the unique id of the alarm that generated this event
+ - `${event_id}` the incremental id of the event, for this alarm id
+ - `${when}` the timestamp this event occurred
+ - `${name}` the name of the alarm, as given in netdata health.d entries
+ - `${url_name}` same as `${name}` but URL encoded
+ - `${chart}` the name of the chart (type.id)
+ - `${url_chart}` same as `${chart}` but URL encoded
+ - `${family}` the family of the chart
+ - `${url_family}` same as `${family}` but URL encoded
+ - `${status}` the current status : REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
+ - `${old_status}` the previous status: REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL
+ - `${value}` the current value of the alarm
+ - `${old_value}` the previous value of the alarm
+ - `${src}` the line number and file the alarm has been configured
+ - `${duration}` the duration in seconds of the previous alarm state
+ - `${duration_txt}` same as `${duration}` for humans
+ - `${non_clear_duration}` the total duration in seconds this is/was non-clear
+ - `${non_clear_duration_txt}` same as `${non_clear_duration}` for humans
+ - `${units}` the units of the value
+ - `${info}` a short description of the alarm
+ - `${value_string}` friendly value (with units)
+ - `${old_value_string}` friendly old value (with units)
+ - `${image}` the URL of an image to represent the status of the alarm
+ - `${color}` a color in #AABBCC format for the alarm
+ - `${goto_url}` the URL the user can click to see the netdata dashboard
+ - `${calc_expression}` the expression evaluated to provide the value for the alarm
+ - `${calc_param_values}` the value of the variables in the evaluated expression
+ - `${total_warnings}` the total number of alarms in WARNING state on the host
+ - `${total_critical}` the total number of alarms in CRITICAL state on the host
The following are more human friendly:
- - ${alarm} like "name = value units"
- - ${status_message} like "needs attention", "recovered", "is critical"
- - ${severity} like "Escalated to CRITICAL", "Recovered from WARNING"
- - ${raised_for} like "(alarm was raised for 10 minutes)"
+ - `${alarm}` like "name = value units"
+ - `${status_message}` like "needs attention", "recovered", "is critical"
+ - `${severity}` like "Escalated to CRITICAL", "Recovered from WARNING"
+ - `${raised_for}` like "(alarm was raised for 10 minutes)"
[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fhealth%2Fnotifications%2Fcustom%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/health/notifications/email/README.md b/health/notifications/email/README.md
index 163839b6b..84a9e0ce7 100644
--- a/health/notifications/email/README.md
+++ b/health/notifications/email/README.md
@@ -30,4 +30,6 @@ sudo su -s /bin/bash netdata
Where `[ROLE]` is the role you want to test. The default (if you don't give a `[ROLE]`) is `sysadmin`.
+Note that in versions before 1.16, the plugins.d directory may be installed in a different location in certain OSs (e.g. under `/usr/lib/netdata`). You can always find the location of the alarm-notify.sh script in `netdata.conf`.
+
[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fhealth%2Fnotifications%2Femail%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()