NotificationWorker

    The notification worker page contains objects that allow you to manange, connect to, create, and use JMX notifications. This example will combine components from the diagnosticWorkers and notificationWorkers package to create a URL monitor that will email you when a site is down.

    You should already be familiar with the Junit DiagnosticWorkers package. It uses the Junit test framework to manage objects which test services. We are going to use the org.jmx4odp.junitRunner.EventRunner as our Junit test runner. It is a modified test runner that runs the Junit tests in the JMX agent and sends out failures and errors as events.

    Now we will use the notificationWorkers to connect to the EventRunner and listen for notifications that we are interested in. We are going to listen with a NotificationMailer object. So by combining these objects, we can have one listen for when URLS cannot be reached, send out a notification, which will be caught by the mail object, which will send an email to you.

    Go to your

    bin/diagnosticWorkerDemo

    and run your

    start.bat or start.sh

    If all goes well, this should start up a BaseAgent, then pause for a little, then it will use the XmlExecutor to initialize the JMX ojects. You can go to the BaseAgent's HTTP port to see what is going on. You can switch the URL to a bad one and it should send you an email.