mirror of
https://github.com/coolsnowwolf/packages
synced 2025-01-07 07:07:02 +08:00
prometheus: Update default tsdb directory handling
Use /srv/prometheus instead of /data, because user `prometheus` doens't have permissions to create `/data/` in `/`. Instead this commit puts prometheus data into `/srv/prometheus` by default, which is a cleaner path, and it'll create tsdb path & then assign required permissions on each prometheus service start. This way, also, the cases when users re-configure tsdb to point to external USB - it'll also be created and assigned required permissions for prometheus. Signed-off-by: Alex Simkin <sashasimkin@gmail.com>
This commit is contained in:
parent
ebd52e9a6c
commit
e642f308ba
@ -47,6 +47,9 @@ Prometheus, a Cloud Native Computing Foundation project, is a systems and
|
||||
service monitoring system. It collects metrics from configured targets at given
|
||||
intervals, evaluates rule expressions, displays the results, and can trigger
|
||||
alerts if some condition is observed to be true.
|
||||
|
||||
Default tsdb path is /srv/prometheus, you might want to edit /etc/config/prometheus
|
||||
in order to place it on USB storage or external SD card.
|
||||
endef
|
||||
|
||||
define Package/prometheus/install
|
||||
|
@ -12,8 +12,14 @@ start_service() {
|
||||
local web_listen_address
|
||||
config_load "prometheus"
|
||||
config_get config_file prometheus config_file "$CONFFILE"
|
||||
config_get storage_tsdb_path prometheus storage_tsdb_path "/data"
|
||||
config_get storage_tsdb_path prometheus storage_tsdb_path "/srv/prometheus"
|
||||
config_get web_listen_address prometheus web_listen_address "127.0.0.1:9090"
|
||||
|
||||
# Create tsdb dir & permissions if needed
|
||||
if [ ! -d "$storage_tsdb_path" ]; then
|
||||
mkdir "$storage_tsdb_path"
|
||||
chown prometheus:prometheus "$storage_tsdb_path"
|
||||
fi;
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
|
@ -6,7 +6,7 @@ uci -q get prometheus.prometheus || {
|
||||
uci -q batch <<EOF
|
||||
set prometheus.prometheus=prometheus
|
||||
set prometheus.prometheus.config_file='/etc/prometheus.yml'
|
||||
set prometheus.prometheus.storage_tsdb_path='/data'
|
||||
set prometheus.prometheus.storage_tsdb_path='/srv/prometheus'
|
||||
set prometheus.prometheus.web_listen_address='127.0.0.1:9090'
|
||||
commit prometheus
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user