Chapter 11. The Health Check API


11.1. The Health Check API

The Health Check API allows users to monitor the health of the cluster, and the caches contained within. This information is particularly important when working in a cloud environment, as it provides a method of querying to report the status of the cluster or cache.

This API exposes the following information:

  • The name of the cluster.
  • The number of machines in the cluster.
  • The overall status of the cluster or cache, represented in one of three values:

    • Healthy - The entity is healthy.
    • Unhealthy - The entity is unhealthy. This value indicates that one or more caches are in a degraded state.
    • Rebalancing - The entity is operational, but a rebalance is in progress. Cluster nodes should not be adjusted when this value is reported.
  • The status of each cache.
  • A tail of the server log.

For information on using the Health Check API through non-programmatic methods, refer to the JBoss Data Grid Administration and Configuration Guide.

11.2. Accessing the Health Check API Programmatically

The Health Check API is only accessible programatically in Library mode, and may be accessed by calling the embeddedCacheManager.getHealth() method.

This method returns an org.infinispan.health.Health object, which has access to the following methods:

  • getClusterHealth() - returns a ClusterHealth object with access to the following methods:

    • getNumberOfNodes() - returns an int representing the number of all nodes in the cluster
    • getNodeNames() - returns a List<String> containing the names of all nodes in the cluster
    • getClusterName() - returns a String containing the name of the cluster
    • getHealthStatus() - returns a HealthStatus that contains the cluster’s health, being reported as HEALHTY, UNHEALTHY, or REBALANCING
  • getHostInfo() - returns a HostInfo object with access to the following methods:

    • getNumberOfCpus() - returns an int containing the number of CPUs installed in the host
    • getTotalMemoryKb() - returns a long containing the total memory in KB
    • getFreeMemoryInKb() - returns a long containing the free memory in KB
  • getCacheHealth() - returns a List<CacheHealth>. Each CacheHealth object has access to the following methods:

    • getCacheName() - returns a String containing the name of the cache
    • getStatus() - returns a HealthStatus that contains the cache’s health, being reported as HEALHTY, UNHEALTHY, or REBALANCING
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.