Commit 868de52b authored by Alexander Wirt's avatar Alexander Wirt

Imported Upstream version 1.8.2

parent fb9c4cb8
......@@ -12,11 +12,46 @@ UPGRADE NOTES
- core, classic ui: sample-config/updates/
- idoutils: module/idoutils/config/updates
1.8.2 - 28/11/2012
FIXES
* core: fix macro escaping logs incorrect warning for $$escapes #3404 - MF
* core: fix wrong escalation notification due to state based escalation range behaviour changes #3441 - MF
* idoutils: fix many memory leaks in ido2db on dbi_result_free and others (thx Klaus Wagner) #3406 - MF
* idoutils: fix ido2db crashes when Oracle queries fail #3324 - GB
* idoutils: fix ORA-1461 writing data to varchar2 exceeding field size limit output, command_arg and commandline data written to Oracle #3324 #3325 - TD
* idoutils: fix unsafe handling of dbi_conn_sequence_last, rewrite last_insert_id/sequence fetching #3408 - MF
* idoutils: fix ido2db does not cleanly exit the client on wrong schema version check in db_hello #3419 - MF
* idoutils: fix FROM_UNIXTIME(NULL) does not work with MySQL 5.0.x #3399 #3466 - CF
* install: drop unused daemon-init-readhat script (spec uses daemon-init) #3402 - MF
* install: fix broken configure ssl detection for idoutils on ubuntu/debian (Oliver Skibbe) #3413 - MF
* classic ui: fix cmd.cgi does not honor commandpipe location; overwrites from empty environment variable #3418 - MF
* classic ui: fixed double-listed host dependencies in host extinfo.cgi #3295 - RB
* classic ui: fixed sort_icinga_logfiles_by_name() in readlogs.c fails to take NULL pointers into consideration #3398 - CF
* classic ui: fixed committing acknowledgement cmd negates flags for send_notification and sticky_ack #3329 - RB
* classic ui: fixed backtrack_archives only getting calculated on a daily log rotation basis #3416 - RB
* classic ui: fixed invalid freeing of last_check in 'scheduling queue' for first time checks #3444 - RB
* docs: add missing cmd_mod description in cgi params #3438 - MF
* docs: search_string as cgi GET param works also for status.cgi #3451 - MF
* docs: fix typo pqsql -> pgsql #3461 - WN
CHANGES
* icinga.cfg - enable_state_based_escalation_ranges=0 (disabled if not set) fix for #3441
1.8.1 - 25/10/2012
FIXES
* core: fix faulty macro cleaning, replacing spaces with pluses where they shouldn't be cleaned #3397 - MF
* icinga.cfg - enable_state_based_escalation_ranges=0 (disabled if not set) fix for #3441
1.8.0 - 18/10/2012
host object attributes 'vrml_image' and '3dcoords' are deprecated due to the removal of the 3d statusmap (statuswrl).
......
......@@ -78,7 +78,7 @@ MKDIR=/bin/mkdir
###############################
# Global
###############################
ICINGA_VERSION=1.8.1
ICINGA_VERSION=1.8.2
CP=@CP@
......@@ -267,7 +267,7 @@ distclean: clean
cd $(SRC_TAP) && $(MAKE) $@; \
rm -f sample-config/*.cfg sample-config/*.conf sample-config/template-object/*.cfg
rm -f daemon-init pkginfo rc.ido2db daemon-init-redhat
rm -f daemon-init pkginfo rc.ido2db
rm -f include/dh.h
rm -f Makefile subst p1.pl
rm -f config.log config.status config.cache
......
......@@ -326,6 +326,7 @@ in various ways. If we missed your name, let us know.
* Dave Viner
* Ton Voon
* Lars Vogdt
* Klaus Wagner
* Phil Walther
* Jeremy Weatherford
* Holger Weiss
......
......@@ -228,6 +228,7 @@ extern unsigned long max_debug_file_size;
extern int allow_empty_hostgroup_assignment;
extern unsigned long max_check_result_list_items;
extern int enable_state_based_escalation_ranges;
/* make sure gcc3 won't hit here */
#ifndef GCCTOOOLD
......@@ -1469,6 +1470,16 @@ int read_main_config_file(char *main_config_file) {
else if (!strcmp(variable, "max_check_result_list_items"))
max_check_result_list_items = strtoul(value, NULL, 0);
else if (!strcmp(variable, "enable_state_based_escalation_ranges")) {
if (strlen(value) != 1 || value[0] < '0' || value[0] > '1') {
dummy = asprintf(&error_message, "Illegal value for enable_state_based_escalation_ranges");
error = TRUE;
break;
}
enable_state_based_escalation_ranges = (atoi(value) > 0) ? TRUE : FALSE;
}
/*** AUTH_FILE VARIABLE USED BY EMBEDDED PERL INTERPRETER ***/
else if (!strcmp(variable, "auth_file")) {
......
......@@ -287,6 +287,8 @@ unsigned long max_debug_file_size = DEFAULT_MAX_DEBUG_FILE_SIZE;
unsigned long max_check_result_list_items = DEFAULT_MAX_CHECK_RESULT_LIST_ITEMS;
int enable_state_based_escalation_ranges = FALSE;
int dummy; /* reduce compiler warnings */
......
......@@ -50,6 +50,8 @@ extern unsigned long next_notification_id;
extern char *generic_summary;
extern int enable_state_based_escalation_ranges;
int check_escalation_condition(escalation_condition*);
int dummy; /* reduce compiler warnings */
......@@ -964,59 +966,62 @@ int is_valid_escalation_for_service_notification(service *svc, serviceescalation
if (options & NOTIFICATION_OPTION_BROADCAST)
return TRUE;
/* state based escalation ranges */
/* skip this escalation if it happens later
* Only skip if none of the notifications numbers match */
if (se->first_notification == -2 || se->first_notification > notification_number)
widematch = 0;
if (!widematch) {
switch (svc->current_state) {
case STATE_WARNING: {
if (se->first_warning_notification == -2 || se->first_warning_notification > warning_notification_number)
return FALSE;
break;
}
case STATE_CRITICAL: {
if (se->first_critical_notification == -2 || se->first_critical_notification > critical_notification_number)
return FALSE;
break;
}
case STATE_UNKNOWN: {
if (se->first_unknown_notification == -2 || se->first_unknown_notification > unknown_notification_number)
return FALSE;
break;
}
/* skip this escalation if it happens later */
if (enable_state_based_escalation_ranges == FALSE) {
if (se->first_notification > notification_number)
return FALSE;
} else {
/* state based escalation ranges
* Only skip if none of the notifications numbers match */
if (se->first_notification == -2 || se->first_notification > notification_number)
widematch = 0;
if (!widematch) {
switch (svc->current_state) {
case STATE_WARNING:
if (se->first_warning_notification == -2 || se->first_warning_notification > warning_notification_number)
return FALSE;
break;
case STATE_CRITICAL:
if (se->first_critical_notification == -2 || se->first_critical_notification > critical_notification_number)
return FALSE;
break;
case STATE_UNKNOWN:
if (se->first_unknown_notification == -2 || se->first_unknown_notification > unknown_notification_number)
return FALSE;
break;
}
}
}
/* skip this escalation if it has already passed
* only skip if none of the notifications numbers match */
widematch = 1;
if (se->last_notification == -2 || ((se->last_notification != 0) && (se->last_notification < notification_number)))
widematch = 0;
if (!widematch) {
switch (svc->current_state) {
case STATE_WARNING: {
if (se->last_warning_notification == -2 || ((se->last_warning_notification != 0) && (se->last_warning_notification < warning_notification_number)))
return FALSE;
break;
}
case STATE_CRITICAL: {
if (se->last_critical_notification == -2 || ((se->last_critical_notification != 0) && (se->last_critical_notification < critical_notification_number)))
return FALSE;
break;
}
case STATE_UNKNOWN: {
if (se->last_unknown_notification == -2 || ((se->last_unknown_notification != 0) && (se->last_unknown_notification < unknown_notification_number)))
return FALSE;
break;
}
/* skip this escalation if it has already passed */
if (enable_state_based_escalation_ranges == FALSE) {
if (se->last_notification != 0 && se->last_notification < notification_number)
return FALSE;
} else {
/* state based escalation ranges
* only skip if none of the notifications numbers match */
widematch = 1;
if (se->last_notification == -2 || ((se->last_notification != 0) && (se->last_notification < notification_number)))
widematch = 0;
if (!widematch) {
switch (svc->current_state) {
case STATE_WARNING:
if (se->last_warning_notification == -2 || ((se->last_warning_notification != 0) && (se->last_warning_notification < warning_notification_number)))
return FALSE;
break;
case STATE_CRITICAL:
if (se->last_critical_notification == -2 || ((se->last_critical_notification != 0) && (se->last_critical_notification < critical_notification_number)))
return FALSE;
break;
case STATE_UNKNOWN:
if (se->last_unknown_notification == -2 || ((se->last_unknown_notification != 0) && (se->last_unknown_notification < unknown_notification_number)))
return FALSE;
break;
}
}
}
......@@ -2073,43 +2078,50 @@ int is_valid_escalation_for_host_notification(host *hst, hostescalation *he, int
if (options & NOTIFICATION_OPTION_BROADCAST)
return TRUE;
/* state based escalation ranges */
/* skip this escalation if it happens later */
if (he->first_notification == -2 || he->first_notification > notification_number)
widematch = 0;
if (!widematch) {
switch (hst->current_state) {
case HOST_DOWN: {
if (he->first_down_notification == -2 || he->first_down_notification > down_notification_number)
return FALSE;
break;
}
case HOST_UNREACHABLE: {
if (he->first_unreachable_notification == -2 || he->first_unreachable_notification > unreachable_notification_number)
return FALSE;
break;
}
if (enable_state_based_escalation_ranges == FALSE) {
if (he->first_notification > notification_number)
return FALSE;
} else {
/* state based escalation ranges */
if (he->first_notification == -2 || he->first_notification > notification_number)
widematch = 0;
if (!widematch) {
switch (hst->current_state) {
case HOST_DOWN:
if (he->first_down_notification == -2 || he->first_down_notification > down_notification_number)
return FALSE;
break;
case HOST_UNREACHABLE:
if (he->first_unreachable_notification == -2 || he->first_unreachable_notification > unreachable_notification_number)
return FALSE;
break;
}
}
}
/* skip this escalation if it has already passed. only skip if none match */
widematch = 1;
if ((he->last_notification == -2) || ((he->last_notification != 0) && (he->last_notification < notification_number)))
widematch = 0;
if (!widematch) {
switch (hst->current_state) {
case HOST_DOWN: {
if ((he->last_down_notification == -2) || ((he->last_down_notification != 0) && (he->last_down_notification < down_notification_number)))
return FALSE;
break;
}
case HOST_UNREACHABLE: {
if ((he->last_unreachable_notification == -2) || ((he->last_unreachable_notification) && (he->last_unreachable_notification < unreachable_notification_number)))
return FALSE;
break;
}
/* skip this escalation if it has already passed */
if (enable_state_based_escalation_ranges == FALSE) {
if (he->last_notification != 0 && he->last_notification < notification_number)
return FALSE;
} else {
/* state based escalation ranges */
widematch = 1;
if ((he->last_notification == -2) || ((he->last_notification != 0) && (he->last_notification < notification_number)))
widematch = 0;
if (!widematch) {
switch (hst->current_state) {
case HOST_DOWN:
if ((he->last_down_notification == -2) || ((he->last_down_notification != 0) && (he->last_down_notification < down_notification_number)))
return FALSE;
break;
case HOST_UNREACHABLE:
if ((he->last_unreachable_notification == -2) || ((he->last_unreachable_notification) && (he->last_unreachable_notification < unreachable_notification_number)))
return FALSE;
break;
}
}
}
......
......@@ -2868,7 +2868,7 @@ void read_archived_state_data(void) {
logentry *entry_list = NULL;
logfilter *filter_list = NULL;
status = get_log_entries(&entry_list, &filter_list, &error_text, NULL, FALSE, t1 - (60 * 60 * 24 * backtrack_archives), t2);
status = get_log_entries(&entry_list, &filter_list, &error_text, NULL, FALSE, t1 - get_backtrack_seconds(backtrack_archives), t2);
if (status != READLOG_ERROR_FATAL) {
......
......@@ -346,7 +346,7 @@ char * get_cmd_file_location(void) {
/* stay compatible */
cmdloc = getenv("NAGIOS_COMMAND_FILE");
if (!cmdloc) {
cmdloc = DEFAULT_COMMAND_FILE;
cmdloc = command_file;
}
}
}
......
......@@ -77,36 +77,32 @@ extern comment *comment_list;
/** @name ELEMET TEMPLATE TYPES
@{**/
#define PRINT_COMMON_HEADER 1
#define PRINT_AUTHOR 2
#define PRINT_STICKY_ACK 3
#define PRINT_PERSISTENT 4
#define PRINT_SEND_NOTFICATION 5
#define PRINT_COMMENT_BOX 6
#define PRINT_NOTIFICATION_DELAY 7
#define PRINT_START_TIME 8
#define PRINT_END_TIME 9
#define PRINT_CHECK_TIME 10
#define PRINT_FORCE_CHECK 11
#define PRINT_CHECK_OUTPUT_BOX 12
#define PRINT_PERFORMANCE_DATA_BOX 13
#define PRINT_FIXED_FLEXIBLE_TYPE 14
#define PRINT_BROADCAST_NOTIFICATION 15
#define PRINT_FORCE_NOTIFICATION 16
#define PRINT_EXPIRE_ACKNOWLEDGEMENT 17
#define PRINT_COMMON_HEADER 1
#define PRINT_AUTHOR 2
#define PRINT_STICKY_ACK 3
#define PRINT_PERSISTENT 4
#define PRINT_SEND_NOTFICATION 5
#define PRINT_COMMENT_BOX 6
#define PRINT_NOTIFICATION_DELAY 7
#define PRINT_START_TIME 8
#define PRINT_END_TIME 9
#define PRINT_CHECK_TIME 10
#define PRINT_FORCE_CHECK 11
#define PRINT_CHECK_OUTPUT_BOX 12
#define PRINT_PERFORMANCE_DATA_BOX 13
#define PRINT_FIXED_FLEXIBLE_TYPE 14
#define PRINT_BROADCAST_NOTIFICATION 15
#define PRINT_FORCE_NOTIFICATION 16
#define PRINT_EXPIRE_ACKNOWLEDGEMENT 17
#define PRINT_EXPIRE_DISABLE_NOTIFICATIONS 18
/** @}*/
/** @name OBJECT LIST TYPES
@{**/
#define PRINT_HOST_LIST 17
#define PRINT_SERVICE_LIST 18
#define PRINT_COMMENT_LIST 19
#define PRINT_DOWNTIME_LIST 20
/** @}*/
/** @name NOTIFICATION LIST TYPES
@{**/
#define PRINT_EXPIRE_DISABLE_NOTIFICATIONS 21
#define PRINT_HOST_LIST 19
#define PRINT_SERVICE_LIST 20
#define PRINT_COMMENT_LIST 21
#define PRINT_DOWNTIME_LIST 22
/** @}*/
/** @brief host/service list structure
......@@ -410,6 +406,8 @@ int process_cgivars(void) {
int error = FALSE;
int x;
int z = 0;
int sticky_ack_set = FALSE; /* default is TRUE */
int send_notification_set = FALSE; /* default is TRUE */
variables = getcgivars();
......@@ -609,24 +607,12 @@ int process_cgivars(void) {
persistent_comment = TRUE;
/* we got the notification option for an acknowledgement */
else if (!strcmp(variables[x], "send_notification")) {
x++;
if (variables[x] == NULL) {
error = TRUE;
break;
}
send_notification = (atoi(variables[x]) > 0) ? TRUE : FALSE;
}
else if (!strcmp(variables[x], "send_notification"))
send_notification_set = TRUE;
/* we got the acknowledgement type */
else if (!strcmp(variables[x], "sticky_ack")) {
x++;
if (variables[x] == NULL) {
error = TRUE;
break;
}
sticky_ack = (atoi(variables[x]) > 0) ? TRUE : FALSE;
}
else if (!strcmp(variables[x], "sticky_ack"))
sticky_ack_set = TRUE;
/* we use the end_time as expire time */
else if (!strcmp(variables[x], "use_ack_end_time"))
......@@ -798,6 +784,11 @@ int process_cgivars(void) {
}
if (command_mode == CMDMODE_COMMIT) {
send_notification = send_notification_set;
sticky_ack = sticky_ack_set;
}
/* free memory allocated to the CGI variables */
free_cgivars(variables);
......
......@@ -183,6 +183,7 @@ int main(void) {
service *temp_service = NULL;
servicegroup *temp_servicegroup = NULL;
servicedependency *temp_sd = NULL;
char *last_hd_hostname = "";
char *last_sd_svc_desc = "";
char *last_sd_hostname = "";
hostdependency *temp_hd = NULL;
......@@ -464,17 +465,20 @@ int main(void) {
/* Host Dependencies */
found = FALSE;
printf("<DIV CLASS='data'>Host Dependencies</DIV><DIV CLASS='dataTitle'>");
printf("<DIV CLASS='data'>Host Dependencies ");
printf("<img id='expand_image_hd' src='%s%s' border=0 onClick=\"if (document.getElementById('host_dependencies').style.display == 'none') { document.getElementById('host_dependencies').style.display = ''; document.getElementById('host_dependencies_gap').style.display = 'none'; document.getElementById('expand_image_hd').src = '%s%s'; } else { document.getElementById('host_dependencies').style.display = 'none'; document.getElementById('host_dependencies_gap').style.display = ''; document.getElementById('expand_image_hd').src = '%s%s'; }\">", url_images_path, EXPAND_ICON, url_images_path, COLLAPSE_ICON, url_images_path, EXPAND_ICON);
printf("</DIV><DIV CLASS='dataTitle' id='host_dependencies_gap' style='display:;'>&nbsp;</DIV><DIV CLASS='dataTitle' id='host_dependencies' style='display:none;'>");
for (temp_hd = hostdependency_list; temp_hd != NULL; temp_hd = temp_hd->next) {
if (!strcmp(temp_hd->dependent_host_name, temp_host->name)) {
if (!strcmp(temp_hd->dependent_host_name, temp_host->name) && !strcmp(temp_hd->host_name, last_hd_hostname)) {
if (found == TRUE)
printf(", ");
printf("<A HREF='%s?type=%d&host=%s'>%s</A>\n", EXTINFO_CGI, DISPLAY_HOST_INFO, url_encode(temp_hd->host_name), html_encode(temp_hd->host_name, FALSE));
found = TRUE;
}
last_hd_hostname = temp_hd->host_name;
}
if (found == FALSE)
......@@ -516,7 +520,9 @@ int main(void) {
/* Service Dependencies */
found = FALSE;
printf("<DIV CLASS='data'>Service Dependencies</DIV><DIV CLASS='dataTitle'>");
printf("<DIV CLASS='data'>Service Dependencies ");
printf("<img id='expand_image_sd' src='%s%s' border=0 onClick=\"if (document.getElementById('service_dependencies').style.display == 'none') { document.getElementById('service_dependencies').style.display = ''; document.getElementById('service_dependencies_gap').style.display = 'none'; document.getElementById('expand_image_sd').src = '%s%s'; } else { document.getElementById('service_dependencies').style.display = 'none'; document.getElementById('service_dependencies_gap').style.display = ''; document.getElementById('expand_image_sd').src = '%s%s'; }\">", url_images_path, EXPAND_ICON, url_images_path, COLLAPSE_ICON, url_images_path, EXPAND_ICON);
printf("</DIV><DIV CLASS='dataTitle' id='service_dependencies_gap' style='display:;'>&nbsp;</DIV><DIV CLASS='dataTitle' id='service_dependencies' style='display:none;'>");
for (temp_sd = servicedependency_list; temp_sd != NULL; temp_sd = temp_sd->next) {
......@@ -3596,11 +3602,11 @@ void show_scheduling_queue(void) {
/* last check */
get_time_string(&temp_svcstatus->last_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
last_check = (temp_svcstatus->last_check == (time_t)0) ? "N/A" : strdup(date_time);
last_check = (temp_svcstatus->last_check == (time_t)0) ? strdup("N/A") : strdup(date_time);
/* next check */
get_time_string(&temp_svcstatus->next_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
next_check = (temp_svcstatus->next_check == (time_t)0) ? "N/A" : strdup(date_time);
next_check = (temp_svcstatus->next_check == (time_t)0) ? strdup("N/A") : strdup(date_time);
/* type */
if (temp_svcstatus->check_options == CHECK_OPTION_NONE)
......@@ -3650,11 +3656,11 @@ void show_scheduling_queue(void) {
/* last check */
get_time_string(&temp_hststatus->last_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
last_check = (temp_hststatus->last_check == (time_t)0) ? "N/A" : strdup(date_time);
last_check = (temp_hststatus->last_check == (time_t)0) ? strdup("N/A") : strdup(date_time);
/* next check */
get_time_string(&temp_hststatus->next_check, date_time, (int)sizeof(date_time), SHORT_DATE_TIME);
next_check = (temp_hststatus->next_check == (time_t)0) ? "N/A" : strdup(date_time);
next_check = (temp_hststatus->next_check == (time_t)0) ? strdup("N/A") : strdup(date_time);
/* type */
if (temp_hststatus->check_options == CHECK_OPTION_NONE)
......
......@@ -2046,7 +2046,7 @@ void read_archived_state_data(void) {
add_log_filter(&filter_list, LOGENTRY_SHUTDOWN,