[SNMP4J] detect timeout ?

FLORENT Philippe Philippe.FLORENT at edenred.com
Wed Oct 26 15:05:15 CEST 2016


Hi,

I use this function to read infos on my host,

But if the host (or the snmp service) is down, how do I detect it ?

So far I check the table size must be >0 but what if table is 0 size and the host is not down ?

thanks

public ArrayList<TableRow> getTable(Mib mib)
    {
        final PDUFactory pduFactory = new DefaultPDUFactory(PDU.GETBULK);
        pduFactory.createPDU(target);
        final TableUtils utils = new TableUtils(snmp, pduFactory);
        List<TableEvent> table = utils.getTable(target, new OID[]{ new OID(mib.oid) }, null, null);
        for(TableEvent a:table)
        {
            if(a.getColumns()!=null)
            {
....
            }
        }
   }



More information about the SNMP4J mailing list