使用jmx4perl和j4psh接管Jolokia

在ActiveMQ的API中,内置了Jolokia 。

可以使用jmx4perl来安装:

复制代码
$ perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> install JMX::Jmx4Perl
...
...
jmx4perl
========

jmx4perl is a command line utility for accessing Jolokia agents
(www.jolokia.org). It can be used for script based exploration 
and easy inspection of the JMX space.

Install 'jmx4perl' ? (y/n) [y ]
....
复制代码

其余的库可以自行安装

复制代码
root@kali:~# j4psh http://192.168.197.25:8161/api/jolokia -user admin -password admin
[192.168.197.25:8161] : help
                  cd -- Enter a domain
             connect -- Connect to a server by its URL or symbolic name
               error -- Show last error (if any)
                help -- Print online help
             history -- Command History
                  ls -- List MBean Domains
                quit -- Quit
             servers -- Show all configured servers
[192.168.197.25:8161] : ls
JMImplementation:
    type=MBeanServerDelegate

jolokia:
    type=Config
    type=Discovery
    type=ServerHandler

io.fabric8.insight:
    type=LogQuery

java.nio:
    name=direct,type=BufferPool
    name=mapped,type=BufferPool

jmx4perl:
    type=Config

com.sun.management:
    type=DiagnosticCommand
    type=HotSpotDiagnostic

org.apache.activemq:
    brokerName=localhost,connector=clientConnectors,connectorName=amqp,type=Broker
    brokerName=localhost,connector=clientConnectors,connectorName=mqtt,type=Broker
    brokerName=localhost,connector=clientConnectors,connectorName=openwire,type=Broker
    brokerName=localhost,connector=clientConnectors,connectorName=stomp,type=Broker
    brokerName=localhost,connector=clientConnectors,connectorName=ws,type=Broker
    brokerName=localhost,destinationName=121.42.182.208_1234,destinationType=Topic,type=Broker
    brokerName=localhost,destinationName=ActiveMQ.Advisory.MasterBroker,destinationType=Topic,type=Broker
    brokerName=localhost,destinationName=ActiveMQ.Advisory.Queue,destinationType=Topic,type=Broker
    brokerName=localhost,destinationName=ActiveMQ.Advisory.Topic,destinationType=Topic,type=Broker
    brokerName=localhost,destinationName=abc.def,destinationType=Queue,type=Broker
    brokerName=localhost,instanceName=KahaDBPersistenceAdapter[/data/apache-activemq-5.15.2/data/kahadb_Index_/data/apache-activemq-5.15.2/data/kahadb],service=PersistenceAdapter,type=Broker
    brokerName=localhost,service=Health,type=Broker
    brokerName=localhost,service=Log4JConfiguration,type=Broker
    brokerName=localhost,type=Broker

java.lang:
    name=Code Cache,type=MemoryPool
    name=CodeCacheManager,type=MemoryManager
    name=Copy,type=GarbageCollector
    name=Eden Space,type=MemoryPool
    name=MarkSweepCompact,type=GarbageCollector
    name=Metaspace Manager,type=MemoryManager
    name=Metaspace,type=MemoryPool
    name=Survivor Space,type=MemoryPool
    name=Tenured Gen,type=MemoryPool
    type=ClassLoading
    type=Compilation
    type=Memory
    type=OperatingSystem
    type=Runtime
    type=Threading

java.util.logging:
    type=Logging

[192.168.197.25:8161] : cd java.lang
[192.168.197.25:8161 java.lang] : ls
java.lang:
    name=Code Cache,type=MemoryPool
    name=CodeCacheManager,type=MemoryManager
    name=Copy,type=GarbageCollector
    name=Eden Space,type=MemoryPool
    name=MarkSweepCompact,type=GarbageCollector
    name=Metaspace Manager,type=MemoryManager
    name=Metaspace,type=MemoryPool
    name=Survivor Space,type=MemoryPool
    name=Tenured Gen,type=MemoryPool
    type=ClassLoading
    type=Compilation
    type=Memory
    type=OperatingSystem
    type=Runtime
    type=Threading

[192.168.197.25:8161 java.lang] : cd type=ClassLoading
[192.168.197.25:8161 java.lang:type=ClassLoading] : ls
java.lang:type=ClassLoading

Attributes:
  TotalLoadedClassCount           long               TotalLoadedClassCount
  LoadedClassCount                int                LoadedClassCount
  ObjectName                      ObjectName         ObjectName
  UnloadedClassCount              long               UnloadedClassCount
  Verbose                         boolean            Verbose

[192.168.197.25:8161 java.lang:type=ClassLoading] : cat ObjectName
    {
      objectName => 'java.lang:type=ClassLoading'
    }
[192.168.197.25:8161 java.lang:type=ClassLoading] : 
复制代码

 

posted @   sevck  阅读(669)  评论(0编辑  收藏  举报
编辑推荐:
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
阅读排行:
· 新年开篇:在本地部署DeepSeek大模型实现联网增强的AI应用
· DeepSeek火爆全网,官网宕机?本地部署一个随便玩「LLM探索」
· Janus Pro:DeepSeek 开源革新,多模态 AI 的未来
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(三):用.NET IoT库
· 上周热点回顾(1.20-1.26)
点击右上角即可分享
微信分享提示