Add ability to scrape additional hosts with Prometheus, and scrape from HomeAssistant

This commit is contained in:
David Stephens 2023-04-12 23:03:20 +01:00
parent 2a8d86e062
commit 7d3e6825d0
2 changed files with 12 additions and 0 deletions

View file

@ -36,3 +36,6 @@ stats_collection_interval: 15s
# uncomment to scrape more hosts
# stats_prometheus_additional_hosts:
# - 192.168.1.1:9100
# uncomment to scrape metrics from HomeAssistant. You'll need to create a long lived access token.
# stats_hass_long_lived_access_token: addfasdfasdf

View file

@ -56,3 +56,12 @@ scrape_configs:
{% endfor %}
{% endif %}
- job_name: "homeassistant"
metrics_path: /api/prometheus
authorization:
credentials: "{{ stats_hass_long_lived_access_token | default("abcd") }}"
static_configs:
- targets: [
"{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:8123"
]