prometheus-service

Example:

# Install prometheus, add two scrape configs.
- prometheus-service:
    web_listen_address: 192.168.1.12:9090
    scrape_configs:
    - job_name: prometheus
      static_configs:
      - targets:
        - 192.168.1.12:9090
    - job_name: node
      static_configs:
      - targets:
        - 192.168.1.11:9100
        - 192.168.1.12:9100

Description

n/a

Resources

Variables

Name Type Default Description

alert_relabel_configs

list --

Alert relabeling rules. This should be specified as list in yaml format. It is compatible with the official .

alert_rules

list --

Full list of alerting rules which will be copied to {{ prometheus_config_dir }}/rules/ansible_managed.rules. Alerting rules can be also provided by other files located in {{ prometheus_config_dir }}/rules/ which have *.rules extension.

Defaults can be found in the Ansible role 'defaults' file.

alertmanager_config

list --

Configuration responsible for pointing where alertmanagers are. This should be specified as list in yaml format. It is compatible with official .

config_flags_extra

dict --

Additional configuration flags passed to prometheus binary at startup.

external_labels

dict --

Provide map of additional labels which will be added to any time series or alerts when communicating with external systems.

Defaults to:

environment: "{{ ansible_fqdn | default(ansible_host) | default(inventory_hostname) }}"

global_config

dict --

Prometheus global config. Compatible with official configuration.

Defaults to:

{ scrape_interval: 60s, scrape_timeout: 15s, evaluation_interval: 15s, }

remote_read

list --

Remote read. Compatible with official configuration.

remote_write

list --

Remote write. Compatible with official configuration. - " documentation"

scrape_configs

list --

Prometheus scrape jobs provided in same format as in official docs.

Defaults can be found in the Ansible role 'defaults' file.

For more information checkout the Ansible role README.md.

storage_retention

string --

Data retention period, defaults to '30d'.

targets

dict --

Targets which will be scraped.

For more information checkout the Ansible role README.md.

Example:

prometheus_targets:
- targets:
  - demo.cloudalchemy.org:9100
  labels:
    env: demo
    job: node
- targets:
  - demo.cloudalchemy.org:9093
  labels:
    env: demo
    job: alertmanager
- targets:
  - demo.cloudalchemy.org:3000
  labels:
    env: demo
job: grafana

version

string --

The version of Prometheus.

web_external_url

string --

External address on which prometheus is available. Useful when behind reverse proxy. Ex. http://example.org/prometheus.

web_listen_address

string --

Address on which prometheus will be listening.

Defaults to '0.0.0.0:9090'.

Examples

Example 1

Install prometheus, add two scrape configs.

Code
- prometheus-service:
    web_listen_address: 192.168.1.12:9090
    scrape_configs:
    - job_name: prometheus
      static_configs:
      - targets:
        - 192.168.1.12:9090
    - job_name: node
      static_configs:
      - targets:
        - 192.168.1.11:9100
        - 192.168.1.12:9100

Command-line

frecklecute prometheus-service --help

Usage: frecklecute prometheus-service [OPTIONS]

  Installs the Prometheus monitoring service.

Options:
  --alert-relabel-configs ALERT_RELABEL_CONFIGS
                                  Alert relabeling rules.
  --alert-rules ALERT_RULES       Full list of alerting rules.
  --alertmanager-config ALERTMANAGER_CONFIG
                                  Configuration responsible for pointing where
                                  alertmanagers are.
  --config-flags-extra FLAGS      Additional configuration flags passed to
                                  prometheus binary at startup.
  --external-labels EXTERNAL_LABELS
                                  Additional labels.
  --global-config GLOBAL_CONFIG   Prometheus global config.
  --remote-read REMOTE_READ       Remote read.
  --remote-write REMOTE_WRITE     Remote write.
  --scrape-configs SCRAPE_CONFIGS
                                  Prometheus scrape jobs.
  --storage-retention STORAGE_RETENTION
                                  Data retention period.
  --targets TARGETS               Targets which will be scraped.
  --version VERSION               The version of Prometheus.
  --web-external-url WEB_EXTERNAL_URL
                                  External address on which prometheus is
                                  available.
  --web-listen-address WEB_LISTEN_ADDRESS
                                  Address on which prometheus will be
                                  listening.
  --help                          Show this message and exit.