kolla-ansible/ansible/roles/prometheus/templates/prometheus-server.json.j2
Will Szumski d05578f59f Add extras directory to prometheus config
This provides a generic mechanism to include extra files
that you can reference in prometheus.yml, for example:

scrape_targets:
  - job_name: ipmi
    params:
      module: default
    scrape_interval: 1m
    scrape_timeout: 30s
    metrics_path: /ipmi
    scheme: http
    file_sd_configs:
    - files:
      - /etc/prometheus/extras/file_sd/ipmi-exporter-targets.yml
      refresh_interval: 5m

Change-Id: Ie2f085204b71725b901a179ee51541f1f383c6fa
Related: blueprint custom-prometheus-targets
2020-05-11 13:47:12 +01:00

44 lines
1.6 KiB
Django/Jinja

{
"command": "/opt/prometheus/prometheus -config.file /etc/prometheus/prometheus.yml -web.listen-address {{ api_interface_address | put_address_in_context('url') }}:{{ prometheus_port }} -web.external-url={{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ prometheus_port }} -log.format logger:stdout -storage.local.path /var/lib/prometheus{% if prometheus_cmdline_extras %} {{ prometheus_cmdline_extras }}{% endif %}",
"config_files": [
{
"source": "{{ container_config_directory }}/prometheus.yml",
"dest": "/etc/prometheus/prometheus.yml",
"owner": "prometheus",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/extras/*",
"dest": "/etc/prometheus/extras/",
"preserve_properties": true,
"optional": true
}
{% if enable_prometheus_alertmanager %}
,{
"source": "{{ container_config_directory }}/*.rules",
"dest": "/etc/prometheus/",
"optional": true,
"owner": "prometheus",
"perm": "0600"
}
{% endif %}
],
"permissions": [
{
"path": "/data",
"owner": "prometheus:kolla",
"recurse": true
},
{
"path": "/var/log/kolla/prometheus",
"owner": "prometheus:kolla",
"recurse": true
},
{
"path": "/etc/prometheus/extras/",
"owner": "prometheus:kolla",
"recurse": true
}
]
}