Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PromQL CLI
#!/bin/bash
# Basic: HOSTNAME=prom.something.com ./promql.sh '(time() - puppet_time{type="last_run"}) > 4801'
# Getting something useful out from this looks like this. Best used in combination with JQ.
# Complete: HOSTNAME=prom.something.com ./promql.sh '(time() - puppet_time{type="last_run"}) > 4801' | jq '.data.result[] | .metric.host'
curl \
-X GET \
-G \
-s \
--data-urlencode "query=$1" \
"https://$HOSTNAME/api/v1/query"
# Make output look a little nicer.
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.