Coder Social home page Coder Social logo

nanusefue / mqtt-topic-monitoring Goto Github PK

View Code? Open in Web Editor NEW

This project forked from philenius/mqtt-topic-monitoring

0.0 0.0 0.0 101 KB

Golang app for monitoring MQTT topics with Prometheus and Grafana

License: Apache License 2.0

Go 100.00%

mqtt-topic-monitoring's Introduction

MQTT Hackathon Topic Monitoring

Disclaimer: this app was created during a MQTT hackathon.

This repository contains a small app written in Golang for monitoring a list of MQTT topics. Basically, this app counts the number of received messages for each given topic in order to calculate the throughput in messages per second. Metrics are exposed through a Prometheus endpoint which can then be visualized through a Grafana dashboard included in this repository.

Grafana Dashboard

Start a local MQTT broker

docker run -it -p 1883:1883 eclipse-mosquitto

Build and run this app

go get
go build

LOGXI=* ./mqtt-monitoring -broker "tcp://127.0.0.1:1883" -topics "test"

If you don't have a MQTT client for publishing messages, you can use MQTT.fx. Publish some messages to the topic test and watch the console output of the Golang app or take a look at the Grafana dashboard.

Start Prometheus & Grafana

  • Start Prometheus:

    docker run \
        -d \
        --rm \
        --network host \
        -p 9090:9090 \
        -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
        --name prometheus \
        prom/prometheus
  • Start Grafana:

    docker run \
      -d \
      --rm \
      -p 3000:3000 \
      --name=grafana \
      grafana/grafana
  • Open Grafana in your browser on localhost:3000 and login with the credentials admin and admin.

  • Create a Prometheus datasource to connect to Prometheus:

    Prometheus Datasource in Grafana

  • Import the Grafana dashboard from the file grafana-dashboard.json into Grafana.

mqtt-topic-monitoring's People

Contributors

philenius avatar

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.