mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Moved active monitoring page to vuejs
This commit is contained in:
parent
0a2b1e8bb9
commit
963579b526
18 changed files with 1469 additions and 3 deletions
60
scripts/lua/rest/v2/delete/active_monitoring/measurement.lua
Normal file
60
scripts/lua/rest/v2/delete/active_monitoring/measurement.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
--
|
||||
-- (C) 2019-24 - ntop.org
|
||||
--
|
||||
local dirs = ntop.getDirs()
|
||||
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
|
||||
|
||||
require "http_lint"
|
||||
local am_utils = require "am_utils"
|
||||
local auth = require "auth"
|
||||
local rest_utils = require "rest_utils"
|
||||
|
||||
-- ################################################
|
||||
|
||||
local host = _POST["host"]
|
||||
local measurement = _POST["measurement"]
|
||||
|
||||
local res = {}
|
||||
|
||||
-- ################################################
|
||||
|
||||
if isEmptyString(host) then
|
||||
res.result = i18n("missing_x_parameter", {
|
||||
param = 'Host'
|
||||
})
|
||||
rest_utils.answer(rest_utils.consts.success.ok, res)
|
||||
return
|
||||
end
|
||||
|
||||
-- ################################################
|
||||
|
||||
if isEmptyString(measurement) then
|
||||
res.result = i18n("missing_x_parameter", {
|
||||
param = 'Measurement'
|
||||
})
|
||||
rest_utils.answer(rest_utils.consts.success.ok, res)
|
||||
return
|
||||
end
|
||||
|
||||
-- ################################################
|
||||
|
||||
if not auth.has_capability(auth.capabilities.active_monitoring) then
|
||||
res.result = i18n("not_admin")
|
||||
rest_utils.answer(rest_utils.consts.success.ok, res)
|
||||
return
|
||||
end
|
||||
|
||||
-- ################################################
|
||||
|
||||
local url = am_utils.formatAmHost(host, measurement)
|
||||
local existing = am_utils.hasHost(host, measurement)
|
||||
|
||||
if existing then
|
||||
am_utils.deleteHost(host, measurement)
|
||||
end
|
||||
|
||||
res.result = 'ok'
|
||||
|
||||
-- ################################################
|
||||
|
||||
rest_utils.answer(rest_utils.consts.success.ok, res)
|
||||
Loading…
Add table
Add a link
Reference in a new issue