zoukankan      html  css  js  c++  java
  • perl JMX::Jmx4Perl

    NAME ^

    JMX::Jmx4Perl - JMX access for Perl

    SYNOPSIS ^

    Simple:

    use strict;
    use JMX::Jmx4Perl;
    use JMX::Jmx4Perl::Alias; # Import MBean aliases

    print “Memory Used: “,
    JMX::Jmx4Perl
    ->new(url => “http://localhost:8080/j4p“)
    ->get_attribute(MEMORY_HEAP_USED);
    Advanced:

    use strict;
    use JMX::Jmx4Perl;
    use JMX::Jmx4Perl::Request; # Type constants are exported here

    my $jmx = new JMX::Jmx4Perl(url => “http://localhost:8080/j4p“,
    product => “jboss”);
    my request=newJMX::Jmx4Perl::Request(type=>READ,mbean=>java.lang:type=Memory,attribute=>HeapMemoryUsage,path=>used);myresponse = jmx>request(request);
    print “Memory used: “,$response->value(),” ”;

    # Get general server information
    print “Server Info: “,$jmx->info();

    DESCRIPTION ^

    Jmx4Perl is here to connect the Java and Perl Enterprise world by providing transparent access to the Java Management Extensions (JMX) from the perl side.

    Jmx4Perl 是连接到Java和 Perl Enterprise world 通过提供透明的访问到Java 管理扩展(JMX)

    It uses a traditional request-response paradigma for performing JMX operations on a remote Java Virtual machine.

    它使用一个传统的请求-响应范式用于执行JMX 操作在一个远程的Java 虚拟机。

    There a various ways how JMX information can be transfered. Jmx4Perl is based on a Jolokia agent (www.jolokia.org), which needs to deployed on the target platform.
    It plays the role of a proxy, which on one side communicates with the 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 JMX::Jmx4Perl::Manual for installation instructions for how to deploy the Jolokia agent.

    有各种方式 JMX信息可以被转移,Jmx4Perl是基于Jolokia agent(www.jolokia.org),需要部署在目标平台。

    它起一个代理的角色, 一方面和MBeanServer通讯和传输JMX相关的信息通过HTTP和JSON 给客户端(i.e. this module).

    请参考JMX::Jmx4Perl::Manual 查看安装说明和如何部署Jolokia agent。

    An alternative and more ‘java like’ approach is the usage of JSR 160 connectors. However, the default connectors provided by the Java Virtual Machine (JVM) since version 1.5 support only proprietary protocols which require serialized Java objects to be exchanged. This implies that a JVM needs to be started on the client side adding quite some overhead if used from within Perl. If you absolutely require JSR 160 communication (e.g. because a agent can not be deployed on the target for some reason), you can still use Jmx4Perl operating with the so called proxy mode.

    一个不寻常的,更加‘java like’的方法是JSR 160连接器的使用。然而, 默认的连接器提供通过Java Virtual Machine (JVM) 自从1.5版本只支持

    专有的额系诶需要学历恶化的Java对象被执行。 这意味着JVM需要被启动在客户端上增加一些开销,如果从Perl内部使用。

    For further discussion comparing both approaches, please refer to JMX::Jmx4Perl::Manual

    为进一步讨论比较的方法,请参阅JMX::Jmx4Perl::Manual

    JMX itself knows about the following operations on so called MBeans, which are specific “managed beans” designed for JMX and providing access to management functions:

    Reading and writing of attributes of an MBean (like memory usage or connected users)
    Executing of exposed operations (like triggering a garbage collection)
    Registering of notifications which are send from the application server to a listener when a certain event happens.

    JMX 本身知道以下操作所谓的MBean,指定为”managed beans” 设计用于JMX 和提供访问管理功能:

    读取和写MBean的属性(like memory usage or connected users)

    执行操作(like triggering a garbage collection)

    当某事件发生时,将从应用服务器发送通知的通知注册

    METHODS 方法:
    $jmx = JMX::Jmx4Perl->new(mode => , ….)

    $jmx = JMX::Jmx4Perl->new(mode => , ….)

    Create a new instance. The call is dispatched to an Jmx4Perl implementation by selecting an appropriate mode. For now, the only mode supported is “agent”,

    which uses the JMX::Jmx4Perl::Agent backend. Hence, the mode can be submitted for now.

    创建一个新实例, 请求被调度到一个Jmx4Perl 实现通过选择一个适当的模式。现在,唯一的方式是代理,使用JMX::Jmx4Perl::Agent后台,因此,

    该模式可以提交现在。

    Options can be given via key value pairs (or via a hash). Recognized options are:

    选项可以通过键值对(或者通过hash),公认的选项:

    server
    You can provide a server name which is looked up in a configuration file. The configuration file’s name can be given via config_file (see below) or,

    by default, .j4p in the users home directory is used.

    你能提供一个server name,在配置文件里查找。配置文件的名字可以被给定通过config_file(见下文) 默认的,.j4p 在用户家目录被使用。

    config_file
    Path to a configuration file to use

    配置文件使用路径

    config
    A JMX::Jmx4Perl::Config object which is used for configuraton. Use this is you already read in the configuration on your own.

    JMX::Jmx4Perl::Config 配置对象用于配置, 使用你已经从配置读取的

    product
    If you provide a product id via the named parameter product you can given jmx4perl a hint which server you are using. By default, this module uses autodetection to guess the kind of server you are talking to. You need to provide this argument only if you use jmx4perl’s alias feature and if you want to speed up things (autodetection can be quite slow since this requires several JMX request to detect product specific MBean attributes).

    如果你提供一个产品id 通过命名的参数产品你可以指定jmx4perl 一个hint,默认的 这个模块是使用自动检查的 来猜测server的类型。

    你需要提供这个参数只要如果你使用jmx4perl’s alias 功能,如果你需要加速(自动检查可能是相当慢的因为这个需要server JMX 请求来检测产品指定的MBean 属性0

    timeout
    Timeout in seconds for an HTTP request

    method
    Default HTTP method to use for requests which can be overridden for each specific request

    Any other named parameters are interpreted by the backend, please refer to its documentation for details (i.e. JMX::Jmx4Perl::Agent)

    value=>jmx->get_attribute(…)
    value=jmx->get_attribute(mbean,attribute,path)value = jmx>getattribute(alias)
    value=jmx->get_attribute(ALIAS) # Literal alias as defined in
    # JMX::Jmx4Perl::Alias
    value=jmx->get_attribute({ domain => ,
    properties => { => value },
    attribute => ,
    path => })
    value=jmx->get_attribute({ alias => ,
    path =>

  • 相关阅读:
    MySQL 行锁 表锁机制
    2017年总结-我的学习之路
    SpringData 基于SpringBoot快速入门
    SolrJ 复杂查询 高亮显示
    Solr7 安装部署 管理界面介绍
    Redis 高可用集群
    10分钟搭建服务器集群——Windows7系统中nginx与IIS服务器搭建集群实现负载均衡
    1分钟解决VS每次运行都显示“正在还原nuget程序包”问题
    C# Lambda表达式和linq表达式 之 匿名对象查询接收
    C#枚举的简单使用
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351355.html
Copyright © 2011-2022 走看看