Selaa lähdekoodia

Bug fixes, spec file and init script changes by James Peterson, added sample xinetd config file

Ethan Galstad 23 vuotta sitten
vanhempi
commit
135c113ad3
13 muutettua tiedostoa jossa 59 lisäystä ja 29 poistoa
  1. 3 1
      Changelog
  2. 2 2
      Makefile.in
  3. 3 3
      README
  4. 1 1
      common/common.h
  5. 5 2
      configure
  6. 5 2
      configure.in
  7. 3 3
      init-script.debian.in
  8. 3 3
      init-script.freebsd.in
  9. 3 3
      init-script.in
  10. 5 6
      nrpe.spec
  11. 15 0
      nrpe.xinetd.in
  12. 1 1
      src/check_nrpe.c
  13. 10 2
      src/nrpe.c

+ 3 - 1
Changelog

@@ -5,8 +5,10 @@ NRPE Changelog
 
 1.7 - ??/??/2003
 ----------------
-- Updated spec file
+- Spec file updates and minor bug fixes (James Peterson)
 - Bug fix with default nrpe port definition
+- Added sample xinetd config file (nrpe.xinetd)
+- Bug fix for command_timeout variable (James Peterson)
 
 
 1.6 - 12/30/2002

+ 2 - 2
Makefile.in

@@ -1,7 +1,7 @@
 ###############################
 # Makefile for NRPE
 #
-# Last Modified: 06-03-2002
+# Last Modified: 01-07-2003
 ###############################
 
 
