summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2021-09-14 13:16:31 +0300
committerGitHub <noreply@github.com>2021-09-14 13:16:31 +0300
commit4e0a3f8cda4a12c46d50bf211b6279ba8f2368cf (patch)
tree31d302f96bdbc5c8ad45131ca561174a99539e7c /health
parent3f2b6d638edf315f264095cbd5b21d29f2e881da (diff)
Add custom e-mail headers (#11454)
* add custom mail headers * Aso add when sending only plain text emails * Update documentation on custom headers for filtering, and new email image
Diffstat (limited to 'health')
-rwxr-xr-xhealth/notifications/alarm-notify.sh.in14
-rw-r--r--health/notifications/email/README.md18
2 files changed, 30 insertions, 2 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in
index 15fd0908e7..d1f18ea1fd 100755
--- a/health/notifications/alarm-notify.sh.in
+++ b/health/notifications/alarm-notify.sh.in
@@ -2685,6 +2685,13 @@ Subject: ${host} ${status_message} - ${name//_/ } - ${chart}
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="multipart-boundary"
${email_thread_headers}
+X-Netdata-Severity: ${status,,}
+X-Netdata-Alert-Name: $name
+X-Netdata-Chart: $chart
+X-Netdata-Family: $family
+X-Netdata-Classification: $classification
+X-Netdata-Host: $host
+X-Netdata-Role: $roles
This is a MIME-encoded multipart message
@@ -3424,6 +3431,13 @@ Subject: ${html_email_subject}
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="multipart-boundary"
${email_thread_headers}
+X-Netdata-Severity: ${status,,}
+X-Netdata-Alert-Name: $name
+X-Netdata-Chart: $chart
+X-Netdata-Family: $family
+X-Netdata-Classification: $classification
+X-Netdata-Host: $host
+X-Netdata-Role: $roles
This is a MIME-encoded multipart message
diff --git a/health/notifications/email/README.md b/health/notifications/email/README.md
index ebd7f4b8c8..82786fca16 100644
--- a/health/notifications/email/README.md
+++ b/health/notifications/email/README.md
@@ -11,9 +11,9 @@ Netdata sends all emails as user `netdata`, so make sure your `sendmail` works f
email notifications look like this:
-![image](https://cloud.githubusercontent.com/assets/2662304/18407294/e9218c68-7714-11e6-8739-e4dd8a498252.png)
+![image](https://user-images.githubusercontent.com/1905463/133216974-a2ca0e4f-787b-4dce-b1b2-9996a8c5f718.png)
-## configuration
+## Configuration
To edit `health_alarm_notify.conf` on your system run `/etc/netdata/edit-config health_alarm_notify.conf`.
@@ -38,6 +38,20 @@ Where `[ROLE]` is the role you want to test. The default (if you don't give a `[
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`.
+## Filtering
+
+Every notification email (both the plain text and the rich html versions) from the Netdata agent, contain a set of custom email headers that can be used for filtering using an email client. Example:
+
+```
+X-Netdata-Severity: warning
+X-Netdata-Alert-Name: inbound_packets_dropped_ratio
+X-Netdata-Chart: net_packets.enp2s0
+X-Netdata-Family: enp2s0
+X-Netdata-Classification: System
+X-Netdata-Host: winterland
+X-Netdata-Role: sysadmin
+```
+
## Simple SMTP transport configuration
If you want an alternative to `sendmail` in order to have a simple MTA configuration for sending emails and auth to an existing SMTP server, you can do the following: