hostOperations.pl

Version 2

    This script allows you to perform the following host operations enter_maintenance_mode,exit_maintenance_mode and reboot across set of ESX(i) hosts being managed by vCenter.

     

    Requirements:

    vCenter 2.5 or vCenter 4.0

    ESX(i) hosts 3.5 or 4.0

    vCLI 4.0 or vMA 4.0

     

    Operations:

    • enter_maintenance_mode

    • exit_maintenance_mode

    • reboot

     

    Sample Execution:

     

    Create a file with list of hosts you want to perform certain operation on

    [vi-admin@scofield ]$ cat hosts
    everest.primp-industries.com
    

     

     

    Enter maintenance mode (will vMotion off any powered on/off VMs to other available host if DRS is enabled with additional hosts):

    
    [vi-admin@scofield ]$ ./hostOperations.pl --server reflex.primp-industries.com --hostfile hosts --operation ent_maint
    Entering maintenance mode for host: "everest.primp-industries.com" and evacauating any VMs if host is part of DRS Cluster ...
            Successfully entered maintenance mode for host: "everest.primp-industries.com"!
    

     

     

    Exit maintenance mode:

    [vi-admin@scofield ]$ ./hostOperations.pl --server reflex.primp-industries.com --hostfile hosts --operation exi_maint
    Exiting maintenance mode for host: "everest.primp-industries.com" ...
            Successfully exited maintenance mode for host: "everest.primp-industries.com"!
    

     

    Reboot

    [vi-admin@scofield ~]$ ./hostOperations.pl --hostfile list --operation reboot
    Rebooting host: "esxi4-2.primp-industries.com" ...
            Successfully rebooted host: "esxi4-2.primp-industries.com"!