fbegyn/tc_exporter

Does not work on Debian 12

Closed this issue · 5 comments

Hi

Upgrade to Debian 12 broke the tc_exporter. The problem is with finding the network interfaces.

ts=2023-06-11T11:12:37.352021706Z version=v0.7.0 caller=main.go:74 msg="failed to get interfaces from ns" err="incorrect size, want: 184 or 192" netns=default

I tried to upgrade the netlink library, but it didn't help

johan@shaper:~/tc_exporter$ git diff go.mod
diff --git a/go.mod b/go.mod
index 5ca06b5..25e1d24 100644
--- a/go.mod
+++ b/go.mod
@@ -6,11 +6,11 @@ require (
        github.com/florianl/go-tc v0.1.1-0.20200404145214-71dd2225291c
        github.com/go-kit/kit v0.10.0
        github.com/jsimonetti/rtnetlink v0.0.0-20200319143528-d89fb9e42094
-       github.com/mdlayher/netlink v1.1.0
+       github.com/mdlayher/netlink v1.7.2
        github.com/mdlayher/promtest v0.0.0-20190902162024-2b6f8ce579e3
        github.com/prometheus/client_golang v1.5.0
        github.com/spf13/viper v1.6.2
-       golang.org/x/sys v0.0.0-20200320181252-af34d8274f85
+       golang.org/x/sys v0.7.0
        gopkg.in/alecthomas/kingpin.v2 v2.2.6
        gopkg.in/yaml.v2 v2.2.8 // indirect
 )
fbegyn commented

Thanks for the report, I've not run into this issue myself (but have no production hosts that migrated yet).

I'll try to find some time this weekend or next week to look into what might cause this.

fbegyn commented

I've ran some tests with a Vagrant box with the new HEAD of main and the old release.

vagrant@bookworm:/vagrant$ uname -a
Linux bookworm 6.1.0-9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64 GNU/Linux
vagrant@bookworm:/vagrant$ cat config.toml 
listen-address = ":9704"

[netns.default]
interfaces = ['eth0']

Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "debian/bookworm64"
  config.vm.network "forwarded_port", guest: 9704, host: 9704

  config.vm.provision "shell", inline: <<-SHELL
    echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
    apt-get update
    apt-get install -y golang make git nfpm
  SHELL
end

I can replicate your errors for the v0.7.0 version:

vagrant@bookworm:/vagrant$ ./bin/tc_exporter 
ts=2023-06-30T15:42:02.841982517Z version=v0.7.0 caller=main.go:41 msg="reading config file ..."
ts=2023-06-30T15:42:02.843962151Z version=v0.7.0 caller=main.go:65 msg="successfully read config file"
ts=2023-06-30T15:42:02.845582672Z version=v0.7.0 caller=main.go:74 msg="failed to get interfaces from ns" err="incorrect size, want: 184 or 192" netns=default
ts=2023-06-30T15:42:02.846121021Z version=v0.7.0 caller=qdisc.go:35 collector=qdisc msg="making qdisc collector"
ts=2023-06-30T15:42:02.846552227Z version=v0.7.0 caller=class.go:39 collector=class msg="making class collector"
ts=2023-06-30T15:42:02.846860183Z version=v0.7.0 caller=class.go:267 collector=hfsc msg="making SC collector"
ts=2023-06-30T15:42:02.847297171Z version=v0.7.0 caller=main.go:91 msg="starting TC exporter" listen-address=:9704

Which seems to be working on the debian 12 box I'm running for the new version v0.7.1:

vagrant@bookworm:/vagrant$ ./bin/tc_exporter 
ts=2023-06-30T15:37:07.207235221Z version=v0.7.1 caller=main.go:41 msg="reading config file ..."
ts=2023-06-30T15:37:07.209514454Z version=v0.7.1 caller=main.go:65 msg="successfully read config file"
ts=2023-06-30T15:37:07.210050553Z version=v0.7.1 caller=qdisc.go:35 collector=qdisc msg="making qdisc collector"
ts=2023-06-30T15:37:07.210168935Z version=v0.7.1 caller=class.go:39 collector=class msg="making class collector"
ts=2023-06-30T15:37:07.210232079Z version=v0.7.1 caller=class.go:267 collector=hfsc msg="making SC collector"
ts=2023-06-30T15:37:07.210516644Z version=v0.7.1 caller=main.go:91 msg="starting TC exporter" listen-address=:9704
ts=2023-06-30T15:37:12.354151344Z version=v0.7.1 caller=collector.go:60 msg="processing scrape"
ts=2023-06-30T15:37:14.004265171Z version=v0.7.1 caller=collector.go:60 msg="processing scrape"

I'm cutting a quick release with v0.7.1 which should help you out a bit.

fbegyn commented

current main and v0.7.1 tags should fix the issue.

Thanks a lot. Quick resolution!

Confirm it works on my Debian 12. Thanks again for a great tool.