Giter Site home page Giter Site logo

smartcollector's Introduction

smartcollector

Smartcollector is a command line tool to export information about your SmartThings sensors into Prometheus. The tool uses the GoSmart library to talk to SmartThings and collect sensor data, and emits files ready to be imported by Prometheus' Node Exporter.

Installation

The installation instructions assume a properly installed and configured Go development environment. The very first step is to download and build smartcollector (this step will also download and compile the GoSmart library):

$ go get -u github.com/marcopaganini/smartcollector

GoSmart configuration

Before we can use smartcollector, we need to configure GoSmart. Follow the GoSmart installation instructions carefully, making sure all steps have been followed.

With GoSmart configured, Follow the instructions to run the simple example that comes with GoSmart. Make sure the example displays a list of your sensors on the screen.

Smartcollector configuration

We now need to authorize smartcollector to access your Smartthings app. Take note of the client_id and client_secret of your SmartThings app (used when running the simple example above). Run:

$ smartcollector --client <client_id> --secret <client_secret> --textfile-dir "/tmp"

Follow the instructions to authorize the app (just like in the simple example.)

Smartcollector will write a file with your credentials to the home directory of the user running it. After the first run, only the client_id is required to run smartcollector:

$ smartcollector --client <client_id> --textfile-dir "/tmp"

Please note the textfile-dir flag above. This instructs smartcollector to write the "textfile" output into your "/tmp" directory. This makes it easy to test smartcollector and perform the initial installation, but node-exporter (Prometheus) won't read and import these files from "/tmp". In a production environment, you'll want to:

  1. Make sure the -collector.textfile.directory flag of your node_exporter agrees with the value set in --textfile-dir on the smartcollector. By default, smartcollector uses "/run/textfile_collector"

  2. Make sure the system user you use to run smartcollector has permissions to write under "textfile-dir".

  3. Add an entry to your cron job to fetch the values every 5 or 10 minutes.

  4. When everything is running well, you should start seeing a timeseries called smartthings_sensors in your prometheus console (usually, at localhost:9090).

smartcollector's People

Contributors

marcopaganini avatar

Stargazers

Thomas Vestergaard Trolle avatar Ryan Westendorf avatar Bryce Drennan avatar Bill Moritz avatar Brett Inman avatar Bryan Casey avatar Joseph Jaramillo avatar László Matics avatar Raj Perera avatar Zeph avatar

Watchers

Zeph avatar James Cloos avatar William avatar  avatar  avatar

smartcollector's Issues

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.