Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Victoria: Add libvirt exporter image #75

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docker/prometheus/prometheus-libvirt-exporter/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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_distro in ['centos'] %}
{% set prometheus_libvirt_exporter_packages = [
'go',
'libvirt-devel',
'git',
] %}
{% elif base_distro in ['debian', 'ubuntu'] %}
{% set prometheus_libvirt_exporter_packages = [
'golang-go',
'libvirt-dev',
'git',
] %}
{% endif %}

{{ macros.install_packages(prometheus_libvirt_exporter_packages | customizable("packages")) }}

{% block prometheus_libvirt_exporter_version %}
ARG prometheus_libvirt_exporter_version=2.1.1
ARG prometheus_libvirt_exporter_url=https://github.com/AlexZzz/libvirt-exporter/archive/refs/tags
{% endblock %}

{% block prometheus_libvirt_exporter_install %}
ENV GOPATH=/build
RUN mkdir /build \
&& cd /build \
&& curl -sSL -o libvirt-exporter.tar.gz ${prometheus_libvirt_exporter_url}/${prometheus_libvirt_exporter_version}.tar.gz \
&& tar xvf libvirt-exporter.tar.gz \
&& cd libvirt-exporter-${prometheus_libvirt_exporter_version} \
&& go build -mod vendor \
&& install -m 0755 libvirt-exporter /opt/ \
&& rm -rf /build

{% endblock %}

{% block prometheus_libvirt_exporter_footer %}{% endblock %}
{% block footer %}{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- Added a container image for Prometheus libvirt exporter, to be used
for monitoring deployments which provide VMs with libvirt.