Git Product home page Git Product logo

airgradient-exporter's Introduction

AirGradient Prometheus Exporter

This project is not affiliated with AirGradient Co Ltd., I am just a fan and user of their products.

Receive data from AirGradient sensors and expose it as Prometheus metrics.

AirGradient Device Configuration

For the device to send data to the exporter, it needs to be configured to send data to the exporter's IP address and port. This will require flashing the device with a custom sketch.

The following steps will guide you through the process of preparing your computer to flash the device.

  1. Install the Arduino Software for the ESP32-C3
  2. Install ESP8266 Arduino Core
  3. Install the required libraries

Flashing the Device

  1. Download the AirGradient sketch
  2. Open the sketch in the Arduino IDE
  3. Find and replace YOUR_IP with the IP address system that will host the exporter
  4. Find and replace YOUR_PORT with the port the exporter will listen on (Default: 10000)
  5. Select the correct board and port
  6. Upload the sketch to the device
  7. The device should now be configured send data to the exporter

Running the Exporter

The exporter will also serve configuration data back to the device. This cannot currently be disabled but will be configurable in the future. See the all of the AG prefixed options under Exporter Configuration for more information.

Linux

  1. Download the latest release for your platform
  2. If on Debian, copy dist/debian/airgradient-exporter.service to /etc/systemd/system/airgradient-exporter.service
  3. Run sudo systemctl enable airgradient-exporter.service
  4. Copy the relevant binary to the system (/bin/airgradient-exporter)
  5. Run sudo systemctl start airgradient-exporter.service
  6. Check the metrics endpoint by opening a web browser and going to http://YOUR_IP:YOUR_PORT/metrics

Exporter Configuration

The exporter can be configured using command line flags or environment variables. The following table lists the available configuration options.

Name Description Default Options CLI Flag Environment Variable
Address The address the exporter will listen on 0.0.0.0 * or a valid IP --address AIRGRADIENT_EXPORTER_ADDRESS
Port The port the exporter will listen on 10000 1-65536 --port AIRGRADIENT_EXPORTER_PORT
Path The path the exporter will expose metrics on /metrics --path AIRGRADIENT_EXPORTER_PATH
Log Level The log level of the exporter info debug, info, warn, error, fatal, panic --log-level LOG_LEVEL
Country The country the device is located in.

Specifying US will cause the device to report in Fahrenheit
US Valid Country Code --ag-country AIRGRADIENT_EXPORTER_AG_COUNTRY
PM Standard The PM standard to use. If left empty, the US AQI is used. not set empty, ugm3 --ag-pm-standard AIRGRADIENT_EXPORTER_AG_PM_STANDARD
CO2 Calibration Requested Whether CO2 calibration is requested false true, false --ag-co2-calibration-requested AIRGRADIENT_EXPORTER_AG_CO2_CALIBRATION_REQUESTED
LED Bar Test Requested Whether the LED bar test is requested false true, false --ag-led-bar-test-requested AIRGRADIENT_EXPORTER_AG_LED_BAR_TEST_REQUESTED
LED Bar Mode The LED bar mode. If set to something other than off then the LED bar will represent the level of the measurement specified off off, pm, co2 --ag-led-bar-mode AIRGRADIENT_EXPORTER_AG_LED_BAR_MODE
Model The model of the device not set --ag-model AIRGRADIENT_EXPORTER_AG_MODEL
MQTT Broker URL The URL of the MQTT broker not set --ag-mqtt-broker-url AIRGRADIENT_EXPORTER_AG_MQTT_BROKER_URL

Inspiration

License

This project is licensed under the MIT License - see the LICENSE file for details.

airgradient-exporter's People

Watchers

Robin Harper 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.