简体   繁体   中英

JMX java processes monitoring

I work on JBoss 7 as and I want to monitor the JBoss processes: (memory used by this processes, CPU percentage...) , using JMX features. I try this code:

 Process p = Runtime.getRuntime().exec
                ("C:\\Users\\*****\\Downloads\\PSTools\\pslist -m");
Process p = Runtime.getRuntime().exec(
                    "C:\\Users\\olawzi\\Downloads\\PSTools\\pslist.exe -s 2");

and it gives a good result, but it doesn't a JMX way. I want to use JMX. Is there any way to do this? thanks for everyone...

Well you can use Nagios to monitor JBoss and other processes very efficiently.You just need a jmx plugin and mbean class which are already here

Integrate JBoss into Nagios monitoring through a small Collector MBean and a perl based Nagios plugin. Lets you read and monitor JMX values from JBoss servers very efficiently. On the Nagios server no JDK or JBoss installation is needed. 在此处输入图片说明

Installation :

with JBoss:

Copy the collector.sar (from the mbean/ directory) to your JBoss deploy directory. Port 5566 is then open for the plugin to access it. with Tomcat or anything else:

Put the collector.sar somewhere in the file system and add -javaagent:/path/to/collector.sar to the options of the JVM you want to monitor. Nagios server:

Copy the plugin check_mbean_collector (from the plugin/ directory) to the Nagios plugin directory on the Nagios server. Edit your Nagios config to use the check_mbean_collector to monitor any attributes of any MBean. You might check that the plugin and the MBean is working properly by doing a test run on the Nagios server:

./check_mbean_collector -H jbossserver -p 5566 -m jboss.system:type=ServerInfo -a ActiveThreadCount -w 200 -c 400<p>

The benefit of using nagios is that: you dont have to write customized mbeans everytime. thousands of ready made plugins. whole lot of distributed processes can be monitored with very less effort from a centralized server. And ofcourse community support.

Note : You may install nagios from here However if you dont want to install nrpe and nagios then use op5 monitor and check_jmx plugin.you may then simply use it like

./check_jmx -U service:jmx:rmi:///jndi/rmi://'app-server':'1090'/jmxrmi -O jboss.jca:name=JmsXA,service=ManagedConnectionPool -A AvailableConnectionCount

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM