Coder Social home page Coder Social logo

ns-exporter's Introduction

ns-exporter

Nightscout exporter to InfluxDB

usage variants:

  1. inline
go build
./ns-exporter
  1. docker
docker build -t ns-exporter .
docker run -d ns-exporter:latest

arguments:

mongo-uri       - MongoDb uri to download from
mongo-db        - MongoDb database name
ns-uri          - Nightscout server url to download from
ns-token        - Nigthscout server API Authorization Token
limit           - number of records to read per request
skip            - number of records to skip from beginning (`skip=100 take=50` means 'take records from 101 to 150')
influx-uri      - InfluxDb uri to download from
influx-token    - InfluxDb access token
influx-org      - (optional, default = 'ns') InfluxDb organization to use
influx-bucket   - (optional, default = 'ns') InfluxDb bucket to use
influx-user-tag - (optional, default = 'unknown') InfluxDb 'user' tag value to be added to every record - to be able to store multiple users data in single bucket

arguments also can be provided via env with NS_EXPORTER_ prefix:

NS_EXPORTER_MONGO_URI=
NS_EXPORTER_MONGO_DB=
NS_EXPORTER_NS_URI=
NS_EXPORTER_NS_TOKEN=
NS_EXPORTER_LIMIT=
NS_EXPORTER_SKIP=
NS_EXPORTER_INFLUX_URI=
NS_EXPORTER_INFLUX_TOKEN=
NS_EXPORTER_INFLUX_ORG=
NS_EXPORTER_INFLUX_BUCKET=
NS_EXPORTER_INFLUX_USER_TAG=

So you can choose the data source: direct MongoDB or Nightscout REST API. Supplying required set of parameters will trigger related consumer. You can even supply both and get from both sources :)

For NS API access you need provide security token. For security reason it is better to go to 'Admin tools' and create special token for NS-Exporter only instead of using admin security key. Since exporter only requires read access, creating role with two permissions will be enough:

  • api:treatments:read
  • api:devicestatus:read

Presentation

I'm using Grafana dashboard for viewing data. To setup grafana with InfluxDB you need to follow InfluxDB's instructions. The sample dashboard can be imported from grafana.json. It uses both InfluxQL and Flux datasources for different panels. Some can be omitted, some can be reworker based on other InfluxDB datasource query type. Anyway they're provided as samples, for educational purpose :)

ns-exporter's People

Contributors

justmara 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.