Exemplo n.º 1
0
  /** {@inheritDoc} */
  @Override
  public boolean isServiceDetected(InetAddress address) {
    try {

      SnmpAgentConfig agentConfig = getAgentConfigFactory().getAgentConfig(address);
      String expectedValue = null;

      configureAgentPTR(agentConfig);

      configureAgentVersion(agentConfig);

      if (getVbvalue() != null) {
        expectedValue = getVbvalue();
      }

      String retrievedValue = getValue(agentConfig, getOid());

      if (retrievedValue != null && expectedValue != null) {
        return (Pattern.compile(expectedValue).matcher(retrievedValue).matches());
      } else {
        return (retrievedValue != null);
      }

    } catch (Throwable t) {
      throw new UndeclaredThrowableException(t);
    }
  }