ESX Agent Manager can detect issues in the ESX agents that solutions deploy. Solutions can try to resolve issues when the status of an ESX agency or an ESX agent is set to red.
You obtain the issues that affect an ESX agency or agent by using the EventManager to listen for issues.
A solution can try to resolve issues by calling the EamObject.resolve(Issue[]) method on an individual ESX agent, in which case ESX Agent Manager tries to resolve the issues. The solution can also call EamObject.resolveAll() on an ESX agency, in which case ESX Agent Manager attempts to resolve all the issues on all the ESX agents that the ESX agency deploys.
Procedure
- Obtain the unique identifiers of issues by calling the Issue.getKey() method.
Your solution can define a method that calls the
Issue.getKey() method in the
MyAgentHandler.java class.
public String getIssueId(Issue issue) {
return Integer.toString(issue.getKey());
}
- Call the Agent.getRuntime() method to obtain an EamObjectRuntimeInfo object for a running ESX agent.
Your solution can implement
Agency.getRuntime() in a method that checks for a running ESX agency and obtains the runtime information for that ESX agency.
public Issue getIssue(String issueId) throws RuntimeFaultFaultMsg {
waitForSetup();
EamObjectRuntimeInfo runtime = getRuntime();
assert runtime != null;
[...]
}
- Call the EamObject.queryIssue() method to obtain the list of issues affecting an ESX agency from the runtime of that ESX agency.
Your solution can add any issues that it discovers for the ESX agency to a
List object, and returns the issues with their issue identifiers.
public Issue getIssue(String issueId) throws RuntimeFaultFaultMsg {
waitForSetup();
EamObjectRuntimeInfo runtime = getRuntime();
assert runtime != null;
List<Issue> issues = _myeamConnection.getStub().queryIssue(_myagency, null);
if (issues == null) {
return null;
}
for (Issue issue : issues) {
if (getIssueId(issue).equals(issueId)) {
return issue;
}
}
return null;
}
- Call the EamObject.resolveAll() method to resolve all issues with ESX agents running in an ESX agency.
Your solution can call the
resolveAll() method on the
Agency object that the
MyAgentHandler.java class creates.
public void resolveAll() throws RuntimeFaultFaultMsg {
waitForSetup();
_myeamConnection.getStub().resolveAll(_myagency);
}
- Call the EamObject.resolve() method to resolve a specific issue with an ESX agent.
Your solution can call the
resolve() method on the issue identifier that the
getIssue() method returns, and generates a list of unknown issues that the solution cannot resolve.
public void resolve(String issueId) throws NumberFormatException,
RuntimeFaultFaultMsg {
waitForSetup();
List<Integer> unknownIssueIds = _myeamConnection.getStub()
.resolve(_myagency,
Collections.singletonList(Integer.parseInt(issueId)));
if (unknownIssueIds != null) {
_log.error("Failed to resolve issue:" + issueId);
}
}
Results
You called the methods from the ESX Agent Manager API to obtain issues and attempt to resolve them.