hassio-addons / addon-prometheus

Prometheus - Home Assistant Community Add-ons
https://addons.community
MIT License
20 stars 29 forks source link

Unable to change default storage retention value from 15d #20

Closed robtheone closed 2 years ago

robtheone commented 2 years ago

Problem/Motivation

I have been unsuccessful at changing the default retention value from 15d

Expected behavior

I would expect to be able to change this value, as 15d can not be optimal across the board for all use cases.

Actual behavior

The 15d value appears to be hard coded. I am running Home Asst Supervised on Debian 10.

Steps to reproduce

Run the Prometheus addon, and you can see the 15d default value under "Runtime & Build Information" for the addon

Proposed changes

I am looking for the correct procedure on HOW to change this value. I have researched it and found only the following options, none of which seem to apply to the HA addon:

(1) Per Prometheus Docs, there several command-line flags that configure local storage:

--storage.tsdb.path: Where Prometheus writes its database. Defaults to data/. --storage.tsdb.retention.time: When to remove old data. Defaults to 15d.

How can I change the command line flags for running Prometheus in a docker container in Home Assistant?

(2) I have read that on Debian, you can simply can add the arguments to

/etc/default/prometheus or etc/prometheus.yml

like so:

# Set the command-line arguments to pass to the server.
ARGS: 
  - '--storage.tsdb.retention.time=60d'

I have edited both of these files, however home assistant seems to ignore ALL parameters set. The Prometheus addon log shows that it reads the /etc/prometheus/prometheus.yml config file, however NONE of the settings I have there are actually loaded into the addon.

level=info ts=2021-09-23T15:02:50.189Z caller=main.go:850 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml level=info ts=2021-09-23T15:02:50.235Z caller=main.go:881 msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml totalDuration=46.036017m

(3) adding deployment.yml file to change storage retention days

image: 'your/image path' args:

Is this a docker configuration setup file? I don't believe I can run the addon using this method.

**Does anyone know what the procedure is for modifying default retention? It seems like one of the FIRST settings I would look at in setting up the addon. Currently after 15 days, my data is being deleted, which is FAR from ideal.

I realize the addon is a "Beta" stage addon, so it appears not to have all same functionality of running Prometheus outside of Home Assistant.**

yahel2410 commented 2 years ago

Hey, I'm also looking to change the default storage retention value, can we proceed with the PR above?

robtheone commented 2 years ago

Any chance this change can be implemented?

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!