本文整理汇总了Java中org.opennms.protocols.snmp.SnmpVarBind类的典型用法代码示例。如果您正苦于以下问题:Java SnmpVarBind类的具体用法?Java SnmpVarBind怎么用?Java SnmpVarBind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SnmpVarBind类属于org.opennms.protocols.snmp包,在下文中一共展示了SnmpVarBind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: snmpReceivedPdu
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public void snmpReceivedPdu(SnmpSession session, int command, SnmpPduPacket pdu) {
try {
SnmpPduRequest response = (SnmpPduRequest)pdu;
log().debug("Received a tracker pdu from "+getAddress()+" of size "+pdu.getLength()+" errorStatus = "+response.getErrorStatus()+", errorIndex = "+response.getErrorIndex());
if (!processErrors(response.getErrorStatus(), response.getErrorIndex())) {
for(int i = 0; i < response.getLength(); i++) {
SnmpVarBind vb = response.getVarBindAt(i);
SnmpObjId receivedOid = SnmpObjId.get(vb.getName().getIdentifiers());
SnmpValue val = new JoeSnmpValue(vb.getValue());
processResponse(receivedOid, val);
}
}
buildAndSendNextPdu();
} catch (Throwable e) {
handleFatalError(e);
}
}
示例2: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
System.gc();
SnmpVarBind outVar = new SnmpVarBind(oid);
long freeMem = Runtime.getRuntime().freeMemory();
SnmpSyntax value = new SnmpUInt32(freeMem);
outVar.setValue(value);
return outVar;
}
示例3: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
SnmpVarBind outVar = new SnmpVarBind(oid);
long totalMem = Runtime.getRuntime().totalMemory();
SnmpSyntax value = new SnmpUInt32(totalMem);
outVar.setValue(value);
return outVar;
}
示例4: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
SnmpVarBind outVar = new SnmpVarBind(oid);
long millis = System.currentTimeMillis() - SNMPLibrary.getInstance().getStartTime();
millis = millis/10; // convert from 1000th of a second to 100th
SnmpSyntax value = new SnmpUInt32(millis);
outVar.setValue(value);
return outVar;
}
示例5: getVarBindAt
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
private SnmpVarBind getVarBindAt(int index) {
return m_pdu.getVarBindAt(index);
}
示例6: addOid
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public void addOid(SnmpObjId snmpObjId) {
SnmpVarBind varBind = new SnmpVarBind(new SnmpObjectId(snmpObjId.getIds()));
m_nextPdu.addVarBind(varBind);
}
示例7: addVarBind
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public void addVarBind(SnmpObjId name, SnmpValue value) {
SnmpSyntax val = ((JoeSnmpValue) value).getSnmpSyntax();
trap.addVarBind(new SnmpVarBind(new SnmpObjectId(name.getIds()), val));
}
示例8: addVarBind
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public void addVarBind(SnmpObjId name, SnmpValue value) {
SnmpSyntax val = ((JoeSnmpValue) value).getSnmpSyntax();
m_pdu.addVarBind(new SnmpVarBind(new SnmpObjectId(name.getIds()), val));
}
示例9: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
SnmpVarBind outVar = new SnmpVarBind(oid);
int numUsers = BrokerFactory.getUserMgmtBroker().getNumUsers();
outVar.setValue(new SnmpUInt32(numUsers));
return outVar;
}
示例10: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
SnmpVarBind outVar = new SnmpVarBind(oid);
int numNotifs = BrokerFactory.getNotificationBroker().getNumPendingNotifications();
outVar.setValue(new SnmpUInt32(numNotifs));
return outVar;
}
示例11: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind handleGet(String oid) {
SnmpVarBind outVar = new SnmpVarBind(oid);
SnmpSyntax value = new SnmpOctetString("Reliable Response Notification".getBytes());
outVar.setValue(value);
return outVar;
}
示例12: snmpReceivedGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpPduRequest snmpReceivedGet(SnmpPduPacket packet, boolean arg1) {
BrokerFactory.getLoggingBroker().logDebug("Got snmp get request = "+packet);
SnmpPduRequest request = new SnmpPduRequest(SnmpPduRequest.RESPONSE);
SnmpVarBind[] returnBinds = BrokerFactory.getSnmpBroker().handleGet(packet);
BrokerFactory.getLoggingBroker().logDebug("Got "+returnBinds.length+" return binds");
if (returnBinds.length == 0) return null;
for (int i = 0; i < returnBinds.length; i++) {
request.addVarBind(returnBinds[i]);
}
return request;
}
示例13: getVarBindAt
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
protected SnmpVarBind getVarBindAt(int index) {
return getPdu().getVarBindAt(index);
}
示例14: getVarBindAt
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
protected SnmpVarBind getVarBindAt(int index) {
return m_pdu.getVarBindAt(index);
}
示例15: handleGet
import org.opennms.protocols.snmp.SnmpVarBind; //导入依赖的package包/类
public SnmpVarBind[] handleGet (SnmpPduPacket packet);