Script to remove stale service registrations from vCenter.
book
Article ID: 371365
calendar_today
Updated On:
Products
VMware vCenter Server
Issue/Introduction
If there is an unclean removal of the 6.x PSC node or any vCenter from ELM, we might see stale service registration entries on the vCenter which can lead to other vCenter issues.
Steps to check if there are stale registrations:
Take the service registration output
/usr/lib/vmware-lookupsvc/tools/lstool.py list --url https://localhost/lookupservice/sdk--no-check-cert > /tmp/psc.txt
Check the number of service registrations for each vCenter:
For an environment with 2 VCs in ELM, there would be 2 service registrations for each service. If there are more than two, then these can be potentially stale ones.
Check the above file(psc.txt) and identify the stale node:
For Example:
The below service registration belongs to vcsa02.domain.local Name: cis.vcha.ServiceName Description: cis.vcha.ServiceDescription Service Product: com.vmware.cis Service Type: vcha Service ID: 1f10XX8f-438d-XXb-90f8-47e7d6XXa94f Site ID: default-first-site Node ID: b2b7XX1e-5XX9-4a55-88XX-699fXXeb1d6f Owner ID: [email protected] Version: 1.0 Endpoints: Type: com.vmware.cis.data.provider Protocol: vmomi URL: https://vcsa02.domain.local:443/vcha/sdk SSL trust: Endpoint Attributes: cis.common.ep.localurl: http://localhost:11080/vcha/sdk Attributes: com.vmware.cis.cm.HostId: 603b3XX1-fXXb-4XX2-aXX5-81517XX8f47a
If vcsa02 is no longer in ELM but multiple service registrations are still present. These must be removed
Environment
vCenter 7.x
vCenter 8.x
Cause
Unclean removal of a node from ELM
Resolution
Shut down all the vCenter nodes in ELM and take a powered-off snapshot from the ESXi host.
Power on all the vCenters
Log in to any one of the vCenter's SSH session.
Validate the incorrect node by checking the URL from the service registration output:
Note down the Node ID for the incorrect service registration.
Run the attached script attached to this KB.
Steps to run the script:
./service_unregister_stalenode.sh <Node_ID of stale node>
The username would be administrator@<sso-domain>, by default it's adminstrator@sso-domain
Enter the password for the same.
Once the script completes, we can verify the removed services by following the steps mentioned in the Issue section of this KB.
Additional Information
Note:
The above script will remove most of the stale service registrations except a few service registrations that do not have node IDs, for example sso:groupcehck, sso:admin etc. These services can be unregistered either from jxplorer or by following the steps mentioned in the below KB: Error: "Could not connect to one or more vCenter Server Systems" in the vSphere Client(316404)