summaryrefslogtreecommitdiffstats
path: root/web/attachments/116649-check_procs_perfdata.diff
blob: 94bcddfc3d669f9442e2ec27609a98df3f75507e (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
--- nagios-plugins-HEAD-200501200547/plugins/check_procs.c	2004-12-29 22:41:39.000000000 -0200
+++ check_procs.c	2005-01-20 14:37:19.000000000 -0200
@@ -54,6 +54,9 @@
 #define ELAPSED 512
 /* Different metrics */
 char *metric_name;
+char *perf_procs;
+char *perf_metric;
+
 enum metric {
 	METRIC_PROCS,
 	METRIC_VSZ,
@@ -290,6 +293,36 @@
 	} 
 	printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs);
 	
+	perf_procs = NULL;
+	perf_metric = NULL;
+		
+	if (metric == METRIC_PROCS) {
+		perf_procs = strscpy(perf_procs,perfdata("Processes", procs, "",
+				(wmax > 0), wmax , (cmax > 0), cmax ,
+				0, 0, 0, 0));
+	} else {
+			perf_metric = strscpy(perf_metric, "Processes: Normal ");
+			perf_metric = strcat(perf_metric, metric_name);
+			perf_procs = strscpy(perf_procs, perfdata(perf_metric, procs, "",
+					       	0, 0, 0, 0, 
+						0, 0, 0, 0));
+			perf_metric = strscpy(perf_metric, "Processes: Warning ");
+			perf_metric = strcat(perf_metric, metric_name);
+			perf_procs = strcat(perf_procs, " ");
+			perf_procs = strcat(perf_procs, perfdata(perf_metric, warn, "",
+						0, 0, 0, 0,
+						0, 0, 0, 0));
+			perf_metric = strscpy(perf_metric, "Processes: Critical ");
+			perf_metric = strcat(perf_metric, metric_name);
+			perf_procs = strcat(perf_procs, " ");
+			perf_procs = strcat(perf_procs, perfdata(perf_metric, crit, "",
+						0, 0, 0, 0,
+					        1, 0, 0, 0));
+	}
+									
+	printf (" | %s", perf_procs);	
+	
+	
 	if (strcmp(fmt,"") != 0) {
 		printf (_(" with %s"), fmt);
 	}