set host [lindex $argv 0]
set port [lindex $argv 1]
set queue [lindex $argv 2]
jmx_connect -h $host -p $port
set message_count [jmx_get -m org.hornetq:module=JMS,name="$queue",type=Queue MessageCount]
puts "$message_count"
jmx_close
I can then run the script like this and it prints the amount of messages on the DLQ to stdout:
./jmxsh queue_count.tcl localhost 3000 DLQ
While the use of TCL might seem obtuse (ie, why not Groovy?), it makes sense from the standpoint of a sysadmin. The JMX agnostic language allows them to script against an app's MBeans with minimal exposure to Java or the JMX API's.
No comments:
Post a Comment