Hello community,
here is the log from the commit of package nagios
checked in at Tue Mar 11 18:13:03 CET 2008.
--------
--- nagios/nagios.changes 2007-10-26 14:42:45.000000000 +0200
+++ /mounts/work_src_done/STABLE/nagios/nagios.changes 2008-03-05 18:38:55.154124000 +0100
@@ -1,0 +2,68 @@
+Wed Mar 5 18:38:43 CET 2008 - lrupp@suse.de
+
+- update to 3.0rc3:
+ + New macros have been added
+ + The old $NOTIFICATIONNUMBER$ macro has been deprecated in favor
+ of new $HOSTNOTIFICATIONNUMBER$ and $SERVICENOTIFICATIONNUMBER$
+ macros.
+ + The $HOSTNOTES$ and $SERVICENOTES$ macros may now contain
+ macros themselves
+ + new 'enable_environment_macros' option, which allow to disable
+ global macros for use in check, event handler, notification,
+ and other commands on large installations
+ + scheduled downtime entries are now stored in the status file
+ and retention file, respectively
+ + Current and retained comments are now stored in the status file
+ and retention file, respectively
+ + Acknowledgement comments that are marked as non-persistent are
+ now only deleted when the acknowledgement is removed.
+ + Comment and downtime IDs are now retained across program
+ restarts and should be unique unless the retention data is
+ deleted or ignored.
+ + Added flap_detection_options directive to host and service
+ definitions to allow you to specify what host/service states
+ should be used by the flap detection logic
+ + Added a new PROCESS_FILE external command to allow processing
+ of external commands found in an eternal (regular) file.
+ + Contact status information (last notification times,
+ notifications enabled/disabled, etc.) is now saved in the
+ status and retention files, although it is not processed
+ by the CGIs.
+ + check timeperiod for hosts and services can now be modified
+ on-the-fly
+ + Multiline plugin output is now supported for host and
+ service checks
+ + Nagios now checks for orphaned service checks by default.
+ + Host checks are now run in parallel
+ + Timeperiods were overdue for a major overhaul
+ + Added event broker callbacks for adaptive programm and contact
+ status data
+ + ... (See ChangeLog for more details)
+- Logfiles are stored in /var/log/nagios now
+- Nagios uses own logrotation - but we bzip the old logfiles via
+ weekly cronjob (Requires: bzip2)
+- added sysconfig file for timeout and nice level
+- overhaul the init script
+- added a README.SuSE
+- added rpmlintrc
+- added config.err file as %ghost
+- use upstream macros for all steps during rpmbuild where possible
+- adapt to work on all (open)SUSE distributions
+- overhaul the patches
+- cmdusr is now wwwrun and not nobody
+- cmdgrp is now new group nagcmd and not www
+- split out devel package
+- enable event-broker
+- use upstream apache config
+- adapt the generated sample configurations so the work out of the
+ box
+- enable template-objects
+- prepare and own the directory for event brokers
+- include all sample configuration in docdir
+- use fdupes
+- create/update new groups/users in %pre of the (sub-)package
+- add the apache2 user to the nagcmd group in %post of nagios-www
+- restart apache2 if nagios-www changes
+- own some %ghost files with the correct permissions
+
+-------------------------------------------------------------------
Old:
----
nagios-2.10.tar.bz2
nagios.avail.host_name.patch
nagios-httpd.conf
nagios.logrotate
nagios.p1.pl-location.patch
nagios.quick-start.txt
nagios.sample-config.email-admin-localhost.patch
nagios.sehandlers.end_time.patch
New:
----
nagios-3.0rc3.tar.bz2
nagios-p1.pl-location.patch
nagios-README.SuSE
nagios-rpmlintrc
nagios.sysconfig
suse.de-nagios
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nagios.spec ++++++
--- /var/tmp/diff_new_pack.b11609/_old 2008-03-11 18:12:58.000000000 +0100
+++ /var/tmp/diff_new_pack.b11609/_new 2008-03-11 18:12:58.000000000 +0100
@@ -1,7 +1,7 @@
#
-# spec file for package nagios (Version 2.10)
+# spec file for package nagios (Version 3.0rc3)
#
-# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
@@ -10,41 +10,60 @@
# norootforbuild
+
Name: nagios
-BuildRequires: apache2-devel freetype2-devel gd-devel iputils libjpeg-devel libpng-devel mailx openssl-devel pcre-devel
-%if 0%{?suse_version} < 1010
-BuildRequires: XFree86-devel XFree86-libs libapr0
-%else
-BuildRequires: libapr-util1-devel xorg-x11-devel
-%endif
Summary: The Nagios Network Monitor
-Version: 2.10
+Version: 3.0rc3
Release: 1
Url: http://www.nagios.org/
License: GPL v2 or later
Group: System/Monitoring
-PreReq: %insserv_prereq %fillup_prereq sed grep coreutils /usr/sbin/useradd /usr/sbin/groupadd
+PreReq: %insserv_prereq %fillup_prereq /bin/logger sed grep coreutils pwdutils
+BuildRequires: apache2-devel freetype2-devel gd-devel iputils libjpeg-devel libpng-devel mailx openssl-devel pcre-devel zlib-devel
+%if 0%{?suse_version} < 1010
+BuildRequires: XFree86-devel XFree86-libs libapr0
+%else
+BuildRequires: libapr-util1-devel xorg-x11-devel
+Recommends: %name-www
+%endif
+%if 0%{?suse_version} > 1020
+BuildRequires: fdupes
+%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+%define realname nagios
%define nsusr nagios
%define nsgrp nagios
-%define cmdusr nobody
-%define cmdgrp www
-%define nslockfile_dir /var/run/nagios
-%define nslockfile %{nslockfile_dir}/nagios.pid
-%define apxs2 /usr/sbin/apxs2-prefork
-%define apache2_sysconfdir %(%{apxs2} -q SYSCONFDIR)
-Source0: %{name}-%{version}.tar.bz2
-Source1: rcnagios
-Source2: nagios.quick-start.txt
-Source3: nagios-httpd.conf
-Source6: nagios.logrotate
-Patch: nagios.sehandlers.end_time.patch
-Patch1: nagios.avail.host_name.patch
-Patch2: nagios.sample-config.email-admin-localhost.patch
-Patch4: nagios.p1.pl-location.patch
+%define cmdusr wwwrun
+%define cmdgrp nagcmd
+%define nslockfile_dir /var/run/%realname
+%define nslockfile %nslockfile_dir/%realname.pid
+%define apache2_sysconfdir %(/usr/sbin/apxs2 -q SYSCONFDIR)/conf.d
+# Macro that print mesages to syslog at package (un)install time
+%define nnmmsg logger -t %name/rpm
+Source0: %realname-%version.tar.bz2
+Source1: rc%name
+Source2: %name-rpmlintrc
+Source3: %name.sysconfig
+Source4: suse.de-nagios
+Source10: %name-README.SuSE
+Patch10: nagios-p1.pl-location.patch
%description
-The Nagios Network Monitor
+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 nagios. The web interface,
+documentation, and development files are built as separate packages
+
+
Authors:
--------
@@ -53,144 +72,361 @@
%package www
Group: System/Monitoring
Summary: Nagios Network Monitor
-PreReq: http_daemon
-Requires: nagios gd
+Requires: %name = %version gd
+PreReq: apache2 coreutils pwdutils /bin/logger sed grep gawk
%description www
-Nagios Network Monitor
+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.
+
+
+
+Authors:
+--------
+ Ethan Galstad
+
+%package devel
+Group: Development/Libraries/C and C++
+Summary: Development files for nagios
+Requires: %name = %version
+Requires: gcc
+
+%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.
+
+
Authors:
--------
Ethan Galstad
%prep
-%setup -q
-%patch -p1
-%patch1 -p1
-%patch2 -p1
-%patch4 -p1
+%setup -q -n %realname-%version
+%patch10
+find -name ".cvsignore" | xargs rm
+find -name ".gitignore" | xargs rm
%build
-CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
-./configure \
- --with-cgiurl=/nagios/cgi-bin \
- --with-htmurl=/nagios \
- --with-lockfile=%{nslockfile} \
- --with-nagios-user=%{nsusr} \
- --with-nagios-grp=%{nsgrp} \
- --with-command-user=%{cmdusr} \
- --with-command-grp=%{cmdgrp} \
- --prefix=%{_prefix} \
- --exec-prefix=%{_prefix}/sbin \
- --bindir=%{_prefix}/sbin \
- --sbindir=%{_prefix}/lib/nagios/cgi \
- --libexecdir=%{_prefix}/lib/nagios/plugins \
- --datadir=%{_prefix}/share/nagios \
- --sysconfdir=/etc/nagios \
- --with-init-dir=/etc/init.d \
- --localstatedir=/var/lib/nagios \
- --with-gd-inc=/usr/include/gd \
- --enable-embedded-perl \
+# if the following command fails, then apache dependencies are not met
+/usr/sbin/apxs2 -q DATADIR >/dev/null
+%configure \
+ --prefix=%_prefix \
+ --exec-prefix=%_sbindir \
+ --bindir=%_sbindir \
+ --sbindir=%_prefix/lib/%realname/cgi \
+ --libexecdir=%_prefix/lib/%realname/plugins \
+ --datadir=%_datadir/%realname \
+ --sysconfdir=%_sysconfdir/%realname \
+ --with-init-dir=%_sysconfdir/init.d \
+ --localstatedir=/var/lib/%realname \
+ --with-cgiurl=/%realname/cgi-bin \
+ --with-htmurl=/%realname \
+ --with-httpd-conf=%apache2_sysconfdir \
+ --with-checkresult-dir=/var/spool/%realname \
+ --with-lockfile=%nslockfile \
+ --with-nagios-user=%nsusr \
+ --with-nagios-group=%nsgrp \
+ --with-command-user=%cmdusr \
+ --with-command-grp=%cmdgrp \
+ --with-gd-lib=%_libdir \
+ --with-gd-inc=%_includedir \
+ --with-template-objects \
+ --with-template-extinfo \
+ --with-perlcache \
--enable-event-broker \
- --with-perlcache
-sed -i 's#@p1pldir@#%{_prefix}/lib/nagios#g' Makefile include/locations.h sample-config/nagios.cfg
-make all %{?jobs:-j%jobs}
-sed -i~ -e '
-s@/var/lib/nagios/rw/@/var/spool/nagios/@
-s@/var/lib/nagios/nagios.log@/var/log/nagios/nagios.log@
-s@/var/lib/nagios/archives@/var/log/nagios/archives@
-s@^nagios_user=daemon$@nagios_user=%{nsusr}@
-s@^nagios_group=nagios$@nagios_group=%{nsgrp}@
-' sample-config/nagios.cfg
-diff -u sample-config/nagios.cfg~ sample-config/nagios.cfg || :
-cd contrib
-make %{?jobs:-j%jobs}
-cd ..
+ --enable-embedded-perl
+#
+# %bindir/p1.pl is not a good place for a perl-_module_!
+#
+sed -i 's#@p1pldir@#%_prefix/lib/nagios#g' Makefile include/locations.h sample-config/nagios.cfg
+#
+# fix p1.pl debug-path
+#
+sed -i 's#/usr/local/nagios/var/#/var/log/%realname/#g' p1.pl
+# make rpmlint happy: add shebang to p1.pl
+echo "#!/usr/bin/perl" > p1.pl.new
+cat p1.pl >> p1.pl.new
+mv p1.pl.new p1.pl
+#
+# make daemonchk.cgi and event handlers
+#
+make %{?_smp_mflags} all
+make %{?_smp_mflags} -C contrib
+pushd contrib/eventhandlers 1>/dev/null
+for f in `find . -type f` ; do
+ F=`mktemp temp.XXXXXX`
+ sed "s=/usr/local/nagios/var/rw/=/var/spool/%realname/=; \
+ s=/usr/local/nagios/libexec/eventhandlers/=%_prefix/lib/%realname/plugins/eventhandlers/=; \
+ s=/usr/local/nagios/libexec/=%_prefix/lib/%realname/plugins/=; \
+ s=/usr/local/nagios/etc/=%_sysconfdir/%realname/=; \
+ s=/usr/local/nagios/test/var=/var/log/%realname=" ${f} > ${F}
+ mv ${F} ${f}
+done
+popd 1>/dev/null
%install
-install -d -m 0775 ${RPM_BUILD_ROOT}/var/spool/nagios
-install -d -m 0775 ${RPM_BUILD_ROOT}/var/log/nagios
-install -d -m 0775 ${RPM_BUILD_ROOT}/var/log/nagios/archives
-install -d -m 0755 ${RPM_BUILD_ROOT}%{_prefix}/include/nagios
-install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
-install -d -m 0755 ${RPM_BUILD_ROOT}/%{apache2_sysconfdir}/conf.d/
-install -d -m 0755 ${RPM_BUILD_ROOT}/etc/logrotate.d/
-install -d -m 0755 ${RPM_BUILD_ROOT}%{nslockfile_dir}
-cp %{S:2} quick-start.txt
-chmod 644 quick-start.txt
-touch ${RPM_BUILD_ROOT}%{nslockfile}
-make DESTDIR=$RPM_BUILD_ROOT INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS= STRIP=: install
-make DESTDIR=$RPM_BUILD_ROOT INSTALL_OPTS="" COMMAND_OPTS="" INIT_OPTS= CGICFGDIR=/etc/nagios install-config
-# devel
-install -m 0644 include/locations.h ${RPM_BUILD_ROOT}%{_prefix}/include/nagios
-#
-cd contrib
-make DESTDIR=$RPM_BUILD_ROOT INSTALL=install CGIDIR=%{_prefix}/lib/nagios/cgi INSTALL_OPTS= install
-cd ..
-install -d -m 755 $RPM_BUILD_ROOT%{_prefix}/lib/nagios/plugins
+mkdir -p %buildroot/var/log/%realname/archives
+mkdir -p %buildroot/%_sbindir
+mkdir -p %buildroot/%_sysconfdir/init.d
+mkdir -p %buildroot/%apache2_sysconfdir/
+mkdir -p %buildroot/%nslockfile_dir
+mkdir -p %buildroot/%_sysconfdir/cron.weekly
+%{__make} install install-commandmode install-config install-webconf \
+ DESTDIR="%buildroot" \
+ INSTALL_OPTS="" \
+ COMMAND_OPTS="" \
+ CGICFGDIR="%_sysconfdir/%realname" \
+ INIT_OPTS=""
+%{__make} install -C contrib \
+ DESTDIR="%buildroot" \
+ INSTALL_OPTS=""
+# install event handlers
+%{__install} -d -m0755 %buildroot%_prefix/lib/%realname/plugins/eventhandlers/
+%{__cp} -afpv contrib/eventhandlers/* %buildroot%_prefix/lib/%realname/plugins/eventhandlers/
+# install directory for event brokers like ndoutils
+%{__install} -d -m0755 %buildroot%_prefix/lib/%realname/brokers
+# install headers for development package
+%{__install} -d -m0755 %buildroot%_includedir/%realname/
+pushd include
+for file in *.h; do
+ if test "x${file}" != "xconfig.h" -a "x${file}" != "xsnprintf.h" -a "x${file}" != "xcgiutils.h" ; then
+ install -m 644 $file %buildroot%_includedir/%realname/
+ fi;
+done
+popd
+#
+# cleanup sample-conf dir for including in docdir
+#
+find sample-config/ -name "*.in" -exec rm {} \;
+find sample-config/ -name "*.in.orig" -exec rm {} \;
+sed -e 's|command_file=.*|command_file=/var/spool/%realname/nagios.cmd|g' \
+ -e 's|log_file=/var/lib/nagios/nagios.log|log_file=/var/log/nagios/nagios.log|g' \
+ -e 's|log_archive_path=/var/lib/nagios/archives|log_archive_path=/var/log/nagios/archives|g' \
+ %buildroot/%_sysconfdir/%realname/nagios.cfg > %buildroot/%_sysconfdir/%realname/nagios.cfg.tmp
+mv %buildroot/%_sysconfdir/%realname/nagios.cfg.tmp %buildroot/%_sysconfdir/%realname/nagios.cfg
+#
# install SuSE specials
-cp %{SOURCE3} $RPM_BUILD_ROOT/%{apache2_sysconfdir}/conf.d/nagios.conf
-sed "s@^NAGIOS_PID=.*@NAGIOS_PID=%{nslockfile}@" %{SOURCE1} > $RPM_BUILD_ROOT/etc/init.d/nagios
-ln -sf ../../etc/init.d/nagios $RPM_BUILD_ROOT/usr/sbin/rcnagios
-install -m 644 %{SOURCE6} $RPM_BUILD_ROOT/etc/logrotate.d/nagios
+#
+# README.SuSE file
+sed -e 's@DATADIR@%_datadir/%realname@g' -e 's@SYSCONFDIR@%_sysconfdir/%realname@g' %{SOURCE10} > %_builddir/%realname-%version/README.SuSE
+# init-script
+install -m755 %{SOURCE1} %buildroot/%_sysconfdir/init.d/%realname
+ln -sf ../../etc/init.d/%realname %buildroot/%_sbindir/rc%realname
+# sysconfig script
+mkdir -p %buildroot/var/adm/fillup-templates/
+install -m 644 %{SOURCE3} %buildroot/var/adm/fillup-templates/sysconfig.nagios
+%if 0%{?suse_version} > 1020
+%fdupes -s %buildroot
+%endif
+# install cronjob (gzip' the logfiles)
+install -m640 %{SOURCE4} %buildroot/%_sysconfdir/cron.weekly/
+# important ghost files
+touch %buildroot%_sysconfdir/%realname/htpasswd.users
+touch %buildroot/var/lib/%realname/retention.dat
+touch %buildroot/var/lib/%realname/status.dat
+touch %buildroot/var/log/%realname/config.err
+touch %buildroot%nslockfile
+
+%clean
+rm -rf %buildroot
%pre
-/usr/sbin/groupadd -r nagios 2> /dev/null || :
-/usr/sbin/useradd -r -o -g nagios -s /bin/false -c "User for Nagios" -d /var/lib/nagios nagios 2> /dev/null || :
+# Create user and group on the system if necessary
+# default group: nagios
+if
+ getent group %nsgrp >/dev/null
+then
+ : OK group %nsgrp already present
+else
+ groupadd -r %nsgrp 2>/dev/null || :
+ %nnmmsg "Added group %nsgrp for package %name"
+fi
+# default group: nagcmd
+if
+ getent group %cmdgrp >/dev/null
+then
+ : OK group %cmdgrp already present
+else
+ groupadd -r %cmdgrp 2>/dev/null || :
+ %nnmmsg "Added group %cmdgrp for package %name"
+fi
+# default user: nagios
+if
+ id %nsusr > /dev/null 2>&1
+then
+ : OK user %nsusr already present
+else
+ useradd -r -o -g %nsgrp -s /bin/false -c "User for Nagios" -d /var/lib/%realname %nsusr 2> /dev/null || :
+ %nnmmsg "Added user %nsusr for package %name"
+fi
+# update?
+if [ ${1:-0} -gt 1 ]; then
+ # in the past, group www was used as cmdgrp - now we use the default: nagcmd
+ if id -Gn %nsusr 2>/dev/null | grep -q %{cmdgrp} >/dev/null 2>&1 ; then
+ : # %nsusr is already in %cmdgrp group
+ else
+ # Add %nsusr to %cmdgrp.
+ groupmod -A %nsusr %cmdgrp 2>/dev/null
+ %nnmmsg "Added %nsusr to %cmdgrp"
+ fi
+fi
%post
-%{fillup_and_insserv nagios}
+%{fillup_and_insserv -n %realname %realname}
# Update ?
-if [ ${FIRST_ARG:-0} -gt 1 ]; then
- if [ -f /etc/nagios/nagios.cfg ]; then
- if ! grep -q lock_file=%{nslockfile} /etc/nagios/nagios.cfg ; then
- echo "updating pid lock_file= to %{nslockfile} in /etc/nagios/nagios.cfg"
- sed -i "s@^lock_file=.*@lock_file=%{nslockfile}@" /etc/nagios/nagios.cfg
+if [ ${1:-0} -gt 1 ]; then
+ if [ -f %_sysconfdir/%realname/nagios.cfg ]; then
+ DATE=`date +%Y-%m-%d-%H:%M`
+ TMPFILE=`mktemp /tmp/%relname-XXXXXX`
+ NAGIOS_CFG=%_sysconfdir/%realname/nagios.cfg
+ cp $NAGIOS_CFG ${NAGIOS_CFG}_${DATE}
+ if ! grep -q ^lock_file=%nslockfile $NAGIOS_CFG ; then
+ echo "- updating pid lock_file= to %nslockfile in $NAGIOS_CFG" >> $TMPFILE
+ sed -i "s@^lock_file=.*@lock_file=%{nslockfile}@" $NAGIOS_CFG
+ fi
+ if grep -q ^service_reaper_frequency $NAGIOS_CFG ; then
+ echo "- renaming service_reaper_frequency to check_result_reaper_frequency in $NAGIOS_CFG" >> $TMPFILE
+ sed -i "s@service_reaper_frequency@check_result_reaper_frequency@" $NAGIOS_CFG
+ fi
+ if grep -q ^aggregate_status_updates $NAGIOS_CFG ; then
+ echo "- aggregate_status_updates option has been removed from $NAGIOS_CFG" >> $TMPFILE
+ sed -i "s@^aggregate_status_updates@# aggregate_status_updates@" $NAGIOS_CFG
+ fi
+ if grep -q ^downtime_file $NAGIOS_CFG ; then
+ set -- `grep ^downtime_file $NAGIOS_CFG | sed 's@=@ @'`
+ shift
+ file=$(echo $*)
+ if [ -n $file ]; then
+ if [ -f $file ]; then
+ set -- `grep ^state_retention_file $NAGIOS_CFG | sed 's@=@ @'`
+ shift
+ state_retention_file=$(echo $*)
+ echo "- adding the content of of $file to $state_retention_file" >> $TMPFILE
+ cat $file >> $state_retention_file
+ fi
+ fi
+ echo "- removing downtime_file variable (no longer supported) in $NAGIOS_CFG" >> $TMPFILE
+ sed -i "s@^downtime_file@# downtime_file@" $NAGIOS_CFG
+ fi
+ if grep -q ^comment_file $NAGIOS_CFG ; then
+ set -- `grep ^comment_file $NAGIOS_CFG | sed 's@=@ @'`
+ shift
+ file=$(echo $*)
+ if [ -n $file ]; then
+ if [ -f $file ]; then
+ echo "- adding the content of $file to $state_retention_file" >> $TMPFILE
+ cat $file >> $state_retention_file
+ fi
+ fi
+ echo "- removing comment_file variable (no longer supported) in $NAGIOS_CFG" >> $TMPFILE
+ sed -i "s@^comment_file@# comment_file@" $NAGIOS_CFG
+ fi
+ %nnmmsg `cat $TMPFILE`
+ rm $TMPFILE
+ fi
+else
+ # First installation: create an alias for the default nagiosadmin user
+ if [ -r /etc/aliases ]; then
+ if ! grep -q "^nagiosadmin:" /etc/aliases; then
+ echo -e "nagiosadmin:\troot" >> /etc/aliases
+ if [ -x /usr/bin/newaliases ]; then
+ /usr/bin/newaliases &>/dev/null
+ else
+ %nnmmsg "Cannot execute newaliases. Please run it manually."
+ fi
fi
fi
fi
%preun
-%stop_on_removal nagios
+%stop_on_removal %realname
%postun
-if test -f %{nslockfile}
-then
- chown -v %{nagios} %{nslockfile}
+if [ -f %nslockfile ]; then
+ chown -v %nsusr %nslockfile
fi
-%restart_on_update nagios
+%restart_on_update %realname
%{insserv_cleanup}
-%clean
-rm -rf $RPM_BUILD_ROOT
+%post www
+wwwusr=""
+if [ -f etc/apache2/uid.conf ]; then
+ # 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/uid.conf`
+fi
+if [ "z" == "z$wwwusr" ]; then # otherwise, use the default
+ wwwusr=%cmdusr
+fi
+# if apache user is not in cmdgrp, add it
+if id -Gn $wwwusr 2>/dev/null | grep -q %cmdgrp >/dev/null 2>&1 ; then
+ : # $wwwusr (default: %cmdusr) is already in nagiocmd group
+else
+ # modify apache user, adding it to cmdgrp
+ groupmod -A $wwwusr %{cmdgrp} 2>/dev/null
+ %nnmmsg "User $wwwusr added to group %{cmdgrp} so sending commands to Nagios from the CGI is possible."
+fi
+%restart_on_update apache2
+
+%preun www
+%restart_on_update apache2
%files
%defattr(-,root,root)
-%doc quick-start.txt
-%dir %{_prefix}/lib/nagios
-%dir %{_prefix}/lib/nagios/plugins
-%dir /etc/nagios
-%dir %{_prefix}/include/nagios
-%dir %attr(755,%{nsusr},%{nsgrp}) /var/lib/nagios
-%dir %attr(755,%{nsusr},%{nsgrp}) /var/log/nagios
-%dir %attr(755,%{nsusr},%{nsgrp}) /var/log/nagios/archives
-%dir %attr(2775,%{nsusr},%{cmdgrp}) /var/spool/nagios
-%dir %attr(755,%{nsusr},%{nsgrp}) %{nslockfile_dir}
-%attr(0644,%{nsusr},%{nsgrp}) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nagios/nagios.pid
-%attr(0744,root,root) %config /etc/init.d/nagios
-%attr(0755,root,root) %{_prefix}/sbin/*
-%attr(0644,root,root) %{_prefix}/lib/nagios/p1.pl
-%{_prefix}/include/nagios/locations.h
-%config(noreplace) /etc/nagios/[!r]*
-%attr(640,root,%nsgrp) %config(noreplace) /etc/nagios/resource.cfg
-%config /etc/logrotate.d/nagios
-%doc Changelog LICENSE README* UPGRADING
+%doc Changelog LICENSE README README.SuSE sample-config/
+%dir %_sysconfdir/%realname
+%dir %_sysconfdir/%realname/objects
+%dir %attr(755,%nsusr,%nsgrp) /var/lib/%realname
+%dir %attr(755,%nsusr,%nsgrp) /var/log/%realname
+%dir %attr(755,%nsusr,%nsgrp) /var/log/%realname/archives
+%dir %attr(755,%nsusr,%nsgrp) %nslockfile_dir
+%dir %attr(2775,%nsusr,%cmdgrp) /var/spool/%realname
+%attr(0755,root,root) %_sysconfdir/init.d/%realname
+%attr(0644,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/%realname/%realname.pid
+%attr(0600,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/%realname/retention.dat
+%attr(0664,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/%realname/status.dat
+%ghost %config(missingok,noreplace) /var/log/%realname/config.err
+%config(noreplace) %_sysconfdir/%realname/*.cfg
+%config(noreplace) %_sysconfdir/%realname/objects/*.cfg
+/var/adm/fillup-templates/sysconfig.nagios
+%defattr(755,root,root)
+%_sbindir/nagios
+%_sbindir/nagiostats
+%_sbindir/mini_epn
+%_sbindir/new_mini_epn
+%_sbindir/convertcfg
+%_sbindir/rc%realname
+%_sysconfdir/cron.weekly/*
+%_prefix/lib/%realname/
+%exclude %_prefix/lib/%realname/cgi/*
%files www
+%defattr(755,root,root)
+%_prefix/lib/%realname/cgi/*
+%defattr(-,root,root)
+%_datadir/%realname/
+%config(noreplace) %{apache2_sysconfdir}/%realname.conf
+%attr(0640,root,%cmdgrp) %ghost %config(missingok,noreplace) %_sysconfdir/%realname/htpasswd.users
+
+%files devel
%defattr(-,root,root)
-%dir %{_prefix}/lib/nagios/cgi
-%dir %{_prefix}/share/nagios
-%{_prefix}/lib/nagios/cgi/*
-%{_prefix}/share/nagios/*
-%dir %{apache2_sysconfdir}/conf.d
-%config(noreplace) %{apache2_sysconfdir}/conf.d/*
+%dir %_includedir/%realname
+%_includedir/%realname/*
+
++++++ nagios-p1.pl-location.patch ++++++
Index: Makefile.in
===================================================================
--- Makefile.in.orig
+++ Makefile.in
@@ -24,6 +24,7 @@
LOGDIR=@localstatedir@
CHECKRESULTDIR=@CHECKRESULTDIR@
CFGDIR=@sysconfdir@
+P1PLDIR=@p1pldir@
BINDIR=@bindir@
CGIDIR=@sbindir@
LIBEXECDIR=@libexecdir@
@@ -190,7 +191,7 @@
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CHECKRESULTDIR)
if [ $(INSTALLPERLSTUFF) = yes ]; then \
- $(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(BINDIR); \
+ $(INSTALL) -m 664 $(INSTALL_OPTS) p1.pl $(DESTDIR)$(P1PLDIR); \
fi;
@echo ""
Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -16,6 +16,7 @@
dnl Figure out how to invoke "install" and what install options to use.
AC_PROG_INSTALL
AC_SUBST(INSTALL)
+AC_SUBST(P1PLDIR)
dnl What OS are we running?
AC_CANONICAL_HOST
Index: include/locations.h.in
===================================================================
--- include/locations.h.in.orig
+++ include/locations.h.in
@@ -39,5 +39,5 @@
#define DEFAULT_OBJECT_CACHE_FILE "@localstatedir@/objects.cache"
#define DEFAULT_PRECACHED_OBJECT_FILE "@localstatedir@/objects.precache"
#define DEFAULT_EVENT_BROKER_FILE "@localstatedir@/broker.socket"
-#define DEFAULT_P1_FILE "@bindir@/p1.pl" /**** EMBEDDED PERL ****/
+#define DEFAULT_P1_FILE "@p1pldir@/p1.pl" /**** EMBEDDED PERL ****/
#define DEFAULT_AUTH_FILE "" /**** EMBEDDED PERL - IS THIS USED? ****/
Index: sample-config/nagios.cfg.in
===================================================================
--- sample-config/nagios.cfg.in.orig
+++ sample-config/nagios.cfg.in
@@ -1047,7 +1047,7 @@
# embedded Perl interpreter) is located. If you didn't compile
# Nagios with embedded Perl support, this option has no effect.
-p1_file=@bindir@/p1.pl
+p1_file=@p1pldir@/p1.pl
++++++ rcnagios ++++++
--- nagios/rcnagios 2006-12-01 10:22:06.000000000 +0100
+++ /mounts/work_src_done/STABLE/nagios/rcnagios 2008-03-05 18:19:38.000000000 +0100
@@ -1,8 +1,10 @@
#! /bin/sh
# Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
# 2002 SuSE Linux AG Nuernberg, Germany.
+# 2007 SuSE Linux GmbH Nuernberg, Germany.
#
-# Author: Wolfgang Rosenauer
+# Author: Wolfgang Rosenauer, Lars Vogdt
+#
#
# /etc/init.d/nagios
#
@@ -13,98 +15,233 @@
# System startup script for nagios
#
### BEGIN INIT INFO
-# Provides: nagios
-# Required-Start: $remote_fs $syslog $network
-# Required-Stop: $remote_fs $syslog
+# Provides: nagios
+# Required-Start: $local_fs $remote_fs $syslog $network
+# Required-Stop: $local_fs $remote_fs $syslog $network
+# Should-Start: $time sendmail httpd2 xntpd $named cron
+# Should-Stop: sendmail
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
-# Description: network monitor nagios
+# Short-Description: Network monitor Nagios
+# Description: Starts and stops the Nagios monitor
+# used to provide network services status for hosts,
+# services and networks.
### END INIT INFO
. /etc/rc.status
-USR=nagios
-NAGIOS_PID=/var/run/nagios.pid
NAGIOS_BIN=/usr/sbin/nagios
NAGIOS_CFG=/etc/nagios/nagios.cfg
-NAGIOS_SAV=/var/log/nagios/status.sav
-NAGIOS_LOG=/var/log/nagios/nagios.log
-NAGIOS_TMP=/var/log/nagios/nagios.tmp
-
-
-test -x $NAGIOS_BIN || exit 5
+NAGIOS_SYSCONFIG=/etc/sysconfig/nagios
+NAGIOS_CFG_ERR_LOG=/var/log/nagios/config.err
+# Read config and log errors in logfile
function config_check () {
- $NAGIOS_BIN -v $NAGIOS_CFG > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- return 0
+ $NAGIOS_BIN -v $NAGIOS_CFG > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ return 0
+ else
+ $NAGIOS_BIN -v $NAGIOS_CFG > $NAGIOS_CFG_ERR_LOG 2>&1
+ return 1
+ fi
+}
+
+# grab a config option
+function get_var() {
+ if [ -n "$2" ]; then
+ set -- `grep ^$1 $2 | sed 's@=@ @'`
else
- $NAGIOS_BIN -v $NAGIOS_CFG > /var/log/nagios/config.err 2>&1
- return 1
+ set -- `grep ^$1 $NAGIOS_CFG | sed 's@=@ @'`
+ fi
+ shift # remove first ARG => search-string
+ echo $*
+}
+
+# check some default files and directories
+function check_files() {
+ # set default access rights for files and directories
+ for file in $check_result_path $log_file $state_retention_file $status_file; do
+ if [ -e $file ]; then
+ touch $file
+ chown $nagios_user:$nagios_cmdgrp $file
fi
+ done
+ chmod 640 $resource_file
+ # remove some perhaps left over files
+ for file in $command_file $lock_file $status_file $temp_file /var/lock/subsys/nagios; do
+ test -f $file && rm -f $file
+ done
}
+# Check for missing binaries (stale symlinks should not happen)
+# Note: Special treatment of stop for LSB conformance
+test -x $NAGIOS_BIN || { echo "$NAGIOS_BIN not installed";
+ if [ "$1" = "stop" ]; then exit 0;
+ else exit 5; fi; }
+
+# Check for existence of needed config file
+test -r $NAGIOS_CFG || { echo "$NAGIOS_CFG not existing";
+ if [ "$1" = "stop" ]; then exit 0;
+ else exit 6; fi; }
+
+# Check for existence of sysconfig file and read it
+test -r $NAGIOS_SYSCONFIG || { echo "$NAGIOS_SYSCONFIG not existing";
+ if [ "$1" = "stop" ]; then exit 0;
+ else exit 6; fi; }
+
+. $NAGIOS_SYSCONFIG
+
+# set values for sysconfig vars
+if [ -n "$NAGIOS_NICELEVEL" ]; then
+ NICELEVEL="-n $NAGIOS_NICELEVEL"
+else
+ NICELEVEL="-n 0"
+fi
+if [ -z "$NAGIOS_TIMEOUT" ]; then
+ NAGIOS_TIMEOUT=10
+fi
+
+#
+# get variables from config file
+#
+nagios_user="$(get_var nagios_user)"
+lock_file="$(get_var lock_file)"
+status_file="$(get_var status_file)"
+log_file="$(get_var log_file)"
+temp_file="$(get_var temp_file)"
+state_retention_file="$(get_var state_retention_file)"
+command_file="$(get_var command_file)"
+resource_file="$(get_var resource_file)"
+object_cache_file="$(get_var object_cache_file)"
+check_result_path="$(get_var check_result_path)"
+
+#
+# use default values if above check doesn't work
+#
+: ${nagios_user:=nagios}
+: ${nagios_cmdgrp:=nagcmd}
+: ${resource_file:=/etc/nagios/resource.cfg}
+# check ownership files
+: ${check_result_path:=/var/spool/nagios}
+: ${log_file:=/var/log/nagios/nagios.log}
+: ${state_retention_file:=/var/log/nagios/retention.dat}
+: ${status_file:=/var/log/nagios/status.dat}
+# files to remove
+: ${command_file:=/var/spool/nagios/nagios.cmd}
+: ${lock_file:=/var/run/nagios.pid}
+: ${object_cache_file:=/var/lib/nagios/objects.cache}
+: ${temp_file:=/var/log/nagios/nagios.tmp}
+
+# Reset status of this service
rc_reset
+
case "$1" in
start)
- echo -n "Starting nagios "
+ echo -n "Starting nagios "
config_check
- if [ $? -eq 0 ]; then
- su $USR -c "touch $NAGIOS_LOG $NAGIOS_SAV"
- startproc -p $NAGIOS_PID $NAGIOS_BIN -d $NAGIOS_CFG
+ if [ $? -eq 0 ]; then
+ # check if nagios is already running
+ NAGPID=$(pidof $NAGIOS_BIN)
+ if [ -n "$NAGPID" ]; then
+ echo "- Error: looks like nagios is still running with PID $NAGPID"
+ echo -n "- trying to kill previous nagios process"
+ kill -9 $NAGPID
+ sleep 2
+ fi
+ check_files
+ startproc $NICELEVEL -p $lock_file $NAGIOS_BIN -d $NAGIOS_CFG
else
- echo "- Error in configuration files"
- echo -n "- please read /var/log/nagios/config.err"
- rc_failed
+ echo "- Error in configuration files"
+ echo -n "- please read $NAGIOS_CFG_ERR_LOG"
+ rc_failed
fi
- rc_status -v
- ;;
+ rc_status -v
+ ;;
stop)
- echo -n "Shutting down nagios "
- killproc -TERM -p $NAGIOS_PID $NAGIOS_BIN
- rm -f /var/lock/subsys/nagios $NAGIOS_TMP $NAGIOS_PID
- rc_status -v
- ;;
+ echo -n "Shutting down nagios "
+ # we have to wait for nagios to exit and remove its
+ # own Lockfile, otherwise a following "start" could
+ # happen, and then the exiting nagios will remove the
+ # new Lockfile, allowing multiple nagios daemons
+ # to (sooner or later) run - John Sellens
+
+ if checkproc $NAGIOS_BIN ; then
+ killproc -p $lock_file -TERM $NAGIOS_BIN
+ sleep 1
+ if [ -e $lock_file ]; then
+ echo "Warning - nagios did not exit in a timely manner. Waiting..."
+ while [ -e $lock_file ] && [ $NAGIOS_TIMEOUT -gt 0 ] ; do
+ sleep 1
+ NAGIOS_TIMEOUT=$[$NAGIOS_TIMEOUT-1]
+ echo -n '.'
+ [ $NAGIOS_TIMEOUT -eq 41 ] && echo
+ done
+ fi
+ if checkproc $NAGIOS_BIN ; then
+ killproc -p $lock_file -SIGKILL $NAGIOS_BIN
+ echo -n "Warning: nagios killed"
+ fi
+ else
+ echo -n "nagios not running"
+ rc_failed 7
+ fi
+ check_files
+ rc_reset
+ rc_status -v
+ ;;
try-restart)
- ## Do a restart only if the service was active before.
- ## Note: try-restart is now part of LSB (as of 1.9).
- ## RH has a similar command named condrestart.
- $0 status
- if test $? = 0; then
- $0 restart
- else
- rc_reset # Not running is not a failure.
- fi
- # Remember status and be quiet
- rc_status
- ;;
+ ## Do a restart only if the service was active before.
+ ## Note: try-restart is now part of LSB (as of 1.9).
+ ## RH has a similar command named condrestart.
+ $0 status
+ if test $? = 0; then
+ $0 restart
+ else
+ rc_reset # Not running is not a failure.
+ fi
+ # Remember status and be quiet
+ rc_status
+ ;;
restart)
- $0 stop
- $0 start
- rc_status
- ;;
+ $0 stop
+ $0 start
+ rc_status
+ ;;
reload|force-reload)
echo -n "Reload service nagios "
config_check
if [ $? -eq 0 ]; then
echo -n "Passed configuration check - reloading..."
- killproc -HUP -p $NAGIOS_PID $NAGIOS_BIN
+ killproc -HUP -p $lock_file $NAGIOS_BIN
else
echo "- Error in configuration files"
- echo -n "- aborting reload - please read /var/log/nagios/config.err"
+ echo -n "- aborting reload - please read $NAGIOS_CFG_ERR_LOG"
rc_failed
fi
rc_status -v
- ;;
+ ;;
status)
- echo -n "Checking for nagios "
- checkproc -p $NAGIOS_PID $NAGIOS_BIN
- rc_status -v
- ;;
+ echo -n "Checking for nagios "
+ checkproc -p $lock_file $NAGIOS_BIN
+ rc_status -v
+ ;;
+ check)
+ echo "Running configuration check..."
+ config_check
+ if [ $? -eq 0 ]; then
+ echo -n "- Passed configuration check"
+ test -f $NAGIOS_CFG_ERR_LOG && rm $NAGIOS_CFG_ERR_LOG
+ rc_reset
+ else
+ echo "- Error in configuration files"
+ echo -n "- please read $NAGIOS_CFG_ERR_LOG"
+ rc_failed
+ fi
+ rc_status -v
+ ;;
*)
- echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
+ echo "Usage: $0 {start|stop|status|try-restart|restart|reload|check}"
exit 1
;;
esac
rc_exit
-
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org