diff --git a/0001-use-local-promu.patch b/0001-use-local-promu.patch new file mode 100644 index 0000000000000000000000000000000000000000..5424463dc6e7c5489e8854bd0a994229502ea1e6 --- /dev/null +++ b/0001-use-local-promu.patch @@ -0,0 +1,25 @@ +From aff2dabb339e1b7a249ac60dd0b341a35210acc3 Mon Sep 17 00:00:00 2001 +From: yangzhao_kl +Date: Tue, 5 Sep 2023 15:52:42 +0800 +Subject: [PATCH] use local promu + +--- + Makefile.common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.common b/Makefile.common +index e372d34..52658d5 100644 +--- a/Makefile.common ++++ b/Makefile.common +@@ -195,7 +195,7 @@ common-unused: + @git diff --exit-code -- go.sum go.mod + + .PHONY: common-build +-common-build: promu ++common-build: + @echo ">> building binaries" + $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES) + +-- +2.33.0 + 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 9bf9ba1f4acf73c18eaf87a1e6dc29e7ed2e2932..0000000000000000000000000000000000000000 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 fa4fd8a74b4a823bb71ab43324f1b82b80dd0e32..0000000000000000000000000000000000000000 Binary files a/alertmanager-0.21.0.linux-arm64.tar.gz and /dev/null differ diff --git a/alertmanager.spec b/alertmanager.spec index 615e6d6c648b14e56a1d32bf0228d932dc9fc191..5f6a4a49ccb3d721b7cae80b5de99009c6127379 100644 --- a/alertmanager.spec +++ b/alertmanager.spec @@ -1,46 +1,53 @@ %define debug_package %{nil} Name: alertmanager -Version: 0.21.0 -Release: 3 +Version: 0.26.0 +Release: 1 Summary: Prometheus Alertmanager. -License: ASL 2.0 +License: Apache-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 +Source4: vendor.tar.gz +Patch0: 0001-use-local-promu.patch + +BuildRequires: make +BuildRequires: golang >= 1.18.0 +BuildRequires: promu +BuildRequires: systemd %{?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} +%patch0 -p1 +tar -xzvf %{SOURCE4} %build -/bin/true +mkdir -p $(go env GOPATH)/bin/ +cp -n $(which promu) $(go env GOPATH)/bin/ + +export GOFLAGS="-mod=vendor -buildmode=pie" +make build %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 alertmanager %{buildroot}%{_bindir} +install -D -m 755 -vp amtool %{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,10 +75,25 @@ exit 0 %dir %attr(755, prometheus, prometheus)%{_sharedstatedir}/prometheus %changelog +* Tue Sep 5 2023 Zhengxin Guo - 0.26.0-1 +- update to 0.26.0 to fix CVE-2023-40577 + +* Wed May 31 2023 Wenlong Zhang - 0.21.0-7 +- update sys and net to support loong64 + +* Tue Mar 07 2023 jiangxinyu - 0.21.0-6 +- Add strip and pie + +* Fri Feb 03 2023 jiangxinyu - 0.21.0-5 +- Add buildRequires systemd + +* 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 - DESC: solve empty postun transaction issue. * Tue Aug 11 2020 houjian - 0.21.0-2 -- Package init \ No newline at end of file +- Package init diff --git a/alertmanager.yaml b/alertmanager.yaml new file mode 100644 index 0000000000000000000000000000000000000000..23f6d60a124f62c88f2c3cbb14b5bf814fd0f47f --- /dev/null +++ b/alertmanager.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: prometheus/alertmanager +tag_prefix: "" +separator: "." \ No newline at end of file diff --git a/alertmanager.yml b/alertmanager.yml new file mode 100644 index 0000000000000000000000000000000000000000..e1f079dce03d61a394758c4acf6410432cd9e291 --- /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.26.0.tar.gz b/v0.26.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a0d9ab3f8941946be7246b212e26e97dda58a5b7 Binary files /dev/null and b/v0.26.0.tar.gz differ diff --git a/vendor.tar.gz b/vendor.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..1cca14c26918fb97c20a14d86d24ab59b8ced02b Binary files /dev/null and b/vendor.tar.gz differ