Bug#283875: [Pkg-nagios-devel] Bug#283875: nagios reload fails too

tony mancill "tony mancill" <tony@mancill.com>, 283875@bugs.debian.org
Thu, 2 Dec 2004 10:40:48 -0800 (PST)


FWIW, we had to drop the "-e 5" in the check_nagios portion of
check_started(), since it wouldn't let us restart if the platform has been
running less than 5 minutes.

On Thu, December 2, 2004 6:56 am, Olaf van der Spek said:
> sean finney wrote:
>> On Thu, Dec 02, 2004 at 12:36:16PM +0100, Olaf van der Spek wrote:
>>
>>>I'm afraid I can't reproduce the bug anymore.
>>>I guess a couple of reboots and nagios restarts have fixed it.
>>
>>
>> could it be that the new init script was unable to stop the old
>> nagios process from the previous version of the package, and once
>> you killed it things were okay?
>
> Hmm, now it happened again:
> debian:/etc/init.d# cat nagios
> #! /bin/sh
> #
> # skeleton      example file to build /etc/init.d/ scripts.
> #               This file should be used to construct scripts for
> /etc/init.d.
> #
> #               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
> #               Modified for Debian GNU/Linux
> #               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
> #
> # Version:      @(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
> #
> # This file was automatically customized by dh-make on Mon, 17 Jan 2000
> 19:30:36 +0000
> # Hacked into netsaint shape by bjb.
>
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> DAEMON=/usr/sbin/nagios
> NAME=nagios
> DESC=nagios
> NICENESS=5
> NAMEDPIPE=/var/run/nagios/nagios.cmd
> PIDFILE=/var/run/nagios/nagios.pid
> CONFIG=/etc/nagios/nagios.cfg
>
> test -f $DAEMON || exit 0
>
> set -e
> set -x
> #
> # Is this function useful at all?
> # start-stop-daemon should handle this work!
> #
> check_started () {
>      if [ -f /etc/nagios/check_nagios_db ]; then
>          if /etc/nagios/check_nagios_db > /dev/null; then
>              return 0    # Is started
>          else
>              return 1    # Isn't started
>          fi
>      elif [ -f /usr/lib/nagios/plugins/check_nagios ]; then
>          if /usr/lib/nagios/plugins/check_nagios -F
> /var/log/nagios/status.log -e 5 -C 'nagios' > /dev/null; then
>              return 0    # Is started
>          else
>              return 1    # Isn't started
>          fi
>      elif [ -f /usr/lib/netsaint/plugins/check_netsaint ]; then
>          if /usr/lib/netsaint/plugins/check_netsaint -F
> /var/log/nagios/status.log -e 5 -C 'nagios' > /dev/null; then
>              return 0    # Is started
>          else
>              return 1    # Isn't started
>          fi
>      elif [ -f $PIDFILE ]; then
>          # Try discovering if nagios is alive checking its pid
>          if kill -CHLD $( cat $PIDFILE ) ; then
>              return 1    # Isn't started
>          else
>              return 0    # Is started
>          fi
>      else
>          return 1        # Isn't started
>      fi
> }