From a422d7000ebbe7c3ad5404f1c772b8aa16c443d6 Mon Sep 17 00:00:00 2001 From: lhpqaq <657407891@qq.com> Date: Mon, 16 Dec 2024 21:34:35 +0800 Subject: [PATCH] add port --- .../1.0.0/services/prometheus/configuration/prometheus.xml | 3 +-- .../stack/infra/v1_0_0/prometheus/PrometheusParams.java | 4 ++++ .../stack/infra/v1_0_0/prometheus/PrometheusServerScript.java | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/configuration/prometheus.xml b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/configuration/prometheus.xml index e4f8728fa..eb7dc3898 100644 --- a/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/configuration/prometheus.xml +++ b/bigtop-manager-server/src/main/resources/stacks/infra/1.0.0/services/prometheus/configuration/prometheus.xml @@ -44,8 +44,7 @@ scrape_configs: - job_name: '${job.name}' file_sd_configs: - - files: - - '${job.targets_file}' + - files: '${job.targets_file}' ]]> diff --git a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusParams.java b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusParams.java index 54ba55530..0d8ee228f 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusParams.java +++ b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusParams.java @@ -117,4 +117,8 @@ public Map configs() { prometheusScrapeInterval = (String) configuration.get("scrape_interval"); return configuration; } + + public Object listenAddress() { + return MessageFormat.format("0.0.0.0:{0}", prometheusPort); + } } diff --git a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusServerScript.java b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusServerScript.java index a9e3f3c88..5f1acd005 100644 --- a/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusServerScript.java +++ b/bigtop-manager-stack/bigtop-manager-stack-infra/src/main/java/org/apache/bigtop/manager/stack/infra/v1_0_0/prometheus/PrometheusServerScript.java @@ -51,8 +51,8 @@ public ShellResult start(Params params) { configure(params); PrometheusParams prometheusParams = (PrometheusParams) params; String cmd = MessageFormat.format( - "nohup {0}/prometheus --config.file={0}/prometheus.yml --storage.tsdb.path={0}/data > {0}/nohup.out 2>&1 &", - prometheusParams.serviceHome()); + "nohup {0}/prometheus --config.file={0}/prometheus.yml --web.listen-address={1} --storage.tsdb.path={0}/data > {0}/nohup.out 2>&1 &", + prometheusParams.serviceHome(), prometheusParams.listenAddress()); try { ShellResult shellResult = LinuxOSUtils.sudoExecCmd(cmd, prometheusParams.user()); if (shellResult.getExitCode() != 0) {