2 Replies Latest reply on May 5, 2011 6:29 AM by gautelund

    Customization of gVCBg2

    MillardJK Enthusiast
    vExpert

      I've gone and "helped myself" to add some new functionality to the script. I wanted to share my updates in case anyone would find them useful, as well as for William to review for inclusion in the authoritative version of the code.

       

      1)  added a "doall" command-line option; this eliminates the need to create  (and maintain!) a list of VMs; it simply logs into your infrastructure  and creates a list of all the VMs present. It isn't coded in the most efficient way; I simply borrowed some of the existing code for object discovery. At some point I may revise it  to allow you to "do all" for an optionally named cluster in the "Hosts and Clusters" vCenter view or folder in the "VMs  and Templates" view (i.e., do all the VMs logically contained in the  "production" folder and its subfolders), but my current need was to  eliminate the need to maintain a list...

       

      2) because I had a couple of VMs that needed special  handling, I revised the operation of per-VM config files so that things  behaved better in conjunction with my "do all" operation: VMs specified  in the list (or discovered using the "doall" command) will backup using  defaults if a config file isn't present. As an additional adaptation, I  revised the configfile reader to use the script defaults unless otherwise specified in the config file; that means the config file doesn't require every single setting to be  present, just the ones you want to override for custom action. I did  that because I didn't want to have to maintain every config file  whenever I changed a default that didn't have bearing on the actual  reason a unique config was needed (in all my cases, it was whether or  not storage quiescing was going to succeed: my default is to request it,  but I have a handful of VMs that won't succeed for some reason).

       

      3) added a command-line "loglevel" option to override  the script's default logging level. This lets you leave the script at  something like "info" for regular automation, but use "debug" when  troubleshooting a single machine.

       

      Note: I'm making these changes to suit my environment's needs; your mileage may vary. Credit and thanks goes to  William for doing the majority of the "heavy lifting" on the original  code. Without his work, mine wouldn't exist.

        • 1. Re: Customization of gVCBg2
          skayser Enthusiast

          Great, thanks for sharing! Your approach of config variable inheritance from default config to VM-specific config files is something that I'd very much like to see going into the official script version too!

          • 2. Re: Customization of gVCBg2
            gautelund Lurker

            Hi,

             

            interesting. I've been using ghettoVCB.sh (g1). I made some modifications which William took into account and rolled into the default version. I am going to implement the same changes to g2 here, and might as well do it with a glance to your version. What I intend to re-implement is:

            • A final status like these, in the log:
              ###### Final status: All VMs backed up OK! ######
              ###### Final status: WARNING: All VMs backed up, but some disk(s) failed! ######
              ###### Final status: ERROR: Only some of the VMs backed up! ######
              ###### Final status: ERROR: Only some of the VMs backed up, and some disk(s) failed! ######
              ###### Final status: ERROR: All VMs failed! ######
              ###### Final status: ERROR: No VMs backed up! ######

              I use this to be able to parse the logs automatically.
            • Separating config from the main script, putting config in a file ghettoVCBg2.conf, so that one can upgrade the script without having to re-configure.
            • Have a "doall" (or -a) option like you have made, but also being able to specify an exclusions list. So you can just slap the script onto a new host to have everything backed up, but also being able to just exclude some VMs and have all others backed up, including new ones.

             

            William has put ghettoVCB.sh on github, but not  ghettoVCBg2.pl yet as it seems.

             

            -gaute