[SNMP4J] SNMP4J Questions
Mathias Bogaert
pathos at pandora.be
Sun Sep 19 22:15:37 CEST 2004
Hi,
I'm evaluating SNMP4J to migrate to from IReasoning SNMP. So far it
looks really good, and I have a couple of questions:
- it would be easy if we could have a wrapped value in the Variable
classes where supported; eg.
PDU response = snmp.sendPDU(requestPDU, target);
if (response.getErrorStatus() != 0)
for (int i = 0; response != null && i < response.size(); i++) {
VariableBinding vb = response.get(i);
if (vb.getOid().equals("1.3.6.1.4.1.9.9.116.1.4.1.1.3")) {
sample.setTotalModems(((Integer32)
vb.getVariable()).getWrappedValue());
}
}
Where getWrappedValue returns an Integer object (as opposed to int).
Reason is that by default, primitive types have a 0 value, and when
storing this in the database using Hibernate, one cannot distinguish
between an actual value of 0 or null (e.g. network element was down).
new Integer((((Integer32) vb.getVariable()).getValue())) looks so
verbose :)
- what is the best practice when querying +10 000 cable modems every 15
minutes? Should I create one Snmp instance for each poller thread that
goes and polls 200 modems? Can I reuse the same requestPDU time after
time, to avoid construction? Any other performance tips?
- in PDU response = snmp.sendPDU(requestPDU, target); when will
response be null? Is there a difference between a null or IOException?
How can I detect a 'timeout'?
Thanks,
Mathias Bogaert
More information about the SNMP4J
mailing list