summaryrefslogtreecommitdiffstats
path: root/web/attachments/430067-check_proc-perfdata.patch
blob: a7f409ad8af6c50de9289b58fd551dd0abc06cb7 (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
--- nagios-plugins-1.4.15/plugins/check_procs.c	2010-07-27 22:47:16.000000000 +0200
+++ /home/goesta/Projekte/Nagios/nagios-plugins_procs_perfpatch/plugins/check_procs.c	2009-12-19 01:12:49.924399127 +0100
@@ -92,6 +92,7 @@
 char *fmt;
 char *fails;
 char tmp[MAX_INPUT_BUFFER];
+int print_perfdata = 0;
 
 FILE *ps_input = NULL;
 
@@ -293,6 +294,9 @@
 		}
 	} 
 	printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs);
+	if ( print_perfdata == 1 ) {
+		printf ("|procs=%d;%d;%d;0;", procs, wmax, cmax);
+	}
 	
 	if (strcmp(fmt,"") != 0) {
 		printf (_(" with %s"), fmt);
@@ -331,6 +335,7 @@
 		{"pcpu", required_argument, 0, 'P'},
 		{"elapsed", required_argument, 0, 'e'},
 		{"argument-array", required_argument, 0, 'a'},
+		{"perfdata", no_argument, 0, 'd'},
 		{"help", no_argument, 0, 'h'},
 		{"version", no_argument, 0, 'V'},
 		{"verbose", no_argument, 0, 'v'},
@@ -344,7 +349,7 @@
 			strcpy (argv[c], "-t");
 
 	while (1) {
-		c = getopt_long (argc, argv, "Vvht:c:w:p:s:u:C:a:z:r:m:P:", 
+		c = getopt_long (argc, argv, "Vvhdt:c:w:p:s:u:C:a:z:r:m:P:", 
 			longopts, &option);
 
 		if (c == -1 || c == EOF)
@@ -505,6 +510,9 @@
 		case CHAR_MAX+2:
 			input_filename = optarg;
 			break;
+		case 'd':
+			print_perfdata = 1;
+			break;
 		}
 	}