04-22-2021 02:31 AM
Hi,
I'm trying to get the average rx and tx speed from the LAN-connected clients to a catalyst switch. I'm using this YANG model:
It contains some interesting labes under statistics:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">
<get>
<filter>
<interfaces xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-interfaces-oper">
<interface>
<statistics>
<rx-pps/>
<rx-kbps/>
<tx-pps/>
<tx-kbps/>
</statistics>
</interface>
</interfaces>
</filter>
</get>
</rpc>
However, I'm not sure if this contains the immediate snapshot rx and tx speeds, or is it an incremental value, or is it the average over a certain period of time (e.g. average tx-kbps over the past 5 min).
What I need is the average speed (rx,tx) over a certain period of time (1-10 min), so that I can identify if the lan client is active. Is this the correct approach?
THANKS
Solved! Go to Solution.
04-29-2021 09:04 AM
The statistics in the interfaces YANG model:
<rx-pps/>
<rx-kbps/>
<tx-pps/>
<tx-kbps/>
correspond to the following numbers in the "show interface" output:
5 minute input rate 487000 bits/sec, 535 packets/sec 5 minute output rate 487000 bits/sec, 535 packets/sec
As you can see these statistics are averaged over a 5-minute interval.
04-22-2021 06:00 AM
I generally do average of 5-10min some time Lower but this lead to laod of the device you keep polling. most i see solarwinds / prtg poll every 120-180 seconds and calculate. is this acceptable in your case ?
04-22-2021 09:00 AM
Hi, I'm not sure if I can follow your answer. You mean that there is a way to calculate (average?) without constantly polling, is that correct? Can you pls elaborate more on this possibility? it sounds promising.
THANKS
04-22-2021 10:02 AM
Polling on Cisco routers does not necessarily skew the statistics because the packet run-time path is either hardware switching, or, always takes precedence over any management function, however, if the router is really busy forwarding packets, your statistics query will be late, but, still give a somewhat accurate average. If you are looking for a readout over 10 minutes and then stopping, polling every 10 or 20 seconds is not a big deal. If you are going for constant polling, then yes, stretch it out to once a minute.
One important thing. You don't want your polling to skew the numbers so target the management interface to ask about statistics on other interfaces.
04-22-2021 09:37 AM
Hello,
The short answer is that this is a snapshot in time, however, the task you are outlining is exactly what programmability interfaces are made for. As a human looking at a router console, you can figure out the average by typing in "show interface xxx" or on the YANG Suite NETCONF page, clicking on "Run RPC"several times in the period you wish and manually figuring out the averages. The solution using a programmatic interface like NETCONF is to create a script that sends this "get" at intervals over a period of time, storing the values, and when the time expires, calculate the average and report it.
Using the YANG Suite NETCONF page, you can "Build RPC "shown above and click on "Replays-->Generate Python script". This will produce a python script that sends the message one time, but, you now have a script that you can modify to perform the solution you mention, for example,
```
for n in range(10):
# send the get
# collect the rx, tx time
sleep(1)
print("RX average {0} TX average {1}".format(rx / 10, tx / 10))
```
04-29-2021 09:04 AM
The statistics in the interfaces YANG model:
<rx-pps/>
<rx-kbps/>
<tx-pps/>
<tx-kbps/>
correspond to the following numbers in the "show interface" output:
5 minute input rate 487000 bits/sec, 535 packets/sec 5 minute output rate 487000 bits/sec, 535 packets/sec
As you can see these statistics are averaged over a 5-minute interval.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide