Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Reference/jetty-monitor"

Line 1: Line 1:
 
{{Jetty Reference  
 
{{Jetty Reference  
 
| introduction =  
 
| introduction =  
Jetty-monitor module allows developers and system administrators to monitor Jetty-based servers. It can run either inside Jetty process or as a standalone Java application, and can be used to monitor both regular and embedded Jetty servers. Jetty-monitor is as a consumer of Jetty JMX integration, allowing it to access MBeans that supply statistical and runtime information about Jetty components and web applications, as well as Java Virtual Machine itself. It can be configured to execute actions that are performed in the event trigger condition(s) based on value(s) of specified MBean attribute(s) are satisfied. Currently, only logging and console output actions are provided out of the box, with ability to easily add custom actions.
+
Jetty-monitor module allows developers and system administrators to monitor Jetty-based servers. It can run either inside Jetty process or as a standalone Java application, and can be used to monitor both regular and embedded Jetty servers. Jetty-monitor is as a consumer of Jetty JMX integration, allowing it to access MBeans that supply statistical and runtime information about Jetty components and web applications, as well as Java Virtual Machine itself. It can be configured to execute actions that are performed in the event trigger condition(s) based on value(s) of specified MBean attribute(s) are satisfied, as well as to call notifier(s) that would be called when an action is performed. Currently, only one action that simply calls the configured notifiers, and only logging and console output notifiers are provided out of the box, with ability to easily add custom actions and notifiers.
  
 
In addition, jetty-monitor provides an integration with [http://www.java-monitor.com Java-monitor] service via a custom action. This integration allows posting the data about the server to a Java-monitor account and using it to monitor the server remotely as well as gathering information about server's performance and outages.
 
In addition, jetty-monitor provides an integration with [http://www.java-monitor.com Java-monitor] service via a custom action. This integration allows posting the data about the server to a Java-monitor account and using it to monitor the server remotely as well as gathering information about server's performance and outages.
 
| body =
 
| body =
 
== Jetty-monitor Installation ==
 
== Jetty-monitor Installation ==
In order to start using jetty-monitor, it is necessary to enable and configure jetty-jmx module in your server process. For instructions on how to do that, please see [[Jetty/Tutorial/JMX|Jetty JMX tutorial]]. If jetty-monitor is going to be run as a standalone Java application, you must configure a remote JMX connector.
+
In order to start using jetty-monitor, it is necessary to enable and configure jetty-jmx module in your server process first. For instructions on how to do that, please see [[Jetty/Tutorial/JMX|Jetty JMX tutorial]]. If jetty-monitor is going to be run as a standalone Java application, you must configure a remote JMX connector.
 +
 
 +
To use jetty-monitor inside the Jetty server process, it needs to be added to the server classpath by copying it into <code>{jetty.home}/lib/ext</code> directory. Jetty-monitor can be configured using the standard jetty.xml configuration file [[Jetty/Reference/jetty.xml_syntax|syntax]]. The following is an example of the jetty-monitor configuration file. It creates a SimpleAction monitor action that is configured to execute when the number of idle threads in Jetty's main thread pool is less than or equal to 4, or greater when 7. When this action is executed, it invokes a console notifier that outputs the message to the console.
 +
 
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
 +
 
 +
<Configure id="Monitor" class="org.mortbay.jetty.monitor.JMXMonitor">
 +
  <Call name="addActions">
 +
    <Arg>
 +
      <Array type="org.mortbay.jetty.monitor.MonitorAction">
 +
        <Item>
 +
          <New class="org.mortbay.jetty.monitor.SimpleAction">
 +
            <Arg>
 +
              <New class="org.mortbay.jetty.monitor.triggers.OrEventTrigger">
 +
                <Arg>
 +
                  <Array type="org.mortbay.jetty.monitor.EventTrigger">
 +
                    <Item>
 +
                      <New
 +
                        class="org.mortbay.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger">
 +
                        <Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
 +
                        </Arg>
 +
                        <Arg>idleThreads</Arg>
 +
                        <Arg type="java.lang.Integer">4</Arg>
 +
                      </New>
 +
                    </Item>
 +
                    <Item>
 +
                      <New
 +
                        class="org.mortbay.jetty.monitor.triggers.GreaterThanAttrEventTrigger">
 +
                        <Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
 +
                        </Arg>
 +
                        <Arg>idleThreads</Arg>
 +
                        <Arg type="java.lang.Integer">7</Arg>
 +
                      </New>
 +
                    </Item>
 +
                  </Array>
 +
                </Arg>
 +
              </New>
 +
            </Arg>
 +
            <Arg>
 +
              <New class="org.mortbay.jetty.monitor.ConsoleNotifier">
 +
                <Arg>%s</Arg>
 +
              </New>
 +
            </Arg>
 +
            <Arg type="java.lang.Long">500</Arg>
 +
          </New>
 +
        </Item>
 +
      </Array>
 +
    </Arg>
 +
  </Call>
 +
</Configure>
 +
</source>
 +
 
  
To use jetty-monitor inside the Jetty server process, it needs to be added to the server classpath by copying it into <code>{jetty.home}/lib/ext</code> directory.
 
 
| more =  
 
| more =  
 
See [[Jetty/Tutorial/JMX|Jetty JMX tutorial]] for instructions on how to configure Jetty JMX integration.
 
See [[Jetty/Tutorial/JMX|Jetty JMX tutorial]] for instructions on how to configure Jetty JMX integration.
 +
 +
See jetty.xml [[Jetty/Reference/jetty.xml_syntax|syntax reference]]  for more information on configuration file syntax.
 
}}
 
}}

Revision as of 10:59, 29 April 2011



Introduction

Jetty-monitor module allows developers and system administrators to monitor Jetty-based servers. It can run either inside Jetty process or as a standalone Java application, and can be used to monitor both regular and embedded Jetty servers. Jetty-monitor is as a consumer of Jetty JMX integration, allowing it to access MBeans that supply statistical and runtime information about Jetty components and web applications, as well as Java Virtual Machine itself. It can be configured to execute actions that are performed in the event trigger condition(s) based on value(s) of specified MBean attribute(s) are satisfied, as well as to call notifier(s) that would be called when an action is performed. Currently, only one action that simply calls the configured notifiers, and only logging and console output notifiers are provided out of the box, with ability to easily add custom actions and notifiers.

In addition, jetty-monitor provides an integration with Java-monitor service via a custom action. This integration allows posting the data about the server to a Java-monitor account and using it to monitor the server remotely as well as gathering information about server's performance and outages.

Jetty-monitor Installation

In order to start using jetty-monitor, it is necessary to enable and configure jetty-jmx module in your server process first. For instructions on how to do that, please see Jetty JMX tutorial. If jetty-monitor is going to be run as a standalone Java application, you must configure a remote JMX connector.

To use jetty-monitor inside the Jetty server process, it needs to be added to the server classpath by copying it into {jetty.home}/lib/ext directory. Jetty-monitor can be configured using the standard jetty.xml configuration file syntax. The following is an example of the jetty-monitor configuration file. It creates a SimpleAction monitor action that is configured to execute when the number of idle threads in Jetty's main thread pool is less than or equal to 4, or greater when 7. When this action is executed, it invokes a console notifier that outputs the message to the console.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
 
<Configure id="Monitor" class="org.mortbay.jetty.monitor.JMXMonitor">
  <Call name="addActions">
    <Arg>
      <Array type="org.mortbay.jetty.monitor.MonitorAction">
        <Item>
          <New class="org.mortbay.jetty.monitor.SimpleAction">
            <Arg>
              <New class="org.mortbay.jetty.monitor.triggers.OrEventTrigger">
                <Arg>
                  <Array type="org.mortbay.jetty.monitor.EventTrigger">
                    <Item>
                      <New
                        class="org.mortbay.jetty.monitor.triggers.LessThanOrEqualToAttrEventTrigger">
                        <Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
                        </Arg>
                        <Arg>idleThreads</Arg>
                        <Arg type="java.lang.Integer">4</Arg>
                      </New>
                    </Item>
                    <Item>
                      <New
                        class="org.mortbay.jetty.monitor.triggers.GreaterThanAttrEventTrigger">
                        <Arg>org.eclipse.jetty.util.thread:type=queuedthreadpool,id=0
                        </Arg>
                        <Arg>idleThreads</Arg>
                        <Arg type="java.lang.Integer">7</Arg>
                      </New>
                    </Item>
                  </Array>
                </Arg>
              </New>
            </Arg>
            <Arg>
              <New class="org.mortbay.jetty.monitor.ConsoleNotifier">
                <Arg>%s</Arg>
              </New>
            </Arg>
            <Arg type="java.lang.Long">500</Arg>
          </New>
        </Item>
      </Array>
    </Arg>
  </Call>
</Configure>

Additional Resources

See Jetty JMX tutorial for instructions on how to configure Jetty JMX integration.

See jetty.xml syntax reference for more information on configuration file syntax.

Back to the top