helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[telegraf-ds] inputs.net provides no data

Open yellowpattern opened this issue 1 year ago • 4 comments

After getting telegraf to start providing data as a daemon set, I then tried to get some network information (it isn't included in the default set of metrics) by adding this to the configMap:

[[inputs.net]]
  ignore_protocol_stats = true
  interfaces = [ "ens*"]

But there's nothing. No output anywhere.

yellowpattern avatar Apr 17 '24 10:04 yellowpattern

Sorry, I lie, I get statistics for "eth0" but not the physical interfaces.

yellowpattern avatar Apr 17 '24 10:04 yellowpattern

If I add:

...
      volumeMounts:
        - name: procnet
          mountPath: /tmp/net
...
      volumes:
        - name: procnet
          hostPath:
            path: /proc/net
            type: ''

Then I can see the real devices in /tmp/net/dev but I can't mount that in /proc/net.

yellowpattern avatar Apr 17 '24 11:04 yellowpattern

The config sets HOST_PROC to be /hostfs/proc BUT /hostfs/proc/net/dev is the same as /proc/net/dev. Problem: /proc can't be ounted under /proc. Fixing this requires something like https://github.com/shirou/gopsutil/issues/1625

yellowpattern avatar Apr 17 '24 11:04 yellowpattern

I found a way...

spec:
...
  template:
...
    spec:
...
      volumeMounts:
        - name: procnet
          mountPath: /hostfs/proc/net
...
      volumes:
        - name: procnet
          hostPath:
            path: /proc/net
            type: ''

yellowpattern avatar Apr 18 '24 00:04 yellowpattern