[修改]修改了时间配置的变量对应,添加了supervisor启动配置,增加了Prometheus对应的confd模版

This commit is contained in:
makotocc0107
2024-09-10 15:25:15 +08:00
committed by Coding
parent c075ada573
commit 0021d2da26
8 changed files with 69 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ FROM openeuler/openeuler:24.03
RUN dnf update -y && \
dnf clean all && \
dnf install -y supervisor &&\
rm -rf /var/cache/dnf/*
RUN curl -fsSL https://github.com/prometheus/prometheus/releases/download/v2.54.0/prometheus-2.54.0.linux-amd64.tar.gz | tar -xz -C /usr/local/bin && \
@@ -9,9 +10,13 @@ RUN curl -fsSL https://github.com/prometheus/prometheus/releases/download/v2.54.
rm /usr/local/bin/prometheus-* -rf && \
chmod +x /usr/local/bin/prometheus
RUN curl -fsSL https://github.com/abtreece/confd/releases/download/v0.20.0/confd-v0.20.0-linux-amd64.tar.gz | tar -xz -C /usr/local/bin && \
chmod +x /usr/local/bin/confd
RUN mkdir /etc/prometheus/
COPY prometheus.yml /etc/prometheus/prometheus.yml
CMD ["prometheus", "--config.file=/etc/prometheus/prometheus.yml"]
COPY COPY ./supervisord/ /etc/supervisord/
CMD [ "supervisord", "-c", "/etc/supervisord/supervisord.conf" ]

View File

@@ -0,0 +1,8 @@
[template]
src = "prometheus.tmpl"
dest = "/prometheus.yml"
keys = [
"/time/",
]a

View File

@@ -0,0 +1,6 @@
backend = "etcd"
nodes = [
"http://etcd:2379",
]
watch = true

View File

@@ -0,0 +1,13 @@
global:
scrape_interval: {{ getv "/time/global_scrape_interval" }}
scrape_configs:
- job_name: 'node_exporter'
scrape_interval: {{ getv "/time/node_exporter_scrape_interval" }}
static_configs:
- targets: [ 'node-exporter:9100' ]
- job_name: 'opcua_exporter'
scrape_interval: {{ getv "/time/opcua_scrape_interval" }}
static_configs:
- targets: [ 'opcua-exporter:8191' ]

View File

@@ -0,0 +1,20 @@
[supervisord]
nodaemon=true ; 让 supervisor 运行在前台,保持容器不退出
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:confd]
command=/usr/local/bin/confd -config-file /etc/confd/confd.toml
autostart=true
autorestart=true
stderr_logfile=/var/log/confd.err.log
stdout_logfile=/var/log/confd.out.log
[program:prometheus]
command=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml
autostart=true
autorestart=true
stderr_logfile=/var/log/prometheus.err.log
stdout_logfile=/var/log/prometheus.out.log