| 1 | <!--startmeta |
| 2 | custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/health/notifications/messagebird/README.md" |
| 3 | meta_yaml: "https://github.com/netdata/netdata/edit/master/src/health/notifications/messagebird/metadata.yaml" |
| 4 | sidebar_label: "MessageBird" |
| 5 | learn_status: "Published" |
| 6 | learn_rel_path: "Alerts & Notifications/Notifications/Agent Dispatched Notifications" |
| 7 | keywords: ['MessageBird'] |
| 8 | message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE NOTIFICATION'S metadata.yaml FILE" |
| 9 | endmeta--> |
| 10 | |
| 11 | # MessageBird |
| 12 | |
| 13 | |
| 14 | <img src="https://netdata.cloud/img/messagebird.svg" width="150"/> |
| 15 | |
| 16 | |
| 17 | Send notifications to MessageBird using Netdata's Agent alert notification feature, which supports dozens of endpoints, user roles, and more. |
| 18 | |
| 19 | |
| 20 | <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> |
| 21 | |
| 22 | ## Setup |
| 23 | |
| 24 | |
| 25 | ### Prerequisites |
| 26 | |
| 27 | #### |
| 28 | |
| 29 | - An access key under 'API ACCESS (REST)' (you will want a live key), you can read more [here](https://developers.messagebird.com/quickstarts/sms/test-credits-api-keys/). |
| 30 | - Access to the terminal where Netdata Agent is running |
| 31 | |
| 32 | |
| 33 | |
| 34 | ### Configuration |
| 35 | |
| 36 | #### Options |
| 37 | |
| 38 | The following options can be defined for this notification |
| 39 | |
| 40 | <details open><summary>Config Options</summary> |
| 41 | |
| 42 | |
| 43 | |
| 44 | | Option | Description | Default | Required | |
| 45 | |:-----|:------------|:--------|:---------:| |
| 46 | | SEND_MESSAGEBIRD | Set `SEND_MESSAGEBIRD` to YES | YES | yes | |
| 47 | | MESSAGEBIRD_ACCESS_KEY | Set `MESSAGEBIRD_ACCESS_KEY` to your API key. | | yes | |
| 48 | | MESSAGEBIRD_NUMBER | Set `MESSAGEBIRD_NUMBER` to the MessageBird number you want to use for the alert. | | yes | |
| 49 | | [DEFAULT_RECIPIENT_MESSAGEBIRD](#option-default-recipient-messagebird) | Set `DEFAULT_RECIPIENT_MESSAGEBIRD` to the number you want the alert notification to be sent as an SMS. You can define multiple recipients like this: +15555555555 +17777777777. | | yes | |
| 50 | |
| 51 | <a id="option-default-recipient-messagebird"></a> |
| 52 | ##### DEFAULT_RECIPIENT_MESSAGEBIRD |
| 53 | |
| 54 | All roles will default to this variable if left unconfigured. |
| 55 | |
| 56 | You can then have different recipients per role, by editing `DEFAULT_RECIPIENT_MESSAGEBIRD` with the number you want, in the following entries at the bottom of the same file: |
| 57 | ```text |
| 58 | role_recipients_messagebird[sysadmin]="+15555555555" |
| 59 | role_recipients_messagebird[domainadmin]="+15555555556" |
| 60 | role_recipients_messagebird[dba]="+15555555557" |
| 61 | role_recipients_messagebird[webmaster]="+15555555558" |
| 62 | role_recipients_messagebird[proxyadmin]="+15555555559" |
| 63 | role_recipients_messagebird[sitemgr]="+15555555550" |
| 64 | ``` |
| 65 | |
| 66 | |
| 67 | |
| 68 | </details> |
| 69 | |
| 70 | |
| 71 | |
| 72 | #### via File |
| 73 | |
| 74 | The configuration file name for this integration is `health_alarm_notify.conf`. |
| 75 | |
| 76 | |
| 77 | 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 |
| 78 | Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory). |
| 79 | |
| 80 | ```bash |
| 81 | cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata |
| 82 | sudo ./edit-config health_alarm_notify.conf |
| 83 | ``` |
| 84 | |
| 85 | ##### Examples |
| 86 | |
| 87 | ###### Basic Configuration |
| 88 | |
| 89 | |
| 90 | |
| 91 | ```yaml |
| 92 | #------------------------------------------------------------------------------ |
| 93 | # Messagebird (messagebird.com) SMS options |
| 94 | |
| 95 | SEND_MESSAGEBIRD="YES" |
| 96 | MESSAGEBIRD_ACCESS_KEY="XXXXXXXX" |
| 97 | MESSAGEBIRD_NUMBER="XXXXXXX" |
| 98 | DEFAULT_RECIPIENT_MESSAGEBIRD="+15555555555" |
| 99 | |
| 100 | ``` |
| 101 | |
| 102 | |
| 103 | ## Troubleshooting |
| 104 | |
| 105 | ### Test Notification |
| 106 | |
| 107 | You can run the following command by hand, to test alerts configuration: |
| 108 | |
| 109 | ```bash |
| 110 | # become user netdata |
| 111 | sudo su -s /bin/bash netdata |
| 112 | |
| 113 | # enable debugging info on the console |
| 114 | export NETDATA_ALARM_NOTIFY_DEBUG=1 |
| 115 | |
| 116 | # send test alarms to sysadmin |
| 117 | /usr/libexec/netdata/plugins.d/alarm-notify.sh test |
| 118 | |
| 119 | # send test alarms to any role |
| 120 | /usr/libexec/netdata/plugins.d/alarm-notify.sh test "ROLE" |
| 121 | ``` |
| 122 | |
| 123 | Note that this will test _all_ alert mechanisms for the selected role. |
| 124 | |
| 125 |