Created
July 17, 2012 15:17
-
-
Save jonleighton/3130013 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Sends the length of each resque queue to Librato Metrics. | |
# Run it on a cron job and you'll have an idea of how backed up (or not) your queues are. | |
API_EMAIL="[email protected]" | |
API_TOKEN="1234..." | |
body="" | |
i=0 | |
for queue in `redis-cli --raw smembers resque:queues`; do | |
len=`redis-cli --raw llen resque:queue:$queue` | |
body="${body}gauges[$i][name]=resque.queue.$queue.length&gauges[$i][value]=$len&" | |
i=$((i+1)) | |
done | |
curl -u $API_EMAIL:$API_TOKEN -d $body -X POST https://metrics-api.librato.com/v1/metrics |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment