Document navigation

NetFlow APIs

CreateFlowCollector

API Request

URLs

POST zstack/v1/flowmeters/{flowMeterUuid}/collectors

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "server": "192.168.48.12"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"server":"192.168.48.12"}}' http://localhost:8080/zstack/v1/flowmeters/3d5b7f5cbc1535fc91b5e97ac56221cf/collectors

Request Parameters

Name Type Location Description Optional Value Starting Version
name String body (contained in the params structure) Optional. The resource name. 3.6.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String url The flow monitoring resource UUID. 3.6.0
server String body (contained in the params structure) Optional. The flow collector IP address. 3.6.0
port Long body (contained in the params structure) Optional. The flow collector service port. 3.6.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.6.0
tagUuids List body (contained in the params structure) Optional. The list of tag UUIDs. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "93adc3c5f9c03d3d9aa24cd78bf77d0f",
    "server": "192.168.48.12",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventory FlowCollectorInventory See inventory 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
server String The IP address of the flow collector. 3.6.0
port Long The UDP port of the flow collector. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

CreateFlowCollectorAction action = new CreateFlowCollectorAction();
action.flowMeterUuid = "3d5b7f5cbc1535fc91b5e97ac56221cf";
action.server = "192.168.48.12";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFlowCollectorAction.Result res = action.call();

Python SDK

action = CreateFlowCollectorAction()
action.flowMeterUuid = "3d5b7f5cbc1535fc91b5e97ac56221cf"
action.server = "192.168.48.12"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryFlowCollector

API Request

URLs

GET zstack/v1/flowmeters/collectors
GET zstack/v1/flowmeters/collectors/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/collectors?q=uuid=6579310b521d3dd587dd42e73755df6c
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/collectors/98bab890be3f329d99bb9e67a3f405a1

Queryable Fields

Run zstack CLI, enter QueryFlowCollector, and press Tab to view all queryable fields and resources that support cross-table queries.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "e231c750a95b301cb4b6de429fa11bbc",
      "server": "192.168.48.12",
      "port": 2055.0,
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventories List See inventories 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
server String The IP address of the flow collector. 3.6.0
port Long The UDP port of the flow collector. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

QueryFlowCollectorAction action = new QueryFlowCollectorAction();
action.conditions = asList("uuid=cfcc92fcc9143d7eba4f927b8f6e7120");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFlowCollectorAction.Result res = action.call();

Python SDK

action = QueryFlowCollectorAction()
action.conditions = ["uuid=e88fd76aa0a535479d9203a47609103d"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateFlowCollector

API Request

URLs

PUT zstack/v1/flowmeters/collectors/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateFlowCollector": {
    "server": "192.168.48.12"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateFlowCollector":{"server":"192.168.48.12"}}' http://localhost:8080/zstack/v1/flowmeters/collectors/a08b84909ccf3ace897d565643688b13/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.6.0
server String body (contained in the updateFlowCollector structure) Optional. The collector IP address. 3.6.0
port Long body (contained in the updateFlowCollector structure) Optional. The UDP port. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "inventory": {
    "uuid": "93adc3c5f9c03d3d9aa24cd78bf77d0f",
    "server": "192.168.48.12",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventory FlowCollectorInventory See inventory 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
server String The IP address of the flow collector. 3.6.0
port Long The UDP port of the flow collector. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

UpdateFlowCollectorAction action = new UpdateFlowCollectorAction();
action.uuid = "a08b84909ccf3ace897d565643688b13";
action.server = "192.168.48.12";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateFlowCollectorAction.Result res = action.call();

Python SDK

action = UpdateFlowCollectorAction()
action.uuid = "a08b84909ccf3ace897d565643688b13"
action.server = "192.168.48.12"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteFlowCollector

API Request

URLs

DELETE zstack/v1/flowmeters/collectors/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/flowmeters/collectors/4a09dc60a4be305b8a6b1157eedb61bb?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.6.0
deleteMode String body Optional. The deletion mode. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

DeleteFlowCollectorAction action = new DeleteFlowCollectorAction();
action.uuid = "4a09dc60a4be305b8a6b1157eedb61bb";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFlowCollectorAction.Result res = action.call();

Python SDK

action = DeleteFlowCollectorAction()
action.uuid = "4a09dc60a4be305b8a6b1157eedb61bb"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

CreateFlowMeter

API Request

URLs

POST zstack/v1/flowmeters

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "type": "NetFlow"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"type":"NetFlow"}}' http://localhost:8080/zstack/v1/flowmeters

