Skip to content

Managing & Monitoring

jackyhung edited this page May 31, 2012 · 11 revisions

In the What is Consumer Dispatcher and Why part, we go through the functionality list that Consumer Dispatcher provides. Now we will introduce how to use those functionality and how to monitor the system.

We have 2 ways to manage and monitor the system, both of them are based on JMX.

the ports for jconsole and webbased interface are configed in job.xml

<monitor rHost="localhost" rPort="9999" httpHost="localhost" httpPort="8888"/>

Using jconsole

It's likely to link JMX with jconsole together. Many people will use jconsole to monitor java system, so do we!

- open jconsole

If you have Java environment installed, you have jconsole. You can goto your $JAVA_HOME/bin to start jconsole up. cd $JAVA_HOME ./jconsole

or you can directly run jconsole from your terminal if your PATH already include it.

- connect to your running Consumer Dispatcher instance

When you start up consumer Dispatcher, , you will find something like jmx.ConsumerDispatcherMonitor(Line:43) [main] - JMX enabled on:service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi in the log file, if you enable INFO logger level.

this is the address you need to provide into jconsole.

fill in service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi (change localhost to your target ip) and click 'connect'

jconsole login

- Find your queue

after connected, you see tabs and information provided by default. Please click on 'MBeans' tab and navigate to ‘your domain’ -> 'queue name' -> 'rabbitmq server' -> 'vhost' in the left box.

you will have option to see 'attributes' and do some 'operation' on the suposed queue.

find the queue

- check the stats

click on the 'attributes' node, it shows you

  • how many working job executor is there for that queue (How it works)
  • how many job has been consumed for this queue

jconsole stats

- do operation on the queue

click on the 'operations' node, you can perform different functionalities that Consumer Dispatcher provides (functionality list)

jconsole operations

  • addJobExecutor:
    (function explanation)
    parameter p1: the number of job executors you would like to add. say, if there is running 1 job executor already, then inputting 3 and clicking 'addJobExecutor' button results in 4 executors running for this queue.

  • removeJobExecutors:
    (function explanation)
    parameter p1: the number of job executors you would like to remove. say, if there is running 30 job executor already, then inputting 10 and clicking 'removeJobExecutors' button results in 20 executors running for this queue.

  • stopAllExecutors:
    stop all consumers for that queue. after stopping all, if you need to run consumer code again, you can use 'addJobExecutor' button.

  • purgeQueue:
    (function explanation and use case)

  • logErrorJobToFile:
    (function explanation and use case)

Web based client

web based client provides exactly the same stuff as jconsole does.

If you have mx4j-tool.jar in your classpath (by default, it's packaged into the jar, so enabled by defalut) When you start up consumer Dispatcher, , you will find something like INFO jmx.ConsumerDispatcherMonitor(Line:71) [main] - mx4j successfuly loaded at localhost:8888 in the log file, if you enable INFO logger level.

visit http://localhost:8888 with your browser, on which you could do the same operations as described above.

mx4j