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>
13 lines
382 B
Bash
Executable file
13 lines
382 B
Bash
Executable file
#!/bin/sh
|
|
|
|
[ -e /etc/config/prometheus ] || touch /etc/config/prometheus
|
|
|
|
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='/srv/prometheus'
|
|
set prometheus.prometheus.web_listen_address='127.0.0.1:9090'
|
|
commit prometheus
|
|
EOF
|
|
}
|