Skip to content

Instantly share code, notes, and snippets.

@gmcintire
Forked from jonleighton/report_queue_length.sh
Created July 17, 2012 16:04
Show Gist options
  • Save gmcintire/3130306 to your computer and use it in GitHub Desktop.
Save gmcintire/3130306 to your computer and use it in GitHub Desktop.
#!/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