Closed pceglowski closed 9 years ago
Hi,
Can you provide me the exact performance counter that you are trying to pull from vSphere?
Also, can you run the vpoller-client
command from the command-line and see what the timestamp is?
Thanks, Marin
Marin,
Please see below.
vpoller-client -m cluster.perf.metric.get -V vcenter1 -n cluster1 -c 2 -T 1 | jq '.'
{
"msg": "Successfully retrieved performance metrics",
"result": [
{
"timestamp": "2015-04-23 15:00:00+00:00",
"counterId": 2,
"interval": 300,
"value": 795,
"instance": ""
},
{
"timestamp": "2015-04-23 15:05:00+00:00",
"counterId": 2,
"interval": 300,
"value": 921,
"instance": ""
},
...
...
...
...
{
"timestamp": "2015-04-24 14:40:00+00:00",
"counterId": 2,
"interval": 300,
"value": 1099,
"instance": ""
}
],
"success": 0
}
I should also mention that it I am running it against vSphere 6.0, and although I do not have any issues with template items, historical performance metric might have been changed in 6.0, which could be the source of the problem.
Thanks!
Okay, I see the issue.
Let me commit a fix for it, which you can test in a bit.
@pceglowski Could you grab the latest vPoller release from Github and test?
Let me know how it goes.
Thanks, Marin
Many thanks Marin, Forgive me asking, but is it the loadable module that needed a fix? Do I need to recompile it as well?
No, you don't need to recompile the loadable module for Zabbix.
Just follow the installation from source section of the documentation.
I've uninstalled the pip version and compiled the latest git pull of your master, but the output of the vpoller-client mentioned above has not changed. What should I expect it to look like?
Make sure to append "--helper vpoller.helpers.zabbix" to your vpoller-client command as well.
I am now getting: vpoller-client -m cluster.perf.metric.get -V vcenter -n cluster -c 6 -T 1 -H vpoller.helpers.zabbix {"msg": "Cannot send result: unicode/str objects only", "success": 1}
Please check vpoller log, you might need to enable debug mode as well
with debug mode... vpoller-client -m cluster.perf.metric.get -V vcenter -n cluster -c 6 -T 1 -H vpoller.helpers.zabbix -d [2015-04-24 17:07:49,728 - DEBUG/MainProcess] Endpoint to connect to: tcp://localhost:10123 [2015-04-24 17:07:49,728 - DEBUG/MainProcess] Timeout of request: 10000 ms [2015-04-24 17:07:49,729 - DEBUG/MainProcess] Number of retries: 3 [2015-04-24 17:07:49,729 - DEBUG/MainProcess] Message to be sent: {'username': None, 'helper': 'vpoller.helpers.zabbix', 'max-sample': None, 'key': None, 'counter-id': '6', 'password': None, 'properties': None, 'name': 'cluster', 'perf-interval': '1', 'hostname': 'vcenter', 'instance': None, 'method': 'cluster.perf.metric.get'} [2015-04-24 17:07:49,731 - DEBUG/MainProcess] Sending client message... [2015-04-24 17:07:50,429 - DEBUG/MainProcess] Received response on client socket [2015-04-24 17:07:50,430 - DEBUG/MainProcess] Received message was: {"msg": "Cannot send result: unicode/str objects only", "success": 1} [2015-04-24 17:07:50,430 - DEBUG/MainProcess] Closing sockets and exiting {"msg": "Cannot send result: unicode/str objects only", "success": 1}
vpoller-worker.log output... 2015-04-24 17:07:50,428 - WARNING/VPollerWorker-1] Helper module raised an exception: 'NoneType' object has no attribute 'getitem' [2015-04-24 17:07:50,429 - WARNING/VPollerWorker-1] Cannot send result: unicode/str objects only
I'll need to check this on my side as well and get back to you later.
Thanks Marin! Have a good weekend.
@pceglowski I've just checked it and found the issue.
A fix has been pushed as well, so please update again to the latest vPoller release from the Github repo.
Here is the correct command to use when retrieving the performance counter for your cluster. This is essentially the exact same command that Zabbix sends to vPoller when sending new task requests.
$ vpoller-client --method cluster.perf.metric.get --vsphere-host <vcenter> --name <cluster-name> --counter-id 6 --perf-interval 1 --max-sample 1 --properties value --helper vpoller.helpers.zabbix
Let me know how it goes when you have time to test it.
Thanks, Marin
That worked brilliantly! Thanks Marin. I am trying to get the current failover level counter from the Cluster Services, but I am getting the following:
vpoller-client -m cluster.perf.metric.get -V vcenter -n cluster -c 279 -T 1 -H vpoller.helpers.zabbix -s 1
{"msg": "Cannot send result: unicode/str objects only", "success": 1}
[2015-04-27 16:35:07,710 - WARNING/VPollerWorker-1] Helper module raised an exception: 'NoneType' object has no attribute '__getitem__'
[2015-04-27 16:35:07,711 - WARNING/VPollerWorker-1] Cannot send result: unicode/str objects only
Try this command instead:
$ vpoller-client -m cluster.perf.metric.get -V vcenter -n cluster -c 279 -T 1 -H vpoller.helpers.zabbix -s 1 --properties value
You are using the vpoller.helpers.zabbix
helper and when you do that you need to tell it what is the property
name from the result JSON object that contains the value that you are interested in - in the case with performance counters the property name is always value
. Just run the same command without the vpoller.helpers.zabbix
helper to see the JSON object - you will see in it that the value is contained within the value
property.
I am getting the same error when including property value:
$ vpoller-client -m cluster.perf.metric.get -V vcenter -n cluster -c 279 -T 1 -H vpoller.helpers.zabbix -s 1 --properties value {"msg": "Cannot send result: unicode/str objects only", "success": 1}
Check whether the cluster supports this counter id with this command:
$ vpoller-client --method cluster.perf.metric.info --vsphere-host <vcenter> --name <cluster>
Make sure that the performance counter id listed in the result.
looks like it does:
... { "instance": "", "counterId": 279 }, ...
Okay, I've just tested it again on a new cluster and I was not getting the value as well.
Try this command:
$ vpoller-client --method cluster.perf.metric.get --vsphere-host <vcenter> --name <cluster> --counter-id 279 --perf-interval 1
You should get an empty result.
Now enable "vSphere HA" on your cluster if not already enabled. If vSphere HA is already enabled, try disabling it and then enabling it again.
Run the above vpoller-client command again and see if it returns the correct values now.
This is how it worked out for me.
Thanks, that has fixed it. Thank you for your help Marin!
Hi,
Allow me to say thank you for your hard work on this project and allowing us all to use it with zabbix.
I am trying to pull a latest historical performance metrics using cluster.perf.metric.get method and zabbix. The problem I am facing is that zabbix item key seems to not pull the latest value, but instead, the oldest one in the JSON output of performance interval values.
Is there anything I can do to change its behaviour?
Many thanks,