Skip to content

Commit

Permalink
if_stats.lua: use MB for the max size of dump files
Browse files Browse the repository at this point in the history
This commit changes the measure unit for the max size of dump
files to MB so that it more user-friendly. This addresses
issue #20.
  • Loading branch information
ariava committed May 11, 2015
1 parent ccf18b3 commit 6b9007e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/lua/if_stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ end
if(_GET["max_files"] ~= nil and _GET["csrf"] ~= nil) then
if (tonumber(_GET["max_files"]) ~= nil) then
page = "packetdump"
ntop.setCache('ntopng.prefs.'..ifstats.name..'.dump_max_files',_GET["max_files"])
local max_files_size = tonumber(_GET["max_files"])
max_files_size = max_files_size * 1000000
ntop.setCache('ntopng.prefs.'..ifstats.name..'.dump_max_files', tostring(max_files_size))
interface.loadDumpPrefs()
end
end
Expand Down Expand Up @@ -618,15 +620,15 @@ end
print(ifstats.name)
print [[">]]
print('<input id="csrf" name="csrf" type="hidden" value="'..ntop.getRandomCSRFValue()..'" />\n')
print [[<input type="number" name="max_files" placeholder="" min="0" step="1000" max="500000000000" value="]]
print [[<input type="number" name="max_files" placeholder="" min="0" step="1" max="100000000" value="]]
max_files = ntop.getCache('ntopng.prefs.'..ifstats.name..'.dump_max_files')
if(max_files ~= nil and max_files ~= "") then
print(max_files.."")
print(tostring(tonumber(max_files)/1000000).."")
else
print(interface.getInterfaceDumpMaxFiles().."")
print(tostring(tonumber(interface.getInterfaceDumpMaxFiles())/1000000).."")
end
print [["></input>
&nbsp; B &nbsp;&nbsp;&nbsp;<button type="submit" style="position: absolute; margin-top: 0; height: 26px" class="btn btn-default btn-xs">Save</button>
&nbsp; MB &nbsp;&nbsp;&nbsp;<button type="submit" style="position: absolute; margin-top: 0; height: 26px" class="btn btn-default btn-xs">Save</button>
</form>
<small>Maximum size of created pcap files.<br>NOTE: total file size is checked daily and old dump files are automatically overwritten after reaching the threshold.</small>
</td></tr>
Expand Down

0 comments on commit 6b9007e

Please sign in to comment.