File golang-github-prometheus-ipmi_exporter.spec of Package golang-github-prometheus-ipmi_exporter

#
# spec file for package golang-github-prometheus-ipmi_exporter
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           golang-github-prometheus-ipmi_exporter
Version:        1.6.1
Release:        0
Summary:        Prometheus exporter for ipmi metrics
License:        MIT
URL:            https://github.com/prometheus-community/ipmi_exporter
Source0:        https://github.com/prometheus-community/ipmi_exporter/archive/v%{version}.tar.gz#/ipmi-exporter-%{version}.tar.gz
Source1:        vendor.tar.gz
Source2:        prometheus-ipmi_exporter.service
BuildRequires:  go
BuildRequires:  golang-packaging
%{?systemd_requires}
Requires(pre):  shadow
Requires:       freeipmi
%{go_provides}
Provides:       ipmi_exporter
Provides:       prometheus(ipmi_exporter)

%description
This is an IPMI exporter for Prometheus.  It supports both the regular /metrics
endpoint, exposing metrics from the host that the exporter is running on, as
well as an /ipmi endpoint that supports IPMI over RMCP - one exporter running
on one host can be used to monitor a large number of IPMI interfaces by passing
the target parameter to a scrape.  The exporter relies on tools from the
FreeIPMI suite for the actual IPMI implementation.

%prep
%autosetup -n ipmi_exporter-%{version}
tar xzf %{S:1}

%build
go build -mod=vendor

%install
install -D -m 0755 ipmi_exporter %{buildroot}%{_bindir}/ipmi_exporter
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/prometheus-ipmi_exporter.service
mkdir -p %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcprometheus-ipmi_exporter

%check
#go test -mod=vendor

%pre
%service_add_pre prometheus-ipmi_exporter.service
%post
%service_add_post prometheus-ipmi_exporter.service

%preun
%service_del_preun prometheus-ipmi_exporter.service

%postun
%service_del_postun prometheus-ipmi_exporter.service

%files
%{_bindir}/ipmi_exporter
%{_unitdir}/prometheus-ipmi_exporter.service
%{_sbindir}/rcprometheus-ipmi_exporter

%changelog
openSUSE Build Service is sponsored by