Skip to content

Commit

Permalink
Merge branch 'upstream' into pr/419
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Sep 7, 2023
2 parents d6c4c6e + 12de0b0 commit d24cc50
Show file tree
Hide file tree
Showing 31 changed files with 265 additions and 430 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Welcome to Naemon Core ##

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/naemon/naemon-core/citest)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/naemon/naemon-core/citest.yml)

Naemon is a host/service/network monitoring program written in C and
released under the GNU General Public License. It works by scheduling
Expand Down
1 change: 0 additions & 1 deletion naemon-core.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Packager: Naemon Core Development Team <[email protected]>
Vendor: Naemon Core Development Team
Source0: naemon-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
Obsoletes: naemon-tools
BuildRequires: gperf
BuildRequires: logrotate
BuildRequires: autoconf
Expand Down
2 changes: 1 addition & 1 deletion src/naemon/broker.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
/****** EVENT FLAGS ************************/

#define NEBFLAG_NONE 0
#define NEBFLAG_PROCESS_INITIATED 1 /* event was initiated by Nagios process */
#define NEBFLAG_PROCESS_INITIATED 1 /* event was initiated by Naemon process */
#define NEBFLAG_USER_INITIATED 2 /* event was initiated by a user request */
#define NEBFLAG_MODULE_INITIATED 3 /* event was initiated by an event broker module */

Expand Down
5 changes: 1 addition & 4 deletions src/naemon/checks_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,14 @@ static void handle_host_check_event(struct nm_event_execution_properties *evprop
host *hst = (host *)evprop->user_data;
double latency;
struct timeval tv;
struct timeval event_runtime;
int options = hst->check_options;

int result = OK;

if (evprop->execution_type == EVENT_EXEC_NORMAL) {
/* get event latency */
latency = evprop->attributes.timed.latency;
gettimeofday(&tv, NULL);
event_runtime.tv_sec = hst->next_check;
event_runtime.tv_usec = 0;
latency = (double)(tv_delta_f(&event_runtime, &tv));

/* When the callback is called, the pointer to the timed event is invalid */
hst->next_check_event = NULL;
Expand Down
7 changes: 3 additions & 4 deletions src/naemon/checks_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ static void handle_service_check_event(struct nm_event_execution_properties *evp
int nudge_seconds = 0;
double latency;
struct timeval tv;
struct timeval event_runtime;
int options = temp_service->check_options;
host *temp_host = NULL;

Expand All @@ -152,10 +151,8 @@ static void handle_service_check_event(struct nm_event_execution_properties *evp
if (evprop->execution_type == EVENT_EXEC_NORMAL) {

/* get event latency */
latency = evprop->attributes.timed.latency;
gettimeofday(&tv, NULL);
event_runtime.tv_sec = temp_service->next_check;
event_runtime.tv_usec = 0;
latency = (double)(tv_delta_f(&event_runtime, &tv));

/* When the callback is called, the pointer to the timed event is invalid */
temp_service->next_check_event = NULL;
Expand Down Expand Up @@ -486,6 +483,8 @@ int handle_async_service_check_result(service *temp_service, check_result *queue
/* was this check passive or active? */
temp_service->check_type = (queued_check_result->check_type == CHECK_TYPE_ACTIVE) ? CHECK_TYPE_ACTIVE : CHECK_TYPE_PASSIVE;

temp_service->latency = queued_check_result->latency;

/* update check statistics for passive checks */
if (queued_check_result->check_type == CHECK_TYPE_PASSIVE)
update_check_stats(PASSIVE_SERVICE_CHECK_STATS, queued_check_result->start_time.tv_sec);
Expand Down
7 changes: 4 additions & 3 deletions src/naemon/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ int close_command_file(void)
command_file_created = FALSE;

/* close the command file */
fclose(command_file_fp);
if (command_file_fp != NULL)
fclose(command_file_fp);

return OK;
}
Expand Down Expand Up @@ -1848,7 +1849,7 @@ static int host_command_handler(const struct external_command *ext_command, time
}
return OK;
case CMD_DEL_ALL_HOST_COMMENTS:
return delete_all_host_comments(target_host->name);
return delete_all_host_comments(target_host);
case CMD_ENABLE_HOST_NOTIFICATIONS:
enable_host_notifications(target_host);
return OK;
Expand Down Expand Up @@ -2251,7 +2252,7 @@ static int service_command_handler(const struct external_command *ext_command, t
target_service->next_notification = GV_TIMESTAMP("notification_time");
return OK;
case CMD_DEL_ALL_SVC_COMMENTS:
return delete_all_comments(SERVICE_COMMENT, target_service->host_name, target_service->description);
return delete_all_service_comments(target_service);
case CMD_ENABLE_SVC_NOTIFICATIONS:
enable_service_notifications(target_service);
return OK;
Expand Down
Loading

0 comments on commit d24cc50

Please sign in to comment.