show sockets client tcp
Python
Copy
import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show sockets client tcp",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show sockets client tcp",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_cl_sk": {
            "ROW_cl_sk": [
              {
                "prefix": "",
                "client-name": "dcos-xinetd",
                "pid": 29001,
                "No-of-clients": 3
              },
              {
                "prefix": "",
                "client-name": "sla_r",
                "pid": 30259,
                "No-of-clients": 100
              },
              {
                "prefix": "",
                "client-name": "sla_s",
                "pid": 30258,
                "No-of-clients": 56
              },
              {
                "prefix": "",
                "client-name": "nginx_1_fe",
                "pid": 31175,
                "No-of-clients": 4
              },
              {
                "prefix": "",
                "client-name": "nginx_1_fe",
                "pid": 31181,
                "No-of-clients": 5
              },
              {
                "prefix": "",
                "client-name": "snmpd",
                "pid": 28997,
                "No-of-clients": 2
              },
              {
                "prefix": "",
                "client-name": "dcos_sshd",
                "pid": 11425,
                "No-of-clients": 2
              },
              {
                "prefix": "",
                "client-name": "dcos_sshd",
                "pid": 11441,
                "No-of-clients": 2,
                "TABLE_sp_cl": {
                  "ROW_sp_cl": {
                    "can-requests": 209958,
                    "can-unblocks": 182575,
                    "can-misses": 26808,
                    "sel-drops": 575,
                    "sel-wakes": 182575
                  }
                }
              }
            ]
          },
          "TABLE_total_clients": {
            "ROW_total_clients": {
              "socket-type": "TCP",
              "total-clients": 8
            }
          }
        }
      }
    }
  }
}