Code Monkey home page Code Monkey logo

mqtt2graphite's Introduction

mqtt2graphite

This program subscribes to any number of MQTT topics, extracts a value from the messages' payload and sends that off to Graphite via Carbon over a UDP socket.

Values in the payload can be simple numbers (92, 12.7) or JSON strings. In the latter case, all JSON names/keys are extracted and if their values are numeric, these are then sent off to Carbon (see example below)

Requirements

Installation and Configuration

  • Configure the mqtt2graphite init script
pip install git+https://github.com/jpmens/mqtt2graphite.git
./init_server.sh mqtt.hostname

Running

  • Edit the mqtt.hostname.conf file
  • Run or add this cmd supervisord -c /etc/supervisord.conf in your /etc/rc.local

Handling numeric payloads

mqtt2graphite assumes topics defined as "n" in the map file contain a simple number (integer or float), published thusly:

mosquitto_pub  -t test/jp/j1 -m '69'

Handling JSON payloads

mosquitto_pub  -t test/jp/j2 -m '{ "size":69,"temp": 89.3, "gas": " 88", "name": "JP Mens" }'

produces the following Carbon keys

test.jp.j2.gas 88.000000 1363169282
test.jp.j2.temp 89.300000 1363169282
test.jp.j2.size 69.000000 1363169282

Todo

A lot.

  • Add configuration file in which we specify username/password and TLS certificates.
  • I'm not experienced enough with high volume of messages, so this should maybe transmit to Carbon via StatsD?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.