Skip to content

Commit

Permalink
Fixes #295: Update AirGradient DIY integration to scrape directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Dec 8, 2021
1 parent 2e74e8a commit 07a72e6
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ So that's what this is.
Other features:

- **Shelly Plug Monitoring**: Installs a [`shelly-plug-prometheus` exporter](https://github.com/geerlingguy/shelly-plug-prometheus) and a Grafana dashboard, which tracks and displays power usage on a Shelly Plug running on the local network. (Disabled by default. Enable and configure using the `shelly_plug_*` vars in `config.yml`.)
- **AirGradient Monitoring**: Installs an [`airgradient-prometheus` exporter](https://github.com/geerlingguy/airgradient-prometheus) and a Grafana dashboard, which tracks and displays air quality over time via a local AirGradient DIY monitor. (Disabled by default. Enable and configure using the `airgradient_enable` var in `config.yml`. See example configuration for ability to monitor multiple AirGradient DIY stations.)
- **AirGradient Monitoring**: Configures [`airgradient-prometheus`](https://github.com/geerlingguy/airgradient-prometheus) and a Grafana dashboard, which tracks and displays air quality over time via one or more AirGradient DIY monitors. (Disabled by default. Enable and configure using the `airgradient_enable` var in `config.yml`. See example configuration for ability to monitor multiple AirGradient DIY stations.)
- **Starlink Monitoring**: Installs a [`starlink` prometheus exporter](https://github.com/danopstech/starlink_exporter) and a Grafana dashboard, which tracks and displays Starlink statistics. (Disabled by default. Enable and configure using the `starlink_enable` var in `config.yml`.)

**IMPORTANT NOTE**: If you use the included Internet monitoring, it will download a decently-large amount of data through your Internet connection on a daily basis. Don't use it, or tune the `internet-monitoring` setup to not run the speedtests as often, if you have a metered connection!
Expand Down
1 change: 1 addition & 0 deletions example.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ airgradient_enable: false
airgradient_sensors:
# ID Should be limited to no more than 38 characters, in the set a-z.
- id: livingroom
ip: "192.168.0.123"
port: 9925

# Starlink configuration. (Also requires `monitoring_enable`)
Expand Down
23 changes: 0 additions & 23 deletions tasks/airgradient.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
---
- name: Clone airgradient-prometheus repo to Pi.
ansible.builtin.git:
repo: https://github.com/geerlingguy/airgradient-prometheus
dest: "{{ config_dir }}/airgradient-prometheus/"
version: master
accept_hostkey: true
become: false
notify: Restart airgradient-prometheus

- name: Copy AirGradient docker-compose template to Pi.
ansible.builtin.template:
src: templates/airgradient-docker-compose.yml.j2
dest: "{{ config_dir }}/airgradient-prometheus/docker-compose.yml"
mode: '0640'
become: false
notify: Restart airgradient-prometheus

- name: Ensure AirGradient Prometheus exporters are running.
community.docker.docker_compose:
project_src: "{{ config_dir }}/airgradient-prometheus/"
build: false
become: false

- name: Copy airgradient dashboard configs to Grafana.
ansible.builtin.template:
src: templates/airgradient-air-quality.json.j2
Expand Down
7 changes: 0 additions & 7 deletions tasks/handlers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@
restarted: true
become: false

- name: Restart airgradient-prometheus
community.docker.docker_compose:
project_src: "{{ config_dir }}/airgradient-prometheus/"
build: false
restarted: true
become: false

- name: Restart starlink-exporter
community.docker.docker_compose:
project_src: "{{ config_dir }}/starlink-exporter/"
Expand Down
16 changes: 0 additions & 16 deletions templates/airgradient-docker-compose.yml.j2

This file was deleted.

2 changes: 1 addition & 1 deletion templates/prometheus.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ scrape_configs:
metrics_path: /metrics
scrape_interval: 30s
static_configs:
- targets: ['172.17.0.1:{{ sensor.port }}']
- targets: ['{{ sensor.ip }}:{{ sensor.port }}']
{% endfor %}
{% endif %}

Expand Down

0 comments on commit 07a72e6

Please sign in to comment.