Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanchietti committed Feb 27, 2024
1 parent 435b17c commit 3ba12a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions imageroot/actions/configure-module/20configure
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ with open('grafana.env', 'w') as gfp:
with open('prometheus.env', 'w') as pfp:
pass

with open('prometheus-config.yml', 'w', encoding='utf-8') as fp:
fp.write("global:\n")
fp.write("scrape_configs:\n")
fp.write(' - job_name: "units"\n')
fp.write(' file_sd_configs:\n')
fp.write(' - files:\n')
fp.write(' - "/prometheus/prometheus.d/*.yml"\n')

network = agent.read_envfile('network.env')
tun = network.get('OVPN_TUN')
Expand Down
2 changes: 1 addition & 1 deletion imageroot/systemd/user/loki.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Podman loki.service
BindsTo=controller.service
ABefore=promtail.service
Before=promtail.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Expand Down
13 changes: 8 additions & 5 deletions imageroot/systemd/user/prometheus.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ After=vpn.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
EnvironmentFile=%S/state/environment
WorkingDirectory=%S/state
Restart=always
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/prometheus.pid %t/prometheus.ctr-id
ExecStartPre=/usr/bin/mkdir -vp %S/state/prometheus.d
ExecStart=/usr/bin/podman run \
--conmon-pidfile %t/prometheus.pid \
--cidfile %t/prometheus.ctr-id \
--cgroups=no-conmon \
--pod-id-file %t/controller.pod-id \
--replace -d --name prometheus \
--volume %S/etc/prometheus-config.yml:/etc/prometheus/prometheus.yml:z \
-v prometheus-data:/prometheus \
--volume=%S/state/prometheus.yml:/prometheus/prometheus.yml:z \
--volume=./prometheus.d/:/prometheus/prometheus.d/:z \
--volume=prometheus-data:/prometheus:z \
--network=host \
--env-file=%S/state/prometheus.env \
--env-file=%S/state/config.env \
${prometheus_IMAGE} \
-config.expand-env=true -config.file=/etc/prometheus/config.yml
${PROMETHEUS_IMAGE} \
-config.file=/etc/prometheus/prometheus.yml
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/prometheus.ctr-id -t 10
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/prometheus.ctr-id
PIDFile=%t/prometheus.pid
Type=forking

[Install]
WantedBy=default.target
WantedBy=default.target

0 comments on commit 3ba12a5

Please sign in to comment.