Accepting request 707889 from home:jcavalheiro:monitoring

- Fix license information in spec file (MIT)
- Initial commit (v0.5.0)

OBS-URL: https://build.opensuse.org/request/show/707889
OBS-URL: https://build.opensuse.org/package/show/server:monitoring/golang-github-lusitaniae-apache_exporter?expand=0&rev=1
This commit is contained in:
Lars Vogdt 2019-06-05 22:39:16 +00:00 committed by Git OBS Bridge
commit fbf0be4512
6 changed files with 129 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:698f9d715567f318391b8acade3dfa83b849c630f9a7c6184c48dd03de56e4ca
size 978705

View File

@ -0,0 +1,9 @@
-------------------------------------------------------------------
Thu Apr 18 09:04:18 UTC 2019 - jcavalheiro@suse.com
- Fix license information in spec file (MIT)
-------------------------------------------------------------------
Wed Apr 17 17:08:16 UTC 2019 - jcavalheiro@suse.com
- Initial commit (v0.5.0)

View File

@ -0,0 +1,78 @@
#
# spec file for package golang-github-lusitaniae-apache_exporter
#
# Copyright (c) 2019 João Cavalheiro <jcavalheiro@suse.com>
#
# 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/
#
# Templating vars to simplify and standardize Prometheus exporters spec files
%define githubrepo github.com/lusitaniae/apache_exporter
%define upstreamname apache_exporter
%define targetname prometheus-apache_exporter
%define serviceuser prometheus
Name: golang-github-lusitaniae-apache_exporter
Version: 0.5.0
Release: 0
License: MIT
Summary: Apache Exporter for Prometheus
Url: http://%{githubrepo}
Group: System/Management
Source: %{upstreamname}-%{version}.tar.gz
Source1: %{targetname}.service
BuildRequires: fdupes
BuildRequires: golang-packaging
BuildRequires: xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
Requires(pre): shadow
%description
Exports apache mod_status statistics via HTTP for Prometheus consumption.
%prep
%setup -q -n %{upstreamname}-%{version}
%build
%goprep %{githubrepo}
%gobuild
%install
install -D -m0755 %{_builddir}/go/bin/%{upstreamname} %{buildroot}/%{_bindir}/%{targetname}
install -d -m 0755 %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}
install -d -m 0755 %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{targetname}
%pre
%service_add_pre %{targetname}.service
getent group %{serviceuser} >/dev/null || %{_sbindir}/groupadd -r %{serviceuser}
getent passwd %{serviceuser} >/dev/null || %{_sbindir}/useradd -r -g %{serviceuser} -d %{_localstatedir}/lib/%{serviceuser} -M -s /sbin/nologin %{serviceuser}
%post
%service_add_post %{targetname}.service
%preun
%service_del_preun %{targetname}.service
%postun
%service_del_postun %{targetname}.service
%files
%defattr(-,root,root,-)
%doc README.md LICENSE
%{_bindir}/%{targetname}
%{_unitdir}/%{targetname}.service
%{_sbindir}/rc%{targetname}
%changelog

View File

@ -0,0 +1,15 @@
[Unit]
Description=Prometheus exporter for Apache metrics
Documentation=https://github.com/lusitaniae/apache_exporter
[Service]
Restart=always
User=prometheus
EnvironmentFile=-/etc/sysconfig/prometheus-apache_exporter
ExecStart=/usr/bin/prometheus-apache_exporter $ARGS
ExecReload=/bin/kill -HUP $MAINPID
TimeoutStopSec=20s
SendSIGKILL=no
[Install]
WantedBy=multi-user.target