Package init

This commit is contained in:
houjian 2020-08-12 09:16:07 +08:00
parent 1f06f8c811
commit bb2334ab54
5 changed files with 92 additions and 0 deletions

Binary file not shown.

Binary file not shown.

0
alertmanager.default Normal file
View File

20
alertmanager.service Normal file
View File

@ -0,0 +1,20 @@
# -*- mode: conf -*-
[Unit]
Description=Prometheus Alertmanager.
Documentation=https://github.com/prometheus/alertmanager
After=network.target
[Service]
EnvironmentFile=-/etc/default/alertmanager
User=prometheus
ExecStart=/usr/bin/alertmanager \
--config.file=/etc/prometheus/alertmanager.yml \
--storage.path=/var/lib/prometheus/alertmanager \
$ALERTMANAGER_OPTS
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

72
alertmanager.spec Normal file
View File

@ -0,0 +1,72 @@
%define debug_package %{nil}
Name: alertmanager
Version: 0.21.0
Release: 2%{?dist}
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 %{name}.service
%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
* Tue Aug 11 2020 houjian <houjian@kylinos.cn> - 0.21.0-2
- Package init