3

we use a montoring system to capture network traffic. the output as root user is fine:

eth0      Link encap:Ethernet  HWaddr 00:1E:67:E6:D6:FE
          inet addr:149.56.19.13  Bcast:149.56.19.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:67ff:fee6:d6fe/64 Scope:Link
          inet6 addr: 2607:5300:61:40d::/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:606278 errors:0 dropped:0 overruns:0 frame:0
          TX packets:269059 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:197777628 (188.6 MiB)  TX bytes:19593247 (18.6 MiB)
          Memory:b1200000-b127ffff

the main focus here is the line RX bytes:197777628 (188.6 MiB) TX bytes:19593247 (18.6 MiB)

The monitoring runs under a different user. when I do the ifconfig there I get the following output:

eth0      Link encap:Ethernet  HWaddr 00:1E:67:E6:D6:FE
          inet addr:149.56.19.13  Bcast:149.56.19.255  Mask:255.255.255.0
          inet6 addr: fe80::21e:67ff:fee6:d6fe/64 Scope:Link
          inet6 addr: 2607:5300:61:40d::/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Memory:b1200000-b127ffff

so no RX or TX ... RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) This is the first server ever that had different outputs regarding RX and TX for different users. I tested that on many machines and all are running CentOS release 6.7 (Final) but it looks like the one that changes the output is running a newer kernel version (3.14) Is there a way to change the output of ifconfig to get the RX and TX as we used to do?

kasperd
  • 29,894
  • 16
  • 72
  • 122
JLW
  • 31
  • 1
  • 2
    under non-root user, can you access to these files `/proc/net/dev` and `/sys/class/net/eth0/statistics/rx_*` ? Also, `netstat -i` is another way to get the statistics of interfaces. – cuongnv23 Apr 26 '16 at 02:02
  • thanks for the input, but our monitoring system is Zabbix and we can't change the way they ask for the statistics. So we would need to change the default output of ifconfig to return the correct values – JLW Apr 26 '16 at 21:09
  • 1
    so how about my question? can you access those files with non-root users. – cuongnv23 Apr 27 '16 at 07:17
  • 1
    Hi, I'm in the exact situation and I can access `/proc/net/dev` as non-root but all numbers are 0 and for `/sys/class/net/*` it's permission denied. – BigBourin May 25 '17 at 08:59

0 Answers0