Chapter 8. Health monitoring
Red Hat Data Grid server has special endpoints for monitoring cluster health. The API is exposed via:
-
Programmatically (using
embeddedCacheManager.getHealth()) - JMX
- CLI
- REST (using WildFly HTTP Management API)
8.1. Accessing Health API using JMX Copy linkLink copied to clipboard!
At first you need to connect to the Red Hat Data Grid Server using JMX (use JConsole or other tool for this). Next, navigate to object name jboss.datagrid-infinispan:type=CacheManager,name="clustered",component=CacheContainerHealth.
8.2. Accessing Health API using CLI Copy linkLink copied to clipboard!
You can access the Health API from the Command Line Interface (CLI), as in the following examples:
- Standalone
bin/cli.sh -c "/subsystem=datagrid-infinispan/cache-container=clustered/health=HEALTH:read-resource(include-runtime=true)"
$ bin/cli.sh -c "/subsystem=datagrid-infinispan/cache-container=clustered/health=HEALTH:read-resource(include-runtime=true)"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Domain Mode
bin/cli.sh -c "/host=master/server=${servername}/subsystem=datagrid-infinispan/cache-container=clustered/health=HEALTH:read-resource(include-runtime=true)"$ bin/cli.sh -c "/host=master/server=${servername}/subsystem=datagrid-infinispan/cache-container=clustered/health=HEALTH:read-resource(include-runtime=true)"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Where
${servername}is the name of the Red Hat Data Grid server instance.
The following is a sample result for the CLI invocation:
8.3. Accessing Health API using REST Copy linkLink copied to clipboard!
The REST interface lets you access the same set of resources as the CLI. However, the HTTP Management API requires authentication so you must first add credentials with the add-user.sh script.
After you set up credentials, access the Health API via REST as in the following examples:
- Standalone
curl --digest -L -D - "http://localhost:9990/management/subsystem/datagrid-infinispan/cache-container/clustered/health/HEALTH?operation=resource&include-runtime=true&json.pretty=1" --header "Content-Type: application/json" -u username:password
curl --digest -L -D - "http://localhost:9990/management/subsystem/datagrid-infinispan/cache-container/clustered/health/HEALTH?operation=resource&include-runtime=true&json.pretty=1" --header "Content-Type: application/json" -u username:passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Domain Mode
curl --digest -L -D - "http://localhost:9990/management/host/master/server/${servername}/subsystem/datagrid-infinispan/cache-container/clustered/health/HEALTH?operation=resource&include-runtime=true&json.pretty=1" --header "Content-Type: application/json" -u username:passwordcurl --digest -L -D - "http://localhost:9990/management/host/master/server/${servername}/subsystem/datagrid-infinispan/cache-container/clustered/health/HEALTH?operation=resource&include-runtime=true&json.pretty=1" --header "Content-Type: application/json" -u username:passwordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Where
${servername}is the name of the Red Hat Data Grid server instance.
The following is a sample result for the REST invocation:
Note that the result from the REST API is exactly the same as the one obtained by CLI.