%define name centreon %define version 2.0 %define release %mkrel 4 %define _requires_exceptions pear(\\(/var/www/CAS/CAS.php\\|install.conf.php\\|/etc/centreon/centreon.conf.php\\)) Name: %{name} Version: %{version} Release: %{release} Summary: Nagios web interface License: GPL Group: Networking/WWW URL: http://www.centreon.com Source0: http://download.centreon.com/%{name}-%{version}.tar.gz Source1: centstorage.init Source2: centcore.init Patch0: centreon-2.0-fix-includes.patch Patch1: centreon-2.0-better-installation-procedure.patch Patch2: centreon-2.0-fhs.patch Patch3: centreon-2.0-use-system-smarty.patch Patch4: centreon-2.0-add-php-shebang.patch Requires: nagios Requires: apache-mod_php Requires: php-mysql Requires: php-gd Requires: php-xml Requires: php-snmp Requires: php-ldap Requires: php-pear Requires: php-smarty >= 2.6.25-4mdv2010.0 Requires: php-pear-DB_DataObject Requires: php-pear-DB_DataObject_FormBuilder Requires: php-pear-MDB2 Requires: php-pear-Date Requires: php-pear-HTML_Common Requires: php-pear-HTML_QuickForm Requires: php-pear-HTML_QuickForm_advmultiselect Requires: php-pear-HTML_Table Requires: php-pear(Archive/Tar.php) Requires: php-pear(Auth/SASL.php) Requires: php-pear(Console/Getopt.php) Requires: php-pear-Image_GraphViz Requires: php-pear-Net_SMTP Requires: php-pear-Net_Socket Requires: php-pear-Net_Traceroute Requires: php-pear-Net_Ping Requires: php-pear-Validate Requires: php-pear-XML_RPC Requires: php-pear-SOAP Requires: php-pear-Log Requires: perl-rrdtool %if %mdkversion < 201010 Requires(postun): rpm-helper %endif Requires(post): rpm-helper Requires(preun): rpm-helper BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version} %description It is powerful thanks to the famous Nagios core and yet so easy to install. Keep an eye on your IT with clear and complete graphs. Get notified before problems start arising and let Centreon/Nagios deal with them, you can finally leave all the work to a reliable solution. %package snmp Summary: SNMP traps for %{name} Group: Networking/WWW Requires: net-snmp Requires: %{name} = %{version}-%{release} %description snmp This package contains SNMP traps for %{name}. %package plugins Summary: Nagios plugins for %{name} Group: Networking/WWW Requires: %{name} = %{version}-%{release} %description plugins This package contains Nagios plugins for %{name}. %prep %setup -q %patch0 -p 1 %patch1 -p 1 %patch2 -p 1 %patch3 -p 1 %patch4 -p 1 %install rm -rf %{buildroot} install -d -m 755 %{buildroot}%{_datadir}/%{name} install -d -m 755 %{buildroot}%{_datadir}/%{name}/{bin,lib,class} install -d -m 755 %{buildroot}%{_datadir}/%{name}/cron/ods install -d -m 755 %{buildroot}%{_datadir}/%{name}/sql/{setup,upgrade} install -m 755 bin/* %{buildroot}%{_datadir}/%{name}/bin install -m 644 lib/* %{buildroot}%{_datadir}/%{name}/lib install -m 644 www/class/* %{buildroot}%{_datadir}/%{name}/class install -m 755 cron/archiveDayLog %{buildroot}%{_datadir}/%{name}/cron install -m 755 cron/centAcl.php %{buildroot}%{_datadir}/%{name}/cron install -m 755 cron/ods/buildDailyReport.php %{buildroot}%{_datadir}/%{name}/cron/ods cp -r www %{buildroot}%{_datadir}/%{name} install -m 644 www/install/*.sql %{buildroot}%{_datadir}/%{name}/sql/setup install -m 644 www/install/sql/*.sql %{buildroot}%{_datadir}/%{name}/sql/upgrade find %{buildroot}%{_datadir}/%{name}/www/install -name *.sql | xargs rm -f rm -rf %{buildroot}%{_datadir}/%{name}/www/class cp -r doc %{buildroot}%{_datadir}/%{name} install -d -m 755 %{buildroot}%{_datadir}/%{name}/modules install -d -m 755 %{buildroot}%{_datadir}/%{name}/img/media sed -i \ -e 's|@BIN_MAIL@|/bin/mail|g' \ -e 's|@BIN_RRDTOOL@|%{_bindir}/rrdtool|g' \ -e 's|@CENTSTORAGE_RRD@|%{_var}/lib/centreon|g' \ -e 's|@INIT_D@|%{_initrddir}|g' \ -e 's|@INSTALL_DIR_CENTREON@|%{_datadir}/centreon|g' \ -e 's|@INSTALL_DIR_NAGIOS@|%{_libdir}/nagios|g' \ -e 's|@NAGIOS_VAR@|%{_var}/log/nagios|g' \ -e 's|@NAGIOS_BINARY@|%{_sbindir}/nagios|g' \ -e 's|@NAGIOSTATS_BINARY@|%{_sbindir}/nagiostats|g' \ -e 's|@NAGIOS_IMG@|%{_datadir}/nagios/images/logos|g' \ -e 's|@NAGIOS_USER@|nagios|g' \ -e 's|@NAGIOS_GROUP@|nagios|g' \ -e 's|@NAGIOS_ETC@|%{_sysconfdir}/nagios|g' \ -e 's|@NAGIOS_PLUGIN@|%{_datadir}/nagios/plugins|g' \ -e 's|@NAGIOS_BIN@|%{_sbindir}/nagios|g' \ -e 's|@NAGIOS_INIT_SCRIPT@|%{_initrddir}/nagios|g' \ -e 's|@RRDTOOL_PERL_LIB@|%{perl_vendorarch}|g' \ -e 's|@NDOMOD_BINARY@|%{_libdir}/nagios/brokers/ndomod.o|g' \ -e 's|@P1_PL@|'"$NAGIOS_P1_FILE"'|g' \ %{buildroot}%{_datadir}/%{name}/sql/setup/*.sql \ %{buildroot}%{_datadir}/%{name}/sql/upgrade/*.sql sed -i \ -e 's|@CENTREON_PATH@|%{_datadir}/%{name}|g' \ -e 's|@CENTREON_DIR@|%{_datadir}/%{name}|g' \ -e 's|@CENTREON_LOG@|%{_var}/log/centreon|g' \ -e 's|@CENTREON_RUNDIR@|%{_var}/run/centreon|g' \ -e 's|@CENTREON_VARLIB@|%{_var}/lib/centreon|g' \ -e 's|@CENTREON_ETC@|%{_sysconfdir}/centreon|g' \ -e 's|@CENTSTORAGE_LIB@|%{_var}/lib/centreon|g' \ -e 's|@RRD_PERL@|%{perl_vendorarch}|g' \ -e 's|@NAGIOS_USER@|nagios|g' \ -e 's|@NAGIOS_GROUP@|nagios|g' \ %{buildroot}%{_datadir}/%{name}/bin/* \ %{buildroot}%{_datadir}/%{name}/cron/archiveDayLog \ %{buildroot}%{_datadir}/%{name}/cron/centAcl.php find %{buildroot}%{_datadir}/%{name}/www -name *.php | xargs sed -i \ -e 's|@CENTREON_PATH@|%{_datadir}/%{name}|g' \ -e 's|@CENTREON_ETC@|%{_sysconfdir}/centreon|' \ -e 's|@CENTREON_GENDIR@|%{_var}/cache/centreon|' \ -e 's|@CENTPLUGINSTRAPS_BINDIR@|%{_datadir}/centreon/bin|g' \ -e 's|@CENTREON_VARLIB@|%{_var}/lib/centreon|g' \ install -d -m 755 %{buildroot}%{_sysconfdir}/snmp install -d -m 755 %{buildroot}%{_sysconfdir}/snmp/centreon_traps install -m 644 snmptrapd/*.conf %{buildroot}%{_sysconfdir}/snmp install -m 644 snmptt/snmptt.ini %{buildroot}%{_sysconfdir}/snmp install -m 755 snmptt/snmptt %{buildroot}%{_datadir}/centreon/bin install -m 755 snmptt/snmpttconvertmib %{buildroot}%{_datadir}/centreon/bin sed -i \ -e 's|@SNMPTT_BINDIR@|%{_datadir}/centreon/bin|g' \ -e 's|@SNMPTT_INI_FILE@|%{_sysconfdir}/snmp/snmptt.ini|g' \ %{buildroot}%{_sysconfdir}/snmp/snmptrapd.conf sed -i \ -e 's|@SNMP_ETC@/centreon_traps|%{_sysconfdir}/snmp/centreon_traps|g' \ %{buildroot}%{_sysconfdir}/snmp/snmptt.ini install -d -m 755 %{buildroot}%{_sysconfdir}/centreon install -d -m 755 %{buildroot}%{_datadir}/nagios/plugins install -m 644 plugins/src/centreon.conf %{buildroot}%{_sysconfdir}/centreon/plugins.conf install -m 644 plugins/src/centreon.pm %{buildroot}%{_datadir}/nagios/plugins install -m 755 plugins/src/check* %{buildroot}%{_datadir}/nagios/plugins install -m 755 plugins/src/submit* %{buildroot}%{_datadir}/nagios/plugins install -m 755 plugins/src/process* %{buildroot}%{_datadir}/nagios/plugins sed -i \ -e 's|@NAGIOS_VAR@|%{_var}/log/nagios|g' \ -e 's|@INSTALL_DIR_CENTREON@|%{_datadir}/centreon|g' \ -e 's|@INSTALL_DIR_NAGIOS@|%{_libdir}/nagios|g' \ -e 's|@NAGIOS_ETC@|%{_sysconfdir}/nagios|g' \ -e 's|@CENTREON_ETC@|%{_sysconfdir}/centreon|g' \ -e 's|@NAGIOS_PLUGINS@|%{_datadir}/nagios/plugins|g' \ -e 's|@RRDTOOL_PERL_LIB@|%{perl_vendorarch}|g' \ -e 's|@CENTPLUGINS_TMP@|%{_var}/lib/centreon/centplugins|g' \ %{buildroot}%{_datadir}/nagios/plugins/* \ %{buildroot}%{_sysconfdir}/centreon/plugins.conf install -d -m 775 %{buildroot}%{_var}/log/centreon install -d -m 755 %{buildroot}%{_var}/lib/centreon install -d -m 755 %{buildroot}%{_var}/cache/centreon install -d -m 755 %{buildroot}%{_var}/cache/centreon/smarty install -d -m 755 %{buildroot}%{_var}/cache/centreon/smarty/{compile,config,cache} install -d -m 755 %{buildroot}%{_var}/cache/centreon/filesGeneration/nagiosCFG install -d -m 755 %{buildroot}%{_var}/cache/centreon/filesUpload/nagiosCFG pushd %{buildroot}%{_datadir}/%{name} ln -sf ../../..%{_var}/cache/centreon/filesGeneration . ln -sf ../../..%{_var}/cache/centreon/filesUpload . popd install -d -m 755 %{buildroot}%{_var}/run/centreon install -d -m 755 %{buildroot}%{_initrddir} install -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/centstorage install -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/centcore cat > %{buildroot}%{_datadir}/centreon/www/install/install.conf.php <<'EOF' <?php $conf_centreon['centreon_dir'] = "/usr/share/centreon/"; $conf_centreon['centreon_etc'] = "/etc/centreon/"; $conf_centreon['centreon_dir_www'] = "/usr/share/centreon/www/"; $conf_centreon['centreon_dir_rrd'] = "/usr/share/centreon/rrd/"; $conf_centreon['nagios'] = "/usr/lib64/nagios/"; $conf_centreon['nagios_conf'] = "/etc/nagios/"; $conf_centreon['nagios_plugins'] = "/usr/lib64/nagios/plugins/"; $conf_centreon['nagios_binary'] = "/usr/sbin/nagios"; $conf_centreon['nagiostats_binary'] = "/usr/sbin/nagiostats"; $conf_centreon['nagios_init_script'] = "/etc/init.d/nagios"; $conf_centreon['rrdtool_dir'] = "/usr/bin/rrdtool"; $conf_centreon['apache_user'] = "apache"; $conf_centreon['apache_group'] = "apache"; $conf_centreon['nagios_user'] = "nagios"; $conf_centreon['nagios_group'] = "nagios"; $conf_centreon['mail'] = "/bin/mail"; $conf_centreon['pear_dir'] = "/usr/share/pear"; $conf_centreon['log_file'] = "/var/log/nagios/nagios.log"; $conf_centreon['object_cache_file'] = "/var/log/nagios/objects.cache"; $conf_centreon['precached_object_file'] = "/var/log/nagios/objects.precache"; $conf_centreon['resource_file'] = "/etc/nagios/resource.cfg"; $conf_centreon['status_file'] = "/var/log/nagios/status.dat"; $conf_centreon['command_file'] = "/var/spool/nagios/nagios.cmd"; $conf_centreon['lock_file'] = "/var/run/nagios/nagios.pid"; $conf_centreon['temp_file'] = "/var/log/nagios/nagios.tmp"; $conf_centreon['max_check_result_file_age'] = "3600"; $conf_centreon['state_retention_file'] = "/var/log/nagios/retention.dat"; $conf_centreon['p1_file'] = "/usr/sbin/p1.pl"; $conf_centreon['debug_file'] = "/var/log/nagios/nagios.debug"; $conf_centreon['max_debug_file_size'] = "1000000"; $conf_centreon['temp_path'] = "/tmp"; $conf_centreon['log_archive_path'] = "/var/log/nagios/archives"; $conf_centreon['check_result_path'] = "/var/spool/nagios/checkresults"; $conf_centreon['physical_html_path'] = "/usr/share/nagios"; ?> EOF touch %{buildroot}%{_sysconfdir}/centreon/centreon.conf.php touch %{buildroot}%{_sysconfdir}/centreon/conf.pm install -d -m 755 %{buildroot}%{_sysconfdir}/cron.d cat > %{buildroot}%{_sysconfdir}/cron.d/centreon <<EOF # rewrite file with new cron line CRONTAB_EXEC_USER="" # Cron for log analyser - for reporting 0 1 1-31 * * nagios %{_datadir}/centreon/cron/archiveDayLog >> %{_var}/log/centreon/archiveDayLog.log 2>&1 # Cron for CentACL */2 * * * * nagios %{_datadir}/centreon/cron/centAcl.php >> %{_var}/log/centreon/centAcl.log 2>&1 EOF cat > %{buildroot}%{_sysconfdir}/cron.d/centstorage <<EOF # rewrite file with new cron line CRONTAB_EXEC_USER="" # Cron for log parser * * * * * nagios %{_datadir}/centreon/bin/logAnalyser >> %{_var}/log/centreon/logAnalyser.log 2>&1 # Cron for tracing Nagios Poller Performances */5 * * * * nagios %{_datadir}/centreon/bin/nagiosPerfTrace >> %{_var}/log/centreon/nagiosPerfTrace.log 2>&1 EOF # apache configuration install -d -m 755 %{buildroot}%{_webappconfdir} cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF # Centreon Apache configuration Alias /%{name} %{_datadir}/%{name}/www <Directory %{_datadir}/%{name}/www> Order allow,deny Allow from all </Directory> <Directory %{_datadir}/%{name}/www/install> Order allow,deny Allow from 127.0.0.1 </Directory> EOF cat > README.urpmi <<EOF Mandriva RPM specific notes setup ----- The installation procedure has been modified to not delete its own file after completion. Default apache configuration restrict access to installation pages from local host only. post-installation ----------------- Post-installation is handled from the web interface. EOF %clean rm -rf %{buildroot} %post %if %mdkversion < 201010 %_post_webapp %endif %_post_service centcore %_post_service centstorage %preun %_preun_service centcore %_preun_service centstorage %postun %if %mdkversion < 201010 %_postun_webapp %endif %files %defattr(-,root,root) %doc LICENSE CHANGELOG README README.urpmi %{_datadir}/%{name} %attr(-,nagios,nagios) %{_var}/lib/%{name} %attr(-,apache,apache) %{_var}/cache/%{name} %attr(-,nagios,nagios) %{_var}/run/%{name} %attr(-,nagios,apache) %{_var}/log/%{name} %{_initrddir}/* %config(noreplace) %{_webappconfdir}/%{name}.conf %dir %{_sysconfdir}/%{name} %attr(-,apache,apache) %config(noreplace) %{_sysconfdir}/%{name}/centreon.conf.php %attr(-,apache,apache) %config(noreplace) %{_sysconfdir}/%{name}/conf.pm %config(noreplace) %{_sysconfdir}/%{name}/*.conf %config(noreplace) %{_sysconfdir}/cron.d/* %exclude %{_sysconfdir}/%{name}/plugins.conf %exclude %{_datadir}/%{name}/bin/snmptt %exclude %{_datadir}/%{name}/bin/snmpttconvertmib %exclude %{_datadir}/%{name}/bin/centGenSnmpttConfFile %exclude %{_datadir}/%{name}/bin/centFillTrapDB %exclude %{_datadir}/%{name}/bin/centTrapHandler-2.x %files snmp %defattr(-,root,root) %{_datadir}/%{name}/bin/snmptt %{_datadir}/%{name}/bin/snmpttconvertmib %{_datadir}/%{name}/bin/centGenSnmpttConfFile %{_datadir}/%{name}/bin/centGenSnmpttConfFile %{_datadir}/%{name}/bin/centFillTrapDB %{_datadir}/%{name}/bin/centTrapHandler-2.x %config(noreplace) %{_sysconfdir}/snmp/*.conf %config(noreplace) %{_sysconfdir}/snmp/snmptt.ini %attr(-,apache,apache) %{_sysconfdir}/snmp/centreon_traps %files plugins %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/%{name}/plugins.conf %{_datadir}/nagios/plugins/* %changelog * Mon Mar 01 2010 Guillaume Rousse <guillomovitch@mandriva.org> 2.0-4mdv2010.1 + Revision: 513176 - rely on filetrigger for reloading apache configuration begining with 2010.1, rpm-helper macros otherwise * Mon Jul 20 2009 Guillaume Rousse <guillomovitch@mandriva.org> 2.0-4mdv2010.0 + Revision: 398206 - update for new smarty package * Sun Jul 19 2009 Guillaume Rousse <guillomovitch@mandriva.org> 2.0-3mdv2010.0 + Revision: 397980 - add missing smarty dependency * Thu Jul 16 2009 Guillaume Rousse <guillomovitch@mandriva.org> 2.0-2mdv2010.0 + Revision: 396500 - update FHS patch (should fix #52125) * Sun Dec 28 2008 Guillaume Rousse <guillomovitch@mandriva.org> 2.0-1mdv2009.1 + Revision: 320706 - final sync - import centreon * Wed Dec 17 2008 Guillaume Rousse <guillomovitch@mandriva.org> 2.0-1mdv2009.1 - first mdv release