Last active
July 13, 2016 19:55
-
-
Save dbeckham/8057390 to your computer and use it in GitHub Desktop.
Graphite carbon-cache Upstart job - This upstart job attempts to duplicate the twistd configuration and command line options that carbon-cache.py uses, but will not daemonize so that an Ubuntu system can properly control carbon-cache. One caveat: the current version (as of 0.9.12) of the carbon code intentionally forces logging to STDOUT if the …
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
# carbon-cache-a upstart job | |
# | |
# Daniel Beckham | |
# @dbeckham | |
# https://github.com/dbeckham | |
# | |
# Tested with Graphite carbon tag v0.9.12 from: | |
# https://github.com/graphite-project/carbon | |
# | |
# Upstart config: /etc/init/carbon-cache-a.conf | |
# init.d symlink: /etc/init.d/carbon-cache-a -> /lib/init/upstart-job | |
# | |
# This upstart job attempts to duplicate the twistd configuration and | |
# command line options that carbon-cache.py uses, but will not daemonize | |
# so that an Ubuntu system can properly control carbon-cache. | |
# | |
# Fun fact, without --nodaemon, twistd carbon-cache forks five times (5!). | |
# Upstart wasn't designed to handle that level of wtf. | |
# | |
# If you would like to use this with a different instance name other than | |
# the default (a), replace carbon-cache-a with carbon-cache-<instancename> | |
# in this file and add '--instance <instancename>' to the script block | |
# after 'carbon-cache'. | |
# | |
# This file is generated for me using a Puppet template I created and I | |
# suggest you do the same using Puppet, Chef, or whatever your favorite | |
# configuration management solution is. | |
# | |
# Comments added to explain each option. | |
# | |
description "Graphite carbon-cache-a instance." | |
author "Puppet" | |
# If you are binding to something other than 0.0.0.0, consider | |
# using start on (local-filesystems and net-device-up IFACE!=lo) | |
# See: http://upstart.ubuntu.com/cookbook/#start-on | |
start on runlevel [2345] | |
stop on runlevel [016] | |
# GRAPHITE_ROOT is required by the Twisted plugin | |
env GRAPHITE_ROOT=/opt/graphite | |
# Twisted requires that the immediate parent directory of the | |
# plugin be in the Python sys path. | |
env PYTHONPATH=/opt/graphite/lib | |
# Since we aren't using carbon-cache.py, ensure that the log directories | |
# are created before running carbon-cache. | |
pre-start script | |
mkdir -p $GRAPHITE_ROOT/storage/log/carbon-cache/carbon-cache-a | |
end script | |
# Details taken from carbon/conf.py and carbon/util.py | |
# | |
# Added --nodaemon for obvious reasons | |
# Use --instance <instancename> after carbon-cache for a different intance | |
# | |
# WARNING: the current version (as of 0.9.12) of the carbon code intentionally | |
# forces logging to STDOUT if the twistd option --nodaemon is used without | |
# --stdout. If separate logs are still required for each log type, | |
# pass --stdout to twistd and filter your syslog appropriately. | |
script | |
exec twistd \ | |
--nodaemon \ | |
--reactor=epoll \ | |
--no_save \ | |
carbon-cache \ | |
--config $GRAPHITE_ROOT/conf/carbon.conf \ | |
2>&1 >> $GRAPHITE_ROOT/storage/log/carbon-cache/carbon-cache-a/console.log | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works great, thanks