| 1 | <!--startmeta |
| 2 | custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/health/notifications/rocketchat/README.md" |
| 3 | meta_yaml: "https://github.com/netdata/netdata/edit/master/src/health/notifications/rocketchat/metadata.yaml" |
| 4 | sidebar_label: "RocketChat" |
| 5 | learn_status: "Published" |
| 6 | learn_rel_path: "Alerts & Notifications/Notifications/Agent Dispatched Notifications" |
| 7 | keywords: ['RocketChat'] |
| 8 | message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE NOTIFICATION'S metadata.yaml FILE" |
| 9 | endmeta--> |
| 10 | |
| 11 | # RocketChat |
| 12 | |
| 13 | |
| 14 | <img src="https://netdata.cloud/img/rocketchat.png" width="150"/> |
| 15 | |
| 16 | |
| 17 | Send notifications to Rocket.Chat 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 | - The incoming webhook URL as given by RocketChat. You can use the same on all your Netdata servers (or you can have multiple if you like - your decision). |
| 30 | - One or more channels to post the messages to |
| 31 | - Access to the terminal where Netdata Agent is running |
| 32 | |
| 33 | |
| 34 | |
| 35 | ### Configuration |
| 36 | |
| 37 | #### Options |
| 38 | |
| 39 | The following options can be defined for this notification |
| 40 | |
| 41 | <details open><summary>Config Options</summary> |
| 42 | |
| 43 | |
| 44 | |
| 45 | | Option | Description | Default | Required | |
| 46 | |:-----|:------------|:--------|:---------:| |
| 47 | | SEND_ROCKETCHAT | Set `SEND_ROCKETCHAT` to `YES` | YES | yes | |
| 48 | | ROCKETCHAT_WEBHOOK_URL | set `ROCKETCHAT_WEBHOOK_URL` to your webhook URL. | | yes | |
| 49 | | [DEFAULT_RECIPIENT_ROCKETCHAT](#option-default-recipient-rocketchat) | Set `DEFAULT_RECIPIENT_ROCKETCHAT` to the channel you want the alert notifications to be sent to. You can define multiple channels like this: `alerts` `systems`. | | yes | |
| 50 | |
| 51 | <a id="option-default-recipient-rocketchat"></a> |
| 52 | ##### DEFAULT_RECIPIENT_ROCKETCHAT |
| 53 | |
| 54 | All roles will default to this variable if left unconfigured. |
| 55 | |
| 56 | The `DEFAULT_RECIPIENT_ROCKETCHAT` can be edited in the following entries at the bottom of the same file: |
| 57 | ```text |
| 58 | role_recipients_rocketchat[sysadmin]="systems" |
| 59 | role_recipients_rocketchat[domainadmin]="domains" |
| 60 | role_recipients_rocketchat[dba]="databases systems" |
| 61 | role_recipients_rocketchat[webmaster]="marketing development" |
| 62 | role_recipients_rocketchat[proxyadmin]="proxy_admin" |
| 63 | role_recipients_rocketchat[sitemgr]="sites" |
| 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 | # rocketchat (rocket.chat) global notification options |
| 94 | |
| 95 | SEND_ROCKETCHAT="YES" |
| 96 | ROCKETCHAT_WEBHOOK_URL="<your_incoming_webhook_url>" |
| 97 | DEFAULT_RECIPIENT_ROCKETCHAT="monitoring_alarms" |
| 98 | |
| 99 | ``` |
| 100 | |
| 101 | |
| 102 | ## Troubleshooting |
| 103 | |
| 104 | ### Test Notification |
| 105 | |
| 106 | You can run the following command by hand, to test alerts configuration: |
| 107 | |
| 108 | ```bash |
| 109 | # become user netdata |
| 110 | sudo su -s /bin/bash netdata |
| 111 | |
| 112 | # enable debugging info on the console |
| 113 | export NETDATA_ALARM_NOTIFY_DEBUG=1 |
| 114 | |
| 115 | # send test alarms to sysadmin |
| 116 | /usr/libexec/netdata/plugins.d/alarm-notify.sh test |
| 117 | |
| 118 | # send test alarms to any role |
| 119 | /usr/libexec/netdata/plugins.d/alarm-notify.sh test "ROLE" |
| 120 | ``` |
| 121 | |
| 122 | Note that this will test _all_ alert mechanisms for the selected role. |
| 123 | |
| 124 |