summaryrefslogtreecommitdiffstats
path: root/web/attachments/302976-nagios-plugins-check_fping-timeout-1.4.13.patch
blob: 965631e769ac701ede31dfcea4e7b49988bedb77 (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
58
59
60
61
62
diff -urN nagios-plugins-1.4.13.ORIG/plugins/check_fping.c nagios-plugins-1.4.13/plugins/check_fping.c
--- nagios-plugins-1.4.13.ORIG/plugins/check_fping.c    2008-11-15 08:39:42.000000000 +0000
+++ nagios-plugins-1.4.13/plugins/check_fping.c 2008-11-15 10:03:56.000000000 +0000
@@ -46,7 +46,8 @@
   PACKET_COUNT = 1,
   PACKET_SIZE = 56,
   PL = 0,
-  RTA = 1
+  RTA = 1,
+  TARGET_TIMEOUT = 500
 };

 int textscan (char *buf);
@@ -58,6 +59,7 @@
 char *server_name = NULL;
 int packet_size = PACKET_SIZE;
 int packet_count = PACKET_COUNT;
+int target_timeout = TARGET_TIMEOUT;
 int verbose = FALSE;
 int cpl;
 int wpl;
@@ -92,8 +94,8 @@
   server = strscpy (server, server_name);

   /* compose the command */
-  asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING,
-            packet_size, packet_count, server);
+  asprintf (&command_line, "%s -t %d -b %d -c %d %s", PATH_TO_FPING,
+            target_timeout, packet_size, packet_count, server);

   if (verbose)
     printf ("%s\n", command_line);
@@ -252,7 +254,7 @@
   }

   while (1) {
-    c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", longopts, &option);
+    c = getopt_long (argc, argv, "+hVvH:c:w:b:n:t:", longopts, &option);

     if (c == -1 || c == EOF || c == 1)
       break;
@@ -313,6 +315,12 @@
       else
         usage (_("Packet count must be a positive integer"));
       break;
+    case 't':                 /* timeout in msec */
+      if (is_intpos (optarg))
+        target_timeout = atoi (optarg);
+      else
+        usage (_("Target timeout must be a positive integer"));
+      break;
     }
   }

@@ -414,5 +422,5 @@
 print_usage (void)
 {
   printf (_("Usage:"));
-  printf (" %s <host_address> -w limit -c limit [-b size] [-n number]\n", progname);
+  printf (" %s <host_address> -w limit -c limit [-b size] [-n number] [-t number]\n", progname);
 }