Java Code Examples for org.snmp4j.PDU#GETBULK
The following examples show how to use
org.snmp4j.PDU#GETBULK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MsgSnmp.java From mts with GNU General Public License v3.0 | 5 votes |
/** This methods HAS TO be quick to execute for performance reason */ @Override public String toShortString() throws Exception { String ret = super.toShortString(); ret += "\n"; ret += "<MESSAGE type:" + PDU.getTypeString(pdu.getType()) + ", requestId:" + pdu.getRequestID(); if(pdu.getType() != PDU.GETBULK) ret += ", errorStatus:" + pdu.getErrorStatusText() + ", errorIndex:" + pdu.getErrorIndex(); else ret += ", nonRepeaters:" + pdu.getNonRepeaters() + ", maxRepetitions:" + pdu.getMaxRepetitions(); ret += "/>"; return ret; }
Example 2
Source File: MsgSnmp.java From mts with GNU General Public License v3.0 | 5 votes |
/** * Convert the message to XML document */ @Override public String toXml() throws Exception { String xml = ""; try { xml += "type: " + PDU.getTypeString(pdu.getType()) + ", requestId: " + pdu.getRequestID(); if(pdu instanceof PDUv1 && (pdu.getType() == PDU.V1TRAP))//specific for TRAP in SNMPV1 xml += ", enterprise: " + ((PDUv1)pdu).getEnterprise() + ", agentAddress: " + ((PDUv1)pdu).getAgentAddress() + ", genericTrap: " + ((PDUv1)pdu).getGenericTrap() + ", specificTrap: " + ((PDUv1)pdu).getSpecificTrap() + ", timestamp: " + ((PDUv1)pdu).getTimestamp(); else if(pdu.getType() != PDU.GETBULK) xml += ", errorStatus: " + pdu.getErrorStatusText() + ", errorIndex: " + pdu.getErrorIndex(); else xml += ", nonRepeaters: " + pdu.getNonRepeaters() + ", maxRepetitions: " + pdu.getMaxRepetitions(); xml += "\r\n"; if(pdu.getVariableBindings().size() > 0) { xml += "VariableBinding: " + pdu.getVariableBindings().toString(); } } catch (Exception e) { GlobalLogger.instance().getApplicationLogger().warn(TextEvent.Topic.PROTOCOL, e, "An error occured while logging the SMTP message : ", xml); } return xml; }
Example 3
Source File: AbstractSnmpmanTest.java From snmpman with Apache License 2.0 | 4 votes |
public static List<TableEvent> getResponse(final OID query, int port, final String community) throws Exception { final Address targetAddress = GenericAddress.parse(String.format("127.0.0.1/%d", port)); final Snmp snmp = new Snmp(new DefaultUdpTransportMapping()); snmp.listen(); final CommunityTarget target = getCommunityTarget(community, targetAddress); // creating PDU final PDUFactory pduFactory = new DefaultPDUFactory(PDU.GETBULK); final TableUtils utils = new TableUtils(snmp, pduFactory); return utils.getTable(target, new OID[]{query}, null, null); }