mirror of
https://github.com/dennypage/dpinger.git
synced 2024-05-19 06:50:01 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6796fa0752 | ||
|
|
24022ac098 | ||
|
|
42c84e965e |
@@ -354,12 +354,12 @@ send_thread(
|
||||
sched_yield();
|
||||
clock_gettime(CLOCK_MONOTONIC, &array[next_slot].time_sent);
|
||||
|
||||
array[next_slot].status = PACKET_STATUS_SENT;
|
||||
len = sendto(send_sock, echo_request, echo_request_len, 0, (struct sockaddr *) &dest_addr, dest_addr_len);
|
||||
if (len == -1)
|
||||
{
|
||||
logger("%s%s: sendto error: %d\n", identifier, dest_str, errno);
|
||||
}
|
||||
array[next_slot].status = PACKET_STATUS_SENT;
|
||||
|
||||
next_slot = (next_slot + 1) % array_size;
|
||||
next_sequence = (next_sequence + 1) % sequence_limit;
|
||||
@@ -471,7 +471,7 @@ report(
|
||||
packets_received++;
|
||||
latency_usec = array[slot].latency_usec;
|
||||
total_latency_usec += latency_usec;
|
||||
total_latency_usec2 += latency_usec * latency_usec;
|
||||
total_latency_usec2 += (unsigned long long) latency_usec * latency_usec;
|
||||
}
|
||||
else if (array[slot].status == PACKET_STATUS_SENT &&
|
||||
ts_elapsed_usec(&array[slot].time_sent, &now) > loss_interval_usec)
|
||||
|
||||
@@ -10,10 +10,21 @@ name="$1"
|
||||
rrdfile="${name}.rrd"
|
||||
echo "Creating rrd file ${rrdfile}"
|
||||
|
||||
rrdtool create "${rrdfile}" --step 1m \
|
||||
DS:latency:GAUGE:5m:0:U \
|
||||
DS:stddev:GAUGE:5m:0:U \
|
||||
DS:loss:GAUGE:5m:0:100 \
|
||||
RRA:AVERAGE:0.5:1m:15d \
|
||||
RRA:AVERAGE:0.5:5m:90d \
|
||||
RRA:AVERAGE:0.5:1h:3y
|
||||
|
||||
# Time duration method doesn't work in all versions of rrdtool
|
||||
#rrdtool create "${rrdfile}" --step 1m \
|
||||
# DS:latency:GAUGE:5m:0:U \
|
||||
# DS:stddev:GAUGE:5m:0:U \
|
||||
# DS:loss:GAUGE:5m:0:100 \
|
||||
# RRA:AVERAGE:0.5:1m:15d \
|
||||
# RRA:AVERAGE:0.5:5m:90d \
|
||||
# RRA:AVERAGE:0.5:1h:3y
|
||||
|
||||
# This method works in all versions
|
||||
rrdtool create "${rrdfile}" --step 60 \
|
||||
DS:latency:GAUGE:300:0:U \
|
||||
DS:stddev:GAUGE:300:0:U \
|
||||
DS:loss:GAUGE:300:0:100 \
|
||||
RRA:AVERAGE:0.5:1:21600 \
|
||||
RRA:AVERAGE:0.5:5:25920 \
|
||||
RRA:AVERAGE:0.5:60:26352
|
||||
|
||||
Reference in New Issue
Block a user