Create SMS Alert Channel using a Custom Webhook and AWS SNS
In this video, I show you how you can create an alert channel using a custom webhook that sends SMS. The SMS gateway I will use is AWS SNS.
You will need an AWS account. Log in and create an IAM user, and add it to a group with the AmazonSNSFullAccess policy. Take note of the Access Key and Secret given to you by AWS.
Go to the SNS Service console, select the Region you desire. I use us-east-1 in the video.
Press the link Start with an Overview and the press the link Text Messaging (SMS)
See video for more details
On your Grafana server.
Install python pip
Install Flask and Boto3
start new screen session
add a new file called sendsms.py
and add the python script below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
Start the python script using
1 2 3 4 5 6 7
Press CTRL A then CTRL D to exit the screen session without closing it. You can come back to a screen session at anytime by typing
Go into the Grafana UI
Select Alerting-->Notification Channels and add a New Channel
|Url||http://127.0.0.1:5000/sendsms?number=your telephone number|
In the above table, the telephone number added to the URL should be in E.164 format but without the + symbol.
eg. Country code +44, with mobile number 07700 900123 should be written as 447700900123.
So the URL would now be http://127.0.0.1:5000/sendsms?number=447700900123
Now press the Send Test button. You should get an SMS on your mobile telephone.