All Projects → geerlingguy → shelly-plug-prometheus

geerlingguy / shelly-plug-prometheus

Licence: MIT license
Shelly Plug Prometheus exporter.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to shelly-plug-prometheus

Jenkins exporter
Prometheus Metrics exporter for Jenkins
Stars: ✭ 152 (+280%)
Mutual labels:  exporter
Awesome Prometheus Alerts
🚨 Collection of Prometheus alerting rules
Stars: ✭ 3,323 (+8207.5%)
Mutual labels:  exporter
prometheus-fastapi-instrumentator
Instrument your FastAPI app
Stars: ✭ 511 (+1177.5%)
Mutual labels:  exporter
Event exporter
Exporter for kubernetes events
Stars: ✭ 179 (+347.5%)
Mutual labels:  exporter
Krita Batch Exporter
A Free Krita plugin to batch export layers and groups with maximum flexibility. Scale, trim, export multiple copies of your layers...
Stars: ✭ 201 (+402.5%)
Mutual labels:  exporter
Objectexporter
Object Exporter lets you export out an object while debugging in Visual Studio, the object can be serialized in either C#, JSON or XML.
Stars: ✭ 240 (+500%)
Mutual labels:  exporter
Decktape
PDF exporter for HTML presentations
Stars: ✭ 1,847 (+4517.5%)
Mutual labels:  exporter
speedtest-exporter
Speedtest Exporter made in python using the official speedtest bin
Stars: ✭ 118 (+195%)
Mutual labels:  exporter
Maya2gltf
Maya to glTF 2.0 exporter
Stars: ✭ 203 (+407.5%)
Mutual labels:  exporter
expresso
Expresso! Exporter is a Photoshop extension aimed at improving the texturing workflow for 3D Artists. It automatically exports textures to common file formats (TGA, PNG, etc.) out of PSDs containing multiple maps.
Stars: ✭ 57 (+42.5%)
Mutual labels:  exporter
Github Csv Tools
Import and export GitHub issues via CSV
Stars: ✭ 182 (+355%)
Mutual labels:  exporter
Clickhouse exporter
This is a simple server that periodically scrapes ClickHouse stats and exports them via HTTP for Prometheus(https://prometheus.io/) consumption.
Stars: ✭ 193 (+382.5%)
Mutual labels:  exporter
mac-notes-exporter
Your last straw to save your data from Notes.app.
Stars: ✭ 32 (-20%)
Mutual labels:  exporter
Rats
Movie Ratings Synchronization with Python
Stars: ✭ 156 (+290%)
Mutual labels:  exporter
lustre exporter
Prometheus exporter for use with the Lustre parallel filesystem
Stars: ✭ 25 (-37.5%)
Mutual labels:  exporter
Laravel Translatable String Exporter
Translatable String Exporter for Laravel
Stars: ✭ 149 (+272.5%)
Mutual labels:  exporter
Github Exporter
Prometheus exporter for github metrics
Stars: ✭ 231 (+477.5%)
Mutual labels:  exporter
yarn-prometheus-exporter
Export Hadoop YARN (resource-manager) metrics in prometheus format
Stars: ✭ 44 (+10%)
Mutual labels:  exporter
xenstats exporter
Prometheus exporter for xen (Storage, Host CPUs, Memory usage)
Stars: ✭ 20 (-50%)
Mutual labels:  exporter
query2metric
A tool to run queries in defined frequency and expose the count as prometheus metrics. Supports MongoDB and SQL
Stars: ✭ 21 (-47.5%)
Mutual labels:  exporter

Shelly Plug Prometheus Exporter

CI

I am a simple man.

I have a Shelly Plug. I don't want to flash a different firmware on it just to get a Prometheus endpoint. Though I might do it someday if I'm not lazy.

I want a Prometheus endpoint where I can scrape metrics for the Shelly Plug.

So I built this.

Could I use MQTT and use some sort of preconfigured broker / metrics generator? Yeah probably. But it's literally easier (if you don't already use MQTT and know how to set it up) to just write a little metrics scraper like this for a one-off.

How to Use

This thing is a PHP script that runs in a Docker container. That's it.

You could even run the thing without using Docker, it doesn't care, it's just a PHP script.

Set environment variables

I recommend adding a basic HTTP auth username and password to your Shelly Plug to give at least minimal security.

Run the PHP script inside Docker like so:

docker run -d -p 9924:80 --name shelly-plug \
  -e SHELLY_HOSTNAME='my-shelly-plug-host-or-ip' \
  -e SHELLY_HTTP_USERNAME='username' \
  -e SHELLY_HTTP_PASSWORD='password' \
  -v "$PWD":/var/www/html \
  php:8-apache

Or you can set it up inside a docker-compose file like so:

---
version: "3"

services:
  shelly-plug:
    container_name: shelly-plug
    image: php:8-apache
    ports:
      - "9924:80"
    environment:
      SHELLY_HOSTNAME='my-shelly-plug-host-or-ip'
      SHELLY_HTTP_USERNAME='username'
      SHELLY_HTTP_PASSWORD='password'
    volumes:
      - './:/var/www/html'
    restart: unless-stopped

If you run the script outside of Docker, make sure you set the necessary environment variables.

After it's running, test that it's working with curl:

$ curl http://localhost:9924/metrics
# HELP power Current real AC power being drawn, in Watts
# TYPE power gauge
power 91.81
# HELP is_valid Whether power metering self-checks OK
# TYPE is_valid gauge
is_valid 1
# HELP total Total energy consumed by the attached electrical appliance in Watt-minute
# TYPE total gauge
total 24239

If you get an error, check your environment variables and make sure they're correct, and make sure the Docker container (and the host it's on) can access your Shelly Plug over HTTP!

License

MIT.

Author

Jeff Geerling.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].