GithubHelp home page GithubHelp logo

metrics_i2c's Introduction

Push Data to OVH metrics timeseries (via I2C)

Prerequisite

Hardware

  • Wemos D1 Mini
  • Other arduino (for master)

Arduino

  • Create a file config.h based on config.h.sample
  • Compile program

config.h

The file shold contain the following definition:

#define TOKEN "put the 'write' token in graphana topic in the manager"

#define OPENTSDB_HOST "the host of your metrics plateform (ie 'opentsdb.gra1.metrics.ovh.net')"

#define WARP10_HOST "the host of your metrics plateform (ie 'warp10.gra1.metrics.ovh.net')"

#define FINGERPRINT "XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX"

The token is the write token you created in the OVH manager (Cloud > metrics): https://www.ovh.com/manager/cloud/#/

Fingerprint

in http.cpp, you must check to have the correct fingerprint:

echo | openssl s_client -showcerts -servername opentsdb.gra1.metrics.ovh.net -connect opentsdb.gra1.metrics.ovh.net:443 2>/dev/null | openssl x509 -noout -fingerprint -sha1 -inform pem | sed -e "s/.*=//g" | sed -e "s/\:/ /g"

VSCode

Install Arduino extension

Create file .vscode/c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${env:HOME}/Arduino/hardware/esp8266com/esp8266/variants/d1_mini",
                "${env:HOME}/Arduino/hardware/esp8266com/esp8266/**",
                "${env:HOME}/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/**",
                "${env:HOME}/Arduino/libraries/**",
            ],
            "forcedInclude": [],
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Create file .vscode/arduino.json

{
    "board": "esp8266com:esp8266:d1_mini",
    "configuration": "xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=921600",
    "sketch": "four_a_pain_metrics.ino",
    "port": "/dev/ttyUSB0"
}

Slave

Wemos will be the slave. Compile the program and load it in the Wemos. Connect I2C to Master:

  • Clock: D1
  • Data: D2

Master

Include communication.h in your code. In your setup, just put:

Wire.begin()

Then you can use the class MetricsClient

Do not forget to connect I2C to the slave:

  • Clock: A5
  • Data: A4

metrics_i2c's People

Contributors

landru29 avatar

Watchers

James Cloos avatar  avatar  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.