Merge "Add Prometheus libvirt exporter image" into stable/xena

This commit is contained in:
Zuul 2022-03-15 11:19:24 +00:00 committed by Gerrit Code Review
commit ebb2b09558
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.