Git Product home page Git Product logo

opendtu-grafana-stack's Introduction

Mosquitto-Telegraf-Influx-Grafana Stack

Check compose file License

This is a docker stack created to visualize the topics of a opendDTU (https://github.com/tbnobody/OpenDTU). The data from openDTU is transferred over mqtt with basic auth an let's encrypt certificates. The data will be stored up to five years. Basically it is the dockerized version of https://github.com/Kraego/OpenDTU-Grafana-Howto. When used with something different adapt the telegraf mapping to your scenario.

It consists of:

  • mosquitto (mqtt broker)
  • telegraf (mqtt -> influxDB2)
  • influxDB2 (store the timeframes in buckets)
  • grafana (monitoring)

Prequesites

  • The following ports must be open on host (so if you have a firewall unblock these ports)
    • 3000 for grafana (webinterface)
    • 8883 or 1883 for mqtt broker (to receive publishes from openDTU)
  • on mac os install gsed for example with brew
  • if you want the tls cert stuff uncomment line 6-8 in the mosquitto.conf (see this guide how to install certbot on host OS)

How to use it

  1. Clone the repo
    git clone https://github.com/Kraego/OpenDTU-Grafana-Stack.git   
    
  2. Go to directory where you have cloned the repo
    cd OpenDTU-Grafana-Stack
    
  3. Create a .env file from the template
    • rename .env_template to .env
    • configure the variables with your values, INFLUX_TOKEN will be set automatic during init
  4. Run the init script:
     ./init.sh
    
  5. Start up the whole stack
    docker-compose up -d
    
  6. Open grafana: http://localhost:3000

YOUR DONE

SELinux

If you have SELinux installed and running, add :Z to all volumes entries in docker-compose.yaml, e.g.

  volumes:
    - ./influxdb/data:/var/lib/influxdb2:Z

Lets encrypt certs

  • Install Certbot on your Host
    • update [YOUR DOMAIN] and [DIR MOUNT OF MOSQUITTO CONTAINER ON HOST] (./mosquitto/certs) in mosquitto-copy-certs.sh
    • copy the file mosquitto-copy-certs.sh to your certbot renewal hooks dir (on Linux it is: /etc/letsencrypt/renewal-hooks/deploy) and make it executable (chmod +x mosquitto-copy-certs.sh)

opendtu-grafana-stack's People

Contributors

jenskueper avatar kraego avatar muellerbe avatar pmithrandir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

opendtu-grafana-stack's Issues

Can't make the dashboard work

Hello,

After quite a bit of difficulties, I managed to get data up to grafana.

I added the dashboard, but it's far from easy to set it up. I'm still totally unable to get something functional.
And the documentation in the other project didn't help much as much task were already present.

What I did:

  • Copy the json
  • Inject the uid
  • Change the inverter serial number, put the same value for both lines (not sure it's relevant, I have one with 4 panels, but it shoudl display something at least)
  • update the bucket in the json... also I start to think I shoudl have created variable instead. ($telegraf)

How would you summarize the differents steps needed ?
Shouldn't we create that doc directly in this repo to not mix up different idea(and inconsistent naming).

Regards,
Pierre

Run certbot inside of stack

Startup certbot container in stack. With auto renewal of certificates. How to fullfil challenge, to run renewal?

Error while starting up the Grafana container

I have cloned your repository, edited the .env file and ran init.sh. Docker shows me that the Grafana container is failing though:

2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.70647988Z level=info msg=Target target=[all]
2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.706488547Z level=info msg="Path Home" path=/usr/share/grafana
2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.706490464Z level=info msg="Path Data" path=/var/lib/grafana
2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.706492464Z level=info msg="Path Logs" path=/var/log/grafana
2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.706494172Z level=info msg="Path Plugins" path=/var/lib/grafana/plugins
2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.706496047Z level=info msg="Path Provisioning" path=/etc/grafana/provisioning
2023-09-10 11:49:42 grafana    | logger=settings t=2023-09-10T09:49:42.706497922Z level=info msg="App mode production"
2023-09-10 11:49:42 grafana    | logger=sqlstore t=2023-09-10T09:49:42.706592964Z level=info msg="Connecting to DB" dbtype=sqlite3
2023-09-10 11:49:42 grafana    | logger=migrator t=2023-09-10T09:49:42.716964922Z level=info msg="Starting DB migrations"
2023-09-10 11:49:42 grafana    | logger=migrator t=2023-09-10T09:49:42.719953172Z level=info msg="migrations completed" performed=0 skipped=484 duration=289.167µs
2023-09-10 11:49:42 grafana    | logger=secrets t=2023-09-10T09:49:42.720204089Z level=info msg="Envelope encryption state" enabled=true currentprovider=secretKey.v1
2023-09-10 11:49:42 grafana    | logger=local.finder t=2023-09-10T09:49:42.750754505Z level=warn msg="Skipping finding plugins as directory does not exist" path=/usr/share/grafana/plugins-bundled
2023-09-10 11:49:42 grafana    | logger=query_data t=2023-09-10T09:49:42.752276047Z level=info msg="Query Service initialization"
2023-09-10 11:49:42 grafana    | logger=live.push_http t=2023-09-10T09:49:42.753809172Z level=info msg="Live Push Gateway initialization"
2023-09-10 11:49:43 grafana    | logger=infra.usagestats.collector t=2023-09-10T09:49:43.388730214Z level=info msg="registering usage stat providers" usageStatsProvidersLen=2
2023-09-10 11:49:43 grafana    | logger=provisioning t=2023-09-10T09:49:43.389725714Z level=error msg="Failed to provision data sources" error="Datasource provisioning error: yaml: unmarshal errors:\n  line 14: cannot unmarshal !!seq into string"
2023-09-10 11:49:43 grafana    | Error: ✗ Datasource provisioning error: yaml: unmarshal errors:
2023-09-10 11:49:43 grafana    |   line 14: cannot unmarshal !!seq into string
1970-01-01 01:00:00 grafana exited with code 1

Any idea what's failing here?

invalid syntax

[inputs.mqtt_consumer] Error in plugin: strconv.ParseFloat: parsing "HM400": invalid syntax

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.