Hi,
In p.217 in NSX-v 6.3 API manual, flow monitoring API is written as the below.
https://pubs.vmware.com/nsx-63/topic/com.vmware.ICbase/PDF/nsx_63_api.pdf
Working With Flow Monitoring Statistics
GET /2.1/app/flow/flowstats
This monitoring feature can be used if "collectFlows" is true by using "PUT /2.1/app/flow/config" API.
My tests (in using 6.2.7) are the followings.
==========
1. Check the current configuration
# curl -sk -u <USER NAME>:<PASSWORD> -X GET https://<NSXMGR ADDR>/api/2.1/app/flow/config
<?xml version="1.0" encoding="UTF-8"?>
<FlowConfiguration>
<collectFlows>false</collectFlows>
<ignoreBlockedFlows>false</ignoreBlockedFlows>
<ignoreLayer2Flows>false</ignoreLayer2Flows>
<sourceIPs/>
<destinationIPs>224.0.0.0/24,255.255.255.255</destinationIPs>
<destinationContainer>
<name>system-generated-broadcast-macset</name>
<id>macset-1</id>
<type>MACSet</type>
</destinationContainer>
<destinationPorts>138,137</destinationPorts>
</FlowConfiguration>
---
2. Change "collectFlows" to "true" (POST API or Web UI: [Networking & Security] -> [Flow Monitoring] -> [Configuration] -> Change "Global Flow Collection Status" to "Enabled")
# curl -ik -u <USER NAME>:<PASSWORD> -H "Content-Type: application/xml" -X PUT https://<NSXMGR ADDR>/api/2.1/app/flow/config -d "<FlowConfiguration>
<collectFlows>true</collectFlows>
<ignoreBlockedFlows>false</ignoreBlockedFlows>
<ignoreLayer2Flows>false</ignoreLayer2Flows>
<sourceIPs/>
<destinationIPs>224.0.0.0/24,255.255.255.255</destinationIPs>
<destinationContainer>
<name>system-generated-broadcast-macset</name>
<id>macset-1</id>
<type>MACSet</type>
</destinationContainer>
<destinationPorts>138,137</destinationPorts>
</FlowConfiguration>"
---
3. Get meta-data
# curl -sk -u <USER NAME>:<PASSWORD> -X GET https://<NSXMGR ADDR>/api/2.1/app/flow/flowstats/info
<?xml version="1.0" encoding="UTF-8"?>
<FlowStatsInfo>
<flowStatsInfoTcpUdp>
<minimumStartTime>1493273464</minimumStartTime>
<maximumEndTime>1494646469</maximumEndTime>
<totalCount>13</totalCount>
</flowStatsInfoTcpUdp>
<flowStatsInfoLayer3>
<minimumStartTime>0</minimumStartTime>
<maximumEndTime>0</maximumEndTime>
<totalCount>0</totalCount>
</flowStatsInfoLayer3>
<flowStatsInfoLayer2>
<minimumStartTime>0</minimumStartTime>
<maximumEndTime>0</maximumEndTime>
<totalCount>0</totalCount>
</flowStatsInfoLayer2>
</FlowStatsInfo>
---
4. Get flow information
# curl -sk -u <USER NAME>:<PASSWORD> -X GET https://<NSXMGR ADDR>/api/2.1/app/flow/flowstats?contextId=datacenter-2\&flowType=TCP_UDP\&startTime=1493273464\&endTime=1494646469
<?xml version="1.0" encoding="UTF-8"?>
<FlowStatsPage>
<pagingInfo>
<contextId>datacenter-2</contextId>
<flowType>TcpUdp</flowType>
<startTime>1493273464</startTime>
<endTime>1494646469</endTime>
<totalCount>10</totalCount>
<startIndex>0</startIndex>
<pageSize>256</pageSize>
</pagingInfo>
<flowStatsTcpUdp>
<startTime>1494556024000</startTime>
<endTime>1494647361000</endTime>
<ruleId>1007</ruleId>
<blocked>0</blocked>
...
<destinationPort>22</destinationPort>
</flowStatsTcpUdp>
</FlowStatsPage>
===========
Regards,
mizo