mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
fixed invalid nindex detection, other improvements
This commit is contained in:
parent
49a5817fa6
commit
963c4bb721
5 changed files with 44 additions and 6 deletions
|
|
@ -1175,7 +1175,7 @@ elseif(page == "traffic_recording") then
|
|||
<tr>
|
||||
<th width=30%>]] print(i18n("traffic_recording.traffic_recording")) print [[</th>
|
||||
<td colspan=2>
|
||||
<input name="record_traffic" type="checkbox" value="1" ]] print (record_traffic_checked) print [[> <i class="fa fa-hdd-o fa-lg"></i> ]] print(i18n("traffic_recording.enable_recording")) print [[</input>
|
||||
<input name="record_traffic" type="checkbox" value="1" ]] print (record_traffic_checked) print [[> <i class="fa fa-hdd-o fa-lg"></i> ]] print(i18n("traffic_recording.continuous_recording")) print [[</input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -1194,11 +1194,10 @@ elseif(page == "traffic_recording") then
|
|||
print [[
|
||||
<tr>
|
||||
<th>]] print(i18n("traffic_recording.storage_utilization")) print [[</th>
|
||||
<td width="15%" class="text-right">]] print(tostring(math.floor(storage_info.used/1024))) print [[GB/]] print(tostring(math.floor(storage_info.total/1024))) print [[GB</td>
|
||||
<td>
|
||||
<span style="width: 60%; float: left;">
|
||||
<div class='progress'><div class='progress-bar progress-bar-warning' style='width: ]] print(storage_info.used_perc) print [[;'></div></div></span>
|
||||
<span style="width: 40%; margin-left: 15px;">]] print(storage_info.used_perc) print [[</span>
|
||||
<span style="width: 40%; margin-left: 15px;"> ]] print(tostring(math.floor(storage_info.used/1024))) print [[ GB / ]] print(tostring(math.floor(storage_info.total/1024))) print [[ GB (]] print(storage_info.used_perc) print [[)</span>
|
||||
</td>
|
||||
</tr>
|
||||
]]
|
||||
|
|
|
|||
|
|
@ -742,7 +742,10 @@ function hasNindexSupport()
|
|||
if prefs == nil then
|
||||
prefs = ntop.getPrefs()
|
||||
end
|
||||
return prefs.is_nindex_enabled
|
||||
local rc = prefs.is_nindex_enabled
|
||||
|
||||
if(rc == nil) then rc = false end
|
||||
return rc
|
||||
end
|
||||
|
||||
--for _key, _value in pairsByKeys(vals, rev) do
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ prefs = ntop.getPrefs()
|
|||
local n2disk_ctl = "/usr/local/bin/n2diskctl"
|
||||
local ntopng_config_tool = "/usr/bin/ntopng-utils-manage-config"
|
||||
local n2disk_ctl_cmd = "sudo "..n2disk_ctl
|
||||
local extraction_queue = "ntopng.traffic_recording.extraction_queue"
|
||||
|
||||
local recording_utils = {}
|
||||
|
||||
|
|
@ -317,6 +318,41 @@ function recording_utils.set_license(key)
|
|||
os.execute(n2disk_ctl_cmd.." set-license "..key)
|
||||
end
|
||||
|
||||
-- Schedule an extraction
|
||||
-- Note: 'params' should contain 'time_from', 'time_to', 'filter'
|
||||
-- 'time_*' format: "2018-10-15 11:00:00"
|
||||
-- 'filter' format: BPF
|
||||
function recording_utils.schedule_extraction(ifid, params)
|
||||
if params.time_from == nil or params.time_to == nil then
|
||||
return nil
|
||||
end
|
||||
if params.filter == nil then
|
||||
params.filter = ""
|
||||
end
|
||||
|
||||
local id = os.time() -- TODO
|
||||
|
||||
local job = {
|
||||
id = id,
|
||||
time = os.time(),
|
||||
status = 'waiting',
|
||||
ifid = ifid,
|
||||
time_from = params.time_from,
|
||||
time_to = params.time_to,
|
||||
filter = params.filer,
|
||||
}
|
||||
|
||||
ntop.rpushCache(extraction_queue, json.encode(job))
|
||||
|
||||
local job_info = { id = id }
|
||||
|
||||
-- Scheduler:
|
||||
-- local job_json = ntop.lpopCache(extraction_queue)
|
||||
-- local job = json.decode(job_json)
|
||||
|
||||
return job_info
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
||||
return recording_utils
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ if recording_utils.isAvailable then
|
|||
|
||||
print("<tr><th nowrap>"..i18n("traffic_recording.storage_dir").."</th><td>"..recording_utils.getPcapPath(ifstats.id).."</td></tr>\n")
|
||||
|
||||
print("<tr><th nowrap>"..i18n("traffic_recording.storage_utilization").."</th><td>"..tostring(math.floor(storage_info.used/1024)).."GB / "..tostring(math.floor(storage_info.total/1024)).."GB ("..storage_info.used_perc..")</td></tr>\n")
|
||||
print("<tr><th nowrap>"..i18n("traffic_recording.storage_utilization").."</th><td>"..tostring(math.floor(storage_info.used/1024)).." GB / "..tostring(math.floor(storage_info.total/1024)).." GB ("..storage_info.used_perc..")</td></tr>\n")
|
||||
|
||||
print("<tr><th nowrap>"..i18n("about.last_log").."</th><td><code>\n")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue