0

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?

Sai Ye Yan Naing Aye
  • 6,622
  • 12
  • 47
  • 65

2 Answers2

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