本文整理了Java中org.snmp4j.PDU.addOID()
方法的一些代码示例,展示了PDU.addOID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.addOID()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:addOID
[英]Adds a new variable binding to this PDU by using the OID of the supplied VariableBinding
. The value portion is thus set to null
.
This method should be used for GET type requests. For SET, TRAP and INFORM requests, the #add method should be used instead.
[中]使用提供的[$0$]的OID将新变量绑定添加到此PDU。因此,值部分被设置为[$1$]。
此方法应用于获取类型请求。对于SET、TRAP和INFORM请求,应该使用#add方法。
代码示例来源:origin: org.snmp4j/snmp4j
/**
* Adds new {@code VariableBindings} each with the OID of the
* corresponding variable binding of the supplied array to this PDU (see
* {@link #addOID(VariableBinding vb)}).
*
* @param vbs an array of {@code VariableBinding} instances. For each instance
* in the supplied array, a new VariableBinding created by
* {@code new VariableBinding(OID)} will be appended to the current
* list of variable bindings in the PDU.
* @since 1.8
*/
public void addAllOIDs(VariableBinding[] vbs) {
variableBindings.ensureCapacity(variableBindings.size() + vbs.length);
for (VariableBinding vb : vbs) {
addOID(vb);
}
}
代码示例来源:origin: org.kaazing/snmp4j
/**
* Adds new <code>VariableBindings</code> each with the OID of the
* corresponding variable binding of the supplied array to this PDU (see
* {@link #addOID(VariableBinding vb)}).
* @param vbs
* an array of <code>VariableBinding</code> instances. For each instance
* in the supplied array, a new VariableBinding created by
* <code>new VariableBinding(OID)</code> will be appended to the current
* list of variable bindings in the PDU.
* @since 1.8
*/
public void addAllOIDs(VariableBinding[] vbs) {
variableBindings.ensureCapacity(variableBindings.size()+vbs.length);
for (int i=0; i<vbs.length; i++) {
addOID(vbs[i]);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
/**
* Adds new {@code VariableBindings} each with the OID of the
* corresponding variable binding of the supplied array to this PDU (see
* {@link #addOID(VariableBinding vb)}).
* @param vbs
* an array of {@code VariableBinding} instances. For each instance
* in the supplied array, a new VariableBinding created by
* {@code new VariableBinding(OID)} will be appended to the current
* list of variable bindings in the PDU.
* @since 1.8
*/
public void addAllOIDs(VariableBinding[] vbs) {
variableBindings.ensureCapacity(variableBindings.size() + vbs.length);
for (VariableBinding vb : vbs) {
addOID(vb);
}
}
代码示例来源:origin: fbacchella/jrds
public long readUptime(Set<OID> upTimesOids) {
try {
for(OID uptimeoid: upTimesOids) {
PDU requestPDU = DefaultPDUFactory.createPDU(snmpTarget, PDU.GET);
requestPDU.addOID(new VariableBinding(uptimeoid));
PDU response = request(requestPDU, snmpTarget);
Object value = new SnmpVars(response).get(uptimeoid);
if(value instanceof Number) {
return ((Number) value).longValue();
}
}
} catch (Exception e) {
log(Level.ERROR, e, "Unable to get uptime: %s", e);
}
return 0;
}
代码示例来源:origin: fbacchella/jrds
requestPDU.addOID(new VariableBinding(ping));
内容来源于网络,如有侵权,请联系作者删除!