Commit bec30ed2 authored by Ad Schellevis's avatar Ad Schellevis

(netflow) enable local data collection, ui part

parent dcc44316
......@@ -67,6 +67,18 @@ class NetflowController extends ApiControllerBase
// load model and update with provided data
$mdlNetflow = new Netflow();
$mdlNetflow->setNodes($this->request->getPost("netflow"));
if ((string)$mdlNetflow->collect->enable == 1) {
// add localhost (127.0.0.1:2056) as target if local capture is configured
if (strpos((string)$mdlNetflow->capture->targets, "127.0.0.1:2056") === false) {
if ((string)$mdlNetflow->capture->targets != "") {
$targets = explode(",", (string)$mdlNetflow->capture->targets);
} else {
$targets = array();
}
$targets[] = "127.0.0.1:2056";
$mdlNetflow->capture->targets = implode(',', $targets);
}
}
// perform validation
$validations = $mdlNetflow->validate();
......
......@@ -7,6 +7,12 @@
<help><![CDATA[Select interface(s) to enable netflow on.]]></help>
<hint>Type or select interface.</hint>
</field>
<field>
<id>netflow.collect.enable</id>
<label>Capture local</label>
<type>checkbox</type>
<help>Collect netflow data on this firewall, this will automatically append localhost as netflow target</help>
</field>
<field>
<id>netflow.capture.version</id>
<label>Version</label>
......
......@@ -27,5 +27,11 @@
<ValidationMessage>Please enter valid targets (e.g. 192.168.0.1:2055)</ValidationMessage>
</targets>
</capture>
<collect>
<enable type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enable>
</collect>
</items>
</model>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment