Aug 21, 2016

Thanks Team for such a wonderful tool .

But when I am trying to configure it on my RELL machine I see below error.

I tried python interactive login using "from pyVim import connect
si = connect.SmartConnect(host = "your vc ip", user = "username", pwd = "password", port = 443) " which works fine But when I run "usr/bin/python /DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/doctor" I see below error message.

/]# usr/bin/python /DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/doctor
Traceback (most recent call last):
File "/DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/doctor", line 21, in <module>
from scripts import TaskTracker
File "/DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/scripts/TaskTracker.py", line 12, in <module>
import vcutil
File "/DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/scripts/vcutil.py", line 14, in <module>
from collections import Counter
ImportError: cannot import name Counter
[ /]# Traceback (most recent call last):
bash: syntax error near unexpected token `most'
[ /]# File "/DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/doctor", line 21, in <module>
bash: syntax error near unexpected token `newline'
[ /]# from scripts import TaskTracker
bash: from: command not found
[ /]# File "/DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/scripts/TaskTracker.py", line 12, in <module>
bash: syntax error near unexpected token `newline'
[ /]# import vcutil
bash: import: command not found
[ /]# File "/DrsDoctor-v1.1/DrsDoctor/Drm-Diagnostic-Tool/scripts/vcutil.py", line 14, in <module>
bash: syntax error near unexpected token `newline'
[ /]# from collections import Counter
bash: from: command not found
[ /]# ImportError: cannot import name Counter
bash: ImportError:: command not found

Thanks In advance

Aug 21, 2016

What is the version of python you are using? Is it less than 2.7? If yes, would recommend to try with at least 2.7.6 (better if it is 2.7.9)

Jul 01, 2016

It seems to try to verify the certificate even though I've commented it out in the configuration file as instructed. Any tips?

Jamess-iMac:Drm-Diagnostic-Tool james$ ./doctor
Starting Drs Doctor with log interval of 300 secs
Enter VC User Password:
pyVmomi version is less than 6.0, Certificate verification will not be done
Got exception while logging in...
(vim.fault.HostConnectFault) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)',
faultCause = <unset>,
faultMessage = (vmodl.LocalizableMessage) []
}
Jamess-iMac:Drm-Diagnostic-Tool james$

*** The Configuration File ***
Jamess-iMac:Drm-Diagnostic-Tool james$ cat conf/testbed.conf
#################################################
#
# Testbed configuration file for the 'DRS Doctor'
#
#################################################

# IP address or Hostname of vCenter to connect, Eg: 'xx.xx.xx.xxx', Hostname should be specified instaed of IP if SSL certficate validtion is required
vcip : '[removed]'

# Login username for the vCenter
vc_usr : 'james'

# Name of the cluster to monitor, Eg: 'My cluster', 'cluster23-1'
cluster : '[removed]'

# Log interval in secs. Eg. 180, 300, 600 etc. Resource usage information is collected for every 'Log_interval' secs and a new log will be generated.
# Since resource data collection for the whole inventory is heavy on VC, Minimum allowed log interval is 120 secs. Default is 300
log_interval : 300

# CA pem file location, comment this out if SSL certificate verfication of VC is not required
# ca_certs : ''
Jamess-iMac:Drm-Diagnostic-Tool james$

*** Versions ***
Jamess-iMac:Drm-Diagnostic-Tool james$ pyenv local
2.7.6
Jamess-iMac:Drm-Diagnostic-Tool james$ pip list
awscli (1.10.44)
botocore (1.4.34)
colorama (0.3.3)
docutils (0.12)
futures (3.0.5)
jmespath (0.9.0)
pip (8.1.2)
pyasn1 (0.1.9)
python-dateutil (2.5.3)
pyvmomi (5.5.0.2014.1.1)
PyYAML (3.11)
requests (2.10.0)
rsa (3.4.2)
s3transfer (0.0.1)
setuptools (23.1.0)
six (1.10.0)
wheel (0.29.0)
Jamess-iMac:Drm-Diagnostic-Tool james$

Jul 03, 2016

Can you please try these commands in python interactive mode (give your vc ip, username and password) and see what error you are getting.

from pyVim import connect
si = connect.SmartConnect(host = "your vc ip", user = "username", pwd = "password", port = 443)
print si.content.about.version

Jul 02, 2016

Since your pyvmomi version is less than 6.0 version certificate validation will not be done. You have the right combination o f pyvmomi and python not sure why you are seeing this error.

Jul 02, 2016

Are you providing the ip of the machine or hostname?

Jul 05, 2016

I have been providing the hostname. I can try it via IP and see if I have different results.

Jul 05, 2016

I tried with the IP instead and got the same result. I confirmed that I have pyyaml (3.11) and pyvmomi (5.5.0.2014.1.1) and that I'm using Python 2.7.6.

