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