Check_ESXI_Hardware not working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Check_ESXI_Hardware not working

Post by kwhogster »

Nagios 4.3.4

I am working on having Nagios check my VMware ESXI hosts.

Found this check check_esxi_hardware.py

root@tgcs017:/usr/local/nagios/libexec# ./check_esxi_hardware.py -H 10.2.8.75 -U root -P xxxxxxxxxxxxx
Traceback (most recent call last):
File "./check_esxi_hardware.py", line 267, in <module>
import pywbem
ImportError: No module named pywbem


I get the above error running this

Any ideas ?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check_ESXI_Hardware not working

Post by cdienger »

Looks like you need to install the missing module. Try:

yum install pywbem (https://support.nagios.com/forum/viewto ... =7&t=32330)
or
sudo pip intall pywbem (http://pywbem.github.io/pywbem/installation.html)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_ESXI_Hardware not working

Post by kwhogster »

Fails to install Ubuntu 16.04.1 LTS


root@tgcs017:/usr/local/nagios/libexec# sudo pip install pywbem
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pywbem
Using cached https://files.pythonhosted.org/packages ... ne-any.whl
Requirement already satisfied: PyYAML>=3.13 in /usr/local/lib/python2.7/dist-packages (from pywbem) (3.13)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python2.7/dist-packages (from pywbem) (1.10.0)
Collecting M2Crypto>=0.31.0; python_version < "3.0" and sys_platform != "win32" (from pywbem)
Using cached https://files.pythonhosted.org/packages ... 2.0.tar.gz
Requirement already satisfied: ply>=3.10 in /usr/local/lib/python2.7/dist-packages (from pywbem) (3.11)
Collecting pbr>=1.10.0 (from pywbem)
Using cached https://files.pythonhosted.org/packages ... ne-any.whl
Collecting mock>=2.0.0 (from pywbem)
Using cached https://files.pythonhosted.org/packages ... ne-any.whl
Requirement already satisfied: typing in /usr/local/lib/python2.7/dist-packages (from M2Crypto>=0.31.0; python_version < "3.0" and sys_platform != "win32"->pywbem) (3.6.6)
Collecting funcsigs>=1; python_version < "3.3" (from mock>=2.0.0->pywbem)
Using cached https://files.pythonhosted.org/packages ... ne-any.whl
Building wheels for collected packages: M2Crypto
Building wheel for M2Crypto (setup.py) ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-5e2geV/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-FbE157 --python-tag cp27:
running bdist_wheel
running build
running build_py
copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.7/M2Crypto
creating build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
running build_ext
building 'M2Crypto._m2crypto' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/SWIG
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/tmp/pip-install-5e2geV/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
SWIG/_m2crypto_wrap.c:3557:25: fatal error: openssl/err.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Failed building wheel for M2Crypto
Running setup.py clean for M2Crypto
Failed to build M2Crypto
Installing collected packages: M2Crypto, pbr, funcsigs, mock, pywbem
Running setup.py install for M2Crypto ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-5e2geV/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-3A4RRP/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/six.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/util.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.7/M2Crypto
copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.7/M2Crypto
creating build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.7/M2Crypto/SSL
running build_ext
building 'M2Crypto._m2crypto' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/SWIG
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -I/tmp/pip-install-5e2geV/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
SWIG/_m2crypto_wrap.c:3557:25: fatal error: openssl/err.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-5e2geV/M2Crypto/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-3A4RRP/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-5e2geV/M2Crypto/
root@tgcs017:/usr/local/nagios/libexec#





On Ubuntu

it is apt-get install


thomas@tgcs017:~$ sudo apt-get install pywbem
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pywbem
thomas@tgcs017:~$
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check_ESXI_Hardware not working

Post by cdienger »

Try:

sudo apt-get install python-pywbem
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_ESXI_Hardware not working

Post by kwhogster »

Thank you


That worked great

root@tgcs017:/usr/local/nagios/libexec# ./check_esxi_hardware.py --host=10.2.8.75 --user=root --pass=########### --cimport=5989
UNKNOWN: (0, 'Socket error: [Errno 111] Connection refused')

getting further

I think I need to run this next on each host

esxcli system wbem set --enable true
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Check_ESXI_Hardware not working

Post by kwhogster »

Update

Now the check works after running

esxcli system wbem set --enable true on Host using SSH

then ran this

root@tgcs017:/usr/local/nagios/libexec# ./check_esxi_hardware.py --host=10.2.8.10 --user=root --pass=############ --cimport=5989
OK - Server: Dell Inc. PowerEdge R310 s/n: DWQV7V1 System BIOS: 1.9.2 2012-04-27


Now off to do the other hosts and create the Nagios command

This can be locked as resolved.

Thank you
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Check_ESXI_Hardware not working

Post by cdienger »

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked