How to implement a customize SMS notification channel?

Greetings,

After reading following docs carefully, I know that there are some works before implementing a customize SMS notification channel.



My plan is listed here.

  1. Write my own django project.
  2. This app implements a endpoint to accept webhook notifications from grafana.
  3. It this app, there is a mapping between user and their mobile phone numbers.
  4. It this app, there is a “all grafana alerts” page that user can subscribe alerts.

Is it correct?

It will be nice that we can include a so-called field “send to” fields in webhook notifications.
For example:
{
‘state’: ‘alerting’,
‘ruleUrl’: ‘http: //localhost: 3000/’,
‘title’: ‘[Alerting]Testnotification’,
‘evalMatches’: [{
‘metric’: ‘Highvalue’,
‘tags’: None,
‘value’: 100
},
{
‘metric’: ‘HigherValue’,
‘tags’: None,
‘value’: 200
}],
‘ruleId’: 0,
‘message’: ‘Someoneistestingthealertnotificationwithingrafana.’,
‘imageUrl’: ‘http: //grafana.org/assets/img/blog/mixed_styles.png’,
‘ruleName’: ‘Testnotification’,
’sendTo’: [xxx-xxx-xxxx, xxx-xxx-xxxx]
}

The custom webhook notification channel does not have lot of options currently, sadly.

It’s OK.

We are looking forward to the new features of grafana. Grafana is awesome!

:grinning:

I just used web API to pull the alerts params from my dashboard jsons and created a custom trigger script to Twilio. Took less than a day.

Can you post the script ?

Hi @torkel is there any way to receive the alert notifications through SMS?

Hi

have you used webhook in grafana ?

Thanks,
Shoaib

Yes, I have.

You need to set up a web service end point to accept and parse POST message from grafana webhook.

Per @urshoaib93 reqeust, a small django project was published in following address, https://github.com/guhuajun/grafana-awssms.

Pull requests are welcomed.

Hi @greggu ,

I am able to pull the image
$ docker pull greggu/grafana-awssms
Using default tag: latest
latest: Pulling from greggu/grafana-awssms
f49cf87b52c1: Pull complete
7b491c575b06: Pull complete
b313b08bab3b: Pull complete
51d6678c3f0e: Pull complete
09f35bd58db2: Pull complete
0f9de702e222: Pull complete
73911d37fcde: Pull complete
99a87e214c92: Pull complete
8915263c3f7a: Pull complete
e256543fdaf5: Pull complete
8f7c245fb94e: Pull complete
c7796887cecd: Pull complete
33efbd741843: Pull complete
a96b37230d7c: Pull complete
45cc103551b6: Pull complete
Digest: sha256:bd20055e7a156c5ad1e6bc1aa25fdf93ff5259d6289345ecdd2766127f284fec
Status: Downloaded newer image for greggu/grafana-awssms:latest
docker.io/greggu/grafana-awssms:latest

After that I tried to run the manage.py runserver but unable to open the url on browser
$ docker run -p 8700:8700 greggu/grafana-awssms python manage.py runserver 0.0.0.0:8700
Performing system checks…

System check identified no issues (0 silenced).
March 19, 2021 - 09:18:15
Django version 1.11.8, using settings 'project.settings'
Starting development server at http://0.0.0.0:8700/
Quit the server with CONTROL-C.

If I am missing anything or anything I need to debug please suggest