Created
May 13, 2014 14:22
-
-
Save coderofsalvation/7ca4aff5d84fb888e9d3 to your computer and use it in GitHub Desktop.
feed metrics to graphite using bash
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 | |
# Set this hostname | |
HOSTNAME=`hostname --short` | |
# Set Graphite host | |
GRAPHITE=my.graphite.host | |
GRAPHITE_PORT=2003 | |
# Loop forever | |
while : | |
do | |
# Get epoch | |
DATE=`date +%s` | |
# Collect some random data for | |
# this example | |
MY_DATA=`ls /tmp | wc -l` | |
# Send data to Graphite | |
echo "stats.${HOSTNAME}.tmp.file.count ${MY_DATA} ${DATE}" | nc $GRAPHITE $GRAPHITE_PORT | |
sleep 10 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment