# Prometheus metrics server (reusable fragment).
# include = ["include/prometheus.toml"]
# Scrapes itself by default; add scrape targets to prometheus.yml. Listens on
# :9090 (host network). The data dir is created (owned by the container uid)
# before the service starts.
# Ensure the mount point exists. The `:U,Z` volume flags below make podman
# chown the volume to the container's user (uid 65534) *and* relabel it for
# SELinux (container_file_t) at startup — both are required on SELinux hosts.
[[directories]]
path = "/mnt/prometheus"
mode = "0755"
[[files]]
path = "/etc/prometheus/prometheus.yml"
mode = "0644"
content = """
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
"""
[[files]]
path = "/etc/containers/systemd/prometheus.container"
mode = "0644"
content = """
[Unit]
Description=Prometheus
Requires=network-online.target
After=network-online.target
[Container]
Image=docker.io/prom/prometheus:latest
Network=host
Volume=/etc/prometheus:/etc/prometheus:ro,Z
Volume=/mnt/prometheus:/prometheus:U,Z
Exec=--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus --storage.tsdb.retention.time=15d --web.listen-address=:9090
AutoUpdate=registry
[Service]
Restart=always
TimeoutStartSec=900
[Install]
WantedBy=multi-user.target
"""
[[services]]
name = "prometheus.service"
enabled = true
state = "started"
neiam
/devendra
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
1.4 KiB · text
History
e832e77