---
project_name: "prometheus"

prometheus_services:
  prometheus-server:
    container_name: prometheus_server
    group: prometheus
    enabled: true
    image: "{{ prometheus_server_image_full }}"
    volumes:
      - "{{ node_config_directory }}/prometheus-server/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "prometheus:/var/lib/prometheus"
      - "kolla_logs:/var/log/kolla/"
    dimensions: "{{ prometheus_server_dimensions }}"
    haproxy:
      prometheus_server:
        enabled: "{{ enable_prometheus }}"
        mode: "http"
        external: false
        port: "{{ prometheus_port }}"
  prometheus-node-exporter:
    container_name: prometheus_node_exporter
    group: prometheus-node-exporter
    enabled: "{{ enable_prometheus_node_exporter | bool }}"
    image: "{{ prometheus_node_exporter_image_full }}"
    pid_mode: "host"
    volumes:
      - "{{ node_config_directory }}/prometheus-node-exporter/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
      - "/proc:/host/proc:ro"
      - "/sys:/host/sys:ro"
    dimensions: "{{ prometheus_node_exporter_dimensions }}"
  prometheus-mysqld-exporter:
    container_name: prometheus_mysqld_exporter
    group: prometheus-mysqld-exporter
    enabled: "{{ enable_prometheus_mysqld_exporter | bool }}"
    image: "{{ prometheus_mysqld_exporter_image_full }}"
    volumes:
      - "{{ node_config_directory }}/prometheus-mysqld-exporter/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
    dimensions: "{{ prometheus_mysqld_exporter_dimensions }}"
  prometheus-haproxy-exporter:
    container_name: prometheus_haproxy_exporter
    group: prometheus-haproxy-exporter
    enabled: "{{ enable_prometheus_haproxy_exporter | bool }}"
    image: "{{ prometheus_haproxy_exporter_image_full }}"
    volumes:
      - "{{ node_config_directory }}/prometheus-haproxy-exporter/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
      - "haproxy_socket:/var/lib/kolla/haproxy"
    dimensions: "{{ prometheus_haproxy_exporter_dimensions }}"
  prometheus-memcached-exporter:
    container_name: prometheus_memcached_exporter
    group: prometheus-memcached-exporter
    enabled: "{{ enable_prometheus_memcached_exporter | bool }}"
    image: "{{ prometheus_memcached_exporter_image_full }}"
    volumes:
      - "{{ node_config_directory }}/prometheus-memcached-exporter/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
    dimensions: "{{ prometheus_memcached_exporter_dimensions }}"
  prometheus-cadvisor:
    container_name: "prometheus_cadvisor"
    group: "prometheus-cadvisor"
    enabled: "{{ enable_prometheus_cadvisor | bool }}"
    image: "{{ prometheus_cadvisor_image_full }}"
    volumes:
      - "{{ node_config_directory }}/prometheus-cadvisor/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
      - "/:/rootfs:ro"
      - "/var/run:/var/run:rw"
      - "/sys:/sys:ro"
      - "/var/lib/docker/:/var/lib/docker:ro"
      - "/dev/disk/:/dev/disk:ro"
    dimensions: "{{ prometheus_cadvisor_dimensions }}"
  prometheus-alertmanager:
    container_name: "prometheus_alertmanager"
    group: "prometheus-alertmanager"
    enabled: "{{ enable_prometheus_alertmanager | bool }}"
    image: "{{ prometheus_alertmanager_image_full }}"
    volumes:
      - "{{ node_config_directory }}/prometheus-alertmanager/:{{ container_config_directory }}/:ro"
      - "/etc/localtime:/etc/localtime:ro"
      - "kolla_logs:/var/log/kolla/"
      - "prometheus:/var/lib/prometheus"
    dimensions: "{{ prometheus_alertmanager_dimensions }}"
    haproxy:
      prometheus_alertmanager:
        enabled: "{{ enable_prometheus_alertmanager }}"
        mode: "http"
        external: false
        port: "{{ prometheus_alertmanager_port }}"
        auth_user: "{{ prometheus_alertmanager_user }}"
        auth_pass: "{{ prometheus_alertmanager_password }}"
      prometheus_alertmanager_external:
        enabled: "{{ enable_prometheus_alertmanager }}"
        mode: "http"
        external: true
        port: "{{ prometheus_alertmanager_port }}"
        auth_user: "{{ prometheus_alertmanager_user }}"
        auth_pass: "{{ prometheus_alertmanager_password }}"

####################
# Database
####################
prometheus_mysql_exporter_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}prometheus{% endif %}"

####################
# Docker
####################
prometheus_install_type: "{{ kolla_install_type }}"
prometheus_tag: "{{ openstack_release }}"

prometheus_server_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-server"
prometheus_server_tag: "{{ prometheus_tag }}"
prometheus_server_image_full: "{{ prometheus_server_image }}:{{ prometheus_server_tag }}"

prometheus_haproxy_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-haproxy-exporter"
prometheus_haproxy_exporter_tag: "{{ prometheus_tag }}"
prometheus_haproxy_exporter_image_full: "{{ prometheus_haproxy_exporter_image }}:{{ prometheus_haproxy_exporter_tag }}"

prometheus_mysqld_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-mysqld-exporter"
prometheus_mysqld_exporter_tag: "{{ prometheus_tag }}"
prometheus_mysqld_exporter_image_full: "{{ prometheus_mysqld_exporter_image }}:{{ prometheus_mysqld_exporter_tag }}"

prometheus_node_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-node-exporter"
prometheus_node_exporter_tag: "{{ prometheus_tag }}"
prometheus_node_exporter_image_full: "{{ prometheus_node_exporter_image }}:{{ prometheus_node_exporter_tag }}"

prometheus_memcached_exporter_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ prometheus_install_type }}-prometheus-memcached-exporter"
prometheus_memcached_exporter_tag: "{{ prometheus_tag }}"
prometheus_memcached_exporter_image_full: "{{ prometheus_memcached_exporter_image }}:{{ prometheus_memcached_exporter_tag }}"

prometheus_cadvisor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-prometheus-cadvisor"
prometheus_cadvisor_tag: "{{ openstack_release }}"
prometheus_cadvisor_image_full: "{{ prometheus_cadvisor_image }}:{{ prometheus_cadvisor_tag }}"

prometheus_alertmanager_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-prometheus-alertmanager"
prometheus_alertmanager_tag: "{{ openstack_release }}"
prometheus_alertmanager_image_full: "{{ prometheus_alertmanager_image }}:{{ prometheus_alertmanager_tag }}"

prometheus_server_dimensions: "{{ default_container_dimensions }}"
prometheus_haproxy_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_mysqld_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_node_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_memcached_exporter_dimensions: "{{ default_container_dimensions }}"
prometheus_cadvisor_dimensions: "{{ default_container_dimensions }}"
prometheus_alertmanager_dimensions: "{{ default_container_dimensions }}"
