Open woutervb opened 8 years ago
I don't use VSANs so I haven't been able to test. I think that this kind of datastore is seen as a local datastore by the API. The following patch should fix it.
Starting at line 1654, you need to replace this :
if (d != null) { //Correction by Andrea for trap the NasDatastoreInfo if (d.getInfo() instanceof NasDatastoreInfo) { NasDatastoreInfo dsInfo = (NasDatastoreInfo) d.getInfo(); if ( dsInfo != null ) { HostNasVolume naaName = dsInfo.getNas(); JsonObject jObject = new JsonObject(); jObject.addProperty("{#DATASTORE}", d.getName()); //jObject.addProperty("{#UUID}", uuid); jObject.addProperty("{#UUID}", "N/A"); jObject.addProperty("{#CLUSTER}", d.getParent().getName()); jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess); jObject.addProperty("{#NAA}", naaName.getName()); jArray.add(jObject); } } else { VmfsDatastoreInfo dsInfo = (VmfsDatastoreInfo) d.getInfo(); if ( dsInfo != null ) { HostScsiDiskPartition[] naaName = dsInfo.getVmfs().extent; JsonObject jObject = new JsonObject(); jObject.addProperty("{#DATASTORE}", d.getName()); //jObject.addProperty("{#UUID}", uuid); jObject.addProperty("{#UUID}", dsInfo.getVmfs().getUuid()); jObject.addProperty("{#CLUSTER}", d.getParent().getName()); jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess); jObject.addProperty("{#NAA}", naaName[0].getDiskName()); jArray.add(jObject); } } }
by this:
if (d != null) { //Correction by Andrea for trap the NasDatastoreInfo if (d.getInfo() instanceof NasDatastoreInfo) { NasDatastoreInfo dsInfo = (NasDatastoreInfo) d.getInfo(); if ( dsInfo != null ) { HostNasVolume naaName = dsInfo.getNas(); JsonObject jObject = new JsonObject(); jObject.addProperty("{#DATASTORE}", d.getName()); //jObject.addProperty("{#UUID}", uuid); jObject.addProperty("{#UUID}", "N/A"); jObject.addProperty("{#CLUSTER}", d.getParent().getName()); jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess); jObject.addProperty("{#NAA}", naaName.getName()); jArray.add(jObject); } } else if (d.getInfo() instanceof LocalDatastoreInfo) { LocalDatastoreInfo dsInfo = (LocalDatastoreInfo) d.getInfo(); if ( dsInfo != null ) { HostNasVolume naaName = dsInfo.getNas(); JsonObject jObject = new JsonObject(); jObject.addProperty("{#DATASTORE}", d.getName()); //jObject.addProperty("{#UUID}", uuid); jObject.addProperty("{#UUID}", "N/A"); jObject.addProperty("{#CLUSTER}", d.getParent().getName()); jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess); jObject.addProperty("{#NAA}", naaName.getName()); jArray.add(jObject); } } else { VmfsDatastoreInfo dsInfo = (VmfsDatastoreInfo) d.getInfo(); if ( dsInfo != null ) { HostScsiDiskPartition[] naaName = dsInfo.getVmfs().extent; JsonObject jObject = new JsonObject(); jObject.addProperty("{#DATASTORE}", d.getName()); //jObject.addProperty("{#UUID}", uuid); jObject.addProperty("{#UUID}", dsInfo.getVmfs().getUuid()); jObject.addProperty("{#CLUSTER}", d.getParent().getName()); jObject.addProperty("{#LOCAL}", !d.getSummary().multipleHostAccess); jObject.addProperty("{#NAA}", naaName[0].getDiskName()); jArray.add(jObject); } } }
Let me know if it works. I'll add it to the next release.
Hi @dav3860,
I already had a look at the code and tried your suggestion yesterday. Unfortunately it did not workout as expected. Finally I added instanceof clauses for all possible DatastoreInfo subclasses, but non matched. So I finally ended up adding an else clause that only works at the level of Datastoreinfo (and does not take any of the possible submembers into account). This dit work. With that code I can sucesfully run a discover (from the commandline with zabbix_get) and get data about the datastore (again with zabbig_get, referencing the datastore by name).
I did not check the provided templates to see of the LLD rules work using the UUID of the datastore's, of the name. If the latter is the case, then, provided you are intrested. I can cleanup my code and prepare a pull request. The issue is that there is no uuid for a datastore available (as far as I can tell) at the level of Datastoreinfo.
This issue with VSAN datastores is still on-going in the most recent vmbix release. When running a discovery, vmbix errors out with:
[VmBix.java:554] Parsing this request : ZBXDdatastore.discovery[*] [VmBix.java:2022] An error occurred : java.lang.ClassCastException: com.vmware.vim25.DatastoreInfo cannot be cast to com.vmware.vim25.VmfsDatastoreInfo
Furthermore, when running the vmbix-object-sync - it also errors out at the datastore section:
INFO - [vsphere_object_datastore] Importing objects of type [vsphere_object_datastore] into Zabbix ERROR - [vsphere_object_datastore] Cannot decode VmBix response
Is there anything that I can do to help solve this?
Thank you.
Getting the release 2.0 up and running was quite trivial on a centos 7 machine.
The issue I am now facing is that the datastore(s) cannot be monitored. It might be an vsan specific thing, but I have the following symptoms.
And in the logging I see the following passing by:
Any ideas what is going on, the account that I use for monitoring has read-only access