prometheus-adlermanager/prometheus-mock.sh
Evilham c1f7b12366
Partial rewrite with sane typing (modern python!)
While there, we get rid of annoying:
Failure: twisted.internet.defer.CancelledError

Whenever we would cancel a deferred (which we use a lot in this app)
2023-11-30 01:05:06 +01:00

32 lines
599 B
Bash
Executable file

#!/bin/sh
SITE="localhost"
SERVICE=dcl
COMPONENT=network
ALERTNAME=MockAlert
TOKEN=$(cat data/sites/${SITE}/tokens.txt | head -n1)
ADLERMANAGER="http://localhost:8080"
#TODO token
curl -X POST \
-H "Authorization: Bearer ${TOKEN}" \
localhost:8080/api/v1/alerts \
-d@- <<EOF
[
{
"labels": {
"adlermanager": "${SITE}",
"alertname": "${ALERTNAME}",
"service": "${SERVICE}",
"component": "${COMPONENT}",
"severity": "error"
},
"annotations": {
"summary": "Hello world!",
"description": "This is a mock alert"
}
}
]
EOF