Websocket Samples
Site Device Command Output
When the command is triggered with the API Request, the API Response will provide a session_id that will be included in the Websocket streamed data. This information can be leverage when multiple commands are triggered at the same time to identify to which command the data is related to.
Websocket Endpoint
WS /api-ws/v1/streamSubscribe Command
{
"subscribe": "/sites/{site_id}/devices/{device_id}/cmd"
}Available Commands and Outputs
ARP From Device
- API Call to trigger the command: ARP from Device
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "session_id",
"raw":
"Output": "\tMAC\t\tDEV\tVLAN\tRx Packets\t\t Rx Bytes\t\tTx Packets\t\t Tx Bytes\tFlows\tIdle sec\n-----------------------------------------------------------------------------------------------------------------------"
}
}Bounce Device Port
- API Call to trigger the command: Ports Bounce From Switch
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "session_id",
"raw": "Port bounce complete."
}
}Device Traceroute
- API Call to trigger the command: Traceroute From Device
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "9106e908-74dc-4a4f-9050-9c2adcaf44a5",
"raw": "Running traceroute...\ntraceroute to 8.8.8.8, 64 hops max\n 0 192.168.1.1 1 ms 192.168.1.1 1 ms 192.168.1.1 1 ms\n 1 80.10.236.81 2 ms 80.10.236.81 4 ms 80.10.236.81 2 ms\n 2 193.253.80.250 3 ms 193.253.80.250 2 ms 193.253.80.250 2 ms\n 3 193.252.159.41 2 ms 193.252.159.41 1 ms 193.252.159.41 3 ms\n"
}
}Ping
- API Call to trigger the command: Ping From Device
- Websocket stream output:
{
"event": "data",
"channel": "/sites/4ac1dcf4-9d8b-7211-65c4-057819f0862b/devices/00000000-0000-0000-1000-5c5b350e0060/cmd",
"data": {
"session": "session_id",
"raw": "64 bytes from 23.211.0.110: seq=8 ttl=58 time=12.323 ms\n"
}
}Show ARP Table
- API Call to trigger the command: Show Site Device Mac Table
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "ee093810-7cb2-4fd0-bcd4-54dc7fd4f2f0",
"raw": "{\"status\":\"SUCCESS\",\"finished\":true,\"columns\":[{\"id\":\"device_interface\",\"display_name\":\"Device Interface\",\"type\":\"STRING\"},{\"id\":\"vlan\",\"display_name\":\"Vlan\",\"type\":\"NUMBER\"},{\"id\":\"ip_address\",\"display_name\":\"IP Address\",\"type\":\"STRING\"},{\"id\":\"destination_mac\",\"display_name\":\"Destination MAC\",\"type\":\"STRING\"},{\"id\":\"state\",\"display_name\":\"State\",\"type\":\"STRING\"}],\"message\":\"Arp Table\",\"rows\":[{\"device_interface\":\"ge-0/0/0\",\"vlan\":0,\"ip_address\":\"192.168.1.1\",\"destination_mac\":\"ac:d7:5b:13:a6:60\",\"state\":\"Valid\"},{\"device_interface\":\"ge-0/0/1\",\"vlan\":0,\"ip_address\":\"192.168.0.1\",\"destination_mac\":\"2a:30:44:98:a1:e8\",\"state\":\"Valid\"}]}\\n\"}}"
}
}Show Device Dhcp Leases
- API Call to trigger the command: Show Site Device Dhcp Leases
Show Device BGP Summary
- API Call to trigger the command: Show Site Device Forwarding Table
{
"event": "data",
"channel": "/sites/d6fb4f96-3ba4-4cf5-8af2-a8d7b85087ac/devices/00000000-0000-0000-1000-0200010edbca/cmd",
"data": {
"session": "e1b7b934-a375-4e73-85fa-1a8e0ab1425f",
"raw": "% No BGP neighbors found in VRF default"
}
}Show Device Forwarding Table
- API Call to trigger the command: Show Site Device Forwarding Table
Show Gateway OSPF Database
- API Call to trigger the command: Show Site Gateway OSPF Database
Show Gateway OSPF Interfaces
- API Call to trigger the command: Show Site Gateway OSPF Interfaces
Show Gateway OSPF Neighbors
- API Call to trigger the command: Show Site Gateway OSPF Neighbors
Show Gateway OSPF Summary
- API Call to trigger the command: Show Site Gateway OSPF Summary
Show SSR Service Path
- API Call to trigger the command: Show Site SSR Service Path
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "5cb8a6db-d11a-42cd-bed7-19e9f29e637b",
"raw": "{\"status\":\"SUCCESS\",\"finished\":true,\"rows\":[{\"service\":\"management\",\"type\":\"service-agent\",\"network_interface\":\"ge-0/0/0\",\"destination\":\"\",\"gateway_ip\":\"192.168.1.1\",\"vector\":\"\",\"cost\":0,\"rate\":0,\"state\":\"Up\",\"capacity\":\"0/unlimited\",\"meetsSLA\":\"Yes\"},{\"service\":\"management\",\"type\":\"service-agent\",\"network_interface\":\"ge-0/0/1\",\"destination\":\"\",\"gateway_ip\":\"192.168.0.1\",\"vector\":\"\",\"cost\":0,\"rate\":0,\"state\":\"Up\",\"capacity\":\"0/unlimited\",\"meetsSLA\":\"Yes\"}]}\n"
}
}Show SSR/SRX Routes
- API Call to trigger the command: Show Site SSR and SRX Routes
Show SSR/SRX Sessions
- API Call to trigger the command: Show Site SSR and SRX Sessions
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "f517bf29-1141-41ae-a084-17cacb0ccb57",
"raw": "{\"status\":\"SUCCESS\",\"finished\":true,\"rows\":[{\"session_id\":\"a04b1cc7-dcc1-40a6-a010-0fe46ca38551\",\"direction\":\"forward\",\"service\":\"internet\",\"tenant\":\"SRV.PRD-Core\",\"device_interface\":\"ge-0/0/3\",\"network_interface\":\"ge-0/0/3.100\",\"protocol\":\"TCP\",\"source_ip\":\"10.3.20.101\",\"source_port\":45733,\"destination_ip\":\"13.38.46.35\",\"destination_port\":443,\"nat_ip\":\"192.168.1.115\",\"nat_port\":45256,\"payload_encrypted\":false,\"timeout\":1581,\"uptime\":319},{\"session_id\":\"a04b1cc7-dcc1-40a6-a010-0fe46ca38551\",\"direction\":\"reverse\",\"service\":\"internet\",\"tenant\":\"SRV.PRD-Core\",\"device_interface\":\"ge-0/0/0\",\"network_interface\":\"ge-0/0/0\",\"protocol\":\"TCP\",\"source_ip\":\"13.38.46.35\",\"source_port\":443,\"destination_ip\":\"192.168.1.115\",\"destination_port\":45256,\"nat_ip\":\"0.0.0.0\",\"nat_port\":0,\"payload_encrypted\":false,\"timeout\":1581,\"uptime\":319}]}\n"
}
}SSR Service Ping
- API Call to trigger the command: Service Ping From SSR
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "session_id",
"raw": "64 bytes from 23.211.0.110: seq=8 ttl=58 time=12.323 ms\n"
}
}Switch Cable Test
- API Call to trigger the command: Cable Test From Switch
- Websocket stream output:
{
"channel": "/sites/d6fb4f96-xxxx-xxxx-xxxx-xxxxxxxxxxxx/devices/00000000-0000-0000-1000-xxxxxxxxxxxx/cmd",
"event": "data",
"data": {
"session": "session_id",
"raw": "Interface TDR detail:\nTest status : Test successfully executed ge-0/0/0\n"
}
}