Implement per-alert-type host counters

Such counters will be used in the future to generate alert timeseries.
Counters are not currently serialized as internally discussed.

Closes #2728
This commit is contained in:
emanuele-f 2019-07-19 17:25:59 +02:00
parent 0d1b4c30a9
commit c715bb36f3
10 changed files with 59 additions and 44 deletions

View file

@ -96,7 +96,7 @@ end
-- ##############################################
-- TODO remove
-- TODO change in "store"
--! @brief Triggers a new alert or refreshes an existing one (if already engaged)
--! @param entity_value the string representing the entity of the alert (e.g. "192.168.1.1")
--! @param alert_message the message (string) or json (table) to store
@ -115,6 +115,11 @@ function alerts_api:trigger(entity_value, alert_message, when)
self.type_id, self.subtype or "", self.severity_id,
self.entity_type_id, entity_value, msg)
if(self.entity == "host") then
-- NOTE: for engaged alerts this operation is performed during trigger in C
interface.incTotalHostAlerts(entity_value, self.type_id)
end
if(rv) then
local action = "store"
local message = {