Skip to content

Instantly share code, notes, and snippets.

@zyegfryed
Created Aug 24, 2012
Embed
What would you like to do?
pystatsd installation script
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