[Nagios-devel] [PATCH] nrpe configuration verify option
Posted: Fri Sep 05, 2003 7:59 am
--=-nurRykcVazB1vCdXw1Xa
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Attached patch adds -v|--verify option to verify the configuration file,
then exit. Patched against 2.0b5.
-Al Tobey
** ** ** PRIVILEGED AND CONFIDENTIAL ** ** **
This email transmission contains privileged and confidential information
intended only for the use of the individual or entity named above. Any
unauthorized review, use, disclosure or distribution is prohibited and
may be a violation of law. If you are not the intended recipient or a
person responsible for delivering this message to an intended recipient,
please delete the email and immediately notify the sender via the email
return address or mailto:[email protected]. Thank you.
--=-nurRykcVazB1vCdXw1Xa
Content-Disposition: attachment; filename=nrpe-config-verify.diff
Content-Type: text/plain; name=nrpe-config-verify.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
--- nrpe.c.orig Tue Jul 22 22:14:55 2003
+++ nrpe.c Fri Sep 5 11:52:25 2003
@@ -73,6 +73,7 @@
int show_version=FALSE;
int use_inetd=TRUE;
int debug=FALSE;
+int verify_only=FALSE;
#ifdef HAVE_SSL
SSL_METHOD *meth;
@@ -127,6 +128,7 @@
printf(" = One of the following two operating modes:\n");
printf(" -i = Run as a service under inetd or xinetd\n");
printf(" -d = Run as a standalone daemon\n");
+ printf(" -v = check configs - exit 0 if ok\n");
printf("\n");
printf("Notes:\n");
printf("This program is designed to process requests from the check_nrpe\n");
@@ -175,6 +177,10 @@
return STATE_CRITICAL;
}
+ if(verify_only==TRUE){
+ exit(STATE_OK);
+ }
+
/* initialize macros */
for(x=0;x<MAX_COMMAND_ARGUMENTS;x++)
macro_argv[x]=NULL;
@@ -1446,6 +1452,7 @@
{"no-ssl", no_argument, 0, 'n'},
{"help", no_argument, 0, 'h'},
{"license", no_argument, 0, 'l'},
+ {"verify", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
#endif
@@ -1454,7 +1461,7 @@
if(argc<2)
return ERROR;
- snprintf(optchars,MAX_INPUT_BUFFER,"c:nidhl");
+ snprintf(optchars,MAX_INPUT_BUFFER,"c:nidhlv");
while(1){
#ifdef HAVE_GETOPT_H
@@ -1493,6 +1500,10 @@
case 'n':
use_ssl=FALSE;
break;
+ case 'v':
+ have_mode=TRUE;
+ verify_only=TRUE;
+ break;
default:
return ERROR;
break;
--=-nurRykcVazB1vCdXw1Xa--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Attached patch adds -v|--verify option to verify the configuration file,
then exit. Patched against 2.0b5.
-Al Tobey
** ** ** PRIVILEGED AND CONFIDENTIAL ** ** **
This email transmission contains privileged and confidential information
intended only for the use of the individual or entity named above. Any
unauthorized review, use, disclosure or distribution is prohibited and
may be a violation of law. If you are not the intended recipient or a
person responsible for delivering this message to an intended recipient,
please delete the email and immediately notify the sender via the email
return address or mailto:[email protected]. Thank you.
--=-nurRykcVazB1vCdXw1Xa
Content-Disposition: attachment; filename=nrpe-config-verify.diff
Content-Type: text/plain; name=nrpe-config-verify.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
--- nrpe.c.orig Tue Jul 22 22:14:55 2003
+++ nrpe.c Fri Sep 5 11:52:25 2003
@@ -73,6 +73,7 @@
int show_version=FALSE;
int use_inetd=TRUE;
int debug=FALSE;
+int verify_only=FALSE;
#ifdef HAVE_SSL
SSL_METHOD *meth;
@@ -127,6 +128,7 @@
printf(" = One of the following two operating modes:\n");
printf(" -i = Run as a service under inetd or xinetd\n");
printf(" -d = Run as a standalone daemon\n");
+ printf(" -v = check configs - exit 0 if ok\n");
printf("\n");
printf("Notes:\n");
printf("This program is designed to process requests from the check_nrpe\n");
@@ -175,6 +177,10 @@
return STATE_CRITICAL;
}
+ if(verify_only==TRUE){
+ exit(STATE_OK);
+ }
+
/* initialize macros */
for(x=0;x<MAX_COMMAND_ARGUMENTS;x++)
macro_argv[x]=NULL;
@@ -1446,6 +1452,7 @@
{"no-ssl", no_argument, 0, 'n'},
{"help", no_argument, 0, 'h'},
{"license", no_argument, 0, 'l'},
+ {"verify", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
#endif
@@ -1454,7 +1461,7 @@
if(argc<2)
return ERROR;
- snprintf(optchars,MAX_INPUT_BUFFER,"c:nidhl");
+ snprintf(optchars,MAX_INPUT_BUFFER,"c:nidhlv");
while(1){
#ifdef HAVE_GETOPT_H
@@ -1493,6 +1500,10 @@
case 'n':
use_ssl=FALSE;
break;
+ case 'v':
+ have_mode=TRUE;
+ verify_only=TRUE;
+ break;
default:
return ERROR;
break;
--=-nurRykcVazB1vCdXw1Xa--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]