mum4k / tc_reader

A persistent SNMP script that exports TC Queue and Class statistics for graphing (for example to Cacti).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems graphing in Cacti.

dbareiro opened this issue · comments

Hello. How are you?

First, wanted to thank you for your time and for sharing this development with the community. I found it reading the forum looking for a Linux Cacti TC QoS Queue Discipline Stats template given that I had not been successful by running the template of that thread.

I had no problem compiling tc_reader.

Below a local testing:

# /sbin/tc -s qdisc show dev eth0
qdisc htb 1: root refcnt 2 r2q 10 default 60 direct_packets_stat 3856
 Sent 650504 bytes 3938 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc sfq 20: parent 1:20 limit 127p quantum 1514b divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc sfq 30: parent 1:30 limit 127p quantum 1514b divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc sfq 40: parent 1:40 limit 127p quantum 1514b divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
# /sbin/tc -s class show dev eth0
class htb 1:1 root rate 1000Kbit ceil 1000Kbit burst 1600b cburst 1600b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 200000 ctokens: 200000

class htb 1:20 parent 1:1 leaf 20: prio 2 rate 256000bit ceil 256000bit burst 1600b cburst 1600b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 781250 ctokens: 781250

class htb 1:30 parent 1:1 leaf 30: prio 3 rate 128000bit ceil 128000bit burst 1600b cburst 1600b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 1562500 ctokens: 1562500

class htb 1:40 parent 1:1 leaf 40: prio 1 rate 24000bit ceil 24000bit burst 1599b cburst 1599b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 8333328 ctokens: 8333328

This is the output I get with snmpwalk:

# snmpwalk -v2c -c private localhost .1.3.6.1.4.1.2021.255
iso.3.6.1.4.1.2021.255.1 = STRING: "tcIndexLeaf"
iso.3.6.1.4.1.2021.255.1.1 = INTEGER: 1
iso.3.6.1.4.1.2021.255.1.2 = INTEGER: 2
iso.3.6.1.4.1.2021.255.1.3 = INTEGER: 3
iso.3.6.1.4.1.2021.255.1.4 = INTEGER: 4
iso.3.6.1.4.1.2021.255.1.5 = INTEGER: 5
iso.3.6.1.4.1.2021.255.1.6 = INTEGER: 6
iso.3.6.1.4.1.2021.255.1.7 = INTEGER: 7
iso.3.6.1.4.1.2021.255.1.8 = INTEGER: 8
iso.3.6.1.4.1.2021.255.2 = INTEGER: 8
iso.3.6.1.4.1.2021.255.3 = STRING: "tcNameLeaf"
iso.3.6.1.4.1.2021.255.3.1 = STRING: "eth0:1:0"
iso.3.6.1.4.1.2021.255.3.2 = STRING: "eth0:32:0"
iso.3.6.1.4.1.2021.255.3.3 = STRING: "eth0:48:0"
iso.3.6.1.4.1.2021.255.3.4 = STRING: "eth0:64:0"
iso.3.6.1.4.1.2021.255.3.5 = STRING: "eth0:1:1"
iso.3.6.1.4.1.2021.255.3.6 = STRING: "eth0:1:32"
iso.3.6.1.4.1.2021.255.3.7 = STRING: "eth0:1:48"
iso.3.6.1.4.1.2021.255.3.8 = STRING: "eth0:1:64"
iso.3.6.1.4.1.2021.255.4 = STRING: "sentBytesLeaf"
iso.3.6.1.4.1.2021.255.4.1 = Counter32: 666552
iso.3.6.1.4.1.2021.255.4.2 = Counter32: 0
iso.3.6.1.4.1.2021.255.4.3 = Counter32: 0
iso.3.6.1.4.1.2021.255.4.4 = Counter32: 0
iso.3.6.1.4.1.2021.255.4.5 = Counter32: 0
iso.3.6.1.4.1.2021.255.4.6 = Counter32: 0
iso.3.6.1.4.1.2021.255.4.7 = Counter32: 0
iso.3.6.1.4.1.2021.255.4.8 = Counter32: 0
iso.3.6.1.4.1.2021.255.5 = STRING: "sentPktLeaf"
iso.3.6.1.4.1.2021.255.5.1 = Counter32: 4048
iso.3.6.1.4.1.2021.255.5.2 = Counter32: 0
iso.3.6.1.4.1.2021.255.5.3 = Counter32: 0
iso.3.6.1.4.1.2021.255.5.4 = Counter32: 0
iso.3.6.1.4.1.2021.255.5.5 = Counter32: 0
iso.3.6.1.4.1.2021.255.5.6 = Counter32: 0
iso.3.6.1.4.1.2021.255.5.7 = Counter32: 0
iso.3.6.1.4.1.2021.255.5.8 = Counter32: 0
iso.3.6.1.4.1.2021.255.6 = STRING: "droppedPktLeaf"
iso.3.6.1.4.1.2021.255.6.1 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.2 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.3 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.4 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.5 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.6 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.7 = Counter32: 0
iso.3.6.1.4.1.2021.255.6.8 = Counter32: 0
iso.3.6.1.4.1.2021.255.7 = STRING: "overLimitPktLeaf"
iso.3.6.1.4.1.2021.255.7.1 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.2 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.3 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.4 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.5 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.6 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.7 = Counter32: 0
iso.3.6.1.4.1.2021.255.7.8 = Counter32: 0
iso.3.6.1.4.1.2021.255.8 = STRING: "tcUserIndexLeaf"
iso.3.6.1.4.1.2021.255.10 = STRING: "tcUserNameLeaf"
iso.3.6.1.4.1.2021.255.11 = STRING: "tcUserDownBytesLeaf"
iso.3.6.1.4.1.2021.255.12 = STRING: "tcUserDownPktLeaf"
iso.3.6.1.4.1.2021.255.13 = STRING: "tcUserDownDroppedPktLeaf"
iso.3.6.1.4.1.2021.255.14 = STRING: "tcUserDownOverLimitPktLeaf"
iso.3.6.1.4.1.2021.255.15 = STRING: "tcUserUpBytesLeaf"
iso.3.6.1.4.1.2021.255.16 = STRING: "tcUserUpPktLeaf"
iso.3.6.1.4.1.2021.255.17 = STRING: "tcUserUpDroppedPktLeaf"
iso.3.6.1.4.1.2021.255.18 = STRING: "tcUserUpOverLimitPktLeaf"

