VMware Cloud Community
bzjeurd
Contributor
Contributor

Restart Management Agents with SSHCommand failed...

Hello all,

I'm currently using the SSHCommand object in order to restart the management agent on ESXi 5.0.

The command is correctly executed but the SSH connection remain opened and the workflow never ends.

This is the command:

mySSHCommand.executeCommand("services.sh restart",true);

If I execute the command ( services.sh restart) manually in a SSH console, the shell script ends normally, as expected.

Is something wrong with this script in a remote shell?

Thank a lot for your help.

Bz

Or there is maybe another way to restart the management services remotely?

Tags (2)
0 Kudos
3 Replies
Burke-
VMware Employee
VMware Employee

I just followed http://kb.vmware.com/kb/2031729 to allow me to SSH  from vCO to one of my hosts... once I confirmed SSH could connect  successfully, I used my console to see what "services.sh restart" would  do - it restarted a whole bunch of stuff and took a while to complete.  Once I saw what to expect, I used the Run SSH command workflow to  execute the same command... my results appeared to be the same as yours, but eventually the workflow DID complete after 14 minutes... It completes with a failed status though because some services were not running in the first place, so I would simply add an error handler to this workflow to let it complete successfully:

[2013-02-19 11:49:57.664] [I] Connecting with password
[2013-02-19 11:49:57.779] [I] Connected!
[2013-02-19 11:49:57.781] [I] Executing 'services.sh restart'
[2013-02-19 12:03:54.419] [I] Output: 'Running xorg stop
Running wsman stop
Stopping openwsmand
Running sfcbd stop
This operation is not supported.
Please use /etc/init.d/sfcbd-watchdog stop
Running snmpd stop
Running sfcbd-watchdog stop
Running vpxa stop
vpxa stopped.
Running vobd stop
vobd stopped
Running dcbd stop
Running smartd stop
smartd stopped
Running cdp stop
Running lacp stop
Running memscrubd stop
memscrubd is not running
Running slpd stop
Stopping slpd
Running hostd stop
hostd stopped.
Running sensord stop
sensord is not running
Running storageRM stop
storageRM stopped
Running lbtd stop
net-lbt stopped
Running rhttpproxy stop
rhttpproxy stopped.
Running usbarbitrator stop
usbarbitrator stopped
Running vcloud stop
Running DCUI stop
Disabling DCUI logins
Running ntpd stop
Stopping ntpd
Connect to localhost failed: Connection failure
Running ntpd restart
Connect to localhost failed: Connection failure
Starting ntpd
Running DCUI restart
Enabling DCUI login: runlevel =
Running vcloud restart
Running usbarbitrator restart
usbarbitrator started
Running rhttpproxy restart
rhttpproxy started.
Running lbtd restart
net-lbt started
Running storageRM restart
storageRM started
Running sensord restart
sensord started
Running hostd restart
hostd started.
Running slpd restart
Starting slpd
Running memscrubd restart
The checkPages boot option is FALSE, hence memscrubd could not be started.
Running lacp restart
lacp started
Running cdp restart
cdp started
Running smartd restart
smartd started
Running dcbd restart
dcbd started
Running vobd restart
vobd started
Running vpxa restart
Connect to localhost failed: Connection failure
Running sfcbd-watchdog restart
Connect to localhost failed: Connection failure
Connect to localhost failed: Connection failure
Running snmpd restart
Running sfcbd restart
This operation is not supported.
Please use /etc/init.d/sfcbd-watchdog start
Running wsman restart
Starting openwsmand
Running xorg restart
'
[2013-02-19 12:03:54.422] [I] Error: 'root: snmpd is not running.
watchdog-vpxa: Terminating watchdog process with PID 1260099
watchdog-vobd: Terminating watchdog process with PID 1262070
watchdog-dcbd: Terminating watchdog process with PID 1257915
watchdog-smartd: Terminating watchdog process with PID 1261923
watchdog-cdp: Terminating watchdog process with PID 1261817
watchdog-net-lacp: Terminating watchdog process with PID 1259732
watchdog-hostd: Terminating watchdog process with PID 1261722
watchdog-storageRM: Terminating watchdog process with PID 1257463
watchdog-net-lbt: Terminating watchdog process with PID 1259476
watchdog-rhttpproxy: Terminating watchdog process with PID 1261485
watchdog-usbarbitrator: Terminating watchdog process with PID 1261449
vcloud: Stopping vcloud
vcloud: Cleaning vcloud agent bundle file with /tmp/vcloudagent-* pattern.
vcloud: Running rm -f /tmp/vcloudagent-*
vcloud: Found vsla_fence. Skipping unloading because automatic unload is not enabled.
VobUserLib_Init failed with -1
VobUserLib_Init failed with -1
vcloud: Starting vcloud
vcloud: /etc/init.d/hostd is not running. No need to restart it.
root: snmpd has not been enabled.
'
[2013-02-19 12:03:54.425] [I] Exit code: '0'
[2013-02-19 12:03:54.539] [E] services.sh restart - output: Running xorg stop
Running wsman stop
Stopping openwsmand
Running sfcbd stop
This operation is not supported.
Please use /etc/init.d/sfcbd-watchdog stop
Running snmpd stop
Running sfcbd-watchdog stop
Running vpxa stop
vpxa stopped.
Running vobd stop
vobd stopped
Running dcbd stop
Running smartd stop
smartd stopped
Running cdp stop
Running lacp stop
Running memscrubd stop
memscrubd is not running
Running slpd stop
Stopping slpd
Running hostd stop
hostd stopped.
Running sensord stop
sensord is not running
Running storageRM stop
storageRM stopped
Running lbtd stop
net-lbt stopped
Running rhttpproxy stop
rhttpproxy stopped.
Running usbarbitrator stop
usbarbitrator stopped
Running vcloud stop
Running DCUI stop
Disabling DCUI logins
Running ntpd stop
Stopping ntpd
Connect to localhost failed: Connection failure
Running ntpd restart
Connect to localhost failed: Connection failure
Starting ntpd
Running DCUI restart
Enabling DCUI login: runlevel =
Running vcloud restart
Running usbarbitrator restart
usbarbitrator started
Running rhttpproxy restart
rhttpproxy started.
Running lbtd restart
net-lbt started
Running storageRM restart
storageRM started
Running sensord restart
sensord started
Running hostd restart
hostd started.
Running slpd restart
Starting slpd
Running memscrubd restart
The checkPages boot option is FALSE, hence memscrubd could not be started.
Running lacp restart
lacp started
Running cdp restart
cdp started
Running smartd restart
smartd started
Running dcbd restart
dcbd started
Running vobd restart
vobd started
Running vpxa restart
Connect to localhost failed: Connection failure
Running sfcbd-watchdog restart
Connect to localhost failed: Connection failure
Connect to localhost failed: Connection failure
Running snmpd restart
Running sfcbd restart
This operation is not supported.
Please use /etc/init.d/sfcbd-watchdog start
Running wsman restart
Starting openwsmand
Running xorg restart

