Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 187855 - net-analyzer/nagios-core crashes on daemonizing
Summary: net-analyzer/nagios-core crashes on daemonizing
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Tobias Scherbaum (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-05 22:24 UTC by Rafael Alfaro
Modified: 2007-08-20 16:17 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
To fix this init script bug (nagios-init.patch,675 bytes, patch)
2007-08-05 22:28 UTC, Rafael Alfaro
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Alfaro 2007-08-05 22:24:33 UTC
The nagios init script does not work in the nagios 2.9 ebuild, I suggest the following:

--- /etc/init.d/nagios  2007-08-04 01:05:27.000000000 +0000
+++ /etc/init.d/nagios.new      2007-08-04 00:22:03.000000000 +0000
@@ -34,9 +34,9 @@
        touch /var/nagios/nagios.log /var/nagios/status.sav
        chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
        rm -f /var/nagios/rw/nagios.cmd
-       start-stop-daemon --quiet --start --startas /usr/nagios/bin/nagios \
+       start-stop-daemon --background --quiet --start --startas /usr/nagios/bin/nagios \
                -e HOME="/var/nagios/home" --pidfile /var/nagios/nagios.lock \
-               -- -d /etc/nagios/nagios.cfg
+               --  /etc/nagios/nagios.cfg
        eend $?
 }




Reproducible: Always

Steps to Reproduce:
1./etc/ini.t/nagios start
2.
3.

Actual Results:  
The nagios daemon does not start.

Expected Results:  
A nagios daemon started

--- /etc/init.d/nagios  2007-08-04 01:05:27.000000000 +0000
+++ /etc/init.d/nagios.new      2007-08-04 00:22:03.000000000 +0000
@@ -34,9 +34,9 @@
        touch /var/nagios/nagios.log /var/nagios/status.sav
        chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
        rm -f /var/nagios/rw/nagios.cmd
-       start-stop-daemon --quiet --start --startas /usr/nagios/bin/nagios \
+       start-stop-daemon --background --quiet --start --startas /usr/nagios/bin/nagios \
                -e HOME="/var/nagios/home" --pidfile /var/nagios/nagios.lock \
-               -- -d /etc/nagios/nagios.cfg
+               --  /etc/nagios/nagios.cfg
        eend $?
 }
Comment 1 Rafael Alfaro 2007-08-05 22:28:10 UTC
Created attachment 127015 [details, diff]
To fix this init script bug
Comment 2 Tobias Scherbaum (RETIRED) gentoo-dev 2007-08-07 09:37:14 UTC
Could you be a little bit more verbose on what the actual problem is and your specific setup? The current Init-Script worked flawless for quite a while ... (plus other distributions are using an init-script similiar to us, i.e. using -d).
Comment 3 Tobias Scherbaum (RETIRED) gentoo-dev 2007-08-17 00:15:45 UTC
Closing, please provide the information as requested and reopen if necessary.
Comment 4 Rafael Alfaro 2007-08-18 23:01:09 UTC
(In reply to comment #3)
> Closing, please provide the information as requested and reopen if necessary.
> 

Sorry about the delay, I had to travel in my work. :-)

Testing again, I'm not sure if this trouble is about gentoo or nagios itself.
Look at this:

# /usr/nagios/bin/nagios -v /etc/nagios/nagios.cfg

Nagios 2.9
Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
Last Modified: 04-10-2007
License: GPL

Reading configuration data...

Running pre-flight check on configuration data...

Checking services...
        Checked 7 services.
Checking hosts...
        Checked 2 hosts.
Checking host groups...
        Checked 5 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
        Checked 1 contacts.
Checking contact groups...
        Checked 1 contact groups.
Checking service escalations...
        Checked 0 service escalations.
Checking service dependencies...
        Checked 0 service dependencies.
Checking host escalations...
        Checked 0 host escalations.
Checking host dependencies...
        Checked 0 host dependencies.
Checking commands...
        Checked 144 commands.
Checking time periods...
        Checked 4 time periods.
Checking extended host info definitions...
        Checked 1 extended host info definitions.
Checking extended service info definitions...
        Checked 0 extended service info definitions.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Running the following I have success:

# /usr/nagios/bin/nagios  /etc/nagios/nagios.cfg

Nagios 2.9
Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)
Last Modified: 04-10-2007
License: GPL

Nagios 2.9 starting... (PID=16789)


But if I run it with the -d option it crash:

/usr/nagios/bin/nagios -d /etc/nagios/nagios.cfg
localhost ~ # echo $?
254

Thanks in advance.
Comment 5 Tobias Scherbaum (RETIRED) gentoo-dev 2007-08-20 12:05:33 UTC
Ok, appearantly this is not a bug in any init skript, it b0rkes while daemonizing. Anything in the log files? Please post the output of 'emerge --info'.
Comment 6 Rafael Alfaro 2007-08-20 16:02:29 UTC
(In reply to comment #5)
> Ok, appearantly this is not a bug in any init skript, it b0rkes while
> daemonizing. Anything in the log files? Please post the output of 'emerge
> --info'.
> 

emerge --info
Portage 2.1.2.11 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.5-r4, 2.6.21-gentoo-r4 i686)
=================================================================
System uname: 2.6.21-gentoo-r4 i686 Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Wed, 08 Aug 2007 08:00:01 +0000
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r6
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.21
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/terminfo"
CXXFLAGS="-march=prescott -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.osuosl.org/ "
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl administrator apache2 avahi berkdb bitmap-fonts cairo cli cracklib crypt cups dri fortran gconf gd gdbm gdm gnokii gnome gpm gtk hacking hal hash haskell iconv ipv6 isdnlog java5 jpeg ldap libg++ midi mudflap ncurses nls nptl nptlonly openmp pam pango pcre perl png pppd python readline reflection session spl ssl tcpd truetype-fonts type1-fonts unicode x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 7 Rafael Alfaro 2007-08-20 16:17:07 UTC
(In reply to comment #5)
> Ok, appearantly this is not a bug in any init skript, it b0rkes while
> daemonizing. Anything in the log files? Please post the output of 'emerge
> --info'.
> 
Well, thanks, a will close this.
The problem was in the configuration files, I was using a wrong path in the "lock_file".
Really thanks about the advices, look the nagios.log:
[1187573614] /var/run/nagios/nagios.pid does not exist (ENOENT)