show processes memory

show processes memory

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 processes memory ",
  "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 processes memory ",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_process_memory": {
            "ROW_process_memory": [
              {
                "mem_pid": 1,
                "mem_alloc": 188416,
                "mem_limit": 0,
                "mem_used": 4308992,
                "stack_base_ptr": "14203ba0/14203468",
                "process": "init"
              },
              {
                "mem_pid": 6036,
                "mem_alloc": 2207744,
                "mem_limit": 0,
                "mem_used": 443641856,
                "stack_base_ptr": "ffcf7d90/ffcf7528",
                "process": "dcos_sshd"
              },

…
…
<snip>
…
…
              {
                "mem_pid": 28465,
                "mem_alloc": 638976,
                "mem_limit": 0,
                "mem_used": 87199744,
                "stack_base_ptr": "e3340940/e333fc38",
                "process": "sshd"
              }
            ]
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show processes memory command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show processes memory 

PID    MemAlloc  MemLimit    MemUsed     StackBase/Ptr      Process
-----  --------  ----------  ----------  -----------------  ----------------
    1    188416  0           4308992     14203ba0/14203468  init
6036 2207744 0 443641856 ffcf7d90/ffcf7528 dcos_sshd
6040 2207744 0 443641856 ffcf7d90/ffcf390c dcos_sshd
… 28465 638976 0 87199744 e3340940/e333fc38 sshd All processes: MemAlloc = 6620700672

show processes cpu

show processes cpu

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 processes cpu",
  "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 processes cpu",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_process_cpu": {
            "ROW_process_cpu": [
              {
                "pid": 1,
                "runtime": 3453,
                "invoked": 100181,
                "usecs": 34,
                "onesec": "0.00",
                "process": "init"
              },
              {
                "pid": 6036,
                "runtime": 229,
                "invoked": 143,
                "usecs": 1601,
                "onesec": "0.00",
                "process": "dcos_sshd"
              },

<snip>

              {
                "pid": 28465,
                "runtime": 15,
                "invoked": 215,
                "usecs": 72,
                "onesec": "0.00",
                "process": "sshd"
              }
            ]
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show processes cpu command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show processes cpu 

PID    Runtime(ms)  Invoked   uSecs  1Sec    Process
-----  -----------  --------  -----  ------  -----------
    1         3453    100179     34   0.00%  init
 6036          229       143   1601   0.00%  dcos_sshd
 6040          128      2630     48   0.00%  dcos_sshd


28465           15       215     72   0.00%  sshd