[Pkg-nagios-devel] Bug#476466: please be more specific

Ferenc Wagner wferi at niif.hu
Wed Jun 11 09:45:04 UTC 2008


Hi,

I'm afraid this solution would break our setup, where we run several
Nagios instances on the same machine.  Currently Nagios 2.11, but we
would like to upgrade.  It all goes very well with the following patch
to the Backports.org init script:

--- /etc/init.d/nagios2	2008-04-07 23:57:30.000000000 +0200
+++ nagios2.init	2008-06-04 13:25:30.382366098 +0200
@@ -27,15 +27,6 @@
   exit 1
 fi
 
-DAEMON=/usr/sbin/nagios2
-NAME="nagios2"
-DESC="nagios2 monitoring daemon"
-NAGIOSCFG="/etc/nagios2/nagios.cfg"
-CGICFG="/etc/nagios2/cgi.cfg"
-NICENESS=5
-
-[ -x "$DAEMON" ] || exit 0
-[ -r /etc/default/nagios2 ] && . /etc/default/nagios2
 
 # this is from madduck on IRC, 2006-07-06
 # There should be a better possibility to give daemon error messages
@@ -109,6 +100,16 @@
   fi
 }
 
+DAEMON=/usr/sbin/nagios2
+NAME=$(basename $0)
+[ -d /etc/niif/$NAME ] || NAME=${NAME#[SK][0-9][0-9]}
+DESC="nagios2 monitoring daemon"
+CGICFG=/etc/niif/$NAME/cgi.cfg
+NAGIOSCFG=$(get_config main_config_file $CGICFG)
+NICENESS=5
+
+[ -x "$DAEMON" ] || exit 0
+
 if [ ! -f "$NAGIOSCFG" ]; then
   log_failure_msg "There is no configuration file for Nagios 2."
   exit 6
@@ -118,10 +119,6 @@
 [ -n "$THEPIDFILE" ] || THEPIDFILE='/var/run/nagios2/nagios.pid'
 
 start () {
-  DIRECTORY=$(dirname $THEPIDFILE)
-  [ ! -d $DIRECTORY ] && mkdir -p $DIRECTORY
-  chown nagios:nagios $DIRECTORY
-
   if ! check_started; then
     if ! check_named_pipe; then
       log_action_msg "named pipe exists - removing"

The various instances run as separate users.  Don't you think ours is
a need general enough not to make it harder to achieve?  Together with
SetEnv NAGIOS_CGI_CONFIG /etc/niif/<NAME>/cgi.cfg in the VirtualHost
declaration we find the above a very effective solution to mass Nagios
hosting.  And one can find several such queries on the web.  It would
be very nice if this could be a recognized or even a somewhat
supported use case.  What do you think?
-- 
Thanks,
Feri.





More information about the Pkg-nagios-devel mailing list