Android-SNMP icon indicating copy to clipboard operation
Android-SNMP copied to clipboard

How to realize the function of the trap on mobile phone?

Open DDDDDFG opened this issue 8 years ago • 4 comments

` private class SendTrap extends AsyncTask<Void, Void, Void> { protected Void doInBackground(Void... params) { PDUv1 pdu = new PDUv1(); pdu.setType(PDU.V1TRAP); pdu.setGenericTrap(PDUv1.COLDSTART); pdu.add(new VariableBinding(new OID(new int[]{ 1,3,6,1}),new Integer32(1995)));//1, 3, 6, 1, 2, 1, 1, 2

        // Specify receiver
        Address targetAddress = new UdpAddress("192.168.0.6/161");
        CommunityTarget target = new CommunityTarget();
        target.setCommunity(new OctetString("public"));
        target.setVersion(SnmpConstants.version1);
        target.setAddress(targetAddress);
        target.setRetries(2);
        target.setTimeout(1500);


        try {
            snmp.trap(pdu, target);
            Log.i(TAG, "doInBackground: !!!!!!!!!!!!!!!!!!");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

`

This is I use the Trap right?

DDDDDFG avatar Aug 15 '16 07:08 DDDDDFG

I have already solved.SNMP trap (pdu, target) method cannot be used, although there is no error, but also send out, but cannot find send data on the server.I am the send by directly using SNMP (pdu, target) method, so you can receive.

DDDDDFG avatar Aug 17 '16 09:08 DDDDDFG

The manager doesn't implement a listener for traps, so the Android device sends the trap but it's not received. SNMP4J seems to support traps, so implementing that should be simple. Take a look at this example.

brnunes avatar Aug 17 '16 14:08 brnunes

For the first time to communicate with international friends, I am a student, English is very slag, is I use translation tools to communicate, very thank you for your busy schedule to take time to answer my question, thank you.

DDDDDFG avatar Aug 22 '16 04:08 DDDDDFG

Hello guys, How to connect mobile device to SNMP Device manager? I got "Error: Agent Timeout". Also I attached screenshot of SNMP device(Showing 'Unknown devices')Please help me WhatsApp Image 2019-07-22 at 4 06 48 PM

presita avatar Jul 22 '19 11:07 presita