rxPacketsReceived/OK counter

Hi,

I am trying to collect gateway statistics, but I have some doubts about the number of packet received by the various gateways. All the packets sent by the nodes are correctly received and forwarded to the app server, but the rx counter from the mqtt stats topic does not reflect the number of packed received and showed on the web interface.
The web interface shows ~13k packet received, but both rxPacketsReceived and rxPacketsReceivedOK say “3”. Am I doing something wrong? How can I get the number of received packet for each gateway?

Thanks

Hi,

It’s funny that you just posted this because I came across the same issues yesterday. The stats were not making any sense to me.
I looked into the code and there is an issue with the way the stats structure is constructed. Basically the stats for downlink are wrong. I just pushed a pull request on the github repo to fix it.

Without the fix, you should read the stats as follow:

  • txPacketsReceived is actually the number of downlink packet transmitted (actually forwarded by the gateway to the end nodes). Corresponds to the txnb field of the stats packet of the Semtech Packet Forwarder protocol
  • txPacketsEmitted is the number of uplink packets forwarded by the gateway to the bridge. Corresponds to the dwnb of the packet forwarder protocol. Nothing to do with tx.

Hope this helps.
Lucas

Actually the behaviour you are experiencing is something different: from what I understand the counters are reset by the packet forwarder (on the gateway) each time a stats packet is sent to the cloud. So the numbers you are seeing in the MQTT messages are from the last stats message received. I don’t know if this is documented somewhere in the Packet Forwarder protocol.

Thanks @lglnt I’ve merged your PR and issued a bugfix release.

@nrdmtt, @lglnt is correct. The stats you are seeing are the numbers since the last stats update.

Thank you both for the clarification and help. Now everything looks good.

Matteo