master
md 137 lines 4.37 KB
Rendered Raw
1 <!--startmeta
2 custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/health/notifications/alerta/README.md"
3 meta_yaml: "https://github.com/netdata/netdata/edit/master/src/health/notifications/alerta/metadata.yaml"
4 sidebar_label: "Alerta"
5 learn_status: "Published"
6 learn_rel_path: "Alerts & Notifications/Notifications/Agent Dispatched Notifications"
7 keywords: ['Alerta']
8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE NOTIFICATION'S metadata.yaml FILE"
9 endmeta-->
10
11 # Alerta
12
13
14 <img src="https://netdata.cloud/img/alerta.png" width="150"/>
15
16
17 The [Alerta](https://alerta.io/) monitoring system is a tool used to consolidate and de-duplicate alerts from multiple sources for quick ‘at-a-glance’ visualization. With just one system you can monitor alerts from many other monitoring tools on a single screen.
18 You can send Netdata alerts to Alerta to see alerts coming from many Netdata hosts or also from a multi-host Netdata configuration.
19
20
21 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
22
23 ## Setup
24
25
26 ### Prerequisites
27
28 ####
29
30 - A working Alerta instance
31 - An Alerta API key (if authentication in Alerta is enabled)
32 - Access to the terminal where Netdata Agent is running
33
34
35
36 ### Configuration
37
38 #### Options
39
40 The following options can be defined for this notification
41
42 <details open><summary>Config Options</summary>
43
44
45
46 | Option | Description | Default | Required |
47 |:-----|:------------|:--------|:---------:|
48 | SEND_ALERTA | Set `SEND_ALERTA` to YES | | yes |
49 | ALERTA_WEBHOOK_URL | set `ALERTA_WEBHOOK_URL` to the API url you defined when you installed the Alerta server. | | yes |
50 | [ALERTA_API_KEY](#option-alerta-api-key) | Set `ALERTA_API_KEY` to your API key. | | yes |
51 | DEFAULT_RECIPIENT_ALERTA | Set `DEFAULT_RECIPIENT_ALERTA` to the default recipient environment you want the alert notifications to be sent to. All roles will default to this variable if left unconfigured. | | yes |
52 | [DEFAULT_RECIPIENT_CUSTOM](#option-default-recipient-custom) | Set different recipient environments per role, by editing `DEFAULT_RECIPIENT_CUSTOM` with the environment name of your choice | | no |
53
54 <a id="option-alerta-api-key"></a>
55 ##### ALERTA_API_KEY
56
57 You will need an API key to send messages from any source, if Alerta is configured to use authentication (recommended). To create a new API key:
58 1. Go to Configuration > API Keys.
59 2. Create a new API key called "netdata" with `write:alerts` permission.
60
61
62 <a id="option-default-recipient-custom"></a>
63 ##### DEFAULT_RECIPIENT_CUSTOM
64
65 The `DEFAULT_RECIPIENT_CUSTOM` can be edited in the following entries at the bottom of the same file:
66
67 ```text
68 role_recipients_alerta[sysadmin]="Systems"
69 role_recipients_alerta[domainadmin]="Domains"
70 role_recipients_alerta[dba]="Databases Systems"
71 role_recipients_alerta[webmaster]="Marketing Development"
72 role_recipients_alerta[proxyadmin]="Proxy"
73 role_recipients_alerta[sitemgr]="Sites"
74 ```
75
76 The values you provide should be defined as environments in `/etc/alertad.conf` with `ALLOWED_ENVIRONMENTS` option.
77
78
79
80 </details>
81
82
83
84 #### via File
85
86 The configuration file name for this integration is `health_alarm_notify.conf`.
87
88
89 You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-configuration-files) script from the
90 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory).
91
92 ```bash
93 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
94 sudo ./edit-config health_alarm_notify.conf
95 ```
96
97 ##### Examples
98
99 ###### Basic Configuration
100
101
102
103 ```yaml
104 #------------------------------------------------------------------------------
105 # alerta (alerta.io) global notification options
106
107 SEND_ALERTA="YES"
108 ALERTA_WEBHOOK_URL="http://yourserver/alerta/api"
109 ALERTA_API_KEY="INSERT_YOUR_API_KEY_HERE"
110 DEFAULT_RECIPIENT_ALERTA="Production"
111
112 ```
113
114
115 ## Troubleshooting
116
117 ### Test Notification
118
119 You can run the following command by hand, to test alerts configuration:
120
121 ```bash
122 # become user netdata
123 sudo su -s /bin/bash netdata
124
125 # enable debugging info on the console
126 export NETDATA_ALARM_NOTIFY_DEBUG=1
127
128 # send test alarms to sysadmin
129 /usr/libexec/netdata/plugins.d/alarm-notify.sh test
130
131 # send test alarms to any role
132 /usr/libexec/netdata/plugins.d/alarm-notify.sh test "ROLE"
133 ```
134
135 Note that this will test _all_ alert mechanisms for the selected role.
136
137