+ Enhance java jmx
This commit is contained in:
parent
7e74221899
commit
faf6578d2b
|
@ -102,14 +102,14 @@ sub run {
|
|||
|
||||
$self->{output}->perfdata_add(label => 'TotalLoadedClassCount',
|
||||
value => $result->{"java.lang:type=ClassLoading"}->{TotalLoadedClassCount},
|
||||
warning => $self->{option_results}->{warning_total},
|
||||
critical => $self->{option_results}->{critical_total},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-total'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-total'),
|
||||
min => 0);
|
||||
|
||||
$self->{output}->perfdata_add(label => 'LoadedClassCount',
|
||||
value => $result->{"java.lang:type=ClassLoading"}->{LoadedClassCount},
|
||||
warning => $self->{option_results}->{warning_loaded},
|
||||
critical => $self->{option_results}->{critical_loaded},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-loaded'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-loaded'),
|
||||
min => 0);
|
||||
|
||||
$self->{output}->perfdata_add(label => 'UnloadedClassCount',
|
||||
|
|
|
@ -102,14 +102,14 @@ sub run {
|
|||
|
||||
$self->{output}->perfdata_add(label => 'SystemCpuLoad', unit => '%',
|
||||
value => $result->{"java.lang:type=OperatingSystem"}->{SystemCpuLoad} * 100,
|
||||
warning => $self->{option_results}->{warning_system},
|
||||
critical => $self->{option_results}->{critical_system},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-system'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-system'),
|
||||
min => 0, max => 100);
|
||||
|
||||
$self->{output}->perfdata_add(label => 'ProcessCpuLoad', unit => '%',
|
||||
value => $result->{"java.lang:type=OperatingSystem"}->{ProcessCpuLoad} * 100,
|
||||
warning => $self->{option_results}->{warning_process},
|
||||
critical => $self->{option_results}->{critical_process},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-process'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-process'),
|
||||
min => 0, max => 100);
|
||||
|
||||
$self->{output}->display();
|
||||
|
|
|
@ -84,8 +84,8 @@ sub run {
|
|||
|
||||
$self->{output}->perfdata_add(label => 'fd',
|
||||
value => $result->{"java.lang:type=OperatingSystem"}->{OpenFileDescriptorCount},
|
||||
warning => $self->{option_results}->{warning} / 100 * $result->{"java.lang:type=OperatingSystem"}->{MaxFileDescriptorCount},
|
||||
critical => $self->{option_results}->{critical} / 100 * $result->{"java.lang:type=OperatingSystem"}->{MaxFileDescriptorCount},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $result->{"java.lang:type=OperatingSystem"}->{MaxFileDescriptorCount}, cast_int => 1),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $result->{"java.lang:type=OperatingSystem"}->{MaxFileDescriptorCount}, cast_int => 1),
|
||||
min => 0, max => $result->{"java.lang:type=OperatingSystem"}->{MaxFileDescriptorCount});
|
||||
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
|
|
|
@ -84,8 +84,8 @@ sub run {
|
|||
|
||||
$self->{output}->perfdata_add(label => 'load',
|
||||
value => $result->{"java.lang:type=OperatingSystem"}->{SystemLoadAverage},
|
||||
warning => $self->{option_results}->{warning},
|
||||
critical => $self->{option_results}->{critical},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
min => 0);
|
||||
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
|
|
|
@ -104,14 +104,14 @@ sub run {
|
|||
|
||||
$self->{output}->perfdata_add(label => 'HeapMemoryUsage', unit => 'B',
|
||||
value => $result->{"java.lang:type=Memory"}->{HeapMemoryUsage}->{used},
|
||||
warning => $self->{option_results}->{warning_heap} / 100 * $result->{"java.lang:type=Memory"}->{HeapMemoryUsage}->{used},
|
||||
critical => $self->{option_results}->{critical_heap} / 100 * $result->{"java.lang:type=Memory"}->{HeapMemoryUsage}->{used},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-heap', total => $result->{"java.lang:type=Memory"}->{HeapMemoryUsage}->{used}, cast_int => 1),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-heap', total => $result->{"java.lang:type=Memory"}->{HeapMemoryUsage}->{used}, cast_int => 1),
|
||||
min => 0, max => $result->{"java.lang:type=Memory"}->{HeapMemoryUsage}->{max});
|
||||
|
||||
$self->{output}->perfdata_add(label => 'NonHeapMemoryUsage', unit => 'B',
|
||||
value => $result->{"java.lang:type=Memory"}->{NonHeapMemoryUsage}->{used},
|
||||
warning => $self->{option_results}->{warning_nonheap} / 100 * $result->{"java.lang:type=Memory"}->{NonHeapMemoryUsage}->{used},
|
||||
critical => $self->{option_results}->{critical_nonheap} / 100 * $result->{"java.lang:type=Memory"}->{NonHeapMemoryUsage}->{used},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-nonheap', total => $result->{"java.lang:type=Memory"}->{NonHeapMemoryUsage}->{used}, cast_int => 1),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-nonheap', total => $result->{"java.lang:type=Memory"}->{NonHeapMemoryUsage}->{used}, cast_int => 1),
|
||||
min => 0, max => $result->{"java.lang:type=Memory"}->{NonHeapMemoryUsage}->{max});
|
||||
|
||||
$self->{output}->display();
|
||||
|
|
|
@ -111,18 +111,18 @@ sub run {
|
|||
|
||||
$self->{output}->perfdata_add(label => $mapping_memory{$memtype},
|
||||
value => $result->{"java.lang:name=" . $memtype . ",type=MemoryPool"}->{Usage}->{used},
|
||||
warning => $self->{option_results}->{'warning_' . $mapping_memory{$memtype}} / 100 * $result->{"java.lang:name=" . $memtype . ",type=MemoryPool"}->{Usage}->{used},
|
||||
critical => $self->{option_results}->{'critical_' . $mapping_memory{$memtype}} / 100 * $result->{"java.lang:name=" . $memtype . ",type=MemoryPool"}->{Usage}->{used},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $mapping_memory{$memtype}, total => $result->{"java.lang:name=" . $memtype . ",type=MemoryPool"}->{Usage}->{used}, cast_int => 1),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $mapping_memory{$memtype}, total => $result->{"java.lang:name=" . $memtype . ",type=MemoryPool"}->{Usage}->{used}, cast_int => 1),
|
||||
min => 0, max => $result->{"java.lang:name=".$memtype.",type=MemoryPool"}->{Usage}->{max});
|
||||
|
||||
my $exit = $self->{perfdata}->threshold_check(value => $prct,
|
||||
threshold => [ { label => 'critical_' . $mapping_memory{$memtype}, exit_litteral => 'critical' },
|
||||
{ label => 'warning_' . $mapping_memory{$memtype}, exit_litteral => 'warning' } ]);
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("%s usage is %.2f%%", $memtype, $prct));
|
||||
$self->{output}->output_add(long_msg => sprintf("%s usage %.2f%%", $memtype, $prct));
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("%s usage:%.2f%% ", $memtype, $prct}));
|
||||
short_msg => sprintf("%s usage %.2f%% ", $memtype, $prct}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,14 +82,14 @@ sub run {
|
|||
my $exit = $self->{perfdata}->threshold_check(value => $result->{"java.lang:type=Threading"}->{ThreadCount},
|
||||
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||
|
||||
$self->{output}->perfdata_add(label => 'ThreadCount', unit => 'thread',
|
||||
$self->{output}->perfdata_add(label => 'ThreadCount',
|
||||
value => $result->{"java.lang:type=Threading"}->{ThreadCount},
|
||||
warning => $self->{option_results}->{warning},
|
||||
critical => $self->{option_results}->{critical},
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
|
||||
min => 0);
|
||||
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Thread Count : %i", $result->{"java.lang:type=Threading"}->{ThreadCount}));
|
||||
short_msg => sprintf("Thread Count : %s", $result->{"java.lang:type=Threading"}->{ThreadCount}));
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue