Add Prometheus libvirt exporter image

This adds a libvirt exporter image for use with Prometheus.

Partially-Implements: blueprint libvirt-exporter
Change-Id: Ice2af99a323496d3821762851b663899d15f569a
This commit is contained in:
Doug Szumski 2019-03-08 16:14:54 +00:00 committed by Dr. Jens Harbott
parent a93f171da3
commit afce8598ac
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,45 @@
FROM {{ namespace }}/{{ infra_image_prefix }}prometheus-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% import "macros.j2" as macros with context %}
{% block prometheus_libvirt_exporter_header %}{% endblock %}
{% if base_package_type == 'rpm' %}
{% set prometheus_libvirt_exporter_packages = [
'git',
'go',
'libvirt-devel',
] %}
{% elif base_package_type == 'deb' %}
{% set prometheus_libvirt_exporter_packages = [
'build-essential',
'git',
'golang-go',
'libvirt-dev',
'pkg-config',
] %}
{% endif %}
{{ macros.install_packages(prometheus_libvirt_exporter_packages | customizable("packages")) }}
{% block prometheus_libvirt_exporter_version %}
ARG prometheus_libvirt_exporter_version=2.3.0
ARG prometheus_libvirt_exporter_path=github.com/AlexZzz/libvirt-exporter
{% endblock %}
{% block prometheus_libvirt_exporter_install %}
ENV GOPATH=/build
RUN go mod init libvirt-exporter \
&& go get -v ${prometheus_libvirt_exporter_path}@${prometheus_libvirt_exporter_version} \
&& mv /build/bin/libvirt-exporter /opt \
&& rm -rf /build
{% endblock %}
{% block prometheus_libvirt_exporter_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER root

View File

@ -0,0 +1,4 @@
---
features:
- Added a container image for Prometheus libvirt exporter, to be used
for monitoring deployments which provide VMs with libvirt.