当前位置: 首页>>代码示例>>Java>>正文


Java AlarmTransitionSubAlarm类代码示例

本文整理汇总了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());
  }
}
 
开发者ID:openstack,项目名称:monasca-thresh,代码行数:21,代码来源:Alarm.java

示例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: []");
}
 
开发者ID:openstack,项目名称:monasca-thresh,代码行数:20,代码来源:AlarmTest.java

示例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();
}
 
开发者ID:openstack,项目名称:monasca-api,代码行数:20,代码来源:AlarmStateHistory.java

示例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;
}
 
开发者ID:openstack,项目名称:monasca-common,代码行数:22,代码来源:AlarmStateTransitionedEvent.java

示例5: getTransitionSubAlarms

import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public List<AlarmTransitionSubAlarm> getTransitionSubAlarms() {
  return transitionSubAlarms;
}
 
开发者ID:openstack,项目名称:monasca-thresh,代码行数:4,代码来源:Alarm.java

示例6: setTransitionSubAlarms

import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public void setTransitionSubAlarms(List<AlarmTransitionSubAlarm> transitionSubAlarms) {
  this.transitionSubAlarms = transitionSubAlarms;
}
 
开发者ID:openstack,项目名称:monasca-thresh,代码行数:4,代码来源:Alarm.java

示例7: getSubAlarms

import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public List<AlarmTransitionSubAlarm> getSubAlarms() {
  return subAlarms;
}
 
开发者ID:openstack,项目名称:monasca-api,代码行数:4,代码来源:AlarmStateHistory.java

示例8: setSubAlarms

import monasca.common.model.alarm.AlarmTransitionSubAlarm; //导入依赖的package包/类
public void setSubAlarms(List<AlarmTransitionSubAlarm> subAlarms) {
  this.subAlarms = subAlarms;
}
 
开发者ID:openstack,项目名称:monasca-api,代码行数:4,代码来源:AlarmStateHistory.java


注:本文中的monasca.common.model.alarm.AlarmTransitionSubAlarm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。