From e1165820a4deafc78e024aec0ac82e5da44d08b9 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 3 Mar 2017 17:25:38 +0100 Subject: [PATCH] + Enhanced code java memory-detailed --- centreon/common/jvm/mode/memorydetailed.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/centreon/common/jvm/mode/memorydetailed.pm b/centreon/common/jvm/mode/memorydetailed.pm index 025570144..162a19524 100644 --- a/centreon/common/jvm/mode/memorydetailed.pm +++ b/centreon/common/jvm/mode/memorydetailed.pm @@ -35,13 +35,13 @@ my %mapping_memory = ( 'CMS Perm Gen' => 'permanent', 'PS Perm Gen' => 'permanent', 'Perm Gen' => 'permanent', + 'Metaspace' => 'permanent', 'Code Cache' => 'code', 'CMS Old Gen' => 'tenured', 'PS Old Gen' => 'tenured', 'Tenured Gen' => 'tenured', ); - sub new { my ($class, %options) = @_; my $self = $class->SUPER::new(package => __PACKAGE__, %options); @@ -94,6 +94,12 @@ sub run { foreach my $key (keys %$result) { $key =~ /name=(.*?),type/; my $memtype = $1; + + if (!defined($mapping_memory{$memtype})) { + $self->{output}->output_add(long_msg => "unknown memory type: " . $memtype, debug => 1); + next; + } + my $prct = $result->{"java.lang:name=".$memtype.",type=MemoryPool"}->{Usage}->{used} / $result->{"java.lang:name=".$memtype.",type=MemoryPool"}->{Usage}->{max} * 100; $self->{output}->perfdata_add(label => $mapping_memory{$memtype}, unit => 'B',