summaryrefslogtreecommitdiffstats
path: root/web/attachments/415177-check_icmp.patch
blob: 570e4f7bda89ffc09d9fc1dcefaa2e41ccc89043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- check_icmp.c.orig	2011-06-12 13:05:39.000000000 +0200
+++ check_icmp.c	2011-06-12 13:21:28.000000000 +0200
@@ -204,7 +204,7 @@
 /** global variables **/
 static struct rta_host **table, *cursor, *list;
 static threshold crit = {80, 500000}, warn = {40, 200000};
-static int mode, protocols, sockets, debug = 0, timeout = 10;
+static int mode, protocols, sockets, debug = 0, timeout = 10, allperf = 1;
 static unsigned short icmp_data_size = DEFAULT_PING_DATA_SIZE;
 static unsigned short icmp_pkt_size = DEFAULT_PING_DATA_SIZE + ICMP_MINLEN;
 
@@ -456,7 +456,7 @@
 
 	/* parse the arguments */
 	for(i = 1; i < argc; i++) {
-		while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) {
+		while((arg = getopt(argc, argv, "vhVaw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) {
 			long size;
 			switch(arg) {
 			case 'v':
@@ -512,6 +512,9 @@
 			case 's': /* specify source IP address */
 				set_source_ip(optarg);
 				break;
+			case 'a':
+				allperf = 0;
+				break;
       case 'V':                 /* version */
         print_revision (progname, NP_VERSION);
         exit (STATE_OK);
@@ -1002,12 +1005,16 @@
 	host = list;
 	while(host) {
 		if(debug) puts("");
-		printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; %srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ",
+		if(allperf) printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; %srtmax=%0.3fms;;;; %srtmin=%0.3fms;;;; ",
 			   (targets > 1) ? host->name : "",
 			   host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000,
 			   (targets > 1) ? host->name : "", host->pl, warn.pl, crit.pl,
 			   (targets > 1) ? host->name : "", (float)host->rtmax / 1000,
 			   (targets > 1) ? host->name : "", (host->rtmin < DBL_MAX) ? (float)host->rtmin / 1000 : (float)0);
+		else printf("%srta=%0.3fms;%0.3f;%0.3f;0; %spl=%u%%;%u;%u;; ",
+			   (targets > 1) ? host->name : "",
+			   host->rta / 1000, (float)warn.rta / 1000, (float)crit.rta / 1000,
+			   (targets > 1) ? host->name : "", host->pl, warn.pl, crit.pl);
 
 		host = host->next;
 	}
@@ -1315,6 +1322,8 @@
   printf (" %s\n", "-b");
   printf ("    %s\n", _("Number of icmp data bytes to send"));
   printf ("    %s %u + %d)\n", _("Packet size will be data bytes + icmp header (currently"),icmp_data_size, ICMP_MINLEN);
+  printf (" %s\n", "-a");
+  printf ("    %s\n",_("no rtmin/rtmax performance data"));
   printf (" %s\n", "-v");
   printf ("    %s\n", _("verbose"));