naemon / naemon-livestatus

Naemon - Livestatus Eventbroker Module
GNU General Public License v2.0
27 stars 30 forks source link

speed up contacts host/service column #85

Closed sni closed 3 years ago

sni commented 3 years ago

the default contacts column iterates over each available contact and checks with isNagiosMember() if this contact is valid for the given hst/svc which in turn calls is_contact_for_service() which simply iterates over all service contacts and then over all contactgroups with all its members to see if the contact matches. That's quite a number of nested loops just to get the contacts list of a host/service. This scales accidentally quadratic with the number of services/hosts/contacts.

We now calculate the contacts based on the contacts and contactgroup members on the fly to avoid the nested loops. Since the list could then contain duplicates and is not sorted we have to do apply sorting again to match the previous result.

Signed-off-by: Sven Nierlein sven@nierlein.de