@@ -48,7 +48,7 @@ clean:
 	cd $(SRC_BASE); $(MAKE) $@ ; cd ..
 	rm -f core
 	rm -f *~ */*~
-	rm -f config.log config.status config.cache nrpe.cfg Makefile subst $(SRC_COMMON)/config.h
+	rm -f config.log config.status config.cache nrpe.cfg nrpe.xinetd Makefile subst $(SRC_COMMON)/config.h init-script init-script.debian init-script.freebsd
 
 distclean: clean
 

+ 3 - 3
README

@@ -98,7 +98,7 @@ of TCP wrappers, you need to do the following things:
    /etc/inetd.conf as follows:
 
 
-	nrpe 	stream 	tcp 	nowait 	<user> /usr/sbin/tcpd <nrpebin> --inetd -c <nrpecfg>
+	nrpe 	stream 	tcp 	nowait 	<user> /usr/sbin/tcpd <nrpebin> -c <nrpecfg> --inetd
 
 
    - Replace <user> with the name of the user that the nrpe server should run as.
@@ -124,7 +124,7 @@ of TCP wrappers, you need to do the following things:
         	wait            = no
 	        user            = <user>
         	server          = <nrpebin>
-	        server_args     = --inetd -c <nrpecfg>
+	        server_args     = -c <nrpecfg> --inetd
         	log_on_failure  += USERID
 	        disable         = no
 		only_from       = <ipaddress1> <ipaddress2> ...
@@ -169,7 +169,7 @@ command definition for the check_nrpe plugin would look like this:
 
 define command{
 	command_name	check_nrpe
-	command_line	/usr/local/nagios/libexec/check_nrpe $HOSTADDRESS$ -c $ARG1$
+	command_line	/usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
 	}
 
 In any service definitions that use the nrpe plugin/daemon to

+ 1 - 1
common/common.h

@@ -23,7 +23,7 @@
 
 
 #define PROGRAM_VERSION "1.7"
-#define MODIFICATION_DATE "01-06-2003"
+#define MODIFICATION_DATE "01-07-2003"
 
 #define OK		0
 #define ERROR		-1

+ 5 - 2
configure

@@ -527,7 +527,7 @@ fi
 PKG_NAME=nrpe
 PKG_VERSION="1.7"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="01-06-2003"
+PKG_REL_DATE="01-07-2003"
 
 
 ac_aux_dir=
@@ -2074,7 +2074,10 @@ test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
 
 perl subst nrpe.cfg
-
+perl subst init-script
+perl subst init-script.debian
+perl subst init-script.freebsd
+perl subst nrpe.xinetd
 
 
 echo ""

+ 5 - 2
configure.in

@@ -11,7 +11,7 @@ AC_PREFIX_DEFAULT(/usr/local/nagios)
 PKG_NAME=nrpe
 PKG_VERSION="1.7"
 PKG_HOME_URL="http://www.nagios.org/"
-PKG_REL_DATE="01-06-2003"
+PKG_REL_DATE="01-07-2003"
 
 dnl Figure out how to invoke "install" and what install options to use.
 
@@ -66,7 +66,10 @@ AC_PATH_PROG(PERL,perl)
 AC_OUTPUT(Makefile src/Makefile subst)
 
 perl subst nrpe.cfg
-
+perl subst init-script
+perl subst init-script.debian
+perl subst init-script.freebsd
+perl subst nrpe.xinetd
 
 
 dnl Review options

+ 3 - 3
init-script.debian → init-script.debian.in

@@ -4,14 +4,14 @@
 # Contributed by Andrew Ryder 06-22-02
 # Slight mods by Ethan Galstad 07-09-02
 
-NrpeBin=/usr/sbin/nrpe
-NrpeCfg=/etc/nrpe.cfg
+NrpeBin=@bindir@/nrpe
+NrpeCfg=@sysconfdir@/nrpe.cfg
 
 test -f $NrpeBin || exit 0
 
 case "$1" in
 start)	echo -n "Starting nagios remote plugin daemon: nrpe"
-        start-stop-daemon --start --quiet --exec $NrpeBin -- -d $NrpeCfg
+        start-stop-daemon --start --quiet --exec $NrpeBin -c $NrpeCfg -d
         echo "." 
 	;;
 stop)	echo -n "Stopping nagios remote plugin daemon: nrpe"

+ 3 - 3
init-script.freebsd → init-script.freebsd.in

@@ -4,12 +4,12 @@
 # Contributed by Andrew Ryder 06-22-02
 # Slight mods by Ethan Galstad 07-09-02
 
-NrpeBin=/usr/local/bin/nrpe
-NrpeCfg=/usr/local/etc/nrpe.cfg
+NrpeBin=@bindir@/nrpe
+NrpeCfg=@sysconfdir@/nrpe.cfg
 
 case "$1" in
 start)
-	$NrpeBin -d $NrpeCfg
+	$NrpeBin -c $NrpeCfg -d
 	echo -n ' nrpe'
 	;;
 stop)

+ 3 - 3
init-script → init-script.in

@@ -27,8 +27,8 @@ fi
 # Check that networking is up.
 [ ${NETWORKING} = "no" ] && exit 0
 
-NrpeBin=/usr/local/nagios/bin/nrpe
-NrpeCfg=/usr/local/nagios/etc/nrpe.cfg
+NrpeBin=@bindir@/nrpe
+NrpeCfg=@sysconfdir@/nrpe.cfg
 LockFile=/var/lock/subsys/nrpe
 
 # See how we were called.
@@ -36,7 +36,7 @@ case "$1" in
   start)
 	# Start daemons.
 	echo -n "Starting nrpe: "
-	daemon $NrpeBin -d $NrpeCfg
+	daemon $NrpeBin -c $NrpeCfg -d
 	echo
 	touch $LockFile
 	;;

+ 5 - 6
nrpe.spec

@@ -1,6 +1,6 @@
 %define name nrpe
 %define version 1.7
-%define release 3
+%define release 1
 %define nsusr nagios
 %define nsgrp nagios
 %define nsport 5666
@@ -86,11 +86,6 @@ fi
 if [ "$1" -ge "1" ]; then
 	/sbin/service nrpe condrestart >/dev/null 2>&1 || :
 fi
-# Delete nagios user and group
-if [ $1 = 0 ]; then
-	/usr/sbin/userdel %{nsusr} || %nnmmsg "User %{nsusr} could not be deleted."
-	/usr/sbin/groupdel %{nsgrp} || %nnmmsg "Group %{nsgrp} could not be deleted."
-fi
 
 %build
 export PATH=$PATH:/usr/sbin
@@ -145,6 +140,10 @@ rm -rf $RPM_BUILD_ROOT
 %doc Changelog LEGAL README
 
 %changelog
+* Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
+- Removed the lines which removed the nagios user and group from the system
+- changed the patch release version from 3 to 1
+
 * Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
 - Removed patch files required for nrpe 1.5
 - Update spec file for version 1.6 (1.6-1)

+ 15 - 0
nrpe.xinetd.in

@@ -0,0 +1,15 @@
+# default: on
+# description: NRPE (Nagios Remote Plugin Executor)
+service nsca
+{
+       	flags           = REUSE
+        socket_type     = stream        
+       	wait            = no
+        user            = @nrpe_user@
+	group		= @nrpe_grp@
+       	server          = @bindir@/nrpe
+        server_args     = -c @sysconfdir@/nrpe.cfg --inetd
+       	log_on_failure  += USERID
+        disable         = no
+	only_from       = 127.0.0.1
+}

+ 1 - 1
src/check_nrpe.c

@@ -4,7 +4,7 @@
  * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 01-06-2003
+ * Last Modified: 01-07-2003
  *
  * Command line: CHECK_NRPE -H <host_address> [-p port] [-c command] [-wt warn_time] \
  *                          [-ct crit_time] [-to to_sec]

+ 10 - 2
src/nrpe.c

@@ -4,9 +4,9 @@
  * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
  * License: GPL
  *
- * Last Modified: 01-06-2003
+ * Last Modified: 01-07-2003
  *
- * Command line: nrpe [--inetd | --standalone] -c <config_file>
+ * Command line: nrpe -c <config_file> [--inetd | --daemon]
  *
  * Description:
  *
@@ -270,6 +270,14 @@ int read_config_file(char *filename){
 
                 else if(!strcmp(varname,"nrpe_group"))
 			nrpe_group=strdup(varvalue);
+		
+		else if(!strcmp(varname,"command_timeout")){
+			command_timeout=atoi(varvalue);
+			if(command_timeout<1){
+				syslog(LOG_ERR,"Invalid command_timeout specified in config file '%s' - Line %d\n",filename,line);
+				return ERROR;
+			        }
+		        }
 
 		else{
 			syslog(LOG_ERR,"Unknown option specified in config file '%s' - Line %d\n",filename,line);