Пример #1
0
 private void build(TrapMessage msg, Threshold t) {
   if (msg == null
       || msg.getAlarmsTrap() == null
       || msg.getAlarmsTrap().getSourceIp() == null
       || t == null) return;
   Device device =
       deviceService.getByMacOrIp(
           msg.getAlarmsTrap().getSourceMac(), msg.getAlarmsTrap().getSourceIp());
   if (device != null) {
     if (Integer.valueOf(t.getSeverity()) < 4) {
       AlarmsCurrent ac =
           createAlarm(
               device,
               null,
               t,
               msg.getAlarmsTrap().getSourceType(),
               msg.getAlarmsTrap().getSourceKey());
       msg.getAlarmsCurrents().add(ac);
     } else {
       AlarmsEvent ae =
           createEvent(
               device,
               null,
               t,
               msg.getAlarmsTrap().getSourceType(),
               msg.getAlarmsTrap().getSourceKey());
       msg.getAlarmsEvents().add(ae);
     }
   }
 }
Пример #2
0
 public void build(TrapMessage msg) {
   if (msg == null || msg.getAlarmsTrap() == null || msg.getAlarmsTrap().getTrapTypeOid() == null)
     return;
   String thresholdKey = msg.getAlarmsTrap().getTrapTypeOid();
   List<Threshold> ts = thresholdService.getThreshold(thresholdKey);
   if (ts != null && ts.size() > 0) {
     for (Threshold t : ts) {
       build(msg, t);
     }
   }
 }