/rabbitmq-statsd

Amqp queue information to statsd

Primary LanguageJavaScript

rabbitmq-statsd

Example

Alt text

Alt text

Configuration

In the config.json file you will find all the application configuration

{
	"collectInterval": 30000, // collect interval time in ms
	"amqp": {
		"username": "AMQP_USERNAME",
		"password": "AMQP_PASSWORD",
		"host": "AMQP_HOSTNAME:15672", // might be something like heroku.srs.rabbitmq.com/rabbitmq/foobar
		"protocol": "HTTP_OR_HTTPS"
	},
	"statsd": {
		"host": "STATSD_HOSTNAME",
		"port": "8125", // port of your statsd
		"prefix": "STATSD_PREFIX" // prefix for your stats ex rabbit.prod / rabbit.dev
	},
	"logPath": "rabbit.log"
}

Install

Clone the remository

$ git clone https://github.com/lahaxearnaud/rabbitmq-statsd

Run with docker on arm architecture (based on armbuild/alpine)

Docker images: 47MB

  • Build the image
$ make build
docker build -t rabbitmq-collector /home/pirate/domotique-rabbitmq-statsd
Sending build context to Docker daemon 2.842 MB
Step 1 : FROM resin/armhf-alpine-node:slim
 ---> 3e890d09a3d8
Step 2 : RUN npm install forever -g
 ---> Using cache
 ---> a8ee4752aca3
Successfully built a8ee4752aca3

  • Start the container
$ make up
docker rm rabbitmq-collector-container | true
docker run --name rabbitmq-collector-container -v /home/pirate/domotique-rabbitmq-statsd:/var/app -d rabbitmq-collector forever /var/app/app.js
4645aa2efcc4946924be0faa8237e4163ba5a2771ef9b72d488ff4e22e79e610
  • Access container logs
$ make tail
docker logs -f rabbitmq-collector-container
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Rabbit monitoring starting

  • Stop the container
$ make down

docker kill rabbitmq-collector-container | true
  • Remove the image
$ make rm
docker kill rabbitmq-collector-container | true
Error response from daemon: Cannot kill container rabbitmq-collector-container: Container 4645aa2efcc4946924be0faa8237e4163ba5a2771ef9b72d488ff4e22e79e610 is not running
docker rmi rabbitmq-collector
Untagged: rabbitmq-collector:latest

Run without docker with forever

$ forver start app.js

Run without docker and without forever

$ npm run app

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

LAHAXE Arnaud

License

Copyright © 2016 LAHAXE Arnaud Licensed under the MIT license.


After coding

What better way to relax, after spending hours coding, than a good cocktail on the terrace?