summaryrefslogtreecommitdiffstats
path: root/web/attachments/50795-perf.patch
blob: feaa2fca93c5a76e6fc7eae516c990bf7671d9d5 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
Only in nagios-client/nagios-plugins-1.3.0/plugins: Makefile
diff -u nagios-plugins-1.3.0-orig/plugins/check_disk.c nagios-client/nagios-plugins-1.3.0/plugins/check_disk.c
--- nagios-plugins-1.3.0-orig/plugins/check_disk.c	2003-02-15 13:48:44.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_disk.c	2003-05-20 12:51:58.000000000 +0200
@@ -28,6 +28,8 @@
  *     initailize usp to -1, eliminate 'found' variable
  *     accept any filename/filesystem
  *     use sscanf, drop while loop
+ *  - Modification by www.datux.nl 2003-01-24
+ *     added performance data output
  *
  *****************************************************************************/
 
@@ -64,6 +66,9 @@
 	int total_disk = -1;
 	int used_disk = -1;
 	int free_disk = -1;
+	int perf_total_disk = 0;
+	int perf_free_disk = 0;
+	int perf_used_disk = 0;
 	int result = STATE_UNKNOWN;
 	int disk_result = STATE_UNKNOWN;
 	char *command_line = "";
@@ -96,6 +101,7 @@
 		if (!index (input_buffer, '/'))
 			continue;
 
+		/* did we get some usefull output from the 'df' process? */
 		if (sscanf (input_buffer, "%s %d %d %d %d%% %s", file_system,
 		     &total_disk, &used_disk, &free_disk, &usp, mntp) == 6 ||
 		    sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system,
@@ -118,6 +124,9 @@
 				          free_disk, 100 - usp, display_mntp ? mntp : file_system);
 
 			result = max_state (result, disk_result);
+			perf_total_disk+=total_disk;
+			perf_free_disk+=free_disk;
+			perf_used_disk+=used_disk;
 		}
 
 		else {
@@ -147,8 +156,14 @@
 	else if (result == STATE_UNKNOWN)
 		printf ("Unable to read output\n%s\n%s\n", command_line, input_buffer);
 	else
-		printf ("DISK %s%s\n", state_text (result), output);
-
+		printf ("DISK %s%s|total=%d,used=%d,free=%d,used_perc=%f,free_perc=%f\n", 
+		    state_text (result), 
+		    output, 
+		    perf_total_disk, 
+		    perf_used_disk, 
+		    perf_free_disk, 
+		    100-((float)perf_free_disk*100/(float)perf_total_disk),
+		    ((float)perf_free_disk*100/(float)perf_total_disk));
 	return result;
 }
 
diff -u nagios-plugins-1.3.0-orig/plugins/check_http.c nagios-client/nagios-plugins-1.3.0/plugins/check_http.c
--- nagios-plugins-1.3.0-orig/plugins/check_http.c	2003-02-22 08:22:02.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_http.c	2003-05-20 12:51:58.000000000 +0200
@@ -21,6 +21,9 @@
  *
  * $Id: perf.patch,v 1.1 2003/05/20 17:45:04 psy Exp $
  *
+ * Sun Feb  9 17:11:53 CET 2003 Modified by Edwin Eefting (edwin@datux.nl)
+ *				fixed performance data: no spaces please :)
+ *
  *****************************************************************************/
 
 const char *progname = "check_http";
@@ -795,7 +798,7 @@
 			else if (onredirect == STATE_CRITICAL)
 				printf ("HTTP CRITICAL");
 			elapsed_time = delta_time (tv);
-			asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%7.3f\n",
+			asprintf (&msg, ": %s - %7.3f second response time %s%s|time=%f\n",
 		                 status_line, elapsed_time, timestamp,
 	                   (display_html ? "</A>" : ""), elapsed_time);
 			terminate (onredirect, msg);
@@ -807,7 +810,7 @@
 		
 	/* check elapsed time */
 	elapsed_time = delta_time (tv);
-	asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%7.3f\n",
+	asprintf (&msg, "HTTP problem: %s - %7.3f second response time %s%s|time=%f\n",
 	               status_line, elapsed_time, timestamp,
 	               (display_html ? "</A>" : ""), elapsed_time);
 	if (check_critical_time == TRUE && elapsed_time > critical_time)
