0

my prometheus configuration looks like below

cat /etc/prometheus/prometheus.yml |grep targets
    - targets:
    - targets: ['localhost:10090']

Unfortunately, /var/log/messages reports errors as like below

Apr  6 17:04:57 ip-172-31-14-101 prometheus: level=error ts=2020-04-06T07:04:57.638Z caller=main.go:747 err="error starting web server: listen tcp 0.0.0.0:9090: bind: address already in use"
Apr  6 17:04:57 ip-172-31-14-101 systemd: prometheus.service: main process exited, code=exited, status=1/FAILURE
Apr  6 17:04:57 ip-172-31-14-101 systemd: Unit prometheus.service entered failed state.
Apr  6 17:04:57 ip-172-31-14-101 systemd: prometheus.service failed.

Port 9090 is used by Chef hence I am using port 10090. Is there any default configuration I need to update? Missing something?

Host OS is Amazon Linux 2

learner
  • 2,480
  • 10
  • 50
  • 94

1 Answers1

2

The target specification is not where to listen, it is where to collect metrics from.

What you want to modify is the listen address. The man page lists the command line option --web.listen-address="0.0.0.0:9090", you could either change the command line or modify the config file appropriately.

Oh, look here, someone has already answered a similar question with a better answer. The config file change suggested is:

# Set the command-line arguments to pass to the server.
ARGS="--web.listen-address=localhost:10090"

I did a google search for prometheus listen port config and found that answer. You should search before you ask, I should search before I answer.

ranga
  • 372
  • 1
  • 4