diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2022-10-26 21:40:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 21:40:30 +0300 |
commit | e4cc55d8cbe979fd332a47a6c6104605b71f2b96 (patch) | |
tree | 9a84bc88d4de9a6a492eff60a1c17e1a4f114613 /collectors | |
parent | 88c03ca74a49a90943d7141ef1896d120718439f (diff) |
fix(proc.plugin): fix read retry logic when reading interface speed (#13893)
Diffstat (limited to 'collectors')
-rw-r--r-- | collectors/proc.plugin/proc_net_dev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c index dc6c71e97f..0b5fb4606f 100644 --- a/collectors/proc.plugin/proc_net_dev.c +++ b/collectors/proc.plugin/proc_net_dev.c @@ -1015,7 +1015,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { (d->speed_file_exists || now_monotonic_sec() - d->speed_file_lost_time > READ_RETRY_PERIOD)) { ret = read_single_number_file(d->filename_speed, (unsigned long long *) &d->speed); } else { - d->speed = 0; + d->speed = 0; // TODO: this is wrong, shouldn't use 0 value, but NULL. } if(ret) { @@ -1057,8 +1057,10 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdsetvar_custom_chart_variable_set( d->st_bandwidth, d->chart_var_speed, (NETDATA_DOUBLE)d->speed * KILOBITS_IN_A_MEGABIT); - d->speed_file_exists = 1; - d->speed_file_lost_time = 0; + if (d->speed) { + d->speed_file_exists = 1; + d->speed_file_lost_time = 0; + } } } } |