{"id":21534828,"url":"https://github.com/netinvent/grafana_webhook_gammu_smsd","last_synced_at":"2025-03-17T20:15:36.379Z","repository":{"id":171015797,"uuid":"647325588","full_name":"netinvent/grafana_webhook_gammu_smsd","owner":"netinvent","description":"Convert Grafana Webhook calls to gammu_smsd webhooks","archived":false,"fork":false,"pushed_at":"2024-04-25T11:32:27.000Z","size":145,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T05:03:51.566Z","etag":null,"topics":["alert","alertmanager","alertmanager-webhook","gammu","gammu-smsd","grafana","sms","sms-gateway"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netinvent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-30T14:35:07.000Z","updated_at":"2023-05-30T16:56:17.000Z","dependencies_parsed_at":"2024-03-08T21:30:58.192Z","dependency_job_id":"82dd4a9d-de08-4eae-94e4-29de47908f4d","html_url":"https://github.com/netinvent/grafana_webhook_gammu_smsd","commit_stats":null,"previous_names":["netinvent/grafana_webhook_gammu_smsd"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netinvent%2Fgrafana_webhook_gammu_smsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netinvent%2Fgrafana_webhook_gammu_smsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netinvent%2Fgrafana_webhook_gammu_smsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netinvent%2Fgrafana_webhook_gammu_smsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netinvent","download_url":"https://codeload.github.com/netinvent/grafana_webhook_gammu_smsd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244102855,"owners_count":20398386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","alertmanager","alertmanager-webhook","gammu","gammu-smsd","grafana","sms","sms-gateway"],"created_at":"2024-11-24T03:12:47.906Z","updated_at":"2025-03-17T20:15:36.358Z","avatar_url":"https://github.com/netinvent.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Grafana webhook to gammu smsd server\n\nThis (quick and dirty) tool allows to receive grafana alerts in webhook format, and transfer it's content to an SMS gateway.  \nIn our case, the SMS gateway will be `gammu-smsd` but any command line driven SMS gateway can be configured.\n\n## Requirements\n\nYou need a working SMS service that can be triggered by CLI, example: gammu-smsd\n\n## Setup\n\nInstall and setup a python environment\n```\ncd /opt\ngit clone https://github.com/netinvent/grafana_webhook_gammu_smsd\npython3 -m venv /opt/grafana_webhook_gammu_smsd/venv\n/opt/grafana_webhook_gammu_smsd/venv/bin/python -m pip install -r /opt/grafana_webhook_gammu_smsd/requirements.txt\n```\n\nConfigure the file `/opt/grafana_webhook_gammu_smsd/grafana_webhook_gammu_smsd.conf` according to your needs.  \nBy default, it's configured to use Gammu-smsd-inject command to send SMS. \n\nSetup the service\n```\ncp /opt/grafana_webhook_gammu_smsd/examples/systemd/grafana_webhook_gammu_smsd.service /etc/systemd/system/\nsystemctl enable grafana_webhook_gammu_smsd\nsystemctl start grafana_webhook_gammu_smsd\nsystemctl status grafana_webhook_gammu_smsd\n```\n\nDon't forget to setup the firewall. Example for RHEL:\n```\nfirewall-cmd --add-port=8080/tcp --permanent \u0026\u0026 firewall-cmd --reload\n```\n\nAt this point, you can configure Grafana's webhook. Send endpoint is `/grafana` \n\n![image](img/new_webhook_grafana_9.5.png)\n\nThe url will be `http(s)://your_server.tld/grafana/{phone_number}` where `{phone_number}` must be replaced with actual number, URL encoded if needed.  \nHTTP method should be post, and HTTP Basic authentication should be enabled.  \nPlease also use this server behind a HTTPS reverse proxy for better security.\n\nYou may add multiple phone numbers by separating them with a semicolon, eg\n`http(s)://your_server.tld/grafana/0123456789;0234567890;02345678901`\n\nYou may also limit the number of sent sms by setting a minimal interval between two sent smses.  \nThe url will be `http(s)://your_server.tld/grafana/{phone_number}/{min_interval}`\nExample, in order to not receive more than a SMS every two hours (7200 seconds):\n\n`http(s)://your_server.tld/grafana/0123456789;0234567890;02345678901/7200`\n\n### Testing your server in CLI mode\n\nOnce your server is setup, you can use CURL to check whether everything works.  \nBy using one of the test grafana calls found in `grafana-webhook-calls.txt` and the username/password configured in `grafana_webhook_gammu_smsd.conf`, you can execute the following test request to phone number 01234567890\n\n```\ncurl -X POST -u grafana:MySecret!Password -H \"Content-Type: application/json\" -d '{\"receiver\": \"test\", \"status\": \"firing\", \"alerts\": [{\"status\": \"firing\", \"labels\": {\"alertname\": \"TestAlert\", \"instance\": \"Grafana\"}, \"annotations\": {\"summary\": \"Notification test\"}, \"startsAt\": \"2024-03-09T11:10:16.31897622+01:00\", \"endsAt\": \"0001-01-01T00:00:00Z\", \"generatorURL\": \"\", \"fingerprint\": \"57c6d9296de2ad39\", \"silenceURL\": \"https://supervision.local/alerting/silence/new?alertmanager=grafana\u0026matcher=alertname%3DTestAlert\u0026matcher=instance%3DGrafana\", \"dashboardURL\": \"\", \"panelURL\": \"\", \"values\": null, \"valueString\": \"[ metric='foo' labels={instance=bar} value=10 ]\"}], \"groupLabels\": {\"alertname\": \"TestAlert\", \"instance\": \"Grafana\"}, \"commonLabels\": {\"alertname\": \"TestAlert\", \"instance\": \"Grafana\"}, \"commonAnnotations\": {\"summary\": \"Notification test\"}, \"externalURL\": \"https://supervision.local/\", \"version\": \"1\", \"groupKey\": \"test-57c6d9296de2ad39-1709979016\", \"truncatedAlerts\": 0, \"orgId\": 1, \"title\": \"[FIRING:1] TestAlert Grafana \", \"state\": \"alerting\", \"message\": \"**Firing**\\n\\nValue: [no value]\\nLabels:\\n - alertname = TestAlert\\n - instance = Grafana\\nAnnotations:\\n - summary = Notification test\\nSilence: https://supervision.local/alerting/silence/new?alertmanager=grafana\u0026matcher=alertname%3DTestAlert\u0026matcher=instance%3DGrafana\\n\"}' http://localhost:8080/grafana/01234567890\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetinvent%2Fgrafana_webhook_gammu_smsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetinvent%2Fgrafana_webhook_gammu_smsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetinvent%2Fgrafana_webhook_gammu_smsd/lists"}