Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Mango as SNMP Trap Receiver


  • Re: How-to test SNMP Trap in Mango

    I have been trying to configure Mango to receive Traps using the instructions in this post from 2009. I realize that many improvements have been made to the SNMP Data Source since then and I was looking to get confirmation that this is still the correct approach.

    I confirmed Mango(java) is listening on 162 as root and I have sent test traps but see nothing in the log.


  • Hi Wingnut2.0,

    I don't believe anything has changed with regards to traps, unless it was in the SNMP4J library. I didn't look too deeply into what logging is available in SNMP4J, but it looks like if you set

    x.sct.snmp.trapResponse=true

    in your env.properties at startup then any trap PDU that makes it to the data source should produce either an event or a log message. I would have expected you already to have gotten a "Trap not handled" warning from your data source had your test message gotten through.

    The incoming trap message must either have a source address that matches the target address of the data source, and then the local address must either be blank or must match the agent address. Here's the code for that socket's multicaster:

     public synchronized void processPdu(CommandResponderEvent evt) {
                PDU command = evt.getPDU();
                if (command != null) {
                    // Get the peer address
                    String peer = evt.getPeerAddress().toString();
                    int slash = peer.indexOf('/');
                    if (slash > 0)
                        peer = peer.substring(0, slash);
    
                    String localAddress = "";
                    if (command instanceof PDUv1)
                        localAddress = ((PDUv1) command).getAgentAddress().toString();
    
                    // Look for the peer in the data source list.
                    for (SnmpDataSourceRT ds : dataSources) {
                        if (ds.getAddress().equals(peer)) {
                            if (StringUtils.isBlank(ds.getLocalAddress()) || localAddress.equals(ds.getLocalAddress()))
                                ds.receivedPDU(evt);
                        }
                    }
                }
            }
    

    So, if you're testing traps with a command line tool or something, you may need to set the host for the data source to localhost or the IP of the machine you're sending the test traps from.


  • Thank you Phil.


  • Certainly, I hope it's useful!