Jamess-iMac:Drm-Diagnostic-Tool james$ ./doctor
Starting Drs Doctor with log interval of 300 secs
Enter VC User Password:
pyVmomi version is less than 6.0, Certificate verification will not be done
Got exception while logging in...
(vim.fault.HostConnectFault) {
dynamicType = <unset>,
dynamicProperty = (vmodl.DynamicProperty) [],
msg = '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)',
faultCause = <unset>,
faultMessage = (vmodl.LocalizableMessage) []
}

Jul 05, 2016

can you try the below commands in python interactive mode. This will help in getting more details of exception (like line number)

from pyVim import connect
si = connect.SmartConnect(host = "your vc ip", user = "username", pwd = "password", port = 443)
print si.content.about.version

Jul 05, 2016

I couldn't even get the import to work, so I took a guess that this is a version/dependency issue. I tried moving over to Windows where I don't have to deal with the OS X system's implementation of Python and it worked right away. On Windows, the process was: install python 2.7.12, upgrade pip, install pyyaml and pyvmomi, run the tool. Took all of 30 seconds! For anyone reading this: it may be worth sorting out the issues if you want to run this long term. Since I'm just testing at the moment, Windows (or Linux, I'm sure) provides a much easier way to get this thing off the ground. And I believe it's mostly a Python issue, not any issue with the Fling.

Jul 05, 2016
Jun 28, 2016

I'd really like to give this a try but am confused on how to setup and use? Any chance for a more detailed set of instructions and what platforms this is supported on? (python for Windows??)

Jun 29, 2016

This is platform independent. All you need is a python environment(>=2.6) and mentioned python modules(pyvmomi, pyyaml). Yes, if you have mentioned python environment on windows it will just work.

Jun 29, 2016

When attempting to run this on a Windows box, using the command python C:\directory_name\doctor I get:
Traceback (most recent call last):
File "C:\Drm-Diagnostic-Tool\doctor", line 23, in <module>
from scripts import ResourceCollector as ResourceCollector
File "C:\Drm-Diagnostic-Tool\scripts\ResourceCollector.py", line 14, in <module>
import vcutil, log, printutil
File "C:\Drm-Diagnostic-Tool\scripts\log.py", line 35, in <module>
get_logger()
File "C:\Drm-Diagnostic-Tool\scripts\log.py", line 27, in get_logger
filemode = 'w+', level = logging.INFO)
File "C:\Python27\lib\logging\__init__.py", line 1547, in basicConfig
hdlr = FileHandler(filename, mode)
File "C:\Python27\lib\logging\__init__.py", line 913, in __init__
StreamHandler.__init__(self, self._open())
File "C:\Python27\lib\logging\__init__.py", line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 22] invalid mode ('w+') or filename: 'C:\\Python27\\logs\\2016-06-29_10:37:37.log'

Any ideas what's causing the failure?

Jun 29, 2016

Can you run the command from inside the directory and check? like 'python ./doctor'

Jun 29, 2016

command "python ./doctor" does not work as python in not in the directory:
'python' is not recognized as an internal or external command, operable program or batch file.

Changing this to "C:\Python27\python ./doctor" gives:

Traceback (most recent call last):
File "./doctor", line 23, in <module>
from scripts import ResourceCollector as ResourceCollector
File "C:\Drm-Diagnostic-Tool\scripts\ResourceCollector.py", line 14, in <module>
import vcutil, log, printutil
File "C:\Drm-Diagnostic-Tool\scripts\log.py", line 35, in <module>
get_logger()
File "C:\Drm-Diagnostic-Tool\scripts\log.py", line 27, in get_logger
filemode = 'w+', level = logging.INFO)
File "C:\Python27\lib\logging\__init__.py", line 1547, in basicConfig
hdlr = FileHandler(filename, mode)
File "C:\Python27\lib\logging\__init__.py", line 913, in __init__
StreamHandler.__init__(self, self._open())
File "C:\Python27\lib\logging\__init__.py", line 943, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 22] invalid mode ('w+') or filename: 'C:\\Drm-Diagnostic-Tool\\logs\\2016-06-29_11:32:22.log'

Jun 29, 2016

it is trying to create a log file '2016-06-29_11:32:22.log' at the path C:\\Drm-Diagnostic-Tool\\logs\\2016-06-29_11:32:22.log' which is definitely not valid.

Jun 29, 2016

let me check why the path has double '\\'

Jun 29, 2016

Double backslash would be correct I believe as a regular backslash is an operator thus \l would be read when compiling and fail as an invalid operand.

Jun 29, 2016

I looked for the error and it seems Windows doesn't support colon ':' in their file names. Can you modify the string in file 'scripts/log.py' line 24 from "%Y-%m-%d_%H:%M:%S" to "%Y-%m-%d_%H-%M-%S" to see colon is the real issue here with windows.

Thanks

Jun 29, 2016

Perfect, that was it!