Created
August 24, 2012 09:24
-
-
Save zyegfryed/3448114 to your computer and use it in GitHub Desktop.
pystatsd installation script
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
apt-get install python-pip | |
pip install pystatsd | |
cat > /etc/default/statsd <<EOF | |
STATSD_PORT=8125 # port to run on (default: 8125) | |
PCT=90 # stats pct threshold (default: 90) | |
GRAPHITE_HOST=localhost # host to connect to graphite on (default: localhost) | |
GRAPHITE_PORT=2003 # port to connect to graphite on (default: 2003) | |
USER=nobody # user to run statsd as | |
EOF | |
cat > /etc/init/statsd.conf <<EOF | |
description "start and stop the statsd server" | |
version "1.1" | |
author "Rob Terhaar" | |
description "statsd server" | |
respawn limit 15 5 | |
#oom never | |
start on (local-filesystems | |
and net-device-up IFACE!=lo) | |
stop on shutdown | |
respawn | |
pre-start script | |
. /etc/default/statsd | |
end script | |
script | |
. /etc/default/statsd | |
exec su -s /bin/sh -c "/usr/local/bin/pystatsd-server \ | |
--port $STATSD_PORT \ | |
--pct $PCT \ | |
--graphite-host $GRAPHITE_HOST \ | |
--graphite-port $GRAPHITE_PORT" $USER | |
end script | |
post-stop script | |
end script | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment