1
0
mirror of https://github.com/dennypage/dpinger.git synced 2024-05-19 06:50:01 +00:00

6 Commits
v3.3 ... master

Author SHA1 Message Date
dennypage
664f5c7aa6 Use dpinger defaults for send_interval and time_period 2023-11-08 10:40:52 -08:00
Denny Page
0e963753e1 Use gcc by default 2023-11-08 10:22:58 -08:00
Denny Page
e3cb41889e Add explicit cast for assignment of alarm_hold_periods 2023-11-08 10:08:07 -08:00
dennypage
9c31ea4380 Update default parameters and correct loss calculation
Update parameters to reflect existing defaults and correct the loss resolution calculation when using subsecond send intervals.
2023-11-08 08:29:46 -08:00
Denny Page
fff9b65eb5 Correct usage note regarding loss resolution with subsecond send intervals 2023-11-08 08:07:39 -08:00
Denny Page
47f1a778b9 Correct usage note regarding parameters to the alert_cmd 2023-11-06 15:40:46 -08:00
4 changed files with 10 additions and 10 deletions

View File

@@ -1,8 +1,8 @@
#CC=gcc
#WARNINGS=-Wall -Wextra -Wformat=2 -Wno-unused-result
CC=gcc
WARNINGS=-Wall -Wextra -Wformat=2 -Wno-unused-result
CC=clang
WARNINGS=-Weverything -Wno-padded -Wno-disabled-macro-expansion -Wno-reserved-id-macro
#CC=clang
#WARNINGS=-Weverything -Wno-unsafe-buffer-usage -Wno-cast-function-type-strict -Wno-padded -Wno-disabled-macro-expansion -Wno-reserved-id-macro
CFLAGS=${WARNINGS} -pthread -g -O2

View File

@@ -4,10 +4,10 @@ In general, dpinger works a bit differently than other latency monitors. Rather
When the alert check is made, or a report is generated, dpinger goes through the array and examines each echo request. If a reply has been received, it is used as part of the overall latency calculation. If a reply has not yet been received, the amount of time since the request is compared against the loss interval. If it is greater than the loss interval, the request/reply is counted as lost in the current report. However the concept of the request/reply being lost is not a permanent decision. In subsequent reports, if a the missing reply has been received, its latency will be used instead of being counted as lost.
It's important to keep in mind that latency and loss are reported as averages across the entire request set. The default time period for dpinger is 30 seconds, with an echo request being sent every 250 milliseconds. This means that the latency and loss will be reported as averages across 115-120 samples. The alert check runs every second by default. So each time, the 4 oldest entries in the set have been replaced by the 4 newest ones.
It's important to keep in mind that latency and loss are reported as averages across the entire request set. The default time period for dpinger is 60 seconds, with an echo request being sent every 500 milliseconds. This means that the latency and loss will be reported as averages across 116-120 samples. The alert check runs every second by default. So each time, the 4 oldest entries in the set have been replaced by the 4 newest ones.
Note that if you want accurate loss reporting, it is important that the number of samples be sufficient. In order to achieve 1% loss resolution, you have need more than 100 samples in the set. The calculation for loss resolution is:
100 * send_interval / (time_period - loss_interval)
100 / ((time_period - loss_interval) / send_interval)
The default settings for dpinger report loss with an accuracy of 0.87%.

View File

@@ -606,7 +606,7 @@ alert_thread(
sleeptime.tv_nsec = (alert_interval_msec % 1000) * 1000000;
// Set number of alarm hold periods
alarm_hold_periods = (alarm_hold_msec + alert_interval_msec - 1) / alert_interval_msec;
alarm_hold_periods = (unsigned int) ((alarm_hold_msec + alert_interval_msec - 1) / alert_interval_msec);
while (1)
{
@@ -878,8 +878,8 @@ usage(void)
fprintf(stderr, " the output format is \"latency_avg latency_stddev loss_pct\"\n");
fprintf(stderr, " latency values are output in microseconds\n");
fprintf(stderr, " loss percentage is reported in whole numbers of 0-100\n");
fprintf(stderr, " resolution of loss calculation is: 100 * send_interval / (time_period - loss_interval)\n\n");
fprintf(stderr, " the alert_cmd is invoked as \"alert_cmd dest_addr alarm_flag latency_avg loss_avg\"\n");
fprintf(stderr, " resolution of loss calculation is: 100 / ((time_period - loss_interval) / send_interval)\n\n");
fprintf(stderr, " the alert_cmd is invoked as \"alert_cmd dest_addr alarm_flag latency_avg latency_stddev loss_pct\"\n");
fprintf(stderr, " alarm_flag is set to 1 if either latency or loss is in alarm state\n");
fprintf(stderr, " alarm_flag will return to 0 when both have have cleared alarm state\n");
fprintf(stderr, " alarm hold time begins when the source of the alarm retruns to normal\n\n");

View File

@@ -41,7 +41,7 @@ influx_pass = os.getenv('INFLUX_PASS')
# Set up dpinger command
cmd = [dpinger_path, "-f"]
cmd.extend(sys.argv)
cmd.extend(["-s", "1s", "-t", "60s", "-r", "10s", target])
cmd.extend(["-r", "10s", target])
# Set up formats
url = '{0}/write?db={1}'.format(influx_url, influx_db)