org.opennms.netmgt.xml.event.Event.getAlarmData()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中org.opennms.netmgt.xml.event.Event.getAlarmData()方法的一些代码示例,展示了Event.getAlarmData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getAlarmData()方法的具体详情如下:
包路径:org.opennms.netmgt.xml.event.Event
类名称:Event
方法名:getAlarmData

Event.getAlarmData介绍

[英]Returns the value of field 'alarmData'. The field 'alarmData' has the following description: Data used to create an event.
[中]返回字段“alarmData”的值。“alarmData”字段具有以下描述:用于创建事件的数据。

代码示例

代码示例来源:origin: OpenNMS/opennms

private static Collection<String> getLockKeys(Event event) {
  if (event.getAlarmData().getClearKey() == null) {
    return Collections.singletonList(event.getAlarmData().getReductionKey());
  } else {
    return Arrays.asList(event.getAlarmData().getReductionKey(), event.getAlarmData().getClearKey());
  }
}

代码示例来源:origin: OpenNMS/opennms

@Override
public boolean match(Event event) {
  return (event.getAlarmData() != null && super.match(event));
}

代码示例来源:origin: org.opennms/opennms-alarmd

private static Collection<String> getLockKeys(Event event) {
  if (event.getAlarmData().getClearKey() == null) {
    return Collections.singletonList(event.getAlarmData().getReductionKey());
  } else {
    return Arrays.asList(event.getAlarmData().getReductionKey(), event.getAlarmData().getClearKey());
  }
}

代码示例来源:origin: OpenNMS/opennms

private boolean isResolutionEvent(Event event) {
  return Objects.equals(event.getAlarmData().getAlarmType(), Integer.valueOf(OnmsAlarm.RESOLUTION_TYPE));
}

代码示例来源:origin: org.opennms/opennms-alarmd

private boolean isResolutionEvent(Event event) {
  return Objects.equals(event.getAlarmData().getAlarmType(), Integer.valueOf(OnmsAlarm.RESOLUTION_TYPE));
}

代码示例来源:origin: OpenNMS/opennms

if (event.getAlarmData() == null || event.getAlarmData().getAlarmType() != 2) {
  return notifIDs;
  PreparedStatement statement = connection.prepareStatement("SELECT e.eventId FROM events e, alarms a WHERE e.alarmid = a.alarmid AND a.reductionkey= ?");
  dbUtils.watch(statement);
  String resolvingKey = event.getAlarmData().getClearKey() == null ? event.getAlarmData().getReductionKey() : event.getAlarmData().getClearKey();
  statement.setString(1, resolvingKey);
  ResultSet results = statement.executeQuery();

代码示例来源:origin: OpenNMS/opennms

private static boolean checkEventSanityAndDoWeProcess(final Event event) {
  if (event.getLogmsg() != null && LogDestType.DONOTPERSIST.toString().equalsIgnoreCase(event.getLogmsg().getDest())) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("checkEventSanity: uei '{}' marked as '{}'; not processing event.", event.getUei(), LogDestType.DONOTPERSIST);
    }
    return false;
  }
  if (event.getAlarmData() == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("checkEventSanity: uei '{}' has no alarm data; not processing event.", event.getUei());
    }
    return false;
  }
  if (event.getDbid() <= 0) {
    throw new IllegalArgumentException("Incoming event has an illegal dbid (" + event.getDbid() + "), aborting");
  }
  return true;
}

代码示例来源:origin: org.opennms/opennms-alarmd

private static boolean checkEventSanityAndDoWeProcess(final Event event) {
  if (event.getLogmsg() != null && LogDestType.DONOTPERSIST.toString().equalsIgnoreCase(event.getLogmsg().getDest())) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("checkEventSanity: uei '{}' marked as '{}'; not processing event.", event.getUei(), LogDestType.DONOTPERSIST);
    }
    return false;
  }
  if (event.getAlarmData() == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("checkEventSanity: uei '{}' has no alarm data; not processing event.", event.getUei());
    }
    return false;
  }
  if (event.getDbid() <= 0) {
    throw new IllegalArgumentException("Incoming event has an illegal dbid (" + event.getDbid() + "), aborting");
  }
  return true;
}

代码示例来源:origin: OpenNMS/opennms

private SnmpTrapBuilder buildAlarmTrap(Event event, boolean sync, SnmpTrapBuilder trap) {
  try {
     if (event.getAlarmData() != null ) {
       if (event.getAlarmData().getAlarmType() == 2) {
         trap = buildEventTrap(event, trap, "Cleared");
         snmpTrapHelper.addVarBinding(trap, ".1.3.6.1.4.1.5813.20.3.1.0", "OctetString", "text", event.getAlarmData().getClearKey());
       } else {
         trap = buildEventTrap(event, trap, null);
         snmpTrapHelper.addVarBinding(trap, ".1.3.6.1.4.1.5813.20.3.1.0", "OctetString", "text", event.getAlarmData().getReductionKey());     
       }
     } else {
       trap = buildEventTrap(event, trap, null);
       snmpTrapHelper.addVarBinding(trap, ".1.3.6.1.4.1.5813.20.3.1.0", "OctetString", "text", "null");            	 
     }
     if (sync)
       snmpTrapHelper.addVarBinding(trap, ".1.3.6.1.4.1.5813.20.3.2.0", "OctetString", "text", "SYNC");
     else
       snmpTrapHelper.addVarBinding(trap, ".1.3.6.1.4.1.5813.20.3.2.0", "OctetString", "text", "null");            	 
  } catch (SnmpTrapHelperException e) {
    e.printStackTrace();
  } catch (Exception e) {
    e.printStackTrace();
  }
   return trap;
}

代码示例来源:origin: OpenNMS/opennms

alarm.setAlarmType(event.getAlarmData().getAlarmType());
if (!event.getAlarmData().hasUpdateFields()) {
  for (UpdateField field : event.getAlarmData().getUpdateFieldList()) {
    String fieldName = field.getFieldName();

代码示例来源:origin: org.opennms/opennms-alarmd

alarm.setAlarmType(event.getAlarmData().getAlarmType());
if (!event.getAlarmData().hasUpdateFields()) {
  for (UpdateField field : event.getAlarmData().getUpdateFieldList()) {
    String fieldName = field.getFieldName();

代码示例来源:origin: OpenNMS/opennms

final String reductionKey = event.getAlarmData().getReductionKey();
LOG.debug("addOrReduceEventAsAlarm: looking for existing reduction key: {}", reductionKey);
String clearKey = event.getAlarmData().getClearKey();
  m_eventDao.update(persistedEvent);
  if (event.getAlarmData().isAutoClean()) {
    m_eventDao.deletePreviousEventsForAlarm(alarm.getId(), persistedEvent);

代码示例来源:origin: org.opennms/opennms-alarmd

final String reductionKey = event.getAlarmData().getReductionKey();
LOG.debug("addOrReduceEventAsAlarm: looking for existing reduction key: {}", reductionKey);
String clearKey = event.getAlarmData().getClearKey();
  m_eventDao.update(persistedEvent);
  if (event.getAlarmData().isAutoClean()) {
    m_eventDao.deletePreviousEventsForAlarm(alarm.getId(), persistedEvent);

代码示例来源:origin: OpenNMS/opennms

return;
if (event.getAlarmData() != null && event.getAlarmData().isAutoClean()) {
  LOG.debug("discarding event {}, the event has been configured with autoClean=true on its alarmData.", event.getUei());
  return;

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

if (event.getAlarmData() != null) {
  strRet = m_eventUtil.expandParms(event.getAlarmData().getReductionKey(), event);
  if (strRet != null) {
    event.getAlarmData().setReductionKey(strRet);
  strRet = m_eventUtil.expandParms(event.getAlarmData().getClearKey(), event);
  if (strRet != null) {
    event.getAlarmData().setClearKey(strRet);

代码示例来源:origin: OpenNMS/opennms

if (event.getAlarmData() != null) {
  strRet = m_eventUtil.expandParms(event.getAlarmData().getReductionKey(), event);
  if (strRet != null) {
    event.getAlarmData().setReductionKey(strRet);
  strRet = m_eventUtil.expandParms(event.getAlarmData().getClearKey(), event);
  if (strRet != null) {
    event.getAlarmData().setClearKey(strRet);

代码示例来源:origin: OpenNMS/opennms

private OnmsAlarm createNewAlarm(OnmsEvent e, Event event) {
  OnmsAlarm alarm = new OnmsAlarm();
  // Situations are denoted by the existance of related-reductionKeys
  alarm.setRelatedAlarms(getRelatedAlarms(event.getParmCollection()), event.getTime());
  alarm.setAlarmType(event.getAlarmData().getAlarmType());
  alarm.setClearKey(event.getAlarmData().getClearKey());
  alarm.setCounter(1);
  alarm.setDescription(e.getEventDescr());
  alarm.setDistPoller(e.getDistPoller());
  alarm.setFirstEventTime(e.getEventTime());
  alarm.setIfIndex(e.getIfIndex());
  alarm.setIpAddr(e.getIpAddr());
  alarm.setLastEventTime(e.getEventTime());
  alarm.setLastEvent(e);
  alarm.setLogMsg(e.getEventLogMsg());
  alarm.setMouseOverText(e.getEventMouseOverText());
  alarm.setNode(e.getNode());
  alarm.setOperInstruct(e.getEventOperInstruct());
  alarm.setReductionKey(event.getAlarmData().getReductionKey());
  alarm.setServiceType(e.getServiceType());
  alarm.setSeverity(OnmsSeverity.get(e.getEventSeverity()));
  alarm.setSuppressedUntil(e.getEventTime()); //UI requires this be set
  alarm.setSuppressedTime(e.getEventTime()); // UI requires this be set
  alarm.setUei(e.getEventUei());
  if (event.getAlarmData().getManagedObject() != null) {
    alarm.setManagedObjectType(event.getAlarmData().getManagedObject().getType());
  }
  e.setAlarm(alarm);
  return alarm;
}

代码示例来源:origin: org.opennms/opennms-alarmd

alarm.setAlarmType(event.getAlarmData().getAlarmType());
alarm.setClearKey(event.getAlarmData().getClearKey());
alarm.setCounter(1);
alarm.setDescription(e.getEventDescr());
alarm.setNode(e.getNode()); 
alarm.setOperInstruct(e.getEventOperInstruct());
alarm.setReductionKey(event.getAlarmData().getReductionKey());
alarm.setServiceType(e.getServiceType());
alarm.setSeverity(OnmsSeverity.get(e.getEventSeverity()));
if (event.getAlarmData().getManagedObject() != null) {
  alarm.setManagedObjectType(event.getAlarmData().getManagedObject().getType());

代码示例来源:origin: OpenNMS/opennms

if (e.getAlarmData() == null && econf.getAlarmData() != null) {
  AlarmData alarmData = new AlarmData();
  final org.opennms.netmgt.xml.eventconf.AlarmData econfAlarmData = econf.getAlarmData();

代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon

if (e.getAlarmData() == null && econf.getAlarmData() != null) {
  AlarmData alarmData = new AlarmData();
  final org.opennms.netmgt.xml.eventconf.AlarmData econfAlarmData = econf.getAlarmData();

相关文章