Tracking more user activities: alerts deleted, all/inactive/interface data deleted, host data deleted, all/host data exproted

This commit is contained in:
Alfredo Cardigliano 2018-12-05 04:36:30 +01:00
parent a087fb3bc9
commit bc7283ce3f
5 changed files with 87 additions and 23 deletions

View file

@ -7,6 +7,7 @@ package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require("dkjson")
local tracker = require("tracker")
sendHTTPContentTypeHeader('application/json', 'attachment; filename="exported_data.json"')
@ -15,16 +16,17 @@ local ifId = _GET["ifid"]
interface.select(ifId)
local host
local host_info
if mode == "filtered" then
local host_info = url2hostinfo(_GET)
local host
host_info = url2hostinfo(_GET)
if not isEmptyString(host_info["host"]) then
host = interface.getHostInfo(host_info["host"], host_info["vlan"] or 0)
end
print(json.encode(host or {}))
else
local hosts_retrv_function
local hosts_stats
@ -43,3 +45,10 @@ else
print(json.encode(hosts_stats or {}))
end
-- TRACKER HOOK
if (host ~= nil) then
tracker.log("export_data", { mode, host_info["host"], host_info["vlan"] })
else
tracker.log("export_data", { mode })
end