[![CircleCI](https://circleci.com/gh/imgix/prometheus-am-executor.svg?style=svg)](https://circleci.com/gh/imgix/prometheus-am-executor) # prometheus-am-executor The prometheus-am-executor is a HTTP server that receives alerts from the [Prometheus Alertmanager](https://prometheus.io/docs/alerting/alertmanager/) and executes a given command with alert details set as environment variables. :information_source: **This project's development is currently stale** We haven't needed to update this program in some time. If you are looking for something with similar functionality and is more actively maintained, [@aantn](https://github.com/aantn) has suggested their project: [Robusta](https://github.com/robusta-dev/robusta) ([docs](https://docs.robusta.dev/master/)) [issue 7](https://github.com/imgix/prometheus-am-executor/issues/7) has discussion relating to the status of this project. ## Building ##### Requirements * [Git](https://git-scm.com/downloads) * [Go](https://golang.org/doc/install) #### 1. Clone this repository ``` git clone https://github.com/imgix/prometheus-am-executor.git ``` #### 2. Compile the `prometheus-am-executor` binary ``` go test -count 1 -v ./... go build ``` ## Usage ``` Usage: ./prometheus-am-executor [options] script [args..] -f string YAML config file to use -l string HTTP Port to listen on (default ":8080") -v Enable verbose/debug logging ``` The executor runs the provided script(s) (set via cli or yaml config file) with the following environment variables set: - `AMX_RECEIVER`: name of receiver in the AM triggering the alert - `AMX_STATUS`: alert status - `AMX_EXTERNAL_URL`: URL to reach alertmanager - `AMX_ALERT_LEN`: Number of alerts; for iterating through `AMX_ALERT_..` vars - `AMX_LABEL_