Hello community,
here is the log from the commit of package nagios for openSUSE:Factory
checked in at Fri May 7 15:57:56 CEST 2010.
--------
--- nagios/nagios.changes 2010-04-06 12:50:01.000000000 +0200
+++ nagios/nagios.changes 2010-05-05 18:11:42.000000000 +0200
@@ -1,0 +2,13 @@
+Wed May 5 08:52:01 UTC 2010 - lars@linux-schulserver.de
+
+- fix broken files section
+- init skript now handles /var/run on tmpfs
+- small adaptions of init skript
+- default pidfile now /var/run/nagios/nagios.pid
+- add manpages from Debian package
+- add Debian patches:
+ + nagios-fix_forced_servicechecks.patch
+ + nagios-fix_encoding_trends.cgi.patch
+ + nagios-fix_spurious_dollar_signs_added_to_command_lines.patch
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
nagios-fix_encoding_trends.cgi.patch
nagios-fix_forced_servicechecks.patch
nagios-fix_spurious_dollar_signs_added_to_command_lines.patch
nagios.8
nagiosstats.8
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nagios.spec ++++++
--- /var/tmp/diff_new_pack.5AqvXJ/_old 2010-05-07 15:52:59.000000000 +0200
+++ /var/tmp/diff_new_pack.5AqvXJ/_new 2010-05-07 15:52:59.000000000 +0200
@@ -15,10 +15,15 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
-# norootforbuild
Name: nagios
+Version: 3.2.1
+Release: 2
+Summary: The Nagios Network Monitor
+Url: http://www.nagios.org/
+Group: System/Monitoring
+License: GPLv2+
%define nsusr nagios
%define nsgrp nagios
%define cmdusr wwwrun
@@ -28,30 +33,24 @@
%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
-Version: 3.2.1
-Release: 1
-License: GPLv2+
-Group: System/Monitoring
-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
Source10: %{name}-README.SuSE
-#
+# PATCH-FIX-UPSTREAM fix for missing expression in return statement bnc#395203
Patch1: nagios.run_async_service_check.return.patch
+# 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-UPSTREAM Fixes handling of forced checks
+Patch4: nagios-fix_forced_servicechecks.patch
+# PATCH-FIX-OPENSUSE openSUSE uses a special location for p1.pl
Patch10: nagios-p1.pl-location.patch
-#
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-PreReq: %insserv_prereq
-PreReq: %fillup_prereq
-PreReq: /bin/logger
-PreReq: coreutils
-PreReq: grep
-PreReq: pwdutils
-PreReq: sed
BuildRequires: apache2-devel
BuildRequires: freetype2-devel
BuildRequires: gd-devel
@@ -62,6 +61,15 @@
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: zlib-devel
+PreReq: %fillup_prereq
+PreReq: %insserv_prereq
+PreReq: /bin/logger
+PreReq: coreutils
+PreReq: grep
+PreReq: pwdutils
+PreReq: sed
+#
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} < 1010
BuildRequires: XFree86-devel
BuildRequires: XFree86-libs
@@ -70,15 +78,16 @@
%else
BuildRequires: libapr-util1-devel
BuildRequires: xorg-x11-devel
-Recommends: cron
Recommends: %{name}-www
+Recommends: cron
# we enable nagios embedded perl, but if people disable it...
Recommends: perl = %{perl_version}
%endif
%if 0%{?suse_version} > 1020
BuildRequires: fdupes
%endif
-Requires: mailx %{name}-plugins
+Requires: %{name}-plugins
+Requires: mailx
%description
Nagios is a program that will monitor hosts and services on your
@@ -95,25 +104,21 @@
This package provide core programs for nagios. The web interface,
documentation, and development files are built as separate packages
-
-
-Authors:
---------
- Ethan Galstad
-
%package www
License: GPLv2+
-Group: System/Monitoring
Summary: Provides the HTML and CGI files for the Nagios web interface
-Requires: %{name} = %{version}
-Requires: gd php5 mod_php_any
+Group: System/Monitoring
+PreReq: /bin/logger
PreReq: apache2
PreReq: coreutils
+PreReq: gawk
+PreReq: grep
PreReq: pwdutils
-PreReq: /bin/logger
PreReq: sed
-PreReq: grep
-PreReq: gawk
+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
@@ -129,16 +134,10 @@
for the Nagios web interface. In addition, HTML documentation is
included in this package.
-
-
-Authors:
---------
- Ethan Galstad
-
%package devel
License: GPLv2+
-Group: Development/Libraries/C and C++
Summary: Development files for nagios
+Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: gcc
@@ -153,18 +152,18 @@
This package provides include files that Nagios-related applications
may compile against.
-
-
-Authors:
---------
- Ethan Galstad
-
%prep
%setup -q
%patch1 -p1
+%patch2 -p0
+%patch3 -p0
+%patch4 -p0
%patch10
find -name ".cvsignore" | xargs rm
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
@@ -210,8 +209,8 @@
#
# make daemonchk.cgi and event handlers
#
-make %{?_smp_mflags} all
-make %{?_smp_mflags} -C contrib
+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`
@@ -227,30 +226,30 @@
popd 1>/dev/null
%install
-mkdir -p %buildroot/var/log/%name/archives
-mkdir -p %buildroot/%_sbindir
-mkdir -p %buildroot/%apache2_sysconfdir/
-mkdir -p %buildroot/%nslockfile_dir
+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 \
- DESTDIR="%buildroot" \
+ DESTDIR=%{buildroot} \
INSTALL_OPTS="" \
COMMAND_OPTS="" \
- CGICFGDIR="%_sysconfdir/%name" \
+ CGICFGDIR="%{_sysconfdir}/%name" \
INIT_OPTS=""
%{__make} install -C contrib \
- DESTDIR="%buildroot" \
+ 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/
+%{__install} -d -m0755 %{buildroot}%{_prefix}/lib/%name/plugins/eventhandlers/
+%{__cp} -afpv contrib/eventhandlers/* %{buildroot}%{_prefix}/lib/%name/plugins/eventhandlers/
# install directory for event brokers like ndoutils
-%{__install} -d -m0755 %buildroot%_prefix/lib/%name/brokers
+%{__install} -d -m0755 %{buildroot}%{_prefix}/lib/%name/brokers
# install headers for development package
-%{__install} -d -m0755 %buildroot%_includedir/%name/
+%{__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/
+ install -m 644 $file %{buildroot}%{_includedir}/%name/
fi;
done
popd
@@ -262,33 +261,39 @@
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' \
- %buildroot/%_sysconfdir/%name/nagios.cfg > %buildroot/%_sysconfdir/%name/nagios.cfg.tmp
-mv %buildroot/%_sysconfdir/%name/nagios.cfg.tmp %buildroot/%_sysconfdir/%name/nagios.cfg
+ -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' %{SOURCE10} > %_builddir/%name-%version/README.SuSE
+sed -e 's@DATADIR@%{_datadir}/%name@g' -e 's@SYSCONFDIR@%{_sysconfdir}/%name@g' %{SOURCE10} > %_builddir/%name-%version/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
+%{__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/var/adm/fillup-templates/sysconfig.%name
+%{__install} -D -m 0644 %{S:3} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%name
# install cronjob (gzip' the logfiles)
-%{__install} -D -m 0640 %{S:4} %buildroot/%_sysconfdir/cron.weekly/%name
+%{__install} -D -m 0640 %{S:4} %{buildroot}%{_sysconfdir}/cron.weekly/%name
# important ghost files
-touch %buildroot%_sysconfdir/%name/htpasswd.users
-touch %buildroot/var/lib/%name/retention.dat
-touch %buildroot/var/lib/%name/status.dat
-touch %buildroot/var/log/%name/config.err
-touch %buildroot%nslockfile
+touch %{buildroot}%{_sysconfdir}/%name/htpasswd.users
+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 %{SOURCE5} %{buildroot}%{_mandir}/man8/%{name}.8
+install -Dm644 %{SOURCE6} %{buildroot}%{_mandir}/man8/nagiosstats.8
+# resource.cfg can contain passwords
+chmod 0640 %{buildroot}%{_sysconfdir}/%name/resource.cfg
# some rpmlint stuff
%if 0%{?suse_version} > 1020
-%fdupes -s %buildroot
+%fdupes -s %{buildroot}
%endif
%clean
-%{__rm} -rf %buildroot
+%{__rm} -rf %{buildroot}
%pre
# Create user and group on the system if necessary
@@ -434,47 +439,50 @@
%files
%defattr(-,root,root)
%doc Changelog LEGAL LICENSE README README.SuSE sample-config/
-%dir %attr(775,%{nsusr},%{cmdgrp}) %_sysconfdir/%name
-%dir %attr(775,%{nsusr},%{cmdgrp}) %_sysconfdir/%name/objects
-%dir %attr(755,%nsusr,%nsgrp) /var/lib/%name
-%dir %attr(755,%nsusr,%nsgrp) /var/log/%name
-%dir %attr(755,%nsusr,%nsgrp) /var/log/%name/archives
-%dir %attr(755,%nsusr,%nsgrp) %nslockfile_dir
-%dir %attr(2775,%nsusr,%cmdgrp) /var/spool/%name
-%attr(0755,root,root) %_sysconfdir/init.d/%name
+%{_mandir}/man8/%{name}*
+%_sysconfdir/init.d/%name
+%ghost %config(missingok,noreplace) /var/log/%name/config.err
+%config(noreplace) %_sysconfdir/%name/resource.cfg
+%config(noreplace) %_sysconfdir/%name/cgi.cfg
+%config(noreplace) %_sysconfdir/%name/%{name}.cfg
+%config(noreplace) %_sysconfdir/%name/objects/*.cfg
+%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
+%defattr(755,root,root)
+%{_sysconfdir}/cron.weekly/*
+%{_prefix}/lib/%name/
+%exclude %{_prefix}/lib/%name/cgi/*
+%{_sbindir}/convertcfg
+%{_sbindir}/mini_epn
+%attr(0750,root,%{cmdgrp}) %{_sbindir}/%{name}
+%attr(0750,root,%{cmdgrp}) %{_sbindir}/nagiostats
+%{_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
+%dir %nslockfile_dir
%attr(0644,%nsusr,%nsgrp) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/%name/%name.pid
%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
-%ghost %config(missingok,noreplace) /var/log/%name/config.err
-%config(noreplace) %attr(664,%{nsusr},%{cmdgrp}) %_sysconfdir/%name/cgi.cfg
-%config(noreplace) %attr(664,%{nsusr},%{cmdgrp}) %_sysconfdir/%name/%{name}.cfg
-%config(noreplace) %attr(660,%{nsusr},%{cmdgrp}) %_sysconfdir/%name/resource.cfg
-%config(noreplace) %attr(664,%{nsusr},%{cmdgrp}) %_sysconfdir/%name/objects/*.cfg
-/var/adm/fillup-templates/sysconfig.%{name}
-# defattr change
-%defattr(755,root,root)
-%_sysconfdir/cron.weekly/*
-%_prefix/lib/%name/
-%exclude %_prefix/lib/%name/cgi/*
-%_sbindir/convertcfg
-%_sbindir/mini_epn
-%attr(0750,root,%{cmdgrp}) %_sbindir/%{name}
-%attr(0750,root,%{cmdgrp}) %_sbindir/nagiostats
-%_sbindir/new_mini_epn
-%_sbindir/rc%name
%files www
%defattr(755,root,root)
-%_prefix/lib/%name/cgi/*
+%{_prefix}/lib/%name/cgi/*
# defattr change
%defattr(-,root,root)
-%_datadir/%name/
+%{_datadir}/%name/
%config(noreplace) %{apache2_sysconfdir}/%name.conf
-%attr(0640,root,%cmdgrp) %ghost %config(missingok,noreplace) %_sysconfdir/%name/htpasswd.users
+%attr(0640,root,%cmdgrp) %ghost %config(missingok,noreplace) %{_sysconfdir}/%name/htpasswd.users
%files devel
%defattr(-,root,root)
-%dir %_includedir/%name
-%_includedir/%name/*
+%{_includedir}/%name/
%changelog
++++++ nagios-fix_encoding_trends.cgi.patch ++++++
Index: cgi/getcgi.c
===================================================================
--- cgi/getcgi.c.orig
+++ cgi/getcgi.c
@@ -96,6 +96,9 @@ void unescape_cgi_input(char *input){
break;
else if(input[x]=='%'){
input[y]=hex_to_char(&input[x+1]);
+ if (input[y]=='+'){
+ input[y]=' ';
+ }
x+=2;
}
else
++++++ nagios-fix_forced_servicechecks.patch ++++++
Index: cgi/cmd.c
===================================================================
--- cgi/cmd.c.orig
+++ cgi/cmd.c
@@ -2041,6 +2041,10 @@ int commit_command(int cmd){
break;
case CMD_SCHEDULE_SVC_CHECK:
+ if(force_check==TRUE)
+ cmd=CMD_SCHEDULE_FORCED_SVC_CHECK;
+ result = cmd_submitf(cmd,"%s;%s;%lu",host_name,service_desc,start_time);
+ break;
case CMD_SCHEDULE_FORCED_SVC_CHECK:
if(force_check==TRUE)
cmd=CMD_SCHEDULE_FORCED_SVC_CHECK;
++++++ nagios-fix_spurious_dollar_signs_added_to_command_lines.patch ++++++
Index: common/macros.c
===================================================================
--- common/macros.c.orig
+++ common/macros.c
@@ -195,7 +195,8 @@ int process_macros(char *input_buffer, c
*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.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]
.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 . This
manual page was written by sean finney 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.
++++++ 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 . This
manual page was written by sean finney 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 ++++++
--- /var/tmp/diff_new_pack.5AqvXJ/_old 2010-05-07 15:53:00.000000000 +0200
+++ /var/tmp/diff_new_pack.5AqvXJ/_new 2010-05-07 15:53:00.000000000 +0200
@@ -2,6 +2,7 @@
# 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
#
@@ -30,18 +31,19 @@
. /etc/rc.status
-NAGIOS_BIN=/usr/sbin/nagios
-NAGIOS_CFG=/etc/nagios/nagios.cfg
-NAGIOS_SYSCONFIG=/etc/sysconfig/nagios
-NAGIOS_CFG_ERR_LOG=/var/log/nagios/config.err
+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 () {
- $NAGIOS_BIN -v $NAGIOS_CFG > /dev/null 2>&1
+ $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
+ $NAGIOS_BIN -v "$NAGIOS_CFG" >"$NAGIOS_CFG_ERR_LOG" 2>&1
return 1
fi
}
@@ -51,7 +53,7 @@
if [ -n "$2" ]; then
set -- `grep ^$1 $2 | sed 's@=@ @' | tr -d '[:cntrl:]'`
else
- set -- `grep ^$1 $NAGIOS_CFG | sed 's@=@ @' | tr -d '[:cntrl:]'`
+ set -- `grep ^$1 "$NAGIOS_CFG" | sed 's@=@ @' | tr -d '[:cntrl:]'`
fi
shift # remove first ARG => search-string
echo $*
@@ -59,38 +61,58 @@
# check some default files and directories
function check_files() {
- # set default access rights for files and directories
- for file in $check_result_path $log_file $state_retention_file $status_file; do
- if [ -e $file ]; then
- touch $file
- chown $nagios_user:$nagios_cmdgrp $file
- fi
- done
- chmod 660 $resource_file
- chown $nagios_user:$nagios_cmdgrp $resource_file
# remove some perhaps left over files
- for file in $command_file $lock_file $status_file $temp_file /var/lock/subsys/nagios; do
- test -f $file && rm -f $file
+ 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 "$check_result_path" "$log_file" "$state_retention_file" "$status_file"; do
+ if [ -e "$file" ]; then
+ touch "$file"
+ chown $nagios_user:$nagios_cmdgrp "$file"
+ fi
done
+ chmod 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
+ ;;
+ *)
+ test -d $(dirname "$NAGIOS_PIDFILE") || 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";
+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";
+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";
+test -r "$NAGIOS_SYSCONFIG" || { echo "$NAGIOS_SYSCONFIG not existing or readable.";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
-. $NAGIOS_SYSCONFIG
+. "$NAGIOS_SYSCONFIG"
# set values for sysconfig vars
if [ -n "$NAGIOS_NICELEVEL" ]; then
@@ -129,7 +151,7 @@
: ${status_file:=/var/log/nagios/status.dat}
# files to remove
: ${command_file:=/var/spool/nagios/nagios.cmd}
-: ${lock_file:=/var/run/nagios.pid}
+: ${lock_file:=/var/run/nagios/nagios.pid}
: ${object_cache_file:=/var/lib/nagios/objects.cache}
: ${temp_file:=/var/log/nagios/nagios.tmp}
@@ -138,52 +160,52 @@
case "$1" in
start)
- echo -n "Starting nagios "
+ echo -n "Starting Nagios "
config_check
if [ $? -eq 0 ]; then
# check if nagios is already running
- NAGPID=$(pidof $NAGIOS_BIN)
+ 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"
+ echo "- Error: looks like Nagios is still running with PID $NAGPID"
+ echo -n "- trying to kill previous Nagios process"
kill -9 $NAGPID
sleep 2
fi
check_files
- startproc $NICELEVEL -p $lock_file $NAGIOS_BIN -d $NAGIOS_CFG
+ check_lock_file
+ startproc $NICELEVEL -p "$lock_file" "$NAGIOS_BIN" -d "$NAGIOS_CFG"
else
- echo "- Error in configuration files"
- echo -n "- please read $NAGIOS_CFG_ERR_LOG"
+ echo "Error in configuration - please read $NAGIOS_CFG_ERR_LOG"
rc_failed
fi
rc_status -v
;;
stop)
- echo -n "Shutting down nagios "
+ 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
+ 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
+ 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"
+ if checkproc "$NAGIOS_BIN" ; then
+ killproc -p "$lock_file" -SIGKILL "$NAGIOS_BIN"
+ echo -n "Warning: Nagios killed"
fi
else
- echo -n "nagios not running"
+ echo -n "Nagios not running"
rc_failed 7
fi
check_files
@@ -192,15 +214,12 @@
;;
try-restart)
## Do a restart only if the service was active before.
- ## Note: try-restart is now part of LSB (as of 1.9).
- ## RH has a similar command named condrestart.
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
- # Remember status and be quiet
rc_status
;;
restart)
@@ -209,11 +228,11 @@
rc_status
;;
reload|force-reload)
- echo -n "Reload service nagios "
+ echo -n "Reload service Nagios "
config_check
if [ $? -eq 0 ]; then
echo -n "Passed configuration check - reloading..."
- killproc -HUP -p $lock_file $NAGIOS_BIN
+ killproc -HUP -p "$lock_file" "$NAGIOS_BIN"
else
echo "- Error in configuration files"
echo -n "- aborting reload - please read $NAGIOS_CFG_ERR_LOG"
@@ -222,24 +241,27 @@
rc_status -v
;;
status)
- echo -n "Checking for nagios "
- checkproc -p $lock_file $NAGIOS_BIN
+ echo -n "Checking for Nagios "
+ checkproc -p "$lock_file" "$NAGIOS_BIN"
rc_status -v
;;
check|check_verbose)
- echo "Running configuration check..."
+ echo -n "Running configuration check... "
config_check
if [ $? -eq 0 ]; then
echo -n "- Passed configuration check"
- test -f $NAGIOS_CFG_ERR_LOG && rm $NAGIOS_CFG_ERR_LOG
+ test -f "$NAGIOS_CFG_ERR_LOG" && rm "$NAGIOS_CFG_ERR_LOG"
rc_reset
else
echo "- Error in configuration files"
- if [ $1 == "check_verbose" ]; then
- cat $NAGIOS_CFG_ERR_LOG
- else
- echo -n "- please read $NAGIOS_CFG_ERR_LOG"
- fi
+ case "$1" in
+ check_verbose)
+ cat "$NAGIOS_CFG_ERR_LOG"
+ ;;
+ *)
+ echo "Please read $NAGIOS_CFG_ERR_LOG"
+ ;;
+ esac
rc_failed
fi
rc_status -v
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org