From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/50795-perf.patch | 329 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 web/attachments/50795-perf.patch (limited to 'web/attachments/50795-perf.patch') 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 @@ +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 ? "" : ""), 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 ? "" : ""), 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 ? "" : ""), 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 ? "" : ""), 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 ? "" : ""), 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 -w ,%% -c ,%%\n\ ++-H -w ,% -c ,%\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 (""); +- 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 -- cgit v1.2.3-74-g34f1