Permalink
Browse files

initial graphite cookbook

  • Loading branch information...
0 parents commit 9475e9fe60a6cfa86c1ced65f8a75d8abd5fb2c4 @dje dje committed Feb 20, 2011
@@ -0,0 +1,12 @@
+= DESCRIPTION:
+
+= REQUIREMENTS:
+
+= ATTRIBUTES:
+
+= USAGE:
+
+= CAVEATS:
+
+I didn't see an easy way to set Graphite's credentials easily.
+I set those to root/root with an email address going no where.
@@ -0,0 +1,9 @@
+default[:graphite][:carbon][:version] = "0.9.7"
+default[:graphite][:carbon][:uri] = "http://launchpadlibrarian.net/61904798/carbon-0.9.7.tar.gz"
+default[:graphite][:carbon][:checksum] = "ba698aca"
+default[:graphite][:whisper][:version] = "0.9.7"
+default[:graphite][:whisper][:uri] = "http://launchpadlibrarian.net/61904764/whisper-0.9.7.tar.gz"
+default[:graphite][:whisper][:checksum] = "c6272ad6"
+default[:graphite][:graphite_web][:version] = "0.9.7c"
+default[:graphite][:graphite_web][:uri] = "http://launchpadlibrarian.net/62379635/graphite-web-0.9.7c.tar.gz"
+default[:graphite][:graphite_web][:checksum] = "a3e16265"
Binary file not shown.
@@ -0,0 +1,38 @@
+{
+ "name": "graphite",
+ "description": "Installs/Configures graphite",
+ "long_description": "= DESCRIPTION:\n\n= REQUIREMENTS:\n\n= ATTRIBUTES:\n\n= USAGE:\n\n= CAVEATS:\n\nI didn't see an easy way to set Graphite's credentials easily.\nI set those to root/root with an email address going no where.\n",
+ "maintainer": "Heavy Water Software Inc.",
+ "maintainer_email": "darrin@heavywater.ca",
+ "license": "Apache 2.0",
+ "platforms": {
+ "ubuntu": [
+
+ ]
+ },
+ "dependencies": {
+ "python": [
+
+ ],
+ "apache2": [
+
+ ]
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ },
+ "groupings": {
+ },
+ "recipes": {
+ },
+ "version": "0.0.1"
+}
@@ -0,0 +1,10 @@
+maintainer "Heavy Water Software Inc."
+maintainer_email "darrin@heavywater.ca"
+license "Apache 2.0"
+description "Installs/Configures graphite"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.0.1"
+
+depends "python"
+depends "apache2"
+supports "ubuntu"
@@ -0,0 +1,25 @@
+remote_file "/usr/src/carbon-#{node.graphite.carbon.version}.tar.gz" do
+ source node.graphite.carbon.uri
+ checksum node.graphite.carbon.checksum
+end
+
+execute "untar carbon" do
+ command "tar xzf carbon-#{node.graphite.carbon.version}.tar.gz"
+ creates "/usr/src/carbon-#{node.graphite.carbon.version}"
+ cwd "/usr/src"
+end
+
+execute "install carbon" do
+ command "python setup.py install"
+ creates "/opt/graphite/lib/carbon-#{node.graphite.carbon.version}-py2.6.egg-info"
+ cwd "/usr/src/carbon-#{node.graphite.carbon.version}"
+end
+
+template "/opt/graphite/conf/carbon.conf"
+template "/opt/graphite/conf/storage-schemas.conf"
+
+service "carbon-cache" do
+ pattern "carbon-cache"
+ start_command "/opt/graphite/bin/carbon-cache.py start"
+ action :start
+end
@@ -0,0 +1,25 @@
+#
+# Cookbook Name:: graphite
+# Recipe:: default
+#
+# Copyright 2011, Heavy Water Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "python"
+
+include_recipe "graphite::whisper"
+include_recipe "graphite::carbon"
+include_recipe "graphite::web"
+
@@ -0,0 +1,48 @@
+include_recipe "apache2::mod_python"
+
+package "python-cairo-dev"
+package "python-django"
+package "python-memcache"
+
+remote_file "/usr/src/graphite-web-#{node.graphite.graphite_web.version}.tar.gz" do
+ source node.graphite.graphite_web.uri
+ checksum node.graphite.graphite_web.checksum
+end
+
+execute "untar graphite-web" do
+ command "tar xzf graphite-web-#{node.graphite.graphite_web.version}.tar.gz"
+ creates "/usr/src/graphite-web-#{node.graphite.graphite_web.version}"
+ cwd "/usr/src"
+end
+
+execute "install graphite-web" do
+ command "python setup.py install"
+ creates "/opt/graphite/webapp/graphite_web-#{node.graphite.graphite_web.version}-py2.6.egg-info"
+ cwd "/usr/src/graphite-web-#{node.graphite.graphite_web.version}"
+end
+
+template "/etc/apache2/sites-available/graphite" do
+ source "graphite-vhost.conf.erb"
+end
+
+apache_site "000-default" do
+ enable false
+end
+
+apache_site "graphite"
+
+directory "/opt/graphite/storage/log/webapp" do
+ owner "www-data"
+ group "www-data"
+end
+
+directory "/opt/graphite/storage" do
+ owner "www-data"
+ group "www-data"
+end
+
+cookbook_file "/opt/graphite/storage/graphite.db" do
+ owner "www-data"
+ group "www-data"
+ action :create_if_missing
+end
@@ -0,0 +1,16 @@
+remote_file "/usr/src/whisper-#{node.graphite.whisper.version}.tar.gz" do
+ source node.graphite.whisper.uri
+ checksum node.graphite.whisper.checksum
+end
+
+execute "untar whisper" do
+ command "tar xzf whisper-#{node.graphite.whisper.version}.tar.gz"
+ creates "/usr/src/whisper-#{node.graphite.whisper.version}"
+ cwd "/usr/src"
+end
+
+execute "install whisper" do
+ command "python setup.py install"
+ creates "/usr/local/lib/python2.6/dist-packages/whisper-#{node.graphite.whisper.version}.egg-info"
+ cwd "/usr/src/whisper-#{node.graphite.whisper.version}"
+end
@@ -0,0 +1,79 @@
+[cache]
+LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
+
+# Specify the user to drop privileges to
+# If this is blank carbon runs as the user that invokes it
+# This user must have write access to the local data directory
+USER =
+
+# Limit the size of the cache to avoid swapping or becoming CPU bound.
+# Sorts and serving cache queries gets more expensive as the cache grows.
+# Use the value "inf" (infinity) for an unlimited cache size.
+MAX_CACHE_SIZE = inf
+
+# Limits the number of whisper update_many() calls per second, which effectively
+# means the number of write requests sent to the disk. This is intended to
+# prevent over-utilizing the disk and thus starving the rest of the system.
+# When the rate of required updates exceeds this, then carbon's caching will
+# take effect and increase the overall throughput accordingly.
+MAX_UPDATES_PER_SECOND = 1000
+
+# Softly limits the number of whisper files that get created each minute.
+# Setting this value low (like at 50) is a good way to ensure your graphite
+# system will not be adversely impacted when a bunch of new metrics are
+# sent to it. The trade off is that it will take much longer for those metrics'
+# database files to all get created and thus longer until the data becomes usable.
+# Setting this value high (like "inf" for infinity) will cause graphite to create
+# the files quickly but at the risk of slowing I/O down considerably for a while.
+MAX_CREATES_PER_MINUTE = inf
+
+LINE_RECEIVER_INTERFACE = 0.0.0.0
+LINE_RECEIVER_PORT = 2003
+
+PICKLE_RECEIVER_INTERFACE = 0.0.0.0
+PICKLE_RECEIVER_PORT = 2004
+
+CACHE_QUERY_INTERFACE = 0.0.0.0
+CACHE_QUERY_PORT = 7002
+
+# By default, carbon-cache will log every whisper update. This can be excessive and
+# degrade performance if logging on the same volume as the whisper data is stored.
+LOG_UPDATES = True
+
+
+# Enable AMQP if you want to receve metrics using an amqp broker
+# ENABLE_AMQP = False
+
+# Verbose means a line will be logged for every metric received
+# useful for testing
+# AMQP_VERBOSE = False
+
+# AMQP_HOST = localhost
+# AMQP_PORT = 5672
+# AMQP_VHOST = /
+# AMQP_USER = guest
+# AMQP_PASSWORD = guest
+# AMQP_EXCHANGE = graphite
+
+# Patterns for all of the metrics this machine will store. Read more at
+# http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol#Bindings
+#
+# Example: store all sales, linux servers, and utilization metrics
+# BIND_PATTERNS = sales.#, servers.linux.#, #.utilization
+#
+# Example: store everything
+# BIND_PATTERNS = #
+
+# NOTE: you cannot run both a cache and a relay on the same server
+# with the default configuration, you have to specify a distinict
+# interfaces and ports for the listeners.
+
+[relay]
+LINE_RECEIVER_INTERFACE = 0.0.0.0
+LINE_RECEIVER_PORT = 2003
+
+PICKLE_RECEIVER_INTERFACE = 0.0.0.0
+PICKLE_RECEIVER_PORT = 2004
+
+CACHE_SERVERS = server1, server2, server3
+MAX_QUEUE_SIZE = 10000
@@ -0,0 +1,38 @@
+NameVirtualHost *:80
+
+# You may need to manually edit this file to fit your needs.
+# This configuration assumes the default installation prefix
+# of /opt/graphite/, if you installed graphite somewhere else
+# you will need to change all the occurances of /opt/graphite/
+# in this file to your chosen install location.
+
+<VirtualHost *:80>
+ ServerName graphite
+ DocumentRoot "/opt/graphite/webapp"
+ ErrorLog /opt/graphite/storage/log/webapp/error.log
+ CustomLog /opt/graphite/storage/log/webapp/access.log common
+
+ <Location "/">
+ SetHandler python-program
+ PythonPath "['/opt/graphite/webapp'] + sys.path"
+ PythonHandler django.core.handlers.modpython
+ SetEnv DJANGO_SETTINGS_MODULE graphite.settings
+ PythonDebug Off
+ PythonAutoReload Off
+ </Location>
+
+ <Location "/content/">
+ SetHandler None
+ </Location>
+
+ <Location "/media/">
+ SetHandler None
+ </Location>
+
+ # NOTE: In order for the django admin site media to work you
+ # must change @DJANGO_ROOT@ to be the path to your django
+ # installation, which is probably something like:
+ # /usr/lib/python2.6/site-packages/django
+ Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
+
+</VirtualHost>
@@ -0,0 +1,4 @@
+[everything_1min_13months]
+priority = 100
+pattern = .*
+retentions = 60:565920

0 comments on commit 9475e9f

Please sign in to comment.