Bug 928248

Summary: NSCA Daemon can't be started by systemd
Product: [Fedora] Fedora Reporter: fedora-bugreport
Component: nscaAssignee: Xavier Bachelot <xavier>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 18CC: fedora-bugreport, gyurco, sergio.pasra, xavier
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: nsca-2.9.1-9.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-31 02:58:18 UTC Type: Bug
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
NSCA configuration none

Description fedora-bugreport 2013-03-27 09:10:59 UTC
Created attachment 716959 [details]
NSCA configuration

Description of problem:
Nsca daemon can't be started using systemd; manual start works fine.


Version-Release number of selected component (if applicable):
nsca-2.9.1-4.fc18.x86_64

How reproducible:
systemctl start nsca.service

Steps to Reproduce:
1. Make sure that the nsca daemon is not running
2. systemctl start nsca.service
3. Take a look at /var/log/messages. There will be a message like "monitoring systemd[1]: Started Nagios Service Check Acceptor."
4. Neither "netstat -panto | grep 5667" nor "ps waux | grep nsca" will show a result
  
Actual results:
Nsca is not running.

Expected results:
Nsca should be up and running.

Additional info:

1. It's possible to start the nsca daemon using the following command:

/usr/sbin/nsca -c /etc/nagios/nsca.cfg

2. IMHO the problem is NOT caused by SELinux. Even if SELinux is in permissive modus (setenforce 0; sestatus) nsca won't start.

3. Neither "/var/log/messages" nor "/var/spool/nagios/cmd/nagios.cmd" or /var/log/nagios/nagios.log" shows an error

4. /lib/systemd/system/nsca.service was not changed

5. /etc/sysconfig/nsca doesn't contain any options

6. As expected, the nsca daemon won't start if an old sysinitv script is used

Comment 1 Sergio Pascual 2013-07-26 16:17:16 UTC
I have tried with this modified nsca.service file and it seems to work:

[Unit]
Description=Nagios Service Check Acceptor
After=syslog.target network.target auditd.service

[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/nsca
ExecStart=/usr/sbin/nsca $OPTIONS -c /etc/nagios/nsca.cfg --daemon
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Comment 2 Xavier Bachelot 2013-07-27 11:58:36 UTC
I think the issue will be resolved if you force the OPTIONS variable to either --single or --daemon in /etc/sysconfig/nsca (with the original systemd unit file).
--single is the default, but it seems nsca won't start with systemd if no option is specified.

Thanks for putting me on the right track Sergio, I was really at lost with this bug.

Comment 3 Xavier Bachelot 2013-07-27 15:16:39 UTC
Here's the url from a scratch build : http://koji.fedoraproject.org/koji/taskinfo?taskID=5663931
When you'll confirm it fixes the issue, I'll make a real build and push it to updates-testing.

Comment 4 Sergio Pascual 2013-09-19 10:19:47 UTC
I can't download the rpm from there. Why not push an update to testing?

Comment 5 Szombathelyi György 2013-10-09 19:03:39 UTC
The problem is still there in Fedora 19.
--single option (the default) for nsca needs Type=Forking in the .service file
(well, another bug that systemd doesn't really logs why it kills the nsca daemon with the wrong Type)

Comment 6 Xavier Bachelot 2013-10-09 22:17:25 UTC
(In reply to Szombathelyi György from comment #5)
> The problem is still there in Fedora 19.
> --single option (the default) for nsca needs Type=Forking in the .service
> file
> (well, another bug that systemd doesn't really logs why it kills the nsca
> daemon with the wrong Type)

Thanks, I guess I still have a lot to learn about systemd.

I pushed the fix to git master and launched a build for rawhide :
http://koji.fedoraproject.org/koji/taskinfo?taskID=6044405

I'll push the fix to earlier branches when confirmed it's ok.

Comment 7 Fedora Update System 2013-10-22 14:31:12 UTC
nsca-2.9.1-8.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/nsca-2.9.1-8.fc19

Comment 8 Fedora Update System 2013-10-22 14:32:13 UTC
nsca-2.9.1-8.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/nsca-2.9.1-8.fc20

Comment 9 Fedora Update System 2013-10-22 14:33:43 UTC
nsca-2.9.1-8.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/nsca-2.9.1-8.fc18

Comment 10 Fedora Update System 2013-10-22 18:54:34 UTC
Package nsca-2.9.1-8.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing nsca-2.9.1-8.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-19705/nsca-2.9.1-8.fc20
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-10-31 02:58:18 UTC
nsca-2.9.1-8.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2013-10-31 03:04:49 UTC
nsca-2.9.1-8.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2013-11-10 06:57:25 UTC
nsca-2.9.1-8.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Szombathelyi György 2014-04-24 20:56:04 UTC
Seems systemd doesn't accept Forking with capital 'F' anymore, it has to be changed to Type=forking (Type with captial 'T', forking with 'f'). Not commenting...

Comment 15 Fedora Update System 2014-04-26 16:56:38 UTC
nsca-2.9.1-9.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/nsca-2.9.1-9.fc19

Comment 16 Fedora Update System 2014-04-26 16:56:48 UTC
nsca-2.9.1-9.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/nsca-2.9.1-9.fc20

Comment 17 Fedora Update System 2014-05-06 03:29:53 UTC
nsca-2.9.1-9.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2014-05-06 03:40:55 UTC
nsca-2.9.1-9.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.