本文整理汇总了Java中monasca.common.model.alarm.AlarmTransitionSubAlarm类的典型用法代码示例。如果您正苦于以下问题:Java AlarmTransitionSubAlarm类的具体用法?Java AlarmTransitionSubAlarm怎么用?Java AlarmTransitionSubAlarm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AlarmTransitionSubAlarm类属于monasca.common.model.alarm包,在下文中一共展示了AlarmTransitionSubAlarm类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildStateChangeReason
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public String buildStateChangeReason(AlarmState alarmState) {
StringBuilder stringBuilder = new StringBuilder();
for(AlarmTransitionSubAlarm alarmTransitionSubAlarm : transitionSubAlarms){
if (alarmTransitionSubAlarm.subAlarmState.equals(alarmState)) {
if (stringBuilder.length() != 0) {
stringBuilder.append(", ");
}
stringBuilder.append(alarmTransitionSubAlarm.subAlarmExpression);
if (!AlarmState.UNDETERMINED.equals(alarmState))
stringBuilder.append(" with the values: ").append(alarmTransitionSubAlarm.currentValues);
}
}
if (AlarmState.UNDETERMINED.equals(alarmState)) {
return String.format("No data was present for the sub-alarms: %s", stringBuilder.toString());
} else if (AlarmState.ALARM.equals(alarmState)) {
return String.format("Thresholds were exceeded for the sub-alarms: %s", stringBuilder.toString());
} else {
return String.format("The alarm threshold(s) have not been exceeded for the sub-alarms: %s", stringBuilder.toString());
}
}
示例2: shouldBuiltStateChangeReason
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public void shouldBuiltStateChangeReason() {
AlarmExpression expr =
new AlarmExpression(
"avg(hpcs.compute{instance_id=5,metric_name=cpu,device=1}, 1) > 5 times 3 OR avg(hpcs.compute{flavor_id=3,metric_name=mem}, 2) < 4 times 3");
Alarm alarm = new Alarm();
List<AlarmTransitionSubAlarm> transitionSubAlarms = new ArrayList<>();
transitionSubAlarms.add(new AlarmTransitionSubAlarm(expr.getSubExpressions().get(0), AlarmState.UNDETERMINED, new ArrayList<Double>()));
transitionSubAlarms.add(new AlarmTransitionSubAlarm(expr.getSubExpressions().get(1), AlarmState.ALARM, new ArrayList<Double>()));
alarm.setTransitionSubAlarms(transitionSubAlarms);
assertEquals(
alarm.buildStateChangeReason(AlarmState.UNDETERMINED),
"No data was present for the sub-alarms: avg(hpcs.compute{device=1, instance_id=5, metric_name=cpu}, 1) > 5.0 times 3");
assertEquals(
alarm.buildStateChangeReason(AlarmState.ALARM),
"Thresholds were exceeded for the sub-alarms: avg(hpcs.compute{flavor_id=3, metric_name=mem}, 2) < 4.0 times 3 with the values: []");
}
示例3: AlarmStateHistory
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public AlarmStateHistory(
String alarmId,
List<MetricDefinition> metrics,
AlarmState oldState,
AlarmState newState,
List<AlarmTransitionSubAlarm> subAlarms,
String reason,
String reasonData,
DateTime timestamp) {
this.alarmId = alarmId;
this.setMetrics(metrics);
this.oldState = oldState;
this.newState = newState;
this.subAlarms = subAlarms;
this.reason = reason;
this.reasonData = reasonData;
this.timestamp = Conversions.variantToDateTime(timestamp);
this.id = timestamp.toString();
}
示例4: AlarmStateTransitionedEvent
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public AlarmStateTransitionedEvent(String tenantId, String alarmId, String alarmDefinitionId,
List<MetricDefinition> metrics, String alarmName, String alarmDescription,
AlarmState oldState, AlarmState newState, String severity, String link, String lifecycleState,
boolean actionsEnabled, String stateChangeReason, List<AlarmTransitionSubAlarm> subAlarms,
long timestamp) {
this.tenantId = tenantId;
this.alarmId = alarmId;
this.alarmDefinitionId = alarmDefinitionId;
this.metrics = metrics;
this.alarmName = alarmName;
this.alarmDescription = alarmDescription;
this.oldState = oldState;
this.newState = newState;
this.severity = severity;
this.link = link;
this.lifecycleState = lifecycleState;
this.actionsEnabled = actionsEnabled;
this.stateChangeReason = stateChangeReason;
this.subAlarms = subAlarms;
this.timestamp = timestamp;
}
示例5: getTransitionSubAlarms
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public List<AlarmTransitionSubAlarm> getTransitionSubAlarms() {
return transitionSubAlarms;
}
示例6: setTransitionSubAlarms
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public void setTransitionSubAlarms(List<AlarmTransitionSubAlarm> transitionSubAlarms) {
this.transitionSubAlarms = transitionSubAlarms;
}
示例7: getSubAlarms
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public List<AlarmTransitionSubAlarm> getSubAlarms() {
return subAlarms;
}
示例8: setSubAlarms
import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public void setSubAlarms(List<AlarmTransitionSubAlarm> subAlarms) {
this.subAlarms = subAlarms;
}