Adds badge upon influxdb export errors

This commit is contained in:
Simone Mainardi 2019-06-26 16:29:08 +02:00
parent 15bf893cc3
commit 2200453862
3 changed files with 19 additions and 1 deletions

View file

@ -3,10 +3,13 @@
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
local json = require("dkjson")
local ts_utils = require("ts_utils_core")
local system_scripts = require("system_scripts_utils")
sendHTTPHeader('application/json')
@ -76,6 +79,11 @@ function dumpInterfaceStats(interface_name)
local alert_cache = interface.getCachedNumAlerts() or {}
res["engaged_alerts"] = alert_cache["num_alerts_engaged"] or 0
res["alerts_stored"] = alert_cache["alerts_stored"] or 0
res["ts_alerts"] = {}
if ts_utils.getDriverName() == "influxdb" and system_scripts.hasAlerts({entity = alertEntity("influx_db")}) then
res["ts_alerts"]["influxdb"] = true
end
end
if not userHasRestrictions() then