December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Restart all services on ESXi through SSH

When you are not able to connect ESXi server to vCenter, or when you cannot connect to ESXi server from VI client it may be necessary to restart the management agents on ESX or ESXi host. In today’s post called How to restart management agents on ESX or ESXi host we will learn this.

You might want to follow this little how to article showing you the way doing it. For the restart of the management agents (mgmt-vmware and vmware-vpxa) directly on ESX/ESXi ESXi 4 and 5.x or ESXi 6.x you will have to do the following:

To restart the management agents on ESXi 6.x

Log in to SSH or Local console as root.
Run these commands:

/etc/init.d/hostd restart
/etc/init.d/vpxa restart

Or also (alternative way)
To reset the management network on a specific VMkernel interface, by default vmk0, run the command:

esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0

Note: Using a semicolon (;) between the two commands ensures the VMkernel interface is disabled and then re-enabled in succession. If the management interface is not running on vmk0, change the above command according to the VMkernel interface used.

To restart all management agents on the host, run the command:

services.sh restart

How to restart the Management agents on ESXi Server – via the console:

1.) Connect to the console of your ESX Server and press F2
2.) Login as root and when using the Up/Down arrows navigate to Restart Management Agents.
3.) Press Enter and press F11 to restart the services.
4.) When the service has been restarted, press Enter. Then you can press Esc to logout of the system.

Then you should see a screen like this one :restart-management-agents-esx-server

 

To restart the management agents on ESXi 4.x and 5.x:

From Local Console or SSH:
  1. Log in to SSH or Local console as root.
  2. Run this command:

/sbin/services.sh restart

You can check also:  Service mgmt-vmware restart may not restart hostd (1005566).

To restart the management agents on ESX Server 3.x, ESX 4.x:

1.) Login to your ESX Server as root from SSH session (via putty for example) or directly from the console.
2.) Type service mgmt-vmware restart and press Enter

Make sure that automatic Startup/Shutdown of virtual machines is disabled before running this command otherwise you might reboot the virtual machines. See more at 103312

4.) Type service vmware-vpxa restart and press Enter.
6.) Type logout and press Enter to disconnect from the ESX Server.

Then you should see see this :

Stopping vmware-vpxa: [ OK ]
Starting vmware-vpxa:
[ OK ]

 

 

 

Troubleshoot ESXi Host Management And Connectivity issues

If you care having problems connecting to an ESXi host, your first port of call should be to check the host’s configuration. Things to check include:

  • Physical connectivity
  • IP/subnet mask
  • VLAN on the vSwitch
  • VLAN configuration on the physical switch

You can use the ‘Test Management Network’ option in the DCUI to test basic connectivity:

 

 

If the network connectivity tests succeed, but the host is still unable to be managed by vCenter or connected to with the vSphere client, then it may be that the hosts management agents need to be restarted. Bear in mind that restarting the management agents on a host may impact tasks that are running on host. You can get a list of running tasks by running the following command at the CLI:

# vim-cmd vimsvc/task_list

Investigating the tasks that are running is covered in this VMware KB article. After reviewing the running tasks, you can decide whether to proceed with restarting the host’s management agents.

Restarting the Management Agents on an ESXi Host

There are a couple of ways in which you can restart a ESXi host’s management agents. You can either use the DCUI or restart the agents via the CLI. Using the DCUI it is just a case of using the ‘Restart Management Agents’ menu option, which can be found under ‘Troubleshooting Options’

 

To restart the management agents using the CLI, establish a connection via SSH or use the local console. Run the following commands to restart the vpxa agent and hostd:

/etc/init.d/hostd restart
/etc/init.d/vpxa restart

To restart all management agents on the host, run the command:

services.sh restart

This will restart all ESXi services including vpxa and hostd:

/sbin # services.sh restart
Running vmtoolsd stop
watchdog-vmtoolsd: Terminating watchdog process with PID 72671
vmtoolsd stopped
Running wsman stop
Stopping openwsmand
Running sfcbd stop
................

The services that will be restarted can be seen if you run ‘chkconfig -io’:

/sbin # chkconfig -io
/etc/init.d/lwiod
/etc/init.d/SSH
/etc/init.d/DCUI
/etc/init.d/ESXShell
/etc/init.d/usbarbitrator
/etc/init.d/lbtd
/etc/init.d/vprobed
/etc/init.d/storageRM
/etc/init.d/hostd
/etc/init.d/sensord
/etc/init.d/slpd
/etc/init.d/memscrubd
/etc/init.d/dcbd
/etc/init.d/cdp
/etc/init.d/vobd
/etc/init.d/vpxa
/etc/init.d/sfcbd-watchdog
/etc/init.d/sfcbd
/etc/init.d/wsman
/etc/init.d/vmtoolsd

You can see which services are set to start by running ‘chkconfig –list’:

/sbin # chkconfig --list
lsassd         off
netlogond      off
lwiod          on
ntpd           off
SSH            on
iked           off
DCUI           on
ESXShell       on
usbarbitrator  on
lbtd           on
vprobed        on
storageRM      on
hostd          on
sensord        on
slpd           on
memscrubd      on
dcbd           on
cdp            on
vobd           on
vpxa           on
sfcbd-watchdog on
sfcbd          on
wsman          on
vmtoolsd       on
vmware-fdm     off

Resetting the Management Network/Interface

Rather than restarting the managements, it may be worth trying a reset on the management interface. To do so, run the following command:

esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0

This command is actually in two parts, the bit before the ‘;’ will disable the interface, while the bit after the ‘;’ will immediately enable it again, thereby performing a ‘reset’.

 

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>