notifications.setEnabled(configuration.getEnabledBooleanValue()); notifications.setAlertsEnabled(configuration.getAlertsBooleanValue()); notifications.setRecoveryEnabled(configuration.getRecoveryBooleanValue()); notifications.setAcknowledgeEnabled(configuration.getAcknowledgeBooleanValue()); notifications.setIgnore(configuration.getIgnore().stream().map((e) -> {return Status.valueOf(e.toUpperCase());}).collect(Collectors.toList())); notifications.setAllEnginesEnabled(configuration.getAllEnginesEnabledBooleanValue()); if (! Util.isEmpty(configuration.getNotificationPeriod())) TimePeriod timePeriod = db.getTimePeriodByName(this.site.getId(), configuration.getNotificationPeriod()); if (timePeriod != null) for (NotificationEngineCfg econfiguration : configuration.getNotificationEngines())
private void convertContacts() { for (NagiosContactCfg cfg : this.nagiosConfig.getContacts()) { // convert the contact ContactCfg contact = new ContactCfg(); contact.setLoadedFrom(convertFile(cfg.getLoadedFrom())); contact.setTemplate(cfg.isRegister() == null || cfg.isRegister() == false ? true : null); contact.setName(contact.getTemplateBooleanValue() ? cfg.getName() : cfg.getContactName()); if (cfg.getInherits() != null) contact.getInheritedTemplates().addAll(cfg.getInherits()); if (!Util.isEmpty(cfg.getEmail())) contact.setEmail(cfg.getEmail()); if (!Util.isEmpty(cfg.getPager())) contact.setPager(cfg.getPager()); if (!Util.isEmpty(cfg.getAlias())) contact.setSummary(cfg.getAlias()); // notifications if (cfg.isNotificationsEnabled() != null || cfg.getNotificationPeriod() != null) { NotificationsCfg notifications = new NotificationsCfg(); notifications.setEnabled(cfg.isNotificationsEnabled()); if (cfg.getNotificationPeriod() != null) { notifications.setNotificationPeriod(Util.coalesce(cfg.getNotificationPeriod(), cfg.getServiceNotificationPeriod(), cfg.getHostNotificationPeriod(), "24x7")); } contact.setNotifications(notifications); } // teams if (cfg.getContactgroups() != null) contact.getTeams().addAll(cfg.getContactgroups()); // add this.config.getContacts().add(contact); } }
service.setNotifications(new NotificationsCfg()); service.getNotifications().setEnabled(cfg.isNotificationsEnabled()); if (cfg.getNotificationPeriod() != null) service.getNotifications().setNotificationPeriod(Util.coalesce(cfg.getNotificationPeriod(), "24x7"));
host.setNotifications(new NotificationsCfg()); host.getNotifications().setEnabled(cfg.isNotificationsEnabled()); if (cfg.getNotificationPeriod() != null) host.getNotifications().setNotificationPeriod(Util.coalesce(cfg.getNotificationPeriod(), "24x7"));