+ Enhanced code java memory-detailed

This commit is contained in:
garnier-quentin 2017-03-03 17:25:38 +01:00
parent 1764f49a34
commit e1165820a4
1 changed files with 7 additions and 1 deletions

View File

@ -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',