File shinken.spec of Package shinken
#
# spec file for package shinken
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
Name: shinken
Version: 1.4.1
Release: 0
License: AGPL-3.0+
Summary: Distributed Monitoring Solution
Url: http://www.shinken-monitoring.org
Group: System/Monitoring
Source0: %{name}-%{version}.tar.bz2
Source1: %{name}-rpmlintrc
Patch1: shinken-1.4-init_scripts.patch
BuildRequires: python-setuptools
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
Requires: python >= 2.6
Requires: %{name}-common = %{version}
Requires(pre): %insserv_prereq
%if 0%{?suse_version}
%if 0%{?suse_version} <= 1220
Requires(pre): pwdutils
%else
Requires(pre): shadow
%endif
%else
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
Requires(pre): shadow-utils
%endif
%endif
%if 0%?suse_version >= 1010
Recommends: %{name}-arbiter = %{version}
Recommends: %{name}-broker = %{version}
Recommends: %{name}-poller = %{version}
Recommends: %{name}-reactioner = %{version}
Recommends: %{name}-scheduler = %{version}
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Shinken is a new Monitoring Tool, allowing distributed monitoring.
Each component can run standalone on a dedicated machine and is independent
from the rest of the monitoring system. As result it's not a problem if
parts of the monitoring system hang or are down. As part of HA funtionality,
it's possible to configure a hot failover in a larger setup.
%package common
Summary: Common files for shinken packages
Group: System/Monitoring
%description common
Shinken is a new Monitoring Tool, allowing distributed monitoring.
This package provides files used/needed by all shinken (sub-)packages.
%package arbiter
Summary: The arbiter
Group: System/Monitoring
Requires: %{name}-common = %{version}
Requires: python >= 2.6
%description arbiter
* reads the configuration and checks them for errors.
* creates python objects and sends them to the scheduler
* checks continuously all processes
* splits up the configuration and deploys them to the dedicated schedulers
* reads the command pipe and sends commands to the right scheduler
%package scheduler
Summary: Shinken scheduler
Group: System/Monitoring
Requires: %{name}-common = %{version}
Requires: python >= 2.6
%description scheduler
* decides about host and service check times
* handles dependencies between hosts and services
* handles check results
* checks freshness of checks
+ creates 'Broks' (Log, Statusupdate) for the broker(s)
%package poller
Summary: Shinken poller
Group: System/Monitoring
Requires: %{name}-common = %{version}
Requires: python >= 2.6
%description poller
* Starts the worker processes (recommendation: same as CPUs)
* splits up the todos onto the different workers
* worker(s) handle the processes and checks their results
* worker(s) return the results to the poller
%package reactionner
Summary: Shinken reactioner
Group: System/Monitoring
Requires: %{name}-common = %{version}
Requires: python >= 2.6
%description reactionner
Same behaviour as poller - but used for eventhandlers.
%package broker
Summary: Shinken broker
Group: System/Monitoring
Requires: %{name}-common = %{version}
Requires: python >= 2.6
%description broker
The replacement for Nagios Event Brokers. Is also responsible for
Logging.
Handles modules for different types of usage:
* Logging
* status.dat
* Livestatus
* NDO (MySQL and Oracle)
* Merlin (MySQL adn SQLite)
* ...
%package webui
Summary: Shinken WebUI
Group: System/Monitoring
Requires: %{name} = %{version}
%description webui
The WebUI for Shinken, a new Monitoring Tool, allowing distributed monitoring.
%prep
%setup -q
%patch1 -p1
%build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --install-scripts=%{_bindir}
mkdir -p %{buildroot}%{_localstatedir}/log/shinken
mkdir -p %{buildroot}%{_sbindir}
%if 0%{?suse_version}
%fdupes %{buildroot}%{python_sitelib}
%endif
# create SUSE rc-Symlinks
pushd %{buildroot}%{_sysconfdir}/init.d
for i in *; do
ln -s %{_sysconfdir}/init.d/$i %{buildroot}%{_sbindir}/rc$i
done
popd
# create links instead of copies
pushd %{buildroot}%{_bindir}
for i in *.py ; do
if [ -f ${i/.py/} ]; then
rm ${i/.py/}
ln -s $i ${i/.py/}
fi
done
popd
# fix x-bit files
find %{buildroot}%{python_sitelib} -name "*.svg" -exec chmod -x {} \;
find %{buildroot}%{python_sitelib} -name "*.css" -exec chmod -x {} \;
find %{buildroot}%{python_sitelib} -name "*.py" -exec chmod +x {} \;
%pre common
/usr/bin/getent group shinken || /usr/sbin/groupadd -r shinken
/usr/bin/getent passwd shinken || /usr/sbin/useradd -r -d /var/run/shinken -s /bin/false shinken
%preun
%stop_on_removal %{name}-receiver
%stop_on_removal %{name}-skonf
%preun common
%stop_on_removal shinken
%preun arbiter
%stop_on_removal %{name}-arbiter
%preun broker
%stop_on_removal %{name}-broker
%preun poller
%stop_on_removal %{name}-poller
%preun reactionner
%stop_on_removal %{name}-reactionner
%preun scheduler
%stop_on_removal %{name}-scheduler
%postun
%insserv_cleanup
%restart_on_update %{name}-receiver
%restart_on_update %{name}-skonf
%postun common
%insserv_cleanup
%restart_on_update shinken
%postun arbiter
%insserv_cleanup
%restart_on_update %{name}-arbiter
%postun broker
%insserv_cleanup
%restart_on_update %{name}-broker
%postun poller
%insserv_cleanup
%restart_on_update %{name}-poller
%postun reactionner
%insserv_cleanup
%restart_on_update %{name}-reactionner
%postun scheduler
%insserv_cleanup
%restart_on_update %{name}-scheduler
%files
%defattr(-,root,root)
%doc COPYING README.rst THANKS
%dir %{_sysconfdir}/shinken
%dir %{_localstatedir}/log/shinken
%config(noreplace) %{_sysconfdir}/default/%{name}
%config(noreplace) %{_sysconfdir}/shinken/*
%{_sysconfdir}/init.d/shinken-receiver
%{_sysconfdir}/init.d/shinken-skonf
%{_sbindir}/rcshinken-receiver
%{_sbindir}/rcshinken-skonf
%{_bindir}/*
%files common
%defattr(-,root,root)
%config %{_sysconfdir}/init.d/shinken
%{_sbindir}/rc%{name}
%{python_sitelib}/*
%exclude %{python_sitelib}/%{name}/webui
%files arbiter
%defattr(-,root,root)
%{_sysconfdir}/init.d/shinken-arbiter
%{_sbindir}/rcshinken-arbiter
%files broker
%defattr(-,root,root)
%{_sysconfdir}/init.d/shinken-broker
%{_sbindir}/rcshinken-broker
%files poller
%defattr(-,root,root)
%{_sysconfdir}/init.d/shinken-poller
%{_sbindir}/rcshinken-poller
%files reactionner
%defattr(-,root,root)
%{_sysconfdir}/init.d/shinken-reactionner
%{_sbindir}/rcshinken-reactionner
%files scheduler
%defattr(-,root,root)
%{_sysconfdir}/init.d/shinken-scheduler
%{_sbindir}/rcshinken-scheduler
%files webui
%defattr(-,root,root)
%dir %{python_sitelib}/%{name}/webui
%{python_sitelib}/%{name}/webui/*
%changelog