161 lines
5.9 KiB
RPMSpec
161 lines
5.9 KiB
RPMSpec
#
|
|
# spec file for package inGraph
|
|
#
|
|
# Copyright (c) 2012 mopp@gmx.net
|
|
#
|
|
# 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/
|
|
#
|
|
|
|
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
|
%if ! %{defined _fillupdir}
|
|
%define _fillupdir /var/adm/fillup-templates
|
|
%endif
|
|
|
|
Name: ingraph
|
|
Summary: NETWAYS inGraph Addon for Icinga
|
|
Version: 1.0.2
|
|
Release: 1
|
|
Url: https://github.com/NETWAYS/ingraph
|
|
License: GPL-3.0
|
|
Group: System/Monitoring
|
|
Source: %{name}-%{version}.tar.gz
|
|
Source1: ingraph.sysconfig
|
|
Source2: ingraph-collector.sysconfig
|
|
Source3: create-mysql-db.sh
|
|
Source4: INSTALL
|
|
Source5: %{name}-rpmlintrc
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
|
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
|
%else
|
|
BuildArch: noarch
|
|
%endif
|
|
|
|
#icinga-web >= 1.5.0 will work,but requires some additional patching
|
|
Requires: icinga-web >= 1.6.0
|
|
Requires: python >= 2.4.0
|
|
Requires: python-SQLAlchemy >= 0.6.0
|
|
Requires: python-mysql
|
|
Requires: php5-curl
|
|
Requires: php5-xmlrpc
|
|
Requires(pre): %fillup_prereq
|
|
Requires(pre): %insserv_prereq
|
|
BuildRequires: fdupes
|
|
BuildRequires: python-devel
|
|
BuildRequires: python-setuptools
|
|
|
|
%define apacheuser wwwrun
|
|
%define apachegroup www
|
|
%define icingawebdir /usr/share/icinga-web
|
|
%define clearcache /usr/share/icinga-web/bin/clearcache.sh
|
|
|
|
%description
|
|
Netways inGraph is a flexible, open source charting tool for Icinga and Nagios,
|
|
which collects performance data in a database and displays the results in a web
|
|
interface.
|
|
|
|
This package is optimized for Icinga-web and not the standalone version.
|
|
|
|
%prep
|
|
%setup -q
|
|
for file in $(find . -type f -name "*.py"); do
|
|
sed -i "s|/usr/bin/env python|%{_bindir}/python|g" "$file"
|
|
done
|
|
|
|
%build
|
|
|
|
%install
|
|
# Install backend
|
|
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
|
# Install sysconfig templates
|
|
%{__mkdir_p} %{buildroot}%{_localstatedir}/adm/fillup-templates/
|
|
install -D -m 644 %{SOURCE1} %{buildroot}%{_fillupdir}/sysconfig.ingraph
|
|
install -D -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.ingraph-collector
|
|
|
|
# Install db creation scripts
|
|
%{__mkdir_p} %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
|
install -D -m 755 %{SOURCE3} %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
|
|
|
# Install inGraph documentation and sample modifications for icinga
|
|
install -D -m 644 AUTHORS LICENSE README TODO %{SOURCE4} %{buildroot}/%{_defaultdocdir}/%{name}
|
|
install -D -m 755 contrib/icinga/add_perfdata_processing_commands.sh %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
|
install -D -m 755 contrib/icinga/enable_perfdata_processing.sh %{buildroot}%{_defaultdocdir}/%{name}/examples/
|
|
%{__mkdir_p} %{buildroot}%{_localstatedir}/lib/icinga/perfdata
|
|
|
|
# Install frontend for Icinga
|
|
%{__mkdir_p} %{buildroot}%{icingawebdir}/app/config
|
|
#Simulating an installed icinga version >= 1.6.n
|
|
cat << EOF > %{buildroot}%{icingawebdir}/app/config/icinga.xml
|
|
<setting name="version.major">1</setting>
|
|
<setting name="version.minor">6</setting>
|
|
EOF
|
|
cd icinga-web/
|
|
# To prevent copy and permission problems use the current user for installation.
|
|
# Permissions are corrected in the RPM
|
|
./setup-icinga-web.sh --install --prefix=%{buildroot}%{icingawebdir} --with-web-user=$(%{__id} -un) --with-web-group=$(%{__id} -gn)
|
|
rm %{buildroot}%{icingawebdir}/app/config/icinga.xml
|
|
|
|
%{__mkdir_p} %{buildroot}%{_sbindir} %{buildroot}%{_localstatedir}/log/ingraph
|
|
%{__ln_s} ../../%{_sysconfdir}/init.d/ingraph "%{buildroot}%{_sbindir}/rcingraph"
|
|
%{__ln_s} ../../%{_sysconfdir}/init.d/ingraph-collector "%{buildroot}%{_sbindir}/rcingraph-collector"
|
|
|
|
%fdupes %{buildroot}%{_prefix}
|
|
|
|
%pre
|
|
/usr/sbin/useradd -c 'inGraph User' -G icinga -s /sbin/nologin -r ingraph 2> /dev/null || :
|
|
|
|
%post
|
|
if [[ -x %{clearcache} ]]; then %{clearcache}; fi
|
|
%{fillup_and_insserv -n ingraph}
|
|
%{fillup_and_insserv -n ingraph-collector}
|
|
|
|
%preun
|
|
%stop_on_removal ingraph-collector
|
|
%stop_on_removal ingraph
|
|
|
|
%postun
|
|
if [[ -x %{clearcache} ]]; then %{clearcache}; fi
|
|
%restart_on_update ingraph-collector
|
|
%restart_on_update ingraph
|
|
%{insserv_cleanup}
|
|
|
|
%files
|
|
%defattr(-,root,root)
|
|
%{_sbindir}/rcingraph
|
|
%{_sbindir}/rcingraph-collector
|
|
%doc AUTHORS LICENSE README TODO
|
|
%doc %{_defaultdocdir}/%{name}/INSTALL
|
|
%attr(755,root,root) %{_defaultdocdir}/%{name}/examples/
|
|
%attr(0755,%{apacheuser},%{apachegroup}) %{_datadir}/icinga-web/app/modules/inGraph/config/views/
|
|
%attr(0755,%{apacheuser},%{apachegroup}) %{_datadir}/icinga-web/app/modules/inGraph/config/templates/
|
|
%{_datadir}/icinga-web/
|
|
%{_fillupdir}/sysconfig.ingraph*
|
|
%dir %{_sysconfdir}/ingraph
|
|
%config(noreplace) %{_sysconfdir}/ingraph/ingraph-aggregates.conf
|
|
%config(noreplace) %{_sysconfdir}/ingraph/ingraph-database.conf
|
|
%config(noreplace) %{_sysconfdir}/ingraph/ingraph-xmlrpc.conf
|
|
%attr(0755,root,root) %{_sysconfdir}/init.d/ingraph
|
|
%attr(0755,root,root) %{_sysconfdir}/init.d/ingraph-collector
|
|
%attr(0755,root,root) %{_bindir}/check_ingraph
|
|
%attr(0755,root,root) %{_bindir}/ingraph-collectord
|
|
%attr(0755,root,root) %{_bindir}/ingraphd
|
|
%{python_sitelib}/
|
|
%attr(0755,root,root) %{python_sitelib}/ingraph/bin/check_ingraph.py
|
|
%attr(0755,root,root) %{python_sitelib}/ingraph/bin/ingraph_collectord.py
|
|
%attr(0755,root,root) %{python_sitelib}/ingraph/bin/ingraphd.py
|
|
%dir %attr(0775,icinga,icinga) %{_localstatedir}/lib/icinga
|
|
%dir %attr(0775,icinga,icinga) %{_localstatedir}/lib/icinga/perfdata
|
|
%dir %attr(0775,icinga,icinga) %{_localstatedir}/log/ingraph
|
|
|
|
%changelog
|
|
|