[修改]修改网络模式为host,调整了各个服务的网络地址

This commit is contained in:
makotocc0107
2024-09-26 11:04:26 +08:00
committed by Coding
parent eb3f49f00f
commit 491b2265d2
8 changed files with 14 additions and 11 deletions

View File

@@ -4,12 +4,14 @@ services:
ports: ports:
- 2379:2379 - 2379:2379
- 2380:2370 - 2380:2370
network_mode: host
prometheus: prometheus:
build: docker/prometheus build: docker/prometheus
ports: ports:
- 9090:9090 - 9090:9090
depends_on: depends_on:
- node-exporter - node-exporter
network_mode: host
panel: panel:
build: management-panel build: management-panel
# volumes: # volumes:
@@ -32,3 +34,4 @@ services:
- '/:/host:ro' - '/:/host:ro'
opcua-exporter: opcua-exporter:
build: opcua-exporter build: opcua-exporter
network_mode: host

View File

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

View File

@@ -5,12 +5,12 @@ scrape_configs:
- job_name: 'node_exporter' - job_name: 'node_exporter'
scrape_interval: {{ getv "/time/node_exporter_scrape_interval"}}{{ 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: [ '127.0.0.1:9100' ]
- job_name: 'opcua_exporter' - job_name: 'opcua_exporter'
scrape_interval: {{ getv "/time/opcua_scrape_interval"}}{{ 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: [ '127.0.0.1:8191' ]
{{ if getv "/remote_write/state" }} {{ if getv "/remote_write/state" }}
remote_write: remote_write:
- url: {{ getv "/remote_write/url" }} - url: {{ getv "/remote_write/url" }}

View File

@@ -4,8 +4,8 @@ global:
scrape_configs: scrape_configs:
- job_name: 'node_exporter' - job_name: 'node_exporter'
static_configs: static_configs:
- targets: [ '172.17.0.1:9100' ] - targets: [ '127.0.0.1:9100' ]
- job_name: 'opcua_exporter' - job_name: 'opcua_exporter'
static_configs: static_configs:
- targets: [ 'opcua-exporter:8191' ] - targets: [ '127.0.0.1:8191' ]

View File

@@ -5,7 +5,7 @@ FROM openeuler/openeuler:24.03 AS dev
# 更新系统和安装软件包 # 更新系统和安装软件包
RUN dnf update -y && \ RUN dnf update -y && \
dnf install -y git php-cli php-bcmath php-mbstring php-pdo php-pecl-zip php-opcache php-sodium php-intl php-pear php-devel c-ares-devel libcurl-devel openssl-devel brotli brotli-devel net-tools && \ dnf install -y git php-cli php-bcmath php-mbstring php-pdo php-pecl-zip php-opcache php-sodium php-intl php-pear php-devel c-ares-devel libcurl-devel openssl-devel brotli brotli-devel net-tools NetworkManager && \
dnf clean all && \ dnf clean all && \
rm -rf /var/cache/dnf/* rm -rf /var/cache/dnf/*
@@ -43,7 +43,7 @@ RUN npm config set registry https://registry.npmmirror.com && \
FROM openeuler/openeuler:24.03 AS runtime FROM openeuler/openeuler:24.03 AS runtime
RUN dnf update -y \ RUN dnf update -y \
&& dnf install php-cli php-bcmath php-mbstring php-pdo php-pecl-zip php-posix php-sodium php-xml php-intl php-opcache c-ares libcurl openssl brotli net-tools -y \ && dnf install php-cli php-bcmath php-mbstring php-pdo php-pecl-zip php-posix php-sodium php-xml php-intl php-opcache c-ares libcurl openssl brotli net-tools NetworkManager -y \
&& dnf clean all && rm -rf /var/cache/dnf/* && dnf clean all && rm -rf /var/cache/dnf/*
RUN mkdir -p /usr/lib64/php/modules/ RUN mkdir -p /usr/lib64/php/modules/

View File

@@ -6,7 +6,7 @@ use GuzzleHttp\Client;
class EtcdService class EtcdService
{ {
protected $client; protected $client;
protected $baseUri = 'http://etcd:2379/v3/'; // etcd 默认地址 protected $baseUri = 'http://127.0.0.1:2379/v3/'; // etcd 默认地址
public function __construct() public function __construct()
{ {

View File

@@ -6,7 +6,7 @@ use GuzzleHttp\Client;
class PrometheusService class PrometheusService
{ {
protected $client; protected $client;
protected $baseUri = 'http://prometheus:9090/api/v1/'; // Prometheus 的默认地址 protected $baseUri = 'http://127.0.0.1:9090/api/v1/'; // Prometheus 的默认地址
public function __construct() public function __construct()
{ {

View File

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