How To Enable Remote JMX Access To Quartz Schedulers

Transcription

How to Enable Remote JMX Access toQuartz SchedulersMay 12, 2015

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oTable of Contents1.PURPOSE . 32.DEFINITIONS . 43.ENABLING REMOTE JMX ACCESS . 53.13.23.3JMX/RMI . 63.1.1 Apache Tomcat . 63.1.2 IBM WebSphere AS . 73.1.3 Oracle GlassFish AS . 83.1.4 Oracle WebLogic 11g (10.23.x) and 12c (12.1.x) . 93.1.5 Standalone Java Application . 10JMXMP . 12REMOTING-JMX (JBOSS ONLY) . 133.3.1 JBoss 6.1.0 Community . 133.3.2 JBoss 7.1.1 Community . 143.3.3 JBoss 6.1 EAP . 153.3.4 JBoss 6.2 EAP . 153.3.5 JBoss 6.3 EAP . 164.EXPORTING QUARTZ SCHEDULER MBEAN . 185.VERIFYING REMOTE JMX ACCESS . 195.1 TOMCAT, WEBSPHERE AS, GLASSFISH AS, WEBLOGIC AS, STANDALONE JAVAAPPLICATION . 195.2 JBOSS AS. 20C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m2

H o w t oQ u a r t z1.E n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oPurposeQuartzDesk relies on the Java Management Extensions (JMX) access to manage and monitorQuartz schedulers. Enabling JMX access to a Quartz scheduler involves two configuration steps:1. Enabling remote JMX access to the Platform MBean Server of the JVM the Quartzscheduler is running on (Platform MBean Server is a standard component of all modernJVMs).2. Exporting the Quartz scheduler management interface (MBean) to the JVM’s PlatformMBean Server.This document describes these configuration steps for all currently supported application servers.For the list of all currently supported application servers, please refer ed-platforms.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m3

H o w t oQ u a r t z2.E n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oDefinitionsThe following table lists all acronyms and shortcuts used throughout this document.Acronym / ShortcutASGASJVMWLASWASDefinitionApplication Server.GlassFish Application Server.Java Virtual Machine.WebLogic Application Server.WebSphere Application Server.The following table lists all locations and properties used throughout this document.Location / PropertyGAS CONFIGExampleserver-configJAVA HOME/usr/lib/jvm/java-1.7.0-openjdk1.7.0.9.x86 hare/tomcat7server1JBOSS INSTALL ROOTJMX HOSTJMX PORTTOMCAT HOMEWAS SERVER NAMEWL DOMAIN HOMEC o p y r i g h tDescriptionGlassFish Application Serverconfiguration.Java installation directory.JBoss installation directory.JMX IP address / hostname.JMX port number.Tomcat installation directory.WebSphere Application Servername./opt/Oracle/user projects/domain1 WebLogic domain directory.2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m4

