use of com.vmware.ops.api.model.symptomdefinition.SymptomDefinitionQuery in project flowgate by vmware.
the class AlertClient method createEnvrionmentSymptom.
protected SymptomDefinition createEnvrionmentSymptom(String name, int waitCycles, int cancleCycles, Criticality serverity, String conditionKey, CompareOperator conditionOperator, String value) {
SymptomDefinitionsClient sd = getClient().symptomDefinitionsClient();
SymptomDefinition aSymptomDefinition = new SymptomDefinition();
aSymptomDefinition.setName(name);
aSymptomDefinition.setAdapterKindKey(VROConsts.ADPTERKIND_VMARE_KEY);
aSymptomDefinition.setResourceKindKey(VROConsts.RESOURCEKIND_HOSTSYSTEM_KEY);
aSymptomDefinition.setWaitCycles(waitCycles);
aSymptomDefinition.setCancelCycles(cancleCycles);
SymptomState symptomState = new SymptomState();
symptomState.setSeverity(serverity);
HTCondition condition = new HTCondition();
condition.setKey(conditionKey);
condition.setOperator(conditionOperator);
// must set threshold type to STATKEY and set the TargetKey
condition.setThresholdType(ThresholdType.STATIC);
// condition.setTargetKey("cpu|availablemhz");
condition.setValue(value);
// condition.setValueType(Condition.ValueTypeEnum.NUMERIC); // necessary only when value is a string
condition.setInstanced(false);
symptomState.setCondition(condition);
aSymptomDefinition.setState(symptomState);
aSymptomDefinition = sd.createSymptomDefinition(aSymptomDefinition);
SymptomDefinitionQuery sdq = new SymptomDefinitionQuery();
sdq.setAdapterKind(VROConsts.ADPTERKIND_VMARE_KEY);
sdq.setResourceKind(VROConsts.RESOURCEKIND_HOSTSYSTEM_KEY);
sdq.setId(new String[] { aSymptomDefinition.getId() });
SymptomDefinitions allSymptoms = sd.querySymptomDefinitions(sdq, null);
return allSymptoms.getSymptomDefinitions().get(0);
}
use of com.vmware.ops.api.model.symptomdefinition.SymptomDefinitionQuery in project flowgate by vmware.
the class AlertClient method getPredefinedSymptoms.
protected Map<String, SymptomDefinition> getPredefinedSymptoms() {
SymptomDefinitionsClient sdc = getClient().symptomDefinitionsClient();
SymptomDefinitionQuery sdq = new SymptomDefinitionQuery();
sdq.setAdapterKind(VROConsts.ADPTERKIND_VMARE_KEY);
sdq.setResourceKind(VROConsts.RESOURCEKIND_HOSTSYSTEM_KEY);
Map<String, SymptomDefinition> result = new HashMap<String, SymptomDefinition>();
for (SymptomDefinition sd : sdc.querySymptomDefinitions(sdq, null).getSymptomDefinitions()) {
if (predefinedSymptomNames.contains(sd.getName())) {
result.put(sd.getName(), sd);
}
}
return result;
}
use of com.vmware.ops.api.model.symptomdefinition.SymptomDefinitionQuery in project flowgate by vmware.
the class AlertClient method getSysmptomDefinitions.
protected SymptomDefinitions getSysmptomDefinitions(String[] ids) {
SymptomDefinitionsClient sd = getClient().symptomDefinitionsClient();
SymptomDefinitionQuery sdq = new SymptomDefinitionQuery();
sdq.setId(ids);
return sd.querySymptomDefinitions(sdq, null);
}
Aggregations