Coder Social home page Coder Social logo

go-mqti's Introduction

mqti

Build Status Go Report Card

MQTT subscriber that pumps data into InfluxDB.

Pronounced 'm-cutey' :)

How it works

Architecture

Features

  • MQTT 3.1.1 supported, TLS, username/password
  • InfluxDB with TLS, username/password
  • Consume MQTT messages and inspect (watch) or forward with the following abilities:
    • Filter messages with AND + OR
  • Receive MQTT messages and write into InfluxDB, with the following abilities:
    • Add tags based on MQTT fields (when MQTT payload is JSON)
    • Geohash support (applicable when consuming MQTT messages from Owntracks
  • Includes docker-compose.yaml to get a full setup up and running!

Configuration

Configuration is handled through a config.yaml file. The following example reads as:

  • Setup four workers for incoming MQTT messages
  • Consume message from MQTT server tcp://localhost:1883 with the client ID of mqti
  • When a MQTT message is consumed from the temperature topic, send write requests to InfluxDB server http://localhost:8086, into the iot database as measurement temperature
---
mqti:
  workers: 4

mqtt:
  host: "localhost"
  port: "1883"
  client_id: "mqti"

influxdb:
  host: "localhost"
  port: "8086"

mappings:
  - mqtt:
      topic: "temperature"
    influxdb:
      database: "iot"
      measurement: "temperature"

Install

go get github.com/ashmckenzie/go-mqti/mqti

or download a release:

github.com/ashmckenzie/go-mqti/releases

Usage

  1. Ensure you have a config.yaml setup (see above)

To consume MQTT messages only

  1. $GOPATH/bin/mqti watch

To consume MQTT messages and forward to InfluxDB

  1. $GOPATH/bin/mqti forward

Trying out with Docker

See the getting started section of a Golang Melbourne presentation for a full demonstration :)

Help

MQTT subscriber that pumps data into InfluxDB

Usage:
  mqti [flags]
  mqti [command]

Available Commands:
  forward     Forward MQTT messages on to InfluxDB
  watch       Watch MQTT messages
  help        Help about any command

Flags:
      --config string   config file (default is config.yaml)
      --debug           enable debugging
  -h, --help            help for mqti
  -v, --version         show version

Use "mqti [command] --help" for more information about a command.

Building

  1. make

TODO

  • Tests
  • Document externals
  • Fully document mungers
  • Leverage viper's default values

Thanks

License

MIT License

Copyright (c) 2017 Ash McKenzie

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

go-mqti's People

Contributors

ashmckenzie avatar

Stargazers

framp avatar  avatar qianji avatar MR.Fan avatar FiberMan avatar Faisal Wirakusuma avatar yunnet avatar Artem Vitiuk avatar Mohammad avatar Michal Mühlpachr avatar Eugene Medvedev avatar edgi avatar  avatar Jorge Hernandez avatar Daniel Chote avatar  avatar  avatar  avatar Merlin Beutlberger avatar chris avatar  avatar chimera kang avatar Jerry avatar <F/>BaoIOT avatar 薄成文 avatar  avatar ipfans avatar  avatar Fred avatar Graeme Cross avatar Murat M avatar

Watchers

Eugene Medvedev avatar  avatar James Cloos avatar  avatar edgi avatar Genaro Pennone avatar  avatar  avatar

Forkers

bcw104 hua4j jxhexi

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.