%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear) %define real_version 2.0-RC8 Summary: Centreon, Network & System Monitoring Name: centreon Version: 2.0 Release: 0.1.rc8%{?dist} Source0: http://www.centreon.com/Download.html/%{name}-%{real_version}.tar.gz License: GPLv2 Group: Applications/System URL: http://www.centreon.com BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch Requires: php, php-cli, php-mysql, php-gd, httpd, Requires: perl-DBD-MySQL, perl-DBI, nagios, rrdtool, perl-rrdtool, php-rrdtool Requires: net-snmp, php-snmp, php-ldap, sudo Requires: php-pear Requires: php-pear-Archive-Tar, php-pear-Auth-SASL, php-pear-Console-Getopt Requires: php-pear-DB-DataObject-FormBuilder, php-pear-DB-DataObject Requires: php-pear-Date, php-pear-HTML-Common, php-pear-HTML-QuickForm Requires: php-pear-HTML-QuickForm-advmultiselect, php-pear-HTML-Table Requires: php-pear-HTTP, php-pear-Image-GraphViz, php-pear-Log, php-pear-MDB2 Requires: php-pear-Net-Ping, php-pear-Net-SMTP, php-pear-Net-Socket Requires: php-pear-Net-Traceroute, php-pear-SOAP, php-pear-Structures-Graph Requires: php-pear-Validate, php-pear-XML-RPC # Following php-pear modules are packaged, but not submitted yet. # php-pear-Archive-Tar # php-pear-Console-Getopt # php-pear-Structures-Graph # php-pear-XML-RPC.spec Requires: nagios # a private copy of snmptt is included in centreon and need to be removed. #Requires: snmptt (packaged, but not submitted yet) Requires(preun): /sbin/service, /sbin/chkconfig Requires(post): /sbin/chkconfig Requires(postun): /sbin/service # OCS2Cent needs to be in a separate package. # OCS2Cent 1.2 has been released. Source1: http://fantominus.titilambert.org/ocs2cent/OCS2Cent-1.0.tar.gz Source2: centreon-httpd.conf Source3: centreon-README.rpm Patch0: centreon-db.patch Patch1: centreon-conf.patch # GPL_LIB directory contains private copy of external projects : # AutoComplete --> # Color_Picker --> # Date_Picker --> # Smarty --> php-Smarty # SmartyCache --> empty ? %description Centreon is a network, system, applicative supervision and monitoring tool, it is based upon the most effective Open Source monitoring engine : Nagios. Centreon provides a new frontend and new functionnalities to Nagios. It allows you to be more efficient in your network monitoring, but also allows you to make your supervision information readable by a largest range of users. Indeed, a non technical user can now use the Centreon/Nagios couple to easily understand your network infrastructure thanks to charts and graphical representations of the gathered information. Skilled users still have access to specific and technical information collected by Nagios though. #%package database #Summary: Centreon database for Mysql #Group: Applications/System #Requires: mysql-server # #%description database #This package contains the centreon and centreon_storage for mysql server. %prep %setup -q -n %{name}-%{real_version} %patch0 -p1 %patch1 -p1 # Change macro find . -type f | xargs sed -i -e 's:@BIN_SCP@:/usr/bin/ssh:g' \ -e 's:@BIN_SSH@:/usr/bin/scp:g' \ -e 's:@CENTCORE_BINDIR@:/usr/share/centreon/bin:g' \ -e 's:@CENTPLUGINS_TMP@:/tmp:g' \ -e 's:@CENTREON_DIR@:/usr/share/centreon:g' \ -e 's:@CENTREON_ETC@:/etc/centreon:g' \ -e 's:@CENTREON_LOG@:/var/log/centreon:g' \ -e 's:@CENTREON_PATH@:/usr/share/centreon:g' \ -e 's:@CENTREON_RUNDIR@:/var/run/centreon:g' \ -e 's:@CENTREON_VARLIB@:/var/lib/centreon:g' \ -e 's:@CENTSTORAGE_BINDIR@:/usr/share/centreon/bin:g' \ -e 's:@CRONUSER@:nagios:g' \ -e 's:@INSTALL_DIR_CENTREON@:/usr/share/centreon:g' \ -e 's:@INSTALL_DIR_NAGIOS@:/usr/share/nagios:g' \ -e 's:@NAGIOS_ETC@:/etc/nagios:g' \ -e 's:@NAGIOS_PLUGINS@:/usr/lib/nagios/plugins:g' \ -e 's:@NAGIOS_USER@:nagios:g' \ -e 's:@NAGIOS_VAR@:/var/log/nagios:g' \ -e 's:@PHP_BIN@:i/usr/bin/php:g' \ -e 's:@RRD_PERL@:/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi:g' \ -e 's:@RRDTOOL_PERL_LIB@:/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi:g' \ -e 's:@SNMPTT_BINDIR@:/usr/bin:g' \ -e 's:@SNMP_ETC@:/etc/snmp/centreon_traps/:g' \ -e 's:@CENTSTORAGE_LIB@:/var/lib/centreon:g' \ -e 's:@CENTREON_GENDIR@:/usr/share/centreon:g' \ -e 's:@PERL_BIN@:/usr/bin/perl:g' # Don't start by default : sed -i -e 's/^# Default-Start:.*$/# Default-Start:/' \ -e 's/^# Default-Stop:.*$/# Default-Stop:/' \ tmpl/install/centcore.init.d sed -i -e 's/^# Default-Start:.*$/# Default-Start:/' \ -e 's/^# Default-Stop:.*$/# Default-Stop:/' \ tmpl/install/centstorage.init.d %build # Nothing to build %install %__rm -rf ${RPM_BUILD_ROOT}/ # Install files configuration %{__install} -d -m 0755 %buildroot%{_sysconfdir}/centreon %{__install} -m 0644 etc/centreon.conf.php %buildroot%{_sysconfdir}/centreon %{__install} -m 0644 etc/conf.pm %buildroot%{_sysconfdir}/centreon %{__install} -m 0644 etc/instCentCore.conf %buildroot%{_sysconfdir}/centreon %{__install} -m 0644 etc/instCentPlugins.conf %buildroot%{_sysconfdir}/centreon %{__install} -m 0644 etc/instCentStorage.conf %buildroot%{_sysconfdir}/centreon %{__install} -m 0644 etc/instCentWeb.conf %buildroot%{_sysconfdir}/centreon # Install cron %{__install} -d -m 0700 %buildroot%{_sysconfdir}/cron.d %{__install} -m 0755 tmpl/install/centreon.cron %buildroot%{_sysconfdir}/cron.d/centreon %{__install} -m 0755 tmpl/install/centstorage.cron %buildroot%{_sysconfdir}/cron.d/centstorage # Install conf apache %{__install} -d -m 0755 %buildroot%{_sysconfdir}/httpd/conf.d %{__install} -m 0644 %{SOURCE2} %buildroot%{_sysconfdir}/httpd/conf.d/centreon.conf # Install centcore and centstorage daemon %{__install} -d -m 0755 %buildroot%{_initrddir} %{__install} -m 0755 tmpl/install/centcore.init.d %buildroot%{_initrddir}/centcore %{__install} -m 0755 tmpl/install/centstorage.init.d %buildroot%{_initrddir}/centstorage # Install file configuration snmptrapd and snmp #%{__install} -d -m 0755 %buildroot%{_sysconfdir}/snmp #%__cp snmptrapd/snmptrapd.conf %buildroot%{_sysconfdir}/snmp/ #%__cp snmptrapd/snmp.conf %buildroot%{_sysconfdir}/snmp/ %{__install} -d -m 0755 %buildroot%{_sysconfdir}/snmp/centreon_traps %__cp plugins/src/traps/conf/snmptt.ini %buildroot%{_sysconfdir}/snmp/centreon_traps # Install centreon plugins and David perfdata %{__install} -d -m 0755 %buildroot%{_libdir}/nagios/plugins %{__install} -m 0755 plugins/src/centreon* %buildroot%{_libdir}/nagios/plugins %{__install} -m 0755 plugins/src/check* %buildroot%{_libdir}/nagios/plugins %{__install} -m 0755 plugins/src/process-service-perfdata %buildroot%{_libdir}/nagios/plugins %{__install} -m 0755 plugins/src/submit_{host,service}_check_result %buildroot%{_libdir}/nagios/plugins # Install datadir centreon %{__install} -d -m 0755 %buildroot%{_datadir}/centreon %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/bin %{__install} -m 0755 bin/centcore %buildroot%{_datadir}/centreon/bin/ %{__install} -m 0755 bin/centFillTrapDB %buildroot%{_datadir}/centreon/bin/ %{__install} -m 0755 bin/centGenSnmpttConfFile %buildroot%{_datadir}/centreon/bin/ %{__install} -m 0755 bin/centstorage %buildroot%{_datadir}/centreon/bin/ %{__install} -m 0755 bin/centTrapHandler-2.x %buildroot%{_datadir}/centreon/bin/ %{__install} -m 0755 bin/logAnalyser %buildroot%{_datadir}/centreon/bin/ %{__install} -m 0755 bin/nagiosPerfTrace %buildroot%{_datadir}/centreon/bin/ #%{__install} -m 0755 snmptt/snmptt %buildroot%{_datadir}/centreon/bin/ #%{__install} -m 0755 snmptt/snmpttconvertmib %buildroot%{_datadir}/centreon/bin/ # Install cron %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/cron %{__install} -m 0755 cron/archiveDayLog %buildroot%{_datadir}/centreon/cron/ %{__install} -m 0755 cron/centAcl.php %buildroot%{_datadir}/centreon/cron/ %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/cron/ods %{__install} -m 0755 cron/ods/buildDailyReport.php %buildroot%{_datadir}/centreon/cron/ods/ %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/cron/reporting #%{__install} -d -m 0755 %buildroot%{_datadir}/centreon/examples #%__cp tmpl/install/centcore.init.d %buildroot%{_datadir}/centreon/examples/ #%__cp tmpl/install/centstorage.init.d %buildroot%{_datadir}/centreon/examples/ #cat << EOF >> %buildroot%{_datadir}/centreon/examples/centreon.sudoers ### BEGIN: CENTREON SUDO ##Add by CENTREON installation script #User_Alias CENTREON=apache ## Nagios Restart #CENTREON ALL = NOPASSWD: /etc/rc.d/init.d/nagios restart ## Nagios reload #CENTREON ALL = NOPASSWD: /etc/rc./init.d/nagios reload ## Nagios test config #CENTREON ALL = NOPASSWD: /usr/bin/nagios -v * ## Nagios test for optim config #CENTREON ALL = NOPASSWD: /usr/bin/nagios -s * ## Snmptrapd Restart #CENTREON ALL = NOPASSWD: /etc/rc.d/init.d/snmptrapd restart ## CentStorage Restart #CENTREON ALL = NOPASSWD: /etc/rc.d/init.d/centstorage restart ## CentStorage stop #CENTREON ALL = NOPASSWD: /etc/rc.d/init.d/centstorage stop ### END: CENTREON SUDO # #EOF # Double check the line below, highly dubious %__cp -r doc GPL_LIB lib www log %buildroot%{_datadir}/centreon/ # Directory for Files Generation %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/filesGeneration %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/filesUpload %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/filesGeneration/nagiosCFG # Install var files %{__install} -d -m 0755 %buildroot%{_localstatedir}/lib/centreon %{__install} -d -m 0755 %buildroot%{_localstatedir}/lib/centreon/centplugins %{__install} -d -m 0755 %buildroot%{_localstatedir}/lib/centreon/log %{__install} -d -m 0755 %buildroot%{_localstatedir}/lib/centreon/metrics %{__install} -d -m 0755 %buildroot%{_localstatedir}/lib/centreon/status %{__install} -d -m 0755 %buildroot%{_localstatedir}/lib/centreon/nagios-perf %{__install} -d -m 0755 %buildroot%{_localstatedir}/log/centreon %{__install} -d -m 0750 %buildroot%{_localstatedir}/run/centreon # Install sql files #%{__install} -m 0644 centreon_storage.sql %buildroot%{_datadir}/centreon #%{__install} -m 0644 centreon.sql %buildroot%{_datadir}/centreon ####################################################################################################################### # Install ocs2cent %{__install} -d -m 0755 %buildroot%{_datadir}/centreon/www/modules #tar -xvz -C %buildroot%{_datadir}/centreon/www/modules -f %{SOURCE1} %preun if [ $1 -eq 0 ]; then /sbin/service centcore stop &>/dev/null /sbin/service centstorage stop &>/dev/null /sbin/chkconfig --del centcore || : /sbin/chkconfig --del centstorage || : fi %postun if [ "$1" -ge "1" ]; then /sbin/service centcore condrestart &>/dev/null || : /sbin/service centstorage condrestart &>/dev/null || : fi %post #if [ "$1" = "1" ] ; then /sbin/chkconfig --add centcore /sbin/chkconfig --add centstorage # # Install sudoers files # sudo=`cat /etc/sudoers | grep CENTREON > /dev/null; echo $?` # ln -s %{_localstatedir}/lib/centreon %{_datadir}/centreon/lib # if [ $sudo == '1' ]; then # chmod u+w /etc/sudoers # sed -i 's/^Defaults.*requiretty/#Defaults requiretty/' /etc/sudoers # echo "#Add by CENTREON installation script" >> /etc/sudoers # echo "User_Alias CENTREON= apache" >> /etc/sudoers # echo "# Nagios Restart" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart" >> /etc/sudoers # echo "# Nagios reload" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload" >> /etc/sudoers # echo "# Nagios test config" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /usr/bin/nagios -v *" >> /etc/sudoers # echo "# Nagios test for optim config" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /usr/bin/nagios -s *" >> /etc/sudoers # echo "## Snmptrapd Restart" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart" >> /etc/sudoers # echo "## CentStorage Restart" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /etc/init.d/centstorage restart" >> /etc/sudoers # echo "## CentStorage stop" >> /etc/sudoers # echo "CENTREON ALL = NOPASSWD: /etc/init.d/centstorage stop" >> /etc/sudoers # echo "" >> /etc/sudoers # chmod u-w /etc/sudoers # fi # # # Disabled installation centreon # mv /usr/share/centreon/www/install /usr/share/centreon/www/install.old # chown -R apache:apache /usr/share/centreon/GPL_LIB/SmartyCache # # # Reload apache # service httpd reload 2>&1 > /dev/null # CR=$? # # if [ $CR -ne 0 ]; then # echo "Cannot reload Apache trying to force restart ..." # service httpd restart 2>&1 > /dev/null # fi # # # Configure snmpd # cat > /etc/snmp/snmpd.conf << EOF #rocommunity public #view systemview included .1.3.6.1.2.1.25.2.3.1.1 #view systemview included .1.3.6.1.2.1.25.2.3.1.2 #view systemview included .1.3.6.1.2.1.25.2.3.1.3 #view systemview included .1.3.6.1.2.1.25.2.3.1.4 #view systemview included .1.3.6.1.2.1.25.2.3.1.5 #view systemview included .1.3.6.1.2.1.25.2.3.1.6 #view systemview included .1.3.6.1.2.1.25.2.3.1.7 #view systemview included .1.3.6.1.2.1.25.3.3.1.2 #EOF # #fi # #chown -R nagios:apache %{_sysconfdir}/nagios #chmod -R g+w %{_sysconfdir}/nagios #chown -R apache:apache %{_datadir}/centreon/www #%post database #if [ "$1" = "1" ] ; then # # Install centreon database # service mysqld status 2>&1 > /dev/null # CR=$? # # if [ $CR -ne 0 ]; then # service mysqld start 2>&1 > /dev/null # CR=$? # if [ $CR -ne 0 ]; then # echo "Centreon database not configured" # echo "Run :" # echo "/usr/bin/mysqladmin -u root create centreon && mysql -u root centreon < /usr/share/centreon/centreon.sql" # echo "mysql -u root centreon < /usr/share/centreon/www/modules/OCS2Cent/sql/install.sql" # echo "/usr/bin/mysqladmin -u root create centreon_storage && mysql -u root centreon_storage < /usr/share/centreon/centreon_storage.sql" # exit 0 # fi # fi # # # Centreon database configuration # /usr/bin/mysqladmin -u root create centreon # /usr/bin/mysqladmin -u root create centreon_storage # sleep 3 # mysql -u root centreon < /usr/share/centreon/centreon.sql # mysql -u root centreon_storage < /usr/share/centreon/centreon_storage.sql # # # Install data ocs2cent into centreon database # mysql -u root centreon < /usr/share/centreon/www/modules/OCS2Cent/sql/install.sql #fi %clean rm -rf ${RPM_BUILD_ROOT} %files # Config %defattr(-, apache, apache, -) %dir %{_sysconfdir}/centreon/ %config(noreplace) %{_sysconfdir}/centreon/centreon.conf.php %config(noreplace) %{_sysconfdir}/centreon/conf.pm %config(noreplace) %{_sysconfdir}/centreon/instCentPlugins.conf %config(noreplace) %{_sysconfdir}/centreon/instCentCore.conf %config(noreplace) %{_sysconfdir}/centreon/instCentStorage.conf %config(noreplace) %{_sysconfdir}/centreon/instCentWeb.conf # Cron %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/cron.d/centreon %config(noreplace) %{_sysconfdir}/cron.d/centstorage # Apache config %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/httpd/conf.d/centreon.conf # Init daemon %defattr(-,root,root,-) %{_initrddir}/centcore %{_initrddir}/centstorage # Install file configuration snmptrapd and snmp %defattr(-,root,root,-) #%config(noreplace) %{_sysconfdir}/snmp/snmptrapd.conf #%config(noreplace) %{_sysconfdir}/snmp/snmp.conf %config(noreplace) %{_sysconfdir}/snmp/centreon_traps/snmptt.ini # Centreon plugins %defattr(-,apache,nagios,-) %{_libdir}/nagios/plugins/centreon* %{_libdir}/nagios/plugins/check* %{_libdir}/nagios/plugins/process-service-perfdata %{_libdir}/nagios/plugins/submit_host_check_result %{_libdir}/nagios/plugins/submit_service_check_result # Datadir centreon %defattr(-,root,root,-) %{_datadir}/centreon/bin/centFillTrapDB %{_datadir}/centreon/bin/centGenSnmpttConfFile %{_datadir}/centreon/bin/centTrapHandler-2.x #%{_datadir}/centreon/bin/snmptt #%{_datadir}/centreon/bin/snmpttconvertmib %defattr(-,nagios,nagios,-) %{_datadir}/centreon/bin/centcore %{_datadir}/centreon/bin/centstorage %{_datadir}/centreon/bin/logAnalyser %{_datadir}/centreon/bin/nagiosPerfTrace %defattr(-,apache,apache,-) %{_datadir}/centreon/filesGeneration %{_datadir}/centreon/filesUpload %{_datadir}/centreon/GPL_LIB %{_datadir}/centreon/www/DBNDOConnect.php %{_datadir}/centreon/www/DBOdsConnect.php %{_datadir}/centreon/www/DBconnect.php %{_datadir}/centreon/www/Themes %{_datadir}/centreon/www/alt_error.php %{_datadir}/centreon/www/basic-functions.php %{_datadir}/centreon/www/class %{_datadir}/centreon/www/footer.php %{_datadir}/centreon/www/header.php %{_datadir}/centreon/www/htmlHeader.php %{_datadir}/centreon/www/img %{_datadir}/centreon/www/include %{_datadir}/centreon/www/index.php %{_datadir}/centreon/www/install %{_datadir}/centreon/www/lib %{_datadir}/centreon/www/locale %{_datadir}/centreon/www/login.php %{_datadir}/centreon/www/main.php %{_datadir}/centreon/www/menu %{_datadir}/centreon/www/oreon.php %{_datadir}/centreon/www/pathWay.php %{_datadir}/centreon/www/robots.txt %{_datadir}/centreon/www/stat.php %defattr(-,nagios,apache,-) %{_datadir}/centreon/cron %defattr(-,root,apache,-) %{_datadir}/centreon/doc %defattr(-,apache,nagios,-) %{_datadir}/centreon/lib %defattr(-,apache,nagios,-) %{_localstatedir}/log/centreon %defattr(-,nagios,nagios,-) %{_localstatedir}/run/centreon # Files ocs2cent #%defattr(-,apache,nagios,-) #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_config.php #%{_datadir}/centreon/www/modules/OCS2Cent/README #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_index.ihtml #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_import.php #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_import_results.php #%{_datadir}/centreon/www/modules/OCS2Cent/infos/infos.txt #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_import.ihtml #%{_datadir}/centreon/www/modules/OCS2Cent/LICENSE #%{_datadir}/centreon/www/modules/OCS2Cent/conf.php #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_import_results.ihtml #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_index.php #%{_datadir}/centreon/www/modules/OCS2Cent/INSTALL #%{_datadir}/centreon/www/modules/OCS2Cent/DB-Func.php #%{_datadir}/centreon/www/modules/OCS2Cent/ocs_config.ihtml #%files database #%defattr(-,root,root,-) #%{_datadir}/centreon/centreon.sql #%{_datadir}/centreon/centreon_storage.sql # Sql file ocs2cent #%defattr(-,apache,nagios,-) #%{_datadir}/centreon/www/modules/OCS2Cent/sql/install.sql #%{_datadir}/centreon/www/modules/OCS2Cent/sql/uninstall.sql %changelog * Mon Nov 18 2008 Xavier Bachelot 2.0-0.1.rc8 - Clean up spec. - Update to 2.0rc8. * Wed Oct 22 2008 Olivier LI-KIANG-CHEONG 2.0-fan.16 - Upgrade to centreon-2.0-RC7 * Thu Oct 16 2008 Olivier LI-KIANG-CHEONG 2.0-fan.15 - Integrate ocs2cent * Thu Sep 18 2008 Olivier LI-KIANG-CHEONG 2.0-fan.14 - Packaging centreon-2.0-RC3 * Tue Jul 08 2008 Arthur Clement - Fix wrong path for nagios.pid * Wed Jun 18 2008 Olivier LI-KIANG-CHEONG 2.0-fan.11 - Fix macro centreon who changed - Fix integration Nagvis to the socket type TCP * Mon Jun 06 2008 Frederic Bouby 2.0-fan.10 - First version for branch 2.0 (2.0-b4)