def initiate(self, state): state.medium.register_interest(AlertsCollector) config = state.medium.get_configuration() state.nagios = self.dependency(INagiosSenderLabourFactory, self, config) # (hostname, agent_id, service_name) -> ReceivedAlerts state.alerts = dict() state.config_notifier = cnagios.create_poster(self) state.medium.initiate_protocol(PushNagiosStatus, 3600) # once an hour
def initiate(self, state): state.config = state.medium.agency.get_config().nagios state.nagios = self.dependency(INagiosSenderLabourFactory, self, state.config) # (hostname, description) -> AlertService state.alerts = dict() state.config_notifier = cnagios.create_poster(self) f = self.query_view(view.DocumentByType, reduce=False, include_docs=True, **view.DocumentByType.keys(AlertService)) f.add_callback(self._load_persistent_services) return f