How to configure a specific IP in prometheus yml configuration file?
You can use the command line option for configuring your listen address
./prometheus --web.listen-address="0.0.0.0:9090"
How to config Prometheus to scrape all IPs behind a hostname in single period?
The configuration in the question appears correct for the task. However, in order to make it work, the DNS response must contain all target IPs at once. The way it works is like this:
- Prometheus makes a DNS request to obtain a list of targets.
- The list of targets gets cached for
refresh_interval: 2s
. - Prometheus makes a scrape request for each target in the list.
At next iterations (defined by the scrape_interval
) Prometheus may skip p.1 and p.2 if the the list of targets is not yet expired. The problem in the question is that DNS server returned only one IP and thus, Prometheus at each scrape_interval
made only one scrape request. The randomly selected target received it's unique IP-based instance
label and this is why the graph looks disconnected.
Configure Prometheus to use non-default port
The quotes were superfluous. This line will work:
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus.yaml --web.enable-admin-api \
--web.listen-address=:8080
Unable to start prometheus even after using a different port
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.
Related Topics
Differenceamong Three Priorities Used in Linux Kernel
Python Read Linux Memory Process Error (/Proc/$Pid/Mem)
How Does the Linux Kernel Determine Ld.So's Load Address
Shell Script to Set Environment Variables Permanently
Question About File Seeking Position
How to Kill All Child Processes Without Killing the Parent
Calculate Mean of Each Column Ignoring Missing Data with Awk
Argument List Too Long When Concatenating Lots of Files in a Folder
How to Determine the Precise Set of Environment Variables a Systemd Environmentfile Would Set
Subprocess Library Won't Execute Compgen
X86 Gnu Assembler Strange Change Seg Fault
How to Wait for a Keystroke Interrupt with a Syscall on Linux
Mono Take Mscorlib.Dll 2.0 Instead of 4.0
How to Append to an Indirect Parameter Expansion of an Array in Bash
Script That Calls Ausearch Behaves Differently When Piped Data on Stdin
Linux: Handling a Segmentation Fault and Getting a Core Dump