Open rockaut opened 6 years ago
It is possible to use it with a standalone host, just keep in mind that not all vpoller methods will work this way, as they expect a vCenter.
This is where the vSphere stuff is https://github.com/dnaeon/py-vpoller/blob/master/src/vpoller/vsphere/tasks.py
And here you can see other examples as well.
Sorry i cant get it working with host directly:
vpoller-client -m host.get -V hostname -p runtime.connectionState {"msg": "Cannot find object None", "success": 1}
I tried several properties but always the msg that it can't find object none.
It works if i do:
vpoller-client -m host.get -V vcenter -n hostname -p runtime.connectionState {"msg": "Successfully retrieved object properties", "result": [{"overallStatus": "green", "name": "hostname"}], "success": 0}
Also working:
vpoller-client -m about -V hostname -p version {"msg": "Successfully retrieved properties", "result": [{"fullName": "VMware ESXi 6.5.0 build-7526125"}], "success": 0}
I had a look at tasks.py but can't get a grip where the single hosts def are.
Hey @rockaut
In your first vpoller-client
command you are missing the --name
parameter. Similarly to how you specify the ESXi host name when connected to vCenter you need to do that for when connecting to stand-alone hosts as well.
Can you try this instead?
vpoller-client -m host.get -V <esxi-host> -n <esxi-host> -p name,runtime.connectionState
The about
method from your last example always works because it retrieves the about
information from the endpoint it is connected to (if running against vcenter - you get the vCenter details, if running against ESXi host - you get the ESXi host info instead).
Sadly i already tried that:
vpoller-client -m host.get -V hostname -n hostname -p runtime.connectionState
Also i already tried to get the property with pyvmomi directly and check_mk script and there it worked.
Hm, seems to be working fine here.
% vpoller-client -m about -V <esxi-host>
{"msg": "Successfully retrieved properties", "success": 0, "result": [{"fullName": "VMware ESXi 5.1.0 build-1211882"}]}
And then this one as well.
% vpoller-client -m host.get -V <esxi-host> --name <esxi-host> --properties name,runtime.connectionState
{"success": 0, "msg": "Successfully retrieved object properties", "result": [{"name": "<esxi-host>", "runtime.connectionState": "connected"}]}
What do you get when you run these commands on your side?
{"msg": "Cannot find object ggesx0921.cloud.local", "success": 1} root@vPoller:/var/lib/zabbix# vpoller-client -m about -V <esxi-host> {"msg": "Successfully retrieved properties", "result": [{"fullName": "VMware ESXi 6.5.0 build-7526125"}], "success": 0} root@vPoller:/var/lib/zabbix# vpoller-client -m host.get -V <esxi-host> --name <esxi-host> --properties name,runtime.connectionState {"msg": "Cannot find object <esxi-host>", "success": 1}
Then it's maybe a vSphere Version thingy? I hadn't time do debug the python script detailed yet.
My current workaround is to get it through the VCSA.
Just tested on a 6.7 host, seems to be working fine as well.
% vpoller-client -m about -V <esx-host>
{"msg": "Successfully retrieved properties", "success": 0, "result": [{"fullName": "VMware ESXi 6.7.0 build-7942050"}]}
And this one.
% vpoller-client -m host.get -V <esx-host> --name <esx-host> --properties name,runtime.connectionState
{"success": 0, "msg": "Successfully retrieved object properties", "result": [{"name": "<esx-host>", "runtime.connectionState": "connected"}]}
Do you have any 5.x or 6.0 hosts to check as well?
You may also try updating to a more recent pyVmomi 6.5.0 version and see if that works for you as well.
Here's the list of package versions I've got.
% pip freeze
certifi==2017.11.5
chardet==3.0.4
docopt==0.6.2
idna==2.6
pyvmomi==6.5.0.2017.5.post1
PyYAML==3.12
pyzabbix==0.7.4
pyzmq==17.0.0b2
requests==2.18.4
six==1.11.0
tabulate==0.8.1
urllib3==1.22
vconnector==0.4.6
vpoller==0.6.3
Interesting. May you test it against your hosts with the docker image if you don't mind? I will export the versions I use in the container and post it.
On Fri, Mar 30, 2018, 13:07 Marin Atanasov Nikolov notifications@github.com wrote:
Just tested on a 6.7 host, seems to be working fine as well.
% vpoller-client -m about -V
{"msg": "Successfully retrieved properties", "success": 0, "result": [{"fullName": "VMware ESXi 6.7.0 build-7942050"}]}
And this one.
% vpoller-client -m host.get -V
--name --properties name,runtime.connectionState {"success": 0, "msg": "Successfully retrieved object properties", "result": [{"name": "
", "runtime.connectionState": "connected"}]} Do you have any 5.x or 6.0 hosts to check as well?
You may also try updating to a more recent pyVmomi 6.5.0 version and see if that works for you as well.
Here's the list of package versions I've got.
% pip freeze
certifi==2017.11.5 chardet==3.0.4 docopt==0.6.2 idna==2.6 pyvmomi==6.5.0.2017.5.post1 PyYAML==3.12 pyzabbix==0.7.4 pyzmq==17.0.0b2 requests==2.18.4 six==1.11.0 tabulate==0.8.1 urllib3==1.22 vconnector==0.4.6 vpoller==0.6.3
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dnaeon/py-vpoller/issues/239#issuecomment-377503070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbq-NkdnIzU0zOX1Y_Dqtb_PWs_K7C5ks5tjhHjgaJpZM4S9IME .
--
Live long and prosper 🖖
Markus
certifi==2018.1.18 chardet==3.0.4 colorama==0.2.5 docopt==0.6.2 html5lib==0.999 idna==2.6 meld3==0.6.10 pyvmomi==6.5.0.2017.5.post1 PyYAML==3.12 pyzabbix==0.7.4 pyzmq==17.0.0 requests==2.18.4 six==1.11.0 supervisor==3.0b2 tabulate==0.8.2 urllib3==1.22 vconnector==0.4.6 vpoller==0.6.3
Not much difference here: certifi is newer pyzmq is older (without b2?) tabulate is newer
also seen that there are additional modules. will check if i can remove them.
I tried it with an 5.5 host:
root@vpoller-proxy:/var/lib/zabbix# vpoller-client -m about -V hostname
{"msg": "Successfully retrieved properties", "result": [{"fullName": "VMware ESXi 5.5.0 build-5230635"}], "success": 0}
root@vpoller-proxy:/var/lib/zabbix# vpoller-client -m host.get -V hostname
{"msg": "Cannot find object None", "success": 1}
root@vpoller-proxy:/var/lib/zabbix# vpoller-client -m host.get -V hostname --name hostname
{"msg": "Cannot find object ggesx0802.cloud.local", "success": 1}
root@vpoller-proxy:/var/lib/zabbix# vpoller-client -m host.get -V hostname --name hostname --properties name
{"msg": "Cannot find object hostname", "success": 1}
May it be a problem, that my hosts are called with fqdn? So hostname = whatever.domain.local
Until now i just used the containers for testing that. I will see if i can install vpoller on a vm and try it there too.
Installed it locally - didn't work either. Same msg
{"msg": "Cannot find object hostname", "success": 1}
certifi==2018.1.18
chardet==3.0.4
docopt==0.6.2
idna==2.6
pkg-resources==0.0.0
pyvmomi==6.5.0.2017.5.post1
pyzmq==17.0.0
requests==2.18.4
six==1.11.0
tabulate==0.8.2
urllib3==1.22
vconnector==0.4.6
vpoller==0.6.3
I am able to get values from a standalone host - so no vCenter - with method "about" but with other methods not although the keys are provided in the sdk/pyvmomi.
For example
vpoller-client --method host.get --vsphere-host xxx.xxx.local -properties runtime.powerState
returns{"msg": "Cannot find object None", "success": 1}
If i go the vCenter way all works well. It's just, that we really would like to gather the data we CAN get from a host, directly from the host not the vCenter.
@dnaeon may you please point me to the file where i can have a look at the source? Isn't that possible in pyvmomi?