mum4k / tc_reader Goto Github PK
View Code? Open in Web Editor NEWA persistent SNMP script that exports TC Queue and Class statistics for graphing (for example to Cacti).
A persistent SNMP script that exports TC Queue and Class statistics for graphing (for example to Cacti).
Hi mum4k,
I upgraded to the last commit you made to correct "value out of range" bug. Now I see a strange behavior. Before upgrade to new tc_reader I checked a parent class current bytes total is the exact sum of all its leaf classes current bytes and that leaf classes current bytes values is equal to the their relative leaf qdiscs.
After last commit upgrade I see those values ar unrelated. Can be 64 bit values correction you made in last commit ?
Can you add "Packet Requeues" to tc_reader and in tc_queues_classes.xml ?
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.
Devices -> Associated Data Queries -> SNMP - TC Users -> Verbose Query.
(Here seems to be missing information.It may be? )
Create Graph for this host:
( 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:
In case it helps, I'm using the default configuration file:
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
We get "value out of range", probably "... bytes 2288850176..." is not correctly managed by tc_reader in an example like this:
qdisc htb 1: root refcnt 5 r2q 30 default 999 direct_packets_stat 18
Sent 4791659924498 bytes 2288850176 pkt (dropped 55735, overlimits 2573220655 requeues 1040)
backlog 58691b 46p requeues 1040
Debug message on /var/log/messages
start(): Starting the tc_reader.
tc_reader[27253]: tc_reader configuration: tcCmdPath: /sbin/tc parseInterval: 5 tcQdiscStats: [-s qdisc show dev] tcClassStats: [-s class show dev] ifaces: [ifc1 ifc2 ifc3] userNameClass: map[]
tc_reader[27253]: parseTc(): Unable to parse the output of TC commands while getting Qdisc statistics, error: strconv.ParseInt: parsing "2288850176": value out of range
tc_reader[27253]: Listen(): received a PING.
tc_reader[27253]: Listen(): processing SNMP GET-NEXT for oid .1.3.6.1.4.1.2021.255
...
tc_reader[27253]: Listen(): received an empty line from the SNMP daemon, exiting ...
Hi,
first thanks for your work. I tried to setup tc_reader with Cacti. The Installation and Configuration works fine without any Errors. Ping - Pong works :)
The problem is that I cant see any data of my Interface.
I added my Interface to /etc/tc_reader.conf
I checked a few SNMP queries from your XML Template File:
root@nagios-xxx:/opt/omd/sites/xxx/etc/nagios/conf.d# snmpget -v1 -c public 192.168.0.xx .1.3.6.1.4.1.2021.255.11
iso.3.6.1.4.1.2021.255.11 = STRING: "tcUserDownBytesLeaf"
root@nagios-xxx:/opt/omd/sites/xxx/etc/nagios/conf.d# snmpget -v1 -c public 192.168.0.xx .1.3.6.1.4.1.2021.255.3
iso.3.6.1.4.1.2021.255.3 = STRING: "tcNameLeaf"
root@nagios-xxx:/opt/omd/sites/xxx/etc/nagios/conf.d# snmpget -v1 -c public 192.168.0.xx .1.3.6.1.4.1.2021.255.4
iso.3.6.1.4.1.2021.255.4 = STRING: "sentBytesLeaf"
root@nagios-xxx:/opt/omd/sites/xxx/etc/nagios/conf.d# snmpget -v1 -c public 192.168.0.xx .1.3.6.1.4.1.2021.255.7
iso.3.6.1.4.1.2021.255.7 = STRING: "overLimitPktLeaf"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.