H o w t oQ u a r t z3.E n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oEnabling Remote JMX AccessQuartzDesk Web Application supports three JMX proocols that can be used to establish a JMXconnection with the JVM Platform MBean Server through which it can manage and monitorQuartz schedulers running on that JVM.From the table below, please choose the protocol that best suits your requirements andconfiguration and refer to the chapter that describes the protocol-specific configuration details.ProtocolDescriptionJMX/RMIStandard JMX protocol.Works with all application servers but JBoss.Firewall-unfriendly protocol that uses a static and a dynamicallyallocated communication port (just like the standard Java RMIprotocol).Requires multiple JVM system properties to enable.Supports security (SSL password authentication).JMXMPStandard JMX protocol.Works with all application servers.Firewall-friendly protocol that uses a single communication port.No JVM system properties to enable. Enabled in the QuartzDesk JVMAgent configuration.Requires the QuartzDesk JVM Agent (only available for QuartzDeskStandard or Enterprise editions).Security is not currently supported for this protocol by QuartzDesk.Available only in QuartzDesk 1.5.0 and newer.REMOTING-JMXJBoss proprietary protocol.Works only on JBoss application servers.Configuration is very similar to the JMX/RMI protocol configuration.Must be used for Quartz schedulers running on JBoss.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m5

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oSupports security (SSL password authentication).3.1JMX/RMITo enable remote JMX/RMI access to the JVM Platform MBean Server, the JVM must be typicallystarted with the following system properties:System o.comDescriptionIP address, or hostname of theserver the JVM is running on. Thishostname is passed to the JMXclient (QuartzDesk) that will use itto communicate with the JVM.Please make sure the hostname isresolvable and reachable from thehost the QuartzDesk WebApplication is running on.The IP/hostname is referred to asJMX HOST in this document.Class name of thejavax.management.MBeanServerBuilder subclass that is used tocreate the JMX server .sun.management.jmxremote.authenticatefalseIf empty, then the standard JMXserver is created.Enables the JMX remote agent.Must be set to ‘true’.Port number used by the JMXclient (QuartzDesk) to establish aconnection with the JVM.The port number is referred to asJMX PORT in this document.Flag indicating whether the JMXcommunication should be securedwith SSL.Flag indicating whether the clientmust authenticate to establish aJMX connection.The following chapters describe the configuration steps to add these JVM properties in allsupported application servers.3.1.1 Apache TomcatAdd the following JVM system properties to the Tomcat startup script.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m6

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r s3.1.1.1J M XA c c e s st oWindowsEdit TOMCAT HOME/bin/catalina.bat and add the following lines below the first line:setsetsetsetsetsetCATALINA OPTS %CATALINA OPTS%CATALINA OPTS %CATALINA OPTS%CATALINA OPTS %CATALINA OPTS%CATALINA OPTS %CATALINA OPTS%CATALINA OPTS %CATALINA OPTS%CATALINA OPTS %CATALINA OPTS%-Djava.rmi.server.hostname JMX HOST-Djavax.management.builder.initial -Dcom.sun.management.jmxremote true-Dcom.sun.management.jmxremote.port JMX PORT-Dcom.sun.management.jmxremote.ssl false-Dcom.sun.management.jmxremote.authenticate falseRestart Tomcat for the changes to take effect.3.1.1.2Unix / LinuxEdit TOMCAT HOME/bin/catalina.sh and add the following lines below the first line:CATALINA OPTS " {CATALINA OPTS}CATALINA OPTS " {CATALINA OPTS}CATALINA OPTS " {CATALINA OPTS}CATALINA OPTS " {CATALINA OPTS}CATALINA OPTS " {CATALINA OPTS}CATALINA OPTS " {CATALINA OPTS}-Djava.rmi.server.hostname JMX HOST"-Djavax.management.builder.initial "-Dcom.sun.management.jmxremote true"-Dcom.sun.management.jmxremote.port JMX PORT"-Dcom.sun.management.jmxremote.ssl false"-Dcom.sun.management.jmxremote.authenticate false"Restart Tomcat for the changes to take effect.3.1.2 IBM WebSphere ASIn the WebSphere Administrative Console open Servers Server Types WebSphere applicationservers WAS SERVER NAME Java and Process Management Process definition JavaVirtual Machine.Add the following JVM property to the “Generic JVM arguments” .-Djavax.management.builder.initial In the WebSphere Administrative Console, open Servers Server Types WebSphereapplication servers WAS SERVER NAME Java and Process Management Processdefinition Java Virtual Machine Custom properties.Add the following properties:C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m7

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oName: java.rmi.server.hostnameValue: JMX HOSTName: javax.management.builder.initialValue: noneName: com.sun.management.jmxremoteValue: trueName: com.sun.management.jmxremote.portValue: JMX PORTName: com.sun.management.jmxremote.sslValue: falseName: com.sun.management.jmxremote.authenticateValue: falseApply and Save changes.Restart WAS for the changes to take effect.3.1.3 Oracle GlassFish ASIn the GlassFish Console, open GAS CONFIG JVM Settings JVM Options.Add the following JVM options:Value: -Djava.rmi.server.hostname JMX HOSTValue: -Dcom.sun.management.jmxremote trueC o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m8

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oValue: -Dcom.sun.management.jmxremote.port JMX PORTValue: -Dcom.sun.management.jmxremote.ssl falseValue: -Dcom.sun.management.jmxremote.authenticate falseDo not change the value of the -Djavax.management.builder.initial JVMoption.Restart GAS for the changes to take effect.3.1.4 Oracle WebLogic 11g (10.23.x) and 12c (12.1.x)Add the following JVM system properties to the WebLogic domain environment initializationscript.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m9

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r s3.1.4.1J M XA c c e s st oWindowsEdit WL DOMAIN HOME/bin/setDomainEnv.cmd and add the following lines at the end ofthe file:set JAVA OPTIONS %JAVA OPTIONS% -Djava.rmi.server.hostname JMX HOSTset JAVA OPTIONS %JAVA OPTIONS% Djavax.management.builder.initial Builderset JAVA OPTIONS %JAVA OPTIONS% -Dcom.sun.management.jmxremote trueset JAVA OPTIONS %JAVA OPTIONS% -Dcom.sun.management.jmxremote.port JMX PORTset JAVA OPTIONS %JAVA OPTIONS% -Dcom.sun.management.jmxremote.ssl falseset JAVA OPTIONS %JAVA OPTIONS% -Dcom.sun.management.jmxremote.authenticate falseRestart the WLAS for the changes to take effect.3.1.4.2Unix / LinuxEdit WL DOMAIN HOME/bin/setDomainEnv.cmd and add the following lines at the end ofthe file:JAVA OPTIONS " {JAVA OPTIONS} -Djava.rmi.server.hostname JMX HOST"JAVA OPTIONS " {JAVA OPTIONS} Djavax.management.builder.initial Builder"JAVA OPTIONS " {JAVA OPTIONS} -Dcom.sun.management.jmxremote true"JAVA OPTIONS " {JAVA OPTIONS} -Dcom.sun.management.jmxremote.port JMX PORT"JAVA OPTIONS " {JAVA OPTIONS} -Dcom.sun.management.jmxremote.ssl false"JAVA OPTIONS " {JAVA OPTIONS} -Dcom.sun.management.jmxremote.authenticate false"export JAVA OPTIONSRestart the WLAS for the changes to take effect.3.1.5 Standalone Java ApplicationEdit the standalone Java application’s startup script and add the following JVM system propertiesto the list of command line options passed to the JVM the application is started with:-Djava.rmi.server.hostname JMX HOST-Djavax.management.builder.initial -Dcom.sun.management.jmxremote true-Dcom.sun.management.jmxremote.port JMX PORT-Dcom.sun.management.jmxremote.ssl false-Dcom.sun.management.jmxremote.authenticate false3.1.5.1Eclipse IDEIf you start the standalone Java application from Eclipse IDE, please go to:Run Run Configurations Java Application [Your Application Name] ArgumentsAdd the above JVM system properties to the VM Arguments text area highlighted in the followingfigure.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m1 0

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r s3.1.5.2J M XA c c e s st oIntelliJ IDEIf you start the standalone Java application from IntelliJ IDE, please go to:Run Edit Configurations Application [Your Application Name] ConfigurationAdd the above JVM system properties to the VM Options text field highlighted in the followingfigure.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m1 1

