FlowOptions options;
NetFlowSNMP snmp;
NetFlowCollector collector;
DataSets data;
TimeSeriesContext context;
DataGraph graphFrame;
if ( ! portsSelectorPanel.getModel().hasEnumerated() ) {
ErrorHandler.modalError(this, "Please enumerate ports on a device and select a port",
"No port selected");
return;
} else if ( portsSelectorPanel.rowsSelected().length == 0 ) {
ErrorHandler.modalError(this, "Please select a port", "No port selected");
return;
}
device = portsSelectorPanel.getModel().getDevice();
try {
snmp = new NetFlowSNMP(device);
if ( snmp.getNetFlowTopFlowsTopNTable() > 0 ) {
logger.debug("NetFlow Top-N table already exists");
if ( JOptionPane.showConfirmDialog(this, "A Netflow Top-N table already exists - overwrite this?",
"Confirm NetFlow Top-N table creation", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.CANCEL_OPTION)
return;
}
/*
ifIndex = device.getPortsIndex()[((JList)(portsPane.getViewport().getView())).getSelectedIndex()];
portString = (String)((JList)portsPane.getViewport().getView()).getSelectedValue();
*/
ifIndex = portsSelectorPanel.getIfIndex();
portString = portsSelectorPanel.getIfDescription();
options = new FlowOptions(ipProtocolCheckBox.isSelected(), sourceAddressCheckBox.isSelected(),
destinationAddressCheckBox.isSelected(), tosCheckBox.isSelected(), sourcePortCheckBox.isSelected(), destinationPortCheckBox.isSelected());
collector = new NetFlowCollector(snmp, ifIndex, portString, directionCombo.getSelectedIndex() + 1, Configuration.getPropertyInt("collector.netflow.table.size"), Integer.parseInt(pollField.getText()) * 1000, criteria, options);
data = new DataSets(DataType.NETFLOW, collector, device, Integer.parseInt(pollField.getText()) * 1000, portString, directionCombo.getSelectedIndex() + 1, null, storeDataCheckBox.isSelected());
//data = new DataSets(3, device, Integer.parseInt(pollField.getText()) * 1000, ifIndex, portString, directionCombo.getSelectedIndex() + 1, "NetFlow Graph", storeDataCheckBox.isSelected());
context = new TimeSeriesContext(data);
graphFrame = new DataGraph(context);
} catch (DBException e) {
ErrorHandler.modalError(this, "Please ensure that database is running and accessible",
"Error opening database connection", e);
} catch (UnknownHostException e) {
ErrorHandler.modalError(this, "Please ensure that device name \"" + device.getName() + "\" is valid",