Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Retention notification (#285)
Browse files Browse the repository at this point in the history
* enh(test_config): New checks added.

* enh(retention): notifications are recorded and reloaded now.

* enh(retention): operator<< is not used to save the retention

* fix(notifier): A bounded memory leak is fixed.

* fix(notifier): Same flapping notifications can be sent one after one

* enh(doc): add release notes for 19.10.5
  • Loading branch information
bouda1 authored Nov 5, 2019
1 parent 427802c commit 4185fa1
Show file tree
Hide file tree
Showing 26 changed files with 1,402 additions and 729 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_directories("${INC_DIR}/compatibility")
# Version.
set(CENTREON_ENGINE_MAJOR 19)
set(CENTREON_ENGINE_MINOR 10)
set(CENTREON_ENGINE_PATCH 4)
set(CENTREON_ENGINE_PATCH 5)
if (CENTREON_ENGINE_PRERELEASE)
set(CENTREON_ENGINE_VERSION "${CENTREON_ENGINE_MAJOR}.${CENTREON_ENGINE_MINOR}.${CENTREON_ENGINE_PATCH}-${CENTREON_ENGINE_PRERELEASE}")
else ()
Expand Down
22 changes: 22 additions & 0 deletions doc/release_notes/engine19.10.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
=======================
Centreon Engine 19.10.5
=======================

*********
Bug fixes
*********

Notifications retention
=======================

In case of engine restart, notifications already sent were lost. It may have
impacts on normal notifications when it is time to send a recovery notification.
After a restart, the recovery notification was never sent.

=======================
Centreon Engine 19.10.4
=======================
Expand All @@ -8,11 +23,13 @@ Bug fixes

Custom variable update crash on reload
======================================

A bug was introduce in 19.10.2 with a reload on custom_variables
services/contacts/hosts update.

Recovery notification didn't work on escalation [1;0]
=====================================================

If an escalation was defined with a first notification at 1 and a
last notification at 0, we want the escalation to start from the
first notification, but only one time, the recovery notification
Expand All @@ -28,6 +45,7 @@ Bug fixes

Service escalation not well resolved
====================================

Service configurations look up failed when service escalations were defined.

=======================
Expand All @@ -40,19 +58,23 @@ Bug fixes

Custom variables not resolved
==============================

Some custom variables were not resolved.
This results in bad or pending checks with wrong commands.

Random host statuses
====================

Some hosts/services were changing status randomly.

Send custom variables to broker
===============================

Some broker notifications about customvariables were dropped.

Null string crash
=================

In some cases strings construction could lead to exceptions thrown.

=======================
Expand Down
2 changes: 1 addition & 1 deletion inc/com/centreon/engine/configuration/applier/globals.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace configuration {
*/
class globals {
public:
void apply(state& globals);
void apply(configuration::state& globals);
static globals& instance();
static void load();
static void unload();
Expand Down
8 changes: 4 additions & 4 deletions inc/com/centreon/engine/configuration/applier/logging.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ namespace configuration {
*/
class logging {
public:
void apply(state& config);
void apply(configuration::state& config);
static logging& instance();
static void load();
static void unload();

private:
logging();
logging(state& config);
logging(configuration::state& config);
logging(logging const&);
~logging() throw ();
logging& operator=(logging const&);
void _add_stdout();
void _add_stderr();
void _add_syslog();
void _add_log_file(state const& config);
void _add_debug(state const& config);
void _add_log_file(configuration::state const& config);
void _add_debug(configuration::state const& config);
void _del_syslog();
void _del_log_file();
void _del_debug();
Expand Down
170 changes: 81 additions & 89 deletions inc/com/centreon/engine/configuration/applier/scheduler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,104 +18,96 @@
*/

#ifndef CCE_CONFIGURATION_APPLIER_SCHEDULER_HH
# define CCE_CONFIGURATION_APPLIER_SCHEDULER_HH
#define CCE_CONFIGURATION_APPLIER_SCHEDULER_HH

# include <vector>
# include "com/centreon/engine/configuration/applier/difference.hh"
# include "com/centreon/engine/configuration/state.hh"
# include "com/centreon/engine/namespace.hh"
#include <vector>
#include "com/centreon/engine/configuration/applier/difference.hh"
#include "com/centreon/engine/configuration/state.hh"
#include "com/centreon/engine/namespace.hh"

// Forward declaration.
CCE_BEGIN()
class service;
class timed_event;

namespace configuration {
namespace applier {
/**
* @class scheduler scheduler.hh
* @brief Simple configuration applier for scheduler class.
*
* Simple configuration applier for scheduler class.
*/
class scheduler {
public:
void apply(
state& config,
difference<set_host> const& diff_hosts,
difference<set_service> const& diff_services);
static scheduler& instance();
static void load();
void remove_host(configuration::host const& h);
void remove_service(configuration::service const& s);
static void unload();
namespace configuration {
namespace applier {
/**
* @class scheduler scheduler.hh
* @brief Simple configuration applier for scheduler class.
*
* Simple configuration applier for scheduler class.
*/
class scheduler {
public:
void apply(configuration::state& config,
difference<set_host> const& diff_hosts,
difference<set_service> const& diff_services);
static scheduler& instance();
static void load();
void remove_host(configuration::host const& h);
void remove_service(configuration::service const& s);
static void unload();

private:
scheduler();
scheduler(scheduler const&);
~scheduler() throw ();
scheduler& operator=(scheduler const&);
void _apply_misc_event();
void _calculate_host_inter_check_delay(
configuration::state::inter_check_delay method);
void _calculate_host_scheduling_params();
void _calculate_service_inter_check_delay(
configuration::state::inter_check_delay method);
void _calculate_service_interleave_factor(
configuration::state::interleave_factor method);
void _calculate_service_scheduling_params();
timed_event* _create_misc_event(
int type,
time_t start,
unsigned long interval,
void* data = NULL);
void _get_hosts(
set_host const& hst_added,
std::vector<
com::centreon::engine::host*>& new_hosts,
bool throw_if_not_found = true);
void _get_services(
set_service const& svc_added,
std::vector<engine::service*>& new_services,
bool throw_if_not_found = true);
void _remove_misc_event(timed_event*& evt);
void _schedule_host_events(
std::vector<
com::centreon::engine::host*> const& hosts);
void _schedule_service_events(
std::vector<engine::service*> const& services);
void _unschedule_host_events(
std::vector<
com::centreon::engine::host*> const& hosts);
void _unschedule_service_events(
std::vector<engine::service*> const& services);
private:
scheduler();
scheduler(scheduler const&);
~scheduler() throw();
scheduler& operator=(scheduler const&);
void _apply_misc_event();
void _calculate_host_inter_check_delay(
configuration::state::inter_check_delay method);
void _calculate_host_scheduling_params();
void _calculate_service_inter_check_delay(
configuration::state::inter_check_delay method);
void _calculate_service_interleave_factor(
configuration::state::interleave_factor method);
void _calculate_service_scheduling_params();
timed_event* _create_misc_event(int type,
time_t start,
unsigned long interval,
void* data = NULL);
void _get_hosts(set_host const& hst_added,
std::vector<com::centreon::engine::host*>& new_hosts,
bool throw_if_not_found = true);
void _get_services(set_service const& svc_added,
std::vector<engine::service*>& new_services,
bool throw_if_not_found = true);
void _remove_misc_event(timed_event*& evt);
void _schedule_host_events(
std::vector<com::centreon::engine::host*> const& hosts);
void _schedule_service_events(std::vector<engine::service*> const& services);
void _unschedule_host_events(
std::vector<com::centreon::engine::host*> const& hosts);
void _unschedule_service_events(
std::vector<engine::service*> const& services);

state* _config;
timed_event* _evt_check_reaper;
timed_event* _evt_command_check;
timed_event* _evt_hfreshness_check;
timed_event* _evt_host_perfdata;
timed_event* _evt_orphan_check;
timed_event* _evt_reschedule_checks;
timed_event* _evt_retention_save;
timed_event* _evt_sfreshness_check;
timed_event* _evt_service_perfdata;
timed_event* _evt_status_save;
unsigned int _old_auto_rescheduling_interval;
unsigned int _old_check_reaper_interval;
int _old_command_check_interval;
unsigned int _old_host_freshness_check_interval;
std::string _old_host_perfdata_file_processing_command;
unsigned int _old_host_perfdata_file_processing_interval;
unsigned int _old_retention_update_interval;
unsigned int _old_service_freshness_check_interval;
std::string _old_service_perfdata_file_processing_command;
unsigned int _old_service_perfdata_file_processing_interval;
unsigned int _old_status_update_interval;
};
}
}
configuration::state* _config;
timed_event* _evt_check_reaper;
timed_event* _evt_command_check;
timed_event* _evt_hfreshness_check;
timed_event* _evt_host_perfdata;
timed_event* _evt_orphan_check;
timed_event* _evt_reschedule_checks;
timed_event* _evt_retention_save;
timed_event* _evt_sfreshness_check;
timed_event* _evt_service_perfdata;
timed_event* _evt_status_save;
unsigned int _old_auto_rescheduling_interval;
unsigned int _old_check_reaper_interval;
int _old_command_check_interval;
unsigned int _old_host_freshness_check_interval;
std::string _old_host_perfdata_file_processing_command;
unsigned int _old_host_perfdata_file_processing_interval;
unsigned int _old_retention_update_interval;
unsigned int _old_service_freshness_check_interval;
std::string _old_service_perfdata_file_processing_command;
unsigned int _old_service_perfdata_file_processing_interval;
unsigned int _old_status_update_interval;
};
} // namespace applier
} // namespace configuration

CCE_END()

#endif // !CCE_CONFIGURATION_APPLIER_SCHEDULER_HH
#endif // !CCE_CONFIGURATION_APPLIER_SCHEDULER_HH
10 changes: 8 additions & 2 deletions inc/com/centreon/engine/notification.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,28 @@ class notification {
uint32_t options,
uint64_t notification_id,
uint32_t notification_number,
uint32_t notification_interval);
uint32_t notification_interval,
bool escalated = false);
int execute(std::unordered_set<contact*> const& to_notify);
notifier::reason_type get_reason() const;
uint32_t get_notification_interval() const;

private:
friend std::ostream& operator<<(std::ostream& os, notification const& n);

notifier* _parent;
notifier::reason_type _type;
std::string _author;
std::string _message;
uint32_t _options;
bool _escalated;
uint64_t _id;
uint32_t _number;
bool _escalated;
uint32_t _interval;
};

std::ostream& operator<<(std::ostream& os, notification const& obj);

CCE_END()

#endif // !CCE_NOTIFICATION_HH
Loading

0 comments on commit 4185fa1

Please sign in to comment.