Exemplo n.º 1
0
 // 属性赋值
 private void copyProperties(String nodeid, String ipAddr, String brand) {
   m_baseEntity = new SnmpDeviceHistoryBaseEntity();
   m_baseEntity.setHostHistory(m_hostEntityList);
   m_baseEntity.setNodeid(nodeid);
   m_baseEntity.setIpAddr(ipAddr);
   m_baseEntity.setType(brand);
   m_baseEntity.setDomain(SnmpDeviceLocator.getDomainId(nodeid));
   m_baseEntity.setTime(new Date());
 }
Exemplo n.º 2
0
 public SnmpDeviceHistoryBaseStatus process(Results results) {
   SnmpDeviceHistoryBaseStatus baseStatus = null; // 保存状态和入库信息
   HostDeviceStatus hostDeviceStatus = new HostDeviceStatus(); // 状态信息,供前台调用
   if (results != null && results.getResultList() != null) {
     for (Result result : results.getResultList()) {
       String deviceName = result.getTrackerName();
       if ("ifTable".equals(deviceName)) {
         // 网络设备状态
         NetworkStatus networkStatus = convertNetworkStatus(result);
         hostDeviceStatus.setNetworkStatus(networkStatus);
         continue;
       }
       if ("hrStorageTable".equals(deviceName)) {
         // 内存状态
         hostDeviceStatus.setMemoryStatus(convertMemoryStatus(result));
         // 硬盘状态
         hostDeviceStatus.setHardDiskStatus(convertHardDiskStatus(result));
         continue;
       }
       if ("hrProcessorTable".equals(deviceName)) {
         // CPU状态
         hostDeviceStatus.setCpuStatus(convertCPUStatus(result));
         continue;
       }
       if ("hrSWRunTable".equals(deviceName)) {
         // 进程状态
         hostDeviceStatus.setProcessesStatus(convertProcessesStatus(result));
         continue;
       }
     }
   }
   // 入库设置
   if (!m_hostEntityList.isEmpty()) {
     baseStatus = new SnmpDeviceHistoryBaseStatus();
     copyProperties(results.getNodeid(), results.getIpAddr(), results.getBrand());
     baseStatus.setSnmpDeviceHistoryBaseEntity(m_baseEntity);
     hostDeviceStatus.setActive(true);
     hostDeviceStatus.setNodeid(results.getNodeid());
     hostDeviceStatus.setIpAddr(results.getIpAddr());
     hostDeviceStatus.setDomain(SnmpDeviceLocator.getDomainId(results.getNodeid()));
     baseStatus.setHostDeviceStatus(hostDeviceStatus);
   }
   return baseStatus;
 }