diff --git a/prometheus/DOCS.md b/prometheus/DOCS.md index eac664a..db78f2d 100644 --- a/prometheus/DOCS.md +++ b/prometheus/DOCS.md @@ -17,7 +17,10 @@ comparison to installing any other Home Assistant add-on. ## Configuration -There are no configuration options for the addon. +### Option: `retention_days` + +Specify when to remove old data. + To add additional scrape targets you need to create a file per target in /share/prometheus/targets. diff --git a/prometheus/config.json b/prometheus/config.json index 5c2c647..3d5f4c9 100755 --- a/prometheus/config.json +++ b/prometheus/config.json @@ -19,5 +19,11 @@ }, "ports_description": { "9090/tcp": "Not required for Ingress" + }, + "schema": { + "retention_days": "int" + }, + "options": { + "retention_days": 15 } } diff --git a/prometheus/rootfs/etc/services.d/prometheus/run b/prometheus/rootfs/etc/services.d/prometheus/run index deb569a..ce316f8 100755 --- a/prometheus/rootfs/etc/services.d/prometheus/run +++ b/prometheus/rootfs/etc/services.d/prometheus/run @@ -12,6 +12,7 @@ bashio::log.info 'Starting prometheus...' options+=(--config.file="/etc/prometheus/prometheus.yml" ) options+=(--storage.tsdb.path="/data/prometheus" ) +options+=(--storage.tsdb.retention.time=$(bashio::config 'retention_days')d) options+=(--web.console.libraries="/usr/share/prometheus/console_libraries" ) options+=(--web.console.templates="/usr/share/prometheus/consoles" ) options+=(--web.route-prefix="/" )