%define _requires_exceptions pear(default.php)
Name: check-mk
Version: 1.2.2
Release: 6%{?dist}
Summary: A new general purpose Nagios-plugin for retrieving data
Group: Applications/Internet
License: GPLv2 and GPLv3
URL: http://mathias-kettner.de/check_mk
Source: http://mathias-kettner.de/download/check_mk-%{version}.tar.gz
Requires: nagios
Source1: First-Installation.txt
Source2: defaults
AutoReq: 0
# Do not provide from a documentation
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_docdir}/.*$
%description
check-mk is a general purpose Nagios-plugin for retrieving data. It adopts a
new approach for collecting data from operating systems and network components.
It obsoletes NRPE, check_by_ssh, NSClient, and check_snmp and it has many
benefits, the most important are a significant reduction of CPU usage on
the Nagios host and an automatic inventory of items to be checked on hosts.
%package agent
Summary: The check-mk's Agent
Requires: xinetd
Group: Applications/Internet
%description agent
This package contains the check-mk's agent. Install the following
agent on all the machines you plan to monitor with check-mk.
%package docs
Summary: The check-mk's documentation
Group: Applications/Internet
BuildArch: noarch
AutoReq: 0
%if 0%{?rhel}
AutoProv: 0
%endif
%description docs
This package contains the check-mk's documentation files.
%package livestatus
Summary: The check-mk's Livestatus
Group: Applications/Internet
Requires: check-mk
Requires: %{name}%{?_isa} = %{version}-%{release}
%description livestatus
This package contains livestatus.
%package multisite
Summary: The check-mk's Multisite
Group: Applications/Internet
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description multisite
This package contains multisite.
%prep
%setup -q -n check_mk-%{version}
tar xf agents.tar.gz
%build
rm -f waitmax
make waitmax
%install
# Agent's installation
install -d -m 755 %{buildroot}%{_sysconfdir}/xinetd.d
install -m 644 xinetd.conf %{buildroot}%{_sysconfdir}/xinetd.d/check-mk-agent
install -d -m 755 %{buildroot}%{_bindir}
install -m 755 check_mk_agent.linux %{buildroot}%{_bindir}/check_mk_agent
# Waitmax's binary
install -m 755 waitmax %{buildroot}%{_bindir}/waitmax
install -d -m 755 %{buildroot}%{_datadir}/check-mk-agent
install -d -m 755 %{buildroot}%{_datadir}/check-mk-agent/plugins
install -d -m 755 %{buildroot}%{_datadir}/check-mk-agent/local
install -m 644 plugins/mk_logwatch %{buildroot}%{_datadir}/check-mk-agent/plugins
install -m 644 plugins/j4p_performance %{buildroot}%{_datadir}/check-mk-agent/plugins
install -m 644 plugins/mk_oracle %{buildroot}%{_datadir}/check-mk-agent/plugins
install -m 644 plugins/sylo %{buildroot}%{_datadir}/check-mk-agent/plugins
install -d -m 755 %{buildroot}%{_sysconfdir}/check-mk-agent
install -m 644 logwatch.cfg %{buildroot}%{_sysconfdir}/check-mk-agent
perl -pi \
-e 's|LIBDIR="/to/be/changed"|LIBDIR="%{_datadir}/check-mk-agent"|;' \
-e 's|CONFDIR="/to/be/changed"|CONFDIR="%{_sysconfdir}/check-mk-agent"|;' \
%{buildroot}%{_bindir}/check_mk_agent
# Server, livestatus and other modules installation
DESTDIR=%{buildroot} ./setup.sh --yes
# Some needed tweaks to modify setup.sh's defaults.
# /etc/apache2/conf.d --> /etc/httpd/conf.d
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/
mv %{buildroot}%{_sysconfdir}/apache2/conf.d/zzz_check_mk.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/zzz_check_mk.conf
rm -rf %{buildroot}%{_sysconfdir}/apache2/
# Install the First-Installation.txt file
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/check_mk
# Make sure all the scripts into /usr/share/check_mk/* and /usr/share/check-mk-agent/* are executable.
for file in %{buildroot}%{_datadir}/check_mk/checks/* ; do
chmod -R a+x $file
done
for file in %{buildroot}%{_datadir}/check-mk-agent/plugins/* ; do
chmod a+x $file
done
# Fix a few more permissions
chmod a+x %{buildroot}%{_datadir}/check_mk/agents/hpux/hpux_statgrab
chmod a+x %{buildroot}%{_datadir}/check_mk/agents/hpux/hpux_lunstats
chmod a+x %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.openbsd
chmod a+x %{buildroot}%{_datadir}/check_mk/agents/plugins/db2_mem.sh
chmod a+x %{buildroot}%{_datadir}/check_mk/modules/snmp.py
chmod a+x %{buildroot}%{_datadir}/check_mk/modules/packaging.py
chmod a+x %{buildroot}%{_datadir}/check_mk/modules/agent_simulator.py
chmod a+x %{buildroot}%{_datadir}/check_mk/modules/notify.py
chmod a+x %{buildroot}%{_datadir}/check_mk/modules/automation.py
chmod a+x %{buildroot}%{_datadir}/check_mk/notifications/debug
# Web app files are not intended to be run, remove the shebang
# TODO: ask upstream to do the same
for file in `find %{buildroot}%{_datadir}/check_mk/web -name '*.py'`; do
sed -i '1{\@^#!/usr/bin/python@d}' $file
done
# Copy the check_mk_templates.cfg from the example file and remove the file installed
# on the /etc/nagios/objects directory.
mkdir -p %{buildroot}%{_sysconfdir}/nagios/conf.d/
cp -r %{buildroot}%{_datadir}/check_mk/check_mk_templates.cfg %{buildroot}%{_sysconfdir}/nagios/conf.d/check_mk_templates.cfg
rm -rf %{buildroot}%{_sysconfdir}/nagios/objects/check_mk_templates.cfg
# Fix the path for the Nagios plugins
sed -i 's|/usr/lib/nagios/plugins|%{_libdir}/nagios/plugins|' \
%{buildroot}%{_sysconfdir}/nagios/conf.d/check_mk_templates.cfg
# Remove the auto-generated defaults file and replace it with a customized version
rm -rf %{buildroot}%{_datadir}/check_mk/modules/defaults
install -m 644 %{SOURCE2} %{buildroot}%{_datadir}/check_mk/modules/
# Remove other operating systems agents, we definitely don't need them on this package.
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.aix
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.freebsd
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.hpux
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.macosx
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.netbsd
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.openbsd
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.openvms
rm -rf %{buildroot}%{_datadir}/check_mk/agents/check_mk_agent.solaris
# Remove Windows files.
rm -rf %{buildroot}%{_docdir}/check_mk/windows/
rm -rf %{buildroot}%{_datadir}/check_mk/agents/windows/
# Remove waitmax and its leftarounds from the wrong directory, the binary is being
# built and installed into the check-mk-agent's package already.
rm %{buildroot}%{_datadir}/check_mk/agents/waitmax
rm %{buildroot}%{_datadir}/check_mk/agents/waitmax.c
# Remove the packages directory.
rm -rf %{buildroot}%{_localstatedir}/lib/check_mk/packages/
# Fix for 64-bit arches
%if %{_lib} == lib64
mkdir -p %{buildroot}%{_prefix}/lib64/check_mk
mv %{buildroot}%{_prefix}/lib/check_mk/livecheck %{buildroot}%{_prefix}/lib64/check_mk/
mv %{buildroot}%{_prefix}/lib/check_mk/livestatus.o %{buildroot}%{_prefix}/lib64/check_mk/
rmdir %{buildroot}%{_prefix}/lib/check_mk
%endif
%files
%{_bindir}/cmk
%{_bindir}/mkp
%{_bindir}/check_mk
%config(noreplace) %{_sysconfdir}/check_mk/main.mk
%config(noreplace) %{_sysconfdir}/check_mk/main.mk-1.2.2
%{_sysconfdir}/check_mk/First-Installation.txt
%{_sysconfdir}/check_mk/conf.d
%{_datadir}/check_mk/agents
%{_datadir}/check_mk/modules
%{_datadir}/check_mk/checks
%{_datadir}/check_mk/pnp-templates
%{_datadir}/check_mk/notifications
%{_datadir}/check_mk/check_mk_templates.cfg
%config(noreplace) %{_sysconfdir}/httpd/conf.d/zzz_check_mk.conf
%config(noreplace) %{_sysconfdir}/nagios/conf.d/check_mk_templates.cfg
%attr(755, nagios, nagios) %{_localstatedir}/lib/check_mk/*
%doc COPYING ChangeLog AUTHORS
%files agent
%{_bindir}/check_mk_agent
%{_bindir}/waitmax
%{_datadir}/check-mk-agent
%config(noreplace) %{_sysconfdir}/xinetd.d/check-mk-agent
%config(noreplace) %{_sysconfdir}/check-mk-agent
%doc COPYING
%files docs
%doc %{_docdir}/check_mk
%files multisite
%{_datadir}/check_mk/web
%config(noreplace) %{_sysconfdir}/check_mk/multisite.mk
%config(noreplace) %{_sysconfdir}/check_mk/multisite.mk-1.2.2
%{_sysconfdir}/check_mk/multisite.d
%files livestatus
%{_bindir}/unixcat
%{_libdir}/check_mk
%changelog
* Thu Aug 29 2013 Andrea Veri <averi@fedoraproject.org> - 1.2.2-6
- Make sure the waitmax binary gets built. Also thanks to John Reddy
for his initial work on this. (BZ: #982769)
- Add an if statement for RHEL and make sure auto provides are not set
automatically. (BZ #985285)
* Fri Aug 02 2013 Petr Pisar <ppisar@redhat.com> - 1.2.2-5
- Do not provide from a documentation
* Sun Apr 28 2013 Andrea Veri <averi@fedoraproject.org> 1.2.2-5%{?dist}
- Make sure the Nagios library path on the check_mk_templates.cfg file
is correct on both x86_64 and i686 systems.
* Sat Apr 27 2013 Andrea Veri <averi@fedoraproject.org> 1.2.2-4%{?dist}
- Change check-mk-agent's binary name to check_mk_agent to match xinetd's file. (BZ: #956489)
- Remove other operating systems agents, we definitely don't need them on this package.
- Make sure that check_mk_templates gets shipped into /etc/nagios/conf.d. (BZ: #956492)
- Don't ship the auto-generated defaults file, but provide it with our customizations. This actually
fixes BZ: #956496 since we modify the checkresults path to be the same as the one provided
by Nagios itself, thus no need to create an additional directory.
* Fri Apr 12 2013 Dan HorĂ¡k <dan[at]danny.cz> - 1.2.2-3
- fix for 64-bit arches
* Wed Apr 10 2013 Andrea Veri <averi@fedoraproject.org> 1.2.2-2%{?dist}
- Remove the extra % on the Requires field for multisite.
* Tue Apr 09 2013 Andrea Veri <averi@fedoraproject.org> 1.2.2-1%{?dist}
- New upstream release.
- Added a depends on Nagios.
- Start shipping the docs, multisite, livestatus packages.
- Make sure the check_mk_templates.cfg file gets installed on the relevant
Nagios directory.
- Add the missing licenses.
- Switch package name to check-mk.
- Livestatus build has been fixed, switch the build/install system to use
upstream's setup.sh.
- Include an handy First-Installation.txt file with instructions about what
steps you should follow right after installing the check-mk's package.
* Fri Apr 05 2013 Andrea Veri <averi@fedoraproject.org> 1.2.0p4-1%{?dist}
- First package release.