Prometheus configuration

Prometheus configuration

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 -h.

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.

Configuration file

To specify which configuration file to load, use the –config.fileflag.

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:

  • : a boolean that can take the values true or false
  • : a duration matching the regular expression [0-9]+(ms|[smhdwy])
  • : a string matching the regular expression [a-zA-Z_][a-zA-Z0-9_]*
  • : a string of unicode characters
  • : a valid path in the current working directory
  • : a valid string consisting of a hostname or IP followed by an optional port number
  • : a valid URL path
  • : a string that can take the values http or https
  • : a regular string
  • : 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.


Written By

Rustem Abdrakhmanov

Read more