Skip to content

Commit

Permalink
Document expore script
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Franklin committed Apr 11, 2022
1 parent 2b8d5bf commit 7dd2c39
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion scripts/explore.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/usr/bin/env python3

# Enables exploring the Cisco UCSM API.
# Example usage:
# * List available classes:
# ./scripts/explore.py list-classids
# * Fetch data for a class:
# ./scripts/explore.py query-classid ProcessorEnvStats

import sys
import os
import argparse
from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.ucsconstants import NamingId


def parse_args():
parser = argparse.ArgumentParser(description="Explore UCS API.")
subparsers = parser.add_subparsers(dest='action', help='sub-command help')
Expand All @@ -32,7 +39,26 @@ def get_required_env(env_name):


def main():
"""
Explore the UCSM API.
This script simply calls the UCSM API using credentials set in the
environment to list available classes or fetch data on a given class.
Parameters
----------
action : string
list-classids or query-classid <classid>
Examples
--------
$ explore.py query-classid ProcessorEnvStats
> prints temperature statistics for servers
See Also
--------
UCSM SDK: https://github.com/CiscoUcs/ucsmsdk
"""
args = parse_args()

username = get_required_env('PROM_UCS_USERNAME')
Expand Down

0 comments on commit 7dd2c39

Please sign in to comment.