Prometheus is configured via command-line flags and a configuration file. While the command-line flags configure immutable system parameters (such as storage locations, amount of data to keep on disk and in memory, etc.), the configuration file defines everything related to scraping jobs and their instances, as well as which rule files to load.
To view all available command-line flags, run
Prometheus can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a
SIGHUP to the Prometheus process or sending a HTTP POST request to the
/-/reload endpoint (when the
--web.enable-lifecycle flag is enabled). This will also reload any configured rule files.
To specify which configuration file to load, use the
The file is written in YAML format, defined by the scheme described below. Brackets indicate that a parameter is optional. For non-list parameters the value is set to the specified default.
Generic placeholders are defined as follows:
<boolean>: a boolean that can take the values
<duration>: a duration matching the regular expression
<labelname>: a string matching the regular expression
<labelvalue>: a string of unicode characters
<filename>: a valid path in the current working directory
<host>: a valid string consisting of a hostname or IP followed by an optional port number
<path>: a valid URL path
<scheme>: a string that can take the values
<string>: a regular string
<secret>: a regular string that is a secret, such as a password
<tmpl_string>: a string which is template-expanded before usage
The other placeholders are specified separately.
A valid example file can be found here.