Monitoring JBOSS using CLI

CLI – Command line interface and Monitoring operations through CLI

 

The Command Line Interface (CLI) is a command line management tool for the JBOSS EAP/AS domain or a standalone server. It acts as a command line administration tool for JBOSS.

CLI allows a user to connect to the JBOSS domain controller or a standalone server and execute management operations such as start and stop servers, monitor the mbean values, Deploy and undeploy the application code and many other administrative task.

 

CLI management tool is launched by calling script which comes along with JBOSS EAP package.
Package will be having both jboss-cli script for LINUX/UNIX and WINDOWS.

cli sh

$EAP_HOME\bin\jboss-cli.sh - script to launch the management CLI for LINUX/UNIX
$EAP_HOME\bin\jboss-cli.bat - script to launch the management CLI for WINDO

 

By using connect command we will be able to connect the running Jboss standalone server or managed domain.
We need to provide the host and port in which the server is listening along with the connect command.

connectcli

 

To launch CLI and connect to the server in one step can be achieved by using –connect argument along with –controller argument for host and port specific.

  • –connect (-c) – instructs the CLI to connect to the controller on start-up
    (to avoid issuing a separate connect command later).
  • –controller – the default controller host and port to connect to when
    –connect option is specified or when the
    connect command is issued w/o the arguments. The default
    controller host is localhost and the port is 9999.

clifullcommand

Command:

$ EAP_HOME/bin/jboss-cli.sh --connect --controller=192.168.0.1:9991

 

When management CLI is launched and connected, it will be at the root level(/).
To change in to different node path can be done using cd command along with the desired path.

cdcli

Using pwd command we can see the full path of the current node.

pwdcli

ls command can be used to list the files

quit command can be used to quit the management CLI.

Below is the way to retrieve the server state

$EAP_HOME/bin/jboss-cli.sh --controller="192.67.601.21:1099" 
connect
:read-attribute(name=server-state)

 

CLI Useful Commands

General data

jboss Jvm OS Name:

/host=%2$s/server=%1$s/core-service=platform-mbean/type=operating-system:read-attribute(name=name)

jboss Jvm OS Version:

/host=%2$s/server=%1$s/core-service=platform-mbean/type=operating-system:read-attribute(name=version)

Status

:read-attribute(name=server-state)
jboss.jvm.status;/host=%2$s/server-config=%1$s:read-attribute(name=status)

Mbean – Complete Resource

/core-service=platform-mbean/type=memory:read-resource(include-runtime=true)
/core-service=platform-mbean/type=threading:read-resource(include-runtime=true)
/core-service=platform-mbean/type=memory-manager:read-resource(include-runtime=true)
/core-service=platform-mbean/type=memory-pool:read-resource(include-runtime=true)
/core-service=platform-mbean/type=garbage-collector:read-resource(include-runtime=true)
/core-service=platform-mbean/type=operating-system:read-resource(include-runtime=true)

Memory

/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)
/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)
/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)
/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)
/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)
/core-service=platform-mbean/type=memory:read-attribute(name=non-heap-memory-usage)

GC

/core-service=platform-mbean/type=garbage-collector/name=PS_MarkSweep:read-attribute(name=collection-count)
/core-service=platform-mbean/type=garbage-collector/name=PS_MarkSweep:read-attribute(name=collection-time)
/core-service=platform-mbean/type=garbage-collector/name=PS_Scavenge:read-attribute(name=collection-count)
/core-service=platform-mbean/type=garbage-collector/name=PS_Scavenge:read-attribute(name=collection-time)

Threads

/core-service=platform-mbean/type=threading:read-attribute(name=thread-count)
/core-service=platform-mbean/type=threading:read-attribute(name=daemon-thread-count)
/core-service=platform-mbean/type=threading:read-attribute(name=current-thread-cpu-time)

Datasources

Jboss DataSource Pool Active Count :

/subsystem=datasources/data-source=%1$s/statistics=pool:read-attribute(name=ActiveCount)

Jboss DataSource Pool Size:

/host=%3$s/server=%2$s/subsystem=datasources/data-source=%1$s:read-attribute(name=max-pool-size)

Jboss Datasource Max Pool Size:

/profile=%2$s/subsystem=datasources/data-source=%1$s:read-attribute(name=max-pool-size)

Jboss Datasource Min Pool Size:

/profile=%2$s/subsystem=datasources/data-source=%1$s:read-attribute(name=min-pool-size)

/subsystem=datasources/data-source=SimulatorDS/statistics=pool
/subsystem=datasources/data-source=SimulatorDS/statistics=pool

/subsystem=datasources/data-source=AQRPDataSource/statistics=pool
ATTR_NAME= “AvailableCount”

/subsystem=datasources/data-source=AQRPDataSource/statistics=pool
ATTR_NAME= “MaxUsedCount”

 

Deployments

Jboss Application Status:

/host=%2$s/server=%1$s/deployment=%3$s:read-attribute(name=status)

Jboss Application Active Session count:

deployment=%1$s/subsystem=web:read-attribute(name=active-sessions)!sum(/:host,/:server)

Hits

JVM Hits:

/host=%2$s/server=%1$s/server=GepAsPPD1_01_01/subsystem=web/connector=http:read-attribute(name=requestCount)