@@ -835,14 +838,14 @@
 	if (strlen (regexp)) {
 		errcode = regexec (&preg, page, REGS, pmatch, 0);
 		if (errcode == 0) {
-			printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
+			printf ("HTTP ok: %s - %7.3f second response time %s%s|time=%f\n",
 			        status_line, elapsed_time,
 			        timestamp, (display_html ? "</A>" : ""), elapsed_time);
 			exit (STATE_OK);
 		}
 		else {
 			if (errcode == REG_NOMATCH) {
-				printf ("HTTP CRITICAL: pattern not found%s|time=%7.3f\n",
+				printf ("HTTP CRITICAL: pattern not found%s|time=%f\n",
 				        (display_html ? "</A>" : ""), elapsed_time);
 				exit (STATE_CRITICAL);
 			}
@@ -856,7 +859,7 @@
 #endif
 
 	/* We only get here if all tests have been passed */
-	asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%7.3f\n",
+	asprintf (&msg, "HTTP ok: %s - %7.3f second response time %s%s|time=%f\n",
 	                status_line, (float)elapsed_time,
 	                timestamp, (display_html ? "</A>" : ""), elapsed_time);
 	terminate (STATE_OK, msg);
Only in nagios-client/nagios-plugins-1.3.0/plugins: check_http.c.rej
Only in nagios-client/nagios-plugins-1.3.0/plugins: check_http.c~
diff -u nagios-plugins-1.3.0-orig/plugins/check_load.c nagios-client/nagios-plugins-1.3.0/plugins/check_load.c
--- nagios-plugins-1.3.0-orig/plugins/check_load.c	2003-02-18 23:16:06.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_load.c	2003-05-20 18:59:25.000000000 +0200
@@ -19,6 +19,9 @@
  *		   mods by Ethan Galstad (nagios@nagios.org)
  * 08/18/1999 - Integrated some code with common plugin utilities
  *		   mods by Ethan Galstad (nagios@nagios.org)
+ * 20/01/2003 - Now returns performance data 
+ *		   mods by Edwin Eefting (www.DatuX.nl)
+ *
  * $Date: 2003/05/20 17:45:04 $
  * Note: The load format is the same used by "uptime" and "w"
  *
@@ -132,13 +135,15 @@
 #endif
 		return STATE_UNKNOWN;
 	}
-	asprintf(&status_line, "load average: %.2f, %.2f, %.2f", la1, la5, la15);
+	asprintf(&status_line, "load average: %.2f, %.2f, %.2f|load1=%.2f,load5=%.2f,load15=%.2f", la1, la5, la15, la1, la5, la15);
 	if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) {
 		printf("CRITICAL - %s\n", status_line);
 		return STATE_CRITICAL;
 	}
 	if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) {
 		printf ("WARNING - %s\n", status_line);
+
+
 		return STATE_WARNING;
 	}
 	printf ("OK - %s\n", status_line);
diff -u nagios-plugins-1.3.0-orig/plugins/check_ping.c nagios-client/nagios-plugins-1.3.0/plugins/check_ping.c
--- nagios-plugins-1.3.0-orig/plugins/check_ping.c	2003-02-15 13:48:45.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_ping.c	2003-05-20 12:51:58.000000000 +0200
@@ -8,6 +8,10 @@
 *
 * $Id: perf.patch,v 1.1 2003/05/20 17:45:04 psy Exp $
 *
+* updated Mon Jan 20 19:03:57 CET 2003 by Edwin Eefting (DatuX.nl)
+*  -minor bugfixes
+*  -now returns performance data
+*
 *****************************************************************************/
 
 const char *progname = "check_ping";
@@ -18,7 +22,7 @@
 #define SUMMARY "Use ping to check connection statistics for a remote host.\n"
 
 #define OPTIONS "\
--H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n\
+-H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>%\n\
        [-p packets] [-t timeout] [-L]\n"
 
 #define LONGOPTIONS "\
@@ -135,14 +139,19 @@
 						state_text (result), warn_text, pl, rta);
 	if (display_html == TRUE)
 		printf ("</A>");
-	printf ("\n");
+
+	/* print performance data */
+	printf("|loss=%d",pl);
+	if (pl != 100)
+	    printf(",rta=%f",rta);
+	printf("\n");
 
 	if (verbose)
 		printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl);
 
 	return result;
 }
-
+
 
 /* process command-line arguments */
 int
@@ -340,7 +349,7 @@
 	if (max_packets == -1)
 		max_packets = DEFAULT_MAX_PACKETS;
 
-	max_seconds = crta / 1000.0 * max_packets + max_packets;
+	max_seconds = crta / 1000.0 * max_packets + max_packets + 10;
 	if (max_seconds > timeout_interval)
 		timeout_interval = (int)max_seconds;
 
diff -u nagios-plugins-1.3.0-orig/plugins/check_procs.c nagios-client/nagios-plugins-1.3.0/plugins/check_procs.c
--- nagios-plugins-1.3.0-orig/plugins/check_procs.c	2003-02-15 13:48:45.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_procs.c	2003-05-20 12:51:58.000000000 +0200
@@ -32,6 +32,9 @@
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
+* feb-9-2003 modified by Edwin Eefting (www.DatuX.nl)  edwin@datux.nl
+*            returns performance data
+*
 ******************************************************************************/
 
 const char *progname = "check_procs";
@@ -197,6 +200,9 @@
 		return result;
 	}
 
+	//add performance data to "format string"
+	asprintf(&fmt,"%s|procs=%d\n",fmt,procs);
+	
 	if (verbose && (options & STAT))
 		printf ("%s ", statopts);
 	if (verbose && (options & PROG))
@@ -427,6 +433,7 @@
 		options |= STAT;
 	}
 
+
 	return validate_arguments ();
 }
 
@@ -457,10 +464,10 @@
 
 	if (options == 0) {
 		options = 1;
-		asprintf (&fmt, "%%s - %%d processes running\n");
+		asprintf (&fmt, "%%s - %%d processes running");
 	}
 	else {
-		asprintf (&fmt, "%%s - %%d processes running with %s\n", fmt);
+		asprintf (&fmt, "%%s - %%d processes running with %s", fmt);
 	}
 
 	return options;
diff -u nagios-plugins-1.3.0-orig/plugins/check_swap.c nagios-client/nagios-plugins-1.3.0/plugins/check_swap.c
--- nagios-plugins-1.3.0-orig/plugins/check_swap.c	2003-02-18 06:35:52.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_swap.c	2003-05-20 14:02:11.000000000 +0200
@@ -23,6 +23,9 @@
  *
  * $Id: perf.patch,v 1.1 2003/05/20 17:45:04 psy Exp $
  *
+ * feb 9 2003 - Modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl
+ *              Returns performance data
+ *
  *****************************************************************************/
 
 #include "common.h"
@@ -51,7 +54,7 @@
 int
 main (int argc, char **argv)
 {
-	int percent_used, percent;
+	float percent_used, percent;
 	long unsigned int total_swap = 0, used_swap = 0, free_swap = 0;
 	long unsigned int total, used, free;
 	int result = STATE_OK;
@@ -93,8 +96,8 @@
 		result = max_state (STATE_CRITICAL, result);
 	else if (percent_used >= warn_percent || free_swap <= warn_size)
 		result = max_state (STATE_WARNING, result);
-	asprintf (&status, "%s %2d%% (%lu out of %lu)", status, percent_used,
-	          used_swap, total_swap);
+	asprintf (&status, "%s %2.0f%% (%lu out of %lu)|user_perc=%f,user=%d,total=%d", status, percent_used,
+	          used_swap, total_swap, percent_used, used_swap, total_swap);
 	fclose (fp);
 #else
 #ifdef HAVE_SWAP
@@ -146,8 +149,8 @@
 		result = max_state (STATE_CRITICAL, result);
 	else if (percent_used >= warn_percent || free_swap <= warn_size)
 		result = max_state (STATE_WARNING, result);
-	asprintf (&status, "%s %2d%% (%lu out of %lu)",
-						status, percent_used, used_swap, total_swap);
+	asprintf (&status, "%s %2.0f%% (%lu out of %lu)|used_perc=%f,user=%d,total=%d",
+						status, percent_used, used_swap, total_swap, percent_used, used_swap, total_swap);
 
 	/* If we get anything on STDERR, at least set warning */
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
Only in nagios-client/nagios-plugins-1.3.0/plugins: check_swap.c.rej
Only in nagios-client/nagios-plugins-1.3.0/plugins: check_swap.c~
diff -u nagios-plugins-1.3.0-orig/plugins/check_users.c nagios-client/nagios-plugins-1.3.0/plugins/check_users.c
--- nagios-plugins-1.3.0-orig/plugins/check_users.c	2003-02-15 13:48:46.000000000 +0100
+++ nagios-client/nagios-plugins-1.3.0/plugins/check_users.c	2003-05-20 12:51:58.000000000 +0200
@@ -42,6 +42,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
+ * feb-9-2003 modified by Edwin Eefting (www.DatuX.nl) edwin@datux.nl
+ *	      returns performance data
+ *
  *****************************************************************************/
 
 #include "common.h"
@@ -120,8 +123,8 @@
 	if (result == STATE_UNKNOWN)
 		printf ("Unable to read output\n");
 	else
-		printf ("USERS %s - %d users currently logged in\n", state_text (result),
-						users);
+		printf ("USERS %s - %d users currently logged in|users=%d\n", state_text (result),
+						users,users);
 
 	return result;
 }
Only in nagios-client/nagios-plugins-1.3.0/plugins: common.h
Only in nagios-client/nagios-plugins-1.3.0/plugins: config.h
Only in nagios-client/nagios-plugins-1.3.0/plugins: netutils.h
Only in nagios-client/nagios-plugins-1.3.0/plugins: perf.patch
Only in nagios-client/nagios-plugins-1.3.0/plugins: popen.h
Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h1
Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h2
Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h3
Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h4
Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h5
Only in nagios-client/nagios-plugins-1.3.0/plugins: stamp-h6
Common subdirectories: nagios-plugins-1.3.0-orig/plugins/t and nagios-client/nagios-plugins-1.3.0/plugins/t
Only in nagios-client/nagios-plugins-1.3.0/plugins: utils.h
Only in nagios-client/nagios-plugins-1.3.0/plugins: version.h