diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..033a160 --- /dev/null +++ b/README.MD @@ -0,0 +1,38 @@ +## Webhook server for grafana to send SMS via twilio + +### Quickstart + +Pull the whole thing with git. +``` git clone https://gitea.rabjerg.de/Rabjerg/grafana_twilio_webhook.git ``` + +Copy ``` secrets.env.sample ``` to ``` secrets.env ``` and fill it with your twilio credientals and sender/reciever phone number. + +Run ``` setup.sh ``` (do NOT do this as root), this will create a new virtual environment and install the nessecary packages in said environment. + +edit ``` flask_webhook_server.py ``` line 11 and 12, what server (URL and IP) is allowed to send SMS via the webhook. + +now test that everything works by running ``` run.sh ``` + +### Setting up webhook notification in grafana. + +Go to your grafana server and select "Alerting" -> "Notifications" -> "Create new notification channel" + +Name: "Twilio SMS Webhook" +type: "Webhook" +URL: "http://{server_ip}:5000/grafana_webhook" +HTTP Method: "POST" + +With the server running, you can now press "test" and should get a test notification per SMS. + +Save and enjoy. + +### Make it run on start with systemd +copy ``` .etc/systemd/system/twilio_webhook.service ``` to ``` /etc/systemd/system/twilio_webhook.service ```. + +edit the ``` /etc/systemd/system/twilio_webhook.service ``` Important is that ``` ExecStart= ``` points to the absolute path of ``` run.sh ``` and ``` WorkingDirectory= ``` points to the directory with ``` run.sh ``` + + +Now do ``` sudo systemctl daemon-reload ``` to load the new unit. +and ``` sudo systemctl start twilio_webhook.service --now ``` to start the service. + +Everything should be set up and running from now on. \ No newline at end of file