One of the maybe most imported task after deployment, is to establish a good monitoring tool. The standardized tool for Java is JConsole.
To remotely connect to a application server, have previously been a pain, but the standardization work has finally given some fruit. The JBoss EAP 6 and AS 7 server now supports the JSR 160 - JMX Remote API for remote management and monitoring. The JSR 160 is a great leap forward, since the standard does not build upon RMI, which makes it really hard to use behind a firewall and only have access via SSH port. So now is JMXConnector used and under the hood uses JBoss its own remoting libraries. The only drawback with this is that you have to add these dependency libraries when starting jconsole. But Red Hat had already provided a ready cooked script for that.
So lets start trying this out. Start with by unzipping a fresh jboss-eap-6.0.1.zip to a new folder and start the server in standalone mode.
$ ./jboss-eap-6.0/bin/standalone.sh -Djboss.bind.address=192.168.0.3 -Djboss.bind.address.management=192.168.0.3
The next thing we need to is to create a management user, since the JMXConnector requires login. We create new users with the add-user.sh script.
$ ./jboss-eap-6.0/bin/add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : admin
Password :
Re-enter Password :
The username 'admin' is easy to guess
Are you sure you want to add user 'admin' yes/no? yes
About to add user 'admin' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'admin' to file '/home/magkar/tmp/jboss-eap-6.0/standalone/configuration/mgmt-users.properties'
Added user 'admin' to file '/home/magkar/tmp/jboss-eap-6.0/domain/configuration/mgmt-users.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="cGFzc3dvcmQ=" />
Now we are ready to start the jconsole on a remote machine, with the jconsole.sh script.
$ ./jboss-eap-6.0/bin/jconsole.sh
Before starting the jconsole, be sure that you have set the JAVA_HOME environment variable.
Now you can remotely login to service:jmx:remoting-jmx://192.168.0.3:9999, with the above credential.
No comments:
Post a Comment