Add prometheus and related containers

Add container for prometheus, mysqld_exporter, node_exporter and
haproxy_exporter

Change-Id: I6e4eb0391380e594b708a67365e240d3eeafd88b
This commit is contained in:
Mathias Ewald 2017-07-17 16:00:08 +00:00
parent b7430a07c4
commit cbbceb0ad3
8 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,21 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block prometheus_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='prometheus') }}
{% if base_arch == 'x86_64' %}
ENV prometheus_arch=amd64
{% elif base_arch == 'aarch64' %}
ENV prometheus_arch=arm64
{% else %}
ENV prometheus_arch={{ base_arch }}
{% endif %}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start
{% block prometheus_base_footer %}{% endblock %}

View File

@ -0,0 +1,9 @@
#!/bin/bash
# Create log directory, with appropriate permissions
if [[ ! -d "/var/log/kolla/prometheus" ]]; then
mkdir -p /var/log/kolla/prometheus
fi
if [[ $(stat -c %a /var/log/kolla/prometheus) != "755" ]]; then
chmod 755 /var/log/kolla/prometheus
fi

View File

@ -0,0 +1,20 @@
FROM {{ namespace }}/{{ image_prefix }}prometheus-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block haproxy_exporter_header %}{% endblock %}
{% block haproxy_exporter_repository_version %}
ENV haproxy_exporter_version=0.7.1
{% endblock %}
{% block haproxy_exporter_install %}
RUN curl -sSL -o /tmp/haproxy_exporter.tar.gz https://github.com/prometheus/haproxy_exporter/releases/download/v${haproxy_exporter_version}/haproxy_exporter-${haproxy_exporter_version}.linux-${prometheus_arch}.tar.gz \
&& tar xvf /tmp/haproxy_exporter.tar.gz -C /opt/ \
&& rm -f /tmp/haproxy_exporter.tar.gz \
&& ln -s /opt/haproxy_exporter* /opt/haproxy_exporter
{% endblock %}
{% block haproxy_exporter_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER prometheus

View File

@ -0,0 +1,20 @@
FROM {{ namespace }}/{{ image_prefix }}prometheus-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block mysqld_exporter_header %}{% endblock %}
{% block mysqld_exporter_repository_version %}
ENV mysqld_exporter_version=0.10.0
{% endblock %}
{% block mysqld_exporter_install %}
RUN curl -ssL -o /tmp/mysqld_exporter.tar.gz https://github.com/prometheus/mysqld_exporter/releases/download/v${mysqld_exporter_version}/mysqld_exporter-${mysqld_exporter_version}.linux-${prometheus_arch}.tar.gz \
&& tar xvf /tmp/mysqld_exporter.tar.gz -C /opt/ \
&& rm -f /tmp/mysqld_exporter.tar.gz \
&& ln -s /opt/mysqld_exporter* /opt/mysqld_exporter
{% endblock %}
{% block mysqld_exporter_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER prometheus

View File

@ -0,0 +1,20 @@
FROM {{ namespace }}/{{ image_prefix }}prometheus-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block node_exporter_header %}{% endblock %}
{% block node_exporter_repository_version %}
ENV node_exporter_version=0.14.0
{% endblock %}
{% block node_exporter_install %}
RUN curl -sSL -o /tmp/node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v${node_exporter_version}/node_exporter-${node_exporter_version}.linux-${prometheus_arch}.tar.gz \
&& tar xvf /tmp/node_exporter.tar.gz -C /opt/ \
&& rm -f /tmp/node_exporter.tar.gz \
&& ln -s /opt/node_exporter* /opt/node_exporter
{% endblock %}
{% block node_exporter_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER prometheus

View File

@ -0,0 +1,21 @@
FROM {{ namespace }}/{{ image_prefix }}prometheus-base:{{ tag }}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% block prometheus_server_header %}{% endblock %}
{% block prometheus_server_repository_version %}
ENV prometheus_version=1.7.1
{% endblock %}
{% block prometheus_server_install %}
RUN curl -sSL -o /tmp/prometheus.tar.gz https://github.com/prometheus/prometheus/releases/download/v${prometheus_version}/prometheus-${prometheus_version}.linux-${prometheus_arch}.tar.gz \
&& tar xvf /tmp/prometheus.tar.gz -C /opt/ \
&& rm -f /tmp/prometheus.tar.gz \
&& ln -s /opt/prometheus* /opt/prometheus \
&& mkdir -p /etc/prometheus /data
{% endblock %}
{% block prometheus_server_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER prometheus

View File

@ -919,7 +919,11 @@ USERS = {
'blazar-user': {
'uid': 42471,
'gid': 42471,
}
},
'prometheus-user': {
'uid': 42472,
'gid': 42472,
},
}

View File

@ -0,0 +1,5 @@
---
features:
- Container image for prometheus timeseries database
- Container images for the prometheus exporters node_exporter, mysqld_exporter
and haproxy_exporter