Replaces sub with gsub for string substitution

This commit is contained in:
Simone Mainardi 2016-07-28 15:48:41 +02:00
parent a31225e2ab
commit 2ec5c8e798

View file

@ -205,7 +205,6 @@ function delete_alert_configuration(alert_source, ifname)
end
end
function check_host_alert(ifname, hostname, mode, key, old_json, new_json)
if(verbose) then
print("check_host_alert("..ifname..", "..hostname..", "..mode..", "..key..")<br>\n")
@ -262,7 +261,7 @@ function check_host_alert(ifname, hostname, mode, key, old_json, new_json)
ntop.queueAlert(alert_level, alert_status, alert_type, alert_msg)
if ntop.isPro() then
-- possibly send the alert to nagios as well
ntop.sendNagiosAlert(string.sub(key, "@0", "") --[[ vlan 0 is implicit for hosts --]],
ntop.sendNagiosAlert(string.gsub(key, "@0", "") --[[ vlan 0 is implicit for hosts --]],
mode, t[1], alert_msg)
if ntop.isEnterprise() then
fire_stateful_host_alert(t[1], -- condition
@ -279,7 +278,7 @@ function check_host_alert(ifname, hostname, mode, key, old_json, new_json)
if(verbose) then print("<p><font color=green><b>Threshold "..t[1].."@"..key.." not crossed</b> [value="..val.."]["..op.." "..t[3].."]</font><p>\n") end
if ntop.isPro() and not is_alert_re_arming(key, mode, t[1], ifname) then
ntop.withdrawNagiosAlert(string.sub(key, "@0", "") --[[ vlan 0 is implicit for hosts --]],
ntop.withdrawNagiosAlert(string.gsub(key, "@0", "") --[[ vlan 0 is implicit for hosts --]],
mode, t[1], "service OK")
if ntop.isEnterprise() then
withdraw_stateful_host_alert(t[1], -- condition