Created
October 10, 2018 10:24
-
-
Save hpio/afd9cd093c65561df7d33a48aa4f77a7 to your computer and use it in GitHub Desktop.
Script to test Alertmanager's integrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| name=$RANDOM | |
| url='http://127.0.0.1:9093/api/v1/alerts' | |
| echo "firing up alert $name" | |
| # change url o | |
| curl -XPOST $url -d "[{ | |
| \"status\": \"firing\", | |
| \"labels\": { | |
| \"alertname\": \"$name\", | |
| \"service\": \"my-service\", | |
| \"severity\":\"1\", | |
| \"escalation\":\"pageduty\", | |
| \"instance\": \"$name.example.net\" | |
| }, | |
| \"annotations\": { | |
| \"summary\": \"High latency is high!\" | |
| }, | |
| \"generatorURL\": \"http://prometheus.int.example.net/<generating_expression>\" | |
| }]" | |
| echo "" | |
| echo "press enter to resolve alert" | |
| read | |
| echo "sending resolve" | |
| curl -XPOST $url -d "[{ | |
| \"status\": \"resolved\", | |
| \"labels\": { | |
| \"alertname\": \"$name\", | |
| \"service\": \"my-service\", | |
| \"severity\":\"1\", | |
| \"escalation\":\"pageduty\", | |
| \"instance\": \"$name.example.net\" | |
| }, | |
| \"annotations\": { | |
| \"summary\": \"High latency is high!\" | |
| }, | |
| \"generatorURL\": \"http://prometheus.int.example.net/<generating_expression>\" | |
| }]" | |
| echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment