Skip to content

Commit

Permalink
handle last_check & last_update for better compat (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanguyvda authored Jun 17, 2022
1 parent b95a90f commit 44145f7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion modules/centreon-stream-connectors-lib/sc_event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,15 @@ function ScEvent:is_valid_host_status_event()
self.sc_logger:warning("[sc_event:is_valid_host_status_event]: host_id: " .. tostring(self.event.host_id) .. " is not in an accepted hostgroup")
return false
end


-- in bbdo 2 last_update do exist but not in bbdo3.
-- last_check also exist in bbdo2 but it is preferable to stay compatible with all stream connectors
if not self.event.last_update and self.event.last_check then
self.event.last_update = self.event.last_check
elseif not self.event.last_check and self.event.last_update then
self.event.last_check = self.event.last_update
end

self:build_outputs()

return true
Expand Down Expand Up @@ -219,6 +227,14 @@ function ScEvent:is_valid_service_status_event()
return false
end

-- in bbdo 2 last_update do exist but not in bbdo3.
-- last_check also exist in bbdo2 but it is preferable to stay compatible with all stream connectors
if not self.event.last_update and self.event.last_check then
self.event.last_update = self.event.last_check
elseif not self.event.last_check and self.event.last_update then
self.event.last_check = self.event.last_update
end

self:build_outputs()

return true
Expand Down

0 comments on commit 44145f7

Please sign in to comment.