| 1 | <!--startmeta |
| 2 | custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/health/notifications/smstools3/README.md" |
| 3 | meta_yaml: "https://github.com/netdata/netdata/edit/master/src/health/notifications/smstools3/metadata.yaml" |
| 4 | sidebar_label: "SMS" |
| 5 | learn_status: "Published" |
| 6 | learn_rel_path: "Alerts & Notifications/Notifications/Agent Dispatched Notifications" |
| 7 | keywords: ['SMS tools 3', 'SMS', 'Messaging'] |
| 8 | message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE NOTIFICATION'S metadata.yaml FILE" |
| 9 | endmeta--> |
| 10 | |
| 11 | # SMS |
| 12 | |
| 13 | |
| 14 | <img src="https://netdata.cloud/img/sms.svg" width="150"/> |
| 15 | |
| 16 | |
| 17 | Send notifications to `smstools3` using Netdata's Agent alert notification feature, which supports dozens of endpoints, user roles, and more. |
| 18 | The SMS Server Tools 3 is a SMS Gateway software which can send and receive short messages through GSM modems and mobile phones. |
| 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 | - [Install](http://smstools3.kekekasvi.com/index.php?p=compiling) and [configure](http://smstools3.kekekasvi.com/index.php?p=configure) `smsd` |
| 31 | - To ensure that the user `netdata` can execute `sendsms`. Any user executing `sendsms` needs to: |
| 32 | - Have write permissions to /tmp and /var/spool/sms/outgoing |
| 33 | - Be a member of group smsd |
| 34 | - To ensure that the steps above are successful, just su netdata and execute sendsms phone message. |
| 35 | - Access to the terminal where Netdata Agent is running |
| 36 | |
| 37 | |
| 38 | |
| 39 | ### Configuration |
| 40 | |
| 41 | #### Options |
| 42 | |
| 43 | The following options can be defined for this notification |
| 44 | |
| 45 | <details open><summary>Config Options</summary> |
| 46 | |
| 47 | |
| 48 | |
| 49 | | Option | Description | Default | Required | |
| 50 | |:-----|:------------|:--------|:---------:| |
| 51 | | [sendsms](#option-sendsms) | Set the path for `sendsms`, otherwise Netdata will search for it in your system `$PATH:` | YES | yes | |
| 52 | | SEND_SMS | Set `SEND_SMS` to `YES`. | | yes | |
| 53 | | [DEFAULT_RECIPIENT_SMS](#option-default-recipient-sms) | Set DEFAULT_RECIPIENT_SMS to the phone number you want the alert notifications to be sent to. You can define multiple phone numbers like this: PHONE1 PHONE2. | | yes | |
| 54 | |
| 55 | <a id="option-sendsms"></a> |
| 56 | ##### sendsms |
| 57 | |
| 58 | # The full path of the sendsms command (smstools3). |
| 59 | # If empty, the system $PATH will be searched for it. |
| 60 | # If not found, SMS notifications will be silently disabled. |
| 61 | sendsms="/usr/bin/sendsms" |
| 62 | |
| 63 | |
| 64 | <a id="option-default-recipient-sms"></a> |
| 65 | ##### DEFAULT_RECIPIENT_SMS |
| 66 | |
| 67 | All roles will default to this variable if left unconfigured. |
| 68 | |
| 69 | You can then have different phone numbers per role, by editing `DEFAULT_RECIPIENT_SMS` with the phone number you want, in the following entries at the bottom of the same file: |
| 70 | ```text |
| 71 | role_recipients_sms[sysadmin]="PHONE1" |
| 72 | role_recipients_sms[domainadmin]="PHONE2" |
| 73 | role_recipients_sms[dba]="PHONE3" |
| 74 | role_recipients_sms[webmaster]="PHONE4" |
| 75 | role_recipients_sms[proxyadmin]="PHONE5" |
| 76 | role_recipients_sms[sitemgr]="PHONE6" |
| 77 | ``` |
| 78 | |
| 79 | |
| 80 | |
| 81 | </details> |
| 82 | |
| 83 | |
| 84 | |
| 85 | #### via File |
| 86 | |
| 87 | The configuration file name for this integration is `health_alarm_notify.conf`. |
| 88 | |
| 89 | |
| 90 | 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 |
| 91 | Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#locate-your-config-directory). |
| 92 | |
| 93 | ```bash |
| 94 | cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata |
| 95 | sudo ./edit-config health_alarm_notify.conf |
| 96 | ``` |
| 97 | |
| 98 | ##### Examples |
| 99 | |
| 100 | ###### Basic Configuration |
| 101 | |
| 102 | |
| 103 | |
| 104 | ```yaml |
| 105 | #------------------------------------------------------------------------------ |
| 106 | # SMS Server Tools 3 (smstools3) global notification options |
| 107 | SEND_SMS="YES" |
| 108 | DEFAULT_RECIPIENT_SMS="1234567890" |
| 109 | |
| 110 | ``` |
| 111 | |
| 112 | |
| 113 | ## Troubleshooting |
| 114 | |
| 115 | ### Test Notification |
| 116 | |
| 117 | You can run the following command by hand, to test alerts configuration: |
| 118 | |
| 119 | ```bash |
| 120 | # become user netdata |
| 121 | sudo su -s /bin/bash netdata |
| 122 | |
| 123 | # enable debugging info on the console |
| 124 | export NETDATA_ALARM_NOTIFY_DEBUG=1 |
| 125 | |
| 126 | # send test alarms to sysadmin |
| 127 | /usr/libexec/netdata/plugins.d/alarm-notify.sh test |
| 128 | |
| 129 | # send test alarms to any role |
| 130 | /usr/libexec/netdata/plugins.d/alarm-notify.sh test "ROLE" |
| 131 | ``` |
| 132 | |
| 133 | Note that this will test _all_ alert mechanisms for the selected role. |
| 134 | |
| 135 |