blib/lib/JMX/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
« blib/lib/JMX/Jmx4Perl/J4psh/Command/Server.pm ↑ Summary blib/lib/JMX/Jmx4Perl/Nagios/CactiJmx4Perl.pm »
1 #!/usr/bin/perl
2 package JMX::Jmx4Perl::Product::Weblogic;
3  
4 2 ▶use JMX::Jmx4Perl::Product::BaseHandler;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use JMX::Jmx4Perl::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use base "JMX::Jmx4Perl::Product::BaseHandler";
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶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 sub id {
24 2 ▶ return "weblogic";
Subroutine id: called CC=1 SCAR=0.0
Pod documented
25 }
26  
27 sub name {
28 0 ▶ return "Oracle WebLogic Server";
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
29 }
30  
31 sub order {
32 2 ▶ return undef;
Subroutine order: called CC=1 SCAR=0.0
Pod documented
33 }
34  
35 sub _try_version {
36 0 ▶ my $self = shift;
Subroutine _try_version: not called CC=2 SCAR=17.9
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 sub vendor {
43 0 ▶ return "Oracle";
Subroutine vendor: not called CC=1 SCAR=6.9
Pod documented
44 }
45  
46 sub server_info {
47 0 ▶ my $self = shift;
Subroutine server_info: not called CC=1 SCAR=6.9
Pod documented
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 sub _try_server_domain {
53 0 ▶ my $self = shift;
Subroutine _try_server_domain: not called CC=1 SCAR=6.9
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 sub jsr77 {
62 0 ▶ return 0;
Subroutine jsr77: not called CC=1 SCAR=6.9
Pod documented
63 }
64  
65 sub autodetect_pattern {
66 0 ▶ return ("version",1);
Subroutine autodetect_pattern: not called CC=1 SCAR=6.9
Pod documented
67 }
68  
69 sub init_aliases {
70 return
71 {
72 attributes => {
73 SERVER_ADDRESS => [ sub {
74 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
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 ▶ }],
Subroutine init_aliases: not called CC=1 SCAR=6.9
Pod documented
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 sub exec_thread_dump {
93 0 ▶ my $self = shift;
Subroutine exec_thread_dump: not called CC=3 SCAR=24.8
Pod undocumented
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 2 1;
« blib/lib/JMX/Jmx4Perl/J4psh/Command/Server.pm ↑ Summary blib/lib/JMX/Jmx4Perl/Nagios/CactiJmx4Perl.pm »