c0psrul3

for nagios 2.8 : nagios28-largerbuffers.patch

Mar 29th, 2018
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.73 KB | None | 0 0
  1. ### SOURCE: http://william.leibzon.org/nagios/nagios25-largerbuffers.patch
  2. --- nagios-2.5n/include/common.h    2006-11-01 12:03:32.000000000 -0800
  3. +++ nagios-2.5/include/common.h 2006-11-01 11:56:53.000000000 -0800
  4. @@ -390,8 +390,8 @@
  5.  /************************** MISC DEFINITIONS ****************************/
  6.  
  7.  #define MAX_FILENAME_LENGTH            256 /* max length of path/filename that Nagios will process */
  8. -#define MAX_INPUT_BUFFER           1024    /* size in bytes of max. input buffer (for reading files) */
  9. -#define MAX_COMMAND_BUFFER                      8192    /* max length of raw or processed command line */
  10. +#define MAX_INPUT_BUFFER           8192    /* size in bytes of max. input buffer (for reading files) */
  11. +#define MAX_COMMAND_BUFFER                      16384   /* max length of raw or processed command line */
  12.  
  13.  #define MAX_DATETIME_LENGTH            48
  14.  
  15. --- nagios-2.5n/include/objects.h   2006-11-01 12:03:32.000000000 -0800
  16. +++ nagios-2.5/include/objects.h    2006-11-01 12:02:49.000000000 -0800
  17. @@ -44,8 +44,8 @@
  18.  /***************** OBJECT SIZE LIMITS *****************/
  19.  
  20.  #define MAX_HOSTNAME_LENGTH                    64  /* max. host name length */
  21. -#define MAX_SERVICEDESC_LENGTH         64  /* max. service description length */
  22. -#define MAX_PLUGINOUTPUT_LENGTH            332 /* max. length of plugin output */
  23. +#define MAX_SERVICEDESC_LENGTH         128 /* max. service description length */
  24. +#define MAX_PLUGINOUTPUT_LENGTH            4096    /* max. length of plugin output */
  25.  
  26.  #define MAX_STATE_HISTORY_ENTRIES      21  /* max number of old states to keep track of for flap detection */
  27.  
  28. @@ -55,26 +55,26 @@
  29.  
  30.  /***************** CHAINED HASH LIMITS ****************/
  31.  
  32. -#define SERVICE_HASHSLOTS                      1024
  33. -#define HOST_HASHSLOTS                         1024
  34. -#define COMMAND_HASHSLOTS                      256
  35. +#define SERVICE_HASHSLOTS                      8192
  36. +#define HOST_HASHSLOTS                         2048
  37. +#define COMMAND_HASHSLOTS                      512
  38.  #define TIMEPERIOD_HASHSLOTS                   64
  39.  #define CONTACT_HASHSLOTS                      128
  40.  #define CONTACTGROUP_HASHSLOTS                 64
  41. -#define HOSTGROUP_HASHSLOTS                    128
  42. -#define SERVICEGROUP_HASHSLOTS                 128
  43. -#define HOSTEXTINFO_HASHSLOTS                  1024
  44. -#define SERVICEEXTINFO_HASHSLOTS               1024
  45. +#define HOSTGROUP_HASHSLOTS                    256
  46. +#define SERVICEGROUP_HASHSLOTS                 256
  47. +#define HOSTEXTINFO_HASHSLOTS                  2048
  48. +#define SERVICEEXTINFO_HASHSLOTS               8192
  49.  
  50.  #ifdef SUPPORT_GROUPEXTINFO
  51. -#define HOSTGROUPEXTINFO_HASHSLOTS             128
  52. -#define SERVICEGROUPEXTINFO_HASHSLOTS          128
  53. +#define HOSTGROUPEXTINFO_HASHSLOTS             256
  54. +#define SERVICEGROUPEXTINFO_HASHSLOTS          256
  55.  #endif // SUPPORT_GROUPEXTINFO
  56.  
  57. -#define HOSTDEPENDENCY_HASHSLOTS               1024
  58. -#define SERVICEDEPENDENCY_HASHSLOTS            1024
  59. -#define HOSTESCALATION_HASHSLOTS               1024
  60. -#define SERVICEESCALATION_HASHSLOTS            1024
  61. +#define HOSTDEPENDENCY_HASHSLOTS               2048
  62. +#define SERVICEDEPENDENCY_HASHSLOTS            16384
  63. +#define HOSTESCALATION_HASHSLOTS               2048
  64. +#define SERVICEESCALATION_HASHSLOTS            8192
  65.  
  66.  
  67.  
  68. --- nagios-2.5n/p1.pl   2006-03-21 15:32:46.000000000 -0800
  69. +++ nagios-2.5/p1.pl    2006-11-01 11:56:53.000000000 -0800
  70. @@ -16,13 +16,13 @@
  71.  # use constant DEBUG_LEVEL     => LEAVE_MSG | CACHE_DUMP ;
  72.  # use constant DEBUG_LEVEL     => LEAVE_MSG | CACHE_DUMP | PLUGIN_DUMP ;
  73.  
  74. -use constant   DEBUG_LOG_PATH      => '/usr/local/nagios/var/' ;
  75. +use constant   DEBUG_LOG_PATH      => '/opt/nagios/var/' ;
  76.  # use constant DEBUG_LOG_PATH      => './' ;
  77.  use constant   LEAVE_MSG_STREAM    => DEBUG_LOG_PATH . 'epn_leave-msgs.log' ;
  78.  use constant   CACHE_DUMP_STREAM   => DEBUG_LOG_PATH . 'epn_cache-dump.log' ;
  79.  use constant   PLUGIN_DUMP_STREAM  => DEBUG_LOG_PATH . 'epn_plugin-dump.log' ;
  80.  
  81. -use constant   NUMBER_OF_PERL_PLUGINS  => 60 ;
  82. +use constant   NUMBER_OF_PERL_PLUGINS  => 200 ;
  83.  
  84.  use constant   Cache_Dump_Interval => 20 ;
  85.                                 # Cache will be dumped every Cache_Dump_Interval plugin compilations
  86. @@ -66,6 +66,8 @@
  87.                                 # Methods for use by tied STDOUT in embedded PERL module.
  88.                                 # Simply ties STDOUT to a scalar and caches values written to it.
  89.                                 # NB No more than 256 characters per line are kept.
  90. +
  91. +use constant    MAX_INPUT_SIZE          => 2048 ;
  92.  
  93.  sub TIEHANDLE {
  94.     my ($class) = @_;
  95. @@ -75,15 +77,15 @@
  96.  
  97.  sub PRINT {
  98.     my $self = shift;
  99. -   # $$self = substr(join('',@_), 0, 256) ;
  100. -   $$self .= substr(join('',@_), 0, 256) ;
  101. +   # $$self = substr(join('',@_), 0, MAX_INPUT_SIZE) ;
  102. +   $$self .= substr(join('',@_), 0, MAX_INPUT_SIZE) ;
  103.  }
  104.  
  105.  sub PRINTF {
  106.     my $self = shift;
  107.     my $fmt = shift;
  108. -   # $$self = substr(sprintf($fmt,@_), 0, 256) ;
  109. -   $$self .= substr(sprintf($fmt,@_), 0, 256) ;
  110. +   # $$self = substr(sprintf($fmt,@_), 0, MAX_INPUT_SIZE) ;
  111. +   $$self .= substr(sprintf($fmt,@_), 0, MAX_INPUT_SIZE) ;
  112.  }
  113.  
  114.  sub READLINE {
  115. @@ -91,7 +93,7 @@
  116.                                 # Omit all lines after the first, per the nagios plugin guidelines
  117.          $$self = (split /\n/, $$self)[0];
  118.                                 # Perl code other than plugins may print nothing; in this case return "(No output!)\n".
  119. -   return $$self ? substr($$self, 0, 256) : "(No output!)\n" ;
  120. +   return $$self ? substr($$self, 0, MAX_INPUT_SIZE) : "(No output!)\n" ;
  121.  }
  122.  
  123.  sub CLOSE {
  124. @@ -227,8 +229,10 @@
  125.             print PH qq($ts eval_file: transformed plugin "$filename" to ==>\n$_\n) ;
  126.         }
  127.  
  128. -       $@ = substr($@, 0, 256)
  129. -           if length($@) > 256 ;
  130. +       use constant MAX_INPUT_SIZE => 2048;
  131. +
  132. +       $@ = substr($@, 0, MAX_INPUT_SIZE )
  133. +           if length($@) > MAX_INPUT_SIZE ;
  134.  
  135.         $Cache{$filename}[PLUGIN_ERROR] = $@ ;
  136.                                 # If the compilation fails, leave nothing behind that may affect subsequent
Add Comment
Please, Sign In to add comment