carbon.conf.j2 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. [cache]
  2. # Configure carbon directories.
  3. #
  4. # OS environment variables can be used to tell carbon where graphite is
  5. # installed, where to read configuration from and where to write data.
  6. #
  7. # GRAPHITE_ROOT - Root directory of the graphite installation.
  8. # Defaults to ../
  9. # GRAPHITE_CONF_DIR - Configuration directory (where this file lives).
  10. # Defaults to $GRAPHITE_ROOT/conf/
  11. # GRAPHITE_STORAGE_DIR - Storage directory for whisper/rrd/log/pid files.
  12. # Defaults to $GRAPHITE_ROOT/storage/
  13. #
  14. # To change other directory paths, add settings to this file. The following
  15. # configuration variables are available with these default values:
  16. #
  17. # STORAGE_DIR = $GRAPHITE_STORAGE_DIR
  18. # LOCAL_DATA_DIR = STORAGE_DIR/whisper/
  19. # WHITELISTS_DIR = STORAGE_DIR/lists/
  20. # CONF_DIR = STORAGE_DIR/conf/
  21. # LOG_DIR = STORAGE_DIR/log/
  22. # PID_DIR = STORAGE_DIR/
  23. #
  24. # For FHS style directory structures, use:
  25. #
  26. # STORAGE_DIR = /var/lib/carbon/
  27. # CONF_DIR = /etc/carbon/
  28. # LOG_DIR = /var/log/carbon/
  29. # PID_DIR = /var/run/
  30. #
  31. #LOCAL_DATA_DIR = /opt/graphite/storage/whisper/
  32. STORAGE_DIR = /var/lib/graphite/
  33. LOCAL_DATA_DIR = /var/lib/graphite/whisper/
  34. CONF_DIR = /etc/carbon/
  35. LOG_DIR = /var/log/carbon/
  36. PID_DIR = /var/run/
  37. # Enable daily log rotation. If disabled, carbon will automatically re-open
  38. # the file if it's rotated out of place (e.g. by logrotate daemon)
  39. ENABLE_LOGROTATION = True
  40. # Specify the user to drop privileges to
  41. # If this is blank carbon runs as the user that invokes it
  42. # This user must have write access to the local data directory
  43. USER = www-data
  44. #
  45. # NOTE: The above settings must be set under [relay] and [aggregator]
  46. # to take effect for those daemons as well
  47. # Limit the size of the cache to avoid swapping or becoming CPU bound.
  48. # Sorts and serving cache queries gets more expensive as the cache grows.
  49. # Use the value "inf" (infinity) for an unlimited cache size.
  50. MAX_CACHE_SIZE = inf
  51. # Limits the number of whisper update_many() calls per second, which effectively
  52. # means the number of write requests sent to the disk. This is intended to
  53. # prevent over-utilizing the disk and thus starving the rest of the system.
  54. # When the rate of required updates exceeds this, then carbon's caching will
  55. # take effect and increase the overall throughput accordingly.
  56. MAX_UPDATES_PER_SECOND = 500
  57. # If defined, this changes the MAX_UPDATES_PER_SECOND in Carbon when a
  58. # stop/shutdown is initiated. This helps when MAX_UPDATES_PER_SECOND is
  59. # relatively low and carbon has cached a lot of updates; it enables the carbon
  60. # daemon to shutdown more quickly.
  61. # MAX_UPDATES_PER_SECOND_ON_SHUTDOWN = 1000
  62. # Softly limits the number of whisper files that get created each minute.
  63. # Setting this value low (e.g. 50) is a good way to ensure that your carbon
  64. # system will not be adversely impacted when a bunch of new metrics are
  65. # sent to it. The trade off is that any metrics received in excess of this
  66. # value will be silently dropped, and the whisper file will not be created
  67. # until such point as a subsequent metric is received and fits within the
  68. # defined rate limit. Setting this value high (like "inf" for infinity) will
  69. # cause carbon to create the files quickly but at the risk of increased I/O.
  70. MAX_CREATES_PER_MINUTE = inf
  71. # Set the interface and port for the line (plain text) listener. Setting the
  72. # interface to 0.0.0.0 listens on all interfaces. Port can be set to 0 to
  73. # disable this listener if it is not required.
  74. LINE_RECEIVER_INTERFACE = 127.0.0.1
  75. # LINE_RECEIVER_PORT = 2003
  76. # Set the TCP backlog for the listen socket created by the line receiver. You
  77. # shouldn't change this unless you know what you're doing.
  78. # LINE_RECEIVER_BACKLOG = 1024
  79. # Set this to True to enable the UDP listener. By default this is off
  80. # because it is very common to run multiple carbon daemons and managing
  81. # another (rarely used) port for every carbon instance is not fun.
  82. ENABLE_UDP_LISTENER = False
  83. UDP_RECEIVER_INTERFACE = 127.0.0.1
  84. # UDP_RECEIVER_PORT = 2003
  85. # Set the interface and port for the pickle listener. Setting the interface to
  86. # 0.0.0.0 listens on all interfaces. Port can be set to 0 to disable this
  87. # listener if it is not required.
  88. PICKLE_RECEIVER_INTERFACE = 127.0.0.1
  89. # PICKLE_RECEIVER_PORT = 2004
  90. # Set the TCP backlog for the listen socket created by the pickle receiver. You
  91. # shouldn't change this unless you know what you're doing.
  92. # PICKLE_RECEIVER_BACKLOG = 1024
  93. # Set to false to disable logging of successful connections
  94. LOG_LISTENER_CONNECTIONS = True
  95. # Per security concerns outlined in Bug #817247 the pickle receiver
  96. # will use a more secure and slightly less efficient unpickler.
  97. # Set this to True to revert to the old-fashioned insecure unpickler.
  98. USE_INSECURE_UNPICKLER = False
  99. CACHE_QUERY_INTERFACE = 127.0.0.1
  100. # CACHE_QUERY_PORT = 7002
  101. # Set the TCP backlog for the listen socket created by the cache query
  102. # listener. You shouldn't change this unless you know what you're doing.
  103. # CACHE_QUERY_BACKLOG = 1024
  104. # Set this to False to drop datapoints received after the cache
  105. # reaches MAX_CACHE_SIZE. If this is True (the default) then sockets
  106. # over which metrics are received will temporarily stop accepting
  107. # data until the cache size falls below 95% MAX_CACHE_SIZE.
  108. USE_FLOW_CONTROL = True
  109. # By default, carbon-cache will log every whisper update and cache hit. This can be excessive and
  110. # degrade performance if logging on the same volume as the whisper data is stored.
  111. LOG_UPDATES = False
  112. LOG_CACHE_HITS = False
  113. LOG_CACHE_QUEUE_SORTS = True
  114. # The thread that writes metrics to disk can use on of the following strategies
  115. # determining the order in which metrics are removed from cache and flushed to
  116. # disk. The default option preserves the same behavior as has been historically
  117. # available in version 0.9.10.
  118. #
  119. # sorted - All metrics in the cache will be counted and an ordered list of
  120. # them will be sorted according to the number of datapoints in the cache at the
  121. # moment of the list's creation. Metrics will then be flushed from the cache to
  122. # disk in that order.
  123. #
  124. # max - The writer thread will always pop and flush the metric from cache
  125. # that has the most datapoints. This will give a strong flush preference to
  126. # frequently updated metrics and will also reduce random file-io. Infrequently
  127. # updated metrics may only ever be persisted to disk at daemon shutdown if
  128. # there are a large number of metrics which receive very frequent updates OR if
  129. # disk i/o is very slow.
  130. #
  131. # naive - Metrics will be flushed from the cache to disk in an unordered
  132. # fashion. This strategy may be desirable in situations where the storage for
  133. # whisper files is solid state, CPU resources are very limited or deference to
  134. # the OS's i/o scheduler is expected to compensate for the random write
  135. # pattern.
  136. #
  137. CACHE_WRITE_STRATEGY = max
  138. # On some systems it is desirable for whisper to write synchronously.
  139. # Set this option to True if you'd like to try this. Basically it will
  140. # shift the onus of buffering writes from the kernel into carbon's cache.
  141. WHISPER_AUTOFLUSH = True
  142. # By default new Whisper files are created pre-allocated with the data region
  143. # filled with zeros to prevent fragmentation and speed up contiguous reads and
  144. # writes (which are common). Enabling this option will cause Whisper to create
  145. # the file sparsely instead. Enabling this option may allow a large increase of
  146. # MAX_CREATES_PER_MINUTE but may have longer term performance implications
  147. # depending on the underlying storage configuration.
  148. # WHISPER_SPARSE_CREATE = False
  149. # Only beneficial on linux filesystems that support the fallocate system call.
  150. # It maintains the benefits of contiguous reads/writes, but with a potentially
  151. # much faster creation speed, by allowing the kernel to handle the block
  152. # allocation and zero-ing. Enabling this option may allow a large increase of
  153. # MAX_CREATES_PER_MINUTE. If enabled on an OS or filesystem that is unsupported
  154. # this option will gracefully fallback to standard POSIX file access methods.
  155. WHISPER_FALLOCATE_CREATE = True
  156. # Enabling this option will cause Whisper to lock each Whisper file it writes
  157. # to with an exclusive lock (LOCK_EX, see: man 2 flock). This is useful when
  158. # multiple carbon-cache daemons are writing to the same files
  159. WHISPER_LOCK_WRITES = False
  160. # Set this to True to enable whitelisting and blacklisting of metrics in
  161. # CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or
  162. # empty, all metrics will pass through
  163. # USE_WHITELIST = False
  164. # By default, carbon itself will log statistics (such as a count,
  165. # metricsReceived) with the top level prefix of 'carbon' at an interval of 60
  166. # seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation
  167. CARBON_METRIC_PREFIX = carbon
  168. CARBON_METRIC_INTERVAL = 60
  169. # Enable AMQP if you want to receve metrics using an amqp broker
  170. # ENABLE_AMQP = False
  171. # Verbose means a line will be logged for every metric received
  172. # useful for testing
  173. # AMQP_VERBOSE = False
  174. # AMQP_HOST = localhost
  175. # AMQP_PORT = 5672
  176. # AMQP_VHOST = /
  177. # AMQP_USER = guest
  178. # AMQP_PASSWORD = guest
  179. # AMQP_EXCHANGE = graphite
  180. # AMQP_METRIC_NAME_IN_BODY = False
  181. # The manhole interface allows you to SSH into the carbon daemon
  182. # and get a python interpreter. BE CAREFUL WITH THIS! If you do
  183. # something like time.sleep() in the interpreter, the whole process
  184. # will sleep! This is *extremely* helpful in debugging, assuming
  185. # you are familiar with the code. If you are not, please don't
  186. # mess with this, you are asking for trouble :)
  187. #
  188. # ENABLE_MANHOLE = False
  189. # MANHOLE_INTERFACE = 127.0.0.1
  190. # MANHOLE_PORT = 7222
  191. # MANHOLE_USER = admin
  192. # MANHOLE_PUBLIC_KEY = ssh-rsa AAAAB3NzaC1yc2EAAAABiwAaAIEAoxN0sv/e4eZCPpi3N3KYvyzRaBaMeS2RsOQ/cDuKv11dlNzVeiyc3RFmCv5Rjwn/lQ79y0zyHxw67qLyhQ/kDzINc4cY41ivuQXm2tPmgvexdrBv5nsfEpjs3gLZfJnyvlcVyWK/lId8WUvEWSWHTzsbtmXAF2raJMdgLTbQ8wE=
  193. # Patterns for all of the metrics this machine will store. Read more at
  194. # http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol#Bindings
  195. #
  196. # Example: store all sales, linux servers, and utilization metrics
  197. # BIND_PATTERNS = sales.#, servers.linux.#, #.utilization
  198. #
  199. # Example: store everything
  200. # BIND_PATTERNS = #
  201. # To configure special settings for the carbon-cache instance 'b', uncomment this:
  202. #[cache:b]
  203. #LINE_RECEIVER_PORT = 2103
  204. #PICKLE_RECEIVER_PORT = 2104
  205. #CACHE_QUERY_PORT = 7102
  206. # and any other settings you want to customize, defaults are inherited
  207. # from [carbon] section.
  208. # You can then specify the --instance=b option to manage this instance
  209. {% for instance in graphite.cache_instances %}
  210. [cache:{{instance.name}}]
  211. LINE_RECEIVER_PORT = {{2003 + loop.index * 100}}
  212. UDP_RECEIVER_PORT = {{2003 + loop.index * 100}}
  213. PICKLE_RECEIVER_PORT = {{2004 + loop.index * 100}}
  214. CACHE_QUERY_PORT = {{7002 + loop.index * 100}}
  215. {% endfor %}
  216. [relay]
  217. USER = www-data
  218. LINE_RECEIVER_INTERFACE = 0.0.0.0
  219. LINE_RECEIVER_PORT = 2003
  220. PICKLE_RECEIVER_INTERFACE = 0.0.0.0
  221. PICKLE_RECEIVER_PORT = 2004
  222. # Set to false to disable logging of successful connections
  223. LOG_LISTENER_CONNECTIONS = True
  224. # Carbon-relay has several options for metric routing controlled by RELAY_METHOD
  225. #
  226. # Use relay-rules.conf to route metrics to destinations based on pattern rules
  227. #RELAY_METHOD = rules
  228. #
  229. # Use consistent-hashing for even distribution of metrics between destinations
  230. #RELAY_METHOD = consistent-hashing
  231. #
  232. # Use consistent-hashing but take into account an aggregation-rules.conf shared
  233. # by downstream carbon-aggregator daemons. This will ensure that all metrics
  234. # that map to a given aggregation rule are sent to the same carbon-aggregator
  235. # instance.
  236. # Enable this for carbon-relays that send to a group of carbon-aggregators
  237. RELAY_METHOD = {{graphite.relay.method}}
  238. #RELAY_METHOD = rules
  239. # If you use consistent-hashing you can add redundancy by replicating every
  240. # datapoint to more than one machine.
  241. REPLICATION_FACTOR = 1
  242. # For REPLICATION_FACTOR >=2, set DIVERSE_REPLICAS to True to guarantee replicas
  243. # across distributed hosts. With this setting disabled, it's possible that replicas
  244. # may be sent to different caches on the same host. This has been the default
  245. # behavior since introduction of 'consistent-hashing' relay method.
  246. # Note that enabling this on an existing pre-0.9.14 cluster will require rebalancing
  247. # your metrics across the cluster nodes using a tool like Carbonate.
  248. #DIVERSE_REPLICAS = False
  249. # This is a list of carbon daemons we will send any relayed or
  250. # generated metrics to. The default provided would send to a single
  251. # carbon-cache instance on the default port. However if you
  252. # use multiple carbon-cache instances then it would look like this:
  253. #
  254. # DESTINATIONS = 127.0.0.1:2004:a, 127.0.0.1:2104:b
  255. #
  256. # The general form is IP:PORT:INSTANCE where the :INSTANCE part is
  257. # optional and refers to the "None" instance if omitted.
  258. #
  259. # Note that if the destinations are all carbon-caches then this should
  260. # exactly match the webapp's CARBONLINK_HOSTS setting in terms of
  261. # instances listed (order matters!).
  262. #
  263. # If using RELAY_METHOD = rules, all destinations used in relay-rules.conf
  264. # must be defined in this list
  265. DESTINATIONS = {% for instance in graphite.cache_instances %}127.0.0.1:{{2004 + loop.index * 100}}:{{instance.name}}{% if not loop.last %}, {% endif %}{% endfor %}
  266. # This defines the maximum "message size" between carbon daemons.
  267. # You shouldn't need to tune this unless you really know what you're doing.
  268. MAX_DATAPOINTS_PER_MESSAGE = 500
  269. MAX_QUEUE_SIZE = 10000
  270. # This is the percentage that the queue must be empty before it will accept
  271. # more messages. For a larger site, if the queue is very large it makes sense
  272. # to tune this to allow for incoming stats. So if you have an average
  273. # flow of 100k stats/minute, and a MAX_QUEUE_SIZE of 3,000,000, it makes sense
  274. # to allow stats to start flowing when you've cleared the queue to 95% since
  275. # you should have space to accommodate the next minute's worth of stats
  276. # even before the relay incrementally clears more of the queue
  277. QUEUE_LOW_WATERMARK_PCT = 0.8
  278. # Set this to False to drop datapoints when any send queue (sending datapoints
  279. # to a downstream carbon daemon) hits MAX_QUEUE_SIZE. If this is True (the
  280. # default) then sockets over which metrics are received will temporarily stop accepting
  281. # data until the send queues fall below QUEUE_LOW_WATERMARK_PCT * MAX_QUEUE_SIZE.
  282. USE_FLOW_CONTROL = True
  283. # Set this to True to enable whitelisting and blacklisting of metrics in
  284. # CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or
  285. # empty, all metrics will pass through
  286. # USE_WHITELIST = False
  287. # By default, carbon itself will log statistics (such as a count,
  288. # metricsReceived) with the top level prefix of 'carbon' at an interval of 60
  289. # seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation
  290. CARBON_METRIC_PREFIX = carbon
  291. CARBON_METRIC_INTERVAL = 60
  292. [aggregator]
  293. LINE_RECEIVER_INTERFACE = 0.0.0.0
  294. LINE_RECEIVER_PORT = 2023
  295. PICKLE_RECEIVER_INTERFACE = 0.0.0.0
  296. PICKLE_RECEIVER_PORT = 2024
  297. # Set to false to disable logging of successful connections
  298. LOG_LISTENER_CONNECTIONS = True
  299. # If set true, metric received will be forwarded to DESTINATIONS in addition to
  300. # the output of the aggregation rules. If set false the carbon-aggregator will
  301. # only ever send the output of aggregation. Default value is set to false and will not forward
  302. FORWARD_ALL = False
  303. # Filenames of the configuration files to use for this instance of aggregator.
  304. # Filenames are relative to CONF_DIR.
  305. #
  306. # AGGREGATION_RULES = aggregation-rules.conf
  307. # REWRITE_RULES = rewrite-rules.conf
  308. # This is a list of carbon daemons we will send any relayed or
  309. # generated metrics to. The default provided would send to a single
  310. # carbon-cache instance on the default port. However if you
  311. # use multiple carbon-cache instances then it would look like this:
  312. #
  313. # DESTINATIONS = 127.0.0.1:2004:a, 127.0.0.1:2104:b
  314. #
  315. # The format is comma-delimited IP:PORT:INSTANCE where the :INSTANCE part is
  316. # optional and refers to the "None" instance if omitted.
  317. #
  318. # Note that if the destinations are all carbon-caches then this should
  319. # exactly match the webapp's CARBONLINK_HOSTS setting in terms of
  320. # instances listed (order matters!).
  321. DESTINATIONS = 127.0.0.1:2004
  322. # If you want to add redundancy to your data by replicating every
  323. # datapoint to more than one machine, increase this.
  324. REPLICATION_FACTOR = 1
  325. # This is the maximum number of datapoints that can be queued up
  326. # for a single destination. Once this limit is hit, we will
  327. # stop accepting new data if USE_FLOW_CONTROL is True, otherwise
  328. # we will drop any subsequently received datapoints.
  329. MAX_QUEUE_SIZE = 10000
  330. # Set this to False to drop datapoints when any send queue (sending datapoints
  331. # to a downstream carbon daemon) hits MAX_QUEUE_SIZE. If this is True (the
  332. # default) then sockets over which metrics are received will temporarily stop accepting
  333. # data until the send queues fall below 80% MAX_QUEUE_SIZE.
  334. USE_FLOW_CONTROL = True
  335. # This defines the maximum "message size" between carbon daemons.
  336. # You shouldn't need to tune this unless you really know what you're doing.
  337. MAX_DATAPOINTS_PER_MESSAGE = 500
  338. # This defines how many datapoints the aggregator remembers for
  339. # each metric. Aggregation only happens for datapoints that fall in
  340. # the past MAX_AGGREGATION_INTERVALS * intervalSize seconds.
  341. MAX_AGGREGATION_INTERVALS = 5
  342. # By default (WRITE_BACK_FREQUENCY = 0), carbon-aggregator will write back
  343. # aggregated data points once every rule.frequency seconds, on a per-rule basis.
  344. # Set this (WRITE_BACK_FREQUENCY = N) to write back all aggregated data points
  345. # every N seconds, independent of rule frequency. This is useful, for example,
  346. # to be able to query partially aggregated metrics from carbon-cache without
  347. # having to first wait rule.frequency seconds.
  348. # WRITE_BACK_FREQUENCY = 0
  349. # Set this to True to enable whitelisting and blacklisting of metrics in
  350. # CONF_DIR/whitelist and CONF_DIR/blacklist. If the whitelist is missing or
  351. # empty, all metrics will pass through
  352. # USE_WHITELIST = False
  353. # By default, carbon itself will log statistics (such as a count,
  354. # metricsReceived) with the top level prefix of 'carbon' at an interval of 60
  355. # seconds. Set CARBON_METRIC_INTERVAL to 0 to disable instrumentation
  356. # CARBON_METRIC_PREFIX = carbon
  357. # CARBON_METRIC_INTERVAL = 60