local_settings.py 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. ## Graphite local_settings.py
  2. # Edit this file to customize the default Graphite webapp settings
  3. #
  4. # Additional customizations to Django settings can be added to this file as well
  5. #####################################
  6. # General Configuration #
  7. #####################################
  8. # Set this to a long, random unique string to use as a secret key for this
  9. # install. This key is used for salting of hashes used in auth tokens,
  10. # CRSF middleware, cookie storage, etc. This should be set identically among
  11. # instances if used behind a load balancer.
  12. #SECRET_KEY = 'UNSAFE_DEFAULT'
  13. # In Django 1.5+ set this to the list of hosts your graphite instances is
  14. # accessible as. See:
  15. # https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-ALLOWED_HOSTS
  16. #ALLOWED_HOSTS = [ '*' ]
  17. # Set your local timezone (Django's default is America/Chicago)
  18. # If your graphs appear to be offset by a couple hours then this probably
  19. # needs to be explicitly set to your local timezone.
  20. #TIME_ZONE = 'America/Los_Angeles'
  21. # Override this to provide documentation specific to your Graphite deployment
  22. #DOCUMENTATION_URL = "http://graphite.readthedocs.org/"
  23. # Logging
  24. #LOG_RENDERING_PERFORMANCE = True
  25. #LOG_CACHE_PERFORMANCE = True
  26. #LOG_METRIC_ACCESS = True
  27. # Enable full debug page display on exceptions (Internal Server Error pages)
  28. #DEBUG = True
  29. # If using RRD files and rrdcached, set to the address or socket of the daemon
  30. #FLUSHRRDCACHED = 'unix:/var/run/rrdcached.sock'
  31. # This lists the memcached servers that will be used by this webapp.
  32. # If you have a cluster of webapps you should ensure all of them
  33. # have the *exact* same value for this setting. That will maximize cache
  34. # efficiency. Setting MEMCACHE_HOSTS to be empty will turn off use of
  35. # memcached entirely.
  36. #
  37. # You should not use the loopback address (127.0.0.1) here if using clustering
  38. # as every webapp in the cluster should use the exact same values to prevent
  39. # unneeded cache misses. Set to [] to disable caching of images and fetched data
  40. #MEMCACHE_HOSTS = ['10.10.10.10:11211', '10.10.10.11:11211', '10.10.10.12:11211']
  41. #DEFAULT_CACHE_DURATION = 60 # Cache images and data for 1 minute
  42. #####################################
  43. # Filesystem Paths #
  44. #####################################
  45. # Change only GRAPHITE_ROOT if your install is merely shifted from /opt/graphite
  46. # to somewhere else
  47. #GRAPHITE_ROOT = '/opt/graphite'
  48. # Most installs done outside of a separate tree such as /opt/graphite will only
  49. # need to change these three settings. Note that the default settings for each
  50. # of these is relative to GRAPHITE_ROOT
  51. #CONF_DIR = '/opt/graphite/conf'
  52. #STORAGE_DIR = '/opt/graphite/storage'
  53. #CONTENT_DIR = '/opt/graphite/webapp/content'
  54. # To further or fully customize the paths, modify the following. Note that the
  55. # default settings for each of these are relative to CONF_DIR and STORAGE_DIR
  56. #
  57. ## Webapp config files
  58. #DASHBOARD_CONF = '/opt/graphite/conf/dashboard.conf'
  59. #GRAPHTEMPLATES_CONF = '/opt/graphite/conf/graphTemplates.conf'
  60. ## Data directories
  61. # NOTE: If any directory is unreadable in DATA_DIRS it will break metric browsing
  62. #WHISPER_DIR = '/opt/graphite/storage/whisper'
  63. #RRD_DIR = '/opt/graphite/storage/rrd'
  64. #DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
  65. #LOG_DIR = '/opt/graphite/storage/log/webapp'
  66. #INDEX_FILE = '/opt/graphite/storage/index' # Search index file
  67. #####################################
  68. # Email Configuration #
  69. #####################################
  70. # This is used for emailing rendered Graphs
  71. # Default backend is SMTP
  72. #EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  73. #EMAIL_HOST = 'localhost'
  74. #EMAIL_PORT = 25
  75. #EMAIL_HOST_USER = ''
  76. #EMAIL_HOST_PASSWORD = ''
  77. #EMAIL_USE_TLS = False
  78. # To drop emails on the floor, enable the Dummy backend:
  79. #EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
  80. #####################################
  81. # Authentication Configuration #
  82. #####################################
  83. ## LDAP / ActiveDirectory authentication setup
  84. #USE_LDAP_AUTH = True
  85. #LDAP_SERVER = "ldap.mycompany.com"
  86. #LDAP_PORT = 389
  87. # OR
  88. #LDAP_URI = "ldaps://ldap.mycompany.com:636"
  89. #LDAP_SEARCH_BASE = "OU=users,DC=mycompany,DC=com"
  90. #LDAP_BASE_USER = "CN=some_readonly_account,DC=mycompany,DC=com"
  91. #LDAP_BASE_PASS = "readonly_account_password"
  92. #LDAP_USER_QUERY = "(username=%s)" #For Active Directory use "(sAMAccountName=%s)"
  93. #
  94. # If you want to further customize the ldap connection options you should
  95. # directly use ldap.set_option to set the ldap module's global options.
  96. # For example:
  97. #
  98. #import ldap
  99. #ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
  100. #ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, "/etc/ssl/ca")
  101. #ldap.set_option(ldap.OPT_X_TLS_CERTFILE, "/etc/ssl/mycert.pem")
  102. #ldap.set_option(ldap.OPT_X_TLS_KEYFILE, "/etc/ssl/mykey.pem")
  103. # See http://www.python-ldap.org/ for further details on these options.
  104. ## REMOTE_USER authentication. See: https://docs.djangoproject.com/en/dev/howto/auth-remote-user/
  105. #USE_REMOTE_USER_AUTHENTICATION = True
  106. # Override the URL for the login link (e.g. for django_openid_auth)
  107. #LOGIN_URL = '/account/login'
  108. ##########################
  109. # Database Configuration #
  110. ##########################
  111. # By default sqlite is used. If you cluster multiple webapps you will need
  112. # to setup an external database (such as MySQL) and configure all of the webapp
  113. # instances to use the same database. Note that this database is only used to store
  114. # Django models such as saved graphs, dashboards, user preferences, etc.
  115. # Metric data is not stored here.
  116. #
  117. # DO NOT FORGET TO RUN 'manage.py syncdb' AFTER SETTING UP A NEW DATABASE
  118. #
  119. # The following built-in database engines are available:
  120. # django.db.backends.postgresql # Removed in Django 1.4
  121. # django.db.backends.postgresql_psycopg2
  122. # django.db.backends.mysql
  123. # django.db.backends.sqlite3
  124. # django.db.backends.oracle
  125. #
  126. # The default is 'django.db.backends.sqlite3' with file 'graphite.db'
  127. # located in STORAGE_DIR
  128. #
  129. #DATABASES = {
  130. # 'default': {
  131. # 'NAME': '/opt/graphite/storage/graphite.db',
  132. # 'ENGINE': 'django.db.backends.sqlite3',
  133. # 'USER': '',
  134. # 'PASSWORD': '',
  135. # 'HOST': '',
  136. # 'PORT': ''
  137. # }
  138. #}
  139. #
  140. #########################
  141. # Cluster Configuration #
  142. #########################
  143. # (To avoid excessive DNS lookups you want to stick to using IP addresses only in this entire section)
  144. #
  145. # This should list the IP address (and optionally port) of the webapp on each
  146. # remote server in the cluster. These servers must each have local access to
  147. # metric data. Note that the first server to return a match for a query will be
  148. # used.
  149. #CLUSTER_SERVERS = ["10.0.2.2:80", "10.0.2.3:80"]
  150. ## These are timeout values (in seconds) for requests to remote webapps
  151. #REMOTE_STORE_FETCH_TIMEOUT = 6 # Timeout to fetch series data
  152. #REMOTE_STORE_FIND_TIMEOUT = 2.5 # Timeout for metric find requests
  153. #REMOTE_STORE_RETRY_DELAY = 60 # Time before retrying a failed remote webapp
  154. #REMOTE_FIND_CACHE_DURATION = 300 # Time to cache remote metric find results
  155. ## Remote rendering settings
  156. # Set to True to enable rendering of Graphs on a remote webapp
  157. #REMOTE_RENDERING = True
  158. # List of IP (and optionally port) of the webapp on each remote server that
  159. # will be used for rendering. Note that each rendering host should have local
  160. # access to metric data or should have CLUSTER_SERVERS configured
  161. #RENDERING_HOSTS = []
  162. #REMOTE_RENDER_CONNECT_TIMEOUT = 1.0
  163. # If you are running multiple carbon-caches on this machine (typically behind a relay using
  164. # consistent hashing), you'll need to list the ip address, cache query port, and instance name of each carbon-cache
  165. # instance on the local machine (NOT every carbon-cache in the entire cluster). The default cache query port is 7002
  166. # and a common scheme is to use 7102 for instance b, 7202 for instance c, etc.
  167. #
  168. # You *should* use 127.0.0.1 here in most cases
  169. #CARBONLINK_HOSTS = ["127.0.0.1:7002:a", "127.0.0.1:7102:b", "127.0.0.1:7202:c"]
  170. #CARBONLINK_TIMEOUT = 1.0
  171. #####################################
  172. # Additional Django Settings #
  173. #####################################
  174. # Uncomment the following line for direct access to Django settings such as
  175. # MIDDLEWARE_CLASSES or APPS
  176. #from graphite.app_settings import *
  177. import os
  178. LOG_DIR = '/var/log/graphite'
  179. SECRET_KEY = '$(date +%s | sha256sum | base64 | head -c 64)'
  180. if (os.getenv("MEMCACHE_HOST") is not None):
  181. MEMCACHE_HOSTS = os.getenv("MEMCACHE_HOST").split(",")
  182. if (os.getenv("DEFAULT_CACHE_DURATION") is not None):
  183. DEFAULT_CACHE_DURATION = int(os.getenv("CACHE_DURATION"))