In recent executions, the syslog shows no errors:

# grep tc_reader /var/log/syslog | tail -f
May 15 19:52:54 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:53:11 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:53:22 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:55:05 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:55:05 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:56:35 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:56:35 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:56:35 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:56:35 srv01 tc_reader: start(): Starting the tc_reader.
May 15 19:56:35 srv01 tc_reader: start(): Starting the tc_reader.

Attached some screenshots of Cacti.

  1. Devices -> Associated Data Queries -> SNMP - TC Users -> Verbose Query.
    tc_reader-verbosequery
    (Here seems to be missing information.It may be? )

  2. Create Graph for this host:
    tc_reader-creategraph
    ( It is correct that this only appears here?)

If I create the graphic by selecting the two lines in Figure two, these are not generated:

tc_reader-generatedgraph1
tc_reader-generatedgraph2

In case it helps, I'm using the default configuration file:
tc_readerconfiguration

May the problem be related to this?

Thank you in advance for your time.

Best regards,
Daniel

[1] http://forums.cacti.net/viewtopic.php?f=12&t=29651&start=45

Hello and thanks for reporting this.

I did not take a deep look, I can do that later, but quickly going through this I see the following:

  • as you noted yourself you are using the default configuration
  • there are no "user" definitions in the default configuration
  • the cacti templates I provided are only for the "user" graphs

I suggest that you define at least one user (by mapping the IN and OUT HTB class names). Then try to manually rerun the SNMP data query in Cacti and see (in the debug output) if it lists the user. If yes, you should be able to create a graph for it.

Also once you define the user it should also appear in the snmpwalk output after you restart the tc_reader. This will be another good thing to check.

