Hello community, here is the log from the commit of package nagios.1308 for openSUSE:12.1:Update checked in at 2013-02-14 10:18:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:12.1:Update/nagios.1308 (Old) and /work/SRC/openSUSE:12.1:Update/.nagios.1308.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nagios.1308", Maintainer is "" Changes: -------- New Changes file: --- /dev/null 2013-02-09 11:18:20.872010756 +0100 +++ /work/SRC/openSUSE:12.1:Update/.nagios.1308.new/nagios.changes 2013-02-14 10:18:15.000000000 +0100 @@ -0,0 +1,979 @@ +------------------------------------------------------------------- +Thu Jan 31 15:58:10 UTC 2013 - l...@linux-schulserver.de + +- refreshed nagios-history_buffer_overflow.patch bnc#797237 + +------------------------------------------------------------------- +Mon Jan 14 16:12:16 UTC 2013 - l...@linux-schulserver.de + +- avoid stack based buffer overflow in web interface (history): + added nagios-history_buffer_overflow.patch - (bnc ##797237) + fixes CVE-2012-6096 + +------------------------------------------------------------------- +Fri Oct 7 18:37:43 UTC 2011 - l...@linux-schulserver.de + +- also check (and fix) the ownership of the directory where + $status_file lives - Nagios uses this directory for temporary + files + +------------------------------------------------------------------- +Mon Aug 1 18:43:41 UTC 2011 - schneem...@b1-systems.de + +- update to 3.3.1 + + FIXES + * Fixes status.cgi when called with no parameters, where host should be + set to all if none specified (Michael Friedrich) + * Fixes possible validation error with empty hostgroups/servicegroups + (Sven-Göran Bergh) + * Performance-data handling and checking is now thread-safe so long as + embedded perl is not used. + * Children should no longer hang on mutex locks held in parent for + localtime() (and similar) calls. + * Debug logging is now properly serialized, using soft-locking with a + timeout of 150 milliseconds to avoid multiple threads competing for the + privilege to write debug info. + * Fixed extraneous alerts for services when host is down + * Fixed incorrect parsing of multi-line host check results (Jochen Bern) + * Fixed bug with passive host checks being incorrectly sent to event + brokers as active checks + * Fixed bug where passive host check status updates were not being + propagated to event brokers + +------------------------------------------------------------------- +Tue Jul 26 21:06:13 UTC 2011 - andrea.turr...@gmail.com + +- fixed typos in nagios.spec + +-------------------------------------------------------------------- +Fri Jul 8 11:35:37 UTC 2011 - l...@linux-schulserver.de + +- removed setuid bit from /var/spool/nagios - configure the + right permissions on service start instead +- use the right STDERR in the cron script +- cleanup files section + +------------------------------------------------------------------- +Tue Jul 5 14:57:40 UTC 2011 - l...@linux-schulserver.de + +- integrated cron script from Daniel Kozar (bnc#701208) + +------------------------------------------------------------------- +Mon Jul 4 17:03:22 UTC 2011 - l...@linux-schulserver.de + +- fixes in init script if check_external_commands are enabled +- added nagios-3.2.3-CVE-2011-1523.patch to fix + CVE-2011-1523 (bnc#682966) + +------------------------------------------------------------------- +Sun Mar 13 16:21:14 UTC 2011 - l...@linux-schulserver.de + +- install /var/spool/nagios with setgroup bit set, so all new files + in this directory belong to the command group (maybe we should + use a permissions file for this?) + +------------------------------------------------------------------- +Wed Oct 6 19:49:37 UTC 2010 - l...@linux-schulserver.de + +- update to 3.2.3: + + Fixes problem where disabling all active hosts/services was not + taking effect + + Fixes for compiler warnings (code cleanup by Stephen Gran) + + Fixes for format errors in event handler logging (Guillaume Rousse) + + Fixed incorrect info in sample nagios.cfg file for + state_retention_file (Michael Friedrich) + + Fixed broker_event_handler() to return ERR if data is NULL + (Michael Friedrich) +- rebased all patches +- adapted nagios-disable_phone_home.patch + +------------------------------------------------------------------- +Mon Sep 20 09:50:56 UTC 2010 - schneem...@b1-systems.de + +- removed unneeded filter "permissions-directory-setuid-bit" from + nagios-rpmlintrc + +------------------------------------------------------------------- +Tue Sep 7 06:43:37 UTC 2010 - schneem...@b1-systems.de + +- cleaned spec and sources, removed unused patches from source + +------------------------------------------------------------------- +Wed Sep 1 22:37:22 UTC 2010 - schneem...@b1-systems.de + +- reworked phone-home patch + +------------------------------------------------------------------- +Wed Sep 1 22:14:55 UTC 2010 - schneem...@b1-systems.de + +- Update to nagios 3.2.2, excerpt from changelog: +FIXES +* Fix for choosing next valid time on day of DST change when clocks go +one hour backwards +* Fix for nagios now erroring when "Error: Could not find any +contactgroup matching..." displayed +* Fix tap tests for Solaris 10 and newer versions of Test::Harness +* Fix for notifications not being sent out when scheduled downtime is +cancelled (Daniel Pouzzner) +* Fix for first notification delay being calculated incorrectly, and +notifications potentially going out early (Pawel Malachowski) +* Fix for text of scheduling downtime of all services on a host (Holger +Weiss) +* Fix for services inheriting notification period from hosts if not +defined (Gordon Messmer) +* Fix for incorrect service states on host failures (bug #130 Petya Kohts) +* Fix for incorrect service state attributes being set on host failures +(bug #128 Petya Kohts) +* Fix for non-scheduled hosts and services not being updated in NDOUtils +* Fix for incorrect host state counts in status CGI when viewing +servicegroups (bug #72) +* Fix for new Splunk integration query parameters (bug #136) +* Fix for extra field header in availability CSV export (bug #113) +* Fix for macro processing code modifying input string (Jochen Bern) +* Fix for event execution loop re-scheduling host checks instead of +executing them if service checks are disabled (bug #152) +* Fix for segfaults on Solaris (Torsten Huebler) +* Fix for incorrect comment expiration times being passed to event +broker (Mattieu Kermagot) + +------------------------------------------------------------------- +Thu Jul 15 20:56:09 UTC 2010 - l...@linux-schulserver.de + +- back to the old file permissions (once again for clean + nagios support) +- readded nonsense stuff again +- create/fix check_result_path if needed + +------------------------------------------------------------------- +Fri Jul 9 14:06:55 UTC 2010 - ch...@computersalat.de + +- fix file/dir perms + o once again for centreon support +- spec mods + o sort TAGS + o added lost Authors (description) + o macros + o remove nonsense stuff + +------------------------------------------------------------------- +Thu Jun 24 10:16:35 UTC 2010 - l...@linux-schulserver.de + +- rebase phone-home patch + +------------------------------------------------------------------- +Tue Jun 22 09:00:37 UTC 2010 - l...@linux-schulserver.de + +- recommend nagios-plugins only to avoid buildcycles + +------------------------------------------------------------------- +Fri Jun 18 01:16:09 UTC 2010 - l...@linux-schulserver.de + +- fix init script: touch files if they do not exist- + +------------------------------------------------------------------- +Fri May 28 05:03:43 UTC 2010 - l...@linux-schulserver.de + +- disable patch8 - needs rebasing +- install PIDDIR if it's not /var/run to avoid owner problems + during start +- always change ownership of standard files to the right values + +------------------------------------------------------------------- +Mon May 24 16:30:36 UTC 2010 - l...@linux-schulserver.de + +- fix 'Schedule downtime for this host and all services' behavior + (http://tracker.nagios.org/view.php?id=133) +- fix typos resulting in non used style declarations + (http://tracker.nagios.org/view.php?id=150) +- fix deleting comments from the hashlist + (http://tracker.nagios.org/view.php?id=80) +- rebase nagios-p1.pl-location.patch +- fix a handful compiler warnings +- do not allow nagios to phone home: disable online_update_checks +- fix command-group +- BuildRequire net-tools for enabling WAP + +------------------------------------------------------------------- ++++ 782 more lines (skipped) ++++ between /dev/null ++++ and /work/SRC/openSUSE:12.1:Update/.nagios.1308.new/nagios.changes New: ---- html-makefile.patch nagios-3.3.1.tar.bz2 nagios-README.SuSE nagios-disable_phone_home.patch nagios-fix_encoding_trends.cgi.patch nagios-fix_spurious_dollar_signs_added_to_command_lines.patch nagios-history_buffer_overflow.patch nagios-htpasswd.users nagios-p1.pl-location.patch nagios-rpmlintrc nagios.8 nagios.changes nagios.spec nagios.sysconfig nagiosstats.8 rcnagios suse.de-nagios ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nagios.spec ++++++ # # spec file for package nagios # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: nagios %define nsusr nagios %define nsgrp nagios %define cmdusr wwwrun %define cmdgrp nagcmd %define nslockfile_dir /var/run/%{name} %define nslockfile %nslockfile_dir/%{name}.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 Summary: The Nagios Network Monitor License: GPL-2.0+ Group: System/Monitoring Version: 3.3.1 Release: 0 Url: http://www.nagios.org/ Source0: %{name}-%{version}.tar.bz2 Source1: rc%{name} Source2: %{name}-rpmlintrc Source3: %{name}.sysconfig Source4: suse.de-nagios Source5: nagios.8 Source6: nagiosstats.8 Source7: nagios-htpasswd.users # Source10: %{name}-README.SuSE # PATCH-FIX-UPSTREAM Fixes the output of spurious $ signs in commandoutput (deb#480001) Patch2: nagios-fix_spurious_dollar_signs_added_to_command_lines.patch # PATCH-FIX-UPSTREAM unescape hex characters in CGI input - avoid addional '+' Patch3: nagios-fix_encoding_trends.cgi.patch # PATCH-FIX-OPENSUSE openSUSE uses a special location for p1.pl Patch10: nagios-p1.pl-location.patch # PATCH-FIX-OPENSUSE disable Nagios online update checks for distributed packages Patch11: nagios-disable_phone_home.patch # patch make errors comming with 3.3.1 Patch13: html-makefile.patch # fix CVE-2012-6096 Patch14: nagios-history_buffer_overflow.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %fillup_prereq PreReq: %insserv_prereq PreReq: /bin/logger PreReq: coreutils PreReq: grep PreReq: pwdutils PreReq: sed BuildRequires: apache2-devel BuildRequires: freetype2-devel BuildRequires: gd-devel BuildRequires: iputils BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: mailx BuildRequires: net-tools BuildRequires: openssl-devel BuildRequires: pcre-devel BuildRequires: zlib-devel %if 0%{?suse_version} < 1010 BuildRequires: XFree86-devel BuildRequires: XFree86-libs BuildRequires: libapr0 Requires: cron %else BuildRequires: libapr-util1-devel BuildRequires: xorg-x11-devel Recommends: cron Recommends: %{name}-www # we enable nagios embedded perl, but if people disable it... Recommends: perl = %{perl_version} %endif %if 0%{?suse_version} > 1020 BuildRequires: fdupes Recommends: %{name}-plugins %else Requires: %{name}-plugins %endif Requires: mailx %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 provides core programs for Nagios. The web interface, documentation, and development files are built as separate packages Authors: -------- Ethan Galstad <nag...@nagios.org> %package www Summary: Provides the HTML and CGI files for the Nagios web interface Group: System/Monitoring PreReq: /bin/logger PreReq: apache2 PreReq: coreutils PreReq: gawk PreReq: grep PreReq: pwdutils PreReq: sed Requires: %{name} = %{version} Requires: gd Requires: mod_php_any Requires: php5 %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. Authors: -------- Ethan Galstad <nag...@nagios.org> %package devel Summary: Development files for Nagios Group: Development/Libraries/C and C++ 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 <nag...@nagios.org> %prep %setup -q -n %{name} %patch2 -p0 %patch3 -p0 %patch10 -p0 %patch11 -p0 %patch13 -p0 %patch14 -p1 find -name ".gitignore" | xargs rm # fix p1.pl pathname of mini_epn sed -i 's|p1.pl|%{_prefix}/lib/%{name}/p1.pl|g' contrib/mini_epn.c sed -i 's|p1.pl|%{_prefix}/lib/%{name}/p1.pl|g' contrib/new_mini_epn.c %build # 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/%{name}/cgi \ --libexecdir=%{_prefix}/lib/%{name}/plugins \ --datadir=%{_datadir}/%{name} \ --sysconfdir=%{_sysconfdir}/%{name} \ --with-init-dir=%{_sysconfdir}/init.d \ --localstatedir=/var/lib/%{name} \ --with-cgiurl=/%{name}/cgi-bin \ --with-htmurl=/%{name} \ --with-httpd-conf=%{apache2_sysconfdir} \ --with-checkresult-dir=/var/spool/%{name} \ --with-lockfile=%{nslockfile} \ --with-nagios-user=%{nsusr} \ --with-nagios-group=%{nsgrp} \ --with-command-user=%{cmdusr} \ --with-command-group=%{cmdgrp} \ --with-gd-lib=%{_libdir} \ --with-gd-inc=%{_includedir} \ --with-template-objects \ --with-template-extinfo \ --with-perlcache \ --enable-event-broker \ --enable-embedded-perl # # /usr/bin/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/%{name}/#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 %{?jobs:-j%jobs} all make %{?jobs:-j%jobs} -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/%{name}/=; \ s=NscaBin\=\"/usr/local/nagios/libexec/send_nsca\"=NscaBin\=/usr/bin/send_nsca=; \ s=/usr/local/nagios/libexec/eventhandlers/=%{_prefix}/lib/%{name}/plugins/eventhandlers/=; \ s=/usr/local/nagios/libexec/=%{_prefix}/lib/%{name}/plugins/=; \ s=/usr/local/nagios/etc/=%{_sysconfdir}/%{name}/=; \ s=/usr/local/nagios/test/var=/var/log/%{name}=" ${f} > ${F} mv ${F} ${f} done popd 1>/dev/null %install mkdir -p %{buildroot}%{_localstatedir}/log/%{name}/archives mkdir -p %{buildroot}%{_sbindir} mkdir -p %{buildroot}%apache2_sysconfdir/ mkdir -p %{buildroot}%nslockfile_dir %{__make} install install-commandmode install-config install-webconf install-classicui\ DESTDIR=%{buildroot} \ INSTALL_OPTS="" \ COMMAND_OPTS="" \ CGICFGDIR="%{_sysconfdir}/%{name}" \ INIT_OPTS="" %{__make} install -C contrib \ DESTDIR=%{buildroot} \ INSTALL_OPTS="" # install event handlers %{__install} -d -m0755 %{buildroot}%{_prefix}/lib/%{name}/plugins/eventhandlers/ %{__cp} -afpv contrib/eventhandlers/* %{buildroot}%{_prefix}/lib/%{name}/plugins/eventhandlers/ find %{buildroot}%{_prefix}/lib/%{name}/plugins/eventhandlers/ -type f -exec chmod +x {} \; # install directory for event brokers like ndoutils %{__install} -d -m0755 %{buildroot}%{_prefix}/lib/%{name}/brokers # install headers for development package %{__install} -d -m0755 %{buildroot}%{_includedir}/%{name}/ 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}/%{name}/ 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/%{name}/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' \ -e 's|^lock_file=.*|lock_file=%nslockfile|g' \ %{buildroot}%{_sysconfdir}/%{name}/nagios.cfg > %{buildroot}%{_sysconfdir}/%{name}/nagios.cfg.tmp mv %{buildroot}%{_sysconfdir}/%{name}/nagios.cfg.tmp %{buildroot}%{_sysconfdir}/%{name}/nagios.cfg # # install SuSE specials # # README.SuSE file sed -e 's@DATADIR@%{_datadir}/%{name}@g' -e 's@SYSCONFDIR@%{_sysconfdir}/%{name}@g' %{S:10} > %_builddir/%{name}/README.SuSE # init-script %{__install} -D -m 0755 %{S:1} %{buildroot}%{_sysconfdir}/init.d/%{name} ln -sf ../../etc/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name} # sysconfig script %{__install} -D -m 0644 %{S:3} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name} # install cronjob (gzip' the logfiles) %{__install} -D -m 0755 %{S:4} %{buildroot}%{_sysconfdir}/cron.weekly/%{name} # install htpasswd file %{__install} -m 0640 %{S:7} %{buildroot}%{_sysconfdir}/%{name}/htpasswd.users # important ghost files touch %{buildroot}%{_localstatedir}/lib/%{name}/retention.dat touch %{buildroot}%{_localstatedir}/lib/%{name}/status.dat touch %{buildroot}%{_localstatedir}/log/%{name}/config.err touch %{buildroot}%nslockfile # install manpages install -Dm644 %{S:5} %{buildroot}%{_mandir}/man8/%{name}.8 install -Dm644 %{S:6} %{buildroot}%{_mandir}/man8/nagiosstats.8 # fixing permissions the dirty way.... for file in "README sample-config/README sample-config/template-object/README"; do chmod 644 $RPM_BUILD_DIR/%{name}/$file done # some rpmlint stuff %if 0%{?suse_version} > 1020 %fdupes -s %{buildroot}%{_datadir} %endif %clean %{__rm} -rf %{buildroot} %pre # 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/%{name} %{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} # Update ? if [ ${1:-0} -gt 1 ]; then if [ -f %{_sysconfdir}/%{name}/nagios.cfg ]; then DATE=$(date "+%Y-%m-%d-%H:%M") TMPFILE=$(mktemp /tmp/%{name}-XXXXXX) NAGIOS_CFG=%{_sysconfdir}/%{name}/nagios.cfg cp -f $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 %{nnmmsg} "Added alias for user nagiosadmin to /etc/aliases" if [ -x usr/bin/newaliases ]; then usr/bin/newaliases &>/dev/null || true else %{nnmmsg} "Cannot execute newaliases. Please run it manually." fi fi fi fi %preun %stop_on_removal %{name} %postun if [ -f %nslockfile ]; then chown -v %{nsusr} %{nslockfile} fi %restart_on_update %{name} %{insserv_cleanup} %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 Nagios cmd 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 # Update ? if [ ${1:-0} -eq 1 ]; then if [ -x %{_sbindir}/a2enmod ]; then # enable authentification in apache config %{_sbindir}/a2enmod authn_file >/dev/null %{_sbindir}/a2enmod auth_basic >/dev/null %{_sbindir}/a2enmod authz_user >/dev/null # enable php5 in apache config %{_sbindir}/a2enmod php5 fi fi %restart_on_update apache2 %preun www %restart_on_update apache2 %files %defattr(-,root,root) %doc Changelog LEGAL LICENSE README README.SuSE sample-config/ %{_mandir}/man8/%{name}* %_sysconfdir/init.d/%name %ghost %config(missingok,noreplace) /var/log/%name/config.err %config(noreplace) %_sysconfdir/%name/*.cfg %config(noreplace) %_sysconfdir/%name/objects/*.cfg %{_localstatedir}/adm/fillup-templates/sysconfig.%{name} %{_sysconfdir}/cron.weekly/* %{_prefix}/lib/%name/ %attr(0755,root,root) %{_prefix}/lib/%name/p1.pl %exclude %{_prefix}/lib/%name/cgi/* %{_sbindir}/convertcfg %{_sbindir}/mini_epn %{_sbindir}/new_mini_epn %{_sbindir}/rc%name # defattr change %defattr(-,%{nsusr},%{cmdgrp}) %dir %_sysconfdir/%name %dir %_sysconfdir/%name/objects %dir /var/spool/%{name} # defattr change %defattr(-,%{nsusr},%nsgrp) %dir /var/lib/%name %dir /var/log/%name %dir /var/log/%name/archives %ghost %dir %nslockfile_dir %attr(0644,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %nslockfile %attr(0600,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/%name/retention.dat %attr(0664,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/lib/%name/status.dat %attr(0750,root,%{cmdgrp}) %{_sbindir}/%{name} %attr(0750,root,%{cmdgrp}) %{_sbindir}/nagiostats %files www %defattr(755,root,root) %{_prefix}/lib/%{name}/cgi/* # defattr change %defattr(-,root,root) %{_datadir}/%{name}/ %config(noreplace) %{apache2_sysconfdir}/%{name}.conf %attr(0640,root,%cmdgrp) %config(missingok,noreplace) %{_sysconfdir}/%{name}/htpasswd.users %files devel %defattr(-,root,root) %{_includedir}/%{name}/ %changelog ++++++ html-makefile.patch ++++++ --- html/Makefile.in.orig 2011-07-27 21:16:48.000000000 +0200 +++ html/Makefile.in 2011-07-27 21:18:13.000000000 +0200 @@ -75,8 +75,7 @@ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/images/logos; done for file in includes/*.*; \ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes; done - for file in includes/rss/*; \ - do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes/rss; done + find includes/rss/ -maxdepth 1 -type f -exec $(INSTALL) -m 664 $(INSTALL_OPTS) {} $(DESTDIR)$(HTMLDIR)/includes/rss \; for file in includes/rss/extlib/*; \ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(HTMLDIR)/includes/rss/extlib; done ++++++ nagios-README.SuSE ++++++ Nagios Documentation -------------------- 1) Quickstart A quickstart installation guide can now be found in the package nagios-www. You can find the quickstart guide (quickstart.html) in the following subdirectory: DATADIR/docs/ The quickstart covers all the basic steps you need to follow to install Nagios, the Nagios plugins, and start out monitoring the machine that Nagios is installed on. ****************************************************************** * Remember to create a htpasswd.users file in SYSCONFDIR: * htpasswd2 -c SYSCONFDIR/htpasswd.users nagiosadmin * And set the correct rights for this file: * chmod 640 SYSCONFDIR/htpasswd.users * chown root:www SYSCONFDIR/htpasswd.users * * You should also add a mail alias for the nagiosadmin to your * /etc/aliases file like: * nagiosadmin: root * and afterwards update the database with "newaliases" * Note: the RPM tries to do this automatically ****************************************************************** 2) Upgrading The HTML documentation covers what you need to know in order to upgrade from Nagios 2.x You can find the documentation in the package nagios-www in the following subdirectory: DATADIR/docs/ Make sure to read the following sections: - "What's New" (whatsnew.html) - "Upgrading Nagios" (upgrading.html) The SuSE RPM package will try to do the necessary steps automatically during an upgrade. But you should check the resulting nagios.conf against the backup version in the /etc/nagios directory (it contains the update date). ++++++ nagios-disable_phone_home.patch ++++++ --- base/utils.c.orig 2011-07-26 20:11:44.000000000 +0200 +++ base/utils.c 2011-07-26 20:16:20.000000000 +0200 @@ -3824,131 +3824,10 @@ /* checks for updates at api.nagios.org */ int query_update_api(void) { - char *api_server = "api.nagios.org"; - char *api_path = "/versioncheck/"; - char *api_query = NULL; - char *api_query_opts = NULL; - char *buf = NULL; - char recv_buf[1024]; - int report_install = FALSE; - int result = OK; - char *ptr = NULL; - int current_line = 0; - int buf_index = 0; - int in_header = TRUE; - char *var = NULL; - char *val = NULL; - int sd = 0; - int send_len = 0; - int recv_len = 0; - int update_check_succeeded = FALSE; - - /* report a new install, upgrade, or rollback */ - /* Nagios monitors the world and we monitor Nagios taking over the world. :-) */ - if(last_update_check == (time_t)0L) - report_install = TRUE; - if(last_program_version == NULL || strcmp(PROGRAM_VERSION, last_program_version)) - report_install = TRUE; - if(report_install == TRUE) { - asprintf(&api_query_opts, "&firstcheck=1"); - if(last_program_version != NULL) - asprintf(&api_query_opts, "%s&last_version=%s", api_query_opts, last_program_version); - } - - /* generate the query */ - asprintf(&api_query, "v=1&product=nagios&tinycheck=1&stableonly=1&uid=%lu", update_uid); - if(bare_update_check == FALSE) - asprintf(&api_query, "%s&version=%s%s", api_query, PROGRAM_VERSION, (api_query_opts == NULL) ? "" : api_query_opts); - - /* generate the HTTP request */ - asprintf(&buf, "POST %s HTTP/1.0\r\n", api_path); - asprintf(&buf, "%sUser-Agent: Nagios/%s\r\n", buf, PROGRAM_VERSION); - asprintf(&buf, "%sConnection: close\r\n", buf); - asprintf(&buf, "%sHost: %s\r\n", buf, api_server); - asprintf(&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); - asprintf(&buf, "%sContent-Length: %zd\r\n", buf, strlen(api_query)); - asprintf(&buf, "%s\r\n", buf); - asprintf(&buf, "%s%s\r\n", buf, api_query); - - /* - printf("SENDING...\n"); - printf("==========\n"); - printf("%s",buf); - printf("\n"); - */ - - - result = my_tcp_connect(api_server, 80, &sd, 2); - /*printf("CONN RESULT: %d, SD: %d\n",result,sd);*/ - if(sd > 0) { - - /* send request */ - send_len = strlen(buf); - result = my_sendall(sd, buf, &send_len, 2); - /*printf("SEND RESULT: %d, SENT: %d\n",result,send_len);*/ - - /* get response */ - recv_len = sizeof(recv_buf); - result = my_recvall(sd, recv_buf, &recv_len, 2); - recv_buf[sizeof(recv_buf)-1] = '\x0'; - /*printf("RECV RESULT: %d, RECEIVED: %d\n",result,recv_len);*/ - - /* - printf("\n"); - printf("RECEIVED...\n"); - printf("===========\n"); - printf("%s",recv_buf); - printf("\n"); - */ - - /* close connection */ - close(sd); - - /* parse the result */ - in_header = TRUE; - while((ptr = get_next_string_from_buf(recv_buf, &buf_index, sizeof(recv_buf)))) { - - strip(ptr); - current_line++; - - if(!strcmp(ptr, "")) { - in_header = FALSE; - continue; - } - if(in_header == TRUE) - continue; - - var = strtok(ptr, "="); - val = strtok(NULL, "\n"); - /*printf("VAR: %s, VAL: %s\n",var,val);*/ - - if(!strcmp(var, "UPDATE_AVAILABLE")) { - update_available = atoi(val); - /* we were successful */ - update_check_succeeded = TRUE; - } - else if(!strcmp(var, "UPDATE_VERSION")) { - if(new_program_version) - my_free(new_program_version); - new_program_version = strdup(val); - } - else if(!strcmp(var, "UPDATE_RELEASEDATE")) { - } - } - } - - /* cleanup */ - my_free(buf); - my_free(api_query); - my_free(api_query_opts); - - /* we were successful! */ + int update_check_succeeded=TRUE; if(update_check_succeeded == TRUE) { time(&last_update_check); - if(last_program_version) - free(last_program_version); - last_program_version = (char *)strdup(PROGRAM_VERSION); } return OK; ++++++ nagios-fix_encoding_trends.cgi.patch ++++++ --- cgi/getcgi.c.orig 2011-07-26 19:56:06.000000000 +0200 +++ cgi/getcgi.c 2011-07-26 20:18:47.000000000 +0200 @@ -96,6 +96,9 @@ break; else if(input[x] == '%') { input[y] = hex_to_char(&input[x+1]); + if ( input[y] == '+') { + input[y]=' '; + } x += 2; } else ++++++ nagios-fix_spurious_dollar_signs_added_to_command_lines.patch ++++++ --- common/macros.c.orig 2011-07-27 21:32:37.000000000 +0200 +++ common/macros.c 2011-07-27 21:33:13.000000000 +0200 @@ -185,7 +185,8 @@ *output_buffer = (char *)realloc(*output_buffer, strlen(*output_buffer) + strlen(temp_buffer) + 3); strcat(*output_buffer, "$"); strcat(*output_buffer, temp_buffer); - strcat(*output_buffer, "$"); + if (buf_ptr != NULL) + strcat(*output_buffer, "$"); } /* insert macro */ ++++++ nagios-history_buffer_overflow.patch ++++++ Index: nagios/cgi/history.c =================================================================== --- nagios.orig/cgi/history.c +++ nagios/cgi/history.c @@ -805,16 +805,16 @@ void get_history(void) { else if(display_type == DISPLAY_HOSTS) { if(history_type == HOST_HISTORY || history_type == SERVICE_HISTORY) { - sprintf(match1, " HOST ALERT: %s;", host_name); - sprintf(match2, " SERVICE ALERT: %s;", host_name); + snprintf(match1, sizeof( match1)," HOST ALERT: %s;", host_name); + snprintf(match2, sizeof( match2)," SERVICE ALERT: %s;", host_name); } else if(history_type == HOST_FLAPPING_HISTORY || history_type == SERVICE_FLAPPING_HISTORY) { - sprintf(match1, " HOST FLAPPING ALERT: %s;", host_name); - sprintf(match2, " SERVICE FLAPPING ALERT: %s;", host_name); + snprintf(match1, sizeof( match1)," HOST FLAPPING ALERT: %s;", host_name); + snprintf(match2, sizeof( match2)," SERVICE FLAPPING ALERT: %s;", host_name); } else if(history_type == HOST_DOWNTIME_HISTORY || history_type == SERVICE_DOWNTIME_HISTORY) { - sprintf(match1, " HOST DOWNTIME ALERT: %s;", host_name); - sprintf(match2, " SERVICE DOWNTIME ALERT: %s;", host_name); + snprintf(match1, sizeof( match1)," HOST DOWNTIME ALERT: %s;", host_name); + snprintf(match2, sizeof( match2)," SERVICE DOWNTIME ALERT: %s;", host_name); } if(show_all_hosts == TRUE) @@ -853,11 +853,11 @@ void get_history(void) { else if(display_type == DISPLAY_SERVICES) { if(history_type == SERVICE_HISTORY) - sprintf(match1, " SERVICE ALERT: %s;%s;", host_name, svc_description); + snprintf(match1, sizeof( match1), " SERVICE ALERT: %s;%s;", host_name, svc_description); else if(history_type == SERVICE_FLAPPING_HISTORY) - sprintf(match1, " SERVICE FLAPPING ALERT: %s;%s;", host_name, svc_description); + snprintf(match1, sizeof( match1), " SERVICE FLAPPING ALERT: %s;%s;", host_name, svc_description); else if(history_type == SERVICE_DOWNTIME_HISTORY) - sprintf(match1, " SERVICE DOWNTIME ALERT: %s;%s;", host_name, svc_description); + snprintf(match1, sizeof( match1), " SERVICE DOWNTIME ALERT: %s;%s;", host_name, svc_description); if(strstr(temp_buffer, match1) && (history_type == SERVICE_HISTORY || history_type == SERVICE_FLAPPING_HISTORY || history_type == SERVICE_DOWNTIME_HISTORY)) display_line = TRUE; ++++++ nagios-htpasswd.users ++++++ nagiosadmin:OIEGHgNTsb3HQ ++++++ nagios-p1.pl-location.patch ++++++ Index: Makefile.in =================================================================== --- Makefile.in.orig +++ Makefile.in @@ -25,6 +25,7 @@ LOGDIR=@localstatedir@ CHECKRESULTDIR=@CHECKRESULTDIR@ CFGDIR=@sysconfdir@ +P1PLDIR=@p1pldir@ BINDIR=@bindir@ CGIDIR=@sbindir@ LIBEXECDIR=@libexecdir@ @@ -219,7 +220,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 @@ -1114,7 +1114,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 ++++++ nagios-rpmlintrc ++++++ # common.css is used in cgi - and can be expanded by user addFilter("zero-length.*/usr/share/nagios/stylesheets/common.css"); # we need xntp for SLES9 addFilter("init-script-non-var-dependency.*/etc/init.d/nagios xntpd"); # nagios comes with embedded perl addFilter("no-dependency-on.*perl") # The name of that package is used since years - no need to change it for this new 'policy' addFilter("name-repeated-in-summary.*Nagios") ++++++ nagios.8 ++++++ .TH nagios "8" "February 2006, May 2010" "sean finney, Lars Vogdt" "Nagios" .SH NAME Nagios \- network/systems status monitoring daemon .SH SYNOPSIS .B nagios [\-h] [\-v] [\-s] [\-d] <main_config_file> .br .SH DESCRIPTION .B nagios is a daemon program that monitors the status of various network accessible systems, devices, and more. For more information, please consult the online documentation available at http://www.nagios.org, or on your nagios server's web page. .SH OPTIONS .TP main_config_file The main configuration file. On openSUSE systems this defaults to /etc/nagios/nagios.cfg .TP \fB\-h\fR A helpful usage message .TP \fB\-v\fR Reads all data in the configuration files and performs a basic verification/sanity check. Always make sure you verify your config data before (re)starting Nagios. You can also use the Nagios init script to verify your configuration - try: rcnagios check_verbose .TP \fB\-s\fR Shows projected/recommended check scheduling information based on the current data in the configuration files. .TP \fB\-d\fR Starts Nagios in daemon mode (instead of as a foreground process). .SH FILES .TP .IP /etc/nagios Default configuration directory for nagios .SH AUTHOR Nagios is written and maintained by Ethan Galstad <nag...@nagios.org>. This manual page was written by sean finney <sean...@debian.org> for the Debian GNU/Linux operating system (but it may be freely used, modified, and redistributed by others) and adapted by Lars Vogdt for openSUSE. ++++++ nagios.sysconfig ++++++ ## Path: Network/Monitors/Nagios ## Description: Nagios startup parameters ## Type: integer ## Default: 10 # # Timeout during server shutdown (seconds) and start. # The start script kills Nagios after this timeout in double-seconds with SIGTERM # If you enabled external commands, the start script also waits for this # time and tries to setup the system so external commands can be executed. # # Increase it, if you use nagios in an big environment (>100 monitoring hosts)! # NAGIOS_TIMEOUT="10" ## Type: integer ## Default: 0 # # Nice level of running Nagios daemon. # NAGIOS_NICELEVEL="0" ## Type: boolean ## Default: true # # Compress old Nagios logfiles in /var/log/nagios/archive. # # Nagios comes with his own logrotate scripts, so you can configure Nagios # to rotate his logfile in /etc/nagios/nagios.cfg # To save disk space, you can enable a cron job which compress the old # logfiles once a week. NAGIOS_COMPRESS_LOGFILES="true" ++++++ nagiosstats.8 ++++++ .TH nagiosstats "8" "February 2006, May 2010" "sean finney, Lars Vogdt " "nagios" .SH NAME nagiosstats \- report statistics information from the Nagios system .SH SYNOPSIS .B nagiosstats [\-hVL] [\-c config] [\-m] [\-d] .br .SH DESCRIPTION .B nagiosstats is a program designed to provide information on the running Nagios system. It can provide a brief summary of information, or it can be used to export specific information about the Nagios system into an MRTG-compatible format. For more information please consult the Nagios online documentation available at http://www.nagios.org or the documentation available with your Nagios server's web page. .SH OPTIONS .TP \fB\-c\fR|\-\-config=FILE The main configuration file. On openSUSE systems this defaults to /etc/nagios/nagios.cfg .TP \fB\-m\fR|\-\-mrtg Print output in MRTG-compatible format. For more details run nagiosstats with \-\-help .TP \fB\-d\fR|\-\-data=VARS Comma-seperated list of variables to output in MRTG format. For more details run nagiosstats with \-\-help. .TP \fB\-h\fR|\-\-help A helpful usage message .TP \fB\-V\fR|\-\-version Print version information .TP \fB\-L\fR|\-\-license Print license details .SH FILES .TP .IP /etc/nagios Default configuration directory for Nagios .SH AUTHOR Nagios is written and maintained by Ethan Galstad <nag...@nagios.org>. This manual page was written by sean finney <sean...@debian.org> for the Debian GNU/Linux operating system (but it may be freely used, modified, and redistributed by others) and adapted for openSUSE by Lars Vogdt. ++++++ rcnagios ++++++ #! /bin/sh # Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany. # 2002 SuSE Linux AG Nuernberg, Germany. # 2007 SuSE Linux GmbH Nuernberg, Germany. # 2010 SUSE LINUX Products GmbH, Nuernberg, Germany # # Author: Wolfgang Rosenauer, Lars Vogdt # # # /etc/init.d/nagios # # and symbolic its link # # /usr/sbin/rcnagios # # System startup script for nagios # ### BEGIN INIT INFO # 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 ndo2db # Should-Stop: sendmail ndo2db # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # 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 NAGIOS_BIN="/usr/sbin/nagios" NAGIOS_CFG="/etc/nagios/nagios.cfg" NAGIOS_PIDFILE="/var/run/nagios/nagios.pid" NAGIOS_SYSCONFIG="/etc/sysconfig/nagios" NAGIOS_CFG_ERR_LOG="/var/log/nagios/config.err" # Read config and log errors in logfile function config_check () { case "$1" in verbose) $NAGIOS_BIN -v "$NAGIOS_CFG" >"$NAGIOS_CFG_ERR_LOG" 2>&1 if [ $? -eq 0 ]; then return 0 else return 1 fi ;; *) $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 ;; esac } # grab a config option function get_var() { if [ -n "$2" ]; then set -- `grep ^$1 $2 | sed 's@=@ @' | tr -d '[:cntrl:]'` else set -- `grep ^$1 "$NAGIOS_CFG" | sed 's@=@ @' | tr -d '[:cntrl:]'` fi shift # remove first ARG => search-string echo $* } # check some default files and directories function check_files() { # 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 # set default access rights for files and directories for file in "$log_file" "$state_retention_file" "$status_file"; do if [ ! -e "$file" ]; then touch "$file" fi chown $nagios_user:$nagios_cmdgrp "$file" done for dir in "$check_result_path" $(dirname $status_file); do if [ ! -d "$dir" ]; then mkdir -p "$dir" fi chown $nagios_user:$nagios_cmdgrp "$dir" done chmod 660 "$resource_file" chown $nagios_user:$nagios_cmdgrp "$resource_file" } function check_lock_file() { PIDDIR=$(dirname $lock_file) case "$PIDDIR" in /var/run) if [ x"$nagios_user" != x"root" ]; then DATESTRING=`date +"%Y%m%d"` mv -f "$NAGIOS_CFG" "$NAGIOS_CFG-$DATESTRING" sed -e "s|^lock_file.*|pid_file=$NAGIOS_PIDFILE|g" "$NAGIOS_CFG-$DATESTRING" > "$NAGIOS_CFG" /bin/logger -t rcnagios "Configured $lock_file in $NAGIOS_CFG moved to $NAGIOS_PIDFILE. Backup is $NAGIOS_CFG-$DATESTRING" test -f "$lock_file" && rm -f "$lock_file" install -d -m755 -o$nagios_user -g$nagios_cmdgrp $(dirname "$NAGIOS_PIDFILE") else test -d "$PIDDIR" || mkdir -p "$PIDDIR" fi ;; *) install -d -m755 -o$nagios_user -g$nagios_cmdgrp $(dirname "$NAGIOS_PIDFILE") esac } # 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 or not executable."; 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 or readable."; 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 or readable."; 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)" check_external_commands="$(get_var check_external_commands)" # # 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} : ${check_external_commands:=0} # files to remove : ${command_file:=/var/spool/nagios/nagios.cmd} : ${lock_file:=/var/run/nagios/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 " config_check 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 check_lock_file startproc $NICELEVEL -p "$lock_file" "$NAGIOS_BIN" -d "$NAGIOS_CFG" if [ "$check_external_commands" != 0 ]; then while [ ! -e "$command_file" ] && [ $NAGIOS_TIMEOUT -gt 0 ]; do sleep 1 NAGIOS_TIMEOUT=$[$NAGIOS_TIMEOUT-1] done chgrp $nagios_cmdgrp "$command_file" chown $nagios_user:$nagios_cmdgrp "$check_result_path" fi else echo "Error in configuration - please read $NAGIOS_CFG_ERR_LOG" rc_failed fi rc_status -v ;; stop) 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. $0 status if test $? = 0; then $0 restart else rc_reset # Not running is not a failure. fi rc_status ;; restart) $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 "$lock_file" "$NAGIOS_BIN" else echo "- Error in configuration files" echo -n "- aborting reload - please read $NAGIOS_CFG_ERR_LOG" rc_failed fi rc_status -v ;; status) echo -n "Checking for Nagios " checkproc -p "$lock_file" "$NAGIOS_BIN" rc_status -v ;; check) echo -n "Starting configuration check " config_check if [ $? -eq 0 ]; then echo "- passed configuration check" test -f $NAGIOS_CFG_ERR_LOG && rm $NAGIOS_CFG_ERR_LOG rc_reset else echo "- detected Error in configuration files" echo "Please read $NAGIOS_CFG_ERR_LOG" rc_failed fi rc_status -v ;; check_verbose) echo "Running verbose configuration check..." config_check verbose exitcode=$? cat "$NAGIOS_CFG_ERR_LOG" rc_failed $exitcode rc_status -v rc_exit ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|reload|check|check_verbose}" exit 1 ;; esac rc_exit ++++++ suse.de-nagios ++++++ #!/usr/bin/env bash # # Compress old nagios logfiles in /var/log/nagios/archives/ # once a week, if sysconfig variable is set to true # if [[ -r /etc/sysconfig/nagios ]]; then . /etc/sysconfig/nagios else echo "/etc/sysconfig/nagios not found or not readable." >&2 exit 1 fi if [[ $NAGIOS_COMPRESS_LOGFILES = "true" ]]; then for f in /var/log/nagios/archives/*.log ; do if [[ -r $f ]] ; then /usr/bin/bzip2 "$f" fi done fi -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org