[修改]prometheus的confd模板修改

This commit is contained in:
2024-09-23 14:45:24 +08:00
committed by Coding
parent b7edc8f1a7
commit 359709d7b5
3 changed files with 5 additions and 5 deletions

View File

@@ -39,8 +39,8 @@ RUN architecture=$(uname -m); \
RUN mkdir /etc/prometheus/ RUN mkdir /etc/prometheus/
COPY ./confd/ /etc/confd/
COPY prometheus.yml /etc/prometheus/prometheus.yml COPY prometheus.yml /etc/prometheus/prometheus.yml
COPY ./confd/ /etc/confd/
COPY ./supervisord/ /etc/supervisord/ COPY ./supervisord/ /etc/supervisord/
CMD [ "supervisord", "-c", "/etc/supervisord/supervisord.conf" ] CMD [ "supervisord", "-c", "/etc/supervisord/supervisord.conf" ]

View File

@@ -1,14 +1,14 @@
global: global:
scrape_interval: {{ printf "%s%s" (trim (getv "/time/global_scrape_interval") "\"") (trim (getv "/time/global_scrape_interval_unit") "\"") }} scrape_interval: {{ getv "/time/global_scrape_interval"}}{{ getv "/time/global_scrape_interval_unit"}}
scrape_configs: scrape_configs:
- job_name: 'node_exporter' - job_name: 'node_exporter'
scrape_interval: {{ printf "%s%s" (trim (getv "/time/node_exporter_scrape_interval") "\"") (trim (getv "/time/node_exporter_scrape_interval_unit") "\"") }} scrape_interval: {{ getv "/time/node_exporter_scrape_interval"}}{{ getv "/time/node_exporter_scrape_interval_unit" }}
static_configs: static_configs:
- targets: [ 'node-exporter:9100' ] - targets: [ 'node-exporter:9100' ]
- job_name: 'opcua_exporter' - job_name: 'opcua_exporter'
scrape_interval: {{ printf "%s%s" (trim (getv "/time/opcua_scrape_interval") "\"") (trim (getv "/time/opcua_scrape_interval_unit") "\"") }} scrape_interval: {{ getv "/time/opcua_scrape_interval"}}{{ getv "/time/opcua_scrape_interval_unit" }}
static_configs: static_configs:
- targets: [ 'opcua-exporter:8191' ] - targets: [ 'opcua-exporter:8191' ]
{{ if getv "/remote_write/state" }} {{ if getv "/remote_write/state" }}

View File

@@ -11,7 +11,7 @@ stderr_logfile=/var/log/confd.err.log
stdout_logfile=/var/log/confd.out.log stdout_logfile=/var/log/confd.out.log
[program:prometheus] [program:prometheus]
command=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.retention.time={{ getv "/time/storage_interval" ~ getv "/time/storage_interval_unit" }} command=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.retention.time={{ getv "/time/storage_interval"}}{{ getv "/time/storage_interval_unit")}}
autostart=true autostart=true
autorestart=true autorestart=true
stderr_logfile=/var/log/prometheus.err.log stderr_logfile=/var/log/prometheus.err.log