Skip to content

Commit

Permalink
add port
Browse files Browse the repository at this point in the history
  • Loading branch information
lhpqaq committed Dec 16, 2024
1 parent 4670517 commit a422d70
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ scrape_configs:
- job_name: '${job.name}'
file_sd_configs:
- files:
- '${job.targets_file}'
- files: '${job.targets_file}'
</#list>
]]>
</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,8 @@ public Map<String, Object> configs() {
prometheusScrapeInterval = (String) configuration.get("scrape_interval");
return configuration;
}

public Object listenAddress() {
return MessageFormat.format("0.0.0.0:{0}", prometheusPort);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a422d70

Please sign in to comment.