Skip to content

Commit bd43362

Browse files
authored
Merge pull request #220 from deniszh/deniszh/carbon-amqp
Adding AMQP control
2 parents 4949a51 + 142e947 commit bd43362

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ Graphite stores tag information in a separate tag database (TagDB). Please check
187187
## Collectd
188188
Use `COLLECTD=1` environment variable to enable local collectd instance
189189

190+
## AMQP
191+
* CARBON_ENABLE_AMQP: (false) if set to 1 or true will enable AMQP ingestion in Carbon.
192+
* CARBON_AMQP_VERBOSE: (false) if set to 1 or true will enable verbose AMQP output
193+
* CARBON_AMQP_HOST: (localhost)
194+
* CARBON_AMQP_PORT: (5672)
195+
* CARBON_AMQP_VHOST: (/)
196+
* CARBON_AMQP_USER: : (guest)
197+
* CARBON_AMQP_PASSWORD: (guest)
198+
* CARBON_AMQP_EXCHANGE: (graphite)
199+
* CARBON_AMQP_METRIC_NAME_IN_BODY: (false)
200+
190201
## Carbon-cache
191202
If custom environment `GRAPHITE_CARBONLINK_HOSTS` variable is setup `carbon-cache` instances as daemons/services are [managed](./conf/etc/run_once/carbon-cache) based on the that, otherwise default instance (`127.0.0.1:7002`) is used.
192203

conf/etc/service/carbon/run

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,35 @@ if [ -n "${CARBON_DISABLE_TAGS}" ]; then
1010
sed -i 's/ENABLE_TAGS = True/ENABLE_TAGS = False/g' /opt/graphite/conf/carbon.conf
1111
fi
1212

13+
# AMQP params
14+
if [ -n "${CARBON_ENABLE_AMQP}" ]; then
15+
sed -i 's/# ENABLE_AMQP = False/ENABLE_AMQP = True/g' /opt/graphite/conf/carbon.conf
16+
if [ -n "${CARBON_AMQP_VERBOSE}" ]; then
17+
sed -i 's/# AMQP_VERBOSE = False/AMQP_VERBOSE = True/g' /opt/graphite/conf/carbon.conf
18+
fi
19+
if [ -n "${CARBON_AMQP_HOST}" ]; then
20+
sed -i "s/AMQP_HOST = localhost/AMQP_HOST = ${CARBON_AMQP_HOST}/g" /opt/graphite/conf/carbon.conf
21+
fi
22+
if [ -n "${CARBON_AMQP_PORT}" ]; then
23+
sed -i "s/AMQP_PORT = 5672/AMQP_PORT = ${CARBON_AMQP_PORT}/g" /opt/graphite/conf/carbon.conf
24+
fi
25+
if [ -n "${CARBON_AMQP_VHOST}" ]; then
26+
sed -i "s/AMQP_VHOST = \//AMQP_VHOST = ${CARBON_AMQP_VHOST}/g" /opt/graphite/conf/carbon.conf
27+
fi
28+
if [ -n "${CARBON_AMQP_USER}" ]; then
29+
sed -i "s/AMQP_USER = graphite/AMQP_USER = ${CARBON_AMQP_USER}/g" /opt/graphite/conf/carbon.conf
30+
fi
31+
if [ -n "${CARBON_AMQP_PASSWORD}" ]; then
32+
sed -i "s/AMQP_PASSWORD = guest/AMQP_PASSWORD = ${CARBON_AMQP_PASSWORD}/g" /opt/graphite/conf/carbon.conf
33+
fi
34+
if [ -n "${CARBON_AMQP_EXCHANGE}" ]; then
35+
sed -i "s/AMQP_EXCHANGE = graphite/AMQP_EXCHANGE = ${CARBON_AMQP_EXCHANGE}/g" /opt/graphite/conf/carbon.conf
36+
fi
37+
if [ -n "${CARBON_AMQP_METRIC_NAME_IN_BODY}" ]; then
38+
sed -i 's/AMQP_METRIC_NAME_IN_BODY = False/AMQP_AMQP_METRIC_NAME_IN_BODY = True/g' /opt/graphite/conf/carbon.conf
39+
fi
40+
fi
41+
1342
BIN=/opt/graphite/bin/python3
1443
[[ -f "/opt/graphite/bin/pypy3" ]] && BIN=/opt/graphite/bin/pypy3
1544
exec ${BIN} /opt/graphite/bin/carbon-cache.py start --debug 2>&1

conf/opt/graphite/conf/carbon.conf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,19 @@ WHISPER_FALLOCATE_CREATE = False
267267
CARBON_METRIC_INTERVAL = 10
268268

269269
# Enable AMQP if you want to receve metrics using an amqp broker
270-
# ENABLE_AMQP = False
270+
ENABLE_AMQP = False
271271

272272
# Verbose means a line will be logged for every metric received
273273
# useful for testing
274-
# AMQP_VERBOSE = False
275-
276-
# AMQP_HOST = localhost
277-
# AMQP_PORT = 5672
278-
# AMQP_VHOST = /
279-
# AMQP_USER = guest
280-
# AMQP_PASSWORD = guest
281-
# AMQP_EXCHANGE = graphite
282-
# AMQP_METRIC_NAME_IN_BODY = False
274+
AMQP_VERBOSE = False
275+
276+
AMQP_HOST = localhost
277+
AMQP_PORT = 5672
278+
AMQP_VHOST = /
279+
AMQP_USER = guest
280+
AMQP_PASSWORD = guest
281+
AMQP_EXCHANGE = graphite
282+
AMQP_METRIC_NAME_IN_BODY = False
283283

284284
# The manhole interface allows you to SSH into the carbon daemon
285285
# and get a python interpreter. BE CAREFUL WITH THIS! If you do

0 commit comments

Comments
 (0)