Created
June 18, 2014 19:27
-
-
Save logikal/799ef1af227dc751280b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Set Graphite host | |
| GRAPHITE=graphite.sjc1.sendgrid.net | |
| GRAPHITE_PORT=2003 | |
| # Loop forever | |
| while : | |
| do | |
| # Get epoch | |
| DATE=`date +%s` | |
| # Collect some random data for | |
| # this example | |
| MY_DATA=`knife ssh "(role:filter OR role:go_filter) AND chef_environment:production* NOT fqdn:filter-163.sjc1.sendgrid.net" "/opt/sendgrid/elasticd/current/elasq.pl -c" -c ~/.chef/knife-11.rb -x skilgore -C 10 | awk '{print $3}' | awk '{s+=$1} END {print s}'` | |
| # Send data to Graphite | |
| echo "sending data: stats.elasticd.total_queue ${MY_DATA} ${DATE}" | |
| echo "sean.elasticd.total_queue ${MY_DATA} ${DATE}" | nc $GRAPHITE $GRAPHITE_PORT | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment