on 12-21-2015 08:06 PM - edited on 02-28-2019 12:37 AM by tamathur
Installation:
pip install ucsmsdk
Install pip (skip if pip is already available):
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
git clone https://github.com/CiscoUcs/ucsmsdk.git
cd ucsmsdk
make install
Uninstall:
pip uninstall ucsmsdk
Documentation:
https://CiscoUcs.github.io/ucsmsdk_docs/
Samples:
GitHub - CiscoUcs/ucsmsdk_samples
Features 0.9.3.1 (2017-01-25)
Features v0.9.3.0:
handle.estimate_impact
convert_to_ucs_python
easier. bin/watch_ucs.py in the github repo.get_inventory
API
Features v0.9.2.0:
convert_from_backup
get_ucs_tech_support
in favour of get_tech_support
. The newer
Features v0.9.1.1:
wait_for_event
method. UcsEventHandler
internals are hidden from user.tag
parameter in add_mo
, set_mo
, remove_mo
, commit_mo
convert_to_ucs_python
exception in some scenariosconvert_to_ucs_python
not displaying python script for Java6u45
Features v0.9.1.0:
compare_ucs_mo
sync_ucs_mo
filter_str
in query_children
methodget_meta_info
UcsEventHandler
Login
methodnot
filter not generating filter requestremove_from_ucs=True
gui_log=True
Features v0.9.0.0:
Github:
https://github.com/CiscoUcs/ucsmsdk/
PyPi:
https://pypi.python.org/pypi/ucsmsdk/0.9.1.1
A slide-deck in markdown describing some of the changes:
stash/slides.md at master · CiscoUcs/stash · GitHub
Community:
We are also on Slack - slack requires registration, but the ucspython team is open invitation to anyone to register here
Quick reference for PythonSDK commands is available for download.Please find it attached below as
LE-45204-PythonSDKPoster.pdf
Note:
0.9.1.0 is not backward compatible with any of the earlier SDKs. It is re-written to be more pythonic and moves away from the earlier JAVA like syntax.
Thank you very much for this. We need to build more and more support around Python and less around powershell.
Hi,
When I use "convert_to_ucs_python()" and create an VLAN on UCSM, the following error was shown:
=================================
>>> from ucsmsdk.utils.converttopython import convert_to_ucs_python
>>> convert_to_ucs_python()
### Please review the generated cmdlets before deployment.
ucsm logfile: /Users/shito/Library/Application Support/Oracle/Java/Deployment/log/.ucsm/centrale_51953.log
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ucsmsdk/utils/converttopython.py", line 1521, in convert_to_ucs_python
File "ucsmsdk/utils/converttopython.py", line 1316, in _find_xml_requests_in_file
File "ucsmsdk/utils/converttopython.py", line 1293, in _extract_xml
File "ucsmsdk/utils/converttopython.py", line 1237, in _generate_cmdlets
File "ucsmsdk/utils/converttopython.py", line 646, in _generate_config_conf_cmdlets
File "ucsmsdk/utils/converttopython.py", line 391, in _get_config_conf_cmdlet
File "ucsmsdk/utils/converttopython.py", line 513, in _form_configconf_cmdlet
File "ucsmsdk/utils/converttopython.py", line 79, in _get_class_id_for_dn
File "ucsmsdk/utils/converttopython.py", line 102, in _get_class_id_for_rn
File "ucsmsdk/ucscoreutils.py", line 231, in get_mo_property_meta
File "ucsmsdk/ucscoreutils.py", line 139, in load_class
ImportError: No module named TopRoot
>>>
=================================
How can I address this?
Regards,
Shin
Shin,
This issue has been fixed and is a part of the latest development code on https://github.com/ciscoucs/ucsmsdk
This will be released as a part of 0.9.1.1 and then available via pip also.
Thanks,
-Vikrant
Vikrant,
Thank you for your update on this. Will install 0.9.1.1 later and confirm in my env.
Anyway, when will the GA version of UCS Python SDK be released?
Regards,
Shin
Hi, and thx for your work in this as it should prove very valuable.
I have an issue when I run..
# launch the UCSM GUI
ucs_gui_launch(handle)
I get the following error around having an issue launching Java....but I have the SDK installed as this works doing it manually via Google Chrome....but I dod have issue wit FF though (maybe a clue)....
.............
2016-09-05 15:12:05,492 - ucs - DEBUG - AuthToken: <91981298051670086458591>
2016-09-05 15:12:05,511 - ucs - DEBUG - UCSM URL: <https://10.x.x.x:443/ucsm/ucsm.jnlp?ucsmToken=91981298051670086458591>
2016-09-05 15:12:05,526 - ucs - DEBUG - javaws path: </usr/bin/javaws>
2016-09-05 15:12:05,655 - ucs - DEBUG - Temp Directory: </var/folders/cb/2dd7r4pd4l1c9lp2zswg__240000gp/T>
Traceback (most recent call last):
File "/Users/micdoher/Documents/Projects/Python Scripts/ucsm.py", line 19, in <module>
ucs_gui_launch(handle)
File "/usr/local/lib/python2.7/site-packages/ucsmsdk/utils/ucsguilaunch.py", line 119, in ucs_gui_launch
raise e
CalledProcessError: Command '[u'java', u'-version']' returned non-zero exit status 1
................
Any thoughts please (btw, using Python 2.7 on a Mac/El Capitan and the latest SDK download)
Cheers
md
................
OK, an update on this .....
I found the following which has helped me move forward as there was an Issue with the Java version….
https://support.apple.com/kb/DL1572?locale=en_GB
After applying the older version of Java,I don’t get any of the Python version errors anymore but it still won’t replicate the code in the Python interpreter (IDLE) and I get the following: -
-----------------------------------------------------]
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:40:04,753 [com.nuova.centrale.core.comms.NuServerCommunicationManager] - Sending requestcom.nuova.centrale.imp.config.ResolveClassMe@7635de1c
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:40:04,765 [latency] - Request-Response Latency (ms):12
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:40:04,766 [com.nuova.centrale.core.comms.NuServerCommunicationManager] -
[---------- Received Response from Server -----------
HTML Headers:
Response: HTTP/1.1 200 OK
Date: Sun, 04 Sep 2016 07:19:52 GMT
Server: Apache/2.4.16 (Unix) CiscoSSL/1.0.1l.4.8-fips
Content-Length: 352
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/soap+xml
[----------debugBuffer----------------]
<configResolveClass cookie="[hidden]" response="yes" classId="topSystem"> <outConfigs> <topSystem address="10.55.154.6" currentTime="2016-09-04T07:19:52.847" descr="" dn="sys" ipv6Addr="::" mode="cluster" name="UCSPE-10-55-154-6" owner="" site="" systemUpTime="01:21:04:16"/> </outConfigs> </configResolveClass>
-----------------------------------------------------]
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,757 [com.nuova.centrale.core.comms.NuServerCommunicationManager] - getting connection for requestcom.nuova.centrale.imp.config.ResolveClassMe@7fc39c69
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,757 [com.nuova.centrale.core.comms.NuServerCommunicationManager] -
[------------- Sending Request to Server ------------
<configResolveClass
classId="topSystem"
inHierarchical="false">
<inFilter>
</inFilter>
</configResolveClass>
-----------------------------------------------------]
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,757 [com.nuova.centrale.core.comms.NuServerCommunicationManager] - Sending requestcom.nuova.centrale.imp.config.ResolveClassMe@7fc39c69
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,768 [latency] - Request-Response Latency (ms):11
DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,769 [com.nuova.centrale.core.comms.NuServerCommunicationManager] -
[---------- Received Response from Server -----------
HTML Headers:
Response: HTTP/1.1 200 OK
Date: Sun, 04 Sep 2016 07:20:52 GMT
Server: Apache/2.4.16 (Unix) CiscoSSL/1.0.1l.4.8-fips
Content-Length: 352
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/soap+xml
[----------debugBuffer----------------]
<configResolveClass cookie="[hidden]" response="yes" classId="topSystem"> <outConfigs> <topSystem address="10.55.154.6" currentTime="2016-09-04T07:20:52.831" descr="" dn="sys" ipv6Addr="::" mode="cluster" name="UCSPE-10-55-154-6" owner="" site="" systemUpTime="01:21:05:16"/> </outConfigs> </configResolveClass>
-----------------------------------------------------]
Michael,
Sometime there are issues in detecting the log file by PYTHON SDK kit based on the Operating systems. Please follow the steps below to fix that issues.
code $cd ~ $sudo find . -name '.ucsm' ./Library/Application Support/Oracle/Java/Deployment/log/.ucsm
convert_to_ucs_python(log_path="/Users/<username>//Library/Application Support/Oracle/Java/Deployment/log/.ucsm")
Regards,Devi
Hi and thanks for your work.
When I try to use UcsHandle, python sends me this error :
>>> from ucsmsdk.ucshandle import UcsHandle
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\PP05647S\Documents\ucsmsdk-0.9.0.0\ucsmsdk\ucshandle.py", line
17, in <module>
import ucsgenutils
ImportError: No module named 'ucsgenutils'
Do you have an idea on the root cause ?
Hi Shin
Were you able to solve the issue?
I'm using ucsmsdk (0.9.2.0) and I'm having the same problem.
>>> converttopython.convert_to_ucs_python()
### Please review the generated cmdlets before deployment.
ucsm logfile: C:\Users\Daniel\AppData\LocalLow\Sun\Java\Deployment\log\.ucsm\centrale_3724.log
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ucsmsdk\utils\converttopython.py", line 1521, in convert_to_ucs_python
File "ucsmsdk\utils\converttopython.py", line 1316, in _find_xml_requests_in_file
File "ucsmsdk\utils\converttopython.py", line 1293, in _extract_xml
File "ucsmsdk\utils\converttopython.py", line 1237, in _generate_cmdlets
File "ucsmsdk\utils\converttopython.py", line 646, in _generate_config_conf_cmdlets
File "ucsmsdk\utils\converttopython.py", line 391, in _get_config_conf_cmdlet
File "ucsmsdk\utils\converttopython.py", line 513, in _form_configconf_cmdlet
File "ucsmsdk\utils\converttopython.py", line 79, in _get_class_id_for_dn
File "ucsmsdk\utils\converttopython.py", line 102, in _get_class_id_for_rn
File "ucsmsdk\ucscoreutils.py", line 246, in get_mo_property_meta
File "ucsmsdk\ucscoreutils.py", line 159, in load_class
ImportError: No module named TopRoot
>>>
regards
dani
Hi,
I changed the file "easy_install.py" to add the path with /ucsmsdk to solve this, but I have a new problem.
The file ucsgenutils line 169 doesn't use the python3's function print ("()" missing)
I tryed to update to version 0.9.2.0 but got the same issue
Could you help me ?
Hi,
what I know the whole SDK is based on Python 2.7
alex
Hello,
I don't know if this is the right place to handle a problem, but let's try:
I try to install the plugin and does the following:
( the system is Centos 7.3.1611, python 2.7)
download cisco plugin 0.9.4 and extract it in /root:
tar zxvf cisco-ucs-nagios-0.9.4 .tar.gz
download UCS sdk:
pip install ucsmsdk
cd ucsmsdk
make install
Whenever i try to install the plugin with:
./installer.py from the cisco-ucs-nagios-0.9.4 directory, i got the following error:
Searching for Nagios installation path...
Found the following paths :
1. /usr/local/nagios/etc
2. Provide your custom install path
Type in your choice [Default '1'] :
As no input was provided taking option '1' as default.
Nagios installation found at /usr/local/nagios/etc
This Nagios plugin requires Ucs Python SDK to be installed before we can proceed further.
Download the latest Cisco Ucs Python SDK from the following URL
https://communities.cisco.com/docs/DOC-37174
Aborting the installation
What will be the problem? It seems that the software is looking for a plugin with the name "UcsmSdk" and i've a plugin with the lowercase characters.
Jaap
Hi Jaap,
The nagios plugin was built against the old version of the UCS Python SDK, it has been deprecated however you can still download it from here, https://communities.cisco.com/docs/DOC-36899
I recommend that you install the deprecated version of UCS Python SDK and then try the nagios install again.
Regards,
John
Hi,
my CVS has
/usr/local/nagios/share/ucs-autodiscovery/autodiscovery/UCSHostInfo.csv
10.10.20.3,admin,password,80,True
when I run "./NagiosAutoDiscoveryUCS.py"
Error while trying to discover : 10.10.20.3
Error is of Type : URLError Message >> <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
Error while trying to auto discover UCS Infrastructure. Check if any of the UCS are reachable.
the --NoSsl ==True option is supposed to ignore certificate check?
./NagiosAutoDiscoveryUCS.py --version
Cisco UCSM Nagios Auto Discovery version : 0.9.4
Thanks in advance
~Aravind
Hi,
Please check if the ‘HTTP to HTTPS Redirection’ is disabled.
If not please disable it.
If its enable, it means server redirects the HTTP requests to HTTPS.
Thanks
Rahul Gupta
That was the solution! Thanks!
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: