Commit 48c51f2e authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(reporting/settings) option to flush all local netflow data. closes...

(reporting/settings) option to flush all local netflow data. closes https://github.com/opnsense/core/issues/983

(cherry picked from commit 0c429413)
parent 2f173460
#!/bin/sh
if [ "$1" == "all" ]; then
echo "flush all local netflow data"
/usr/local/etc/rc.d/flowd_aggregate stop
/usr/local/etc/rc.d/flowd stop
rm /var/netflow/*.sqlite
rm /var/log/flowd.log*
/usr/local/etc/rc.d/flowd start
/usr/local/etc/rc.d/flowd_aggregate start
else
echo "not flushing local netflow data, provide all as parameter to do so"
fi
......@@ -91,3 +91,9 @@ command:/usr/local/opnsense/scripts/netflow/export_details.py
parameters:/provider %s /start_time %s /end_time %s /resolution %s
type:script_output
message:export netflow data aggregator details for %s
[flush]
command:/usr/local/opnsense/scripts/netflow/flush_all.sh all
parameters:
type:script
message:flush all local collected netflow data
......@@ -46,6 +46,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif (!empty($_POST['action']) && $_POST['action'] == "flush_file") {
$savemsg = gettext('RRD report has been cleared.');
configd_run("systemhealth flush ". escapeshellarg($_POST['filename']));
} elseif (!empty($_POST['action']) && $_POST['action'] == "flush_netflow") {
$savemsg = gettext('All local netflow data has been cleared.');
configd_run("netflow flush");
} else {
$config['rrd']['enable'] = !empty($_POST['rrdenable']);
$savemsg = get_std_save_message();
......@@ -88,6 +91,26 @@ $(document).ready(function() {
}]
});
});
// flush all netflow data
$("#flush_netflow").click(function(event){
event.preventDefault();
BootstrapDialog.show({
type:BootstrapDialog.TYPE_DANGER,
title: "<?= gettext("Netflow/Insight");?>",
message: "<?=gettext('Do you really want to reset the netflow data? This will erase all Insight graph data.');?>",
buttons: [{
label: "<?= gettext("No");?>",
action: function(dialogRef) {
dialogRef.close();
}}, {
label: "<?= gettext("Yes");?>",
action: function(dialogRef) {
$("#action").val("flush_netflow");
$("#iform").submit()
}
}]
});
});
$(".act_flush").click(function(event){
var filename = $(this).data('id');
event.preventDefault();
......@@ -144,6 +167,7 @@ $(document).ready(function() {
<td>
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" />
<input type="button" name="ResetRRD" id="ResetRRD" class="btn btn-default" value="<?=gettext("Reset RRD Data");?>" />
<input type="button" id="flush_netflow" class="btn btn-default" value="<?=gettext("Reset Netflow Data");?>" />
</td>
</tr>
<tr>
......
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