Installing and testing the new pywbem 0.8 (development version)

Written by - 2 comments

Published on - Listed in Linux Nagios Monitoring VMware


The python module "pywbem" is the essential piece of the monitoring plugin check_esxi_hardware. It allows to gather information from the ESXi CIM server and therefore detect hardware failures.

In the last couple of years pywbem was patched directly by several distributions (Red Hat, SuSE, Ubuntu to name a few) - yet the upstream (original) development of pywbem was stuck in version 0.7.0.

A few months ago, the pywbem project on SourceForge was revived and a new release is just about the corner. Currently there are several development releases of the new version 0.8.0 available for download. You can manually install the new version with the following steps.

1. Download the newest zip file from http://sourceforge.net/projects/pywbem/files/pywbem/pywbem-0.8.0/

2. Make sure you have python installed, otherwise install python. Simply launch the "python" command to see if python is installed:

python
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

3. Install the python module "M2Crypto". This is a new requirement for pywbem 0.8.0. The packet name is "python-M2Crypto" in openSUSE and "python-m2crypto" in Debian/Ubuntu.

zypper in python-M2Crypto

 4. As root user, unzip the pywbem zip file and launch the python setup script:

unzip pywbem-0.8.0-dev.r728.zip
cd pywbem-0.8.0-dev

python setup.py install
[...]
running install_scripts
copying build/scripts-2.7/wbemcli.py -> /usr/bin
copying build/scripts-2.7/mof_compiler.py -> /usr/bin
changing mode of /usr/bin/wbemcli.py to 755
changing mode of /usr/bin/mof_compiler.py to 755
running install_egg_info
Writing /usr/lib/python2.7/site-packages/pywbem-0.8.0_dev-py2.7.egg-info

5. Test if pywbem can be imported as a python module:

python
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywbem
>>> exit()

There was no error after the import command which means the installation worked.

Now I can test the CIM connection:

python
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywbem
>>> wbemclient = pywbem.WBEMConnection('https://myesxi.internal', ('root', 'mypass'))
>>> c=wbemclient.EnumerateInstances('CIM_Card')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pywbem/cim_operations.py", line 1018, in EnumerateInstances
    **params)
  File "pywbem/cim_operations.py", line 592, in imethodcall
    timeout=self.timeout)
  File "pywbem/cim_http.py", line 542, in wbem_request
    h.endheaders()
  File "/usr/lib64/python2.7/httplib.py", line 991, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 844, in _send_output
    self.send(msg)
  File "pywbem/cim_http.py", line 333, in send
    self.connect()
  File "pywbem/cim_http.py", line 419, in connect
    "SSL error %s: %s" % (str(arg.__class__), arg))
pywbem.cim_http.ConnectionError: SSL error <class 'M2Crypto.SSL.SSLError'>: certificate verify failed

Oops. Error. But that's expected. One of the patches added more security in the wbem connection by validating the returned certificate. This bug is already documented in the check_esxi_hardware FAQ. As a workaround, an additional parameter can be added to the pywbem.WBEMConnection function, but in the original 0.7.0 version this parameter does not exist and therefore breaks compatibility.

But now with the newer 0.8.0 version the version name can be read:

python
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywbem
>>> import pkg_resources
>>> pkg_resources.get_distribution("pywbem").version
'0.8.0-dev'
>>> exit()

Hence there is now a difference now between the original 0.7.0 and the newer 0.8.0 version which can be checked before applying the additional parameter into the pywbem.WBEMConnection function.

As soon as the 0.8.0 is officially out, I hope that Linux distributions will start to roll out the upstream version again and then you can expect a final bug fix in check_esxi_hardware, too.


Add a comment

Show form to leave a comment

Comments (newest first)

Claudio Kuenzler from Switzerland wrote on Apr 28th, 2016:

Now that pywbem 0.8.x is officially released, the easiest method (by far!) is to just use pip.

pip install pywbem


And you're all set.


Gordon Rogers from wrote on Apr 28th, 2016:

Thanks for your help, Installing pywbem & is difficult

Thanks to: https://the.randomengineer.com/2014/07/29/ssl-for-python-m2crypto-on-windows/

I now have the ESX script running again with Python 2.7.11 on Windows 7.

My steps:
Download pywbem-0.8.0 as per step 1
In windows you will now get an error when installing with:
C:\Python27\pywbem-0.8.0-dev>setup.py install

So you need to get M2Crypto installed.
Thanks to:
https://the.randomengineer.com/2014/07/29/ssl-for-python-m2crypto-on-windows/
Grab the M2CryptoWin32 package and install with:
C:\Python27\M2CryptoWin32-0.21.1-3>setup.py install


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder