- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 04-14-2021 01:13 AM
Issue: When the ESX server is removed/deleted from the vCenter, vCenter discovery marks the status of the ESX server as "Retired" but the same status change is not recorded in the audit history table.
Root Cause and Fix: Discovery updates the status of the ESX server record to Retired using GlideMultipleUpdate.execute() (as Batch update) inVCenterDatacentersSensor script include. GlideMultipleUpdate.execute() do not create the audit records. Hence it is changed to GlideRecord.updateMultiple() which creates the audit record whenever the status is changed to Retired.
The issue is fixed in the Rome release. To fix it in previous versions, change the code from
// Mark stale ESX servers as 'retired'
esxGr = new GlideMultipleUpdate('cmdb_ci_esx_server');
esxGr.addQuery('vcenter_ref', vCenterSysId);
esxGr.addQuery('object_id', 'NOT IN', output.hosts);
esxGr.addQuery('install_status', '!=', '7');
esxGr.setValue('install_status', '7'); //Retired = 7
esxGr.setValue('sys_updated_on', gs.nowNoTZ());
esxGr.execute();
TO
// Mark stale ESX servers as 'retired'
esxGr = new GlideRecord('cmdb_ci_esx_server');
esxGr.addQuery('vcenter_ref', vCenterSysId);
esxGr.addQuery('object_id', 'NOT IN', output.hosts);
esxGr.addQuery('install_status', '!=', '7');
esxGr.setValue('install_status', '7'); //Retired = 7
esxGr.updateMultiple();
- 517 Views