infrastructure/roles/monitoring/templates/prometheus/prometheus.container.j2
Saibotk 693184bd7c
refactor!(monitoring): Replace monitoring with monitoring_ng
Not much changed regarding variable names, only the role name changed.
2024-08-14 02:04:32 +02:00

47 lines
1.4 KiB
Django/Jinja

{{ ansible_managed | comment }}
[Unit]
Description = Prometheus timeseries database
[Service]
Restart = always
RestartSec = 5s
[Container]
Image = {{ monitoring_prometheus_containerimage }}:{{ monitoring_prometheus_image_tag }}
ContainerName = prometheus
Exec = --config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/prometheus \
--storage.tsdb.retention.time={{ monitoring_prometheus_retention_time }} \
--web.console.libraries=/usr/share/prometheus/console_libraries \
--web.console.templates=/usr/share/prometheus/consoles \
{% if monitoring_prometheus_write_receiver_enable %}
--web.enable-remote-write-receiver \
{% endif %}
--log.level={{ monitoring_prometheus_loglevel }}
AutoUpdate = registry
LogDriver = journald
NoNewPrivileges = true
ReadOnly = true
DropCapability = all
UserNS = auto:size=65535
{% if monitoring_prometheus_selinux_level != omit %}
SecurityLabelLevel = {{ monitoring_prometheus_selinux_level }}
{% endif %}
Network = caddy.network
ExposeHostPort = 9090
Volume = {{ monitoring_install_dir }}/prometheus/data:/prometheus:U
Volume = {{ monitoring_install_dir }}/prometheus/config:/etc/prometheus:ro,U
PodmanArgs = --memory={{ monitoring_prometheus_memory_high }}
PodmanArgs = --memory-swap={{ monitoring_prometheus_swap_max }}
PodmanArgs = --memory-reservation={{ monitoring_prometheus_memory_low }}
[Install]
WantedBy = default.target