Skip to content

Commit

Permalink
Merge pull request #220 from deniszh/deniszh/carbon-amqp
Browse files Browse the repository at this point in the history
Adding AMQP control
  • Loading branch information
deniszh authored Jul 9, 2023
2 parents 4949a51 + 142e947 commit bd43362
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,17 @@ Graphite stores tag information in a separate tag database (TagDB). Please check
## Collectd
Use `COLLECTD=1` environment variable to enable local collectd instance

## AMQP
* CARBON_ENABLE_AMQP: (false) if set to 1 or true will enable AMQP ingestion in Carbon.
* CARBON_AMQP_VERBOSE: (false) if set to 1 or true will enable verbose AMQP output
* CARBON_AMQP_HOST: (localhost)
* CARBON_AMQP_PORT: (5672)
* CARBON_AMQP_VHOST: (/)
* CARBON_AMQP_USER: : (guest)
* CARBON_AMQP_PASSWORD: (guest)
* CARBON_AMQP_EXCHANGE: (graphite)
* CARBON_AMQP_METRIC_NAME_IN_BODY: (false)

## Carbon-cache
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.

Expand Down
29 changes: 29 additions & 0 deletions conf/etc/service/carbon/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,35 @@ if [ -n "${CARBON_DISABLE_TAGS}" ]; then
sed -i 's/ENABLE_TAGS = True/ENABLE_TAGS = False/g' /opt/graphite/conf/carbon.conf
fi

# AMQP params
if [ -n "${CARBON_ENABLE_AMQP}" ]; then
sed -i 's/# ENABLE_AMQP = False/ENABLE_AMQP = True/g' /opt/graphite/conf/carbon.conf
if [ -n "${CARBON_AMQP_VERBOSE}" ]; then
sed -i 's/# AMQP_VERBOSE = False/AMQP_VERBOSE = True/g' /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_HOST}" ]; then
sed -i "s/AMQP_HOST = localhost/AMQP_HOST = ${CARBON_AMQP_HOST}/g" /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_PORT}" ]; then
sed -i "s/AMQP_PORT = 5672/AMQP_PORT = ${CARBON_AMQP_PORT}/g" /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_VHOST}" ]; then
sed -i "s/AMQP_VHOST = \//AMQP_VHOST = ${CARBON_AMQP_VHOST}/g" /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_USER}" ]; then
sed -i "s/AMQP_USER = graphite/AMQP_USER = ${CARBON_AMQP_USER}/g" /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_PASSWORD}" ]; then
sed -i "s/AMQP_PASSWORD = guest/AMQP_PASSWORD = ${CARBON_AMQP_PASSWORD}/g" /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_EXCHANGE}" ]; then
sed -i "s/AMQP_EXCHANGE = graphite/AMQP_EXCHANGE = ${CARBON_AMQP_EXCHANGE}/g" /opt/graphite/conf/carbon.conf
fi
if [ -n "${CARBON_AMQP_METRIC_NAME_IN_BODY}" ]; then
sed -i 's/AMQP_METRIC_NAME_IN_BODY = False/AMQP_AMQP_METRIC_NAME_IN_BODY = True/g' /opt/graphite/conf/carbon.conf
fi
fi

BIN=/opt/graphite/bin/python3
[[ -f "/opt/graphite/bin/pypy3" ]] && BIN=/opt/graphite/bin/pypy3
exec ${BIN} /opt/graphite/bin/carbon-cache.py start --debug 2>&1
20 changes: 10 additions & 10 deletions conf/opt/graphite/conf/carbon.conf
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,19 @@ WHISPER_FALLOCATE_CREATE = False
CARBON_METRIC_INTERVAL = 10

# Enable AMQP if you want to receve metrics using an amqp broker
# ENABLE_AMQP = False
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
# AMQP_METRIC_NAME_IN_BODY = False
AMQP_VERBOSE = False

AMQP_HOST = localhost
AMQP_PORT = 5672
AMQP_VHOST = /
AMQP_USER = guest
AMQP_PASSWORD = guest
AMQP_EXCHANGE = graphite
AMQP_METRIC_NAME_IN_BODY = False

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

0 comments on commit bd43362

Please sign in to comment.