From 986293e9d45b4bb5d18ce9cc942790b248549221 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Tue, 20 Feb 2024 08:55:55 +0100 Subject: [PATCH] prometheus: use inovex/prometheus-libvirt-exporter The Tinkoff/libvirt-exporter is archived. Latest release in December 2022. The inovex/prometheus-libvirt-exporter is an active fork that will most probably become a prometheus community exporter in the future [1]. Unfortunately this exporter is not 100% compatible with Tinkoff exporter that we are using currently [2]. [1]: https://github.com/prometheus-community/community/issues/50 [2]: https://github.com/inovex/prometheus-libvirt-exporter/issues/22 Change-Id: Icc8a3651d601ab45d448c9d252ca6155219d21cf --- .../prometheus-libvirt-exporter/Dockerfile.j2 | 34 +++---------------- kolla/common/sources.py | 11 ++++++ ...virt-exporter-inovex-acddd497258fe562.yaml | 8 +++++ 3 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 releasenotes/notes/prometheus-libvirt-exporter-inovex-acddd497258fe562.yaml diff --git a/docker/prometheus/prometheus-libvirt-exporter/Dockerfile.j2 b/docker/prometheus/prometheus-libvirt-exporter/Dockerfile.j2 index 88089c7b79..390241b9f0 100644 --- a/docker/prometheus/prometheus-libvirt-exporter/Dockerfile.j2 +++ b/docker/prometheus/prometheus-libvirt-exporter/Dockerfile.j2 @@ -5,41 +5,15 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% import "macros.j2" as macros with context %} -{{ macros.enable_extra_repos(['crb']) }} - {% 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.3 -ARG prometheus_libvirt_exporter_path=github.com/Tinkoff/libvirt-exporter -{% endblock %} - {% block prometheus_libvirt_exporter_install %} -ENV GOPATH=/build -RUN go mod init libvirt-exporter \ - && cd ${GOPATH} \ - && go get -v ${prometheus_libvirt_exporter_path}@${prometheus_libvirt_exporter_version} \ - && go build ${prometheus_libvirt_exporter_path} \ - && mv /build/libvirt-exporter /opt \ - && rm -rf /build +ADD prometheus-libvirt-exporter-archive /prometheus-libvirt-exporter-source + +RUN ln -s /prometheus-libvirt-exporter-source/* prometheus-libvirt-exporter \ + && cp /prometheus-libvirt-exporter/prometheus-libvirt-exporter /opt/libvirt-exporter {% endblock %} diff --git a/kolla/common/sources.py b/kolla/common/sources.py index 782961d6d5..0312df62ec 100644 --- a/kolla/common/sources.py +++ b/kolla/common/sources.py @@ -341,6 +341,17 @@ SOURCES = { 'releases/download/v${version}/' 'elasticsearch_exporter' '-${version}.linux-${debian_arch}.tar.gz')}, + 'prometheus-libvirt-exporter': { + 'version': '1.6.0', + 'type': 'url', + 'sha256': { + 'amd64': '57f1e71ac5bd87f18a40b9089e9fb513dec44ced58328b3065879b279f967596', # noqa: E501 + 'arm64': '8f474fbb515caf19fda92c839eece761738138c7c676d12d10aa0b8c29b3ef9d'}, # noqa: E501 + 'location': ('https://github.com/' + 'inovex/prometheus-libvirt-exporter/' + 'releases/download/v${version}/' + 'prometheus-libvirt-exporter' + '-${version}.linux-${debian_arch}.tar.gz')}, 'prometheus-memcached-exporter': { 'version': '0.14.2', 'type': 'url', diff --git a/releasenotes/notes/prometheus-libvirt-exporter-inovex-acddd497258fe562.yaml b/releasenotes/notes/prometheus-libvirt-exporter-inovex-acddd497258fe562.yaml new file mode 100644 index 0000000000..b98e7b80ab --- /dev/null +++ b/releasenotes/notes/prometheus-libvirt-exporter-inovex-acddd497258fe562.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Replace Tinkoff/libvirt-exporter with inovex/prometheus-libvirt-exporter. + The Tinkoff/libvirt-exporter repository is archived. Latest + release in December 2022. The inovex/prometheus-libvirt-exporter repository is an + active fork of zhangjianweibj/prometheus-libvirt-exporter that will become + `a Prometheus community exporter in the future `_.