Feb 3, 2010 10:18 AM
python interpreter using different unicode than root
-
Like (0)
I am attempting to use check_esx_wbmem.py to monitor VMware's esxi (free) server. You need to add the PYWbem library to do so. As root, I downloaded pywbem-0.7.0.tar.gz from http://sourceforge.net/projects/pywbem/files/.
I then ran the script as root and it worked successfully.
Then I created a template in Zenoss, and added the script in the datasource tab and tested it. This is the result.
max uni code is |
1114111 |
UCS4 build |
20100203 10:07:09 Connection to https:/xxxxxxxxxx |
20100203 10:07:09 Check classe CIM_ComputerSystem |
Traceback (most recent call last): |
File "/opt/zenoss/libexec/check_esx_wbmem.py", line 83, in ? |
instance_list = wbemclient.EnumerateInstances(classe) |
File "/usr/lib/python2.4/site-packages/pywbem/cim_operations.py", line 403, in EnumerateInstances |
ClassName = CIMClassName(ClassName), |
File "/usr/lib/python2.4/site-packages/pywbem/cim_operations.py", line 178, in imethodcall |
reply_dom = minidom.parseString(resp_xml) |
File "/opt/zenoss/lib/python/_xmlplus/dom/minidom.py", line 1924, in parseString |
from xml.dom import expatbuilder |
File "/opt/zenoss/lib/python/_xmlplus/dom/expatbuilder.py", line 32, in ? |
from xml.parsers import expat |
File "/opt/zenoss/lib/python/_xmlplus/parsers/expat.py", line 4, in ? |
from pyexpat import * |
ImportError: /opt/zenoss/lib/python/_xmlplus/parsers/pyexpat.so: undefined symbol: PyUnicodeUCS2_Decode |
From the Python website, I found this explanation:
PYUnicodeUCS2_Decode == The only way to solve this problem is to use extension modules compiled with a Python binary built using the same size for Unicode characters.
So, as a novice in Python, etc. I'm confused as to why it works as root, but when run as Zenoss it craps out. I can only assume that zenoss's pyexpat.so was compiled with an interpreter where unicode was set to ucs2. How do I get my python script to compile with ucs2 and not ucs4?
Thanks in advance.
When logged in as zenoss user, enter "python -V" at the command prompt. you should get "Python 2.4.4". Do the same as root and see what version you get. Are they the same?
root is Python 2.4.3
zenoss is Python 2.4.4
Ahh, so the plugin you installed as root isn't installed in the python
Zenoss is using. which python should show you the different install
locations. Zenoss and the Zenoss user have their own install of Python
to make sure they get the right version to work...
--
James Pulver
Information Technology Area Supervisor
LEPP Computer Group
Cornell University
ZenKeck wrote, On 2/3/2010 12:09 PM:
root is Python 2.4.3
zenoss is Python 2.4.4
>
As soon as I install pywbem with the /opt/zenoss/bin/python. It worked.
Thanks.
Did a little more digging. Notice that the PATH variable for the zenoss user inserts '/opt/zenoss/bin' as the first path location. In that location is a symlink for the executable 'python'. So the version of python installed as part of the OS can be different from the one used by zenoss.
Try installing the library as the zenoss user. Script should run properly then.
I think I said that, though probably not as clearly as you did.
--
James Pulver
Information Technology Area Supervisor
LEPP Computer Group
Cornell University
phonegi wrote, On 2/3/2010 4:26 PM:
Did a little more digging. Notice that the PATH variable for the zenoss user inserts '/opt/zenoss/bin' as the first path location. In that location is a symlink for the executable 'python'. So the version of python installed as part of the OS can be different from the one used by zenoss.
Try installing the library as the zenoss user. Script should run properly then.
>
I may be late to the thread, but would the WBEM Data Source ZenPack be useful to make an ESXi WBEM ZenPack? Either way, feel free to share your ESXi solution with other Zenoss users as a ZenPack (email me if you're interested).
Thanks,
Matt Ray
Zenoss Community Manager
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||