Request Parameters

Name Type Location Description Optional Value Starting Version
version String body (contained in the params structure) Optional. The flow monitoring protocol version.
  • V5
  • V9
3.6.0
type String body (contained in the params structure) The flow monitoring protocol.
  • NetFlow
  • sFlow
3.6.0
sample Integer body (contained in the params structure) Optional. The flow monitoring sampling rate. 3.6.0
generateInterval Integer body (contained in the params structure) Optional. The interval at which flow data is sent to the collector. 3.6.0
name String body (contained in the params structure) Optional. The resource name. 3.6.0
description String body (contained in the params structure) Optional. The detailed description of the resource. 3.6.0
server String body (contained in the params structure) Optional. The collector IP address. 3.6.0
port Long body (contained in the params structure) Optional. The collector service UDP port. 3.6.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.6.0
tagUuids List body (contained in the params structure) Optional. The list of tag UUIDs. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0
  • When you create a flow meter resource in ZStack Cloud, you can specify the expiration interval of the flow by adding the FLOW_EXPIRE_INTERVAL option to SystemTags. The SystemTag is passed by using the expireInterval parameter.

    • Format of the FLOW_EXPIRE_INTERVAL option: expireInterval::xx. Here, the unit of xx is second.
    • Example: expireInterval::1200
  • When you create a flow meter resource in ZStack Cloud, you can specify the timeout configuration of the flow by adding the FLOW_ACTIVE_TIMEOUT option to SystemTags. The SystemTag is passed by using the activeTimeout parameter.

    • Format of the FLOW_ACTIVE_TIMEOUT option: activeTimeout::xx. Here, the unit of xx is second.
    • Example: activeTimeout::3600

API Response

Sample Response

