Compare commits
10 Commits
1f06f8c811
...
e72880b9f9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e72880b9f9 | ||
|
|
213dfc01db | ||
|
|
ee2bff90b0 | ||
|
|
e8f08bb34f | ||
|
|
7e331355e2 | ||
|
|
1f67a8b6b8 | ||
|
|
60989f2e5d | ||
|
|
a47427b425 | ||
|
|
e303b17a74 | ||
|
|
bb2334ab54 |
0
alertmanager.default
Normal file
0
alertmanager.default
Normal file
20
alertmanager.service
Normal file
20
alertmanager.service
Normal 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
|
||||||
85
alertmanager.spec
Normal file
85
alertmanager.spec
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
%define debug_package %{nil}
|
||||||
|
|
||||||
|
Name: alertmanager
|
||||||
|
Version: 0.21.0
|
||||||
|
Release: 6
|
||||||
|
Summary: Prometheus Alertmanager.
|
||||||
|
License: ASL 2.0
|
||||||
|
URL: https://github.com/prometheus/%{name}
|
||||||
|
|
||||||
|
|
||||||
|
Source0: https://github.com/prometheus/%{name}/archive/refs/tags/v%{version}.tar.gz
|
||||||
|
Source1: %{name}.service
|
||||||
|
Source2: %{name}.default
|
||||||
|
Source3: %{name}.yml
|
||||||
|
|
||||||
|
BuildRequires: golang
|
||||||
|
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}
|
||||||
|
|
||||||
|
%build
|
||||||
|
export GOFLAGS="-mod=vendor -buildmode=pie"
|
||||||
|
go build -ldflags '-w -s -linkmode=external -extldflags "-Wl,-z,relro -Wl,-z,now -pie"' -mod=vendor -o %{_builddir}/%{name}-%{version}/bin/alertmanager ./cmd/alertmanager
|
||||||
|
go build -ldflags '-w -s -linkmode=external -extldflags "-Wl,-z,relro -Wl,-z,now -pie"' -mod=vendor -o %{_builddir}/%{name}-%{version}/bin/amtool ./cmd/amtool
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
%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 Mar 07 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 0.21.0-6
|
||||||
|
- Add strip and pie
|
||||||
|
|
||||||
|
* Thu Mar 2 2023 zhangjian <zhang_jian7@hoperun.com> - 0.21.0-5
|
||||||
|
- fix build failure that unitdir cannot be identified
|
||||||
|
|
||||||
|
* 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
|
||||||
|
- DESC: solve empty postun transaction issue.
|
||||||
|
|
||||||
|
* Tue Aug 11 2020 houjian <houjian@kylinos.cn> - 0.21.0-2
|
||||||
|
- Package init
|
||||||
19
alertmanager.yml
Normal file
19
alertmanager.yml
Normal 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
BIN
v0.21.0.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user