query Prometheus /api/v1/query and decide based on output the actions

18 views
Skip to first unread message

Evelyn Pereira Souza

unread,
Sep 15, 2021, 4:56:13 AM9/15/21
to Prometheus Users
Hi

We would like to start a job within K8s. We start this job based on the
value of a metric. The Prometheus server is outside of K8s.

Is this procedure correct? Using curl to query the HTTP API of
Prometheus and then, based on output start a job or not?

Are there other possibilities?

Is the curl correct? Can it be called every 10 sec?

curl -s -u "$USER:$PASS"
https://example.org/api/v1/query\?query\=cluster_location_azure | jq '.'
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "cluster_location_azure",
(...)
},
"value": [
1631694616.135,
"1"
]
}
]
}
}

kind regards
Evelyn
OpenPGP_0x61776FA8E38403FB.asc
OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages