Example #1
0
 private String getLabel(LocalSnmpConnection active, OID labelOID) throws IOException {
   Map<OID, Object> rowLabel =
       SnmpRequester.RAW.doSnmpGet(active, Collections.singletonList(labelOID));
   for (Map.Entry<OID, Object> labelEntry : rowLabel.entrySet()) {
     String label = labelEntry.getValue().toString();
     if (label.length() >= 1) return label;
   }
   return null;
 }
Example #2
0
 private boolean doesExist(JrdsElement hostEleme, ProbeDescSummary summary) throws IOException {
   OID OidExist = new OID(summary.specifics.get("existOid"));
   Map<OID, Object> found =
       SnmpRequester.RAW.doSnmpGet(active, Collections.singletonList(OidExist));
   if (found.size() > 0) {
     addProbe(hostEleme, summary.name, null, null, null, null);
     log(Level.TRACE, "%s does exist: %s", summary.name, found.values());
     return true;
   } else {
     return false;
   }
 }
Example #3
0
 @Override
 public boolean exist(String hostname, HttpServletRequest request) {
   try {
     hosttarget = makeSnmpTarget(request);
     active = new LocalSnmpConnection();
     active.target = hosttarget;
     active.doStart();
     if (SnmpRequester.RAW.doSnmpGet(active, Collections.singleton(sysObjectID)).size() < 0) {
       log(Level.INFO, "SNMP not active on host %s", hostname);
       return false;
     }
     return true;
   } catch (UnknownHostException e) {
     log(Level.INFO, "Host name %s unknown", hostname);
     return false;
   } catch (IOException e1) {
     log(Level.INFO, "SNMP not active on host %s", hostname);
     return false;
   }
 }