GithubHelp home page GithubHelp logo

stutily / promtotwilio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from swatto/promtotwilio

0.0 0.0 0.0 1.05 MB

Send text messages for Prometheus alerts using Twilio

License: MIT License

Makefile 24.79% Go 67.02% Dockerfile 8.19%

promtotwilio's Introduction

forked from Swatto/promtotwilio

Prometheus alert with text message

This is a simple and stupid program that will receive webhooks from Prometheus to send them as text message (using Twilio) with the summary of the alert.

The Docker image size is less than 9MB.

Docker Pulls

Configuration

It needs 4 environment variables:

  • SID - Twilio Account SID
  • TOKEN - Twilio Auth Token
  • RECEIVER - Phone number of receiver (optional parameter, representing default receiver)
  • SENDER - Phone number managed by Twilio (friendly name)

You can see a basic launch inside the Makefile.

API

/: ping promtotwilio application. Returns 200 OK if application works fine.

/send?receiver=<rcv>: send Prometheus firing alerts from payload to a rcv if specified, or to default receiver, represented by RECEIVER environment variable. If none is specified, status code 400 BadRequest is returned.

Test it

To send test sms to a phone +zxxxyyyyyyy use the following command (please notice %2B symbols, representing a url encoded + sign)

$ curl -H "Content-Type: application/json" -X POST -d \
'{"version":"2","status":"firing","alerts":[{"annotations":{"summary":"Server down"},"startsAt":"2016-03-19T05:54:01Z"}]}' \
http://localhost:9090/send?receiver=%2Bzxxxyyyyyyy

Configuration example

Here's a sample Docker Compose file to use it with cAdvisor, Prometheus, Alertmanager and Grafana.

sms:
  image: swatto/promtotwilio:latest
  environment:
    SID: xxx
    TOKEN: xxx
    RECEIVER: xxx
    SENDER: xxx

alert:
  image: prom/alertmanager:latest
  links:
   - sms
  volumes:
   - ./alertmanager.yml:/etc/alertmanager/config.yml

container:
  image: google/cadvisor:latest
  volumes:
   - /:/rootfs:ro
   - /var/run:/var/run:rw
   - /sys:/sys:ro
   - /var/lib/docker/:/var/lib/docker:ro

prometheus:
  image: prom/prometheus:latest
  links:
   - container
   - alert
  volumes:
   - ./prometheus.yml:/etc/prometheus/prometheus.yml
   - ./alerts.conf:/etc/prometheus/alerts.conf
  entrypoint: /bin/prometheus -config.file=/etc/prometheus/prometheus.yml -alertmanager.url=http://alert:9093

web:
  image: grafana/grafana:latest
  links:
   - prometheus
  ports:
   - "3000:3000"
  environment:
    GF_SERVER_ROOT_URL: http://stats.example.com
    GF_SECURITY_ADMIN_PASSWORD: 123456

Here's the AlertManager config where sms will be provided by Docker Compose

route:
  receiver: 'admin'

receivers:
- name: 'admin'
  webhook_configs:
  - url: 'http://sms:9090/send'

promtotwilio's People

Contributors

swatto avatar stutily avatar prestonvanloon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.