Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
>
icinga110
> icinga.spec
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File icinga.spec of Package icinga110 (Revision 7)
Currently displaying revision
7
,
show latest
#!BuildIgnore: post-build-checks %define name icinga %define version 1.10.3 %define pkgversion 1.10.3 %define release 1 %define nsusr icinga %define nsgrp icinga %define cmdgrp icingacmd %define wwwusr wwwrun %define wwwgrp www %define logdir /var/log/%{name} %ifarch x86_64 %define arch x86_64 %else %define arch i586 %endif # Macro that print mesages to syslog at package (un)install time %define nnmmsg logger -t %{name}/rpm Summary: Host/service/network monitoring program Name: %{name} Version: %{version} Release: %{release} License: GPL Group: Application/System Source0: %{name}-%{pkgversion}.tar.bz2 Source1: %{name}-rpmlintrc BuildRoot: %{_tmppath}/%{name}-buildroot Requires: gd > 1.8 zlib libpng libjpeg bash grep perl libdbi-drivers Requires(pre): pwdutils PreReq: /bin/logger, sed, mktemp BuildRequires: gd-devel > 1.8 zlib-devel libpng-devel libjpeg-devel glibc-devel libgcc gcc gcc-c++ perl BuildRequires: openssl-devel BuildRequires: libdbi-devel libocilib-devel %if 0%{?fedora_version} >= 7 BuildRequires: perl-ExtUtils-MakeMaker BuildRequires: perl-ExtUtils-Embed %endif %description Nagios is a program that will monitor hosts and services on your network. It has the ability to email or page you when a problem arises and when a problem is resolved. Nagios is written in C and is designed to run under Linux (and some other *NIX variants) as a background process, intermittently running checks on various services that you specify. The actual service checks are performed by separate "plugin" programs which return the status of the checks to Nagios. The plugins are available at http://sourceforge.net/projects/nagiosplug This package provide core programs for icinga. The web interface, documentation, and development files are built as separate packages %package www Group: Application/System Summary: Provides the HTML and CGI files for the Nagios web interface Requires: %{name} = %{version} Requires: http_daemon #Provides: icinga-api = %{version} %description www Nagios is a program that will monitor hosts and services on your network. It has the ability to email or page you when a problem arises and when a problem is resolved. Nagios is written in C and is designed to run under Linux (and some other *NIX variants) as a background process, intermittently running checks on various services that you specify. Several CGI programs are included with Nagios in order to allow you to view the current service status, problem history, notification history, and log file via the web. This package provides the HTML and CGI files for the Nagios web interface. In addition, HTML documentation is included in this package %package devel Group: Application/System Summary: Provides include files that Nagios-related applications may compile against Requires: %{name} = %{version} %description devel Nagios is a program that will monitor hosts and services on your network. It has the ability to email or page you when a problem arises and when a problem is resolved. Nagios is written in C and is designed to run under Linux (and some other *NIX variants) as a background process, intermittently running checks on various services that you specify. This package provides include files that Nagios-related applications may compile against. %prep %setup -q -n %{name}-%{pkgversion} %pre # Create `icinga' user on the system if necessary if /usr/bin/id %{nsusr} > /dev/null 2>&1 ; then : # user already exists else /usr/sbin/useradd -r -d /var/log/icinga -s /bin/sh -c "%{nsusr}" %{nsusr} || \ %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process. fi # id cannot tell us if the group already exists # so just try to create it and assume it works /usr/sbin/groupadd %{nsgrp} > /dev/null 2>&1 /usr/sbin/groupadd %{cmdgrp} > /dev/null 2>&1 # if LSB standard /etc/init.d does not exist, # create it as a symlink to the first match we find if [ -d /etc/init.d -o -L /etc/init.d ]; then : # we're done elif [ -d /etc/rc.d/init.d ]; then ln -s /etc/rc.d/init.d /etc/init.d elif [ -d /usr/local/etc/rc.d ]; then ln -s /usr/local/etc/rc.d /etc/init.d elif [ -d /sbin/init.d ]; then ln -s /sbin/init.d /etc/init.d fi %preun %if 0%{?suse_version} %stop_on_removal icinga %else if [ "$1" = 0 ]; then /sbin/service icinga stop > /dev/null 2>&1 /sbin/chkconfig --del icinga fi %endif %postun if [ "$1" -ge "1" ]; then /sbin/service icinga condrestart >/dev/null 2>&1 || : fi # Delete icinga user and group # (if grep doesn't find a match, then it is NIS or LDAP served and cannot be deleted) if [ $1 = 0 ]; then /bin/grep '^%{nsusr}:' /etc/passwd > /dev/null 2>&1 && /usr/sbin/userdel %{nsusr} || %nnmmsg "User %{nsusr} could not be deleted." /bin/grep '^%{nsgrp}:' /etc/group > /dev/null 2>&1 && /usr/sbin/groupdel %{nsgrp} || %nnmmsg "Group %{nsgrp} could not be deleted." /bin/grep '^%{cmdgrp}:' /etc/group > /dev/null 2>&1 && /usr/sbin/groupdel %{cmdgrp} || %nnmmsg "Group %{cmdgrp} could not be deleted." fi %insserv_cleanup icinga %post www # If apache is installed, and we can find the apache user, set a shell var wwwusr=`awk '/^[ \t]*User[ \t]+[a-zA-Z0-9]+/ {print $2}' /etc/apache2/*.conf` if [ "z" == "z$wwwusr" ]; then # otherwise, use the default wwwusr=%{wwwusr} fi # if apache user is not in cmdgrp, add it if /usr/bin/id -Gn $wwwusr 2>/dev/null | /bin/grep -q %{cmdgrp} > /dev/null 2>&1 ; then : # $wwwusr (default: apache) is already in nagiocmd group else # first find apache primary group pgrp=`/usr/bin/id -gn $wwwusr 2>/dev/null` # filter apache primary group from secondary groups sgrps=`/usr/bin/id -Gn $wwwusr 2>/dev/null | /bin/sed "s/^$pgrp //;s/ $pgrp //;s/^$pgrp$//;s/ /,/g;"` if [ "z" == "z$sgrps" ] ; then sgrps=%{nsgrp} else sgrps=$sgrps,%{cmdgrp} fi # modify apache user, adding it to cmdgrp /usr/sbin/usermod -G $sgrps $wwwusr >/dev/null 2>&1 %nnmmsg "User $wwwusr added to group %{cmdgrp} so sending commands to Nagios from the command CGI is possible." fi %preun www if [ $1 = 0 ]; then if test -f /etc/apache2/httpd.conf; then TEMPFILE=`mktemp /etc/apache2/httpd.conf.tmp.XXXXXX` if grep "^ *Include /etc/apache2/conf.d/icinga.conf" /etc/apache2/httpd.conf > /dev/null; then grep -v "^ *Include /etc/apache2/conf.d/icinga.conf" /etc/apache2/httpd.conf > $TEMPFILE mv $TEMPFILE /etc/apache2/httpd.conf chmod 644 /etc/apache2/httpd.conf /etc/init.d/apache2 restart fi fi fi %stop_on_removal icinga %build export PATH=$PATH:/usr/sbin CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \ ./configure \ --host=%{arch}-suse-linux-gnu \ --build=%{arch}-suse-linux-gnu \ --target=%{arch}-suse-linux \ --with-init-dir=/etc/init.d \ --with-cgiurl=/icinga/cgi-bin \ --with-htmurl=/icinga \ --with-lockfile=/var/run/icinga.pid \ --with-icinga-user=%{nsusr} \ --with-icinga-group=%{nsgrp} \ --prefix=%{_prefix} \ --exec-prefix=%{_prefix}/sbin \ --bindir=%{_sbindir} \ --sbindir=%{_prefix}/lib/icinga/cgi \ --libdir=%{_libdir}/icinga \ --libexecdir=%{_prefix}/lib/icinga/plugins \ --datarootdir=%{_prefix}/share/icinga \ --datadir=%{_prefix}/share/icinga \ --mandir=%{_mandir} \ --docdir=%{_docdir}/%{name} \ --sysconfdir=/etc/icinga \ --localstatedir=/var/log/icinga \ --with-log-dir=%{logdir} \ --with-cgi-log-dir=%{logdir}/cgi \ --with-phpapi-log-dir=%{logdir}/api \ --with-gd-lib=%{_libdir} \ --with-gd-inc=/usr/include \ --with-dbi-lib=%{_libdir} \ --with-dbi-inc=%{_includedir}/db \ --with-libdbi-driver-dir=%{_libdir}/dbd \ --with-oci-lib=%{_libdir} \ --with-oci-inc=%{_includedir} \ --with-ssl-dir=%{_prefix} \ --with-ssl-lib=%{_libdir} \ --with-ssl-inc=%{_includedir}/openssl \ --enable-nanosleep \ --enable-event-broker \ --enable-idoutils \ --with-httpd-conf=/etc/apache2/conf.d \ --with-checkresult-dir=/var/spool/icinga/checkresults %__make all # make daemonchk.cgi and event handlers cd contrib %__make cd eventhandlers for f in `find . -type f` ; do F=`mktemp temp.XXXXXX` sed "s=/usr/local/icinga/var/rw/=/var/spool/icinga/=; \ s=/usr/local/icinga/libexec/eventhandlers/=%{_prefix}/lib/icinga/plugins/eventhandlers=; \ s=/usr/local/icinga/test/var=/var/log/icinga=" ${f} > ${F} mv ${F} ${f} done cd ../.. %install install -d -m 0775 ${RPM_BUILD_ROOT}/var/spool/icinga install -d -m 0775 ${RPM_BUILD_ROOT}/var/spool/icinga/checkresults install -d -m 0755 ${RPM_BUILD_ROOT}%{_prefix}/include/icinga install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d install -d -m 0755 ${RPM_BUILD_ROOT}/etc/logrotate.d install -d -m 0755 ${RPM_BUILD_ROOT}/etc/apache2/conf.d install -d -m 0755 ${RPM_BUILD_ROOT}/etc/icinga make DESTDIR=${RPM_BUILD_ROOT} INSTALL_OPTS="" INSTALL_OPTS_WEB="" COMMAND_OPTS="" install make DESTDIR=${RPM_BUILD_ROOT} INSTALL_OPTS="" INSTALL_OPTS_WEB="" COMMAND_OPTS="" INIT_OPTS="" install-daemoninit make DESTDIR=${RPM_BUILD_ROOT} INSTALL_OPTS="" INSTALL_OPTS_WEB="" COMMAND_OPTS="" install-idoutils mv %{buildroot}/etc/icinga/ido2db.cfg-sample %{buildroot}/etc/icinga/ido2db.cfg mv %{buildroot}/etc/icinga/idomod.cfg-sample %{buildroot}/etc/icinga/idomod.cfg # install templated configuration files cd sample-config for f in {icinga,cgi}.cfg ; do [ -f $f ] && install -c -m 664 $f ${RPM_BUILD_ROOT}/etc/icinga/${f} done ###mkdir -p ${RPM_BUILD_ROOT}/etc/icinga/private for f in resource.cfg ; do [ -f $f ] && install -c -m 664 $f ${RPM_BUILD_ROOT}/etc/icinga/${f} done cd template-object for f in {hosts,hostgroups,services,contacts,contactgroups,dependencies,escalations,timeperiods,checkcommands,misccommands,minimal}.cfg do [ -f $f ] && install -c -m 664 $f ${RPM_BUILD_ROOT}/etc/icinga/${f} done cd .. cd .. # install headers for development package install -m 0644 include/locations.h ${RPM_BUILD_ROOT}%{_prefix}/include/icinga # install httpd configuration in RH80-style httpd config subdir cp sample-config/httpd.conf ${RPM_BUILD_ROOT}/etc/apache2/conf.d/icinga.conf # install CGIs cd contrib make INSTALL=install DESTDIR=${RPM_BUILD_ROOT} INSTALL_OPTS="" COMMAND_OPTS="" CGIDIR=%{_prefix}/lib/icinga/cgi install cd .. # install event handlers cd contrib/eventhandlers install -d -m 0755 ${RPM_BUILD_ROOT}%{_prefix}/lib/icinga/eventhandlers for file in * ; do test -f $file && install -m 0755 $file ${RPM_BUILD_ROOT}%{_prefix}/lib/icinga/eventhandlers && rm -f $file done cd ../.. install -d -m 0755 ${RPM_BUILD_ROOT}/var/log/icinga/rw chmod +x %{buildroot}/etc/init.d/ido2db cd %{buildroot}%{_sbindir} ln -sf /etc/init.d/icinga rcicinga ln -sf /etc/init.d/ido2db rcido2db # remove placeholder files find %{buildroot} -name PLACEHOLDER -exec rm {} \; %clean rm -rf $RPM_BUILD_ROOT %files %defattr(755,root,root) /etc/init.d/icinga /etc/init.d/ido2db %{_sbindir}/icinga %{_sbindir}/icingastats %{_sbindir}/mini_epn %{_sbindir}/new_mini_epn %{_sbindir}/ido2db %{_sbindir}/log2ido %{_sbindir}/rcicinga %{_sbindir}/rcido2db %{_libdir}/icinga/idomod.so %dir %{_prefix}/lib/icinga/eventhandlers %{_prefix}/lib/icinga/eventhandlers/* %{_sbindir}/convertcfg %dir /etc/icinga %defattr(644,root,root) %config(noreplace) /etc/icinga/*.cfg %dir %attr(755,root,root) /etc/icinga/modules %config /etc/icinga/modules/idoutils.cfg-sample %dir %attr(755,root,root) /etc/icinga/objects %config /etc/icinga/objects/ido2db_check_proc.cfg %defattr(750,root,%{nsgrp}) %defattr(640,root,%{nsgrp}) %defattr(755,%{nsusr},%{nsgrp}) %dir /var/log/icinga %dir /var/log/icinga/rw %dir /var/log/icinga/archives %defattr(2775,%{nsusr},%{nsgrp}) %dir /var/spool/icinga %dir /var/spool/icinga/checkresults %defattr(0644,root,root) %doc Changelog INSTALLING LICENSE README UPGRADING %doc module/idoutils/db/{mysql,oracle,pgsql}/*.sql %doc module/idoutils/db/{mysql,oracle,pgsql}/upgrade/*.sql %doc sample-config/updates/ %doc module/idoutils/config/updates/ %defattr(-,%{nsusr},%{nsgrp}) %dir %{logdir} %files www %defattr(755,root,root) %dir %{_prefix}/lib/icinga/cgi %{_prefix}/lib/icinga/cgi/* %dir %{_prefix}/share/icinga %defattr(-,root,root) %{_prefix}/share/icinga/* %config(noreplace) /etc/apache2/conf.d/icinga.conf %defattr(-,%{wwwusr},%{wwwgrp}) %dir %{logdir}/cgi %{logdir}/cgi/index.htm %{logdir}/cgi/.htaccess %files devel %defattr(-,root,root) %dir %{_prefix}/include/icinga %{_prefix}/include/icinga/locations.h %changelog