Determine if a JBoss ON agent is available using the remote API or CLI

Solution Verified - Updated -


  • Red Hat JBoss Operations Network (ON) 3.1, 3.2
  • JBoss ON remote API or command-line interface (CLI) script
  • Retrieving AvailabilityType for a resource's agent -- e.g. myResource.getAgent()


  • Get agent availability
  • No getCurrentAvailability() or isAvailable() method for the Agent domain object
  • Determine if a resource's agent is running


To retrieve an agent's availability status, you must retrieve its platform resource and invoke its getCurrentAvailability() method.

// retrieve the platform resource for a given agentId
resCriteria = new ResourceCriteria();
// a platform is a singleton so we should only get 1 row back
// we can then grab its availability type directly
platformAvailType = ResourceManager.findResourcesByCriteria(resCriteria).get(0).getCurrentAvailability().getAvailabilityType();
if ( platformAvailType != AvailabilityType.UP ) { 
    println("The agent for " + myResource.getName() + " is not UP!");

Root Cause

The Agent domain object is not derived from a Resource domain object. This means that it does not expose the normal resource operations and attributes.

Each agent has a platform as the top level resource for all child server and service resources. If the platform resource is down, then the agent is either down or not responding.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.