Bug 546561

Summary: /etc/init.d/nagios status always returns 0
Product: [Fedora] Fedora Reporter: Ricky Zhou <rzhou>
Component: nagiosAssignee: Peter Lemenkov <lemenkov>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: blogcomment, mmcgrath, redhat, sebastian.gosenheimer, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nagios-3.2.0-4.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-09 03:16:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
[PATCH] Fix status return code and nagios.pid SELinux context.
none
Fix status return code and nagios.pid SELinux context. none

Description Ricky Zhou 2009-12-11 08:49:27 UTC
Created attachment 377691 [details]
[PATCH] Fix status return code and nagios.pid SELinux context.

Description of problem:
/etc/init.d/nagios status always returns 0, even when nagios is not running.

Version-Release number of selected component (if applicable):
nagios-3.2.0-2.fc12.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Stop nagios
2. Run /etc/init.d/nagios status
3. echo $?
  
Actual results:
Returns 0

Expected results:
Return non-zero status.


Additional info:
The initscript included in the nagios tarball is honestly kind of a nightmare,
but the attached patch fixes the issue for now.

The patch also includes Daniel Walsh's SELinux-related fix from bug #539963.

Comment 1 Ricky Zhou 2010-01-20 16:16:45 UTC
Reassigning to new owners.

Comment 2 J. David Beutel 2010-02-09 06:49:56 UTC
In the attached patch, the

if [ $RETVAL = 0]; then

maybe should be

if [ $RETVAL = 0 ]; then

Comment 3 Ricky Zhou 2010-02-09 07:35:01 UTC
Created attachment 389690 [details]
Fix status return code and nagios.pid SELinux context.

Good catch, here's a new patch with your fix.

Comment 4 Ricky Zhou 2010-02-21 20:57:21 UTC
Ping, any update on this?  This is breaking tools (like puppet) that depend on the return status of initscripts to tell if nagios is running, and the SELinux issue is making the initscript fail on machines with SELinux enforcing.

Comment 5 Peter Lemenkov 2010-02-22 05:09:26 UTC
I'll fix it very soon. Thanks you for patch.

Comment 6 Fedora Update System 2010-02-25 12:16:46 UTC
nagios-3.2.0-4.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/nagios-3.2.0-4.fc12

Comment 7 Fedora Update System 2010-02-25 12:17:12 UTC
nagios-3.2.0-4.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/nagios-3.2.0-4.fc13

Comment 8 Fedora Update System 2010-02-25 12:17:35 UTC
nagios-3.2.0-4.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/nagios-3.2.0-4.fc11

Comment 9 Fedora Update System 2010-02-26 03:36:39 UTC
nagios-3.2.0-4.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update nagios'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2010-2903

Comment 10 Fedora Update System 2010-02-26 03:37:44 UTC
nagios-3.2.0-4.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update nagios'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-2917

Comment 11 Fedora Update System 2010-02-26 03:45:43 UTC
nagios-3.2.0-4.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update nagios'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F13/FEDORA-2010-2957

Comment 12 Fedora Update System 2010-03-09 03:15:38 UTC
nagios-3.2.0-4.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2010-03-09 03:27:12 UTC
nagios-3.2.0-4.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2010-03-09 03:36:43 UTC
nagios-3.2.0-4.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.