[Pkg-nagios-devel] init-script exits after sucessfully creating folder /var/run/nagios

Mattias Fransson mattias at webben.nu
Sat Dec 28 20:09:13 UTC 2013


Package: nsca
Version: 2.9.1-2
Architecture: armhf
Description: Nagios service monitor

Lines 47-50 of the init script seems to be malformed.

The package init script (/etc/init.d/nsca) has the following if clause:

if [ ! -d "/var/run/nagios" ]; then
    mkdir -p /var/run/nagios || log_failure_msg "couldn't create
/var/run/nagios"
    exit 1
fi

It will cause the script to exit if the folder /var/run/nagios is lacking,
even if the mkdir is successfull.

This must, in my opinion, be malformed.

My system (raspberry pi, tmpfs for /var/run) needs the folder created on
each boot, but the script exits after the folder is created and the service
is not started.

Changing the lines to the following makes the service start on boot for me:

if [ ! -d "/var/run/nagios" || ! mkdir -p /var/run/nagios ]; then
    log_failure_msg "couldn't create /var/run/nagios"
    exit 1
fi


Information from the system:
root at rpi:~# which nsca
/usr/sbin/nsca
root at rpi:~# type nsca
nsca is /usr/sbin/nsca
root at rpi:~# dpkg --search /usr/sbin/nsca
nsca: /usr/sbin/nsca
root at rpi:~# dpkg --list nsca
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                    Version
Architecture             Description
+++-=======================================-========================-========================-===================================================================================
ii  nsca                                    2.9.1-2
armhf                    Nagios service monitor agent
root at rpi:~# dpkg --status nsca
Package: nsca
Status: install ok installed
Priority: optional
Section: net
Installed-Size: 126
Maintainer: Debian Nagios Maintainer Group <
pkg-nagios-devel at lists.alioth.debian.org>
Architecture: armhf
Version: 2.9.1-2
Depends: libc6 (>= 2.4), libmcrypt4, debconf (>> 0.5) | debconf-2.0,
nsca-client, confget
Suggests: nagios3, nagios-plugins-basic | nagios-plugins
Conffiles:
 /etc/nsca.cfg 5de6af7fc3db8b95a1a9238b6cce8aa0
 /etc/init.d/nsca 64b8f41f3240a8272f04542642a570ff
Description: Nagios service monitor agent
 This addon allows you to send service check results to a central
 monitoring server running Nagios in a reasonably secure manner.
 .
 Nagios is a monitoring and management system for hosts, services and
 networks.
 .
 Nagios' features include:
 .
  -  Monitoring of network services (via TCP port, SMTP, POP3, HTTP, NNTP,
     PING, etc.)
  -  Plugin interface to allow for user-developed service checks
  -  Contact notifications when problems occur and get resolved (via email,
     pager, or user-defined method)
  -  Ability to define event handlers to be run during service or host
events
     (for proactive problem resolution)
  -  Web output (current status, notifications, problem history, log file,
     etc.)
 .
 Nagios was written in C and is designed to be easy to understand and modify
 to fit your own needs.

Sincerely,
Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20131228/60275096/attachment-0001.html>


More information about the Pkg-nagios-devel mailing list