error: root: snmpd is not running.
watchdog-vpxa: Terminating watchdog process with PID 1260099
watchdog-vobd: Terminating watchdog process with PID 1262070
watchdog-dcbd: Terminating watchdog process with PID 1257915
watchdog-smartd: Terminating watchdog process with PID 1261923
watchdog-cdp: Terminating watchdog process with PID 1261817
watchdog-net-lacp: Terminating watchdog process with PID 1259732
watchdog-hostd: Terminating watchdog process with PID 1261722
watchdog-storageRM: Terminating watchdog process with PID 1257463
watchdog-net-lbt: Terminating watchdog process with PID 1259476
watchdog-rhttpproxy: Terminating watchdog process with PID 1261485
watchdog-usbarbitrator: Terminating watchdog process with PID 1261449
vcloud: Stopping vcloud
vcloud: Cleaning vcloud agent bundle file with /tmp/vcloudagent-* pattern.
vcloud: Running rm -f /tmp/vcloudagent-*
vcloud: Found vsla_fence. Skipping unloading because automatic unload is not enabled.
VobUserLib_Init failed with -1
VobUserLib_Init failed with -1
vcloud: Starting vcloud
vcloud: /etc/init.d/hostd is not running. No need to restart it.
root: snmpd has not been enabled.

[2013-02-19 12:03:54.719] [I] SSH execute command failed. root: snmpd is not running.
watchdog-vpxa: Terminating watchdog process with PID 1260099
watchdog-vobd: Terminating watchdog process with PID 1262070
watchdog-dcbd: Terminating watchdog process with PID 1257915
watchdog-smartd: Terminating watchdog process with PID 1261923
watchdog-cdp: Terminating watchdog process with PID 1261817
watchdog-net-lacp: Terminating watchdog process with PID 1259732
watchdog-hostd: Terminating watchdog process with PID 1261722
watchdog-storageRM: Terminating watchdog process with PID 1257463
watchdog-net-lbt: Terminating watchdog process with PID 1259476
watchdog-rhttpproxy: Terminating watchdog process with PID 1261485
watchdog-usbarbitrator: Terminating watchdog process with PID 1261449
vcloud: Stopping vcloud
vcloud: Cleaning vcloud agent bundle file with /tmp/vcloudagent-* pattern.
vcloud: Running rm -f /tmp/vcloudagent-*
vcloud: Found vsla_fence. Skipping unloading because automatic unload is not enabled.
VobUserLib_Init failed with -1
VobUserLib_Init failed with -1
vcloud: Starting vcloud
vcloud: /etc/init.d/hostd is not running. No need to restart it.
root: snmpd has not been enabled.
(Workflow:Run SSH command / Assign (item5)#6)

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
bzjeurd
Contributor
Contributor

Thanks Burke for your quick test and answer.

I'm glad to know that I'm not the only guy with this behavior.

As I need to do some other task after the restart of the management agent, I chose to put the restart task in a tiny workflow and launched it as an asynchronous workflow. My parent workflow has just to check the workflow token, if it still running after a defined time then cancel it.

It is not a clean method but it works fine.

Bz

0 Kudos
uswbnc53
Enthusiast
Enthusiast

Do you have example code showing how to restart the management agents?

0 Kudos