Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network statistics are not collected when alias interfaces are present on the system #2450

Closed
pdcleyn opened this issue Feb 21, 2017 · 1 comment
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@pdcleyn
Copy link

pdcleyn commented Feb 21, 2017

Bug report

Relevant telegraf.conf:

[global_tags]


[agent]
  interval = "10s"
  round_interval = true

  metric_batch_size = 1000

  metric_buffer_limit = 10000

  collection_jitter = "0s"

  flush_interval = "10s"
  flush_jitter = "0s"

  precision = ""

  debug = true
  quiet = false
  logfile = "/var/log/telegraf/telegraf.log"

  hostname = ""
  omit_hostname = false
  
[[outputs.file]]
  files = ["stdout", "/tmp/metrics.out"]
  

[[inputs.net]]

System info:

[ root@HOST ~]# rpm -qa | grep telegraf
telegraf-1.1.1-1.x86_64
[ root@HOST ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[ root@HOST ~]# uname -a
Linux HOST 2.6.32-642.13.1.el6.x86_64 #1 SMP Wed Jan 11 20:56:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[ root@HOST ~]#

Steps to reproduce:

Create a network interface and an alias interface on top, following files can be used on a RHEL6 system:

/etc/sysconfig/network-scripts/ifcfg-tun10

OWNER=nobody
NOZEROCONF=yes
IPV6INIT=yes
USERCTL=no
VLAN=no
BOOTPROTO=static
TYPE=Tap
ONBOOT=yes
DEVICE=tun10

/etc/sysconfig/network-scripts/ifcfg-tun10:10

OWNER=nobody
NOZEROCONF=yes
IPV6INIT=yes
USERCTL=no
VLAN=no
BOOTPROTO=static
TYPE=Tap
ONBOOT=yes
DEVICE=tun10:1
NAME=tun10:1

Activate the interfaces:
ifup tun10
ifup tun10:1

/proc/net/dev should now contain the new interfaces:

[root@host ~]# cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo: 1638928809 4771634    0    0    0     0          0         0 1638928809 4771634    0    0    0     0       0          0
  eth0: 1000866899965 764654426    0    0    0     0          0         0 1267144066 5373060    0    0    0     0       0          0
tun10:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
tun10:1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          

Restart telegraf

Expected behavior:

Interface statistics for the new interfaces and all other existing interfaces should be gathered.

Actual behavior:

An error is thrown in /var/log/telegraf/telegraf.log and no interface statistics are gathered:

2017/02/16 03:38:00 E! ERROR in input [inputs.net]: error getting net io info: strconv.ParseUint: parsing "2:": invalid syntax

Additional info:

Error is caused by a parse issue in the upstream shizou/gopsutils package. I created a PR to address this issue.

@sparrc sparrc added the bug unexpected problem or unintended behavior label Feb 21, 2017
@sparrc sparrc added this to the 1.3.0 milestone Feb 21, 2017
@danielnelson
Copy link
Contributor

@pdcleyn We are using a version of gopsutil with your fix in it, so I believe this bug is fixed. Please reopen if there are still issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants