Skip to content

Commit 957424b

Browse files
Merge pull request #955 from tsadpbb/910-downtime-wrong-comment-time
Fix [#910]: Register downtime used current time in comment instread of entry time
2 parents be5cfa7 + 321cc3c commit 957424b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Changelog

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Nagios Core 4 Change Log
66
------------------
77
* Fix handling of timeperiods w/ downtime availability calculations in the Availability CGI report (Sebastian Wolf)
88
* Fix build when compiling against musl libc (#952) (Sebastian Wolf)
9+
* Fix downtime comment using current time instead of the downtime's entry time (#910) (Dylan Anderson)
910

1011
4.5.1 - 2024-02-28
1112
-------------------

common/downtime.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ int register_downtime(int type, unsigned long downtime_id) {
464464

465465
/* add a non-persistent comment to the host or service regarding the scheduled outage */
466466
if(temp_downtime->type == SERVICE_DOWNTIME)
467-
add_new_comment(SERVICE_COMMENT, DOWNTIME_COMMENT, svc->host_name, svc->description, time(NULL), ( NULL == temp_downtime->author ? "(Nagios Process)" : temp_downtime->author), temp_buffer, 0, COMMENTSOURCE_INTERNAL, FALSE, (time_t)0, &(temp_downtime->comment_id));
467+
add_new_comment(SERVICE_COMMENT, DOWNTIME_COMMENT, svc->host_name, svc->description, temp_downtime->entry_time, ( NULL == temp_downtime->author ? "(Nagios Process)" : temp_downtime->author), temp_buffer, 0, COMMENTSOURCE_INTERNAL, FALSE, (time_t)0, &(temp_downtime->comment_id));
468468
else
469-
add_new_comment(HOST_COMMENT, DOWNTIME_COMMENT, hst->name, NULL, time(NULL), ( NULL == temp_downtime->author ? "(Nagios Process)" : temp_downtime->author), temp_buffer, 0, COMMENTSOURCE_INTERNAL, FALSE, (time_t)0, &(temp_downtime->comment_id));
469+
add_new_comment(HOST_COMMENT, DOWNTIME_COMMENT, hst->name, NULL, temp_downtime->entry_time, ( NULL == temp_downtime->author ? "(Nagios Process)" : temp_downtime->author), temp_buffer, 0, COMMENTSOURCE_INTERNAL, FALSE, (time_t)0, &(temp_downtime->comment_id));
470470

471471
my_free(temp_buffer);
472472

0 commit comments

Comments
 (0)