Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### SOURCE: http://william.leibzon.org/nagios/nagios25-largerbuffers.patch
- --- nagios-2.5n/include/common.h 2006-11-01 12:03:32.000000000 -0800
- +++ nagios-2.5/include/common.h 2006-11-01 11:56:53.000000000 -0800
- @@ -390,8 +390,8 @@
- /************************** MISC DEFINITIONS ****************************/
- #define MAX_FILENAME_LENGTH 256 /* max length of path/filename that Nagios will process */
- -#define MAX_INPUT_BUFFER 1024 /* size in bytes of max. input buffer (for reading files) */
- -#define MAX_COMMAND_BUFFER 8192 /* max length of raw or processed command line */
- +#define MAX_INPUT_BUFFER 8192 /* size in bytes of max. input buffer (for reading files) */
- +#define MAX_COMMAND_BUFFER 16384 /* max length of raw or processed command line */
- #define MAX_DATETIME_LENGTH 48
- --- nagios-2.5n/include/objects.h 2006-11-01 12:03:32.000000000 -0800
- +++ nagios-2.5/include/objects.h 2006-11-01 12:02:49.000000000 -0800
- @@ -44,8 +44,8 @@
- /***************** OBJECT SIZE LIMITS *****************/
- #define MAX_HOSTNAME_LENGTH 64 /* max. host name length */
- -#define MAX_SERVICEDESC_LENGTH 64 /* max. service description length */
- -#define MAX_PLUGINOUTPUT_LENGTH 332 /* max. length of plugin output */
- +#define MAX_SERVICEDESC_LENGTH 128 /* max. service description length */
- +#define MAX_PLUGINOUTPUT_LENGTH 4096 /* max. length of plugin output */
- #define MAX_STATE_HISTORY_ENTRIES 21 /* max number of old states to keep track of for flap detection */
- @@ -55,26 +55,26 @@
- /***************** CHAINED HASH LIMITS ****************/
- -#define SERVICE_HASHSLOTS 1024
- -#define HOST_HASHSLOTS 1024
- -#define COMMAND_HASHSLOTS 256
- +#define SERVICE_HASHSLOTS 8192
- +#define HOST_HASHSLOTS 2048
- +#define COMMAND_HASHSLOTS 512
- #define TIMEPERIOD_HASHSLOTS 64
- #define CONTACT_HASHSLOTS 128
- #define CONTACTGROUP_HASHSLOTS 64
- -#define HOSTGROUP_HASHSLOTS 128
- -#define SERVICEGROUP_HASHSLOTS 128
- -#define HOSTEXTINFO_HASHSLOTS 1024
- -#define SERVICEEXTINFO_HASHSLOTS 1024
- +#define HOSTGROUP_HASHSLOTS 256
- +#define SERVICEGROUP_HASHSLOTS 256
- +#define HOSTEXTINFO_HASHSLOTS 2048
- +#define SERVICEEXTINFO_HASHSLOTS 8192
- #ifdef SUPPORT_GROUPEXTINFO
- -#define HOSTGROUPEXTINFO_HASHSLOTS 128
- -#define SERVICEGROUPEXTINFO_HASHSLOTS 128
- +#define HOSTGROUPEXTINFO_HASHSLOTS 256
- +#define SERVICEGROUPEXTINFO_HASHSLOTS 256
- #endif // SUPPORT_GROUPEXTINFO
- -#define HOSTDEPENDENCY_HASHSLOTS 1024
- -#define SERVICEDEPENDENCY_HASHSLOTS 1024
- -#define HOSTESCALATION_HASHSLOTS 1024
- -#define SERVICEESCALATION_HASHSLOTS 1024
- +#define HOSTDEPENDENCY_HASHSLOTS 2048
- +#define SERVICEDEPENDENCY_HASHSLOTS 16384
- +#define HOSTESCALATION_HASHSLOTS 2048
- +#define SERVICEESCALATION_HASHSLOTS 8192
- --- nagios-2.5n/p1.pl 2006-03-21 15:32:46.000000000 -0800
- +++ nagios-2.5/p1.pl 2006-11-01 11:56:53.000000000 -0800
- @@ -16,13 +16,13 @@
- # use constant DEBUG_LEVEL => LEAVE_MSG | CACHE_DUMP ;
- # use constant DEBUG_LEVEL => LEAVE_MSG | CACHE_DUMP | PLUGIN_DUMP ;
- -use constant DEBUG_LOG_PATH => '/usr/local/nagios/var/' ;
- +use constant DEBUG_LOG_PATH => '/opt/nagios/var/' ;
- # use constant DEBUG_LOG_PATH => './' ;
- use constant LEAVE_MSG_STREAM => DEBUG_LOG_PATH . 'epn_leave-msgs.log' ;
- use constant CACHE_DUMP_STREAM => DEBUG_LOG_PATH . 'epn_cache-dump.log' ;
- use constant PLUGIN_DUMP_STREAM => DEBUG_LOG_PATH . 'epn_plugin-dump.log' ;
- -use constant NUMBER_OF_PERL_PLUGINS => 60 ;
- +use constant NUMBER_OF_PERL_PLUGINS => 200 ;
- use constant Cache_Dump_Interval => 20 ;
- # Cache will be dumped every Cache_Dump_Interval plugin compilations
- @@ -66,6 +66,8 @@
- # Methods for use by tied STDOUT in embedded PERL module.
- # Simply ties STDOUT to a scalar and caches values written to it.
- # NB No more than 256 characters per line are kept.
- +
- +use constant MAX_INPUT_SIZE => 2048 ;
- sub TIEHANDLE {
- my ($class) = @_;
- @@ -75,15 +77,15 @@
- sub PRINT {
- my $self = shift;
- - # $$self = substr(join('',@_), 0, 256) ;
- - $$self .= substr(join('',@_), 0, 256) ;
- + # $$self = substr(join('',@_), 0, MAX_INPUT_SIZE) ;
- + $$self .= substr(join('',@_), 0, MAX_INPUT_SIZE) ;
- }
- sub PRINTF {
- my $self = shift;
- my $fmt = shift;
- - # $$self = substr(sprintf($fmt,@_), 0, 256) ;
- - $$self .= substr(sprintf($fmt,@_), 0, 256) ;
- + # $$self = substr(sprintf($fmt,@_), 0, MAX_INPUT_SIZE) ;
- + $$self .= substr(sprintf($fmt,@_), 0, MAX_INPUT_SIZE) ;
- }
- sub READLINE {
- @@ -91,7 +93,7 @@
- # Omit all lines after the first, per the nagios plugin guidelines
- $$self = (split /\n/, $$self)[0];
- # Perl code other than plugins may print nothing; in this case return "(No output!)\n".
- - return $$self ? substr($$self, 0, 256) : "(No output!)\n" ;
- + return $$self ? substr($$self, 0, MAX_INPUT_SIZE) : "(No output!)\n" ;
- }
- sub CLOSE {
- @@ -227,8 +229,10 @@
- print PH qq($ts eval_file: transformed plugin "$filename" to ==>\n$_\n) ;
- }
- - $@ = substr($@, 0, 256)
- - if length($@) > 256 ;
- + use constant MAX_INPUT_SIZE => 2048;
- +
- + $@ = substr($@, 0, MAX_INPUT_SIZE )
- + if length($@) > MAX_INPUT_SIZE ;
- $Cache{$filename}[PLUGIN_ERROR] = $@ ;
- # If the compilation fails, leave nothing behind that may affect subsequent
Add Comment
Please, Sign In to add comment