コード例 #1
0
 private AlarmsEvent createEvent(
     Device device, Date triggeTime, Threshold threshold, String sourceType, String sourceKey) {
   AlarmsEvent ae = new AlarmsEvent();
   ae.setAlertCount(1);
   ae.setAlertName(threshold.getAlertName());
   ae.setAlertTime(new Date());
   ae.setAlertTypeId(threshold.getId());
   ae.setTrapTypeOid(threshold.getSourceId());
   ae.setDeviceName(device.getName());
   ae.setIpAddress(device.getIp());
   ae.setNodeId(device.getId());
   ae.setSeverity(threshold.getSeverity());
   ae.setSourceType(sourceType);
   ae.setSourceKey(sourceKey);
   return ae;
 }
コード例 #2
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);
     }
   }
 }
コード例 #3
0
 private AlarmsCurrent createAlarm(
     Device device, Date triggeTime, Threshold threshold, String sourceType, String sourceKey) {
   AlarmsCurrent ac = new AlarmsCurrent();
   ac.setAlertCount(1);
   ac.setAlertName(threshold.getAlertName());
   ac.setAlertTime(new Date());
   ac.setAlertTypeId(threshold.getId());
   ac.setTrapTypeOid(threshold.getSourceId());
   ac.setDeviceName(device.getName());
   ac.setIpAddress(device.getIp());
   ac.setNodeId(device.getId());
   ac.setSeverity(threshold.getSeverity());
   ac.setSourceType(sourceType);
   ac.setSourceKey(sourceKey);
   ac.setAcknowledge(0);
   ac.setTriggeTime(triggeTime);
   return ac;
 }