Flowstats Rest API calls return incorrect times.
search cancel

Flowstats Rest API calls return incorrect times.

book

Article ID: 339177

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

  • The time range reported by the flowstats API call that does not match the time range (start time and end time)  given in the GET API query 
  • The affected API call is:  GET https://nsx_address/api/2.1/app/flow/flowstats?contextId={VM-ID}&flowType=TCP_UDP&startTime={start_time}&endTime={end_time}
  • The API call executed correctly with return code 200, however, the start time and end time returned by the API call is not matching the start time and end time provided in the GET query. 

    Below is an example:

     The API call:  GET https://{{nsxmanager}}/api/2.1/app/flow/flowstats?contextId=vm-42&flowType=TCP_UDP&startTime=1533130000&endTime=1533132230&pageSize=1024

     The returned values:

       "flowStatsTcpUdp": [
                    {
                            "startTime": 1651536000,            <==== the returned start time
                            "endTime": 1533131815000,       <==== the returned end time 
                            "ruleId": 1001,
                            "blocked": 0,
                            "protocol": 6,
                            "direction": 2,
                            "sessions": 26,
                            "sourcePackets": 51,
                            "destinationPackets": 51,
                            "sourceBytes": 3060,
                            "destinationBytes": 4488,
                            "source": "192.168.1.20",
                            "destination": "192.168.1.11",
                            "destinationPort": 8080
             },


    The provided startTime = 1533130000 = Wednesday, August 1, 2018 1:26:40 PM
     while the returned startTime = 1651536000 = Tuesday, May 3, 2022 12:00:00 AM

Environment

VMware NSX Data Center for vSphere 6.x

Cause

  • Flow timestamps are invalid when flow moves from active to inactive state, and this causes problems in the related algorithms.
  • Flows which are active during VM migration have the correct timestamps while active and after moving to inactive on the destination host.

Resolution

This issue is resolved in VMware NSX Data Center for vSphere 6.4.2


Additional Information

Impact/Risks:

  • The returned time stamps are not expected