{
  "inventory": {
    "uuid": "5fd98cedd76139a4b0dc68482ac61878",
    "type": "NetFlow",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventory FlowMeterInventory See inventory 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
sample Long The sample rate of the flow meter. 3.6.0
expireInterval Long The expiration interval of the flow. 3.6.0
version String The version of the flow meter protocol. 3.6.0
type String The type of the flow meter protocol. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0
collectors List See collectors 3.6.0
networkRefs List See networkRefs 3.6.0

#collectors

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
server String The IP address of the flow collector. 3.6.0
port Long The UDP port of the flow collector. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

#networkRefs

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
vRouterUuid String The vRouter UUID. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
l3NetworkUuid String The L3 network UUID. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

CreateFlowMeterAction action = new CreateFlowMeterAction();
action.type = "NetFlow";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateFlowMeterAction.Result res = action.call();

Python SDK

action = CreateFlowMeterAction()
action.type = "NetFlow"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryFlowMeter

API Request

URLs

GET zstack/v1/flowmeters
GET zstack/v1/flowmeters/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters?q=name=test
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/84b52e4a84bd3747b3c1429eb47a4f34

Queryable Fields

Run zstack CLI, enter QueryFlowMeter, and press Tab to view all queryable fields and resources that support cross-table queries.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "4ba598ab40a1321798fb957a9eddb77d",
      "type": "NetFlow",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventories List See inventories 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
sample Long The sample rate of the flow meter. 3.6.0
expireInterval Long The expiration interval of the flow. 3.6.0
version String The version of the flow meter protocol. 3.6.0
type String The type of the flow meter protocol. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0
collectors List See collectors 3.6.0
networkRefs List See networkRefs 3.6.0

#collectors

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
server String The IP address of the flow collector. 3.6.0
port Long The UDP port of the flow collector. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

#networkRefs

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
vRouterUuid String The vRouter UUID. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
l3NetworkUuid String The L3 network UUID. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

QueryFlowMeterAction action = new QueryFlowMeterAction();
action.conditions = asList("name=test");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFlowMeterAction.Result res = action.call();

Python SDK

action = QueryFlowMeterAction()
action.conditions = ["name=test"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

UpdateFlowMeter

API Request

URLs

PUT zstack/v1/flowmeters/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateFlowMeter": {
    "version": "V5"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateFlowMeter":{"version":"V5"}}' http://localhost:8080/zstack/v1/flowmeters/46191b3339313efaa8a2321490ccd666/actions

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.6.0
version String body (contained in the updateFlowMeter structure) Optional. The version of the flow meter protocol.
  • V5
  • V9
3.6.0
sample Long body (contained in the updateFlowMeter structure) Optional. The flow sampling rate. 3.6.0
name String body (contained in the updateFlowMeter structure) Optional. The resource name. 3.6.0
expireInterval Long body (contained in the updateFlowMeter structure) Optional. The flow export interval. 3.6.0
description String body (contained in the updateFlowMeter structure) Optional. The detailed description of the resource. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "inventory": {
    "collectors": [],
    "uuid": "40175d4f6adc33b69926219a69318de4",
    "sample": 1.0,
    "version": "V5",
    "type": "NetFlow",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventory FlowMeterInventory See inventory 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventory

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
sample Long The sample rate of the flow meter. 3.6.0
expireInterval Long The expiration interval of the flow. 3.6.0
version String The version of the flow meter protocol. 3.6.0
type String The type of the flow meter protocol. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0
collectors List See collectors 3.6.0
networkRefs List See networkRefs 3.6.0

#collectors

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The resource name. 3.6.0
description String Optional. The detailed description of the resource. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
server String The IP address of the flow collector. 3.6.0
port Long The UDP port of the flow collector. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

#networkRefs

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
vRouterUuid String The vRouter UUID. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
l3NetworkUuid String The L3 network UUID. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

UpdateFlowMeterAction action = new UpdateFlowMeterAction();
action.uuid = "46191b3339313efaa8a2321490ccd666";
action.version = "V5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateFlowMeterAction.Result res = action.call();

Python SDK

action = UpdateFlowMeterAction()
action.uuid = "46191b3339313efaa8a2321490ccd666"
action.version = "V5"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

DeleteFlowMeter

API Request

URLs

DELETE zstack/v1/flowmeters/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/flowmeters/3a65b90e4cbc30b9b90c6defa9d4150d?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 3.6.0
deleteMode String body Optional. The deletion mode. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

DeleteFlowMeterAction action = new DeleteFlowMeterAction();
action.uuid = "3a65b90e4cbc30b9b90c6defa9d4150d";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteFlowMeterAction.Result res = action.call();

Python SDK

action = DeleteFlowMeterAction()
action.uuid = "3a65b90e4cbc30b9b90c6defa9d4150d"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

AddVRouterNetworksToFlowMeter

API Request

URLs

POST zstack/v1/flowmeters/{flowMeterUuid}/router/{vRouterUuid}/addnetworks

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "l3NetworkUuids": [
      "fc4a406728373583a22ebca19874b2e1"
    ]
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"l3NetworkUuids":["fc4a406728373583a22ebca19874b2e1"]}}' http://localhost:8080/zstack/v1/flowmeters/2fd1cc7c10023dd880e566f510f043ee/router/5248c2e5e7c0308abc2863c2249fce61/addnetworks

Request Parameters

Name Type Location Description Optional Value Starting Version
flowMeterUuid String url The flow monitoring resource. 3.6.0
vRouterUuid String url The VPC vRouter UUID or VPC vRouter group UUID. 3.6.0
l3NetworkUuids List body (contained in the params structure) The VPC vRouter network UUID. 3.6.0
resourceUuid String body (contained in the params structure) Optional. The resource UUID. 3.6.0
tagUuids List body (contained in the params structure) Optional. The list of tag UUIDs. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "b10d1994c1813b9982ab5e52bf07c2e0",
      "vRouterUuid": "335d1d3f24c132dba22362dbb4867c7a",
      "flowMeterUuid": "f01fef876e503331a4d6b186c41ef1d1",
      "l3NetworkUuid": "80b4e4931a8a3760bde3d66f1c03a1ae",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventories List See inventories 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
vRouterUuid String The vRouter UUID. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
l3NetworkUuid String The L3 network UUID. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

AddVRouterNetworksToFlowMeterAction action = new AddVRouterNetworksToFlowMeterAction();
action.flowMeterUuid = "2fd1cc7c10023dd880e566f510f043ee";
action.vRouterUuid = "5248c2e5e7c0308abc2863c2249fce61";
action.l3NetworkUuids = asList("fc4a406728373583a22ebca19874b2e1");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddVRouterNetworksToFlowMeterAction.Result res = action.call();

Python SDK

action = AddVRouterNetworksToFlowMeterAction()
action.flowMeterUuid = "2fd1cc7c10023dd880e566f510f043ee"
action.vRouterUuid = "5248c2e5e7c0308abc2863c2249fce61"
action.l3NetworkUuids = [fc4a406728373583a22ebca19874b2e1]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

QueryVRouterFlowMeterNetwork

API Request

URLs

GET zstack/v1/flowmeters/networks
GET zstack/v1/flowmeters/networks/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/networks?q=uuid=d515c0ab43ac369e9419c9c861d5c2f7
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/networks/6d67988b515133dea956ddbac0f1d361

Queryable Fields

Run zstack CLI, enter QueryVRouterFlowMeterNetwork, and press Tab to view all queryable fields and resources that support cross-table queries.

API Response

Sample Response

{
  "inventories": [
    {
      "uuid": "62413232b13c3ff496876495906d9254",
      "vRouterUuid": "276b37d53794342b8b93f11ffdab0b24",
      "flowMeterUuid": "606c59dee3e0371da1b6a829c249bb79",
      "l3NetworkUuid": "7d744eec67cb385cb8f55e84056a3a50",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
inventories List See inventories 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#inventories

Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
vRouterUuid String The vRouter UUID. 3.6.0
flowMeterUuid String The flow meter UUID. 3.6.0
l3NetworkUuid String The L3 network UUID. 3.6.0
createDate Timestamp The creation date. 3.6.0
lastOpDate Timestamp The last operation date. 3.6.0

SDK Sample

Java SDK

QueryVRouterFlowMeterNetworkAction action = new QueryVRouterFlowMeterNetworkAction();
action.conditions = asList("uuid=87600bd6f382333ea003d14514a9d077");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryVRouterFlowMeterNetworkAction.Result res = action.call();

Python SDK

action = QueryVRouterFlowMeterNetworkAction()
action.conditions = ["uuid=ac2b106208373677a9d39040d44dd1db"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

GetVRouterFlowCounter

API Request

URLs

GET zstack/v1/flowmeters/{vRouterUuid}/counter

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/eee5bf613b913040b6609c2b07efea07/counter

Request Parameters

Name Type Location Description Optional Value Starting Version
vRouterUuid String url The vRouter UUID. 3.6.0
systemTags List query Optional. The system tags. 3.6.0
userTags List query Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "counters": [
    {
      "device": "eth1",
      "totalEntries": "12",
      "totalPkts": "123",
      "totalBytes": "12345"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0
counters List See counters 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

#counters

Name Type Description Starting Version
device String The network interface. 3.6.0
totalEntries String The total flow count. 3.6.0
totalPkts String The total packet count. 3.6.0
totalBytes String The total byte count. 3.6.0

SDK Sample

Java SDK

GetVRouterFlowCounterAction action = new GetVRouterFlowCounterAction();
action.vRouterUuid = "eee5bf613b913040b6609c2b07efea07";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetVRouterFlowCounterAction.Result res = action.call();

Python SDK

action = GetVRouterFlowCounterAction()
action.vRouterUuid = "eee5bf613b913040b6609c2b07efea07"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

RemoveVRouterNetworksFromFlowMeter

API Request

URLs

DELETE zstack/v1/flowmeters/networks

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/flowmeters/networks?deleteMode=Permissive

Request Parameters

Name Type Location Description Optional Value Starting Version
uuids List body The resource UUID list. 3.6.0
deleteMode String body Optional. The deletion mode. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,

{
    "error": {
        "code": "SYS.1001",
        "description": "A message or an operation timeout",
        "details": "Create VM on KVM timeout after 300s"
    }
}

SDK Sample

Java SDK

RemoveVRouterNetworksFromFlowMeterAction action = new RemoveVRouterNetworksFromFlowMeterAction();
action.uuids = asList("aaa9d2325b073fd39a7f1a67b007b1ae");
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RemoveVRouterNetworksFromFlowMeterAction.Result res = action.call();

Python SDK

action = RemoveVRouterNetworksFromFlowMeterAction()
action.uuids = [aaa9d2325b073fd39a7f1a67b007b1ae]
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

GetFlowMeterRouterId

API Request

URLs

GET zstack/v1/flowmeters/{vRouterUuid}/routerid

Headers

Authorization: OAuth the-session-uuid

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/flowmeters/7ca3752b57ef3c8c89257e1eeb720b88/routerid

Request Parameters

Name Type Location Description Optional Value Starting Version
vRouterUuid String url The VPC vRouter UUID. 3.6.0
systemTags List query Optional. The system tags. 3.6.0
userTags List query Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "routerId": 120.0
}
Name Type Description Starting Version
routerId Long The router ID. 3.6.0
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

SDK Sample

Java SDK

GetFlowMeterRouterIdAction action = new GetFlowMeterRouterIdAction();
action.vRouterUuid = "7ca3752b57ef3c8c89257e1eeb720b88";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetFlowMeterRouterIdAction.Result res = action.call();

Python SDK

action = GetFlowMeterRouterIdAction()
action.vRouterUuid = "7ca3752b57ef3c8c89257e1eeb720b88"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

SetFlowMeterRouterId

API Request

URLs

POST zstack/v1/flowmeters/{vRouterUuid}/routerid

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "routerId": 120.0
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"routerId":120.0}}' http://localhost:8080/zstack/v1/flowmeters/0bfa81935a6c3dd1a8c68de1874e8a1d/routerid

Request Parameters

Name Type Location Description Optional Value Starting Version
vRouterUuid String url The vRouter UUID. 3.6.0
routerId Long body (contained in the params structure) The router ID. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

Sample Response

{
  "routerId": 120.0
}
Name Type Description Starting Version
routerId Long The VPC vRouter flow monitoring ID. 3.6.0
error ErrorCode Error code, null if operation succeeds, non-null if operation fails, see error 3.6.0

#error

Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0

SDK Sample

Java SDK

SetFlowMeterRouterIdAction action = new SetFlowMeterRouterIdAction();
action.vRouterUuid = "0bfa81935a6c3dd1a8c68de1874e8a1d";
action.routerId = 120.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetFlowMeterRouterIdAction.Result res = action.call();

Python SDK

action = SetFlowMeterRouterIdAction()
action.vRouterUuid = "0bfa81935a6c3dd1a8c68de1874e8a1d"
action.routerId = 120.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()