mirror of
https://github.com/Napsty/check_esxi_hardware.git
synced 2026-02-06 15:15:20 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
489da3de76 | ||
|
|
bcf607b2cb | ||
|
|
ff3228b804 | ||
|
|
08cf10de24 | ||
|
|
df56d7373d | ||
|
|
6aebd1a4bb | ||
|
|
96aced6377 |
77
.github/workflows/python2check.yml
vendored
Normal file
77
.github/workflows/python2check.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# @file python2check.yml
|
||||||
|
---
|
||||||
|
name: Python2 check
|
||||||
|
|
||||||
|
# Trigger the workflow on push or pull request
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
python2-pywbem08:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: '2.7'
|
||||||
|
- name: Install pywbem from apt
|
||||||
|
run: |
|
||||||
|
sudo apt-get install -qq -yy python-pywbem
|
||||||
|
- name: Set environment PYTHONPATH
|
||||||
|
run: |
|
||||||
|
export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
- name: Launch script with --help
|
||||||
|
run: |
|
||||||
|
./check_esxi_hardware.py --help
|
||||||
|
|
||||||
|
# Jobs with PIP installations are currently disabled.
|
||||||
|
# python2-pywbem09:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '2.7'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python-pip
|
||||||
|
# pip install pywbem==0.9.1
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# python2-pywbem012:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '2.7'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python-pip
|
||||||
|
# pip install pywbem==0.12.6
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# python2-pywbem014:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '2.7'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python-pip
|
||||||
|
# pip install pywbem==0.14.6
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
114
.github/workflows/python3check.yml
vendored
Normal file
114
.github/workflows/python3check.yml
vendored
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
# @file python3check.yml
|
||||||
|
---
|
||||||
|
name: Python3 check
|
||||||
|
|
||||||
|
# Trigger the workflow on push or pull request
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
simple-output:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Simple hello world
|
||||||
|
run: echo "Hello World"
|
||||||
|
# python3-pywbem-latest:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '3.8'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python3-pip
|
||||||
|
# pip3 install pywbem
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python/3.8.0/x64/lib/python3.8/site-packages
|
||||||
|
# - name: Verify python sys.path
|
||||||
|
# run: (echo "import sys"; echo "print(', '.join(sys.path))") | python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# python3-pywbem-08:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '3.x'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python3-pip
|
||||||
|
# pip3 install pywbem==0.8.4
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# python3-pywbem-012:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '3.x'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python3-pip
|
||||||
|
# pip3 install pywbem==0.12.6
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# python3-pywbem-013:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '3.x'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python3-pip
|
||||||
|
# pip3 install pywbem==0.13.1
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# python3-pywbem-014:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '3.x'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python3-pip
|
||||||
|
# pip3 install pywbem==0.14.6
|
||||||
|
# - name: Set environment PYTHONPATH
|
||||||
|
# run: |
|
||||||
|
# export PYTHONPATH=/opt/hostedtoolcache/Python
|
||||||
|
# - name: Launch script with --help
|
||||||
|
# run: |
|
||||||
|
# ./check_esxi_hardware.py --help
|
||||||
|
# find-pywbem:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v1
|
||||||
|
# - uses: actions/setup-python@v1
|
||||||
|
# with:
|
||||||
|
# python-version: '3.x'
|
||||||
|
# - name: Install latest pywbem from pip
|
||||||
|
# run: |
|
||||||
|
# sudo apt-get install -qq -yy python-pip
|
||||||
|
# pip install pywbem
|
||||||
|
# - name: Find pywbem module
|
||||||
|
# run: |
|
||||||
|
# find / -name 'pywbem-*'
|
||||||
@@ -8,4 +8,4 @@ This is the public git repository for development of the plugin.
|
|||||||
|
|
||||||
Documentation + Production Ready Plugin
|
Documentation + Production Ready Plugin
|
||||||
-------------
|
-------------
|
||||||
Please refer to http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
|
Please refer to https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
# Copyright (c) 2008 David Ligeret
|
# Copyright (c) 2008 David Ligeret
|
||||||
# Copyright (c) 2009 Joshua Daniel Franklin
|
# Copyright (c) 2009 Joshua Daniel Franklin
|
||||||
# Copyright (c) 2010 Branden Schneider
|
# Copyright (c) 2010 Branden Schneider
|
||||||
# Copyright (c) 2010-2018 Claudio Kuenzler
|
# Copyright (c) 2010-2019 Claudio Kuenzler
|
||||||
# Copyright (c) 2010 Samir Ibradzic
|
# Copyright (c) 2010 Samir Ibradzic
|
||||||
# Copyright (c) 2010 Aaron Rogers
|
# Copyright (c) 2010 Aaron Rogers
|
||||||
# Copyright (c) 2011 Ludovic Hutin
|
# Copyright (c) 2011 Ludovic Hutin
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
# The VMware 5.x CIM API is documented here:
|
# The VMware 5.x CIM API is documented here:
|
||||||
# http://pubs.vmware.com/vsphere-50/index.jsp?nav=/5_1_1
|
# http://pubs.vmware.com/vsphere-50/index.jsp?nav=/5_1_1
|
||||||
#
|
#
|
||||||
# This Nagios plugin is maintained here:
|
# This monitoring plugin is maintained and documented here:
|
||||||
# http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
|
# https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
|
||||||
#
|
#
|
||||||
#@---------------------------------------------------
|
#@---------------------------------------------------
|
||||||
#@ History
|
#@ History
|
||||||
@@ -256,7 +256,19 @@
|
|||||||
#@ Author : Peter Newman
|
#@ Author : Peter Newman
|
||||||
#@ Reason : Throw an unknown if we can't fetch the data for some reason
|
#@ Reason : Throw an unknown if we can't fetch the data for some reason
|
||||||
#@---------------------------------------------------
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20181001
|
||||||
|
#@ Author : Claudio Kuenzler
|
||||||
|
#@ Reason : python3 compatibility
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20190510
|
||||||
|
#@ Author : Claudio Kuenzler
|
||||||
|
#@ Reason : Allow regular expressions from ignore list (-r)
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20190701
|
||||||
|
#@ Author : Phil Randal (phil.randal@gmail.com)
|
||||||
|
#@ Reason : Fix lookup of warranty info for Dell (again)
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import pywbem
|
import pywbem
|
||||||
@@ -264,7 +276,7 @@ import re
|
|||||||
import pkg_resources
|
import pkg_resources
|
||||||
from optparse import OptionParser,OptionGroup
|
from optparse import OptionParser,OptionGroup
|
||||||
|
|
||||||
version = '20180411'
|
version = '20190701'
|
||||||
|
|
||||||
NS = 'root/cimv2'
|
NS = 'root/cimv2'
|
||||||
hosturl = ''
|
hosturl = ''
|
||||||
@@ -351,6 +363,8 @@ timeout = 0
|
|||||||
|
|
||||||
# elements to ignore (full SEL, broken BIOS, etc)
|
# elements to ignore (full SEL, broken BIOS, etc)
|
||||||
ignore_list=[]
|
ignore_list=[]
|
||||||
|
regex_ignore_list=[]
|
||||||
|
regex=False
|
||||||
|
|
||||||
# urlise model and tag numbers (currently only Dell supported, but the code does the right thing for other vendors)
|
# urlise model and tag numbers (currently only Dell supported, but the code does the right thing for other vendors)
|
||||||
urlise_country=''
|
urlise_country=''
|
||||||
@@ -434,7 +448,7 @@ def urlised_server_info(vendor, country, server_info):
|
|||||||
#server_inf = server_info
|
#server_inf = server_info
|
||||||
if vendor == 'dell' :
|
if vendor == 'dell' :
|
||||||
# Dell support URLs (idea and tables borrowed from check_openmanage)
|
# Dell support URLs (idea and tables borrowed from check_openmanage)
|
||||||
du = 'http://www.dell.com/support/troubleshooting/' + dell_country(country) + '19/Product/poweredge-'
|
du = 'http://www.dell.com/support/home/' + dell_country(country) + '04/product-support/product/poweredge-'
|
||||||
if (server_info is not None) :
|
if (server_info is not None) :
|
||||||
p=re.match('(.*)PowerEdge (.*) (.*)',server_info)
|
p=re.match('(.*)PowerEdge (.*) (.*)',server_info)
|
||||||
if (p is not None) :
|
if (p is not None) :
|
||||||
@@ -442,7 +456,7 @@ def urlised_server_info(vendor, country, server_info):
|
|||||||
if md == 'R210 II':
|
if md == 'R210 II':
|
||||||
md='r210-2'
|
md='r210-2'
|
||||||
md=md.lower()
|
md=md.lower()
|
||||||
server_info = p.group(1) + '<a href="' + du + md + '#ui-tabs-4">PowerEdge ' + p.group(2)+'</a> ' + p.group(3)
|
server_info = p.group(1) + '<a href="' + du + md + '/">PowerEdge ' + p.group(2)+'</a> ' + p.group(3)
|
||||||
elif vendor == 'hp':
|
elif vendor == 'hp':
|
||||||
return server_info
|
return server_info
|
||||||
elif vendor == 'ibm':
|
elif vendor == 'ibm':
|
||||||
@@ -457,8 +471,8 @@ def urlised_server_info(vendor, country, server_info):
|
|||||||
def system_tag_url(vendor,country):
|
def system_tag_url(vendor,country):
|
||||||
if vendor == 'dell':
|
if vendor == 'dell':
|
||||||
# Dell support sites
|
# Dell support sites
|
||||||
supportsite = 'http://www.dell.com/support/troubleshooting/'
|
supportsite = 'http://www.dell.com/support/home/'
|
||||||
dellsuffix = 'nodhs1/Index?t=warranty&servicetag='
|
dellsuffix = '19/product-support/servicetag/'
|
||||||
|
|
||||||
# warranty URLs for different country codes
|
# warranty URLs for different country codes
|
||||||
return supportsite + dell_country(country) + dellsuffix
|
return supportsite + dell_country(country) + dellsuffix
|
||||||
@@ -481,14 +495,14 @@ def urlised_serialnumber(vendor,country,SerialNumber):
|
|||||||
|
|
||||||
def verboseoutput(message) :
|
def verboseoutput(message) :
|
||||||
if verbose:
|
if verbose:
|
||||||
print "%s %s" % (time.strftime("%Y%m%d %H:%M:%S"), message)
|
print(time.strftime("%Y%m%d %H:%M:%S"), message)
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
def getopts() :
|
def getopts() :
|
||||||
global hosturl,cimport,user,password,vendor,verbose,perfdata,urlise_country,timeout,ignore_list,get_power,get_volts,get_current,get_temp,get_fan,get_lcd
|
global hosturl,cimport,user,password,vendor,verbose,perfdata,urlise_country,timeout,ignore_list,regex,get_power,get_volts,get_current,get_temp,get_fan,get_lcd
|
||||||
usage = "usage: %prog -H hostname -U username -P password [-C port -V system -v -p -I XX]\n" \
|
usage = "usage: %prog -H hostname -U username -P password [-C port -V vendor -v -p -I XX -i list,list -r]\n" \
|
||||||
"example: %prog -H my-shiny-new-vmware-server -U root -P fakepassword -C 5989 -V auto -I uk\n\n" \
|
"example: %prog -H hostname -U root -P password -C 5989 -V auto -I uk\n\n" \
|
||||||
"or, verbosely:\n\n" \
|
"or, verbosely:\n\n" \
|
||||||
"usage: %prog --host=hostname --user=username --pass=password [--cimport=port --vendor=system --verbose --perfdata --html=XX]\n"
|
"usage: %prog --host=hostname --user=username --pass=password [--cimport=port --vendor=system --verbose --perfdata --html=XX]\n"
|
||||||
|
|
||||||
@@ -514,6 +528,8 @@ def getopts() :
|
|||||||
help="timeout in seconds - no effect on Windows (default = no timeout)")
|
help="timeout in seconds - no effect on Windows (default = no timeout)")
|
||||||
group2.add_option("-i", "--ignore", action="store", type="string", dest="ignore", default="", \
|
group2.add_option("-i", "--ignore", action="store", type="string", dest="ignore", default="", \
|
||||||
help="comma-separated list of elements to ignore")
|
help="comma-separated list of elements to ignore")
|
||||||
|
group2.add_option("-r", "--regex", action="store_true", dest="regex", default=False, \
|
||||||
|
help="allow regular expression lookup of ignore list")
|
||||||
group2.add_option("--no-power", action="store_false", dest="get_power", default=True, \
|
group2.add_option("--no-power", action="store_false", dest="get_power", default=True, \
|
||||||
help="don't collect power performance data")
|
help="don't collect power performance data")
|
||||||
group2.add_option("--no-volts", action="store_false", dest="get_volts", default=True, \
|
group2.add_option("--no-volts", action="store_false", dest="get_volts", default=True, \
|
||||||
@@ -532,14 +548,14 @@ def getopts() :
|
|||||||
|
|
||||||
# check input arguments
|
# check input arguments
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "no parameters specified\n"
|
print("no parameters specified\n")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
# if first argument starts with 'https://' we have old-style parameters, so handle in old way
|
# if first argument starts with 'https://' we have old-style parameters, so handle in old way
|
||||||
if re.match("https://",sys.argv[1]):
|
if re.match("https://",sys.argv[1]):
|
||||||
# check input arguments
|
# check input arguments
|
||||||
if len(sys.argv) < 5:
|
if len(sys.argv) < 5:
|
||||||
print "too few parameters\n"
|
print("too few parameters\n")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
if len(sys.argv) > 5 :
|
if len(sys.argv) > 5 :
|
||||||
@@ -557,7 +573,7 @@ def getopts() :
|
|||||||
mandatories = ['host', 'user', 'password']
|
mandatories = ['host', 'user', 'password']
|
||||||
for m in mandatories:
|
for m in mandatories:
|
||||||
if not options.__dict__[m]:
|
if not options.__dict__[m]:
|
||||||
print "mandatory parameter '--" + m + "' is missing\n"
|
print("mandatory parameter '--" + m + "' is missing\n")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
@@ -578,6 +594,7 @@ def getopts() :
|
|||||||
urlise_country=options.urlise_country.lower()
|
urlise_country=options.urlise_country.lower()
|
||||||
timeout=options.timeout
|
timeout=options.timeout
|
||||||
ignore_list=options.ignore.split(',')
|
ignore_list=options.ignore.split(',')
|
||||||
|
regex=options.regex
|
||||||
get_power=options.get_power
|
get_power=options.get_power
|
||||||
get_volts=options.get_volts
|
get_volts=options.get_volts
|
||||||
get_current=options.get_current
|
get_current=options.get_current
|
||||||
@@ -612,7 +629,7 @@ if os_platform != "win32":
|
|||||||
on_windows = False
|
on_windows = False
|
||||||
import signal
|
import signal
|
||||||
def handler(signum, frame):
|
def handler(signum, frame):
|
||||||
print 'UNKNOWN: Execution time too long!'
|
print('UNKNOWN: Execution time too long!')
|
||||||
sys.exit(ExitUnknown)
|
sys.exit(ExitUnknown)
|
||||||
|
|
||||||
if cimport:
|
if cimport:
|
||||||
@@ -644,7 +661,7 @@ if '0.7.' in pywbemversion:
|
|||||||
c = conntest.EnumerateInstances('CIM_Card')
|
c = conntest.EnumerateInstances('CIM_Card')
|
||||||
except:
|
except:
|
||||||
#raise
|
#raise
|
||||||
verboseoutput("Connection error, disable SSL certification verification (probably patched pywbem)")
|
verboseoutput("Connection error, disable SSL certificate verification (probably patched pywbem)")
|
||||||
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), no_verification=True)
|
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), no_verification=True)
|
||||||
else:
|
else:
|
||||||
verboseoutput("Connection worked")
|
verboseoutput("Connection worked")
|
||||||
@@ -670,19 +687,19 @@ ExitMsg = ""
|
|||||||
if vendor=='auto':
|
if vendor=='auto':
|
||||||
try:
|
try:
|
||||||
c=wbemclient.EnumerateInstances('CIM_Chassis')
|
c=wbemclient.EnumerateInstances('CIM_Chassis')
|
||||||
except pywbem.cim_operations.CIMError,args:
|
except pywbem.cim_operations.CIMError as args:
|
||||||
if ( args[1].find('Socket error') >= 0 ):
|
if ( args[1].find('Socket error') >= 0 ):
|
||||||
print "UNKNOWN: %s" %args
|
print("UNKNOWN: {}".format(args))
|
||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
elif ( args[1].find('ThreadPool --- Failed to enqueue request') >= 0 ):
|
elif ( args[1].find('ThreadPool --- Failed to enqueue request') >= 0 ):
|
||||||
print "UNKNOWN: %s" %args
|
print("UNKNOWN: {}".format(args))
|
||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
else:
|
else:
|
||||||
verboseoutput("Unknown CIM Error: %s" % args)
|
verboseoutput("Unknown CIM Error: %s" % args)
|
||||||
except pywbem.cim_http.AuthError,arg:
|
except pywbem.cim_http.AuthError as arg:
|
||||||
verboseoutput("Global exit set to UNKNOWN")
|
verboseoutput("Global exit set to UNKNOWN")
|
||||||
GlobalStatus = ExitUnknown
|
GlobalStatus = ExitUnknown
|
||||||
print "UNKNOWN: Authentication Error"
|
print("UNKNOWN: Authentication Error")
|
||||||
sys.exit (GlobalStatus)
|
sys.exit (GlobalStatus)
|
||||||
else:
|
else:
|
||||||
man=c[0][u'Manufacturer']
|
man=c[0][u'Manufacturer']
|
||||||
@@ -701,19 +718,19 @@ for classe in ClassesToCheck :
|
|||||||
verboseoutput("Check classe "+classe)
|
verboseoutput("Check classe "+classe)
|
||||||
try:
|
try:
|
||||||
instance_list = wbemclient.EnumerateInstances(classe)
|
instance_list = wbemclient.EnumerateInstances(classe)
|
||||||
except pywbem.cim_operations.CIMError,args:
|
except pywbem.cim_operations.CIMError as args:
|
||||||
if ( args[1].find('Socket error') >= 0 ):
|
if ( args[1].find('Socket error') >= 0 ):
|
||||||
print "UNKNOWN: %s" %args
|
print("UNKNOWN: {}".format(args))
|
||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
elif ( args[1].find('ThreadPool --- Failed to enqueue request') >= 0 ):
|
elif ( args[1].find('ThreadPool --- Failed to enqueue request') >= 0 ):
|
||||||
print "UNKNOWN: %s" %args
|
print("UNKNOWN: {}".format(args))
|
||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
else:
|
else:
|
||||||
verboseoutput("Unknown CIM Error: %s" % args)
|
verboseoutput("Unknown CIM Error: %s" % args)
|
||||||
except pywbem.cim_http.AuthError,arg:
|
except pywbem.cim_http.AuthError as arg:
|
||||||
verboseoutput("Global exit set to UNKNOWN")
|
verboseoutput("Global exit set to UNKNOWN")
|
||||||
GlobalStatus = ExitUnknown
|
GlobalStatus = ExitUnknown
|
||||||
print "UNKNOWN: Authentication Error"
|
print("UNKNOWN: Authentication Error")
|
||||||
sys.exit (GlobalStatus)
|
sys.exit (GlobalStatus)
|
||||||
else:
|
else:
|
||||||
# GlobalStatus = ExitOK #ARR
|
# GlobalStatus = ExitOK #ARR
|
||||||
@@ -725,7 +742,13 @@ for classe in ClassesToCheck :
|
|||||||
verboseoutput(" Element Name = "+elementName)
|
verboseoutput(" Element Name = "+elementName)
|
||||||
|
|
||||||
# Ignore element if we don't want it
|
# Ignore element if we don't want it
|
||||||
if elementName in ignore_list :
|
if (regex == True) and (len(ignore_list) > 0) :
|
||||||
|
for ignore in ignore_list :
|
||||||
|
if re.search(ignore, elementName, re.IGNORECASE) :
|
||||||
|
verboseoutput(" (ignored through regex)")
|
||||||
|
regex_ignore_list.append(elementName)
|
||||||
|
|
||||||
|
if (elementName in ignore_list) or (elementName in regex_ignore_list) :
|
||||||
verboseoutput(" (ignored)")
|
verboseoutput(" (ignored)")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -937,12 +960,12 @@ if perf == '|':
|
|||||||
perf = ''
|
perf = ''
|
||||||
|
|
||||||
if GlobalStatus == ExitOK :
|
if GlobalStatus == ExitOK :
|
||||||
print "OK - Server: %s %s %s%s" % (server_info, SerialNumber, bios_info, perf)
|
print("OK - Server: %s %s %s%s" % (server_info, SerialNumber, bios_info, perf))
|
||||||
|
|
||||||
elif GlobalStatus == ExitUnknown :
|
elif GlobalStatus == ExitUnknown :
|
||||||
print "UNKNOWN: %s" % (ExitMsg) #ARR
|
print("UNKNOWN: %s" % (ExitMsg)) #ARR
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "%s- Server: %s %s %s%s" % (ExitMsg, server_info, SerialNumber, bios_info, perf)
|
print("%s - Server: %s %s %s%s" % (ExitMsg, server_info, SerialNumber, bios_info, perf))
|
||||||
|
|
||||||
sys.exit (GlobalStatus)
|
sys.exit (GlobalStatus)
|
||||||
|
|||||||
Reference in New Issue
Block a user