Skip to content

UnderGreen/ansible-prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ansible Role: prometheus Build Status

An Ansible role that installs Prometheus Monitoring server on Ubuntu-based machines with systemd.

Requirements

All needed packages will be installed with this role. Minimal Ansible version - 2.0.

Role Variables

Available main variables are listed below, along with default values:

prometheus_version: 2.1

prometheus_global_scrape_interval: 15s
prometheus_global_evaluation_interval: 15s
prometheus_global_scrape_timeout: 10s
prometheus_self_scrape_interval: "{{ prometheus_global_scrape_interval }}"
prometheus_self_evaluation_interval: "{{ prometheus_global_scrape_interval }}"

prometheus_root_dir: /opt/prometheus
prometheus_config_dir: /etc/prometheus
prometheus_pid_path: /var/run/prometheus.pid
prometheus_db_dir: /var/lib/prometheus

prometheus_web_listen_address: ":9090"
prometheus_alertmanager_url: 'localhost:9093'

prometheus_config_flags:
  'config.file': '{{ prometheus_config_dir }}/prometheus.yml'
  'storage.local.path': '{{ prometheus_db_dir }}'
  'web.listen-address': '{{ prometheus_web_listen_address }}'
  'alertmanager.url': '{{ prometheus_alertmanager_url }}'

All variables you can see here.

Dependencies

This role doesn't have dependencies.

Example Playbook

- hosts: monitoring
  roles:
    - { role: UnderGreen.prometheus }

You should create another config parts of main file inside {{ playbook_dir }}/files/config_parts.
I use Ansible assembly and config parts should have alphabethical order. For example 2-static_sd.yml:

scrape_configs:
  - job_name: "files_sd"
    scrape_interval: 15s
    file_sd_configs:
      - files:
        - '/etc/prometheus/tgroups/*.json'
        - '/etc/prometheus/tgroups/*.yml'
        - '/etc/prometheus/tgroups/*.yaml'
        refresh_interval: '5m'

Example 03-alertmanager.yml:

alerting:
  alertmanagers:
  - scheme: http
    static_configs:
      - targets:
        - '127.0.0.1:9093'

License

GPLv2

About

Ansible role for deploying Prometheus monitoring server

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •