Hello community,

here is the log from the commit of package nagios for openSUSE:Factory checked 
in at 2014-03-30 09:10:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nagios (Old)
 and      /work/SRC/openSUSE:Factory/.nagios.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nagios"

Changes:
--------
--- /work/SRC/openSUSE:Factory/nagios/nagios.changes    2014-02-02 
18:41:35.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.nagios.new/nagios.changes       2014-03-30 
12:19:37.000000000 +0200
@@ -1,0 +2,115 @@
+Fri Mar 28 21:01:21 UTC 2014 - [email protected]
+
+- fix stack-based buffer overflow in the cmd_submitf function 
+  in cgi/cmd.c - CVE-2014-1878 (bnc#864843)
+  nagios-CVE-2014-1878.patch
+
+-------------------------------------------------------------------
+Mon Mar 17 19:20:30 UTC 2014 - [email protected]
+
+- add nagios-4.0.4-remove-date-time.patch to prevent unneccessary
+  rebuilds due to __DATE__ and __TIME__ macros
+
+-------------------------------------------------------------------
+Sun Mar 16 18:05:24 UTC 2014 - [email protected]
+
+- update to 4.0.4:
+  ENHANCEMENTS
+  * JSON CGIs moved to beta status (Eric Stanley)
+  FIXES
+  * Fixed bug #491,#553: Rebuilt the daemon-init scripts back to
+    something that should work on all systems (Scott Wilkerson)
+
+-------------------------------------------------------------------
+Sat Mar  1 17:55:49 UTC 2014 - [email protected]
+
+- update to 4.0.3
+  ENHANCEMENTS
+  * Aliased hourly_value to importance and minimum_value to
+    minimum_importance and deprecated the former (Eric Stanley)
+  * Added host and service importance macros (Eric Stanley)
+  * Added notifications on flexible downtime expiration (Dan Wittenberg)
+  FIXES
+  * Bug #548: Temporary fix that rejects all external command during
+    restart to prevent Core from crashing (Eric Stanley)
+  * Corrected calculation of host importance and importance defaults (Eric
+    Stanley)
+  * Fixed bug #498: Nagios 4 enable_environment_macros=1 not working (Eric
+    Stanley, Alexey Dvoryanchikov)
+  * No longer checks whether logs can be written when verifying
+    configuration (Eric Stanley)
+  * Fixed CGI bug where the CGI could read past the end of the list of CGI
+    variables, potentially crashing the CGI (Scott Wilkerson)
+  * Fixed inheritance of hourly_value from host and service templates
+    (Scott Wilkerson)
+  * Fixed bug #502: 4.0.0: Configuration -> Service Escalations =
+    incomplete list (Eric Stanley)
+  * Fixed bug #523: quotes and double quotes in plugin message are
+    converted to HTML escapes in Nagios 4.0 (duplicate of bug #524)
+  * Fixed bug #524: URLs returned in plugin check results are not
+    correctly displayed (Eric Stanley)
+  * Fixed bug where passive service checks would return "Service check
+    timed out after 0.00 seconds" (Scott Wilkerson)
+- print recommendation to run the upgrade_nagios script in case 
+  of an update (via logger command)
+- added man page for nagios_upgrade
+
+-------------------------------------------------------------------
+Thu Jan 24 21:14:34 UTC 2014 - [email protected]
+
+- update to 4.0.2
+  FIXES
+  * Fixed 528: Nagios 4.0.1: Logrotation: Only current host- and 
+    servicestates saved in rotated logfiles (duplicate of 507)
+  * Fixed 507: Nagios 4.0.0 - Problem during log rotate (Stefano Ghelfi)
+  * Fixed 530: RPM spec file sets wrong permissions on plugins 
+    directory (duplicate of bug 494)
+  * Fixed 494: nagios.spec fixes (with patch) (Karsten Weiss)
+  * Fixed 515: Segsegv after starting up nagios (duplicate of bug 526)
+  * Fixed 513: Crash while entering downtime for service 
+    (duplicate of bug 526)
+  * Fixed 529: Core Worker failed to reap child in 4.0.1 Description
+  * Fixed 514: scheduled downtime not showing in web interface 
+    (Eric Stanley)
+  * Fixed 526: sort_downtime() corrupts scheduled_downtime_list 
+    causing segfault (Adam James)
+  * Fixed 492: Nagios 4 fails to remove/add checks upon reload 
+    (Eric Stanley)
+  * Fixed 484: Beta4.0.0b4 service checks returning (No output 
+    on stdout) (Eric Stanley)
+  * Fixed 470: statusmap doesn't display info (Cameron Moore)
+  * Fixed 499: Security issue in daemon-init.in, function 
+    check_config (Tómas Edwardsson) 
+
+-------------------------------------------------------------------
+Thu Jan 23 12:01:00 UTC 2014 - [email protected]
+
+- update to 4.0.1
+  ENHANCEMENTS
+  * Added compiler flags in RPM spec file to reduce compiler noise 
+    (Dan Wittenberg)
+  * Added logging of failure in dlclose() call (Anton Lofgren)
+  * Added a simple query handler interface, nagios-qh.rb 
+    (Dan Wittenberg)
+  * Multiple code simplifications, additional error handling in 
+    downtime code (Andreas Ericsson)
+  FIXES
+  * Reverted commit f99a9a7b which set check_interval to 1 if 
+    it was configured as zero.
+  * Corrected order of arguments when logging unknown hosts/services 
+    (Scott Wilkerson)
+  * Downtime initialized before retention data read (Eric Stanley)
+  * Patches to make RPM build again (Dan Wittenberg)
+  * Ensure that scheduled_downtime_depth never drops below zero 
+    (Andreas Ericsson)
+
+For a complete list of changes for the new Nagios Core 4 version, 
+see http://nagios.sourceforge.net/docs/nagioscore/4/en/whatsnew.html
+
+- removed upstreamed patches:
+  + nagios-CVE-2013-2214.patch
+  + nagios-disable_phone_home.patch
+  + nagios-p1.pl-location.patch
+- added nagios-random_data.patch 
+
+-------------------------------------------------------------------

Old:
----
  nagios-3.0.6-docs.tar.bz2
  nagios-3.5.1.tar.bz2
  nagios-CVE-2013-2214.patch
  nagios-CVE-2013-7108.patch
  nagios-p1.pl-location.patch

New:
----
  nagios-4.0.4-remove-date-time.patch
  nagios-4.0.4.tar.bz2
  nagios-CVE-2014-1878.patch
  nagios-random_data.patch
  upgrade_nagios.8
  upgrade_nagios.sh

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nagios.spec ++++++
--- /var/tmp/diff_new_pack.bPwjRs/_old  2014-03-30 12:19:39.000000000 +0200
+++ /var/tmp/diff_new_pack.bPwjRs/_new  2014-03-30 12:19:39.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package nagios
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 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
@@ -17,7 +17,7 @@
 
 
 Name:           nagios
-Version:        3.5.1
+Version:        4.0.4
 Release:        0
 Summary:        The Nagios Network Monitor
 License:        GPL-2.0+
@@ -30,26 +30,31 @@
 Source5:        nagios.8
 Source6:        nagiosstats.8
 Source7:        nagios-htpasswd.users
-#
+Source8:        upgrade_nagios.sh
+Source9:        upgrade_nagios.8
 Source10:       %{name}-README.SuSE
 Source11:       %{name}-html-pages.tar.bz2
-Source12:       %{name}-3.0.6-docs.tar.bz2
 Source20:       %{name}-rpmlintrc
 # 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-UPSTREAM return 1 in int main()
+Patch4:         nagios-random_data.patch
 # PATCH-FIX-OPENSUSE disable Nagios online update checks for distributed 
packages
 Patch11:        nagios-disable_phone_home.patch
-# PATCH-FIX-UPSTREAM fix CVE-2013-2214
-Patch12:        nagios-CVE-2013-2214.patch
-# PATCH-FIX-UPSTREAM fix CVE-2013-7108
-Patch13:        nagios-CVE-2013-7108.patch
-BuildRequires:  apache2-devel
+Patch12:        nagios-4.0.4-remove-date-time.patch
+# PATCH-FIX-UPSTREAM fix against CVE-2014-1878
+Patch13:        nagios-CVE-2014-1878.patch
+BuildRequires:  doxygen
+# yes: we still build for SLE10
+%if 0%{?suse_version} > 1020
+BuildRequires:  fdupes
+%endif
+BuildRequires:  bzip2
 BuildRequires:  freetype2-devel
 BuildRequires:  gd-devel
+BuildRequires:  gperf
 BuildRequires:  iputils
 BuildRequires:  libjpeg-devel
 BuildRequires:  libpng-devel
@@ -59,6 +64,8 @@
 BuildRequires:  openssl-devel
 BuildRequires:  pcre-devel
 BuildRequires:  zlib-devel
+Provides:       monitoring_daemon
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Requires(pre):  %fillup_prereq
 Requires(pre):  %insserv_prereq
 Requires(pre):  /bin/logger
@@ -66,35 +73,20 @@
 Requires(pre):  grep
 Requires(pre):  pwdutils
 Requires(pre):  sed
-Provides:       monitoring_daemon
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%if 0%{?suse_version} < 1010
-BuildRequires:  XFree86-devel
-BuildRequires:  XFree86-libs
-BuildRequires:  libapr0
-Requires:       cron
-%else
 BuildRequires:  xorg-x11-devel
-BuildRequires:  pkgconfig(apr-util-1)
 Recommends:     %{name}-www
 Recommends:     cron
 # this package contains shared tools with icinga
 Recommends:     monitoring-tools
-# we enable nagios embedded perl, but if people disable it...
 Recommends:     perl = %{perl_version}
 # as long as it is enabled we need the following requires
 %{?libperl_requires}
-%endif
 Recommends:     icinga-monitoring-tools
-%if 0%{?suse_version} > 1020
 Recommends:     %{name}-plugins
-%else
-Requires:       %{name}-plugins
-%endif
 Requires:       mailx
 %define         nslockfile_dir /var/run/%{name}
 %define         nslockfile %nslockfile_dir/%{name}.pid
-%define         apache2_sysconfdir %(/usr/sbin/apxs2 -q SYSCONFDIR)/conf.d
+%define         apache2_sysconfdir %{_sysconfdir}/apache2/conf.d
 # Macro that print mesages to syslog at package (un)install time
 %define         nnmmsg logger -t %{name}/rpm
 
@@ -116,6 +108,11 @@
 %package www
 Summary:        Provides the HTML and CGI files for the Nagios web interface
 Group:          System/Monitoring
+Requires:       %{name} = %{version}
+Requires:       gd
+Requires:       mod_php_any
+Requires:       php
+Provides:       monitoring_webfrontend
 Requires(pre):  /bin/logger
 Requires(pre):  apache2
 Requires(pre):  coreutils
@@ -123,11 +120,6 @@
 Requires(pre):  grep
 Requires(pre):  pwdutils
 Requires(pre):  sed
-Requires:       %{name} = %{version}
-Requires:       gd
-Requires:       mod_php_any
-Requires:       php
-Provides:       monitoring_webfrontend
 
 %description www
 Nagios is a program that will monitor hosts and services on your
@@ -143,6 +135,19 @@
 for the Nagios web interface. In addition, HTML documentation is
 included in this package.
 
+%package theme-exfoliation
+Summary:        Nagios Core web interface
+Group:          System/Monitoring
+Requires(pre):  nagios-theme-switcher
+Requires:       nagios-www >= 3.0
+%if 0%{?suse_version} >= 01210
+BuildArch:      noarch
+%endif
+
+%description theme-exfoliation
+Exfoliation is a simple makeover for the Nagios Core web interface. It consists
+of two folders that overlay on a stock Nagios installation.
+
 %package www-dch
 Summary:        HTML and CGI files that do not call home
 Group:          System/Monitoring
@@ -166,6 +171,14 @@
 Please enable the flag "NAGIOSDCH" in the apache configuration.
 Note: The HTML pages use 'side' and 'main' and frame targets.
 
+%package contrib
+Summary:        Files from the contrib directory
+Group:          Development/Utils
+Requires:       %{name} = %{version}
+
+%description contrib
+This package contains all the files from the contrib directory
+
 %package devel
 Summary:        Development files for Nagios
 Group:          Development/Libraries/C and C++
@@ -184,22 +197,33 @@
 may compile against.
 
 %prep
-%setup -q -n %{name}
+%setup -q
 %patch2 -p0
 %patch3 -p0
-%patch10 -p0
-%patch11 -p0
+%patch4 -p1
+%patch11 -p1
 %patch12 -p1
 %patch13 -p1
 find -name ".gitignore" | xargs rm
-# fix p1.pl [dos]
-perl -p -i -e 's|\r\n|\n|' contrib/p1.pl
-# fix file permissions
-chmod -x Changelog LEGAL LICENSE README
+# fixing permissions the dirty way....
+chmod 644 Changelog LEGAL LICENSE README sample-config/README 
sample-config/template-object/README
+# README.SuSE file
+sed -e 's@DATADIR@%{_datadir}/%{name}@g' -e 
's@SYSCONFDIR@%{nagios_sysconfdir}@g' %{SOURCE10} > README.SUSE
+# we do not use /usr/local ...
+pushd contrib/eventhandlers 1>/dev/null
+for f in $(find . -type f) ; do
+    F=$(mktemp temp.XXXXXX)
+    sed "s=/usr/local/nagios/var/rw/=%{nagios_spooldir}/=; \
+         
s=NscaBin\=\"/usr/local/nagios/libexec/send_nsca\"=NscaBin\=\"%{_bindir}/send_nsca\"=;
 \
+         
s=NscaCfg\=\"/usr/local/nagios/etc/send_nsca.cfg\"=NscaCfg\=\"%{_sysconfdir}/nsca.cfg\"=;
 \
+         
s=/usr/local/nagios/libexec/eventhandlers/=%{nagios_eventhandlerdir}/=; \
+         s=/var/nagios/rw/nagios.qh=%{nagios_localstatedir}/nagios.qh=; \
+         s=/usr/local/nagios/libexec/=%{nagios_plugindir}/=" ${f} > ${F}
+    mv ${F} ${f}
+done
+popd 1>/dev/null
 
 %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} \
@@ -224,38 +248,19 @@
        --with-template-objects \
        --with-template-extinfo \
        --with-perlcache \
-       --enable-event-broker \
-       --enable-embedded-perl
+       --enable-event-broker
 #
-# /usr/bin/p1.pl is not a good place for a perl-_module_!
+# make daemonchk.cgi and event handlers
 #
-sed -i 's#@p1pldir@#%{nagios_libdir}#g' Makefile include/locations.h 
sample-config/nagios.cfg
+make %{?_smp_mflags} all
 #
-# fix p1.pl debug-path
+# Build documentation
 #
-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 dox
 #
-# make daemonchk.cgi and event handlers
+# Build contrib stuff
 #
-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/=%{nagios_spooldir}/=; \
-         
s=NscaBin\=\"/usr/local/nagios/libexec/send_nsca\"=NscaBin\=/usr/bin/send_nsca=;
 \
-         
s=/usr/local/nagios/libexec/eventhandlers/=%{nagios_eventhandlerdir}/=; \
-         s=/usr/local/nagios/libexec/=%{nagios_plugindir}/=; \
-         s=/usr/local/nagios/etc/=%{nagios_sysconfdir}/=; \
-         s=/usr/local/nagios/test/var=%{nagios_logdir}/=" ${f} > ${F}
-
-    mv ${F} ${f}
-done
-popd 1>/dev/null
 
 %install
 mkdir -p %{buildroot}/%{nagios_logdir}/archives
@@ -266,7 +271,6 @@
     DESTDIR=%{buildroot} \
     INSTALL_OPTS="" \
     COMMAND_OPTS="" \
-       CGICFGDIR="%{nagios_sysconfdir}" \
     INIT_OPTS=""
 make install -C contrib \
     DESTDIR=%{buildroot} \
@@ -278,14 +282,9 @@
 # install directory for event brokers like ndoutils
 install -d -m0755 %{buildroot}%{nagios_localstatedir}/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
+mkdir -p %{buildroot}%{_includedir}/%{name}/lib
+install -p -m644 include/*.h %{buildroot}%{_includedir}/%{name}/
+install -m644 lib/*.h %{buildroot}/%{_includedir}/%{name}/lib
 #
 # cleanup sample-conf dir for including in docdir
 #
@@ -294,14 +293,21 @@
 sed -e 's|command_file=.*|command_file=%{nagios_command_file}|g' \
     -e 
's|log_file=/var/lib/nagios/nagios.log|log_file=%{nagios_logdir}/nagios.log|g' \
     -e 
's|log_archive_path=/var/lib/nagios/archives|log_archive_path=%{nagios_logdir}/archives|g'
 \
+    -e 
's|#query_socket=/var/lib/nagios/rw/nagios.qh|query_socket=%{nagios_localstatedir}/nagios.qh|g'
 \
     -e 's|^lock_file=.*|lock_file=%nslockfile|g' \
     %{buildroot}/%{nagios_sysconfdir}/nagios.cfg > 
%{buildroot}%{_sysconfdir}/%{name}/nagios.cfg.tmp
 mv %{buildroot}/%{nagios_sysconfdir}/nagios.cfg.tmp 
%{buildroot}%{_sysconfdir}/%{name}/nagios.cfg
 #
+# Install documentation
+#
+cp -fr Documentation/html/* %{buildroot}%{nagios_datadir}/docs/
+#
+# Install libnagios
+#
+install -Dm644 lib/libnagios.a %{buildroot}%{_libdir}/libnagios.a
+#
 # install SuSE specials
 #
-# README.SuSE file
-sed -e 's@DATADIR@%{_datadir}/%{name}@g' -e 
's@SYSCONFDIR@%{nagios_sysconfdir}@g' %{SOURCE10} > 
%_builddir/%{name}/README.SuSE
 # init-script
 install -D -m 0755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/%{name}
 ln -sf ../../etc/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
@@ -319,22 +325,17 @@
 # install manpages
 install -Dm644 %{SOURCE5} %{buildroot}%{_mandir}/man8/%{name}.8
 install -Dm644 %{SOURCE6} %{buildroot}%{_mandir}/man8/nagiostats.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
 # we use nagios_spooldir for this
 test -d %{buildroot}%{nagios_localstatedir}/rw && rmdir 
%{buildroot}%{nagios_localstatedir}/rw
 # install plain html files to allow users to use Nagios without internet 
connection
 # and without PHP at all
 pushd %{buildroot}%{nagios_datadir} >/dev/null
 tar -xf %{SOURCE11}
-tar -xf %{SOURCE12}
-sed -i "s|Version 3.4.3|Version %{version}|g; \
-               s|version=3.4.3|version=%{version}|g" main.html
+sed -i "s|3.4.3|%{version}|g" main.html
+popd >/dev/null
 # jip: ugly at the moment
 #LINES=$(echo $(wc -l %%{buildroot}%%{apache2_sysconfdir}/%%{name}.conf | awk 
'" " { print $1}')-2 | bc)
-LINES=40
+LINES=39
 head -n $LINES %{buildroot}%{apache2_sysconfdir}/%{name}.conf > 
%{buildroot}%{apache2_sysconfdir}/%{name}.conf.in
 cat >> %{buildroot}%{apache2_sysconfdir}/%{name}.conf.in << EOF
     <IfDefine KOHANA2>
@@ -343,11 +344,22 @@
 </Directory>
 EOF
 mv -f %{buildroot}%{apache2_sysconfdir}/%{name}.conf.in 
%{buildroot}%{apache2_sysconfdir}/%{name}.conf
-popd >/dev/null
-# delete monitoring-tools because they are provided by monitoring-tools
+# install upgrade script
+install -m755 %{SOURCE8} %{buildroot}%{_sbindir}/upgrade_nagios
+install -m644 %{SOURCE9} %{buildroot}%{_mandir}/man8/upgrade_nagios.8
+# delete monitoring-tools because they are provided by monitoring-tools package
 rm -f %{buildroot}/%{_sbindir}/convertcfg
 rm -f %{buildroot}/%{_sbindir}/mini_epn
 rm -f %{buildroot}/%{_sbindir}/new_mini_epn
+# move exfoliation theme to separate folder
+mkdir -p %{buildroot}%{_datadir}/nagios-themes/exfoliation
+mv %{buildroot}%{nagios_datadir}/{stylesheets,images} 
%{buildroot}%{_datadir}/nagios-themes/exfoliation/
+%if 0%{?suse_version} > 1020
+%fdupes %{buildroot}%{_datadir}/nagios-themes/exfoliation/
+%endif
+mkdir -p %{buildroot}%{nagios_datadir}/{stylesheets,images}
+cp -rf html/stylesheets/* %{buildroot}%{nagios_datadir}/stylesheets/
+cp -rf html/images/* %{buildroot}%{nagios_datadir}/images/
 
 %clean
 rm -rf %{buildroot}
@@ -356,7 +368,6 @@
 # Create user and group on the system if necessary
 %nagios_user_group_add
 %nagios_command_user_group_add
-
 # update?
 if [ ${1:-0} -gt 1 ]; then
   # in the past, group www was used as nagios_command_group - now we use the 
default: nagcmd
@@ -376,54 +387,8 @@
 %post
 # Update ?
 if [ ${1:-0} -gt 1 ]; then
- if [ -f '%{nagios_sysconfdir}/nagios.cfg' ]; then
-  DATE=$(date "+%Y-%m-%d-%H:%M")
-  TMPFILE=$(mktemp /tmp/%{name}-XXXXXX)
-  NAGIOS_CFG='%{nagios_sysconfdir}/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
+  if [ -f %{nagios_sysconfdir}/nagios.cfg ]; then
+    %{nnmmsg} "Please run %{_sbindir}/upgrade_nagios 
%{nagios_sysconfdir}/nagios.cfg to upgrade your installation."
  fi
 else
   # First installation: create an alias for the default nagiosadmin user
@@ -490,19 +455,35 @@
 %preun www
 %restart_on_update apache2
 
+%post theme-exfoliation
+if [ ${1:-0} -eq 1 ]; then
+    # Only switch the theme if we're not in update mode.
+    if [ -x %{_sbindir}/switch-nagios-theme ]; then
+        %{_sbindir}/switch-nagios-theme exfoliation
+    fi
+fi
+
+%postun theme-exfoliation
+if [ ${1:-0} -eq 1 ]; then
+    # Only switch the theme if we're not in update mode.
+    if [ -x %{_sbindir}/switch-nagios-theme ]; then
+        %{_sbindir}/switch-nagios-theme exfoliation
+    fi
+fi
+
 %files
 %defattr(0644,root,root,0755)
-%doc Changelog LEGAL LICENSE README README.SuSE sample-config/
+%doc Changelog LEGAL LICENSE README README.SUSE UPGRADING THANKS sample-config/
 %dir %{nagios_libdir}
 %dir %{nagios_plugindir}
-%dir %{nagios_eventhandlerdir}
 %exclude %{nagios_cgidir}/*
 %{_mandir}/man8/%{name}*
 %{_sbindir}/rc%{name}
+%attr(0755,root,root) %{_sbindir}/upgrade_nagios
+%{_mandir}/man8/upgrade_nagios.8*
 %{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
 %attr(0755,root,root) %{_sysconfdir}/init.d/%{name}
 %attr(0755,root,root) %{_sysconfdir}/cron.weekly/*
-%attr(0755,root,root) %{nagios_eventhandlerdir}/*
 %config(noreplace) %{nagios_sysconfdir}/*.cfg
 %config(noreplace) %{nagios_sysconfdir}/objects/*.cfg
 %ghost %config(missingok,noreplace) %{nagios_logdir}/config.err
@@ -516,7 +497,6 @@
 %ghost                                             %dir %{nslockfile_dir}
 # files with special handling
 %config(noreplace) %attr(0640,root,%{nagios_group}) 
%{nagios_sysconfdir}/resource.cfg
-%attr(0755,root,root) %{nagios_libdir}/p1.pl
 %attr(0644,%{nagios_user},%{nagios_group}) %verify(not md5 size mtime) %ghost 
%config(missingok,noreplace) %{nslockfile}
 %attr(0600,%{nagios_user},%{nagios_group}) %verify(not md5 size mtime) %ghost 
%config(missingok,noreplace) %{nagios_state_retention_file}
 %attr(0664,%{nagios_user},%{nagios_group}) %verify(not md5 size mtime) %ghost 
%config(missingok,noreplace) %{nagios_status_file}
@@ -532,15 +512,25 @@
 %config(noreplace) %{apache2_sysconfdir}/%{name}.conf
 %attr(0640,root,%nagios_command_group) %config(missingok,noreplace) 
%{_sysconfdir}/%{name}/htpasswd.users
 %exclude %{nagios_datadir}/*.html
-%exclude %{nagios_datadir}/docs/*
+
+%files theme-exfoliation
+%defattr(0644,root,root,0755)
+%dir %{_datadir}/nagios-themes
+%{_datadir}/nagios-themes/exfoliation/
 
 %files www-dch
 %defattr(0644,root,root,0755)
 %{nagios_datadir}/*.html
-%{nagios_datadir}/docs/
+
+%files contrib 
+%defattr(-,root,root)
+%doc contrib/README
+%dir %{nagios_eventhandlerdir}
+%attr(0755,root,root) %{nagios_eventhandlerdir}/*
 
 %files devel
 %defattr(644,root,root,0755)
 %{_includedir}/%{name}/
+%{_libdir}/libnagios.a
 
 %changelog

++++++ nagios-4.0.4-remove-date-time.patch ++++++
From: Andreas Stieger <[email protected]>
Date: Mon, 17 Mar 2014 19:18:34 +0000
Subject: prevent unneccessary rebuilds due to __DATE__ and __TIME__ macros
Upstream: no

Fixes build warnings:
nagios-www.i586: W: file-contains-date-and-time 
/usr/lib/nagios/cgi/statusjson.cgi
nagios-www.i586: W: file-contains-date-and-time 
/usr/lib/nagios/cgi/objectjson.cgi
nagios-www.i586: W: file-contains-date-and-time 
/usr/lib/nagios/cgi/archivejson.cgi
Your file uses  __DATE and __TIME__ this causes the package to rebuild when
not needed

---
 cgi/archivejson.c |    2 +-
 cgi/objectjson.c  |    2 +-
 cgi/statusjson.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Index: nagios-4.0.4/cgi/archivejson.c
===================================================================
--- nagios-4.0.4.orig/cgi/archivejson.c
+++ nagios-4.0.4/cgi/archivejson.c
@@ -742,7 +742,7 @@ int main(void) {
                                json_result(query_time, THISCGI, 
                                svm_get_string_from_value(cgi_data.query, 
valid_queries), 
                                get_query_status(query_status, cgi_data.query),
-                               compile_time(__DATE__, __TIME__), 
RESULT_SUCCESS, ""));
+                               compile_time("Jan  1 1970", "00:00:00"), 
RESULT_SUCCESS, ""));
                json_object_append_object(json_root, "data", 
                                json_help(archive_json_help));
                break;
Index: nagios-4.0.4/cgi/objectjson.c
===================================================================
--- nagios-4.0.4.orig/cgi/objectjson.c
+++ nagios-4.0.4/cgi/objectjson.c
@@ -1090,7 +1090,7 @@ int main(void) {
                                json_result(query_time, THISCGI, 
                                svm_get_string_from_value(cgi_data.query, 
valid_queries), 
                                get_query_status(query_status, cgi_data.query),
-                               compile_time(__DATE__, __TIME__), 
RESULT_SUCCESS, ""));
+                               compile_time("Jan  1 1970", "00:00:00"), 
RESULT_SUCCESS, ""));
                json_object_append_object(json_root, "data", 
json_help(object_json_help));
                break;
        default:
Index: nagios-4.0.4/cgi/statusjson.c
===================================================================
--- nagios-4.0.4.orig/cgi/statusjson.c
+++ nagios-4.0.4/cgi/statusjson.c
@@ -1111,7 +1111,7 @@ int main(void) {
                                json_result(query_time, THISCGI, 
                                svm_get_string_from_value(cgi_data.query, 
valid_queries), 
                                get_query_status(query_status, cgi_data.query),
-                               compile_time(__DATE__, __TIME__), 
RESULT_SUCCESS, ""));
+                               compile_time("Jan  1 1970", "00:00:00"), 
RESULT_SUCCESS, ""));
                json_object_append_object(json_root, "data", 
json_help(status_json_help));
                break;
        default:
++++++ nagios-3.0.6-docs.tar.bz2 -> nagios-4.0.4.tar.bz2 ++++++
++++ 245066 lines of diff (skipped)

++++++ nagios-CVE-2013-2214.patch -> nagios-CVE-2014-1878.patch ++++++
--- /work/SRC/openSUSE:Factory/nagios/nagios-CVE-2013-2214.patch        
2013-08-05 20:48:15.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.nagios.new/nagios-CVE-2014-1878.patch   
2014-03-30 12:19:37.000000000 +0200
@@ -1,48 +1,21 @@
-Index: nagios/cgi/status.c
+Index: nagios-4.0.4/cgi/cmd.c
 ===================================================================
---- nagios.orig/cgi/status.c
-+++ nagios/cgi/status.c
-@@ -2547,6 +2547,10 @@ void show_servicegroup_overview(serviceg
-               if(temp_host == NULL)
-                       continue;
+--- nagios-4.0.4.orig/cgi/cmd.c
++++ nagios-4.0.4/cgi/cmd.c
+@@ -1903,14 +1903,14 @@ static int cmd_submitf(int id, const cha
+               return ERROR;
  
-+        /* make sure user has rights to view this host */
-+        if(is_authorized_for_host(temp_host, &current_authdata) == FALSE)
-+            continue;
-+
-               /* skip this if it isn't a new host... */
-               if(temp_host == last_host)
-                       continue;
-@@ -2752,6 +2756,10 @@ void show_servicegroup_host_totals_summa
-               if(temp_host == NULL)
-                       continue;
+       len = snprintf(cmd, sizeof(cmd) - 1, "[%lu] %s;", time(NULL), 
command_name);
+-      if(len < 0)
++      if(len < 0 || len >= sizeof(cmd))
+               return ERROR;
  
-+        /* make sure user has rights to view this host */
-+        if(is_authorized_for_host(temp_host, &current_authdata) == FALSE)
-+            continue;
-+
-               /* skip this if it isn't a new host... */
-               if(temp_host == last_host)
-                       continue;
-@@ -2931,6 +2939,10 @@ void show_servicegroup_service_totals_su
-               temp_service = find_service(temp_member->host_name, 
temp_member->service_description);
-               if(temp_service == NULL)
-                       continue;
-+ 
-+        /* make sure user has rights to view this service */
-+        if(is_authorized_for_service(temp_service, &current_authdata) == 
FALSE)
-+            continue;
+       if(fmt) {
+               va_start(ap, fmt);
+               len2 = vsnprintf(&cmd[len], sizeof(cmd) - len - 1, fmt, ap);
+               va_end(ap);
+-              if(len2 < 0)
++              if(len2 < 0 || len >= sizeof(cmd) - len)
+                       return ERROR;
+               }
  
-               /* skip this if it isn't a new service... */
-               if(temp_service == last_service)
-@@ -3290,6 +3302,10 @@ void show_servicegroup_grid(servicegroup
-               if(temp_host == NULL)
-                       continue;
- 
-+        /* make sure user has rights to view this host */
-+        if(is_authorized_for_host(temp_host, &current_authdata) == FALSE)
-+            continue;
-+
-               /* get the status of the host */
-               temp_hoststatus = find_hoststatus(temp_host->name);
-               if(temp_hoststatus == NULL)

++++++ nagios-disable_phone_home.patch ++++++
--- /var/tmp/diff_new_pack.bPwjRs/_old  2014-03-30 12:19:40.000000000 +0200
+++ /var/tmp/diff_new_pack.bPwjRs/_new  2014-03-30 12:19:40.000000000 +0200
@@ -1,23 +1,18 @@
----
- base/utils.c |  129 
-----------------------------------------------------------
- 1 file changed, 1 insertion(+), 128 deletions(-)
-
-Index: base/utils.c
+Index: nagios-4.0.4/base/utils.c
 ===================================================================
---- base/utils.c.orig
-+++ base/utils.c
-@@ -3935,138 +3935,11 @@ int check_for_nagios_updates(int force,
+--- nagios-4.0.4.orig/base/utils.c
++++ nagios-4.0.4/base/utils.c
+@@ -2833,118 +2833,6 @@ int check_for_nagios_updates(int force,
  
  /* checks for updates at api.nagios.org */
  int query_update_api(void) {
--      char *api_server = "api.nagios.org";
--      char *api_path = "/versioncheck/";
+-      const char *api_server = "api.nagios.org";
+-      const 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;
@@ -63,36 +58,16 @@
 -               api_path, PROGRAM_VERSION, api_server,
 -               strlen(api_query), 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);*/
+-      my_tcp_connect(api_server, 80, &sd, 2);
 -      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);*/
+-              my_sendall(sd, buf, &send_len, 2);
 -
 -              /* get response */
 -              recv_len = sizeof(recv_buf);
--              result = my_recvall(sd, recv_buf, &recv_len, 2);
+-              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);
@@ -113,7 +88,6 @@
 -
 -                      var = strtok(ptr, "=");
 -                      val = strtok(NULL, "\n");
--                      /*printf("VAR: %s, VAL: %s\n",var,val);*/
 -
 -                      if(!strcmp(var, "UPDATE_AVAILABLE")) {
 -                              update_available = atoi(val);
@@ -135,14 +109,15 @@
 -      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);
+-      /* we were successful! */
+-      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 ++++++
--- /var/tmp/diff_new_pack.bPwjRs/_old  2014-03-30 12:19:40.000000000 +0200
+++ /var/tmp/diff_new_pack.bPwjRs/_new  2014-03-30 12:19:40.000000000 +0200
@@ -6,7 +6,7 @@
 ===================================================================
 --- cgi/getcgi.c.orig
 +++ cgi/getcgi.c
-@@ -96,6 +96,9 @@ void unescape_cgi_input(char *input) {
+@@ -95,6 +95,9 @@ void unescape_cgi_input(char *input) {
                        break;
                else if(input[x] == '%') {
                        input[y] = hex_to_char(&input[x + 1]);

++++++ nagios-fix_spurious_dollar_signs_added_to_command_lines.patch ++++++
--- /var/tmp/diff_new_pack.bPwjRs/_old  2014-03-30 12:19:40.000000000 +0200
+++ /var/tmp/diff_new_pack.bPwjRs/_new  2014-03-30 12:19:40.000000000 +0200
@@ -6,7 +6,7 @@
 ===================================================================
 --- common/macros.c.orig
 +++ common/macros.c
-@@ -221,7 +221,8 @@ int process_macros_r(nagios_macros *mac,
+@@ -191,7 +191,8 @@ int process_macros_r(nagios_macros *mac,
                                *output_buffer = (char 
*)realloc(*output_buffer, strlen(*output_buffer) + strlen(temp_buffer) + 3);
                                strcat(*output_buffer, "$");
                                strcat(*output_buffer, temp_buffer);

++++++ nagios-html-pages.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/main.html new/main.html
--- old/main.html       2013-01-09 10:51:36.000000000 +0100
+++ new/main.html       2013-10-25 00:28:30.000000000 +0200
@@ -22,10 +22,9 @@
 <div id="currentversioninfo">
 <div class="product">Nagios<sup><span style="font-size: 
small;">&reg;</span></sup> Core<sup><span style="font-size: 
small;">&trade;</span></sup></div>
 <div class="version">Version 3.4.3</div>
-<div class="releasedate">November 30, 2012</div>
 <div class="checkforupdates"><a 
href="http://www.nagios.org/checkforupdates/?version=3.4.3&product=nagioscore"; 
target="_blank">Check for updates on nagios.org</a></div>
 <div class="submessage">Please note: automatic update checks are disabled by 
intention.<br  />Check for updates using the package mananger of your 
distribution.</div>
-<div class="whatsnew"><a href="http://go.nagios.com/nagioscore/whatsnew";>Read 
what's new in Nagios Core 3</a></div>
+<div class="whatsnew"><a href="http://go.nagios.com/nagioscore/whatsnew";>Read 
what's new in Nagios Core 3.4.3</a></div>
 </div>
 
 <div id="splashboxes">

++++++ nagios-random_data.patch ++++++
Index: nagios-4.0.4/worker/ping/worker-ping.c
===================================================================
--- nagios-4.0.4.orig/worker/ping/worker-ping.c
+++ nagios-4.0.4/worker/ping/worker-ping.c
@@ -84,6 +84,7 @@ main( int argc, char **argv, char **env)
        if( worker( worker_socket)) {
                exit( 1);
        }
+    return 1;
 }
 
 void parse_worker_command_line( int argc, char **argv, char **env,
++++++ nagios-rpmlintrc ++++++
--- /var/tmp/diff_new_pack.bPwjRs/_old  2014-03-30 12:19:40.000000000 +0200
+++ /var/tmp/diff_new_pack.bPwjRs/_new  2014-03-30 12:19:40.000000000 +0200
@@ -3,10 +3,9 @@
 # we need xntp for SLES9
 addFilter("init-script-non-var-dependency.*/etc/init.d/nagios xntpd");
 addFilter("subsys-unsupported.*/etc/init.d/nagios");
-# 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")
 # avoid FollowSymlinks in apache configuration
 addFilter("files-duplicated-waste");
 addFilter("files-duplicate.*/usr/share/nagios/.*");
+addFilter("devel-file-in-non-devel-package.*/usr/lib.*/libnagios.a");

++++++ rcnagios ++++++
--- /var/tmp/diff_new_pack.bPwjRs/_old  2014-03-30 12:19:40.000000000 +0200
+++ /var/tmp/diff_new_pack.bPwjRs/_new  2014-03-30 12:19:40.000000000 +0200
@@ -39,7 +39,7 @@
 NAGIOS_DAEMONCHK='/usr/lib/nagios/cgi/daemonchk.cgi'
 
 # Read config and log errors in logfile
-function config_check () {
+config_check () {
     case "$1" in
         verbose)
             $NAGIOS_BIN -v "$NAGIOS_CFG" >"$NAGIOS_CFG_ERR_LOG" 2>&1
@@ -62,7 +62,7 @@
 }
 
 # grab a config option 
-function get_var() {
+get_var() {
        if [ -n "$2" ]; then
                set -- `grep ^$1 $2 | sed 's@=@ @' | tr -d '[:cntrl:]'`
        else
@@ -73,7 +73,7 @@
 }
 
 # check some default files and directories
-function check_files() {
+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"
@@ -95,7 +95,7 @@
     chown $nagios_user:$nagios_cmdgrp "$resource_file"
 }
 
-function check_lock_file() {
+check_lock_file() {
        PIDDIR=$(dirname $lock_file)
        case "$PIDDIR" in
                /var/run)
@@ -198,7 +198,7 @@
             if [ "$check_external_commands" != 0 ]; then
                 while [ ! -e "$command_file" ] && [ $NAGIOS_TIMEOUT -gt 0 ]; do
                        sleep 1
-                       NAGIOS_TIMEOUT=$[$NAGIOS_TIMEOUT-1]
+                       NAGIOS_TIMEOUT=$(($NAGIOS_TIMEOUT-1))
                done
                 chgrp $nagios_cmdgrp "$command_file"
                 chown $nagios_user:$nagios_cmdgrp "$check_result_path"
@@ -224,7 +224,7 @@
                 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]
+                    NAGIOS_TIMEOUT=$(($NAGIOS_TIMEOUT-1))
                     echo -n '.'
                     [ $NAGIOS_TIMEOUT -eq 41 ] && echo
                 done

++++++ upgrade_nagios.8 ++++++
.TH upgrade_nagios "8" "1 March 2014" "Lars Vogdt" "Nagios"
.SH NAME
Upgrade Nagios Configuration

.SH SYNOPSIS
.B upgrade_nagios [\-d] [\-h] [\-l] [\-p] [\-V] <main_config_file>
.br

.SH DESCRIPTION
.B nagios_upgrade
will upgrade your main nagios configuration file by adding/removing 
configuration values.

.SH OPTIONS
.TP
main_config_file
The main configuration file. On openSUSE systems this defaults to
\fB\/etc/nagios/nagios.cfg\fR
.TP
\fB\-h\fR
A helpful usage message
.TP
\fB\-V\fR
Prints version information about the script itself.
.TP
\fB\-d\fR
Enables debug mode: nothing will be done in real - all commands will be 
printed on STDOUT instead.
.TP
\fB\-l\fR
Provide another path to the logfile. Default is 
/var/log/nagios/nagios_upgrade.log
.TP
\fB\-p\fR
Provide another path to the Nagios lock file (default: 
/var/run/nagios/nagios.pid).

.SH FILES
.TP
.IP /etc/nagios/nagios.cfg
Default configuration file for Nagios.
.IP /var/log/nagios/nagios_upgrade.log
Logfile used by the nagios_upgrade script.
.IP /var/run/nagios/nagios.pid
Lock file of the running Nagios daemon.

.SH AUTHOR
Nagios is written and maintained by Ethan Galstad <[email protected]>.  This
manual page was written by Lars Vogdt for the openSUSE operating system 
(but it may be freely used, modified, and redistributed by others).
++++++ upgrade_nagios.sh ++++++
#!/bin/bash
#
# Copyright (C) 2013, SUSE Linux Products GmbH
# Author: Lars Vogdt
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
#   list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
#   and/or other materials provided with the distribution.
#
# * Neither the name of the Novell nor the names of its contributors may be
#   used to endorse or promote products derived from this software without
#   specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
#set -x
VERSION=1
NAGIOS_CFG='/etc/nagios/nagios.cfg'
LOCK_FILE='/var/run/nagios/nagios.pid'
DATE=$(date "+%Y-%m-%d-%H:%M")
TMPFILE=$(mktemp /tmp/$(basename $0)-XXXXXX)
LOGFILE='/var/log/nagios/nagios_upgrade.log'
VERBOSE='no'
DO_ECHO=''

ALL_OBSOLETE_VARS="
aggregate_status_updates 
check_result_reaper_frequency 
command_check_interval
comment_file 
downtime_file 
enable_embedded_perl 
external_command_buffer_slots 
max_check_result_reaper_time 
p1_file
service_reaper_frequency 
sleep_time
use_embedded_perl_implicitly 
"

REMOVED_VARS="
aggregate_status_updates 
check_result_reaper_frequency 
command_check_interval
enable_embedded_perl 
external_command_buffer_slots 
max_check_result_reaper_time 
p1_file
service_reaper_frequency 
sleep_time
use_embedded_perl_implicitly 
"

CP=$(which cp)
CAT=$(which cat)
SED=$(which sed)
ECHO=$(which echo)
LOGGER=$(which logger)
GREP=$(which grep)

cleanup_and_exit(){
        local EXITCODE="$1"
        test -f "$TMPFILE" && rm "$TMPFILE"
        exit $EXITCODE
}

usage(){
        echo "Usage: $(basename $0) [OPTIONS] [path_to_nagios.cfg]"
        echo 
        echo "       -h : show this help text"
        echo "       -d : just print out the commands"
        echo "       -l : full path to log file (default: $LOGFILE)"
        echo "       -p : full path to Nagios lock file (default: $LOCK_FILE)"
        echo "       -V : print version (current: $VERSION)"
        echo
}

check_and_disable_option(){
        local OPTION="$1"
        if $GREP -q ^$OPTION "$NAGIOS_CFG" ; then
                $ECHO "- $OPTION option has been uncommented in $NAGIOS_CFG" >> 
"$TMPFILE"
                $DO_ECHO $SED -i "s@^$OPTION@# $OPTION@" "$NAGIOS_CFG"
        fi
}

#######################################################################
###                             MAIN                                ###
#######################################################################
trap 'echo' SIGHUP SIGINT SIGQUIT
trap 'cleanup_and_exit 1' SIGTRAP SIGBUS SIGKILL SIGPIPE SIGTERM
trap 'cleanup_and_exit 0' EXIT

if [ ! $1 ]; then
    usage
    cleanup_and_exit '1'
fi

while getopts 'hda:vl:V'  OPTION ; do
    case $OPTION in
        h)      usage
                        cleanup_and_exit '0'
        ;;
                d) DO_ECHO="$ECHO"
                ;;
                p) LOCK_FILE="$OPTARG"
                ;;
                v) VERBOSE='yes'
                ;;
                l) LOGFILE="$OPTARG"
                ;;
                V)      echo "$(basename $0) version $VERSION"
                        cleanup_and_exit '0'
                ;;
        esac
done
shift $(( OPTIND - 1 ))
NAGIOS_CFG="$1"

VAR_EXISTS='no'
for option in $ALL_OBSOLETE_VARS ; do
        grep -q ^$option "$NAGIOS_CFG" && { 
                VAR_EXISTS='yes';
                if [ "$VERBOSE" == "yes" ]; then
                        $ECHO "Found obsolete configuration variable $option";
                fi; }
done

if [ "$VAR_EXISTS" == "no" ]; then
    if [ "$VERBOSE" == "yes" ]; then
        $ECHO "No enabled obsolete configuration variables found in $NAGIOS_CFG"
    fi
    cleanup_and_exit '0'
fi

$DO_ECHO echo -n "$(basename $0) called at: " >> "$LOGFILE"
$DO_ECHO date >> "$LOGFILE"

if [ ! -w "$NAGIOS_CFG" ]; then
        $ECHO "Could not open/write $NAGIOS_CFG - aborting" >&2
        $ECHO "Could not open/write $NAGIOS_CFG - aborting" >> "$LOGFILE"
        usage
        cleanup_and_exit '1'
fi

$DO_ECHO $CP -f "$NAGIOS_CFG" "${NAGIOS_CFG}_${DATE}" || {
        $ECHO "Could not create backup file ${NAGIOS_CFG}_${DATE} - aborting" 
>&2 ; 
        $ECHO "Could not create backup file ${NAGIOS_CFG}_${DATE} - aborting" 
>> "$LOGFILE" ;
        cleanup_and_exit '1';
}

if ! $GREP -q ^lock_file=$LOCK_FILE "$NAGIOS_CFG" ; then
        $ECHO "- updating pid lock_file= to $LOCK_FILE in $NAGIOS_CFG" >> 
$TMPFILE
        $DO_ECHO $SED -i "s@^lock_file=.*@lock_file=$LOCK_FILE @" "$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
                        $DO_ECHO $CAT "$file" >> "$state_retention_file"
                fi
        fi
        $ECHO "- removing downtime_file variable (no longer supported) in 
$NAGIOS_CFG" >> $TMPFILE
        $DO_ECHO $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
                        $DO_ECHO $CAT "$file" >> "$state_retention_file"
                fi
        fi
        $ECHO "- removing comment_file variable (no longer supported) in 
$NAGIOS_CFG" >> $TMPFILE
        $DO_ECHO $SED -i "s@^comment_file@# comment_file@" "$NAGIOS_CFG"
fi
for option_var in $REMOVED_VARS ; do
        check_and_disable_option "$option_var"
done
if [ -s "$TMPFILE" ]; then
        if [ "$VERBOSE" == "yes" ]; then
                $CAT "$TMPFILE"
        fi
        $DO_ECHO $CAT "$TMPFILE" >> "$LOGFILE"
        $DO_ECHO $LOGGER -t nagios/rpm -f "$TMPFILE"
else
        $DO_ECHO $ECHO "nothing to do" >> "$LOGFILE"
fi
cleanup_and_exit '0'
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to