ESXi

 View Only
  • 1.  CLI shutdown?

    Posted Jun 08, 2015 11:18 PM

    It seems that you can't use the command line tools to remote shutdown an ESXi server (Dell R730 in my case) unless you have a paid license? Did I read the error messages correctly? I have a separate box monitoring the power in the room to avoid getting our crappy Tripplite UPS units to work with the ESXi box. I believe for that I need the paid license too. Or at least you have to jump through a lot of hoops to get it to work. At the moment all of my VM's power off when the UPS goes on battery, but I can't seem to get the R730 to be powered off cleanly.



  • 2.  RE: CLI shutdown?

    Posted Jun 09, 2015 05:52 AM

    Hi

    I dont know if your UPS can contact the machines over SSH. If it can you can just set up a command to send to the host. You will have to enable SSH in security profile. You find it under configuration -> security profile -> properties. This should work with free licens but im not 100 % sure.

    Vmware has the SSH disable as default because security concerns.



  • 3.  RE: CLI shutdown?

    Posted Jun 10, 2015 01:27 AM

    Yeah, I was hoping to avoid SSH and use the CLI tools. But I'm not sure one is any safer or more secure than the other really. I built the rest of the monitoring and shutdown of the VM's around the CLI tools, but the actual ESXi host shutdown seems to require the paid license (weird).

    [root@ida ~]# cat Scripts/Cron/foo_off.sh

    #!/bin/bash

    H="foo.bar.gov"

    U="admin"

    P="PASSWORD"

    VM=(`/usr/local/bin/vmware-cmd -H $H -U $U -P $P -l`)

    POWERSTATUS=`upsc tripplite@localhost | grep ups.status | awk '{print $2}'`

    if [ $POWERSTATUS == OL ]; then exit; fi

    VMON=();

    for machine in ${VM[@]}

    do

      VMON=(${VMON[@]} $machine);

    done

    for ((;;)) do

    for test in ${VMON[@]}

    do

      STATE=$(/usr/local/bin/vmware-cmd -H $H -U $U -P $P $test getstate | tail -1 | awk '{print $3}')

      if [ $STATE == off ]

      then

        VMON=(${VMON[@]:0:$((${#VMON[@]}-1)))});

      fi

      if [ ${#VMON[@]} == 0 ]

      then

        /usr/bin/vicfg-hostops vmware-cmd -server $H -username $U -password $P --operation shutdown --force

        /usr/bin/logger -p syslog.alert -t upssched-cmd "Shutting Down FOO"

      exit

      fi

    done

    sleep 5

    done



  • 4.  RE: CLI shutdown?

    Posted Jun 10, 2015 12:47 PM

    Did you try "Stop-VMHost" from VMware PowerCLI tool? I guess that it does not require paid license to shut it down.



  • 5.  RE: CLI shutdown?

    Posted Jun 10, 2015 07:35 PM

    I followed this:

    Stopping, Rebooting, and Examining Hosts with vicfg-hostops

    You can shut down or reboot an ESXi host using the vSphere Web Client, or ESXCLI or vicfg-hostops vCLI command.

    Shutting down a managed host disconnects it from the vCenter Server system, but does not remove the host from the inventory. You can shut down a single host or all hosts in a datacenter or cluster. Specify one of the options listed in Connection Options in place of <conn_options>.

    Single host. Run vicfg-hostops with --operation shutdown.

    If the host is in maintenance mode, run the command without the --force option.

    vicfg-hostops <conn_options> --operation shutdown

    If the host is not in maintenance mode, use --force to shut down the host and all running virtual machines.

    vicfg-hostops <conn_options> --operation shutdown --force

    And I got an error message that I need a paid license.



  • 6.  RE: CLI shutdown?
    Best Answer

    Posted Jun 11, 2015 06:16 AM

    Yes, You have read the error messages correctly. We can't shutdown ESXi which are not licensed. Its explained here - VMware KB: VMware ESXi/ESX 4.1 and ESXi 5.0 comparison

    vCLI , PowerCLI , and vSphere SDk for Perl are limited to read-only access for the free vSphere Hypervisor edition. To enable full functionality of vCLI on a VMware ESXi host, the host must be licensed with vSphere Essentials, vSphere Essential Plus, vSphere Standard, vSphere Advanced, vSphere Enterprise, or vSphere Enterprise Plus.



  • 7.  RE: CLI shutdown?

    Posted Jun 11, 2015 09:54 PM

    Thanks, I appreciate the verification.