On 9/28/2021 at 10:06 AM, Shack said:
I figured this out and went a different route. Here is what I'm using. Works perfectly on all VC's in our environment, both windows and appliance.
import com.santaba.agent.groovyapi.esx.ESX
import com.vmware.vim25.mo.*
def host = hostProps.get("system.hostname")
def user = hostProps.get("esx.user")
def pass = hostProps.get("esx.pass")
def addr = hostProps.get("esx.url") ?: "https://${host}/sdk"
def svc = new ESX()
svc.open(addr, user, pass, 10 * 1000) // timeout in 10 seconds
def si = svc.getServiceInstance()
def rootFolder = si.getRootFolder()
// Get resource
HostSystem esxHost = new InventoryNavigator(rootFolder).searchManagedEntities("HostSystem").first()
println "auto.vcenter.fullname=${si.aboutInfo.fullName}"
println "auto.vcenter.build=${si.aboutInfo.build}"
println "auto.vcenter.licenseproductname=${si.aboutInfo.licenseProductName}"
println "auto.vcenter.os.type=${si.aboutInfo.osType}"
println "auto.vcenter.product.line=${si.aboutInfo.productLineId}"
println "auto.vcenter.version=${si.aboutInfo.version}"
return 0
Thanks for this. Trying to find the exact Service Instance context via VMware documentation was unfruitful and I don't have direct access to the SDK endpoints at the moment. I was about to try to regain access to a lab vCenter to get this information and I stumbled upon this. I owe you a beer @Shack.
In the interest of keeping the sharing vibe strong, here's a similar property source that I made for iDRAC BIOS and Firmware versioning. If it helps anyone else, my job is done. If not, no worries.
---
Dell iDRAC BIOS - AppliesTo - system.sysoid =~ "1.3.6.1.4.1.674.10892.5" || hasCategory("DellDRACDetail")
/*********** Frank G - LM Community ******************/
import com.santaba.agent.groovyapi.snmp.Snmp;
def hostname = hostProps.get("system.hostname");
// gather all properties necessary.
def props = hostProps.toProperties()
def timeout = 5000; // Timeout in milliseconds
def system_WalkAsMap = Snmp.walkAsMap(hostname, ".1.3.6.1.4.1.674.10892.5.4.300.50", props, timeout); // This is the systemBIOStable for iDRAC
if (system_WalkAsMap) {
println "auto.drac.bios.version=" + system_WalkAsMap['1.8.1.1'] // 1.8.1.1 = BIOS version name
println "auto.drac.bios.version.date=" + system_WalkAsMap['1.7.1.1'] // 1.7.1.1 = BIOS version date
}
// Successful script execution, return 0;
return 0;
----
Dell iDRAC Firmware (similar/same appliesTo as above)
/*********** Frank G - LM Community ******************/
import com.santaba.agent.groovyapi.snmp.Snmp;
def hostname = hostProps.get("system.hostname");
// gather all properties necessary.
def props = hostProps.toProperties()
def timeout = 5000; // Timeout in milliseconds
def system_WalkAsMap = Snmp.walkAsMap(hostname, ".1.3.6.1.4.1.674.10892.5.4.300.60", props, timeout); // This is the firmwaretable for iDRAC
if (system_WalkAsMap) {
println "auto.drac.firmware.version.1=" + system_WalkAsMap['1.11.1.1'] // 1.11.1.1 = firmware version name
println "auto.drac.firmware.version.2=" + system_WalkAsMap['1.11.1.2'] // 1.11.1.2 = firmware version name (2, if applicable)
println "auto.drac.version=" + system_WalkAsMap['1.8.1.1'] // 1.8.1.1 = iDRAC version
}
// Successful script execution, return 0;
return 0;