Last active
August 29, 2015 14:16
-
-
Save jderrett/a703a2e5660ab153af3d to your computer and use it in GitHub Desktop.
Librato active alerts with service counts (using jq)
This file contains 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
# Required: | |
# http://stedolan.github.io/jq/ | |
# brew install jq | |
LIBRATO_USER="[email protected]" | |
LIBRATO_TOKEN="<your api token>" | |
LIBRATO_AUTH="$LIBRATO_USER:$LIBRATO_TOKEN" | |
ALERTS_ENDPOINT="https://metrics-api.librato.com/v1/alerts?version=2" | |
# Show active alerts with service counts (i.e. how many notifications are getting sent if it fires) | |
# And a URL to the alert | |
curl -s -X GET -u $LIBRATO_AUTH $ALERTS_ENDPOINT \ | |
| jq '.alerts[] | select(.active==true)' \ | |
| jq '{id: .id, url: ("https://metrics.librato.com/alerts#/" + (.id | tostring)), name: .name, service_count: (.services | length)}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment