@Ignore @Test public void shouldReturnMapOfStringByRawUsage() throws Exception { Map<String, RawSnmpUsage> map = client.getSnmpUsage(); assertTrue(map.entrySet().size() > 0); }
public Map<String, RawSnmpUsage> getSnmpUsage() throws StingraySnmpSetupException, StingraySnmpRetryExceededException, StingraySnmpGeneralException { vlog.printf("in call to getSnmpUsage()"); Map<String, RawSnmpUsage> rawSnmpMap = new HashMap<String, RawSnmpUsage>(); List<VariableBinding> bindings; bindings = getBulkOidBindingList(OIDConstants.VS_CURRENT_CONNECTIONS); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_CURRENT_CONNECTIONS, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setConcurrentConnections(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_IN); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_IN, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesIn(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_OUT); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_OUT, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesOut(vb.getVariable().toLong()); } return rawSnmpMap; }
StingraySnmpClient { public Map<String, RawSnmpUsage> getSnmpUsage() throws StingraySnmpSetupException, StingraySnmpRetryExceededException, StingraySnmpGeneralException { vlog.printf("in call to getSnmpUsage()"); Map<String, RawSnmpUsage> rawSnmpMap = new HashMap<String, RawSnmpUsage>(); List<VariableBinding> bindings; bindings = getBulkOidBindingList(OIDConstants.VS_CURRENT_CONNECTIONS); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_CURRENT_CONNECTIONS, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setConcurrentConnections(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_IN); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_IN, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesIn(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_OUT); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_OUT, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesOut(vb.getVariable().toLong()); } return rawSnmpMap; } }
StingraySnmpClient { public Map<String, RawSnmpUsage> getSnmpUsage() throws StingraySnmpSetupException, StingraySnmpRetryExceededException, StingraySnmpGeneralException { vlog.printf("in call to getSnmpUsage()"); Map<String, RawSnmpUsage> rawSnmpMap = new HashMap<String, RawSnmpUsage>(); List<VariableBinding> bindings; bindings = getBulkOidBindingList(OIDConstants.VS_CURRENT_CONNECTIONS); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_CURRENT_CONNECTIONS, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setConcurrentConnections(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_IN); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_IN, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesIn(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_OUT); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_OUT, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesOut(vb.getVariable().toLong()); } return rawSnmpMap; } StingraySnmpClient();  StingraySnmpClient(String address);  StingraySnmpClient(String address, String port);  StingraySnmpClient(String address, String port, String community); }
StingraySnmpClient { public Map<String, RawSnmpUsage> getSnmpUsage() throws StingraySnmpSetupException, StingraySnmpRetryExceededException, StingraySnmpGeneralException { vlog.printf("in call to getSnmpUsage()"); Map<String, RawSnmpUsage> rawSnmpMap = new HashMap<String, RawSnmpUsage>(); List<VariableBinding> bindings; bindings = getBulkOidBindingList(OIDConstants.VS_CURRENT_CONNECTIONS); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_CURRENT_CONNECTIONS, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setConcurrentConnections(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_IN); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_IN, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesIn(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_OUT); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_OUT, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesOut(vb.getVariable().toLong()); } return rawSnmpMap; } StingraySnmpClient();  StingraySnmpClient(String address);  StingraySnmpClient(String address, String port);  StingraySnmpClient(String address, String port, String community); static long getTimeout(); static void setTimeout(long aTimeout); static Random getRnd(); @Override String toString(); synchronized static int incRequestId(); Map<String, Long> getLongOidVals(String oid); Map<String, RawSnmpUsage> getSnmpUsage(); long getBytesIn(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); long getBytesOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); long getConcurrentConnections(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getMaxConnections(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getConnectTimedOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getDataTimedOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getKeepAliveTimedOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getConnectionErrors(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getConnectionFailures(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getIntegerValueForVirtualServer(String vsName, String baseOid, boolean zeroOnNotFoundException, boolean negativeOneOnNotFoundException); long getLongValueForVirtualServer(String vsName, String baseOid, boolean zeroOnNotFoundException, boolean negativeOneOnNotFoundException); org.snmp4j.smi.Variable getValueForVirtualServer(String vsName, String baseOid, boolean zeroOnNotFoundException, boolean negativeOneOnNotFoundException); List<VariableBinding> getBulkOidBindingList(String oid); static String getOidFromVirtualServerName(String baseOid, String vsName); static String getVirtualServerNameFromOid(String baseOid, String oid); @Override boolean equals(Object o); @Override int hashCode(); String getAddress(); String getPort(); String getCommunity(); void setAddress(String address); void setPort(String port); void setCommunity(String community); static void nop(); static int getRequestId(); int getMaxRetrys(); void setMaxRetrys(int maxRetrys); int getVersion(); void setVersion(int version); synchronized static void setRequestId(int aRequestId); long getReportUdpCountEveryNMilliSeconds(); void setReportUdpCountEveryNMilliSeconds(long reportUdpCountEveryNMilliSeconds); int getNonRepeaters(); void setNonRepeaters(int nonRepeaters); int getMaxRepetitions(); void setMaxRepetitions(int maxRepetitions); }
StingraySnmpClient { public Map<String, RawSnmpUsage> getSnmpUsage() throws StingraySnmpSetupException, StingraySnmpRetryExceededException, StingraySnmpGeneralException { vlog.printf("in call to getSnmpUsage()"); Map<String, RawSnmpUsage> rawSnmpMap = new HashMap<String, RawSnmpUsage>(); List<VariableBinding> bindings; bindings = getBulkOidBindingList(OIDConstants.VS_CURRENT_CONNECTIONS); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_CURRENT_CONNECTIONS, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setConcurrentConnections(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_IN); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_IN, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesIn(vb.getVariable().toLong()); } bindings = getBulkOidBindingList(OIDConstants.VS_BYTES_OUT); for (VariableBinding vb : bindings) { String vsName = getVirtualServerNameFromOid(OIDConstants.VS_BYTES_OUT, vb.getOid().toString()); if (!rawSnmpMap.containsKey(vsName)) { RawSnmpUsage entry = new RawSnmpUsage(); entry.setVsName(vsName); rawSnmpMap.put(vsName, entry); } rawSnmpMap.get(vsName).setBytesOut(vb.getVariable().toLong()); } return rawSnmpMap; } StingraySnmpClient();  StingraySnmpClient(String address);  StingraySnmpClient(String address, String port);  StingraySnmpClient(String address, String port, String community); static long getTimeout(); static void setTimeout(long aTimeout); static Random getRnd(); @Override String toString(); synchronized static int incRequestId(); Map<String, Long> getLongOidVals(String oid); Map<String, RawSnmpUsage> getSnmpUsage(); long getBytesIn(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); long getBytesOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); long getConcurrentConnections(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getMaxConnections(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getConnectTimedOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getDataTimedOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getKeepAliveTimedOut(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getConnectionErrors(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getConnectionFailures(String vsName, boolean zeroOnNotFound, boolean negativeOneOnNotFoundException); int getIntegerValueForVirtualServer(String vsName, String baseOid, boolean zeroOnNotFoundException, boolean negativeOneOnNotFoundException); long getLongValueForVirtualServer(String vsName, String baseOid, boolean zeroOnNotFoundException, boolean negativeOneOnNotFoundException); org.snmp4j.smi.Variable getValueForVirtualServer(String vsName, String baseOid, boolean zeroOnNotFoundException, boolean negativeOneOnNotFoundException); List<VariableBinding> getBulkOidBindingList(String oid); static String getOidFromVirtualServerName(String baseOid, String vsName); static String getVirtualServerNameFromOid(String baseOid, String oid); @Override boolean equals(Object o); @Override int hashCode(); String getAddress(); String getPort(); String getCommunity(); void setAddress(String address); void setPort(String port); void setCommunity(String community); static void nop(); static int getRequestId(); int getMaxRetrys(); void setMaxRetrys(int maxRetrys); int getVersion(); void setVersion(int version); synchronized static void setRequestId(int aRequestId); long getReportUdpCountEveryNMilliSeconds(); void setReportUdpCountEveryNMilliSeconds(long reportUdpCountEveryNMilliSeconds); int getNonRepeaters(); void setNonRepeaters(int nonRepeaters); int getMaxRepetitions(); void setMaxRepetitions(int maxRepetitions);  }