Package nz.co.abrahams.asithappens.storage

Examples of nz.co.abrahams.asithappens.storage.Device


    public NetFlowCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        NetFlowMatchCriteriaDAO criteriaDAO;
        FlowOptionsDAO optionsDAO;
        String name;
        Device device;
        PortsSelectorSNMP portsSNMP;
        NetFlowSNMP netflowSNMP;
        long pollInterval;
        int ifIndex;
        String ifDescr;
View Full Code Here


     * @return               the collector created from the database definition
     */
    public ResponseWindowsCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        long pollInterval;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
        deviceDAO = DAOFactory.getDeviceDAO();
        device = deviceDAO.retrieveDevice(name, false);
View Full Code Here

    public FlowTest() {
    }

    @Before
    public void setUp() throws java.lang.Exception {
        device1 = new Device(InetAddress.getByName("192.168.0.1"), new EthernetAddress("00:11:D8:0C:25:11"));
        device2 = new Device(InetAddress.getByName("10.1.2.3"), new EthernetAddress("00:11:D8:0C:25:22"));
        device3 = new Device(InetAddress.getByName("192.168.0.1"), new EthernetAddress("00:11:D8:0C:25:11"));
        device4 = new Device(InetAddress.getByName("10.1.2.3"), new EthernetAddress("00:11:D8:0C:25:22"));
        device5 = new Device(InetAddress.getByName("102.168.0.2"), new EthernetAddress("00:11:D8:0C:25:22"));
       
        flow1 = new Flow(1115641185, device1, device2, 2048, 6, 1025, 80, 100);
        flow2 = new Flow(1115641188, device3, device4, 2048, 6, 1025, 80, 200);
       
        flow3 = new Flow(1115641188, device1, device5, 2048, 6, 1025, 80, 300);
View Full Code Here

     * @return               the collector created from the database definition
     */
    public MemoryHRCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        MemoryHRSNMP snmp;
        long pollInterval;
        int snmpIndex;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
View Full Code Here

     * @return               the collector created from the database definition
     */
    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;
View Full Code Here

        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
        int storageIndex;
        String storageString;
        Device currentDevice;
        MemoryUCDSNMP memoryUCDSNMP;
        int pollInterval;
       
        pollInterval = Integer.parseInt(pollField.getText());
        //pollInterval = Integer.parseInt(pollField.getText()) * 1000;
 
View Full Code Here

        DataSets data;
        TimeSeriesContext context;
        DataGraph graphFrame;
        int processorIndex;
        String processorString;
        Device currentDevice;
        ProcessorUCDSNMP processorUCDSNMP;
        ProcessorCiscoSNMP processorCiscoSNMP;
        int pollInterval;
       
        //pollInterval = Integer.parseInt(pollField.getText()) * 1000;
        pollInterval = Integer.parseInt(pollField.getText());
        if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_HR ) {
           
            try {
                processorIndex = processorHRSNMP.getProcessorsIndex()[((JList)(processorsPane.getViewport().getView())).getSelectedIndex()];
                processorString = (String)((JList)processorsPane.getViewport().getView()).getSelectedValue();
                collector = new ProcessorHRCollector(processorHRSNMP, pollInterval, processorIndex);
                data = new DataSets(DataType.PROCESSOR, collector, device, pollInterval, processorString, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
            } catch (NullPointerException e) {
                ErrorHandler.modalError(this, "Please enumerate resources on a device and select a processor",
                        "No processor selected");
            } catch (ArrayIndexOutOfBoundsException e) {
                ErrorHandler.modalError(this, "Please select a processor", "No processor selected");
            } catch (DBException e) {
                ErrorHandler.modalError(null, "Please ensure that database is running and accessible",
                        "Error opening database connection", e);
            } catch (UnknownHostException e) {
                ErrorHandler.modalError(null, "Please ensure that device name \"" + deviceField.getText() + "\" is valid",
                        "Unknown host " + deviceField.getText());
            } catch (SNMPException e) {
                ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                        "Cannot access SNMP service on device " + deviceField.getText(), e);
            } catch (ClassCastException e) {
                ErrorHandler.modalError(null, "Please ensure that device supports processor usage in the Host Resources MIB",
                        "Cannot find processor usage information on device " + deviceField.getText(), e);
            }
           
        } else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_UCD ) {
            try {
                currentDevice = new Device(deviceField.getText(), communityField.getText(), null, false);
                processorUCDSNMP = new ProcessorUCDSNMP(currentDevice);
                collector = new ProcessorUCDCollector(processorUCDSNMP, (long)pollInterval);
                data = new DataSets(DataType.NETSNMP_PROCESSOR, collector, currentDevice, pollInterval, null, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
            } catch (DBException e) {
                ErrorHandler.modalError(null, "Please ensure that database is running and accessible",
                        "Error opening database connection", e);
            } catch (UnknownHostException e) {
                ErrorHandler.modalError(null, "Please ensure that device name \"" + deviceField.getText() + "\" is valid",
                        "Unknown host " + deviceField.getText());
            } catch (SNMPException e) {
                ErrorHandler.modalError(null, "Please ensure that device name and community string are correct",
                        "Cannot access SNMP service on device " + deviceField.getText(), e);
            }
        } else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_CISCO ) {
            try {
                currentDevice = new Device(deviceField.getText(), communityField.getText(), null, false);
                processorCiscoSNMP = new ProcessorCiscoSNMP(currentDevice);
                collector = new ProcessorCiscoCollector(processorCiscoSNMP, pollInterval);
                data = new DataSets(DataType.PROCESSOR, collector, currentDevice, pollInterval, null, DataSets.DIRECTION_NONE, null, storeDataCheckBox.isSelected());
                context = new TimeSeriesContext(data);
                graphFrame = new DataGraph(context);
View Full Code Here

        JList storageList;
        //ProcessorHRSNMP processorSNMP;
       
        try {
            if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_HR ) {
                device = new Device(deviceField.getText(), communityField.getText(), null, false);
                //device.enumerateHostProcessors();
                processorHRSNMP = new ProcessorHRSNMP(device);
                processorHRSNMP.enumerateHostProcessors();
                processorsTitleLabel.setText("Processor list for " + device.getName());
                processorsList = new javax.swing.JList(processorHRSNMP.getProcessorsDescr());
                processorsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                processorsPane.setViewportView((java.awt.Component)processorsList);
               
                //device.enumerateHostStorage();
                memoryHRSNMP = new MemoryHRSNMP(device);
                memoryHRSNMP.enumerateHostStorage();
                storageTitleLabel.setText("Storage list for " + device.getName());
                storageList = new javax.swing.JList(memoryHRSNMP.getStorageDescr());
                storageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                storagePane.setViewportView((java.awt.Component)storageList);
            } else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_UCD ) {
                device = new Device(deviceField.getText(), communityField.getText(), null, false);
                processorsTitleLabel.setText("Processor list for " + device.getName());
                processorsList = new javax.swing.JList(NO_CHOICE);
                processorsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                processorsPane.setViewportView((java.awt.Component)processorsList);
                storageTitleLabel.setText("Memory list for " + device.getName());
                storageList = new javax.swing.JList(MemoryUCDCollector.UCD_MEMORY_TYPES);
                storageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                storagePane.setViewportView((java.awt.Component)storageList);
            } else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_CISCO ) {
                device = new Device(deviceField.getText(), communityField.getText(), null, false);
                //device.enumerateCiscoMemoryPools();
                memoryCiscoSNMP = new MemoryCiscoSNMP(device);
                memoryCiscoSNMP.enumerateCiscoMemoryPools();
                storageTitleLabel.setText("Memory pools for " + device.getName());
                storageList = new javax.swing.JList(memoryCiscoSNMP.getStorageDescr());
View Full Code Here

       
    }//GEN-LAST:event_resourcesButtonActionPerformed
   
    public void retrieveCommunity() {
        String community;
        Device candidate;
       
        try {
            candidate = new Device(deviceField.getText());
            community = candidate.retrieveReadCommunity();
            if ( community != null ) {
                communityField.setText(community);
            }
        } catch (DBException e) {
        }
View Full Code Here

     * @return               the collector created from the database definition
     */
    public ProcessorUCDCollector retrieve(int sessionID) throws DBException, UnknownHostException, SNMPException {
        DeviceDAO deviceDAO;
        String name;
        Device device;
        ProcessorUCDSNMP snmp;
        long pollInterval;
        int snmpIndex;
       
        name = (String)(DBUtil.retrieveSingleAttributeWithPK(connection, RETRIEVE_DEVICE, sessionID));
View Full Code Here

TOP

Related Classes of nz.co.abrahams.asithappens.storage.Device

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.