mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-07 05:05:58 +00:00
This commits adds two reset buttons to the interface page. One button allows the reset of all interface counters, namely, packets and bytes received, packets dropped, and the number of flows exported and dropped (when mysql or elasticsearch is enabled). The other button allows the reset of only the drops.
28 lines
646 B
Lua
28 lines
646 B
Lua
--
|
|
-- (C) 2013-16 - ntop.org
|
|
--
|
|
|
|
dirs = ntop.getDirs()
|
|
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
|
require "lua_utils"
|
|
|
|
local json = require("dkjson")
|
|
|
|
sendHTTPHeader('application/json; charset=iso-8859-1')
|
|
|
|
local action = _GET["action"]
|
|
|
|
interface.select(ifname)
|
|
|
|
local res = { ["status"] = "ok" }
|
|
if haveAdminPrivileges() then
|
|
if action == "reset_drops" then
|
|
interface.resetCounters(true --[[ reset only drops --]])
|
|
elseif action == "reset_all" then
|
|
interface.resetCounters(false --[[ reset all counters --]])
|
|
end
|
|
else
|
|
res["status"] = "unauthorized"
|
|
end
|
|
|
|
print(json.encode(res, nil))
|