This docker image pulls Prometheus firiing alerts and then executes a script on them.
290
A shell script that takes Prometheus alerts and sends out REST API calls. You should put your script ont /etc/prometheus_executor
docker run -d --network=my-net --ip="172.31.0.4" -p 9095:9095 -v /etc/prometheus_executor/:/etc/prometheus_executor rabotond/prometheus_executor - export IP=$(hostname --ip-address)
Like: #!/bin/bash
if [[ "$AMX_STATUS" != "firing" ]]; then
exit 0
fi
over_loaded() {
curl -X POST http://{{variables.occopus_restservice_ip}}:{{variables.occopus_restservice_port}}/infrastructures/$1/scaleup/$2
}
under_loaded() {
curl -X POST http://{{variables.occopus_restservice_ip}}:{{variables.occopus_restservice_port}}/infrastructures/$1/scaledown/$2
}
main() {
for i in $(seq 1 "$AMX_ALERT_LEN"); do
alert="AMX_ALERT_${i}_LABEL_alert"
infra="AMX_ALERT_${i}_LABEL_infra_id"
node="AMX_ALERT_${i}_LABEL_node"
if [ "${!alert}" = "overloaded" ]
then
over_loaded "${!infra}" "${!node}"
else
under_loaded "${!infra}" "${!node}"
fi
done
wait
}
main "$@"
Content type
Image
Digest
Size
70.9 MB
Last updated
over 9 years ago
docker pull rabotond/prometheus_executor