-
Notifications
You must be signed in to change notification settings - Fork 0
/
naemon.spec
176 lines (144 loc) · 5.39 KB
/
naemon.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
%if %{defined suse_version}
%define apacheuser wwwrun
%define apachegroup www
%define apachedir apache2
%else
%define apacheuser apache
%define apachegroup apache
%define apachedir httpd
%endif
%undefine _disable_source_fetch
Summary: Open Source Host, Service And Network Monitoring Program
Name: naemon
Version: 1.4.2
Release: 0
License: GPL-2.0-only
BuildArch: noarch
Group: Applications/System
URL: https://www.naemon.io/
Packager: Naemon Core Development Team <naemon-dev@monitoring-lists.org>
Vendor: Naemon Core Development Team
Source0: https://github.com/naemon/naemon/archive/refs/tags/v%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
%if %{defined suse_version}
BuildRequires: apache2
%else
BuildRequires: httpd
%endif
Requires: %{name}-core >= %{version}
Requires: %{name}-livestatus >= %{version}
Requires: %{name}-vimvault >= 1.4.1
Requires: %{name}-thruk = %{version}
# do not generate debug packages
%define debug_package %{nil}
%description
Naemon is an application, system and network monitoring application.
It can escalate problems by email, pager or any other medium. It is
also useful for incident or SLA reporting. It is originally a fork
of Nagios, but with extended functionality, stability and performance.
It is written in C and is designed as a background process,
intermittently running checks on various services that you specify.
The actual service checks are performed by separate "plugin" programs
which return the status of the checks to Naemon. The plugins are
compatible with Nagios, and can be found in the monitoring-plugins package.
Naemon ships the Thruk gui with extended reporting and dashboard features.
%package thruk
Summary: Thruk Gui For Naemon
Group: Applications/System
Requires: thruk
Requires(pre): naemon-core >= %{version}-%{release}
%if 0%{?systemd_requires}
%systemd_requires
%endif
Obsoletes: naemon-thruk-reporting
Obsoletes: naemon-thruk-libs
%description thruk
This package contains the thruk gui for %{name}.
%prep
%setup -q
%build
%{__make}
%install
%{__rm} -rf %{buildroot}
%{__make} install DESTDIR="%{buildroot}"
%clean
%{__rm} -rf %{buildroot}
%post thruk
# migrate config files to new location
mkdir -p -m 0755 /etc/thruk/
[ ! -e %{_sysconfdir}/%{name}/cgi.cfg ] || %{__mv} %{_sysconfdir}/%{name}/cgi.cfg /etc/thruk/cgi.cfg
[ ! -e %{_sysconfdir}/%{name}/thruk_local.conf ] || %{__mv} %{_sysconfdir}/%{name}/thruk_local.conf /etc/thruk/thruk_local.d/_migrated_naemon_thruk_local.conf
[ ! -e %{_sysconfdir}/%{name}/menu_local.conf ] || sed -e 's%/usr/share/naemon/%/usr/share/thruk/%g' -i %{_sysconfdir}/%{name}/menu_local.conf
[ ! -e %{_sysconfdir}/%{name}/menu_local.conf ] || %{__mv} %{_sysconfdir}/%{name}/menu_local.conf /etc/thruk/menu_local.conf
[ ! -e %{_sysconfdir}/%{name}/htpasswd ] || %{__mv} %{_sysconfdir}/%{name}/htpasswd /etc/thruk/htpasswd
[ -e %{_sysconfdir}/%{name}/conf.d/thruk_templates.cfg ] || ln -sfn /usr/share/thruk/support/thruk_templates.cfg %{_sysconfdir}/%{name}/conf.d/thruk_templates.cfg
# add apache user to group naemon so thruk can access the livestatus socket
if /usr/bin/id %{apacheuser} &>/dev/null; then
if ! /usr/bin/id -Gn %{apacheuser} 2>/dev/null | grep -q naemon ; then
%if %{defined suse_version}
%if 0%{?suse_version} < 1230
/usr/sbin/groupmod -A %{apacheuser} naemon >/dev/null
%else
/usr/sbin/usermod -a -G naemon %{apacheuser} >/dev/null
%endif
%else
/usr/sbin/usermod -a -G naemon %{apacheuser} >/dev/null
%endif
fi
fi
# restart apache webserver
%if %{defined suse_version}
%if %{?_unitdir:1}0
systemctl daemon-reload &>/dev/null || true
systemctl condrestart apache2.service &>/dev/null || true
%else
/etc/init.d/apache2 restart &>/dev/null || true
%endif
%else
%if %{?_unitdir:1}0
systemctl daemon-reload &>/dev/null || true
systemctl condrestart httpd.service &>/dev/null || true
%else
/etc/init.d/httpd condrestart &>/dev/null || true
%endif
%endif
exit 0
%postun thruk
case "$*" in
0)
# POSTUN
rm -f %{_sysconfdir}/%{apachedir}/conf-enabled/naemon.conf
rm -f %{_sysconfdir}/%{name}/conf.d/thruk_templates.cfg
;;
1)
# POSTUPDATE
;;
*) echo case "$*" not handled in postun
esac
exit 0
%files
%files thruk
%config(noreplace) %{_sysconfdir}/%{apachedir}/conf.d/naemon.conf
%attr(-,root,root) %{_datadir}/%{name}/naemon-thruk.include
%config(noreplace) %{_sysconfdir}/thruk/thruk_local.d/naemon.conf
%if 0%{?suse_version} >= 1315
%attr(-,-,-) %dir %{_sysconfdir}/thruk/
%attr(-,-,-) %dir %{_sysconfdir}/thruk/thruk_local.d/
%endif
%changelog
* Wed Feb 14 2024 Will Haines <william.haines@colorado.edu>
- Fork for CU Boulder
* Fri Nov 05 2021 Sven Nierlein <sven.nierlein@consol.de> 1.3.0-1
- Add vimvault module
* Tue Sep 19 2017 Sven Nierlein <sven.nierlein@consol.de> 1.0.7-1
- Decouple core and livestatus
* Sun Jun 21 2015 Sven Nierlein <sven.nierlein@consol.de> 1.0.4-1
- Decouple thruk and replace with metapackage
* Sun Feb 23 2014 Daniel Wittenberg <dwittenberg2008@gmail.com> 0.8.0-2
- Add native and full systemctl control on el7
* Thu Feb 06 2014 Daniel Wittenberg <dwittenberg2008@gmail.com> 0.1.0-1
- Add reload for systemctl-based setups
* Thu Feb 06 2014 Sven Nierlein <sven.nierlein@consol.de> 0.1.0-1
- moved thruks reporting addon into seperate package
* Tue Nov 26 2013 Sven Nierlein <sven.nierlein@consol.de> 0.0.1-1
- initial naemon meta package