Having an application, that runs in an active/passive mode across two Application servers in a cluster. One of the applications is always shown as down because of this.
Is it possible to make the Application Instance State and Server State rules cluster aware?
The JavaEE Cartridge rules are not designed to support clusters.
JEE-7198 has been filed for rules to be cluster aware.
WORKAROUND:
You can create a second Application Instance State rule to cover the cluster. For Example OAS Application Instance State, You will also want to create a copy of the original OAS Application Instance State rule and change the scope so that the original rule is not evaluated for the cluster. Creating a second rule for the OAS Server state rule would be a good idea too.
Following is an outline for creating new rules for the cluster:
_______________________________________________________________
OAS Application Instance State
The logic here is to first check if the agent for the scoped application is running or not. If it is running, then return the appropriate application state (from the default rule). If agent is not running, then check for cluster awareness. If cluster availability is zero, it means the other half of the cluster is also down and so an alarm should be fired. But if cluster availability is 1, then do not fire an alarm.
The steps would be as follows:
1. Make a copy of the OAS Application Instance State rule.
2. Adjust the scope of the rule so that its evaluated only for a particular set of OC4J processes.
3. Change the condition so it appears as listed below, and replace home_ with a string that will match the OC4J process.
import com.quest.common.log.*;
CAT = LogCategory.getInstance("JavaEECartridge/oracle-monitoring-policy");
state = #RuntimeState#;
try {
if (scope.monitoringAgent != null) {
agentStatus = scope.monitoringAgent.agentStatus;
if (agentStatus != null && (agentStatus.equals("Disconnected") || agentStatus.equals("Shutdown"))) {
// agent is down, check for cluster availability
//This is the query to get objects with the name of the procesess
def topologyQuery = #!OC4JProcess where name like '%home_%'#;
def overallAvailability = 0;
//loop through objects that match the query and add up the availability metric // 1.0 means up 0 means down
for( object in topologyQuery.getTopologyObjects() ) {
value = server.get("DataService").retrieveLatestValue(object, "availability");
overallAvailability += value.getValue().getAvg();
}
//0 means nothing up
//1 means 1 node up
//2 means both nodes up
if (overallAvailability ==1){
return false;
}
}
else{
// do nothing, agent appears to be running
}
}
}catch (Exception ex1) {
CAT.ignoreException( "OC4JProcess.availability: unable to check for agent status in appstate rule.", ex1);
}
return (state == 'Unavailable' || state == 'PresumedStopped');
_______________________________________________________________
OAS Server State
Execute the following steps to create a new OAS Server State rule for the cluster:
1. Copy the OAS Server State rule
2. Adjust the scope of the rule so that its evaluated only for a particular cluster. For example, OC4JProcess where name like "%home_%"
3. Change the condition so it appears as listed below, and replace "home_" with a string that will match the OC4J process.
//This is the query to get objects with the name of the proceses
def topologyQuery = #!OC4JProcess where name like '%home_%'#;
def overallAvailability = 0;
//loop through objects that match the query and add up the availability metric // 1.0 means up 0 means down
for( object in topologyQuery.getTopologyObjects() ) {
value = server.get("DataService").retrieveLatestValue(object, "availability");
overallAvailability += value.getValue().getAvg();
}
//0 means nothing up
//1 means 1 node up
//2 means both nodes up
if (overallAvailability ==0){
return true;
}else {
return false;
}
_______________________________________________________________
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center