1 2 Previous Next 20 Replies Latest reply on Nov 9, 2018 12:14 PM by LucD

    run vCheck for mutliple VC

    AlexanderNabokikh Lurker

      Hi,

       

      I need to run vCheck for multiple vCenters (18 to be exact) having one report per vCenter.

      Can somebody suggest me how can I achieve this without creating separate directory with all vCheck plugins for each vCenter.

       

       

      Thank you

        • 1. Re: run vCheck for mutliple VC
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          The vCheck.ps1 script accepts a number of parameters, one of these is the Job parameter.

          The job parameter points to an XML file (default plugins.xml).

          In this XML file you can define the plugin list.

          The first plugin (plugin 00) contains the server to which to do the Connect-VIServer.

          So you could run several invocations of vCheck.ps1 with different vaules for the Job parameter.

          Each XML file would point to a different plugin_00, while the rest of the plugins stays the same.

          • 2. Re: run vCheck for mutliple VC
            AlexanderNabokih Lurker

            Could you please provide an example of such XML file? I cannot find documentation on that.

            • 3. Re: run vCheck for mutliple VC
              LucD Guru
              vExpertUser ModeratorsCommunity Warriors

              When you extract vCheck to your drive, there is a default one, called plugins.xml, in the vCheck directory.

              • 4. Re: run vCheck for mutliple VC
                AlexanderNabokih Lurker

                Yes, I got this.

                I just don't understand what exactly should I change in this file and in GlobalVariables.ps1, 00 Initialize to get this done.

                Do you have any instructions? or documentation.

                 

                Thank you

                • 5. Re: run vCheck for mutliple VC
                  nullifi Lurker

                  I'm not sure if this is the intended way, but I created different xml files containing only this, with the filename changed for each server. I named it config-server1.xml, etc:

                  <vCheck>

                       <globalVariables>GlobalVariables-Server1.ps1</globalVariables>

                  </vCheck>

                   

                  I then copied the default GlobalVariables.ps1 script and made the minor modification of adding a global variable: $Global:VCServer="server1"

                   

                  I then modified the 00 connection plugin to set $Server = $Global:VCServer.

                   

                  I am sad that I had to modify the 00 file, as I had hoped that it pulled data in from global variables but it doesn't appear that it does. With the job xml file not specifying plugins, it uses the default plugin list that is available locally, so it behaves the same as running it without the -job parameter.

                  • 6. Re: run vCheck for mutliple VC
                    treemon Lurker

                    Hi Nullifi

                     

                    I tried your method.

                    Its great to be able to specify the job upfront and get an output based on that but there is still only 1 report per email.

                     

                    Does anyone have any idea how to have an email sent, which will have 1 html attachment per VC

                     

                    So that a single report can be run against several vcs at the same time and you end up with an email with as many attachments?

                     

                    Thanks for the help so far

                    • 7. Re: run vCheck for mutliple VC
                      LucD Guru
                      vExpertCommunity WarriorsUser Moderators

                      What I do to produce reports for all my vCenters in one run (with one email), is the following.

                       

                      1. Create a separate Plugin00, one for each vCenter (in this file you specify the vCenter and assign it to the $server variable)

                      Also define in here that this vCheck run should just create the HTML file, but not send it.

                      vc1-ps1.png

                      2. Create an XML file for each vCenter. The content of these XML files can be the same, except for the pointer to Plugin00, which should be the vCenter specific one.

                      The example just contains the bare minimum of plugins, you can have more.

                      vc1-xml.png

                      3. Use a script to run vCheck against all the vCenters (2 in the example), and when completed send an email with all the HTML files attached

                       

                      .\vCheck.ps1 -job vc1.xml -Outputpath .\Reports

                      .\vCheck.ps1 -job vc2.xml -Outputpath .\Reports

                       

                      $mailAddr = 'me@domain.com'

                      $smtp = 'mail.domain.com'

                      $attchments = Get-ChildItem -Path .\Reports | Select -ExpandProperty FullName

                       

                      Send-MailMessage -From $mailAddr -To $mailAddr -Subject 'vCheck Reports' -SmtpServer $smtp -Attachments $attchments

                       

                      • 8. Re: run vCheck for mutliple VC
                        fcocquyt16 Novice

                        No - had not seen that

                         

                        thanks,

                        buys LucD a beer

                         

                        has anyone coded the {vcenter list} and {plugin list} as parameters to vcheck before I go off and do it?

                         

                        thanks

                        • 9. Re: run vCheck for mutliple VC
                          fcocquyt16 Novice

                          hmm - it runs fine - then throws an error on "

                          Get-ReportHTML : The term 'Get-ReportHTML' is not recognized"


                          seems to be defined in styles...?

                           

                           

                          [12:22:46] Collecting VM Objects

                          [12:22:47] Collecting VM Host Objects

                          [12:22:47] Collecting Cluster Objects

                          [12:22:47] Collecting Datastore Objects

                          [12:22:48] Collecting Detailed VM Objects

                          [12:22:50] Collecting Template Objects

                          [12:22:51] Collecting Detailed VI Objects

                          [12:22:51] Collecting Detailed Alarm Objects

                          [12:22:51] Collecting Detailed VMHost Objects

                          [12:22:52] Collecting Detailed Cluster Objects

                          [12:22:52] Collecting Detailed Datastore Objects

                          [12:22:52] Collecting Detailed Datastore Cluster Objects

                          [12:22:53] ..finished calculating Connection settings for vCenter by Alan Renouf

                          v1.7 [2 of 4]

                          [12:22:53] ..start calculating General Information by Alan Renouf, Frederic Mart

                          in v1.2 [3 of 4]

                          [12:22:55] ..finished calculating General Information by Alan Renouf, Frederic M

                          artin v1.2 [3 of 4]

                          [12:22:55] ..start calculating Snapshots Oversize by Raphael Schitz, Shawn Maste

                          rson v1.3 [4 of 4]

                          [12:23:02] ..finished calculating Snapshots Oversize by Raphael Schitz, Shawn Ma

                          sterson v1.3 [4 of 4]

                          Get-ReportHTML : The term 'Get-ReportHTML' is not recognized as the name of a

                          cmdlet, function, script file, or operable program. Check the spelling of the

                          name, or if a path was included, verify that the path is correct and try again.

                          At E:\vmware\vCheck-snapreport\vCheck.ps1:748 char:13

                          + $MyReport = Get-ReportHTML

                          +             ~~~~~~~~~~~~~~

                              + CategoryInfo          : ObjectNotFound: (Get-ReportHTML:String) [], Comm

                             andNotFoundException

                              + FullyQualifiedErrorId : CommandNotFoundException

                          • 10. Re: run vCheck for mutliple VC
                            fcocquyt16 Novice

                            Ok I manually added a source .style - now to solve the first error - now I'm getting:

                             

                            PowerCLI E:\vmware\vCheck-snapreport> .\vCheck.ps1 -job .\sanssnte01vcn55.xml -outputpath .\report

                            E:\vmware\vCheck-snapreport\vCheck.ps1 : Cannot validate argument on parameter

                            'Outputpath'. The "Test-Path $_ -PathType 'Container'" validation script for

                            the argument with value ".\report" did not return true. Determine why the

                            validation script failed and then try the command again.

                            At line:1 char:53

                            + .\vCheck.ps1 -job .\sanssnte01vcn55.xml -outputpath .\report

                            +                                                     ~~~~~~~~

                                + CategoryInfo          : InvalidData: (:) [vCheck.ps1], ParameterBindingV

                               alidationException

                                + FullyQualifiedErrorId : ParameterArgumentValidationError,vCheck.ps1

                             

                            what is that complaint - another variable not sourced?

                             

                            thanks

                            • 11. Re: run vCheck for mutliple VC
                              fcocquyt16 Novice

                              Ok the report files are generated - time to send them - BUT an error:

                               

                              PowerCLI E:\vmware\vCheck-snapreport> .\sendsnapreport.ps1

                              Send-MailMessage : Access to the path

                              'E:\vmware\vCheck-snapreport\Report\archives\sanssnte03vcn55.san.ssnsgs.net'

                              is denied.

                              At E:\vmware\vCheck-snapreport\sendsnapreport.ps1:5 char:1

                              + Send-MailMessage -From $mailAddr -To $mailAddr -Subject 'vCheck Reports'

                              -SmtpSe ...

                              + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                              ~~~

                                  + CategoryInfo          : NotSpecified: (:) [Send-MailMessage], Unauthoriz

                                 edAccessException

                                  + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow

                                 erShell.Commands.SendMailMessage

                               

                              but I can write to it fine:

                               

                              PowerCLI E:\vmware\vCheck-snapreport> md E:\vmware\vCheck-snapreport\Report\Arch

                              ives\sanssnte03vcn55.san.ssnsgs.net\t

                               

                               

                               

                               

                                  Directory:

                                  E:\vmware\vCheck-snapreport\Report\Archives\sanssnte03vcn55.san.ssnsgs.net

                               

                               

                               

                               

                              Mode                LastWriteTime     Length Name

                              ----                -------------     ------ ----

                              d----        11/25/2016   9:09 AM            t

                               

                               

                               

                              Help me LucD

                              • 12. Re: run vCheck for mutliple VC
                                fcocquyt16 Novice

                                Getting close - I'll back it up to the original request - "how to run vcheck on a subset of the plugins over a series of vcenters"

                                 

                                Can the author provide an example vCheck report running against a set {vcenter1, vcenter 2,...vcenterN}

                                 

                                foreach vcenter {some list of vcenters}

                                     execute a plugin from a list (snapshots in this case)

                                end

                                 

                                #thanks

                                • 13. Re: run vCheck for mutliple VC
                                  LucD Guru
                                  vExpertUser ModeratorsCommunity Warriors

                                  Do you have a Plugin00 (connection) and an XML with the desired plugin for each vCenter in the list?

                                  • 14. Re: run vCheck for mutliple VC
                                    fcocquyt16 Novice

                                    Ok, seems to be working fine up until the 9th or 10th vcenter 00 Connection plugin.ps1

                                    (I tested 2 vcenters at a time, they all finished and reported - but then put all the 00 Connection plugin.ps1's  and its hanging or throwing an error like out of memory after sitting there for 25 minutes - and this vcenter returned fine in an earlier test run - I think the previous vcenter connections are not disconnected and could be responsible for the hangs/memory errors?)

                                     

                                     

                                     

                                    [18:48:02] Adding Custom properties

                                    [18:48:02] Collecting VM Objects

                                    [18:48:08] Collecting VM Host Objects

                                    [18:48:15] Collecting Cluster Objects

                                    [18:48:16] Collecting Datastore Objects

                                    [18:48:17] Collecting Detailed VM Objects

                                    [18:48:38] Collecting Template Objects

                                    [18:48:46] Collecting Detailed VI Objects

                                    [18:48:47] Collecting Detailed Alarm Objects

                                    [18:48:53] Collecting Detailed VMHost Objects

                                    [18:49:23] Collecting Detailed Cluster Objects

                                    [18:49:24] Collecting Detailed Datastore Objects

                                    [18:49:27] Collecting Detailed Datastore Cluster Objects

                                    [18:49:27] ..finished calculating Connection settings for vCenter by Alan Renouf

                                    v1.7 [10 of 13]

                                    [18:49:27] ..start calculating Snapshot Information by Alan Renouf, Raphael Schi

                                    tz v1.4 [11 of 13]

                                    Get-View : 11/28/2016 7:15:54 PM    Get-View        Exception of type

                                    'System.OutOfMemoryException' was thrown.

                                    At E:\vmware\vCheck-snapreport\Plugins\60 VM\02 Snapshot Information.ps1:87

                                    char:10

                                    +             $vm = Get-View $_.Entity

                                    +                   ~~~~~~~~~~~~~~~~~~

                                        + CategoryInfo          : NotSpecified: (:) [Get-View], VimException

                                        + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio

                                       n.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

                                     

                                    thanks!

                                    1 2 Previous Next