private void storageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_storageButtonActionPerformed
DataCollector collector;
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;
if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_HR ) {
try {
storageIndex = memoryHRSNMP.getStorageIndex()[((JList)(storagePane.getViewport().getView())).getSelectedIndex()];
storageString = (String)((JList)storagePane.getViewport().getView()).getSelectedValue();
collector = new MemoryHRCollector(memoryHRSNMP, pollInterval, storageIndex);
data = new DataSets(DataType.STORAGE, collector, device, pollInterval, storageString, 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 storage object",
"No storage object selected");
} catch (ArrayIndexOutOfBoundsException e) {
ErrorHandler.modalError(this, "Please select a storage object", "No storage object 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);
}
}
else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_UCD ) {
try {
storageIndex = ((JList)(storagePane.getViewport().getView())).getSelectedIndex();
storageString = (String)((JList)storagePane.getViewport().getView()).getSelectedValue();
//currentDevice = new Device(deviceField.getText(), communityField.getText());
memoryUCDSNMP = new MemoryUCDSNMP(device);
collector = new MemoryUCDCollector(memoryUCDSNMP, pollInterval, storageIndex);
data = new DataSets(DataType.STORAGE, collector, device, pollInterval, storageString, 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 memory type",
"No memory type selected");
} catch (ArrayIndexOutOfBoundsException e) {
ErrorHandler.modalError(this, "Please select a memory type", "No memory type 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);
}
}
else if ( collectorTypeComboBox.getSelectedIndex() == COLLECTOR_TYPE_CISCO ) {
try {
storageIndex = memoryCiscoSNMP.getStorageIndex()[((JList)(storagePane.getViewport().getView())).getSelectedIndex()];
storageString = (String)((JList)storagePane.getViewport().getView()).getSelectedValue();
//currentDevice = new Device(deviceField.getText(), communityField.getText());
collector = new MemoryCiscoCollector(memoryCiscoSNMP, pollInterval, storageIndex);
data = new DataSets(DataType.STORAGE, collector, device, pollInterval, storageString, 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 Cisco device and select a memory pool",
"No memory pool selected");
} catch (ArrayIndexOutOfBoundsException e) {
ErrorHandler.modalError(this, "Please select a memory pool", "No memory pool selected");