Debugging failing inputs.net configuration

telegraf
#1

I want to monitor the network traffic on my machines. For this I use the simple net input like so:

[[inputs.net]]
  interfaces = ["eth0"]

This works on one machine but not on the other. I’m puzzled by this. I can’t imagine I messed up the config since it is so little and the same config works on the other machine. I also double checked the interface. This is clearly correct.
Could it be some permissions issue? Perhaps the telegraf user is not allow to read from the device? How do I debug this?
I’m using Ubuntu 16.04 and Telegraf 1.2.1.

#2

@haarts Have you checked the interface naming? Is it something non standard? Are there any issues in the telegraf logs?

#3

To check if it is a permission issue, you could try sudo telegraf --test to run the inputs one time and exit. If it works as root, but not as a regular user, then it is probably permission related.

The net plugin reads /proc/net/dev, so you could also try cat /proc/net/dev as the telegraf user.

#4

I did check and it seems OK. The logs don’t mention anything odd.

#5

Haha! Running with sudo gave a different output.
My kernel is compiled with grsec… My only real option is to run telegraf as root. Not sure how comfortable I’m with that.