You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
418 lines
13 KiB
418 lines
13 KiB
%define _rundir %{_localstatedir}/run |
|
%define _libexecdir %{_prefix}/lib/ |
|
%define plugindir %{_libdir}/nagios/plugins |
|
%define apachename httpd |
|
%define apacheconfdir %{_sysconfdir}/httpd/conf.d |
|
%define apacheuser apache |
|
%define apachegroup apache |
|
%define use_systemd 1 |
|
%define configure_systemd_limits 1 |
|
%define icinga_user icinga |
|
%define icinga_group icinga |
|
%define icingacmd_group icingacmd |
|
%define icingaweb2name icingaweb2 |
|
%define icingaweb2version 2.0.0 |
|
%define logmsg logger -t %{name}/rpm |
|
|
|
Summary: Network monitoring application |
|
Name: icinga2 |
|
Version: 2.11.9 |
|
Release: 1%{?dist} |
|
License: GPL-2.0+ |
|
URL: https://www.icinga.com/ |
|
Group: Applications/System |
|
Source: https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz |
|
Source1: icinga2.service.limits.conf |
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build |
|
Requires: %{name}-bin = %{version}-%{release} |
|
|
|
|
|
%description |
|
Meta package for Icinga 2 Core, DB IDO and Web. |
|
|
|
|
|
%package bin |
|
Summary: Icinga 2 binaries and libraries |
|
Group: Applications/System |
|
BuildRequires: libedit-devel |
|
BuildRequires: ncurses-devel |
|
BuildRequires: gcc-c++ |
|
BuildRequires: libstdc++-devel |
|
BuildRequires: openssl-devel |
|
BuildRequires: cmake |
|
BuildRequires: flex >= 2.5.35 |
|
BuildRequires: bison |
|
BuildRequires: make |
|
BuildRequires: boost-devel >= 1.48 |
|
BuildRequires: systemd |
|
Requires: systemd |
|
Requires: %{name}-libs = %{version}-%{release} |
|
%description bin |
|
Icinga 2 is a general-purpose network monitoring application. |
|
Provides binaries for Icinga 2 Core. |
|
|
|
|
|
%package common |
|
Summary: Common Icinga 2 configuration |
|
Group: Applications/System |
|
Requires(pre): shadow-utils |
|
Requires(post): shadow-utils |
|
Requires(pre): coreutils |
|
Requires(post): coreutils |
|
#BuildRequires: monitoring-plugins-common |
|
#Requires: monitoring-plugins-common |
|
%description common |
|
Provides common directories, uid and gid among Icinga 2 related |
|
packages. |
|
|
|
|
|
%package doc |
|
Summary: Documentation for Icinga 2 |
|
Group: Applications/System |
|
Requires: %{name} = %{version}-%{release} |
|
%description doc |
|
Provides documentation for Icinga 2. |
|
|
|
|
|
%package libs |
|
Summary: Libraries for Icinga 2 |
|
Group: Applications/System |
|
Requires: %{name}-common = %{version}-%{release} |
|
%description libs |
|
Provides internal libraries for the daemon or studio. |
|
|
|
|
|
%package ido-mysql |
|
Summary: IDO MySQL database backend for Icinga 2 |
|
Group: Applications/System |
|
BuildRequires: mysql-devel |
|
Requires: %{name} = %{version}-%{release} |
|
%description ido-mysql |
|
Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x |
|
IDOUtils schema >= 1.12 |
|
|
|
|
|
%package ido-pgsql |
|
Summary: IDO PostgreSQL database backend for Icinga 2 |
|
Group: Applications/System |
|
BuildRequires: postgresql-devel |
|
Requires: %{name} = %{version}-%{release} |
|
%description ido-pgsql |
|
Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x |
|
IDOUtils schema >= 1.12 |
|
|
|
%global selinux_variants mls targeted |
|
%{!?_selinux_policy_version: %global _selinux_policy_version %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2>/dev/null)} |
|
%global modulename %{name} |
|
%package selinux |
|
Summary: SELinux policy module supporting icinga2 |
|
Group: System Environment/Base |
|
BuildRequires: checkpolicy, selinux-policy-devel, /usr/share/selinux/devel/policyhelp, hardlink |
|
Requires: selinux-policy >= %{_selinux_policy_version} |
|
Requires: %{name} = %{version}-%{release} |
|
Requires(post): policycoreutils-python |
|
Requires(postun): policycoreutils-python |
|
%description selinux |
|
SELinux policy module supporting icinga2 |
|
|
|
|
|
%package -n vim-icinga2 |
|
Summary: Vim syntax highlighting for icinga2 |
|
Group: Applications/System |
|
%if "%{_vendor}" == "suse" |
|
BuildRequires: vim |
|
Requires: vim |
|
%else |
|
Requires: vim-filesystem |
|
%endif |
|
%description -n vim-icinga2 |
|
Vim syntax highlighting for icinga2 |
|
|
|
|
|
%package -n nano-icinga2 |
|
Summary: Nano syntax highlighting for icinga2 |
|
Group: Applications/System |
|
Requires: nano |
|
%description -n nano-icinga2 |
|
Nano syntax highlighting for icinga2 |
|
|
|
|
|
%prep |
|
%setup -q -n %{name}-%{version} |
|
|
|
%build |
|
CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \ |
|
-DCMAKE_INSTALL_SYSCONFDIR=/etc \ |
|
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \ |
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
|
-DICINGA2_LTO_BUILD=ON \ |
|
-DCMAKE_VERBOSE_MAKEFILE=ON \ |
|
-DBoost_NO_BOOST_CMAKE=ON \ |
|
-DBoost_NO_SYSTEM_PATHS=TRUE \ |
|
-DBOOST_LIBRARYDIR=/usr/lib64/boost169 \ |
|
-DBOOST_INCLUDEDIR=/usr/include/boost169 \ |
|
-DBoost_ADDITIONAL_VERSIONS='1.69;1.69.0' \ |
|
-DICINGA2_PLUGINDIR=%{plugindir} \ |
|
-DICINGA2_RUNDIR=%{_rundir} \ |
|
-DICINGA2_USER=%{icinga_user} \ |
|
-DICINGA2_GROUP=%{icinga_group} \ |
|
-DICINGA2_COMMAND_GROUP=%{icingacmd_group} \ |
|
-DBUILD_TESTING=FALSE \ |
|
-DUSE_SYSTEMD=ON \ |
|
-DICINGA2_WITH_LIVESTATUS=ON \ |
|
-DICINGA2_WITH_NOTIFICATION=ON \ |
|
-DICINGA2_WITH_PERFDATA=ON \ |
|
-DICINGA2_WITH_MYSQL=ON \ |
|
-DICINGA2_WITH_PGSQL=ON" |
|
|
|
#-DICINGA2_SYSCONFIGFILE=%{_sysconfigdir}/%{name} \ |
|
|
|
cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" . |
|
|
|
make %{?_smp_mflags} |
|
|
|
cd tools/selinux |
|
for selinuxvariant in %{selinux_variants} |
|
do |
|
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile |
|
mv %{modulename}.pp %{modulename}.pp.${selinuxvariant} |
|
make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean |
|
done |
|
cd - |
|
|
|
%install |
|
make install \ |
|
DESTDIR="%{buildroot}" |
|
|
|
install -D -m 0644 %{SOURCE1} %{buildroot}/etc/systemd/system/%{name}.service.d/limits.conf |
|
|
|
# remove features-enabled symlinks |
|
rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf |
|
|
|
cd tools/selinux |
|
for selinuxvariant in %{selinux_variants} |
|
do |
|
install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} |
|
install -p -m 644 %{modulename}.pp.${selinuxvariant} \ |
|
%{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp |
|
done |
|
|
|
# TODO: Fix build problems on Icinga, see https://github.com/Icinga/puppet-icinga_build/issues/11 |
|
#/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux |
|
|
|
#install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/%{name}.vim |
|
#install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/%{name}.vim |
|
|
|
#install -D -m 0644 tools/syntax/nano/%{name}.nanorc %{buildroot}%{_datadir}/nano/%{name}.nanorc |
|
|
|
|
|
%clean |
|
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot} |
|
|
|
|
|
%pre common |
|
getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group} |
|
getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group} |
|
getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} |
|
|
|
|
|
%post common |
|
%systemd_post %{name}.service |
|
if [ ${1:-0} -eq 1 ] |
|
then |
|
# initial installation, enable default features |
|
for feature in checker notification mainlog; do |
|
ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf |
|
done |
|
fi |
|
exit 0 |
|
|
|
|
|
%postun common |
|
%systemd_postun_with_restart %{name}.service |
|
if [ "$1" = "0" ]; then |
|
# deinstallation of the package - remove enabled features |
|
rm -rf %{_sysconfdir}/%{name}/features-enabled |
|
fi |
|
exit 0 |
|
|
|
%preun common |
|
%systemd_preun %{name}.service |
|
exit 0 |
|
|
|
|
|
%post ido-mysql |
|
if [ ${1:-0} -eq 1 ] |
|
then |
|
# initial installation, enable ido-mysql feature |
|
ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf |
|
fi |
|
exit 0 |
|
|
|
%postun ido-mysql |
|
if [ "$1" = "0" ]; then |
|
# deinstallation of the package - remove feature |
|
rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf |
|
fi |
|
exit 0 |
|
|
|
%post ido-pgsql |
|
if [ ${1:-0} -eq 1 ] |
|
then |
|
# initial installation, enable ido-pgsql feature |
|
ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf |
|
fi |
|
exit 0 |
|
|
|
%postun ido-pgsql |
|
if [ "$1" = "0" ]; then |
|
# deinstallation of the package - remove feature |
|
rm -f %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf |
|
fi |
|
exit 0 |
|
|
|
%post selinux |
|
for selinuxvariant in %{selinux_variants} |
|
do |
|
/usr/sbin/semodule -s ${selinuxvariant} -i \ |
|
%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || : |
|
done |
|
/sbin/fixfiles -R icinga2-bin restore &> /dev/null || : |
|
/sbin/fixfiles -R icinga2-common restore &> /dev/null || : |
|
/sbin/semanage port -a -t icinga2_port_t -p tcp 5665 &> /dev/null || : |
|
|
|
|
|
%postun selinux |
|
if [ $1 -eq 0 ] ; then |
|
/sbin/semanage port -d -t icinga2_port_t -p tcp 5665 &> /dev/null || : |
|
for selinuxvariant in %{selinux_variants} |
|
do |
|
/usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || : |
|
done |
|
/sbin/fixfiles -R icinga2-bin restore &> /dev/null || : |
|
/sbin/fixfiles -R icinga2-common restore &> /dev/null || : |
|
fi |
|
|
|
|
|
%files |
|
%defattr(-,root,root,-) |
|
%doc COPYING |
|
|
|
|
|
%files bin |
|
%defattr(-,root,root,-) |
|
%doc COPYING README.md NEWS AUTHORS CHANGELOG.md |
|
%{_sbindir}/%{name} |
|
%dir %{_libdir}/%{name}/sbin |
|
%{_libdir}/%{name}/sbin/%{name} |
|
%{plugindir}/check_nscp_api |
|
%{_datadir}/%{name} |
|
%exclude %{_datadir}/%{name}/include |
|
%{_mandir}/man8/%{name}.8.gz |
|
|
|
%attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name} |
|
%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name} |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/crash |
|
%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat |
|
%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat/archives |
|
%attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name} |
|
|
|
%attr(0750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name} |
|
%attr(2750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}/cmd |
|
|
|
|
|
%files libs |
|
%defattr(-,root,root,-) |
|
%doc COPYING README.md NEWS AUTHORS CHANGELOG.md |
|
%exclude %{_libdir}/%{name}/libdb_ido_mysql* |
|
%exclude %{_libdir}/%{name}/libdb_ido_pgsql* |
|
%dir %{_libdir}/%{name} |
|
%{_libdir}/%{name}/*.so* |
|
|
|
|
|
%files common |
|
%defattr(-,root,root,-) |
|
%doc COPYING README.md NEWS AUTHORS CHANGELOG.md tools/syntax |
|
%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name} |
|
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
|
%{_sysconfdir}/bash_completion.d/%{name} |
|
%if 0%{?use_systemd} |
|
%attr(644,root,root) %{_unitdir}/%{name}.service |
|
%if 0%{?configure_systemd_limits} |
|
%attr(644,root,root) /etc/systemd/system/%{name}.service.d/limits.conf |
|
%endif |
|
%else |
|
%attr(755,root,root) %{_sysconfdir}/init.d/%{name} |
|
%endif |
|
%if "%{_vendor}" == "suse" |
|
%{_sbindir}/rc%{name} |
|
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name} |
|
%else |
|
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
|
%endif |
|
%attr(0750,root,%{icinga_group}) %dir %{_sysconfdir}/%{name} |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available |
|
%exclude %{_sysconfdir}/%{name}/features-available/ido-*.conf |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf |
|
#%config(noreplace) %attr(0640,root,%{icinga_group}) %{_sysconfdir}/%{name}/init.conf |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/* |
|
%config(noreplace) %{_sysconfdir}/%{name}/scripts/* |
|
%dir %{_libexecdir}/%{name} |
|
%{_libexecdir}/%{name}/prepare-dirs |
|
%{_libexecdir}/%{name}/safe-reload |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name} |
|
%attr(0770,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp |
|
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include |
|
%{_datadir}/%{name}/include |
|
|
|
|
|
%files doc |
|
%defattr(-,root,root,-) |
|
%{_datadir}/doc/%{name} |
|
%docdir %{_datadir}/doc/%{name} |
|
|
|
|
|
%files ido-mysql |
|
%defattr(-,root,root,-) |
|
%doc COPYING README.md NEWS AUTHORS CHANGELOG.md |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-mysql.conf |
|
%{_libdir}/%{name}/libdb_ido_mysql* |
|
%{_datadir}/icinga2-ido-mysql |
|
|
|
|
|
%files ido-pgsql |
|
%defattr(-,root,root,-) |
|
%doc COPYING README.md NEWS AUTHORS CHANGELOG.md |
|
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-pgsql.conf |
|
%{_libdir}/%{name}/libdb_ido_pgsql* |
|
%{_datadir}/icinga2-ido-pgsql |
|
|
|
|
|
%files selinux |
|
%defattr(-,root,root,0755) |
|
%doc tools/selinux/* |
|
%{_datadir}/selinux/*/%{modulename}.pp |
|
|
|
|
|
%files -n vim-icinga2 |
|
%defattr(-,root,root,-) |
|
%{_datadir}/vim/vimfiles/syntax/%{name}.vim |
|
%{_datadir}/vim/vimfiles/ftdetect/%{name}.vim |
|
|
|
|
|
%files -n nano-icinga2 |
|
%defattr(-,root,root,-) |
|
%dir %{_datadir}/nano |
|
%{_datadir}/nano/%{name}.nanorc |
|
|
|
|
|
%changelog
|
|
|