public InetAddress getInetAddress() { return m_config.getAddress(); }
public InetAddress getAddress() { return m_config.getAddress(); }
public InetAddress getInetAddress() { return m_config.getAddress(); }
public InetAddress getAddress() { return m_config.getAddress(); }
public InetAddress getInetAddress() { return m_config.getAddress(); }
public InetAddress getAddress() { return m_config.getAddress(); }
private static TooBigReportingAggregator createTooBigTracker(SnmpAgentConfig agentConfig, CollectionTracker... trackers) { return new TooBigReportingAggregator(trackers, agentConfig.getAddress()); }
private static TooBigReportingAggregator createTooBigTracker(SnmpAgentConfig agentConfig, CollectionTracker... trackers) { return new TooBigReportingAggregator(trackers, agentConfig.getAddress()); }
@Override public SnmpWalker createWalker(final SnmpAgentConfig agentConfig, final String name, final CollectionTracker tracker) { LOG.debug("createWalker({}/{}, {}, {})", InetAddrUtils.str(agentConfig.getAddress()), agentConfig.getPort(), name, tracker.getClass().getName()); final SnmpAgentAddress aa = new SnmpAgentAddress(agentConfig.getAddress(), agentConfig.getPort()); final PropertyOidContainer oidContainer = getOidContainer(aa); return new MockSnmpWalker(aa, agentConfig.getVersion(), oidContainer, name, tracker, agentConfig.getMaxVarsPerPdu(), agentConfig.getRetries()); }
protected PropertyOidContainer getOidContainer(final SnmpAgentConfig agentConfig) { return getOidContainer(new SnmpAgentAddress(agentConfig.getAddress(), agentConfig.getPort())); }
public String toString() { StringBuffer buff = new StringBuffer("AgentConfig["); buff.append("Address: "+getAddress()); buff.append(", ProxyForAddress: "+getProxyFor()); buff.append(", Port: "+getPort()); buff.append(", Community: "+getReadCommunity()); buff.append(", Timeout: "+getTimeout()); buff.append(", Retries: "+getRetries()); buff.append(", MaxVarsPerPdu: "+getMaxVarsPerPdu()); buff.append(", MaxRepetitions: "+getMaxRepetitions()); buff.append(", Max request size: "+getMaxRequestSize()); buff.append(", Version: "+versionToString(getVersion())); if (getVersion() == VERSION3) { buff.append(", Security level: "+getSecurityLevel()); buff.append(", Security name: "+getSecurityName()); buff.append(", auth-passphrase: "+getAuthPassPhrase()); buff.append(", auth-protocol: "+getAuthProtocol()); buff.append(", priv-passprhase: "+getPrivPassPhrase()); buff.append(", priv-protocol: "+getPrivProtocol()); } buff.append("]"); return buff.toString(); }
/** * {@inheritDoc} * * Returns true if the protocol defined by this plugin is supported. If * the protocol is not supported then a false value is returned to the * caller. The qualifier map passed to the method is used by the plugin to * return additional information by key-name. These key-value pairs can be * added to service events if needed. */ @Override public boolean isServiceDetected(final InetAddress address, final SnmpAgentConfig agentConfig) { try { configureAgentPTR(agentConfig); configureAgentVersion(agentConfig); SnmpObjId virtualDiskRollUpStatusSnmpObject = SnmpObjId.get(virtualDiskRollUpStatus + '.' + m_virtualDiskNumber); SnmpValue virtualDiskRollUpStatus = SnmpUtils.get(agentConfig, virtualDiskRollUpStatusSnmpObject); if (virtualDiskRollUpStatus == null || virtualDiskRollUpStatus.isNull()) { LOG.debug("SNMP poll failed: no results, addr={} oid={}", agentConfig.getAddress(), virtualDiskRollUpStatusSnmpObject); return false; } if (virtualDiskRollUpStatus.toInt() != 3) { // 3 means Online LOG.debug("OMSAStorageMonitor.poll: Bad Disk Found. Log vol({}) degraded", m_virtualDiskNumber); return false; } } catch (Throwable t) { throw new UndeclaredThrowableException(t); } return true; }
/** * Create an SNMP V2 trap based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV2Trap(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpTrapBuilder trap = SnmpUtils.getV2TrapBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.send(config.getAddress().getHostAddress(), config.getPort(), config.getReadCommunity()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
/** * Create an SNMP V2 inform based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV2Inform(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV2TrapBuilder trap = SnmpUtils.getV2InformBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.sendInform(config.getAddress().getHostName(), config.getPort(), config.getTimeout(), config.getRetries(), config.getReadCommunity()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
final SnmpAgentConfig other = (SnmpAgentConfig) obj; return Objects.equals(getAddress(), other.getAddress()) && Objects.equals(getProxyFor(), other.getProxyFor()) && Objects.equals(getPort(), other.getPort())
/** * Create an SNMP V3 trap based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV3Trap(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV3TrapBuilder trap = SnmpUtils.getV3TrapBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.send(config.getAddress().getHostAddress(), config.getPort(), config.getSecurityLevel(), config.getSecurityName(), config.getAuthPassPhrase(), config.getAuthProtocol(), config.getPrivPassPhrase(), config.getPrivProtocol()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
/** * Create an SNMP V3 inform based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV3Inform(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV3TrapBuilder trap = SnmpUtils.getV3InformBuilder(); populateTrapBuilder(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.sendInform(config.getAddress().getHostAddress(), config.getPort(), config.getTimeout(), config.getTimeout(), config.getSecurityLevel(), config.getSecurityName(), config.getAuthPassPhrase(), config.getAuthProtocol(), config.getPrivPassPhrase(), config.getPrivProtocol()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
/** * Create an SNMP V1 trap based on the content of the specified trap configuration, and send it to the appropriate destination. * * @param trapConfig The trap configuration mapping object * @throws SnmpTrapException if any. */ private void forwardV1Trap(SnmpTrapConfig trapConfig) throws SnmpTrapException { SnmpV1TrapBuilder trap = SnmpUtils.getV1TrapBuilder(); trap.setEnterprise(SnmpObjId.get(trapConfig.getEnterpriseId())); trap.setAgentAddress(trapConfig.getHostAddress()); if (trapConfig.hasGeneric()) { trap.setGeneric(trapConfig.getGeneric()); } if (trapConfig.hasSpecific()) { trap.setSpecific(trapConfig.getSpecific()); } trap.setTimeStamp(System.currentTimeMillis() / 1000); addParameters(trap, trapConfig); try { SnmpAgentConfig config = getAgentConfig(trapConfig); trap.send(config.getAddress().getHostAddress(), config.getPort(), config.getReadCommunity()); } catch (Throwable e) { throw new SnmpTrapException("Failed to send trap "+e.getMessage(), e); } }
private void setCommonAttributes(final SnmpAgentConfig agentConfig, final Definition def, final int version) { agentConfig.setVersion(version); agentConfig.setPort(def.getPort()); agentConfig.setRetries(def.getRetry()); agentConfig.setTimeout((int)def.getTimeout()); agentConfig.setMaxRequestSize(def.getMaxRequestSize()); agentConfig.setMaxVarsPerPdu(def.getMaxVarsPerPdu()); agentConfig.setMaxRepetitions(def.getMaxRepetitions()); InetAddress proxyHost = InetAddressUtils.addr(def.getProxyHost()); if (proxyHost != null) { agentConfig.setProxyFor(agentConfig.getAddress()); agentConfig.setAddress(proxyHost); } }
@Override public int hashCode() { int hash = Objects.hash(getAddress(), getProxyFor(), getPort(), getTimeout(), getRetries(), getMaxVarsPerPdu(), getMaxRepetitions(), getMaxRequestSize(), getVersion(), getSecurityLevel(), getSecurityName(), getAuthPassPhrase(), getAuthProtocol(), getPrivPassPhrase(), getPrivProtocol(), getContextName(), getEngineId(), getContextEngineId(), getEnterpriseId(), getReadCommunity(), getWriteCommunity()); return hash; }