mum4k / tc_reader

A persistent SNMP script that exports TC Queue and Class statistics for graphing (for example to Cacti).
10 stars 4 forks source link

Fix hexadecimal qdisc/class id matching #3

Closed mgreter closed 6 years ago

mgreter commented 6 years ago

First thanks for this useful piece of code, got it up and running quite easily. But I've hit some minor obstacles while configuring my "user" rules. I have some tc classes that are reported by tc like this:

class htb 1:80 parent 1:1 ...

So I thought the following config would work

user = "class" "wan0:1:80" "wan0:1:81"

But I did not see these classes in the returned tcUserNameLeaf. Debugged the issue down (first time doing something in go) and found that results from tc are parsed via strconv.ParseInt(matchSlice[2], 16, 32) and the derived tc name is done via strconv.FormatInt(classHandle, 10), therefore not matching the configuration (eg. 1:80 become 1:128). This PR is of course a breaking change, but I guess nobody else has hit this so far or he/she should probably have reported it already (and I don't think this was intentional).

googlebot commented 6 years ago

Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
mum4k commented 6 years ago

Hello Marcel,

thank you very much for the contribution and for finding this embarrassing bug ;)

I think we will also need to update some tests. Sadly this was one of my older repositories and I didn't have continuous testing enabled. I have added that now and the Travis-CI output should indicate which tests need to be updated. The tests will also help us by ensuring that the fix actually fixes the issue. I am sure you have tested it locally, however tests will give us the guarantee going forward.

Secondly since this is Google-owned code I will ask you to sign the CLA (see the comment from the googlebot) first. Please respond on the pull request once the above checks are all green (CLA signed and tests passing).

Again thanks for your time and help!

mum4k commented 6 years ago

Fixes #4

googlebot commented 6 years ago

CLAs look good, thanks!

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 15


Totals Coverage Status
Change from base Build 6: 0.0%
Covered Lines: 487
Relevant Lines: 609

💛 - Coveralls
mgreter commented 6 years ago

All done, test pass, have a nice weekend!