08-20-2021 04:18 AM
Hi,
Have tried the API below and get response that include these statisctics rx/tx-packets, rx/tx-error etc. but not the up_capacity_percentage and down_capacity_percentage. Does vManage sandbox support those statistics? If yes, any pointer on which API to be used to get the capacity related statistics?
Solved! Go to Solution.
08-23-2021 03:57 AM
@tanisha_sarraf @raihanAbidin i tested this on the reservable sd-wan sandbox here https://devnetsandbox.cisco.com/RM/Diagram/Index/c9679e49-6751-4f43-9bb4-9d7ee162b069?diagramType=Topology
https://{{vmanage}}:{{port}}/dataservice/statistics/interface
{
"header": {
"generatedOn": 1629715476012,
"viewKeys": {
"uniqueKey": [],
"preferenceKey": "grid-raw_interfacestatistics"
},
"columns": [
{
"title": "Entry_time",
"property": "entry_time",
"displayFormat": "DD MMM YYYY h:mm:ss A z",
"inputFormat": "unix-time",
"dataType": "date"
},
{
"title": "StatCycleTime",
"property": "statcycletime",
"displayFormat": "DD MMM YYYY h:mm:ss A z",
"inputFormat": "unix-time",
"dataType": "date"
},
{
"title": "Device IP",
"property": "vdevice_name",
"hideable": true,
"dataType": "string"
},
{
"title": "Device Model",
"property": "device_model",
"display": "keyvalue",
"keyvalueProperty": "deviceModel",
"width": 120,
"dataType": "string"
},
{
"title": "Host name",
"property": "host_name",
"hideable": false,
"dataType": "string"
},
{
"title": "VPN Id",
"property": "vpn_id",
"dataType": "number"
},
{
"title": "If name",
"property": "interface",
"dataType": "string"
},
{
"title": "Rx packets",
"property": "rx_pkts",
"dataType": "number"
},
{
"title": "Rx Octets",
"property": "rx_octets",
"dataType": "number"
},
{
"title": "Rx Errors",
"property": "rx_errors",
"dataType": "number"
},
{
"title": "Rx Drops",
"property": "rx_drops",
"dataType": "number"
},
{
"title": "Rx packets per second",
"property": "rx_pps",
"dataType": "number"
},
{
"title": "Rx kilo bits per second",
"property": "rx_kbps",
"dataType": "number"
},
{
"title": "Tx Packets",
"property": "tx_pkts",
"dataType": "number"
},
{
"title": "Tx Octets",
"property": "tx_octets",
"dataType": "number"
},
{
"title": "Tx Errors",
"property": "tx_errors",
"dataType": "number"
},
{
"title": "Tx Drops",
"property": "tx_drops",
"dataType": "number"
},
{
"title": "Tx packets per second",
"property": "tx_pps",
"dataType": "number"
},
{
"title": "Tx kilo bits per second",
"property": "tx_kbps",
"dataType": "number"
},
{
"title": "Total mega bits per second",
"property": "total_mbps",
"dataType": "double"
},
{
"title": "Oper Status",
"property": "oper_status",
"dataType": "string"
},
{
"title": "Admin Status",
"property": "admin_status",
"dataType": "string"
},
{
"title": "bw up",
"property": "bw_up",
"dataType": "number"
},
{
"title": "bw down",
"property": "bw_down",
"dataType": "number"
},
{
"title": "up capacity percentage",
"property": "up_capacity_percentage",
"dataType": "double"
},
{
"title": "down_capacity_percentage",
"property": "down_capacity_percentage",
"dataType": "double"
},
{
"title": "vnf_name",
"property": "vnf_name",
"dataType": "string"
},
{
"title": "vip_time",
"property": "vip_time",
"displayFormat": "DD MMM YYYY h:mm:ss A z",
"inputFormat": "unix-time",
"dataType": "date"
},
{
"title": "vnic_id",
"property": "vnic_id",
"dataType": "string"
},
{
"title": "platform_type",
"property": "platform_type",
"dataType": "string"
},
{
"title": "System Ip",
"property": "system-ip",
"dataType": "string"
}
],
"fields": [
{
"property": "entry_time",
"dataType": "date"
},
{
"property": "vip_idx",
"dataType": "number"
},
{
"property": "statcycletime",
"dataType": "date"
},
{
"property": "vdevice_name",
"dataType": "string"
},
{
"property": "device_model",
"dataType": "string",
"display": "keyvalue"
},
{
"property": "host_name",
"dataType": "string"
},
{
"property": "vpn_id",
"dataType": "number"
},
{
"property": "interface",
"dataType": "string"
},
{
"property": "rx_pkts",
"dataType": "number"
},
{
"property": "rx_octets",
"dataType": "number"
},
{
"property": "rx_errors",
"dataType": "number"
},
{
"property": "rx_drops",
"dataType": "number"
},
{
"property": "rx_pps",
"dataType": "number"
},
{
"property": "rx_kbps",
"dataType": "number"
},
{
"property": "tx_pkts",
"dataType": "number"
},
{
"property": "tx_octets",
"dataType": "number"
},
{
"property": "tx_errors",
"dataType": "number"
},
{
"property": "tx_drops",
"dataType": "number"
},
{
"property": "tx_pps",
"dataType": "number"
},
{
"property": "tx_kbps",
"dataType": "number"
},
{
"property": "total_mbps",
"dataType": "double"
},
{
"property": "oper_status",
"dataType": "string"
},
{
"property": "admin_status",
"dataType": "string"
},
{
"property": "bw_up",
"dataType": "number"
},
{
"property": "bw_down",
"dataType": "number"
},
{
"property": "up_capacity_percentage",
"dataType": "double"
},
{
"property": "down_capacity_percentage",
"dataType": "double"
},
{
"property": "vnf_name",
"dataType": "string"
},
{
"property": "vip_time",
"dataType": "date"
},
{
"property": "vnic_id",
"dataType": "string"
},
{
"property": "platform_type",
"dataType": "string"
},
{
"property": "system-ip",
"dataType": "string"
}
],
"chart": {
"xAxis": [
"entry_time"
],
"yAxis": [
"rx_pkts",
"rx_octets",
"rx_errors",
"rx_drops",
"rx_pps",
"rx_kbps",
"tx_pkts",
"tx_octets",
"tx_errors",
"tx_drops",
"tx_pps",
"tx_kbps"
],
"series": [
"interface"
],
"title": "",
"xAxisLabel": "Time",
"yAxisLabel": "bytes"
}
},
"data": [
{
"down_capacity_percentage": 0,
"tx_pps": 16,
"total_mbps": 0.04,
"device_model": "vedge-cloud",
"rx_kbps": 20,
"interface": "ge0/0",
"tx_octets": 1617969,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 10096,
"tx_errors": 0,
"rx_octets": 1551547,
"statcycletime": 1629715200028,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "physical",
"tenant": "default",
"entry_time": 1629714461255,
"vip_time": 1629714461255,
"af_type": "IPv4",
"rx_pkts": 9703,
"rx_pps": 16,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 21,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 6,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qx"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-cloud",
"rx_kbps": 0,
"interface": "ge0/1",
"tx_octets": 9534,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 147,
"tx_errors": 0,
"rx_octets": 57404,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"tenant": "default",
"entry_time": 1629713894446,
"vip_time": 1629713894446,
"af_type": "IPv4",
"rx_pkts": 401,
"rx_pps": 0,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 120,
"tx_kbps": 0,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 5,
"host_name": "site3-vedge01",
"vpn_id": 1,
"id": "AXtymHghYdW0CdV3u0qw"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-cloud",
"rx_kbps": 0,
"interface": "system",
"tx_octets": 0,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 0,
"tx_errors": 0,
"rx_octets": 0,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "logical",
"tenant": "default",
"entry_time": 1629713889009,
"vip_time": 1629713889009,
"af_type": "IPv4",
"rx_pkts": 0,
"rx_pps": 0,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 0,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 4,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qv"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-cloud",
"rx_kbps": 5,
"interface": "eth0",
"tx_octets": 3944,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 70,
"tx_errors": 0,
"rx_octets": 481980,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"tenant": "default",
"entry_time": 1629713873402,
"vip_time": 1629713873402,
"af_type": "IPv4",
"rx_pkts": 2147,
"rx_pps": 3,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 20,
"tx_kbps": 0,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 3,
"host_name": "site3-vedge01",
"vpn_id": 512,
"id": "AXtymHghYdW0CdV3u0qu"
},
{
"down_capacity_percentage": 0,
"tx_pps": 6,
"total_mbps": 0.02,
"device_model": "vedge-cloud",
"rx_kbps": 10,
"interface": "ge0/2",
"tx_octets": 868948,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 4304,
"tx_errors": 0,
"rx_octets": 828040,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "physical",
"tenant": "default",
"entry_time": 1629713861294,
"vip_time": 1629713861294,
"af_type": "IPv4",
"rx_pkts": 4377,
"rx_pps": 6,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 10,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 2,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qt"
},
{
"down_capacity_percentage": 0,
"tx_pps": 11,
"total_mbps": 0.05,
"device_model": "vedge-cloud",
"rx_kbps": 19,
"interface": "ge0/0",
"tx_octets": 2545338,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 7553,
"tx_errors": 0,
"rx_octets": 1583306,
"statcycletime": 1629715200014,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "physical",
"tenant": "default",
"entry_time": 1629713861253,
"vip_time": 1629713861254,
"af_type": "IPv4",
"rx_pkts": 7006,
"rx_pps": 10,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 1,
"tx_kbps": 31,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 1,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qs"
}
],
"pageInfo": {
"startTime": "1629714461255",
"endTime": "1629713861253",
"count": 6
}
}
03-05-2025 01:08 AM
The API has changed since this question was originally posted. You must now supply a query parameter which previously was not required for the /statistics/interface endpoint. If you use the GET method this must be supplied as a query-string and if you use a POST you must supply it in the request body. I prefer the POST version.
Here's an example I have tested using the always on sandbox using the example query from the API docs:
import requests
import json
base_url = ""
username = ""
password = ""
# Get session cookie
payload = f"j_username={username}&j_password={password}"
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
response = requests.request("POST", base_url + "/j_security_check", headers=headers, data=payload, verify=False)
session_cookie = response.headers["set-cookie"]
# Get XSRF Token
headers = {
'Content-Type': 'application/json',
'Cookie': session_cookie
}
response = requests.request("GET", base_url + "/dataservice/client/token", headers=headers, verify=False)
xsrf_token = response.text
# Get interface statistics
payload = json.dumps({
"query": {
"condition": "AND",
"rules": [
{
"value": [
"24"
],
"field": "entry_time",
"type": "date",
"operator": "last_n_hours"
},
{
"value": [
"10.10.1.13"
],
"field": "vdevice_name",
"type": "string",
"operator": "in"
}
]
}
})
headers = {
'Cookie': session_cookie,
'X-XSRF-TOKEN': xsrf_token,
'Content-Type': 'application/json'
}
response = requests.request("POST", base_url + "/dataservice/statistics/interface", headers=headers, data=payload, verify=False).json()
# "Pretty-print" response body
print(json.dumps(response.text,indent=2))
Note: This is not good code and should only be used as an example for how to query the API endpoint.
You can read more about the API endpoint here: https://developer.cisco.com/docs/sdwan/sd-wan-vmanage-v20-16/
08-20-2021 05:18 AM
Hello @raihanAbidin the sandbox support all the API resources within the design, ie if there is no cloud/onramp you cannot perform an API request for this. The ask on API is not clear, can you explain what you mean by up_capacity_percentage please? Does this refer to the interface state or bandwidth capacity of the interface? You might try
/statistics/interface/ccapacity/distribution
https://developer.cisco.com/docs/sdwan/#!reference-device-state-and-statistics
"data": [
{
"vdevice_name": "10.35.0.1",
"count": 143,
"interface": "GigabitEthernet2",
"min_up_capacity_percentage": 0.0099,
"bw_down": 1000000,
"max_up_capacity_percentage": 0.0099,
"bw_up": 1000000,
"avg_up_capacity_percentage": 0.0056034965034965035,
"max_down_capacity_percentage": 0.0063,
"min_down_capacity_percentage": 0.0063,
"avg_down_capacity_percentage": 0.004683916083916084,
"range": "0-25"
},
Hope this helps.
08-22-2021 11:37 PM
Hi @bigevilbeard ,
We are looking for the API to get the data for below metrics:
"bw_down": 1000000, "up_capacity_percentage": 0.0099, "bw_up": 1000000, "down_capacity_percentage": 0.0063,
We used the API shared by you:
/statistics/interface/ccapacity/distribution
still not getting data.
https://{{vmanage}}:{{port}}/dataservice/statistics/interface/ccapacity/distribution
08-23-2021 12:55 AM
@tanisha_sarraf based on this information the data points are all blank - is this a devnet sandbox you are testing or your own?
08-23-2021 03:57 AM
@tanisha_sarraf @raihanAbidin i tested this on the reservable sd-wan sandbox here https://devnetsandbox.cisco.com/RM/Diagram/Index/c9679e49-6751-4f43-9bb4-9d7ee162b069?diagramType=Topology
https://{{vmanage}}:{{port}}/dataservice/statistics/interface
{
"header": {
"generatedOn": 1629715476012,
"viewKeys": {
"uniqueKey": [],
"preferenceKey": "grid-raw_interfacestatistics"
},
"columns": [
{
"title": "Entry_time",
"property": "entry_time",
"displayFormat": "DD MMM YYYY h:mm:ss A z",
"inputFormat": "unix-time",
"dataType": "date"
},
{
"title": "StatCycleTime",
"property": "statcycletime",
"displayFormat": "DD MMM YYYY h:mm:ss A z",
"inputFormat": "unix-time",
"dataType": "date"
},
{
"title": "Device IP",
"property": "vdevice_name",
"hideable": true,
"dataType": "string"
},
{
"title": "Device Model",
"property": "device_model",
"display": "keyvalue",
"keyvalueProperty": "deviceModel",
"width": 120,
"dataType": "string"
},
{
"title": "Host name",
"property": "host_name",
"hideable": false,
"dataType": "string"
},
{
"title": "VPN Id",
"property": "vpn_id",
"dataType": "number"
},
{
"title": "If name",
"property": "interface",
"dataType": "string"
},
{
"title": "Rx packets",
"property": "rx_pkts",
"dataType": "number"
},
{
"title": "Rx Octets",
"property": "rx_octets",
"dataType": "number"
},
{
"title": "Rx Errors",
"property": "rx_errors",
"dataType": "number"
},
{
"title": "Rx Drops",
"property": "rx_drops",
"dataType": "number"
},
{
"title": "Rx packets per second",
"property": "rx_pps",
"dataType": "number"
},
{
"title": "Rx kilo bits per second",
"property": "rx_kbps",
"dataType": "number"
},
{
"title": "Tx Packets",
"property": "tx_pkts",
"dataType": "number"
},
{
"title": "Tx Octets",
"property": "tx_octets",
"dataType": "number"
},
{
"title": "Tx Errors",
"property": "tx_errors",
"dataType": "number"
},
{
"title": "Tx Drops",
"property": "tx_drops",
"dataType": "number"
},
{
"title": "Tx packets per second",
"property": "tx_pps",
"dataType": "number"
},
{
"title": "Tx kilo bits per second",
"property": "tx_kbps",
"dataType": "number"
},
{
"title": "Total mega bits per second",
"property": "total_mbps",
"dataType": "double"
},
{
"title": "Oper Status",
"property": "oper_status",
"dataType": "string"
},
{
"title": "Admin Status",
"property": "admin_status",
"dataType": "string"
},
{
"title": "bw up",
"property": "bw_up",
"dataType": "number"
},
{
"title": "bw down",
"property": "bw_down",
"dataType": "number"
},
{
"title": "up capacity percentage",
"property": "up_capacity_percentage",
"dataType": "double"
},
{
"title": "down_capacity_percentage",
"property": "down_capacity_percentage",
"dataType": "double"
},
{
"title": "vnf_name",
"property": "vnf_name",
"dataType": "string"
},
{
"title": "vip_time",
"property": "vip_time",
"displayFormat": "DD MMM YYYY h:mm:ss A z",
"inputFormat": "unix-time",
"dataType": "date"
},
{
"title": "vnic_id",
"property": "vnic_id",
"dataType": "string"
},
{
"title": "platform_type",
"property": "platform_type",
"dataType": "string"
},
{
"title": "System Ip",
"property": "system-ip",
"dataType": "string"
}
],
"fields": [
{
"property": "entry_time",
"dataType": "date"
},
{
"property": "vip_idx",
"dataType": "number"
},
{
"property": "statcycletime",
"dataType": "date"
},
{
"property": "vdevice_name",
"dataType": "string"
},
{
"property": "device_model",
"dataType": "string",
"display": "keyvalue"
},
{
"property": "host_name",
"dataType": "string"
},
{
"property": "vpn_id",
"dataType": "number"
},
{
"property": "interface",
"dataType": "string"
},
{
"property": "rx_pkts",
"dataType": "number"
},
{
"property": "rx_octets",
"dataType": "number"
},
{
"property": "rx_errors",
"dataType": "number"
},
{
"property": "rx_drops",
"dataType": "number"
},
{
"property": "rx_pps",
"dataType": "number"
},
{
"property": "rx_kbps",
"dataType": "number"
},
{
"property": "tx_pkts",
"dataType": "number"
},
{
"property": "tx_octets",
"dataType": "number"
},
{
"property": "tx_errors",
"dataType": "number"
},
{
"property": "tx_drops",
"dataType": "number"
},
{
"property": "tx_pps",
"dataType": "number"
},
{
"property": "tx_kbps",
"dataType": "number"
},
{
"property": "total_mbps",
"dataType": "double"
},
{
"property": "oper_status",
"dataType": "string"
},
{
"property": "admin_status",
"dataType": "string"
},
{
"property": "bw_up",
"dataType": "number"
},
{
"property": "bw_down",
"dataType": "number"
},
{
"property": "up_capacity_percentage",
"dataType": "double"
},
{
"property": "down_capacity_percentage",
"dataType": "double"
},
{
"property": "vnf_name",
"dataType": "string"
},
{
"property": "vip_time",
"dataType": "date"
},
{
"property": "vnic_id",
"dataType": "string"
},
{
"property": "platform_type",
"dataType": "string"
},
{
"property": "system-ip",
"dataType": "string"
}
],
"chart": {
"xAxis": [
"entry_time"
],
"yAxis": [
"rx_pkts",
"rx_octets",
"rx_errors",
"rx_drops",
"rx_pps",
"rx_kbps",
"tx_pkts",
"tx_octets",
"tx_errors",
"tx_drops",
"tx_pps",
"tx_kbps"
],
"series": [
"interface"
],
"title": "",
"xAxisLabel": "Time",
"yAxisLabel": "bytes"
}
},
"data": [
{
"down_capacity_percentage": 0,
"tx_pps": 16,
"total_mbps": 0.04,
"device_model": "vedge-cloud",
"rx_kbps": 20,
"interface": "ge0/0",
"tx_octets": 1617969,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 10096,
"tx_errors": 0,
"rx_octets": 1551547,
"statcycletime": 1629715200028,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "physical",
"tenant": "default",
"entry_time": 1629714461255,
"vip_time": 1629714461255,
"af_type": "IPv4",
"rx_pkts": 9703,
"rx_pps": 16,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 21,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 6,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qx"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-cloud",
"rx_kbps": 0,
"interface": "ge0/1",
"tx_octets": 9534,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 147,
"tx_errors": 0,
"rx_octets": 57404,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"tenant": "default",
"entry_time": 1629713894446,
"vip_time": 1629713894446,
"af_type": "IPv4",
"rx_pkts": 401,
"rx_pps": 0,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 120,
"tx_kbps": 0,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 5,
"host_name": "site3-vedge01",
"vpn_id": 1,
"id": "AXtymHghYdW0CdV3u0qw"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-cloud",
"rx_kbps": 0,
"interface": "system",
"tx_octets": 0,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 0,
"tx_errors": 0,
"rx_octets": 0,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "logical",
"tenant": "default",
"entry_time": 1629713889009,
"vip_time": 1629713889009,
"af_type": "IPv4",
"rx_pkts": 0,
"rx_pps": 0,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 0,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 4,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qv"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-cloud",
"rx_kbps": 5,
"interface": "eth0",
"tx_octets": 3944,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 70,
"tx_errors": 0,
"rx_octets": 481980,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"tenant": "default",
"entry_time": 1629713873402,
"vip_time": 1629713873402,
"af_type": "IPv4",
"rx_pkts": 2147,
"rx_pps": 3,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 20,
"tx_kbps": 0,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 3,
"host_name": "site3-vedge01",
"vpn_id": 512,
"id": "AXtymHghYdW0CdV3u0qu"
},
{
"down_capacity_percentage": 0,
"tx_pps": 6,
"total_mbps": 0.02,
"device_model": "vedge-cloud",
"rx_kbps": 10,
"interface": "ge0/2",
"tx_octets": 868948,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 4304,
"tx_errors": 0,
"rx_octets": 828040,
"statcycletime": 1629715200027,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "physical",
"tenant": "default",
"entry_time": 1629713861294,
"vip_time": 1629713861294,
"af_type": "IPv4",
"rx_pkts": 4377,
"rx_pps": 6,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 10,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 2,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qt"
},
{
"down_capacity_percentage": 0,
"tx_pps": 11,
"total_mbps": 0.05,
"device_model": "vedge-cloud",
"rx_kbps": 19,
"interface": "ge0/0",
"tx_octets": 2545338,
"oper_status": "Up",
"rx_errors": 0,
"bw_down": 0,
"tx_pkts": 7553,
"tx_errors": 0,
"rx_octets": 1583306,
"statcycletime": 1629715200014,
"admin_status": "Up",
"bw_up": 0,
"interface_type": "physical",
"tenant": "default",
"entry_time": 1629713861253,
"vip_time": 1629713861254,
"af_type": "IPv4",
"rx_pkts": 7006,
"rx_pps": 10,
"vmanage_system_ip": "10.10.1.17",
"tx_drops": 0,
"rx_drops": 1,
"tx_kbps": 31,
"vdevice_name": "10.10.1.17",
"up_capacity_percentage": 0,
"vip_idx": 1,
"host_name": "site3-vedge01",
"vpn_id": 0,
"id": "AXtymHghYdW0CdV3u0qs"
}
],
"pageInfo": {
"startTime": "1629714461255",
"endTime": "1629713861253",
"count": 6
}
}
08-24-2021 07:46 PM
Thank you @bigevilbeard for your help! We managed to get the response now.
02-27-2024 05:29 AM - edited 02-27-2024 05:29 AM
Hello,
I get this error message when I send a GET to the API /dataservice/statistics/interface
02-27-2024 05:53 AM
@Douglas Aguirre The error message "must not be null" indicates that a required field in your GET request to the Cisco SD-WAN API /dataservice/statistics/interface is missing. If you check the API documents (or the API docs on the device)
For example i would expect this to look like
https://vmanage-ip-address/dataservice/data/device/statistics/interfacestatistics?startDate=yyyy-mm-ddThh:mm:ss&endDate=yyyy-mm-ddThh:mm:ss
https://developer.cisco.com/docs/sdwan/20-4/#!sd-wan-vmanage-v20-4
You can see the following, the API documentation shows an example query string with two specific fields: "condition" and "aggregation". Ensure your query string includes these fields with the appropriate values.
query
string
(query)
Query string
Example : OrderedMap { "query": OrderedMap { "condition": "AND", "rules": List [ OrderedMap { "value": List [ "2020-05-10T01:00:00 UTC", "2020-05-10T01:30:00 UTC" ], "field": "entry_time", "type": "date", "operator": "between" } ] }, "aggregation": OrderedMap { "metrics": List [ OrderedMap { "property": "latency", "type": "avg" } ] } }
So an example would look like
## Query:
```
{
"query": {
"condition": "AND",
"rules": [
{
"value": [
"2020-10-20T10:00:00 UTC",
"2020-10-20T10:30:00 UTC"
],
"field": "entry_time",
"type": "date",
"operator": "between"
}
]
}
}
```
## Sample Response
```
"data": [
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-CSR-1000v",
"rx_kbps": 0,
"interface": "Tunnel100001",
"tx_octets": 0,
"oper_status": "Down",
"rx_errors": 0,
"bw_down": 100,
"tx_pkts": 0,
"tx_errors": 0,
"rx_octets": 0,
"statcycletime": 1603190400016,
"admin_status": "Up",
"bw_up": 100,
"interface_type": "logical",
"tenant": "default",
"entry_time": 1603189563640,
"rx_pkts": 0,
"af_type": "IPv4",
"rx_pps": 0,
"vmanage_system_ip": "1.1.1.6",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 0,
"vdevice_name": "1.1.1.6",
"up_capacity_percentage": 0,
"vip_idx": 16,
"host_name": "BR2-CSR1000v",
"vpn_id": 0,
"id": "Ju2YRXUB6FA-Z7p5JO8f"
},
{
"down_capacity_percentage": 0,
"tx_pps": 0,
"total_mbps": 0,
"device_model": "vedge-CSR-1000v",
"rx_kbps": 0,
"interface": "Tunnel100002",
"tx_octets": 0,
"oper_status": "Down",
"rx_errors": 0,
"bw_down": 100,
"tx_pkts": 0,
"tx_errors": 0,
"rx_octets": 0,
"statcycletime": 1603190400017,
"admin_status": "Up",
"bw_up": 100,
"interface_type": "logical",
"tenant": "default",
"entry_time": 1603189563640,
"rx_pkts": 0,
"af_type": "IPv4",
"rx_pps": 0,
"vmanage_system_ip": "1.1.1.6",
"tx_drops": 0,
"rx_drops": 0,
"tx_kbps": 0,
"vdevice_name": "1.1.1.6",
"up_capacity_percentage": 0,
"vip_idx": 17,
"host_name": "BR2-CSR1000v",
"vpn_id": 0,
"id": "J-2YRXUB6FA-Z7p5JO8f"
},
Hope this helps.
02-27-2024 08:03 AM
Thank youv @bigevilbeard
With your help I got the information I needed, but I am confused, isn't the API "dataservice/statistics/interface"? Where did this "/dataservice/data/device/statistics/interfacestatistics" come from?
02-27-2024 09:17 AM
Great news @Douglas Aguirre it is listed on the doc here https://developer.cisco.com/docs/sdwan/20-4/#!bulk-api/request-parameters-1
03-03-2025 12:02 PM
Hi @bigevilbeard, I tried this but I am always getting this response from Postman. Any advice? TIA!
03-04-2025 01:35 AM
@Sors the API is expecting a required field in your request, but the field is either missing or set to null.
Hope this helps.
03-04-2025 03:19 AM
Hello @Sors,
Can you post the code/request you are using?
03-04-2025 11:56 AM
Hi @Torbjørn thank you for your response! Here it is.
https://{{vmanage}}/dataservice/statistics/interface
03-05-2025 01:08 AM
The API has changed since this question was originally posted. You must now supply a query parameter which previously was not required for the /statistics/interface endpoint. If you use the GET method this must be supplied as a query-string and if you use a POST you must supply it in the request body. I prefer the POST version.
Here's an example I have tested using the always on sandbox using the example query from the API docs:
import requests
import json
base_url = ""
username = ""
password = ""
# Get session cookie
payload = f"j_username={username}&j_password={password}"
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
response = requests.request("POST", base_url + "/j_security_check", headers=headers, data=payload, verify=False)
session_cookie = response.headers["set-cookie"]
# Get XSRF Token
headers = {
'Content-Type': 'application/json',
'Cookie': session_cookie
}
response = requests.request("GET", base_url + "/dataservice/client/token", headers=headers, verify=False)
xsrf_token = response.text
# Get interface statistics
payload = json.dumps({
"query": {
"condition": "AND",
"rules": [
{
"value": [
"24"
],
"field": "entry_time",
"type": "date",
"operator": "last_n_hours"
},
{
"value": [
"10.10.1.13"
],
"field": "vdevice_name",
"type": "string",
"operator": "in"
}
]
}
})
headers = {
'Cookie': session_cookie,
'X-XSRF-TOKEN': xsrf_token,
'Content-Type': 'application/json'
}
response = requests.request("POST", base_url + "/dataservice/statistics/interface", headers=headers, data=payload, verify=False).json()
# "Pretty-print" response body
print(json.dumps(response.text,indent=2))
Note: This is not good code and should only be used as an example for how to query the API endpoint.
You can read more about the API endpoint here: https://developer.cisco.com/docs/sdwan/sd-wan-vmanage-v20-16/
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide