Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1515445 - initscript 'kill' is mis-behaving in Nagios stop initscript
Summary: initscript 'kill' is mis-behaving in Nagios stop initscript
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: nagios
Version: el6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Stephen John Smoogen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-20 19:36 UTC by R P Herrold
Modified: 2017-12-10 23:28 UTC (History)
12 users (show)

Fixed In Version: nagios-4.3.4-7.el6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-08 19:35:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
the diff of what I used (which should match yours identically (890 bytes, text/plain)
2017-11-20 21:05 UTC, R P Herrold
no flags Details

Description R P Herrold 2017-11-20 19:36:44 UTC
Description of problem:

kill syntax is not working in initscript

as reported in an email, kill and the initscripts are having indigestion.

The weekend finally prised the testing candidate out into EPEL general

Version-Release number of selected component (if applicable):

[root@monitor sysconfig]# service nagios restart
Running configuration check...
Stopping nagios:kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
 done.
Starting nagios: done.

[root@monitor sysconfig]# rpm -q nagios
nagios-4.3.4-4.el6.i686

This may well be due to a change in the behavior of 'kill' rather than in Nagios

[root@monitor sysconfig]# rpm -qf `which kill `
util-linux-ng-2.17.2-12.28.el6_9.1.i686
...
Release     : 12.28.el6_9.1                 Build Date: Wed 15 Nov 2017 10:54:43 AM EST

============

I had noticed this elsewhere

relevant code:

[root@monitor init.d]# grep kill nagios 
killproc_nagios ()
        kill -s "$1" $NagiosPID
                killproc_nagios TERM
                        killproc_nagios KILL
                                killproc_nagios HUP
[root@monitor init.d]# 


seems to be on the stop side

[root@monitor init.d]# service nagios stop
Stopping nagios:kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
 done.
[root@monitor init.d]# 


Ask if you wish VM access and I can accomodate

-- Russ

Comment 1 Stephen John Smoogen 2017-11-20 20:48:21 UTC
I would like to test this in the nagios startup file

pid_nagios ()
{
        if test ! -f $NagiosRunFile; then
                echo "No lock file found in $NagiosRunFile"
                exit 1
        fi

        export NagiosPID=`head -n 1 $NagiosRunFile`
        if [[ -z "$NagiosPID" ]]; then
            echo "No usable PID found in $NagiosRunFile"
            exit 1
        fi

        regex='^[0-9]+$'
        if ! [[ $NagiosPID =~ $regex ]]; then
            echo "PID not number found in $NagiosRunFile"
            exit 1
        fi
        
}

The startup script probably needs a rewrite to be RHEL like versus the upstream but I removed that earlier due to other outstanding requests to use upstream.

Comment 2 R P Herrold 2017-11-20 21:04:03 UTC
[root@monitor init.d]# ps ax | grep nag
17066 pts/0    S+     0:00 grep nag
32182 ?        Ss     0:02 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
32184 ?        S      0:00 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
32185 ?        S      0:00 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
32186 ?        S      0:00 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
32187 ?        S      0:00 /usr/sbin/nagios --worker /var/spool/nagios/cmd/nagios.qh
32250 ?        S      0:00 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
[root@monitor init.d]# ps afx | grep "nagios [-]d" | head -n 1  ; cat /var/run/nagios/nagios.pid ; ./nagios restart
32182 ?        Ss     0:02 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
Running configuration check...
Stopping nagios:No usable PID found in /var/run/nagios/nagios.pid
Starting nagios: done.
[root@monitor init.d]# cat /var/run/nagios/nagios.pid
[root@monitor init.d]# ps afx | grep "nagios [-]d" | head -n 1  ; cat /var/run/nagios/nagios.pid ; ./nagios stop
32182 ?        Ss     0:02 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
Stopping nagios:No usable PID found in /var/run/nagios/nagios.pid
[root@monitor init.d]# ps afx | grep "nagios [-]d" | head -n 1  ; cat /var/run/nagios/nagios.pid ; ./nagios start
32182 ?        Ss     0:02 /usr/sbin/nagios -d /etc/nagios/nagios.cfg
Starting nagios: done.
[root@monitor init.d]# service nagios restart
Running configuration check...
Stopping nagios:No usable PID found in /var/run/nagios/nagios.pid
Starting nagios: done.
[root@monitor init.d]# 

diff patch file in a moment

Comment 3 R P Herrold 2017-11-20 21:05:45 UTC
Created attachment 1356179 [details]
the diff of what I used (which should match yours identically

Comment 4 R P Herrold 2017-11-20 21:07:31 UTC
did this as well, but not material

[root@monitor init.d]# restorecon -Rv .
restorecon reset /etc/rc.d/init.d/nagios-as_shipped context unconfined_u:object_r:etc_t:s0->unconfined_u:object_r:initrc_exec_t:s0
[root@monitor init.d]#

Comment 5 R P Herrold 2017-11-20 21:12:16 UTC
... so a PID update issue is newly present

Comment 6 Fedora Update System 2017-11-20 23:07:58 UTC
nagios-4.3.4-5.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-723d26389e

Comment 7 Fedora Update System 2017-11-21 19:27:56 UTC
nagios-4.3.4-5.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-723d26389e

Comment 8 R P Herrold 2017-11-21 19:52:43 UTC
further investigation indicates that when kill is not handed a valid PID, that message results ... just adding this here to help my memory

Comment 9 Fedora Update System 2017-11-24 13:16:30 UTC
nagios-4.3.4-6.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-ecb67df0a6

Comment 10 R P Herrold 2017-11-24 15:12:53 UTC
works here -- closing

Comment 11 Robert Scheck 2017-11-24 17:19:00 UTC
The initial fix breaks the setup here. Not only that the initscript did
contain a syntax error, it also does not stop/kill nagios at all, but it
does start a new instance additionally (when using "restart").

Comment 13 Fedora Update System 2017-11-25 05:23:21 UTC
nagios-4.3.4-7.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-ecb67df0a6

Comment 14 R P Herrold 2017-12-08 19:35:50 UTC
seems to work here with a couple weeks testing several times an hour and no errors

Comment 15 Fedora Update System 2017-12-10 23:28:12 UTC
nagios-4.3.4-7.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.