diff --git a/alertmanager-0.21.0.linux-amd64.tar.gz b/alertmanager-0.21.0.linux-amd64.tar.gz deleted file mode 100644 index 9bf9ba1..0000000 Binary files a/alertmanager-0.21.0.linux-amd64.tar.gz and /dev/null differ diff --git a/alertmanager-0.21.0.linux-arm64.tar.gz b/alertmanager-0.21.0.linux-arm64.tar.gz deleted file mode 100644 index fa4fd8a..0000000 Binary files a/alertmanager-0.21.0.linux-arm64.tar.gz and /dev/null differ diff --git a/alertmanager.spec b/alertmanager.spec index 615e6d6..bd532e1 100644 --- a/alertmanager.spec +++ b/alertmanager.spec @@ -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 - 0.21.0-4 +- Build from source code + * Thu Aug 05 2021 herengui - 0.21.0-3 - Type: bugfix - ID: #I4431I diff --git a/alertmanager.yml b/alertmanager.yml new file mode 100644 index 0000000..e1f079d --- /dev/null +++ b/alertmanager.yml @@ -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'] diff --git a/v0.21.0.tar.gz b/v0.21.0.tar.gz new file mode 100644 index 0000000..1024c83 Binary files /dev/null and b/v0.21.0.tar.gz differ