当前位置: 首页 > 工具软件 > jmx4perl > 使用案例 >

使用jmx4perl和j4psh接管Jolokia

田翔
2023-12-01

在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] :

 

转载于:https://www.cnblogs.com/sevck/p/8341622.html

 类似资料: