java 如何配置 JBoss 6.3.0GA 以使用 RMI JMX?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25934901/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 08:58:44  来源:igfitidea点击:

How to configure JBoss 6.3.0GA to use RMI JMX?

javajbossjmxnagios

提问by djb

As you can see, there's the new instructions:
https://docs.jboss.org/author/display/AS71/JMX+subsystem+configuration
And the old RMI instructions:
https://docs.jboss.org/author/pages/viewpage.action?pageId=21627109

如您所见,有新的说明:
https: //docs.jboss.org/author/display/AS71/JMX+subsystem+configuration
和旧的 RMI 说明:https:
//docs.jboss.org/author/pages /viewpage.action?pageId=21627109

I can get the new instructions working, but we use nagios, which only allows checking JMX via RMI, so I need to get RMI JMX working.

我可以让新指令工作,但我们使用 nagios,它只允许通过 RMI 检查 JMX,所以我需要让 RMI JMX 工作。

Does anyone have a solution for this? I can't use the old instructions because it says <jmx-connector>is no longer supported.

有没有人对此有解决方案?我不能使用旧的说明,因为它说<jmx-connector>不再受支持。

I've added the following to my JAVA_OPTS on JBoss startup:

我在 JBoss 启动时将以下内容添加到我的 JAVA_OPTS 中:

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl -Djava.rmi.server.hostname=10.20.2.50

JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false" -Djava.util.logging.manager =org.jboss.logmanager.LogManager -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.logmanager.LoggerPluginImpl -Djava.rmi.server.hostname=10.20.2.50

but i can't get jconsole to connect to service:jmx:rmi:///jndi/rmi://10.20.2.50:12345/jmxrmi

但我无法让 jconsole 连接到服务:jmx:rmi:///jndi/rmi://10.20.2.50:12345/jmxrmi

(PS. If anyone with redhat paywall access could report back on the answer here: https://access.redhat.com/solutions/263763that would be swell :P)

(PS。如果任何拥有红帽付费专区访问权限的人都可以在这里报告答案:https: //access.redhat.com/solutions/263763那就太好了:P)

回答by Federico Sierra

To connect to JMX the URL entered should be in the format

要连接到 JMX,输入的 URL 应采用以下格式

service:jmx:remoting-jmx://{host_name}:{port}

Standalone mode

单机模式

where {port} is the native management interface of the AS7 installation being monitored (default=9999).

其中 {port} 是被监控的 AS7 安装的本机管理界面(默认值 = 9999)。

Domain mode

域模式

where {port} is the JMX subsystem interface of the AS7 installation being monitored (first server=4447, port-offset=150 next server).

其中 {port} 是被监控的 AS7 安装的 JMX 子系统接口(第一个服务器 = 4447,端口偏移 = 150 下一个服务器)。

<subsystem xmlns="urn:jboss:domain:jmx:1.1">
   <show-model value="true"/>
   <remoting-connector use-management-endpoint="false"/>
</subsystem>

Both modes

两种模式

Outside localhost you have to set -Djboss.bind.address.management or inside xml (standalone.xml / host.xml).

在本地主机之外,您必须设置 -Djboss.bind.address.management 或在 xml (standalone.xml / host.xml) 内。

Once connected the capabilities provided by jconsole can be used as normal.

一旦连接,jconsole 提供的功能就可以正常使用了。

Authentication

验证

The connector is making use of JBoss Remoting to communicate with the server, for this reason the exact same authentication mechanisms as are used by the CLI will apply here.

连接器使用 JBoss Remoting 与服务器通信,因此,与 CLI 使用的完全相同的身份验证机制将在此处应用。

Local

当地的

For processes running local to the AS7 installation we support a local authentication mechanism which allows clients to verify their identity by sharing a token on the filesystem with the server - this mechanism runs silently without any further user interaction required.

对于在 AS7 安装本地运行的进程,我们支持本地身份验证机制,该机制允许客户端通过与服务器共享文件系统上的令牌来验证其身份 - 该机制静默运行,无需任何进一步的用户交互。

Username / Password

用户名密码

Where local authentication is not possible such as if the client is running as a different user than the AS7 process or is running on a remote installation by default the next mechanism to be used is username / password based. Where this mechanism is used the username and password of a user in the ManagementRealm if using the default management connector (port 9999) or in the ApplicationRealm if using the remoting connector (port 4447) should be supplied in the boxes on the 'New Connection' screen before the 'Connect' button is clicked.

在无法进行本地身份验证的情况下,例如,如果客户端作为与 AS7 进程不同的用户运行或默认在远程安装上运行,则下一个要使用的机制是基于用户名/密码的。在使用此机制的情况下,如果使用默认管理连接器(端口 9999)或在 ApplicationRealm 中如果使用远程连接器(端口 4447),则在 ManagementRealm 中的用户名和密码应在“新连接”的框中提供单击“连接”按钮之前的屏幕。

The $JBOSS_HOME/bin/add-user.sh(Linux) or $JBOSS_HOME/bin/add-user.bat(Windows) scripts can be used to add these users. Make sure to choose between Management User and ManagementRealm vs Application User and ApplicationRealm depending on whether you're using the default management connector or the remoting connector (usually used with domain mode or when connecting remotely).

$JBOSS_HOME/bin/add-user.sh(Linux)或$JBOSS_HOME/bin/add-user.bat(Windows)中可以使用脚本来添加这些用户。确保根据您使用的是默认管理连接器还是远程连接器(通常用于域模式或远程连接时)在管理用户和管理领域与应用程序用户和应用程序领域之间进行选择。

Necessary libraries to connect JMX over JBoss Remoting

通过 JBoss Remoting 连接 JMX 的必要库

The JMX MBeanServer is accessible using JBoss Remoting through the management connection. Therefore, it is necessary to add the following libaries from the modules directory of the EAP6 / AS7 distribution to the classpath of the monitoring application:

可以使用 JBoss Remoting 通过管理连接访问 JMX MBeanServer。因此,需要将EAP6/AS7发行版的modules目录下的以下库添加到监控应用的classpath中:

org/jboss/remoting3/remoting-jmx
org/jboss/remoting3
org/jboss/logging
org/jboss/xnio
org/jboss/xnio/nio
org/jboss/sasl
org/jboss/marshalling
org/jboss/marshalling/river

Ref: Using jconsole to connect to JMX on AS7

参考:在 AS7 上使用 jconsole 连接到 JMX

Other resource: Connecting VisualVM with a remote JBoss AS 7 / EAP6 JVM process

其他资源:将 VisualVM 与远程 JBoss AS 7 / EAP6 JVM 进程连接

EDIT:

编辑:

JBoss EAP 5 supports JMX monitoring using RMI, where JBoss EAP 6 does not. EAP 6 uses “remoting-jmx” instead of “rmi”.

JBoss EAP 5 支持使用 RMI 的 JMX 监控,而 JBoss EAP 6 不支持。EAP 6 使用“remoting-jmx”而不是“rmi”。

You should look for another solution, as SNMP, or proper plugin for nagios

您应该寻找另一种解决方案,如 SNMP 或适用于 nagios 的适当插件

See:

看:

JVM monitoring via SNMP of JBoss EAP 6 worker nodes with pnp4nagios Template

使用 pnp4nagios 模板通过 JBoss EAP 6 工作节点的 SNMP 进行 JVM 监控

Jboss SAR MBean and Perl plug-in for Nagios compatible with Jboss 7.1.1

与 Jboss 7.1.1 兼容的 Nagios 的 Jboss SAR MBean 和 Perl 插件