Package nz.co.abrahams.asithappens.snmputil

Examples of nz.co.abrahams.asithappens.snmputil.PortsSelectorSNMP


    }
   
    public void setDevice(String deviceName, String community) throws UnknownHostException, SNMPException {
        if ( retrieveRWCommunity ) {
            device = new Device(deviceName, null, community, true);
            snmp = new PortsSelectorSNMP(device);
        }
        else {
            device = new Device(deviceName, community, null, false);
            snmp = new PortsSelectorSNMP(device);
        }
    }
View Full Code Here


        DeviceDAO deviceDAO;
        NetFlowMatchCriteriaDAO criteriaDAO;
        FlowOptionsDAO optionsDAO;
        String name;
        Device device;
        PortsSelectorSNMP portsSNMP;
        NetFlowSNMP netflowSNMP;
        long pollInterval;
        int ifIndex;
        String ifDescr;
        int direction;
        int tableSize;
        NetFlowMatchCriteria criteria;
        FlowOptions options;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
        deviceDAO = DAOFactory.getDeviceDAO();
        device = deviceDAO.retrieveDevice(name, true);
        deviceDAO.closeConnection();
        pollInterval = ((Long)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_POLLINTERVAL, sessionID))).longValue();
        ifDescr = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_IFDESCR, sessionID));
        direction = ((Integer)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DIRECTION, sessionID))).intValue();
        tableSize = ((Integer)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_TABLESIZE, sessionID))).intValue();
        portsSNMP = new PortsSelectorSNMP(device);
        /*
        device.enumeratePorts();
        ifIndex = -1;
        for ( int i = 0 ; i < device.getPortsIndex().length ; i++ ) {
            if ( device.getPortsDescr()[i].equals(ifDescr) ) {
                ifIndex = device.getPortsIndex()[i];
            }
        }
         */
        ifIndex = portsSNMP.getIfIndex(ifDescr);

        criteriaDAO = DAOFactory.getNetFlowMatchCriteriaDAO(connection);
        criteria = criteriaDAO.retrieve(sessionID);
        optionsDAO = DAOFactory.getFlowOptionsDAO(connection);
        options = optionsDAO.retrieve(sessionID);
View Full Code Here

     */
    public BandwidthCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        PortsSelectorSNMP portsSNMP;
        BandwidthSNMP bandwidthSNMP;
        long pollInterval;
        boolean prefer64BitCounters;
        String[] ifDescriptions;
        int[] ifIndicies;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
        deviceDAO = DAOFactory.getDeviceDAO();
        device = deviceDAO.retrieveDevice(name, false);
        deviceDAO.closeConnection();
        bandwidthSNMP = new BandwidthSNMP(device);
        pollInterval = ((Long)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_POLLINTERVAL, sessionID))).longValue();
        prefer64BitCounters = ((Byte)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_USE64BITCOUNTERS, sessionID))).intValue() == 1;
        ifDescriptions = retrieveBandwidthCollectorPorts(sessionID);
        portsSNMP = new PortsSelectorSNMP(device);
        /*
        portsSNMP.enumeratePorts();
        ifIndicies = new int[ifDescriptions.length];
        for ( int i = 0 ; i < portsSNMP.getPortsIndex().length ; i++ ) {
            for ( int j = 0 ; j < ifDescriptions.length ; j++ ) {
                if ( portsSNMP.getPortsDescr()[i].equals(ifDescriptions[j]) ) {
                    ifIndicies[j] = portsSNMP.getPortsIndex()[i];
                }
            }
        }
         */
        ifIndicies = portsSNMP.getIfIndexArray(ifDescriptions);

        bandwidthSNMP = new BandwidthSNMP(device);
        return new BandwidthCollector(bandwidthSNMP, pollInterval, ifIndicies, ifDescriptions, prefer64BitCounters);
    }
View Full Code Here

     */
    public NBARCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        PortsSelectorSNMP portsSNMP;
        NBARSNMP nbarSNMP;
        long pollInterval;
        int ifIndex;
        String ifDescr;
        int direction;
        int tableSize;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
        deviceDAO = DAOFactory.getDeviceDAO();
        device = deviceDAO.retrieveDevice(name, true);
        deviceDAO.closeConnection();
        pollInterval = ((Long)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_POLLINTERVAL, sessionID))).longValue();
        ifDescr = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_IFDESCR, sessionID));
        direction = ((Integer)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DIRECTION, sessionID))).intValue();
        tableSize = ((Integer)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_TABLESIZE, sessionID))).intValue();
        portsSNMP = new PortsSelectorSNMP(device);
        /*
        device.enumeratePorts();
        ifIndex = -1;
        for ( int i = 0 ; i < device.getPortsIndex().length ; i++ ) {
            if ( device.getPortsDescr()[i].equals(ifDescr) ) {
                ifIndex = device.getPortsIndex()[i];
            }
        }
         */
        ifIndex = portsSNMP.getIfIndex(ifDescr);
        nbarSNMP = new NBARSNMP(device);
        return new NBARCollector(nbarSNMP, pollInterval, ifIndex, ifDescr, direction, tableSize);
    }
View Full Code Here

TOP

Related Classes of nz.co.abrahams.asithappens.snmputil.PortsSelectorSNMP

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.