I want to call JBoss 5x JMX's mbeans with linux shell script. Is there anyway to call JBoss 5x JMX's mbeans with Linux shell script?
Asked
Active
Viewed 1,133 times
0
-
Duplicate as http://stackoverflow.com/questions/1751130/calling-jmx-mbean-method-from-a-shell-script – Ted Shaw Sep 10 '12 at 11:27
-
@Ted I already seen this, but it is not similar as I want. If you are experienced on this, could you support some simple example? – Sai Ye Yan Naing Aye Sep 10 '12 at 11:34
2 Answers
1
Jboss shipped with twiddle script, you can get the list of Mbeans from jmx-console and query/invoke it through twiddle, such as
$JBOSS_HOME/twiddle.sh -s 127.0.0.1 invoke "jboss.system:type=ServerInfo" listMemoryPools "True"
$JBOSS_HOME/twiddle.sh -s 127.0.0.1 get "jboss.system:type=ServerInfo"
and you can also use nagios-jmx-plugin
java -jar check_jmx.jar -U service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1090/jmxconnector --username admin --password admin -O "jboss.system:type=ServerInfo" -A FreeMemory

Ted Shaw
- 2,298
- 14
- 8
-
The first way is OK for me but how i access this on other machine not localhost.Please share me this. – Sai Ye Yan Naing Aye Sep 11 '12 at 05:00
-
add -u username -p password and change -s to real hostname $JBOSS_HOME/twiddle.sh -u admin -p admin -s otherhost.com get "jboss.system:type=ServerInfo" – Ted Shaw Sep 11 '12 at 06:23
0
Only by writing a Java program to invoke from the shell script to talk to the MBeans.

bmargulies
- 97,814
- 39
- 186
- 310