show module uptime

show module uptime

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 module uptime",
  "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 module uptime",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_uptimeinf": {
            "ROW_uptimeinf": {
              "slot": 0,
              "starttime": "Wed Aug  8 18:04:49 2018",
              "daysup": 0,
              "hoursup": 1,
              "minutesup": 55,
              "secondsup": 20
            }
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show module uptime 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 module uptime
------ Module 1 -----
Module Start Time:   Wed Aug  8 18:04:49 2018
Up Time:             0 days, 1 hours, 54 minutes, 45 seconds