e
MBeanServer within in the application server and transfers JMX related
information via HTTP and JSON to the client (i.e. this module). Please refer to
L<JMX::Jmx4Perl::Manual> for installation instr
VERSION $HANDLER_BASE_PACKAGE @PRODUCT_HANDLER_ORDERING);
use Data::Dumper;
use Module::Find;
use JSON;
$VERSION = "1.13";
my $REGISTRY = {
# Agent based
"agent" => "
uired
alarm $timeout;
$s->recv($data,8192);
push @result,from_json($data, {utf8 => 1} );
alarm 0;
};
if ($@) {
die unless $@
gent;
use JMX::Jmx4Perl::Agent::Jolokia::Logger;
use JMX::Jmx4Perl::Agent::Jolokia::Verifier;
use JSON;
use Data::Dumper;
use base qw(LWP::UserAgent);
use strict;
my $JOLOKIA_META_URL = "http://www.j
meta_json;
my $cached = undef;
if (!$force) {
$meta_json = $self->_from_cache;
$cached = 1 if $meta_json;
}
$meta_json = $self->_load_from_server unless $meta_json; # T
# loaded
return undef unless $meta_json;
$self->_to_cache($meta_json) unless $cached;
$self->{_meta} = $meta_json;
return $self;
}
=item $meta->initialized()
Return
uilding blocks of this bridge are based on standards well
known and used in both worlds: HTTP and JSON.
The agent part of jmx4perl can be found at www.jolokia.org. This site also
contains all relevan
locally to the JMX
MBeanServer, and listens to HTTP requests whose results are translated into a
JSON representation. This reponse can be easily picked up by a Perl module,
L<JMX::Jmx4Perl> in our ca
ing the j4p agent servlet on
it. This works by using j4p.war as a JMX Proxy, which translates our
JSON/HTTP protocol on the frontside to JSR-160 JMX remote requests on the
backend and vice versa.
A d
em $content = $response->value()
Return the content of this response, which is a represents the JSON response as
returned by the Java agent as a hash reference value. This is set only when C<is_ok>
an C<java.lang:type=Memory>'s attribute C<HeapMemoryUsage> is a complex
value, which looks in the JSON representation like
"value":{"init":0,"max":518979584,"committed":41381888,"used":33442568}
So
eErrors
With these number you can restrict the size of the JSON structure
returned. C<maxDepth> gives the maximum nesting level of the JSON
object,C<maxObjects> returns the maximum number of objects
No operation name given\n" unless $self->{operation};
}
}
# Called for post requests
sub TO_JSON {
my $self = shift;
my $ret = {
type => $self->{type} ? uc($self->{type})
se Data::Dumper;
use JSON;
=item $is_object = JMX::Jmx4Perl::Util->is_object_to_dump($val)
For dumping out, checks whether C<$val> is an object (i.e. it is a ref but not a
JSON::XS::Boolean) or not
shift;
my $val = shift;
return ref($val) && !JSON::is_bool($val);
}
=item $text = JMX::Jmx4Perl::Util->dump_value($value,{ format => "json", boolean_string =>1})
Return a formatted text repr
is the default and uses
L<Data::Dumper> for creating a textual description and C<json> which return the
result as JSON value. When C<data> is used as format, booleans are returned as 0
for false and
Perl::J4psh::Command);
use JMX::Jmx4Perl::Util;
use JMX::Jmx4Perl::Request;
use Data::Dumper;
use JSON;
=head1 NAME
JMX::Jmx4Perl::J4psh::Command::MBean - MBean commands
=head1 DESCRIPTION
=head1
XT);
use Carp;
use Scalar::Util qw(looks_like_number);
use URI::Escape;
use Text::ParseWords;
use JSON;
our $AUTOLOAD;
=head1 NAME
JMX::Jmx4Perl::Nagios::SingleCheck - A single nagios check
This i
_safe_value {
my $self = shift;
my $value = shift;
if (defined($value)) {
if (JSON::is_bool($value)) {
return $value ? "true" : "false";
} elsif (ref($value) &&
.$extra);
}
if (!$req->is_mbean_pattern && (ref($resp->value) && !$self->string) && !JSON::is_bool($resp->value)) {
$self->_die("Response value is a " . ref($resp->value) .
#!/usr/bin/perl
package JMX::Jmx4Perl::Agent;
use JSON;
use URI::Escape qw(uri_escape_utf8);
use HTTP::Request;
use Carp;
use strict;
use vars qw($VERSION $DEBUG);
use base qw(JMX::Jmx4Perl);
use JMX
nt;
use Data::Dumper;
$VERSION = $JMX::Jmx4Perl::VERSION;
=head1 NAME
JMX::Jmx4Perl::Agent - JSON-HTTP based acess to a remote JMX agent
=head1 SYNOPSIS
my $agent = new JMX::Jmx4Perl(mode=>"ag
ified in L<JMX::Jmx4Perl>. It uses a
L<HTTP::Request> sent via an L<LWP::UserAgent> for posting a JSON representation
of the request. This method shouldn't be called directly but via
L<JMX::Jmx4Perl>-