mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-07-15 19:52:58 -04:00
check_ntp_time: add polling delay
NTP server can have rate limiting which might be triggered by check_ntp_time due to many requests in a short time span. This patch adds a default delay (of 0.5s) between requests to each server and a command line option (--poll-delay) to make this delay configurable. Co-authored-by: Lorenz Kästle <lorenz@vulgrim.de>
This commit is contained in:
parent
cc8d5b55de
commit
8a0dca477a
1 changed files with 5 additions and 0 deletions
|
|
@ -5,6 +5,9 @@
|
|||
#include "thresholds.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/* Time in microseconds to delay between polling to avoid a blocking response. */
|
||||
const long default_polling_delay = 500000L;
|
||||
|
||||
typedef struct {
|
||||
char *server_address;
|
||||
char *port;
|
||||
|
|
@ -15,6 +18,7 @@ typedef struct {
|
|||
mp_thresholds offset_thresholds;
|
||||
|
||||
bool output_format_is_set;
|
||||
long poll_delay;
|
||||
mp_output_format output_format;
|
||||
} check_ntp_time_config;
|
||||
|
||||
|
|
@ -29,6 +33,7 @@ check_ntp_time_config check_ntp_time_config_init() {
|
|||
.offset_thresholds = mp_thresholds_init(),
|
||||
|
||||
.output_format_is_set = false,
|
||||
.poll_delay = default_polling_delay,
|
||||
};
|
||||
|
||||
mp_range warning = mp_range_init();
|
||||
|
|
|
|||
Loading…
Reference in a new issue