JMX::Jmx4Perl::Response - A jmx4perl response
my $jmx_response = $jmx_agent->request($jmx_request); my $value = $jmx_response->value();
A JMX::Jmx4Perl::Response is the result of an JMX request and encapsulates the answer as returned by a JMX::Jmx4Perl backend. Depending on the status it either contains the result of a valid request or a error message. The status is modelled after HTTP response codes (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html). For now, only the codes 200 and 400 .. 599 codes are used to specified successful request and errors respectively.
status
200
400 .. 599
Internal constructor for creating a response which is use withing requesting the backend. $error and $stacktrace are optional and should only provided when $status != 200.
$error
$stacktrace
$status != 200
Return the status code of this response. Status codes are modelled after HTTP return codes. 200 is the code for a suceeded request. Any code in the range 500 - 599 specifies an error.
Get the timestamp (i.e. epoch seconds) when the request was executed on the serverside.
Get the history if history tracking is switched on. History tracking is switchen on by executing a certain JMX operation on the jmx4perl:type=Config MBean. See the alias JMX4PERL_HISTORY_MAX_ATTRIBUTE and "HISTORY TRACKING" in jmx4perl for details.
jmx4perl:type=Config
JMX4PERL_HISTORY_MAX_ATTRIBUTE
The returned arrayref (if any) contains hashes with two values: value contains the historical value and timestamp the timestamp when this value was recorded.
value
timestamp
Return true if this object contains a valid response (i.e. the status code is equal 200)
Opposite of is_ok, i.e. return true if the status code is not equal to 200
is_ok
Return the error text. Set only if is_error is true
is_error
true
Returns the stacktrace of an Java error if any. This is only set when is_error is true and and Java exception occured on the Java agent's side.
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 is_ok is true.
Return the JMX::Jmx4Perl::Request which lead to this response
This file is part of jmx4perl.
Jmx4perl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
jmx4perl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with jmx4perl. If not, see <http://www.gnu.org/licenses/>.
A commercial license is available as well. Please contact roland@cpan.org for further details.
roland@cpan.org
To install JMX::Jmx4Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm JMX::Jmx4Perl
CPAN shell
perl -MCPAN -e shell install JMX::Jmx4Perl
For more information on module installation, please visit the detailed CPAN module installation guide.