In Part 8, we are going to take a look how services are managed in a VCSA or PSC node which is provided by the vCenter Server Lifecycle Management system also referred to internally as vMon. You can interact with the vMon service using either the service-control utility which is only available via SSH or the VAMI APIs which are available remotely. As you probably have guessed, we will be using the VAMI APIs 🙂
VAMI UI Area of Focus
There is not a service view in the VAMI UI (https://[VCSA]:5480) for either the VCSA or PSC. However, this information is available as part of the VAMI information when logged into the vSphere Web Client by navigating to System Configuration->Nodes->Related Objects or System Configuration->Services.
VAMI APIs Used
- GET /appliance/vmon/service
- POST /appliance/vmon/service/start
- POST /appliance/vmon/service/stop
PowerCLI Function
Sample Output
The Get-VAMIService will lists all available services for the given VCSA or PSC node that you are connected to. It provides the exact same output that you would see in the vSphere Web Client such as the name of the service, the current state, the health and whether the service is disabled or configured to start up automatically or manually.
The function also accepts a name parameter if you know the specific service you wish to query, for example here is the syntax for checking the Auto Deploy service which is named rbd:
Get-VAMIService -Name rbd
We can use the Start-VAMISerivce function and given a service name, we can start it as shown in the screenshot below.
Similialy, we can use the Stop-VAMISerivce function and given a service name to stop the service as shown in the screenshot below.
- Exploring new VCSA VAMI API w/PowerCLI: Part 1
- Exploring new VCSA VAMI API w/PowerCLI: Part 2
- Exploring new VCSA VAMI API w/PowerCLI: Part 3
- Exploring new VCSA VAMI API w/PowerCLI: Part 4
- Exploring new VCSA VAMI API w/PowerCLI: Part 5
- Exploring new VCSA VAMI API w/PowerCLI: Part 6
- Exploring new VCSA VAMI API w/PowerCLI: Part 7
- Exploring new VCSA VAMI API w/PowerCLI: Part 8
- Exploring new VCSA VAMI API w/PowerCLI: Part 9
- Exploring new VCSA VAMI API w/PowerCLI: Part 10
vmwaregeek says
Awesome functionality. Is there a way to change/set the "startup type" for a service using VAMI?
Alexandre Costa says
Please try the following solution which I found out at VMware community forum
# Image Builder as an example of a possible service and Automatic as an example of new Startup Type
$vMonAPI = Get-CisService 'com.vmware.appliance.vmon.service'
$update_spec = @{
startup_type="AUTOMATIC"
}
$vMonAPI.Get('imagebuilder')
$vMonAPI.update('imagebuilder',$update_spec)
rim saoud says
hey William Lam,
I try to list this services with perl can you help me ??
thanks.
Dan says
Hello William,
Can this be done (check status of services) in a VCS appliance?, I tried to do it from powershell but obviously since the appliance is linux based I get an error. I tried get-service -computername vcsa-xxxx -name * and it shows that I need additional privileges. Thanks
Ross says
is there an option to restart all the services?