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

#
# spec file for package golang-github-prometheus-mysqld_exporter
#
# Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

Name:           golang-github-prometheus-mysqld_exporter
Version:        0.15.1
Release:        0
License:        Apache-2.0
Summary:        Prometheus exporter for MySQL server metrics
Url:            https://github.com/prometheus/mysqld_exporter
Group:          System/Monitoring 
Source:         mysqld_exporter-%{version}.linux-amd64.tar.gz
Source1:        prometheus-mysqld_exporter.service
Source2:        prometheus-mysqld_exporter.sysconfig
BuildRequires:  go >= 1.11
BuildRequires:  fdupes
BuildRequires:  golang-packaging
BuildRequires:  golang-github-prometheus-promu
Provides:       mysqld_exporter = %{version}-%{release}
Provides:       prometheus(mysqld_exporter) = %{version}-%{release}
Requires(post): %fillup_prereq
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{go_provides}
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates
%endif

%description
Prometheus exporter for MySQL server metrics.

Supported MySQL versions: 5.6 and up.

NOTE: Not all collection methods are supported on MySQL < 5.6

%prep
%setup -q -n mysqld_exporter-%{version}.linux-amd64

%build

%install
install -Dd -m 0755 %{buildroot}%{_bindir}
install -D -m 0755 mysqld_exporter %{buildroot}%{_bindir}/mysqld_exporter
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/prometheus-mysqld_exporter.service
install -Dd -m 0755 %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcprometheus-mysqld_exporter
install -D -m 0644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.prometheus-mysqld_exporter
%fdupes %{buildroot}

%check

%pre
%service_add_pre prometheus-mysqld_exporter.service

%post
%service_add_post prometheus-mysqld_exporter.service
%fillup_only -n prometheus-mysqld_exporter

%preun
%service_del_preun prometheus-mysqld_exporter.service

%postun
%service_del_postun prometheus-mysqld_exporter.service

%files
%defattr(-,root,root)
%if 0%{?suse_version} >= 1500
%license LICENSE
%else
%doc LICENSE
%endif
%{_bindir}/mysqld_exporter
%{_unitdir}/prometheus-mysqld_exporter.service
%{_sbindir}/rcprometheus-mysqld_exporter
%{_fillupdir}/sysconfig.prometheus-mysqld_exporter

%changelog
openSUSE Build Service is sponsored by