DNS Domain name field for ESX Servers are "empty"


Description

Symptoms

  • Post vCenter discovery it was observed that few of the ESX servers DNS Domain name field is not populated.

Release

  • Any release.

Cause

  • The probable cause is the target ESX servers doesn't have the FQDN name configured.

Troubleshooting

In order to troubleshoot further,

  • Compare the ESX server CIs which has DNS Domain field populated and not populated.

 

  • Re-run the discovery towards the respective vCenter CI's.
  • Compare the "VMWarevCenterESXHostsProbe" Input payload for working and non-working ESX hosts.
>working ESX>

{"type":"HostSystem","morid":"host-29","name":"abc.expr.com","install_status":false,"os_version":"VMware ESXi 5.5.0 build-2403361","network":["network-35","network-34"],"datastore":["datastore-30","datastore-31","datastore-32","datastore-33"],"vm":["vm-49","vm-39","vm-38","vm-121","vm-61","vm-37","vm-41"],"correlation_id":"30393137-3436-5a43-4a35-33363034505a","cpu_speed":2297,"model_id":"ProLiant DL380 Gen9","ram":98175,"cpu_count":2,"cpu_core_count":10,"manufacturer":"HP","cpu_type":"Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz","ip_address":"xx.xx.xx.xx","cpu_manufacturer":"intel","serial_number":"CZJ53604PZ","cluster":["domain-c26"],"disk_space":3605}

<working ESX<

>non-working ESX>

{"type":"HostSystem","morid":"host-325","name":"xyz","install_status":false,"os_version":"VMware ESXi 5.5.0 build-1331820","network":["network-36","network-35","network-38","network-37"],"datastore":["datastore-326","datastore-366","datastore-367"],"vm":["vm-289","vm-323","vm-306","vm-295"],"correlation_id":"32333536-3030-5355-4533-333443444d59","cpu_speed":2294,"model_id":"ProLiant DL380p Gen8","ram":262109,"cpu_count":2,"cpu_core_count":6,"manufacturer":"HP","cpu_type":"Intel(R) Xeon(R) CPU E5-2630 0 @ 2.30GHz","ip_address":"xx.xx.xx.xx","cpu_manufacturer":"intel","serial_number":"USE334CDMY","cluster":["domain-c79"],"disk_space":4369}

<non-working ESX<
  • In the payload received we could see the name probed for one ESX with FQDN and other without FQDN. (text highlighted)

Logic

  • "VCenterESXHostsSensor" sensor is responsible for updating data to the "cmdb_ci_esx_server" table. 
https://<instancename.service-now.com>nav_to.do?uri=sys_script_include.do?sys_id=4c6fbb6f8f575200c2fe0b5437bdeeae
  • This sensor script in turns calls the another script include "HostnameJS" to process the "hostname"
var vCenterSysId, vCenterUuid, datacenterMorId, datacenterSysId, fullDiscovery, _this, 

enableCmpApi,

hostname = new HostnameJS(),

esxVmMap = { },

hostMounts = [ ],

serialNumbers = [ ], 
  • This "HostnameJS" script include parses the domain name from what the "VMWarevCenterESXHostsProbe" probe has probed from the target server. 
https://<instancename.service-now.com>/nav_to.do?uri=sys_script_include.do?sys_id=8998a2500ab3015300e6ebbf8bc77f26
_parseFQDN: function(sysName) { 

this.sysName = sysName 

// A fully qualified domain name should never have spaces in it. If it does, then we can't really parse it. 

if (sysName.indexOf(" ") > -1) 

return; 

// If the hostname is an IP address, then there's really nothing to parse. 

if (SncIPAddressV4.getIPAddressV4Instance(sysName)) 

return; 

// In order to parse FQDN, the name must have at least 2 dots in it, such as mac1.snc.com 

var parts = sysName.split('.'); 

if (parts.length < 3) 

return; 

// Parse FQDN with regex. By default, we take the first one separated by dot as 

// the host name and the rest of at least two as the domain name. 

try { 

var regexStr = gs.getProperty('glide.discovery.fqdn.regex', "^([^.]+)\\.((?:[^.]+\\.)+[^.]+)$"); 

var fqdnRegex = new RegExp(regexStr); 

var groups = fqdnRegex.exec(sysName); 

if (groups.length != 3) 

return; 

this.sysName = groups[1]; 

this.dnsDomain = groups[2]; 

} catch (e) { 

this.log("FQDN parsing error! The regex " + regexStr + " was not able to parse '" + sysName + "'. The error is " + e.message, "warning"); 



}, 
  • If you see the above script logic, the name which is probed must have at least 2 dots in it, such as mac1.snc.com. So that this sensor will parse FQDN with regex and update the "DNS Domain" name field.
  • In this scenario, the ESX hosts "abc" has complete FQDN "abc.expr.com" and the corresponding "HostnameJS" script include parsed FQDN with regex with the right value.
  • But for the non-working ESX server "xyz", the name was probed as "xyz" which doesn't have FQDN.

Resolution

  • The Customer has to check internally with VM Admin to see how the ESX hosts name are configured and alter them accordingly.