Giter Site home page Giter Site logo

sensehat-exporter's Introduction

Sensehat Prometheus Exporter

A simple Prometheus exporter for exporting values from the Raspberry Pi SenseHat.

Requirements

Installation

git clone https://github.com/epleterte/sensehat-exporter.git
cd sensehat-exporter
pip3 install -r requirements.txt
sudo cp sensehat-exporter.py /usr/local/bin/sensehat-exporter
# start sensehat-exporter!
sensehat-exporter

Run as a service

cp sensehat-exporter.service.example /etc/systemd/system/sensehat-exporter.service
systemctl daemon-reload
systemctl start sensehat-exporter
systemctl enable sensehat-exporter

Usage

usage: simpleexporter.py [-h] [--port [PORT]] [--bind [BIND]]

optional arguments:
  -h, --help     show this help message and exit
  --port [PORT]  The TCP port to listen on (default: 9101)
  --bind [BIND]  The interface/IP to bind to (default: 0.0.0.0)
  --orientation  Enable 'orientation' data (roll, yaw, pitch)

Configuration

Currently there are no other configuration than options IP/port and no configuration file.

Prometheus Configuration

In /etc/prometheus/prometheus.yml, Add a static scrape target under scrape_configs:

scrape_configs:
  - job_name: 'sensehat'
    static_configs:
    - targets: ['<ip>:9101'] 

TODO

  • Upload example Grafana dashboard
  • Export more sensor data - currently only temperature, humidity and pressure is exported.
  • Possibly make additional sensors configurable.

Demo

Here's a screenshot of the data being put to use in a Grafana dashboard:

Grafana RPi Sensehat dashboard screenshot

License

This software is licensed under the ISC license.

sensehat-exporter's People

Contributors

epleterte avatar vakabus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sensehat-exporter's Issues

Grafana error using exporter metrics

Using Prometheus 2.33.3 and Grafana 8.3.3. Scraping job for the sensehat-exporter is running and generating metrics. However, when in Grafana to define a Prometheus data source, I set the URL to localhost:9101, click Save and Test and receive the following error:

Error reading Prometheus: bad_response: readObjectStart: expect { or n, but found #, error found in #1 byte of ...|# HELP pyth|..., bigger context ...|# HELP python_gc_objects_collected_total Objects co|...

Apparently the outputted metrics do not follow the current definition for such data. Any help would be appreciated.

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.