From: W.J.M. N. <Wim...@nl...> - 2011-10-17 07:19:43
|
Hello, the patch below disables capturing of fields when evaluating the 'except' directive. This directive is taken from the DEVMON tag in the hosts.cfg file of Xymon (bb-hosts file in case of Hobbit). It decreases the CPU utilization and lowers the Devmon run-time. In our environment, Devmon is run in single-node mode, with 15 childs, on a HP DL 380, dual CPU with two cores each. Devmon checks 777 devices, and for 95 of them an 'except' directive is used. (Most of those devices are Cisco switches. 'Except' is used to ignore the interfaces which are disabled.) Using the patch below, the run-time of Devmon has decreased with about 1.4 [s], and the CPU utilization has decreased with 2%. The patch on Devmon r216 is: Index: dm_tests.pm =================================================================== --- dm_tests.pm (revision 37) +++ dm_tests.pm (working copy) @@ -1848,12 +1848,12 @@ my $a_val = $dev->{'except'}{$test}{$pri}{'alarm'} || $dev->{'except'}{'all'}{$pri}{'alarm'} || $tmpl->{'oids'}{$pri}{'except'}{'alarm'}; - $alarm = ($pri_val =~ /^($a_val)$/) ? 1 : 0 if defined $a_val; + $alarm = ($pri_val =~ /^(?:$a_val)$/) ? 1 : 0 if defined $a_val; my $na_val = $dev->{'except'}{$test}{$pri}{'noalarm'} || $dev->{'except'}{'all'}{$pri}{'noalarm'} || $tmpl->{'oids'}{$pri}{'except'}{'noalarm'}; - $alarm = 0 if defined $na_val and $pri_val =~ /^($na_val)$/; + $alarm = 0 if defined $na_val and $pri_val =~ /^(?:$na_val)$/; # Now go through all the oids in our table row and replace them for my $root ($row_data =~ /\{(.+?)}/g) { @@ -1881,8 +1881,8 @@ my $only = $dev->{'except'}{$test}{$oid}{'only'} || $dev->{'except'}{'all'}{$oid}{'only'} || $tmpl->{'oids'}{$oid}{'except'}{'only'}; - next T_LEAF if defined $ignore and $val =~ /^($ignore)$/; - next T_LEAF if defined $only and $val !~ /^($only)$/; + next T_LEAF if defined $ignore and $val =~ /^(?:$ignore)$/; + next T_LEAF if defined $only and $val !~ /^(?:$only)$/; # If we arent alarming on a value, its green by default @@ -2210,28 +2210,28 @@ if(defined $dev->{'except'}{$test}{$oid}{'noalarm'}) { my $match = $dev->{'except'}{$test}{$oid}{'noalarm'}; - return 1 if $val =~ /^($match)$/; + return 1 if $val =~ /^(?:$match)$/; } elsif(defined $dev->{'except'}{'all'}{$oid}{'noalarm'}) { my $match = $dev->{'except'}{'all'}{$oid}{'noalarm'}; - return 1 if $val =~ /^($match)$/; + return 1 if $val =~ /^(?:$match)$/; } elsif(defined $tmpl->{'oids'}{$oid}{'except'}{'noalarm'}) { my $match = $tmpl->{'oids'}{$oid}{'except'}{'noalarm'}; - return 1 if $val =~ /^($match)$/; + return 1 if $val =~ /^(?:$match)$/; } if(defined $dev->{'except'}{$test}{$oid}{'alarm'}) { my $match = $dev->{'except'}{$test}{$oid}{'alarm'}; - return 1 if $val !~ /^($match)$/; + return 1 if $val !~ /^(?:$match)$/; } elsif(defined $dev->{'except'}{'all'}{$oid}{'alarm'}) { my $match = $dev->{'except'}{'all'}{$oid}{'alarm'}; - return 1 if $val !~ /^($match)$/; + return 1 if $val !~ /^(?:$match)$/; } elsif(defined $tmpl->{'oids'}{$oid}{'except'}{'alarm'}) { my $match = $tmpl->{'oids'}{$oid}{'except'}{'alarm'}; - return 1 if $val !~ /^($match)$/; + return 1 if $val !~ /^(?:$match)$/; } } Kind regards, Wim Nelis. ****************************************************************************************************************** The NLR disclaimer is valid for NLR e-mail messages. This message is only meant for providing information. Nothing in this e-mail message amounts to a contractual or legal commitment on the part of the sender. This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. Sender accepts no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages. ****************************************************************************************************************** |