7.2.10.1.2. Configuration / fichiers utiles

Prometheus server est optionnel, l’activation/désactivation de son installation est possible depuis la conf (cots_var.yml la variable prometheus.server.enabled)

7.2.10.1.2.1. Fichier prometheus.yml

# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
    # - alertmanager:9093
{% for host in groups['hosts_alertmanager'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{prometheus.alertmanager.api_port}}
{% endfor %}

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - rule.yml
{% for item in rules_files.files %}
  - {{ item.path }}
{% endfor %}

scrape_configs:
  - job_name: vitam-node-exporter
    metrics_path: {{ prometheus.node_exporter.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['vitam'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{prometheus.node_exporter.port}}
{% endfor %}

{% if (groups['hosts_access_internal']|length >0) %}
  - job_name: vitam-access-internal
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_access_internal'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.accessinternal.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_access_external']|length >0) %}
  - job_name: vitam-access-external
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_access_external'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.accessexternal.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_ingest_internal']|length >0) %}
  - job_name: vitam-ingest-internal
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_ingest_internal'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.ingestinternal.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_ingest_external']|length >0) %}
  - job_name: vitam-ingest-external
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_ingest_external'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.ingestexternal.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_metadata']|length >0) %}
  - job_name: vitam-metadata
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_metadata'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.metadata.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_ihm_demo']|length >0) %}
  - job_name: vitam-ihm-demo
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_ihm_demo'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.ihm_demo.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_ihm_recette']|length >0) %}
  - job_name: vitam-ihm-recette
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_ihm_recette'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.ihm_recette.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_logbook']|length >0) %}
  - job_name: vitam-logbook
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_logbook'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.logbook.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_workspace']|length >0) %}
  - job_name: vitam-workspace
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_workspace'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.workspace.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_processing']|length >0) %}
  - job_name: vitam-processing
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_processing'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.processing.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_worker']|length >0) %}
  - job_name: vitam-worker
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_worker'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.worker.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_storage_engine']|length >0) %}
  - job_name: vitam-storage-engine
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_storage_engine'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.storageengine.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_storage_offer_default']|length >0) %}
  - job_name: vitam-storage-offer-default
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_storage_offer_default'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.storageofferdefault.port_admin }}
{% endfor %}
{% endif %}

{% if (groups['hosts_functional_administration']|length >0) %}
  - job_name: vitam-functional-administration
    metrics_path: {{ prometheus.metrics_path }}
    static_configs:
    - targets:
{% for host in groups['hosts_functional_administration'] %}
      - {{ hostvars[host]['ip_admin'] }}:{{ vitam.functional_administration.port_admin }}
{% endfor %}
{% endif %}

7.2.10.1.2.2. Fichier de variable d’environnement

PROMETHEUS_OPTS='--web.listen-address={{ ip_admin }}:{{prometheus.server.port}} --web.external-url=http://{{ ip_admin }}:{{prometheus.server.port}}/prometheus --config.file=/vitam/conf/prometheus/prometheus.yml --storage.tsdb.path=/vitam/data/prometheus'
# Following params can be added
# --web.enable-admin-api
# --web.page-title
# --web.cors.origin
# --web.route-prefix

7.2.10.1.2.3. Fichier de données

Ce service utilise des fichiers de données localisés dans le répertoire /vitam/data/prometheus/