Skip to content

smartlogic/ansible-role-prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus

Set up common prometheus configurations

Install to requirements.yml

- src: [email protected]:smartlogic/ansible-role-prometheus
  name: prometheus
  version: 0.6.1

Requirements

For prometheus-postgresql-adapter

  • PostgreSQL 10
  • A PostgreSQL user that has full permissions on the database prometheus will be using
  • This assumes a local connection

If enabled, this will set up two PostgreSQL extensions: pg_prometheus and timescaledb. prometheus-postgresql-adapter will also be set up as a service.

Role Variables

  • prometheus_version - Which version of prometheus to download
  • prometheus_checksum - The checksum for the version of prometheus
  • prometheus_extra_flags - Variable to place on the command line, after the config file load
  • alertmanager_version - Which version of alertmanager to download
  • alertmanager_checksum - The checksum for the version of alertmanager
  • alertmanager_extra_flags - Variable to place on the command line, after the config file load
  • grafana_ini_file - The file to use for grafana.ini
    • Default: grafana.ini
  • grafana_state - The state of the apt package for grafana (present|latest)
    • Default: present
  • prometheus_config_file - The file to use for prometheus.yml
    • Default: prometheus.yml.j2
  • prometheus_alert_file - The file to use for alertmanager.yml
    • Default: alertmanager.yml
  • alertmanager_enabled - boolean - True for enabling the alertmanager, via systemctl
    • Default: true
  • prometheus - Configure scrape files, alert rules, and alert templates
  • prometheus_postgresql_archive - boolean - If true the postgresql adapter will be installed
    • Default: false
  • prometheus_postgresql_adapter_host - The host that the adapter will be running on, how Prometheus will find it
    • Default: localhost
  • prometheus_postgresql_database - Database that the adapter will use
    • Default: metrics
  • prometheus_postgresql_username - User that the adapter will connect as
    • Default: prometheus
  • prometheus_postgresql_password - Password that the adapter will connect with
    • Default: prometheus

Dependencies

None

Example Configuration

grafana_ini_file: "{{ playbook_dir }}/files/grafana.ini"
prometheus_config_file: "{{ playbook_dir }}/files/prometheus.yml"
prometheus_alert_file: "{{ playbook_dir }}/files/alertmanager.yml"

prometheus_postgresql_archive: true
prometheus_postgresql_database: metrics
prometheus_postgresql_username: prometheus

prometheus:
  jobs:
    - "{{ playbook_dir }}/file_config/project.json"
  alert:
    rules:
      - "{{ playbook_dir }}/alert_rules/rules.yml"
    templates:
      - "{{ playbook_dir }}/alert_templates/templte.tmpl"

Example Playbook

Full setup:

- hosts: servers
  roles:
    - { role: prometheus, action: "full" }

License

MIT

Author Information

SmartLogic. https://smartlogic.io