File golang-github-ndecker-fritzbox_exporter.spec of Package golang-github-ndecker-fritzbox_exporter

#
# spec file for package golang-github-ndecker-fritzbox_exporter
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2019 Matthias Bach <marix@marix.org>
#
# 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-ndecker-fritzbox_exporter
Version:        1.0
Release:        0
Summary:        FRITZ!Box UPnP statistics exporter for Prometheus
License:        Apache-2.0
Group:          Development/Languages/Other
URL:            https://github.com/ndecker/fritzbox_exporter
Source:         fritzbox_exporter-%{version}.tar.gz
Source1:        prometheus-fritzbox_exporter.service
Source2:        prometheus-fritzbox_exporter.sysconfig
BuildRequires:  golang-packaging
BuildRequires:  go1.15
%{go_nostrip}
%{go_provides}
%{?systemd_ordering}
Requires(pre):  user(prometheus)
Requires(pre):  group(prometheus)


%description
This exporter exports some variables from an AVM FRITZ!Box to Prometheus.

By default the metrics are made available at http://localhost:9133/metrics.

%prep
%setup -q -n fritzbox_exporter-%{version}

%build
%{goprep} github.com/ndecker/fritzbox_exporter/
%{gobuild}

%install
%{goinstall}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/prometheus-fritzbox_exporter.service
install -Dd -m 0755 %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcprometheus-fritzbox_exporter
install -D -m 0644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.prometheus-fritzbox_exporter

%pre
%service_add_pre prometheus-fritzbox_exporter.service

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

%preun
%service_del_preun prometheus-fritzbox_exporter.service

%postun
%service_del_postun prometheus-fritzbox_exporter.service

%files
%{_bindir}/fritzbox_exporter
%license LICENSE
%doc README.md
%{_unitdir}/prometheus-fritzbox_exporter.service
%{_sbindir}/rcprometheus-fritzbox_exporter
%{_fillupdir}/sysconfig.prometheus-fritzbox_exporter

%changelog
openSUSE Build Service is sponsored by