Jmx4Perl/Product/Weblogic.pm

filter: Statementstmt 43.7% 21 / 48 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 44.4% 8 / 18 Podpod 88.8% 8 / 9 totaltotal 44.0% 37 / 84 CC 4 SCAR 12.3
CC
4
Cov
38%
exec_thread_dump
12.0
_try_version
6.0
name
2.0
CRAP 3.4
« Jmx4Perl/J4psh/Command/Server.pm ↑ Summary Jmx4Perl/Nagios/CactiJmx4Perl.pm »
1 #!/usr/bin/perl
2 package JMX::Jmx4Perl::Product::Weblogic;
3  
4 4 ▶use JMX::Jmx4Perl::Product::BaseHandler;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use JMX::Jmx4Perl::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use base "JMX::Jmx4Perl::Product::BaseHandler";
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 =head1 NAME
13  
14 JMX::Jmx4Perl::Product::Weblogic - Handler for Oracle WebLogic
15  
16 =head1 DESCRIPTION
17  
18 This is the product handler support for Oracle Weblogic Server 9 and 10
19 (L<http://www.oracle.com/appserver/>)
20  
21 =cut
22  
23 4 ▶sub id {
Subroutine id: called CC=1 SCAR=0.0
Pod documented
24 4 return "weblogic";
25 }
26  
27 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
28 0 return "Oracle WebLogic Server";
29 }
30  
31 4 ▶sub order {
Subroutine order: called CC=1 SCAR=0.0
Pod documented
32 4 return undef;
33 }
34  
35 0 ▶sub _try_version {
Subroutine _try_version: not called CC=2 SCAR=17.9
36 0 my $self = shift;
37 0 my $is_weblogic = $self->_try_server_domain;
38 0 ▶ return undef unless $is_weblogic;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_weblogic 0 0 0
39 0 return $self->try_attribute("version",$self->{server_domain},"ConfigurationVersion");
40 }
41  
42 0 ▶sub vendor {
Subroutine vendor: not called CC=1 SCAR=6.9
Pod documented
43 0 return "Oracle";
44 }
45  
46 0 ▶sub server_info {
Subroutine server_info: not called CC=1 SCAR=6.9
Pod documented
47 0 my $self = shift;
48 0 my $ret = $self->SUPER::server_info();
49 0 $ret .= sprintf("%-10.10s %s\n","IP:",$self->{jmx4perl}->get_attribute("SERVER_ADDRESS"));
50 }
51  
52 0 ▶sub _try_server_domain {
Subroutine _try_server_domain: not called CC=1 SCAR=6.9
53 0 my $self = shift;
54 0 return $self->try_attribute
55 ("server_domain",
56 "com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean",
57 "DomainConfiguration",
58 "objectName");
59 }
60  
61 0 ▶sub jsr77 {
Subroutine jsr77: not called CC=1 SCAR=6.9
Pod documented
62 0 return 0;
63 }
64  
65 0 ▶sub autodetect_pattern {
Subroutine autodetect_pattern: not called CC=1 SCAR=6.9
Pod documented
66 0 return ("version",1);
67 }
68  
69 0 ▶sub init_aliases {
Subroutine init_aliases: not called CC=1 SCAR=6.9
Pod documented
70 return
71 {
72 attributes => {
73 0 ▶ SERVER_ADDRESS => [ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
74 0 my $self = shift;
75 0 $self->_try_server_domain;
76 $self->try_attribute("admin_server",
77 $self->{server_domain},
78 0 "AdminServerName");
79 0 return [ "com.bea:Name=" . $self->{admin_server} . ",Type=ServerRuntime",
80 "AdminServerHost" ];
81 0 }],
82 },
83 operations => {
84 # Needs to be done in a more complex. Depends on admin server name *and*
85 # JVM used
86 THREAD_DUMP => \&exec_thread_dump
87 }
88 # Alias => [ "mbean", "attribute", "path" ]
89 };
90 }
91  
92 0 ▶sub exec_thread_dump {
Subroutine exec_thread_dump: not called CC=3 SCAR=24.8
Pod undocumented
93 0 my $self = shift;
94 0 my $jmx = $self->{jmx4perl};
95  
96 0 my $beans = $jmx->search("com.bea:Type=JRockitRuntime,*");
97 0 ▶ if ($beans && @{$beans}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($beans and @{$beans;}) 0 0 0
Condition0%0/3
$beans and @{$beans;}
!ll&&!rl&&r
000
MC/DC0%0/2
$beans and @{$beans;}
$beans @{$beans;}
Truth table0%0/3
A and B
A= $beansB= @{$beans;}
ABresult
0X0
100
111
98 0 my $bean = $beans->[0];
99 0 my $request = new JMX::Jmx4Perl::Request(READ,$bean,"ThreadStackDump");
100 0 return $jmx->request($request);
101 }
102 0 die $self->name,": Cannot execute THREAD_DUMP because I can't find a suitable JRockitRuntime";
103 }
104  
105 =head1 LICENSE
106  
107 This file is part of jmx4perl.
108  
109 Jmx4perl is free software: you can redistribute it and/or modify
110 it under the terms of the GNU General Public License as published by
111 the Free Software Foundation, either version 2 of the License, or
112 (at your option) any later version.
113  
114 jmx4perl is distributed in the hope that it will be useful,
115 but WITHOUT ANY WARRANTY; without even the implied warranty of
116 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117 GNU General Public License for more details.
118  
119 You should have received a copy of the GNU General Public License
120 along with jmx4perl. If not, see <http://www.gnu.org/licenses/>.
121  
122 A commercial license is available as well. Please contact roland@cpan.org for
123 further details.
124  
125 =head1 AUTHOR
126  
127 roland@cpan.org
128  
129 =cut
130  
131 4 1;
« Jmx4Perl/J4psh/Command/Server.pm ↑ Summary Jmx4Perl/Nagios/CactiJmx4Perl.pm »