Imported Upstream version 1.12

This commit is contained in:
Mario Fetka
2017-10-31 14:38:28 +01:00
commit ae1fc8494f
157 changed files with 35016 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# ================================================
# Base definitions:
# Check for relative memory checks
<Check base_memory_relative>
Use = base_relative_threshold($0,$1)
Use = base_relative_label
Label = (base) $BASE
Unit = B
</Check>
<Check base_relative_threshold>
Critical = ${0:90}
Warning = ${1:80}
</Check>
<Check base_relative_label>
Label = (grandpa) %.2r% used (%.2v %u / %.2b %w)
</Check>

50
it/check_jmx4perl/base.pl Normal file
View File

@@ -0,0 +1,50 @@
# Base functions for various check_jmx4perl checks
use strict;
use FindBin;
use JMX::Jmx4Perl::Alias;
use JMX::Jmx4Perl::Request;
use JMX::Jmx4Perl::Response;
sub exec_check_perl4jmx {
my @args;
for (@_) {
push @args,split;
}
my ($url,$user,$password,$product,$target,$target_user,$target_password) =
@ENV{"JMX4PERL_GATEWAY","JMX4PERL_USER",
"JMX4PERL_PASSWORD","JMX4PERL_PRODUCT","JMX4PERL_TARGET_URL","JMX4PERL_TARGET_USER","JMX4PERL_TARGET_PASSWORD"};
push @args,("--user",$user,"--password",$password) if $user;
push @args,("--product",$product) if $product;
push @args,("--url",$url);
push @args,("--target",$target) if $target;
push @args,("--target-user",$target_user,"--target-password",$target_password) if $target_user;
#push @args,"--legacy-escape";
#push @args,("--verbose");
my $cmd = "perl $FindBin::Bin/../../scripts/check_jmx4perl "
.join(" ",map { '"' . $_ . '"' } @args);
#print $cmd,"\n";
open (F,"$cmd 2>&1 |")
|| die "Cannot open check_jmx4perl: $!";
my $content = join "",<F>;
close F;
if ($? == -1) {
die "check_jmx4perl: failed to execute: $!\n";
}
elsif ($? & 127) {
die "check_jmx4perl child died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
return ($? >> 8,$content);
}
sub reset_history {
my $jmx = shift;
my ($mbean,$operation) = $jmx->resolve_alias(JMX4PERL_HISTORY_RESET);
my $req = new JMX::Jmx4Perl::Request(EXEC,$mbean,$operation,{target => undef});
my $resp = $jmx->request($req);
}
1;

View File

@@ -0,0 +1,195 @@
# Include base configuration
include base.cfg
# ==================================================================
# Various parameterized checks
<Check outer_arg>
Use = memory_heap
Critical = 90
Label = $0 $BASE (Warning: %.2y, Critical: %.2z)
</Check>
# ==================================================================
# Predefined Checks
# Heap Memory
<Check memory_heap>
Use = base_memory_relative
Value = java.lang:type=Memory/HeapMemoryUsage/used
Base = java.lang:type=Memory/HeapMemoryUsage/max
Name = Heap Memory ${0:default_name}
Label = Heap-Memory: $BASE
</Check>
<Check memory_heap2>
Use = base_memory_relative
MBean = java.lang:type=Memory
Attribute = HeapMemoryUsage
Path = used
BaseMBean = java.lang:type=Memory
BaseAttribute = HeapMemoryUsage
BasePath = max
Name = Heap Memory ${0:default_name}
Label = Heap-Memory: $BASE
</Check>
<Check memory_heap_with_label>
Value = java.lang:type=Memory/HeapMemoryUsage/used
Name = $1
Label = $0
Critical = 1:
</Check>
# Perm Gen Memory (used for class definitions)
<Check memory_non_heap>
Use = base_memory_relative($0,$1)
Value = java.lang:type=Memory/NonHeapMemoryUsage/used
Base = java.lang:type=Memory/HeapMemoryUsage/max
Label = NonHeap Memory: $BASE
</Check>
# ===============================================
# Thread count
<Check thread_count>
Value = java.lang:type=Threading/ThreadCount
Name = ${0} $1 $2
Label = "thread_count: $0 $1 $2 : Value %f in range"
Critical = ${0}
Warning = $1
Method = POST
</Check>
<Check invalid_method>
Value = java.lang:type=Threading/ThreadCount
Name = $0 $1 $2
Critical = $0
Warning = $1
Method = Bla
</Check>
# Child
<Check def_placeholder_1>
Use thread_count(,2)
</Check>
<Check def_placeholder_2>
Use thread_count(${0},2)
</Check>
<Check def_placeholder_3>
Use thread_count
</Check>
# =========================================================
# Operation checks
<Check overloaded_operation>
MBean = jolokia.it:type=operation
Operation = overloadedMethod(java.lang.String)
Argument = ${0}
Critical = 5
Warning = :1
</Check>
# =========================================================
# Bug specific checks
# MBean with '#'
<Check hash_check>
MBean = jolokia/it:pid=[ServiceRegistryProvider\#(null)],type=ParticipantMonitor,id=*
Attribute = Ok
String = 1
Label = ServiceRegistryProvider is running
Name = Running
Critical = !OK
</Check>
# Scripting check
<Check script_check>
Script <<EOT
my $pools = $j4p->search("java.lang:type=MemoryPool,*");
my @matched_pools;
my $pattern = "${0}";
for my $pool (@$pools) {
push @matched_pools,$pool if $pool =~ /$pattern/;
}
return $j4p->get_attribute($matched_pools[0],"Usage","used");
EOT
Name script_check $0
Critical ${1:10}
Unit B
</Check>
<MultiCheck script_multi_check>
Check memory_heap(90,80)
Check script_check('Eden|Java',1000000000)
Check memory_non_heap(90,80)
Check script_check($0,1000000000)
Check thread_count(1000,2000,3000)
</MultiCheck>
# Double values below a threshold
<Check double_min>
Name = double_min
MBean = jolokia.it:type=attribute
Attribute = DoubleValueMin
Critical = 1
Warning = 2
</Check>
<Check double_max>
Name = double_max
MBean = jolokia.it:type=attribute
Attribute = DoubleValueMax
Critical = 1
Warning = 2
</Check>
<Check with_name>
Use = thread_count
Critical = $1
Name = $0
</Check>
<Check without_threshold>
Use = thread_count
</Check>
# =================================
# #81699
# Find deadlocked Threads
<Check thread_deadlock>
MBean = java.lang:type=Threading
Operation = findDeadlockedThreads
Null = no deadlock
Name = Thread-Deadlock
String = 1
Critical = !no deadlock
</Check>
<Check counter_operation>
MBean jolokia.it:type=operation
Operation fetchNumber
Argument ${0:inc}
Critical 3
Warning 2
</Check>
# 75062
<Check memory_without_perfdata>
Use = base_memory_relative($0,$1)
Value = java.lang:type=Memory/HeapMemoryUsage/used
Base = java.lang:type=Memory/HeapMemoryUsage/max
Name = Heap Memory ${0:default_name}
Label = Heap-Memory: $BASE
PerfData = ${2:No}
</Check>
<Check memory_with_perfdata>
Use = memory_without_perfdata(90,80,'yes')
</Check>

View File

@@ -0,0 +1,64 @@
include checks.cfg
# =======================================================================
# Multi checks to check
<MultiCheck memory>
Check memory_non_heap
Check memory_heap
</MultiCheck>
<MultiCheck nested>
Check thread_count(400,,"'Thread-Count'")
# Multi-Check referenced via 'Check'
Check memory
</MultiCheck>
<MultiCheck with_inner_args>
Check thread_count(400)
Check memory_heap_with_label("HelloLabel","WithInnerArgs")
</MultiCheck>
<MultiCheck with_outer_args>
Check thread_count(400)
Check memory_heap_with_label("HelloLabel",$0)
</MultiCheck>
<MultiCheck failing_multi_check>
HtmlOutput
Check memory_non_heap(1,2)
Check memory_non_heap(30,20)
Check memory_heap(1,2)
</MultiCheck>
<MultiCheck error_multi_check>
Check memory_heap
Check kaputt
Check memory_heap(1,2)
</MultiCheck>
<Check kaputt>
MBean bla:type=blub
Attribute foobar
</Check>
<MultiCheck nested_with_args>
MultiCheck with_outer_args("NestedWithArgs")
</MultiCheck>
<MultiCheck nested_with_outer_args>
# MulitCheck referenced via Check
Check with_outer_args($0)
</MultiCheck>
<MultiCheck overloaded_multi_check>
Check overloaded_operation("blub")
</MultiCheck>
# Multicheck where the checks have different arguments
# but are otherwise the same checks.
<MultiCheck label_test>
Check with_name("bla",1)
Check with_name("blub",2)
</MultiCheck>