瀏覽代碼

check_nt: allow returning UNKNOWN on timeouts (-u)

Thomas Guyot-Sionnest 17 年之前
父節點
當前提交
dd52d7e5e7
共有 2 個文件被更改,包括 9 次插入2 次删除
  1. 1 0
      NEWS
  2. 8 2
      plugins/check_nt.c

+ 1 - 0
NEWS

@@ -29,6 +29,7 @@ This file documents the major additions and syntax changes between releases.
 	Fixed negate not printing the real timeout in ALRM handler when left to default
 	Fixed negate not printing the real timeout in ALRM handler when left to default
 	negate timeout result is now configurable
 	negate timeout result is now configurable
 	Fixed segfault in check_mysql with old slaves (#2696823 - Oskar Ahner)
 	Fixed segfault in check_mysql with old slaves (#2696823 - Oskar Ahner)
+	check_nt can return UNKNOWN on timeouts (-u)
 
 
 1.4.13 25th Sept 2008
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

+ 8 - 2
plugins/check_nt.c

@@ -480,6 +480,7 @@ int process_arguments(int argc, char **argv){
 		{"params",   required_argument,0,'l'},
 		{"params",   required_argument,0,'l'},
 		{"secret",   required_argument,0,'s'},
 		{"secret",   required_argument,0,'s'},
 		{"display",  required_argument,0,'d'},
 		{"display",  required_argument,0,'d'},
+		{"unknown-timeout", no_argument, 0, 'u'},
 		{"version",  no_argument,      0,'V'},
 		{"version",  no_argument,      0,'V'},
 		{"help",     no_argument,      0,'h'},
 		{"help",     no_argument,      0,'h'},
 		{0,0,0,0}
 		{0,0,0,0}
@@ -506,7 +507,7 @@ int process_arguments(int argc, char **argv){
 	}
 	}
 
 
 	while (1) {
 	while (1) {
-		c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option);
+		c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:u",longopts,&option);
 
 
 		if (c==-1||c==EOF||c==1)
 		if (c==-1||c==EOF||c==1)
 			break;
 			break;
@@ -574,6 +575,9 @@ int process_arguments(int argc, char **argv){
 				if (!strcmp(optarg,"SHOWALL"))
 				if (!strcmp(optarg,"SHOWALL"))
 					show_all = TRUE;
 					show_all = TRUE;
 				break;
 				break;
+			case 'u':
+				socket_timeout_state=STATE_UNKNOWN;
+				break;
 			case 't': /* timeout */
 			case 't': /* timeout */
 				socket_timeout=atoi(optarg);
 				socket_timeout=atoi(optarg);
 				if(socket_timeout<=0)
 				if(socket_timeout<=0)
@@ -671,6 +675,8 @@ void print_help(void)
 	printf ("   %s", _("Parameters passed to specified check (see below)"));
 	printf ("   %s", _("Parameters passed to specified check (see below)"));
 	printf (" %s\n", "-d, --display={SHOWALL}");
 	printf (" %s\n", "-d, --display={SHOWALL}");
 	printf ("   %s", _("Display options (currently only SHOWALL works)"));
 	printf ("   %s", _("Display options (currently only SHOWALL works)"));
+	printf (" %s\n", "-u, --unknown-timeout");
+	printf ("   %s", _("Return UNKNOWN on timeouts"));
 	printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT);
 	printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT);
 	printf (" %s\n", "-h, --help");
 	printf (" %s\n", "-h, --help");
 	printf ("   %s\n", _("Print this help screen"));
 	printf ("   %s\n", _("Print this help screen"));
@@ -754,6 +760,6 @@ void print_usage(void)
 {
 {
 	printf (_("Usage:"));
 	printf (_("Usage:"));
 	printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname);
 	printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname);
-	printf ("[-l params] [-d SHOWALL] [-t timeout]\n");
+	printf ("[-l params] [-d SHOWALL] [-u] [-t timeout]\n");
 }
 }