X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Finterface.c;h=ea820399ca0652bc7299d2b24ee4dde9c5569ecd;hb=d0bb20feb1c5915e8b8af24cc2d46c4ac82d6704;hp=c1e28e32c962aff7a3393ae321634affb6a44be1;hpb=4dc9287f4de0283ae986444377075dcbdada2871;p=collectd.git diff --git a/src/interface.c b/src/interface.c index c1e28e32..ea820399 100644 --- a/src/interface.c +++ b/src/interface.c @@ -296,16 +296,29 @@ static int interface_read (void) if (kstat_read (kc, ksp[i], NULL) == -1) continue; - rx = get_kstat_value (ksp[i], "rbytes"); - tx = get_kstat_value (ksp[i], "obytes"); + /* try to get 64bit counters */ + rx = get_kstat_value (ksp[i], "rbytes64"); + tx = get_kstat_value (ksp[i], "obytes64"); + /* or fallback to 32bit */ + if (rx == -1LL) + rx = get_kstat_value (ksp[i], "rbytes"); + if (tx == -1LL) + tx = get_kstat_value (ksp[i], "obytes"); if ((rx != -1LL) || (tx != -1LL)) if_submit (ksp[i]->ks_name, "if_octets", rx, tx); - rx = get_kstat_value (ksp[i], "ipackets"); - tx = get_kstat_value (ksp[i], "opackets"); + /* try to get 64bit counters */ + rx = get_kstat_value (ksp[i], "ipackets64"); + tx = get_kstat_value (ksp[i], "opackets64"); + /* or fallback to 32bit */ + if (rx == -1LL) + rx = get_kstat_value (ksp[i], "ipackets"); + if (tx == -1LL) + tx = get_kstat_value (ksp[i], "opackets"); if ((rx != -1LL) || (tx != -1LL)) if_submit (ksp[i]->ks_name, "if_packets", rx, tx); + /* no 64bit error counters yet */ rx = get_kstat_value (ksp[i], "ierrors"); tx = get_kstat_value (ksp[i], "oerrors"); if ((rx != -1LL) || (tx != -1LL))