H o w t oQ u a r t z3.2E n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st oJMXMPTo enable access to the Java Platform MBean Server through the JMXMP protocol, the JVM mustbe started with the QuartzDesk JVM Agent. In the QuartzDesk JVM Agent configuration (typicallyAGENT WORK DIR/quartzdesk-agent.properties), it is necessary to adjust values ofthe following configuration properties:Configuration mp.bindAddressDefault Valuefalsen/aDescriptionFlag indicating if the JMXMP connectoris enabled.The hostname/IP the JMXMP connectorbinds to.If not set, the JMXMP connector bindsto all hostnames/IPs.jmxConnector.jmxmp.port11099The port number the JMXMP connectorlistens on for inbound ag indicating if the JMXMP connectoris secured with SASL. Please refer toTODO for details on how to configureJMXMP security.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m1 2

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s mxmp.sasl.passwordn/a3.3t oUsername used by SASL. It must bespecified in SASL is enabled.Password used by SASL. It must bespecified in SASL is enabled.REMOTING-JMX (JBoss Only)This chapter describes changes to the JBoss startup scripts and assumes that JBoss is run instandalone mode. If you are running JBoss in domain mode, the required changes are similar, butyou need to apply them to a different JBoss startup script (e.g. domain.conf.bat / domain.confetc.).3.3.1 JBoss 6.1.0 CommunityWindowsOpen the JBOSS INSTALL ROOT\bin\run.conf.bat file in a text editor and addthe following lines at the end of the file.remsetsetsetsetsetEnable remote JMX access"JAVA OPTS %JAVA OPTS% -Djava.rmi.server.hostname JMX HOST""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote true""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote.port JMX PORT""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote.authenticate false""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote.ssl false"set "JAVA OPTS %JAVA OPTS% -Djboss.platform.mbeanserver"set "JAVA OPTS %JAVA OPTS% Djavax.management.builder.initial "set "JAVA OPTS %JAVA OPTS% Djava.util.logging.manager org.jboss.logmanager.LogManager"set "JAVA OPTS %JAVA OPTS% Dorg.jboss.logging.Logger.pluginClass org.jboss.logging.logmanager.LoggerPluginImpl"set "JBOSS CLASSPATH ./lib/jboss-logmanager.jar"Unix/LinuxOpen the JBOSS INSTALL ROOT/bin/run.conf file in a text editor and add thefollowing lines at the end of the file.# Enable remote JMX accessJAVA OPTS " {JAVA OPTS} -Djava.rmi.server.hostname JMX HOST"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote true"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote.port JMX PORT"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote.authenticate false"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote.ssl false"JAVA OPTS " {JAVA OPTS} -Djboss.platform.mbeanserver"JAVA OPTS " {JAVA OPTS} Djavax.management.builder.initial "JAVA OPTS " {JAVA OPTS} Djava.util.logging.manager org.jboss.logmanager.LogManager"JAVA OPTS " {JAVA OPTS} Dorg.jboss.logging.Logger.pluginClass org.jboss.logging.logmanager.LoggerPluginImpl"C seto p y "JBOSS CLASSPATH ./lib/jboss-logmanager.jar"r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m1 3

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st o3.3.2 JBoss 7.1.1 CommunityWindowsOpen the JBOSS INSTALL ROOT\bin\standalone.conf.bat file in a text editorand add the following lines at the end of the file.remsetsetsetsetsetEnable remote JMX access"JAVA OPTS %JAVA OPTS% -Djava.rmi.server.hostname JMX HOST""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote true""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote.port JMX PORT""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote.authenticate false""JAVA OPTS %JAVA OPTS% -Dcom.sun.management.jmxremote.ssl false"rem Required to fix "JBAS014670: Failed initializing moduleorg.jboss.as.logging" JBoss startup errorset "JBOSS HOME JBOSS INSTALL ROOT"set "JAVA OPTS %JAVA OPTS% Djava.util.logging.manager org.jboss.logmanager.LogManager"set "JAVA OPTS %JAVA OPTS% Xbootclasspath/p:%JBOSS nager-1.2.2.GA.jar"set "JAVA OPTS %JAVA OPTS% Xbootclasspath/p:%JBOSS slogmanager-log4j-1.0.0.GA.jar"set "JAVA OPTS %JAVA OPTS% Xbootclasspath/p:%JBOSS ar"In the JBOSS INSTALL ROOT\bin\standalone.conf.bat file locate a line thatsets the jboss.modules.system.pkgs JVM system property and add theorg.jboss.logmanager package to the specified list of comma-separated packages.Unix/LinuxOpen the JBOSS INSTALL ROOT/bin/standalone.conf file in a text editor andadd the following lines at the end of the file.# Enable remote JMX accessJAVA OPTS " {JAVA OPTS} -Djava.rmi.server.hostname JMX HOST"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote true"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote.port JMX PORT"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote.authenticate false"JAVA OPTS " {JAVA OPTS} -Dcom.sun.management.jmxremote.ssl false"# Required to fix "JBAS014670: Failed initializing moduleorg.jboss.as.logging" JBoss startup errorJBOSS HOME "JBOSS INSTALL ROOT"JAVA OPTS " {JAVA OPTS} Djava.util.logging.manager org.jboss.logmanager.LogManager"JAVA OPTS " {JAVA OPTS} Xbootclasspath/p: {JBOSS nager-1.2.2.GA.jar"JAVA OPTS " {JAVA OPTS} Xbootclasspath/p: {JBOSS slogmanager-log4j-1.0.0.GA.jar"JAVA OPTS " {JAVA OPTS} Xbootclasspath/p: {JBOSS ar"In the JBOSS INSTALL ROOT/bin/standalone.conf file locate a line that setsthe jboss.modules.system.pkgs JVM system property and add theorg.jboss.logmanager package to the specified list of comma-separated packages.C o p y r i g h t2 0 1 3 - 2 0 1 5Q u a r t z D e s k . c o m1 4

H o w t oQ u a r t zE n a b l e R e m o t eS c h e d u l e r sJ M XA c c e s st o3.3.3 JBoss 6.1 EAPWindowsOpen the JBOSS INSTALL ROOT\bin\standalone.conf.bat file in a text editorand add the following lines at the end of the file.remsetsetsetsetsetEnable remote JMX access"JAVA OPTS %JAVA O

create the JMX server instance. If empty, then the standard JMX server is created. com.sun.management.jmxremote true Enables the JMX remote agent. Must be set to ‘true’. com.sun.management.jmxremote.port 1099 Port number used by the JMX client (QuartzDesk) to establish a c