From 37d1b4bb8b74687fbacb65bcb1e43b4efecfaada Mon Sep 17 00:00:00 2001 From: Micha Glave Date: Fri, 13 Mar 2009 09:50:10 +0000 Subject: [PATCH] Test of centreon 2.0.1 --- net-analyzer/centreon/ChangeLog | 17 + net-analyzer/centreon/Manifest | 7 + net-analyzer/centreon/centreon-2.0.1.ebuild | 291 ++++++++++++++++++ net-analyzer/centreon/files/99_centreon.conf | 10 + net-analyzer/centreon/files/centreon.cron | 7 + .../centreon/files/installoreon.conf.php | 33 ++ net-analyzer/centreon/files/ods.initd | 24 ++ 7 files changed, 389 insertions(+) create mode 100644 net-analyzer/centreon/ChangeLog create mode 100644 net-analyzer/centreon/Manifest create mode 100644 net-analyzer/centreon/centreon-2.0.1.ebuild create mode 100644 net-analyzer/centreon/files/99_centreon.conf create mode 100644 net-analyzer/centreon/files/centreon.cron create mode 100644 net-analyzer/centreon/files/installoreon.conf.php create mode 100755 net-analyzer/centreon/files/ods.initd diff --git a/net-analyzer/centreon/ChangeLog b/net-analyzer/centreon/ChangeLog new file mode 100644 index 0000000..20ce03d --- /dev/null +++ b/net-analyzer/centreon/ChangeLog @@ -0,0 +1,17 @@ +# ChangeLog for net-analyzer/centreon +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/centreon/ChangeLog,v 1.3 2008/04/03 08:30:17 hollow Exp $ + + 03 Apr 2008; Benedikt Böhm centreon-1.4.2.4.ebuild: + fix use dependency checks + + 28 Mar 2008; Benedikt Böhm centreon-1.4.2.4.ebuild: + fix typo + +*centreon-1.4.2.4 (28 Mar 2008) + + 28 Mar 2008; Benedikt Böhm +files/99_centreon.conf, + +files/centreon.cron, +files/installoreon.conf.php, +files/ods.initd, + +metadata.xml, +centreon-1.4.2.4.ebuild: + initial ebuild + diff --git a/net-analyzer/centreon/Manifest b/net-analyzer/centreon/Manifest new file mode 100644 index 0000000..365f862 --- /dev/null +++ b/net-analyzer/centreon/Manifest @@ -0,0 +1,7 @@ +AUX 99_centreon.conf 257 RMD160 0ee38f9c1bba533c2f547aed016302b928ac8d23 SHA1 d9555c2062b69bada7876ed07679d8973c796ad5 SHA256 4f6c817c3217ec98075bf254c6e92fb98d7e54ef312f999198b8dc3aacd7de58 +AUX centreon.cron 468 RMD160 67f637acac8582852a1ba4e9b5c865970ca9d787 SHA1 38ca62f63e71059a803377de1989515fa6a57eb4 SHA256 6130334337dc2f7a7a3e2eb14f88376add45867e0406a681b9aa4e1b61194525 +AUX installoreon.conf.php 1561 RMD160 fdb73ab561c40335d481dec547c104d48224ac4e SHA1 7a56a8fd220afc2283f752615fa33a587d40341d SHA256 ecc8609624d3cc98f7bd40dd6024a3da76a9fe23a85424c6f3d78e92245a4044 +AUX ods.initd 571 RMD160 b961865bc3530fc0e67b2179e8c4e651564dcea8 SHA1 afa32f103768680bb9d7d37178e376f4ed75179c SHA256 ce73be667b547e5ba3fe345b3962640daca8569a29d4c21920c44a37e7755021 +DIST centreon-2.0.1.tar.gz 5978352 RMD160 8c0939000badae1b1fc986edcafaa10762dc2901 SHA1 f59a7c38624aeec8bba027a3b32831795fabb58e SHA256 4cae0c58ea3a919581fc3cf6cfb18ff209c08a4f5bcebbb17e43e8e5bdb87100 +EBUILD centreon-2.0.1.ebuild 7197 RMD160 ce35d2ab0d24dc596d8fca7e1a0427e569e7e598 SHA1 f64e442931065877cd588047ab5ac301dfdf17e3 SHA256 590ab51dbaf4c0a9f69bd079b33dba3d66b71dff0c2f6fcff83ec3548d3e96b8 +MISC ChangeLog 647 RMD160 794ed09c1a2b1741eb3578e3b3398c582a5efb9f SHA1 60e8d9dc2f0d27dbbb5bf7478d254048e827d7e7 SHA256 d7e6a56849c8d017133cb9c1c8157cf4b69a80e173f7178547bd38dcfbd8743d diff --git a/net-analyzer/centreon/centreon-2.0.1.ebuild b/net-analyzer/centreon/centreon-2.0.1.ebuild new file mode 100644 index 0000000..bd667bb --- /dev/null +++ b/net-analyzer/centreon/centreon-2.0.1.ebuild @@ -0,0 +1,291 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/centreon/centreon-1.4.2.4.ebuild,v 1.3 2008/04/03 08:30:17 hollow Exp $ + +inherit depend.apache depend.php confutils + +DESCRIPTION="Centreon is a monitoring web-frontend based on the nagios monitoring engine" +HOMEPAGE="http://www.oreon-project.org" +SRC_URI="http://download.oreon-project.org/${PN}/${P}.tar.gz" +# mirror://gentoo/${P}-path_sanity.patch.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="ldap" + +DEPEND="" +RDEPEND=">=net-analyzer/nagios-2.10 + net-analyzer/rrdtool + net-analyzer/net-snmp + net-analyzer/snmptt + app-admin/sudo + dev-php/PEAR-PEAR + dev-php/smarty + >=dev-php/PEAR-Auth_SASL-1.0.1 + >=dev-php/PEAR-DB-1.7.6 + >=dev-php/PEAR-DB_DataObject-1.8.4 + >=dev-php/PEAR-DB_DataObject_FormBuilder-1.0.0_rc4 + >=dev-php/PEAR-Date-1.4.6 + >=dev-php/PEAR-HTML_Common-1.2.2 + >=dev-php/PEAR-HTML_QuickForm-3.2.5 + >=dev-php/PEAR-HTML_QuickForm_advmultiselect-1.1.0 + >=dev-php/PEAR-HTML_Table-1.6.1 + >=dev-php/PEAR-HTTP-1.2.2 + >=dev-php/PEAR-Image_Canvas-0.2.4 + >=dev-php/PEAR-Image_Color-1.0.2 + >=dev-php/PEAR-Image_Graph-0.7.1 + >=dev-php/PEAR-Image_GraphViz-1.1.0 + >=dev-php/PEAR-MDB2-2.0.0 + >=dev-php/PEAR-Mail-1.1.9 + >=dev-php/PEAR-Mail_Mime-1.3.1 + >=dev-php/PEAR-Net_Ping-2.4.1 + >=dev-php/PEAR-Net_SMTP-1.2.8 + >=dev-php/PEAR-Net_Socket-1.0.1 + >=dev-php/PEAR-Net_Traceroute-0.21 + >=dev-php/PEAR-Numbers_Roman-1.0.1 + >=dev-php/PEAR-Numbers_Words-0.14.0 + >=dev-php/PEAR-SOAP-0.10.1 + >=dev-php/PEAR-Validate-0.6.2 + dev-perl/Config-IniFiles + dev-perl/Crypt-DES + dev-perl/DBI + dev-perl/Digest-HMAC + dev-perl/Digest-SHA1 + dev-perl/GD + dev-perl/IO-Socket-INET6 + dev-perl/Net-SNMP + dev-perl/Socket6" + +need_apache2 +need_php5 + +setup_vars() { + INSTALL_DIR_OREON="/usr/share/centreon" + OREON_PATH=${INSTALL_DIR_OREON} + + INSTALL_DIR_NAGIOS="/usr/share/nagios" + NAGIOS_ETC="/etc/nagios" + NAGIOS_VAR="/var/nagios" + NAGIOS_BIN="/usr/sbin/nagios" + NAGIOS_PLUGINS="/usr/lib/nagios/plugins" + NAGIOS_IMG="${INSTALL_DIR_NAGIOS}/htdocs/docs/images" + NAGIOS_USER="nagios" + NAGIOS_GROUP="nagios" + + BIN_RRDTOOL="/usr/bin/rrdtool" + BIN_MAIL="/bin/mail" + WWWUSER="" +} + +pkg_setup() { + confutils_require_built_with_all sys-devel/libperl ithreads + confutils_require_built_with_all dev-lang/perl ithreads + confutils_require_built_with_all net-analyzer/net-snmp perl + confutils_require_built_with_all net-analyzer/rrdtool perl + + require_php_sapi_from apache2 cli + require_php_with_any_use gd gd-external + require_php_with_use mysql posix snmp truetype + + use ldap && require_php_with_use ldap + + setup_vars +} + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${WORKDIR}"/${P}-path_sanity.patch +} + +varsubst() { + local path=$1 + + for var in "$@"; do + sed -i -e "s:@${var}@:$(eval echo \$${var}):g" "${D}${path}" + done +} + +install_centreon() { + cd "${S}" + + # copy www and doc files + insinto "${OREON_PATH}" + doins -r www + dosym /usr/nagios/share/htdocs "${OREON_PATH}"/doc + + # sanitize file modes + find "${D}${OREON_PATH}" -type d -exec chmod 755 {} \; + find "${D}${OREON_PATH}" -type f -exec chmod 644 {} \; + + # keep important directories + keepdir "${OREON_PATH}"/www/modules + keepdir /var/log/centreon + keepdir /var/cache/centreon/rrd + keepdir /var/cache/centreon/smarty/{cache,config,compile} + keepdir /var/cache/centreon/generate/{nagiosCFG,osm} + keepdir /var/cache/centreon/upload/nagiosCFG + + # prepare SQL files + varsubst "${OREON_PATH}"/www/install/insertBaseConf.sql \ + NAGIOS_{USER,GROUP,ETC,BIN,VAR,PLUGINS,IMG} \ + INSTALL_DIR_NAGIOS INSTALL_DIR_OREON \ + BIN_RRDTOOL BIN_MAIL + + varsubst "${OREON_PATH}"/www/install/createTablesODS.sql \ + NAGIOS_VAR + + # fix paths in php files + varsubst "${OREON_PATH}"/www/include/configuration/configCGI/formCGI.php \ + NAGIOS_ETC INSTALL_DIR_NAGIOS + + varsubst "${OREON_PATH}"/www/include/options/oreon/upGrade/preUpdate.php \ + OREON_PATH + + # install ${WWWUSER} config + insinto "${APACHE_MODULES_CONFDIR}" + doins "${FILESDIR}"/99_centreon.conf + + # install global installation config + insinto "${OREON_PATH}"/www/install + doins "${FILESDIR}"/installoreon.conf.php + + # set permissions + fowners -R ${WWWUSER}:${WWWUSER} \ + /var/cache/centreon \ + "${OREON_PATH}"/www + + fowners -R nagios:${WWWUSER} \ + /var/log/centreon +} + +install_plugins() { + cd "${S}" + + # install plugin configuration + insinto /etc/centreon + doins ./Plugins/src/centreon.conf + rm -f ./Plugins/src/centreon.conf + + varsubst /etc/centreon/centreon.conf \ + INSTALL_DIR_NAGIOS INSTALL_DIR_OREON \ + NAGIOS_ETC NAGIOS_PLUGINS + + fowners -R ${WWWUSER}:${WWWUSER} \ + /etc/centreon + + # install nagios plugins + exeinto "${NAGIOS_PLUGINS}" + + for plugin in ./Plugins/src/*; do + if [[ ! -d "${plugin}" ]]; then + doexe "${plugin}" + varsubst "${NAGIOS_PLUGINS}/$(basename "${plugin}")" \ + NAGIOS_PLUGINS NAGIOS_VAR + fi + done +} + +install_traps() { + cd "${S}" + + # install snmp traps plugins + dodir "${NAGIOS_PLUGINS}"/traps + dodir /etc/snmp/centreon + + exeinto "${NAGIOS_PLUGINS}"/traps/ + doexe Plugins/src/traps/plugins/* + + # install snmp configs + insinto /etc/snmp/centreon + doins Plugins/src/traps/conf/snmptt.ini + fowners -R ${WWWUSER}:nagios /etc/snmp/centreon + + insinto /etc/snmp/ + doins Plugins/src/traps/conf/snmp.conf +} + +install_ods() { + cd "${S}" + + # install ODS daemon + insinto /usr + dosbin ODS/ods + + # install ODS library files + insinto /usr/lib/ods + doins ODS/lib/* + + # install ODS init script + newinitd "${FILESDIR}"/ods.initd ods + + # keep important directories + keepdir /etc/ods + keepdir /var/run/ods + keepdir /var/log/ods + keepdir /var/lib/ods + keepdir /var/lib/ods/database + + # set permissions + fowners -R nagios:nagios \ + /var/run/ods \ + /var/log/ods \ + /var/lib/ods/database + fowners -R ${WWWUSER}:nagios /etc/ods +} + +install_cron() { + cd "${S}" + + insinto "${OREON_PATH}" + doins -r cron + + fperms +x "${OREON_PATH}"/cron/*.{pl,php} + + for i in $(find cron/ -type f); do + varsubst "${OREON_PATH}"/${i} OREON_PATH + done + + insinto /etc/cron.d + newins "${FILESDIR}"/centreon.cron centreon +} + +src_install() { + install_centreon + install_plugins + install_traps + install_ods + install_cron +} + +pkg_config() { + setup_vars + + einfo "Setting permissions on ${ROOT}${NAGIOS_ETC}" + chown ${WWWUSER}:nagios "${ROOT}${NAGIOS_ETC}" + chmod 0775 "${ROOT}${NAGIOS_ETC}" + + einfo "Setting permissions on ${ROOT}${NAGIOS_PLUGINS}" + chown ${WWWUSER}:nagios "${ROOT}${NAGIOS_PLUGINS}" + chmod 0775 "${ROOT}${NAGIOS_PLUGINS}" + + einfo "Setting permissions on ${ROOT}${NAGIOS_PLUGINS}/contrib" + chown ${WWWUSER}:nagios "${ROOT}${NAGIOS_PLUGINS}"/contrib + chmod 0775 "${ROOT}${NAGIOS_PLUGINS}"/contrib + + einfo "Adding user ${WWWUSER} to group nagios" + usermod -a -G nagios ${WWWUSER} + + SUDOERS="${ROOT}etc/sudoers" + + if ! grep -q CENTREON "${SUDOERS}"; then + einfo "Adding sudo configuration" + echo >> "${SUDOERS}" + echo "# centreon configuration" >> "${SUDOERS}" + echo "User_Alias CENTREON=${WWWUSER}" >> "${SUDOERS}" + echo "CENTREON ALL = NOPASSWD: /etc/init.d/nagios restart" >> "${SUDOERS}" + echo "CENTREON ALL = NOPASSWD: /etc/init.d/nagios reload" >> "${SUDOERS}" + echo "CENTREON ALL = NOPASSWD: /etc/init.d/snmptrapd restart" >> "${SUDOERS}" + fi +} diff --git a/net-analyzer/centreon/files/99_centreon.conf b/net-analyzer/centreon/files/99_centreon.conf new file mode 100644 index 0000000..1fae171 --- /dev/null +++ b/net-analyzer/centreon/files/99_centreon.conf @@ -0,0 +1,10 @@ + + AddType application/x-java-jnlp-file .jnlp + Alias /centreon/ /usr/share/centreon/www/ + + Options None + AllowOverride AuthConfig Options + Order allow,deny + Allow from all + + diff --git a/net-analyzer/centreon/files/centreon.cron b/net-analyzer/centreon/files/centreon.cron new file mode 100644 index 0000000..100a71f --- /dev/null +++ b/net-analyzer/centreon/files/centreon.cron @@ -0,0 +1,7 @@ +OREON_DIR=/usr/share/centreon +LOG_DIR=/var/log/centreon + +0 0 * * * nagios /usr/bin/php -q ${OREON_DIR}/cron/inventory_update.php 2>&1 >> ${LOG_DIR}/Inventory_log +0 1 1-31 * * nagios /usr/bin/php -q ${OREON_DIR}/cron/reporting/ArchiveLogInDB.php 2>&1 >> ${LOG_DIR}/ArchiveLogInDB_log +* * * * * nagios ${OREON_DIR}/cron/parsing_status.pl 2>&1 >> ${LOG_DIR}/ods_parsing_status +* * * * * nagios ${OREON_DIR}/cron/parsing_log.pl 2>&1 >> ${LOG_DIR}/ods_parsing_log diff --git a/net-analyzer/centreon/files/installoreon.conf.php b/net-analyzer/centreon/files/installoreon.conf.php new file mode 100644 index 0000000..de10d40 --- /dev/null +++ b/net-analyzer/centreon/files/installoreon.conf.php @@ -0,0 +1,33 @@ + diff --git a/net-analyzer/centreon/files/ods.initd b/net-analyzer/centreon/files/ods.initd new file mode 100755 index 0000000..e6daa35 --- /dev/null +++ b/net-analyzer/centreon/files/ods.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/centreon/files/ods.initd,v 1.1 2008/03/28 18:38:07 hollow Exp $ + +depend() { + need mysql +} + +start() { + ebegin "Starting OreonDataStorage (ODS)" + start-stop-daemon --start --pidfile /var/run/ods.pid \ + --background \ + --exec /usr/sbin/ods \ + --user nagios \ + --group nagios + eend +} + +stop() { + ebegin "Stopping OreonDataStorage (ODS)" + start-stop-daemon --stop --pidfile /var/run/ods.pid + eend +}