-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get interface statistic (TZ-1145) #97
Comments
Seem you can access netif via However i'm not sure how to enable |
Hi @motters, thanks for addressing this. So just to confirm, for now, you only want to use the lwIP |
Hi, Yes. How can we access mib_stats feature (struct stats_mib2_netif_ctrs) for each network interface (WiFi, Ethernet, OpenThread)? Then we can wrap some REST APIs around it. Cheers! |
Hi @motters , just ask the question
then build your apps. Please have a try. The LwIP group will support to enable this feature via |
Thanks @zwx1995esp I'll give this a try and report back what information can be obtained. |
@zwx1995esp Sorry slow on this. I've tried the about bit still cannot access. I cannot access the lwip_netif struct I cannot include the struct esp_netif_t as it's defined with esp_netif_lwip_internal.h which is not accessible. |
Hi, @motters try this:
|
@zwx1995esp Thanks thats works However to gain access to The code now compiles however the values within mib2_counters are always zero no matter how much data is transferred via the interface. |
Hi @motters , this seems to be related to the lwIP components. you can create an issue in ESP-IDF to ask for some help from the person responsible for lwIP components. |
@motters please follow up in the IDF lwip component, feel free to link the new issue here. |
Checklist
Feature description
It would be nice to be able to obtain interface statistics to monitor data usage.
Global stats for all interfaces seem to be available at
lwip/stats.h
easily enough. However it combines all interfaces (OpenThread, Wifi, Ethernet etc).It would be better if these stats were accessible for each interface. These seem to be available through via
stats_mib2_netif_ctrs
at:esp_netif_get_handle_from_ifkey("WIFI_STA_DEF")->lwip_netif->mib2_counters
However i cannot access this struct without getting compiler errors:
error: invalid use of incomplete type 'esp_netif_t' {aka 'struct esp_netif_obj'}
With
stats_mib2_netif_ctrs
,lwip/stats.h
andOpenThread History Functions
it would be possible to gain useful statistics on each interface.Use cases
This would help when the border router is using a cellular interface. Allowing you to keep track for any data increases and where the increase came from.
It also gives a deep in sight into the use of the OpenThread network and backbone.
Alternatives
lwip/stats.h
andOpenThread History Functions
are available but they don't give all the information such astotal number of octets received on the interface
whichstats_mib2_netif_ctrs
does.Additional context
How can we access the
stats_mib2_netif_ctrs
for each interface?The text was updated successfully, but these errors were encountered: