Alan Baugher

Useful Wildfly/JBOSS CLI Monitoring Scripts

Discussion created by Alan Baugher Employee on Mar 29, 2018
Latest reply on Jul 25, 2018 by Alan Baugher

Team,

 

There is a nice feature set within the J2EE server of Wildfly/RHEL JBOSS to assist with monitoring the health of the solution.   I would like to bring these scripts & processes back to awareness, as part of any initial heath check of a solution, that may not have a formal or robust commercial monitor tool set.

-  These tools may be used for query and updates as needed.

 

 

To access the full features of the J2EE tier at the command line, it may be necessary to create a local management accounts.

 

I will use the CA Identity Suite vApp as an example, as it is locked down with regards to select service IDs.

 

Step 1:    Create a local management account for IM, IG, IP Wildfly Server.   [NOTE:  J2EE must be running]

 

a.  sudo /opt/CA/wildfly-idm/bin/add-user.sh 

      [sudo /opt/CA/wildfly-ig/bin/add-user.sh  / sudo /opt/CA/wildfly-portal/bin/add-user.sh]
b.  Answer with:    a  [Management User]
c.  Answer with a userID & password:   l: jboss-admin  p: Password01!
d.  For vApp only, answer with the following group:  IAMAdmin    [may be null for other deployments]
e.   Answer yes to use this new configuration:   yes
f.   Answer no, to use these credential in a domain mode:   no

 

 

2.   Execute a list of any scripts via the  JBOSS_HOME/bin/jboss-cli.sh   process.    [NOTE:  J2EE must be running]

 

a.   Take a snapshot (backup) of the standalone-full-ha.xml file.

 

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=:take-snapshot
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=:take-snapshot
/opt/CA/wildfly-portal/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=:take-snapshot

 

 

 

b.   View the JVM Heap Memory Usage

 

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/core-service=platform-mbean/type=memory :read-attribute(name=heap-memory-usage)"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/core-service=platform-mbean/type=memory :read-attribute(name=heap-memory-usage)"
/opt/CA/wildfly-portal/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/core-service=platform-mbean/type=memory :read-attribute(name=heap-memory-usage)"

 

 

c.   View J2EE datasource connection pools and active use.

 

[IM 6 databases]

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/subsystem=datasources/data-source=iam_im-imobjectstoredb-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/subsystem=datasources/data-source=iam_im-imtaskpersistencedb-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/subsystem=datasources/data-source=iam_im-imarchivedb-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/subsystem=datasources/data-source=iam_im-imauditdb-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/subsystem=datasources/data-source=iam_im-imreportsnapshotdb-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command="/subsystem=datasources/data-source=iam_im-imworkflowdb-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"

 

 

[IG 4 databases]

 

/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=" /subsystem=datasources/data-source=eurekifyDS/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=" /subsystem=datasources/data-source=eurekifyTmsDS/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=" /subsystem=datasources/data-source=eurekifyReportdbDS/statistics=pool:read-resource(recursive=true, include-runtime=true)"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=" /subsystem=datasources/xa-data-source=WPDS/statistics=pool:read-resource(recursive=true, include-runtime=true)"

 

 

 

[IP 1 database]

 

/opt/CA/wildfly-portal/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --command=" /subsystem=datasources/data-source=sigma-ds/statistics=pool:read-resource(recursive=true, include-runtime=true)"

 

 

 

d.    A reload of the J2EE (without shutting down the full service)

 

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":reload"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":reload"
/opt/CA/wildfly-portal/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":reload"

e.   Shutdown and Restart of the J2EE

 

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":shutdown(restart=true)"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":shutdown(restart=true)"
/opt/CA/wildfly-portal/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":shutdown(restart=true)"

 

 

f.  Check on the J2EE server status (started/starting/other)

 

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":read-attribute(name=server-state)"
/opt/CA/wildfly-ig/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":read-attribute(name=server-state)"
/opt/CA/wildfly-portal/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01! --command=":read-attribute(name=server-state)"

 

 

Step 3:   Bonus round.     X11 GUI of jboss-cli

- Assumptions:   X11 libraries are installed (rpm/yum) or copied & access via CLASSPATH  [for vApp]

- Environmental variable:  DISPLAY & CLASSPATH 

     -   For putty + XMING  DISPLAY=<IP_Address:0.0>      [XMING uses TCP 6000;  ensure this port is open on workstation F/W]

     -   For MobaTerm     DISPLAY=<IP_Address:1.0>         [MobaTerm uses TCP 6001; ensure this port is open on workstation F/W]

 

/opt/CA/wildfly-idm/bin/jboss-cli.sh --connect --user=jboss-admin --password=Password01!  --gui

 

 

 

 

X11 Libraries required:  

yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-font-utils xorg-x11-fonts-Type1

yum install libXrender.x86_64

yum install libXtst.i686  libXtst.x86_64    [Required both x86 and x64 version due to dependencies on vApp]

 

 

OS Workstation Firewall Ports to allow:

 

Cheers,

 

Alan.

 

 

Edit:  3/30/2018   Addition notes on GUI configuration client tools

 

Use of MobaTerm for local Linux Host & remote AWS Linux Host (using a private key for authentication)

 

A view for Putty to enable X11.

 

Enable X11 forwarding

 

If using AWS then enable these three (3) additional parameters:

Set the initial login ID to AWS format:    ec2-user

 

Change translation from default UTF-8 to "Use font encoding"

 

Lastly, certificate authentication via a private key (PPK).

- AWS will provide a PEM file when setting up the Instances with a security group.

- Do NOT lose this file, or you will need to re-generate a new one.

 

To generate the PPK from the PEM file, use the Putty KeyGen Tool.  Load in the PEM file, then save the PPK file.

Use the PPK for Putty or MobaTerm tools.

Outcomes