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
Installs the Prometheus monitoring service.
Resources
Variables
Name | Type | Default | Description |
---|---|---|---|
|
list | -- | Alert relabeling rules. This should be specified as list in yaml format. It is compatible with the official |
|
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. |
|
list | -- | Configuration responsible for pointing where alertmanagers are. This should be specified as list in yaml format. It is compatible with official |
|
dict | -- | Additional configuration flags passed to prometheus binary at startup. |
|
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) }}" |
|
dict | -- | Prometheus global config. Compatible with official configuration. Defaults to: { scrape_interval: 60s, scrape_timeout: 15s, evaluation_interval: 15s, } |
|
list | -- | Remote read. Compatible with official configuration. |
|
list | -- | Remote write. Compatible with official configuration.
- " |
|
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. |
|
string | -- | Data retention period, defaults to '30d'. |
|
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 |
|
string | -- | The version of Prometheus. |
|
string | -- | External address on which prometheus is available. Useful when behind reverse proxy. Ex. http://example.org/prometheus. |
|
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
Code
doc: short_help: Installs the Prometheus monitoring service. references: Prometheus homepage: https://prometheus.io/ cloudalchemy.prometheus Ansible role: https://github.com/cloudalchemy/ansible-prometheus examples: - title: Install prometheus, add two scrape configs. vars: 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 args: version: doc: short_help: The version of Prometheus. type: string required: false web_listen_address: doc: short_help: Address on which prometheus will be listening. help: | Address on which prometheus will be listening. Defaults to '0.0.0.0:9090'. type: string required: false web_external_url: doc: short_help: External address on which prometheus is available. help: | External address on which prometheus is available. Useful when behind reverse proxy. Ex. http://example.org/prometheus. type: string required: false storage_retention: doc: short_help: Data retention period. help: | Data retention period, defaults to '30d'. type: string required: false config_flags_extra: doc: short_help: Additional configuration flags passed to prometheus binary at startup. type: dict required: false cli: metavar: FLAGS alertmanager_config: doc: short_help: Configuration responsible for pointing where alertmanagers are. help: | Configuration responsible for pointing where alertmanagers are. This should be specified as list in yaml format. It is compatible with official [<alertmanager_config>](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alertmanager_config). references: - '[alertmanager_config documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alertmanager_config)' type: list required: false empty: true alert_relabel_configs: doc: short_help: Alert relabeling rules. help: | Alert relabeling rules. This should be specified as list in yaml format. It is compatible with the official [<alert_relabel_configs>](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs). references: - '[alert_relabel_configs documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#alert_relabel_configs)' type: list required: false empty: true global_config: doc: short_help: Prometheus global config. help: | Prometheus global config. Compatible with [official configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). Defaults to: { scrape_interval: 60s, scrape_timeout: 15s, evaluation_interval: 15s, } references: - '[Prometheus configuration file documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file)' type: dict required: false empty: true remote_write: doc: short_help: Remote write. help: | Remote write. Compatible with [official configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<remote_write>). - "[<remote_write> documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<remote_write>)" type: list empty: true required: false remote_read: doc: short_help: Remote read. help: | Remote read. Compatible with [official configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<remote_read>). references: - '[<remote_read> documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<remote_read>)' type: list empty: true required: false external_labels: doc: short_help: Additional labels. help: | 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) }}" type: dict required: false empty: true alert_rules: doc: short_help: Full list of alerting rules. help: | 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](https://github.com/cloudalchemy/ansible-prometheus/blob/master/defaults/main.yml). type: list empty: true required: false targets: doc: short_help: Targets which will be scraped. help: | Targets which will be scraped. For more information checkout the [Ansible role README.md](https://github.com/cloudalchemy/ansible-prometheus#relation-between-prometheus_scrape_configs-and-prometheus_targets). 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 references: - '[Ansible role readme](https://github.com/cloudalchemy/ansible-prometheus#relation-between-prometheus_scrape_configs-and-prometheus_targets)' type: dict required: false empty: true scrape_configs: doc: short_help: Prometheus scrape jobs. help: | Prometheus scrape jobs provided in same format as in [official docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config). Defaults can be found in the [Ansible role 'defaults' file](https://github.com/cloudalchemy/ansible-prometheus/blob/master/defaults/main.yml). For more information checkout the [Ansible role README.md](https://github.com/cloudalchemy/ansible-prometheus#relation-between-prometheus_scrape_configs-and-prometheus_targets). references: - '[Prometheus <scrape_config> documenation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config)' - '[Ansible role readme](https://github.com/cloudalchemy/ansible-prometheus#relation-between-prometheus_scrape_configs-and-prometheus_targets)' type: list empty: true required: false frecklets: - frecklet: name: cloudalchemy.prometheus type: ansible-role resources: ansible-role: - cloudalchemy.prometheus desc: short: installing prometheus references: "'cloudalchemy.prometheus' Ansible role": https://github.com/cloudalchemy/ansible-prometheus properties: idempotent: true elevated: true internet: true vars: prometheus_version: '{{:: version ::}}' prometheus_web_listen_address: '{{:: web_listen_address ::}}' prometheus_web_external_url: '{{:: web_external_url ::}}' prometheus_storage_retention: '{{:: storage_retention ::}}' prometheus_config_flags_extra: '{{:: config_flags_extra ::}}' prometheus_alertmanager_config: '{{:: alertmanager_config ::}}' prometheus_alert_relabel_configs: '{{:: alert_relabel_configs ::}}' prometheus_global: '{{:: global_config ::}}' prometheus_remote_write: '{{:: remote_write ::}}' prometheus_remote_read: '{{:: remote_read ::}}' prometheus_external_labels: '{{:: external_labels ::}}' prometheus_alert_rules: '{{:: alert_rules ::}}' prometheus_targets: '{{:: targets ::}}' prometheus_scrape_configs: '{{:: scrape_configs ::}}' # netdata: # - targets: # - localhost:19999 # labels: # env: dev # prometheus_scrape_configs: # - job_name: "prometheus" # Custom scrape job, here using `static_config` # metrics_path: "/metrics" # static_configs: # - targets: # - "localhost:9090" # - job_name: "netdata" # metrics_path: '/api/v1/allmetrics' # params: # format: # - prometheus # file_sd_configs: # - files: # - "{{ prometheus_config_dir }}/file_sd/netdata.yml"
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.
# -*- coding: utf-8 -*- # # module path: pycklets.prometheus_service.PrometheusService # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class PrometheusService(AutoPycklet): """Installs the Prometheus monitoring service. Args: alert_relabel_configs: Alert relabeling rules. alert_rules: Full list of alerting rules. alertmanager_config: Configuration responsible for pointing where alertmanagers are. config_flags_extra: Additional configuration flags passed to prometheus binary at startup. external_labels: Additional labels. global_config: Prometheus global config. remote_read: Remote read. remote_write: Remote write. scrape_configs: Prometheus scrape jobs. storage_retention: Data retention period. targets: Targets which will be scraped. version: The version of Prometheus. web_external_url: External address on which prometheus is available. web_listen_address: Address on which prometheus will be listening. """ FRECKLET_ID = "prometheus-service" alert_relabel_configs: List = None alert_rules: List = None alertmanager_config: List = None config_flags_extra: Dict = None external_labels: Dict = None global_config: Dict = None remote_read: List = None remote_write: List = None scrape_configs: List = None storage_retention: str = None targets: Dict = None version: str = None web_external_url: str = None web_listen_address: str = None def __post_init__(self): super(PrometheusService, self).__init__(var_names=["alert_relabel_configs", "alert_rules", "alertmanager_config", "config_flags_extra", "external_labels", "global_config", "remote_read", "remote_write", "scrape_configs", "storage_retention", "targets", "version", "web_external_url", "web_listen_address"]) frecklet_class = PrometheusService
# -*- coding: utf-8 -*- # # module path: pycklets.prometheus_service.PrometheusService # from pyckles import AutoPycklet class PrometheusService(AutoPycklet): """Installs the Prometheus monitoring service. Args: alert_relabel_configs: Alert relabeling rules. alert_rules: Full list of alerting rules. alertmanager_config: Configuration responsible for pointing where alertmanagers are. config_flags_extra: Additional configuration flags passed to prometheus binary at startup. external_labels: Additional labels. global_config: Prometheus global config. remote_read: Remote read. remote_write: Remote write. scrape_configs: Prometheus scrape jobs. storage_retention: Data retention period. targets: Targets which will be scraped. version: The version of Prometheus. web_external_url: External address on which prometheus is available. web_listen_address: Address on which prometheus will be listening. """ FRECKLET_ID = "prometheus-service" def __init__(self, alert_relabel_configs=None, alert_rules=None, alertmanager_config=None, config_flags_extra=None, external_labels=None, global_config=None, remote_read=None, remote_write=None, scrape_configs=None, storage_retention=None, targets=None, version=None, web_external_url=None, web_listen_address=None): super(PrometheusService, self).__init__(var_names=["alert_relabel_configs", "alert_rules", "alertmanager_config", "config_flags_extra", "external_labels", "global_config", "remote_read", "remote_write", "scrape_configs", "storage_retention", "targets", "version", "web_external_url", "web_listen_address"]) self._alert_relabel_configs = alert_relabel_configs self._alert_rules = alert_rules self._alertmanager_config = alertmanager_config self._config_flags_extra = config_flags_extra self._external_labels = external_labels self._global_config = global_config self._remote_read = remote_read self._remote_write = remote_write self._scrape_configs = scrape_configs self._storage_retention = storage_retention self._targets = targets self._version = version self._web_external_url = web_external_url self._web_listen_address = web_listen_address @property def alert_relabel_configs(self): return self._alert_relabel_configs @alert_relabel_configs.setter def alert_relabel_configs(self, alert_relabel_configs): self._alert_relabel_configs = alert_relabel_configs @property def alert_rules(self): return self._alert_rules @alert_rules.setter def alert_rules(self, alert_rules): self._alert_rules = alert_rules @property def alertmanager_config(self): return self._alertmanager_config @alertmanager_config.setter def alertmanager_config(self, alertmanager_config): self._alertmanager_config = alertmanager_config @property def config_flags_extra(self): return self._config_flags_extra @config_flags_extra.setter def config_flags_extra(self, config_flags_extra): self._config_flags_extra = config_flags_extra @property def external_labels(self): return self._external_labels @external_labels.setter def external_labels(self, external_labels): self._external_labels = external_labels @property def global_config(self): return self._global_config @global_config.setter def global_config(self, global_config): self._global_config = global_config @property def remote_read(self): return self._remote_read @remote_read.setter def remote_read(self, remote_read): self._remote_read = remote_read @property def remote_write(self): return self._remote_write @remote_write.setter def remote_write(self, remote_write): self._remote_write = remote_write @property def scrape_configs(self): return self._scrape_configs @scrape_configs.setter def scrape_configs(self, scrape_configs): self._scrape_configs = scrape_configs @property def storage_retention(self): return self._storage_retention @storage_retention.setter def storage_retention(self, storage_retention): self._storage_retention = storage_retention @property def targets(self): return self._targets @targets.setter def targets(self, targets): self._targets = targets @property def version(self): return self._version @version.setter def version(self, version): self._version = version @property def web_external_url(self): return self._web_external_url @web_external_url.setter def web_external_url(self, web_external_url): self._web_external_url = web_external_url @property def web_listen_address(self): return self._web_listen_address @web_listen_address.setter def web_listen_address(self, web_listen_address): self._web_listen_address = web_listen_address frecklet_class = PrometheusService