Red Hat Training

A Red Hat training course is available for Red Hat JBoss Operations Network

13.3. Uninventory a Resource After an Alert: uninventory.js

Removing a resource from the inventory removes it from JBoss ON; the server or application itself remains intact on the local system. (This allows the resource to be re-discovered and re-imported later.)
The alert system can launch CLI scripts in response to a fired alert. One possible response is to uninventory a resource which is not performing well.
This can be a pretty simple little script. To uninventory the resource, use the resource ID which was included in the alert and the uninventoryResource method:
List<Integer> uninventoryResources(Subject subject, int[] resourceIds);
It is possible to combine the uninventory operation with another task. For example, uninventory one resource and automatically create and import another resource to take its place.
Note
This script should be uploaded to the server and then referenced as an alert notification.