Please try this out and let me know,

Jakub

Hi, Jakub.

Thanks for your answer.

Not sure how I should define a user based on the combination of two Qdiscs/Classes I put above:

# tc -s qdisc show dev eth0
qdisc htb 1: root refcnt 2 r2q 10 default 60 direct_packets_stat 125019
 Sent 11582784 bytes 125175 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc sfq 20: parent 1:20 limit 127p quantum 1514b divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc sfq 30: parent 1:30 limit 127p quantum 1514b divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc sfq 40: parent 1:40 limit 127p quantum 1514b divisor 1024 perturb 10sec 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
# tc -s class show dev eth0
class htb 1:1 root rate 1000Kbit ceil 1000Kbit burst 1600b cburst 1600b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 200000 ctokens: 200000

class htb 1:20 parent 1:1 leaf 20: prio 2 rate 256000bit ceil 256000bit burst 1600b cburst 1600b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 781250 ctokens: 781250

class htb 1:30 parent 1:1 leaf 30: prio 3 rate 128000bit ceil 128000bit burst 1600b cburst 1600b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 1562500 ctokens: 1562500

class htb 1:40 parent 1:1 leaf 40: prio 1 rate 24000bit ceil 24000bit burst 1599b cburst 1599b 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 rate 0bit 0pps backlog 0b 0p requeues 0 
 lended: 0 borrowed: 0 giants: 0
 tokens: 8333328 ctokens: 8333328

That is, if the valid values ​​are the ones I get with snmpwalk, I can't see the relation:

# snmpwalk -v2c -c private localhost .1.3.6.1.4.1.2021.255
[...]
iso.3.6.1.4.1.2021.255.3 = STRING: "tcNameLeaf"
iso.3.6.1.4.1.2021.255.3.1 = STRING: "eth0:1:0"
iso.3.6.1.4.1.2021.255.3.2 = STRING: "eth0:32:0"
iso.3.6.1.4.1.2021.255.3.3 = STRING: "eth0:48:0"
iso.3.6.1.4.1.2021.255.3.4 = STRING: "eth0:64:0"
iso.3.6.1.4.1.2021.255.3.5 = STRING: "eth0:1:1"
iso.3.6.1.4.1.2021.255.3.6 = STRING: "eth0:1:32"
iso.3.6.1.4.1.2021.255.3.7 = STRING: "eth0:1:48"
iso.3.6.1.4.1.2021.255.3.8 = STRING: "eth0:1:64"

Could you please show me an example of how I should define a user based on the policies quoted above?

Best regards,
Daniel

Ah I understand now. Your use case is slightly different from mine. This can still work for you, but you will have to adjust something. Let me explain.

In my case - I was applying the scheduling disciplines to two (three really) interfaces on my firewall. So it was easy for me to define both traffic directions IN (outbound queues on the private interface) and OUT (outbound queues on the public interface).

I then coupled these queues by defining a "user". The provided cacti templates then read the user leafes from the SNMP data and store that in RRDs.

In your case you have queuing disciplines only on one interface so defining users does not really make sense for you. There are two possible solutions, the right thing to do and the hack.

  1. the right thing to do:
  • write your own cacti template that will read from this (I see that your snmpwalk shows the counter values there so you have the data):
    iso.3.6.1.4.1.2021.255.4 = STRING: "sentBytesLeaf"
  • you will have to add your own data source and graph definitions, but if you know your way around Cacti - this should be easy
  • ideally once you do this you can add the templates here for others
  1. the hack:
  • you might try to define an user with both IN and OUT being the same queue
  • you should be able to reuse the existing cacti templates there, you will get a graph that will be showing the same traffic levels for both IN and OUT
  • I am not sure if the tc_reader code would do the right thing because I no longer remember if I used the queue name as the key somewhere so this might not work

Or maybe:
3) define queuing disciplines on the other interface as well if this machine is a router?

Hope this helps,

Jakub

Hi, Jakub.

Sorry I could not answer before.

I'll be watching what you mention me and I'll respond. I thank you for your time.

Best regards,
Daniel