!4 build rpm from source

Merge pull request !4 from yangzhao_kl/master
This commit is contained in:
openeuler-ci-bot 2022-01-29 10:07:28 +00:00 committed by Gitee
commit 7e331355e2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 33 additions and 14 deletions

View File

@ -2,45 +2,42 @@
Name: alertmanager
Version: 0.21.0
Release: 3
Release: 4
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
Source0: https://github.com/prometheus/%{name}/archive/refs/tags/v%{version}.tar.gz
Source1: %{name}.service
Source2: %{name}.default
Source3: %{name}.yml
BuildRequires: golang
%{?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}
%setup -q -n %{name}-%{version}
%build
/bin/true
go build -mod=vendor -o %{_builddir}/%{name}-%{version}/bin/alertmanager ./cmd/alertmanager
go build -mod=vendor -o %{_builddir}/%{name}-%{version}/bin/amtool ./cmd/amtool
%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 755 -vd %{buildroot}%{_bindir}
install -D -m 755 -vp %{_builddir}/%{name}-%{version}/bin/* %{buildroot}%{_bindir}
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/default/%{name}
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/prometheus/%{name}.yml
%pre
getent group prometheus >/dev/null || groupadd -r prometheus
@ -68,6 +65,9 @@ exit 0
%dir %attr(755, prometheus, prometheus)%{_sharedstatedir}/prometheus
%changelog
* Sat Jan 29 2022 yangzhao <yangzhao1@kylinos.cn> - 0.21.0-4
- Build from source code
* Thu Aug 05 2021 herengui <herengui@uniontech.com> - 0.21.0-3
- Type: bugfix
- ID: #I4431I

19
alertmanager.yml Normal file
View File

@ -0,0 +1,19 @@
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'web.hook'
receivers:
- name: 'web.hook'
webhook_configs:
- url: 'http://127.0.0.1:5001/'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
equal: ['alertname', 'dev', 'instance']

BIN
v0.21.0.tar.gz Normal file

Binary file not shown.