alertmanager/alertmanager.spec

77 lines
2.1 KiB
RPMSpec
Raw Normal View History

2020-08-12 09:16:07 +08:00
%define debug_package %{nil}
Name: alertmanager
Version: 0.21.0
Release: 3
2020-08-12 09:16:07 +08:00
Summary: Prometheus Alertmanager.
License: ASL 2.0
URL: https://github.com/prometheus/%{name}
%ifarch aarch64
%global hostarch arm64
%endif
%ifarch x86_64
%global hostarch amd64
%endif
Source0: https://github.com/prometheus/%{name}/releases/download/v%{version}/%{name}-%{version}.linux-%{hostarch}.tar.gz
Source1: %{name}.service
Source2: %{name}.default
%{?systemd_requires}
Requires(pre): shadow-utils
%description
The Alertmanager handles alerts sent by client applications such as the
Prometheus server. It takes care of deduplicating, grouping, and routing them to
the correct receiver integration such as email, PagerDuty, or OpsGenie. It also
takes care of silencing and inhibition of alerts.
%prep
%setup -q -n %{name}-%{version}.linux-%{hostarch}
%build
/bin/true
%install
mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus
install -D -m 644 alertmanager.yml %{buildroot}%{_sysconfdir}/prometheus/%{name}.yml
install -D -m 755 %{name} %{buildroot}%{_bindir}/%{name}
install -D -m 755 amtool %{buildroot}%{_bindir}/amtool
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/default/%{name}
%pre
getent group prometheus >/dev/null || groupadd -r prometheus
getent passwd prometheus >/dev/null || \
useradd -r -g prometheus -d %{_sharedstatedir}/prometheus -s /sbin/nologin \
-c "Prometheus services" prometheus
exit 0
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
2020-08-12 09:16:07 +08:00
%files
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/prometheus/%{name}.yml
%{_bindir}/%{name}
%{_bindir}/amtool
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/default/%{name}
%dir %attr(755, prometheus, prometheus)%{_sharedstatedir}/prometheus
%changelog
* Thu Aug 05 2021 herengui <herengui@uniontech.com> - 0.21.0-3
- Type: bugfix
- ID: #I4431I
- DESC: solve empty postun transaction issue.
2020-08-12 09:16:07 +08:00
* Tue Aug 11 2020 houjian <houjian@kylinos.cn> - 0.21.0-2
- Package init