mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Optimize disabled alerts bitmap redis access
This commit is contained in:
parent
3fb11d80c4
commit
a96a90b65f
4 changed files with 137 additions and 81 deletions
|
|
@ -541,18 +541,24 @@ end
|
|||
-- #################################
|
||||
|
||||
local function checkDisableAlerts()
|
||||
local ifid = interface.getId()
|
||||
|
||||
if(_POST["action"] == "disable_alert") then
|
||||
local entity = _POST["entity"]
|
||||
local entity_val = _POST["entity_val"]
|
||||
local alert_type = _POST["alert_type"]
|
||||
local disabled_alerts = alerts_api.getEntityAlertsDisabledBitmap(ifid, entity, entity_val)
|
||||
|
||||
alerts_api.disableEntityAlert(interface.getId(), entity, entity_val, alert_type)
|
||||
disabled_alerts = ntop.bitmapSet(disabled_alerts, tonumber(alert_type))
|
||||
alerts_api.setEntityAlertsDisabledBitmap(ifid, entity, entity_val, disabled_alerts)
|
||||
elseif(_POST["action"] == "enable_alert") then
|
||||
local entity = _POST["entity"]
|
||||
local entity_val = _POST["entity_val"]
|
||||
local alert_type = _POST["alert_type"]
|
||||
local disabled_alerts = alerts_api.getEntityAlertsDisabledBitmap(ifid, entity, entity_val)
|
||||
|
||||
alerts_api.enableEntityAlert(interface.getId(), entity, entity_val, alert_type)
|
||||
disabled_alerts = ntop.bitmapClear(disabled_alerts, tonumber(alert_type))
|
||||
alerts_api.setEntityAlertsDisabledBitmap(ifid, entity, entity_val, disabled_alerts)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1547,8 +1553,6 @@ end
|
|||
-- #################################
|
||||
|
||||
local function printDisabledAlerts(ifid)
|
||||
local entitites = alerts_api.listEntitiesWithAlertsDisabled(ifid)
|
||||
|
||||
print[[
|
||||
<script>
|
||||
$("#table-disabled-alerts").datatable({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue