Giter Club home page Giter Club logo

vcheck-vsphere's Introduction

stars badge forks badge issues badge

Join the VMware Code and #vCheck channel on slack and ask questions here!

Alt text

Navigation
About
Features
Installing
Enhancements
Contributing
Plugins
Styles
Jobs & Settings
More Info

Back to top

vCheck is a PowerShell HTML framework script, the script is designed to run as a scheduled task before you get into the office to present you with key information via an email directly to your inbox in a nice easily readable format.

This script picks on the key known issues and potential issues scripted as plugins for various technologies written as Powershell scripts and reports it all in one place so all you do in the morning is check your email.

One of they key things about this report is if there is no issue in a particular place you will not receive that section in the email, for example if there are no datastores with less than 5% free space (configurable) then the disk space section in the virtual infrastructure version of this script, it will not show in the email, this ensures that you have only the information you need in front of you when you get into the office.

This script is not to be confused with an Audit script, although the reporting framework can also be used for auditing scripts too. I don't want to remind you that you have 5 hosts and what there names are and how many CPUs they have each and every day as you don't want to read that kind of information unless you need it, this script will only tell you about problem areas with your infrastructure.

Back to top

The following items are included as part of the vCheck vSphere download, they are included as vCheck Plugins and can be removed or altered very easily by editing the specific plugin file which contains the data. vCheck Plugins are found under the Plugins folder.

  • General Details
  • Number of Hosts
  • Number of VMs
  • Number of Templates
  • Number of Clusters
  • Number of Datastores
  • Number of Active VMs
  • Number of Inactive VMs
  • Number of DRS Migrations for the last days
  • Snapshots over x Days old
  • Datastores with less than x% free space
  • VMs created over the last x days
  • VMs removed over the last x days
  • VMs with No Tools
  • VMs with CD-Roms connected
  • VMs with Floppy Drives Connected
  • VMs with CPU ready over x%
  • VMs with over x amount of vCPUs
  • List of DRS Migrations
  • Hosts in Maintenance Mode
  • Hosts in disconnected state
  • NTP Server check for a given NTP Name
  • NTP Service check
  • vmkernel warning messages ov the last x days
  • VC Error Events over the last x days
  • VC Windows Event Log Errors for the last x days with VMware in the details
  • VC VMware Service details
  • VMs stored on datastores attached to only one host
  • VM active alerts
  • Cluster Active Alerts
  • If HA Cluster is set to use host datastore for swapfile, check the host has a swapfile location set
  • Host active Alerts
  • Dead SCSI Luns
  • VMs with over x amount of vCPUs
  • vSphere check: Slot Sizes
  • vSphere check: Outdated VM Hardware (Less than V7)
  • VMs in Inconsistent folders (the name of the folder is not the same as the name)
  • VMs with high CPU usage
  • Guest disk size check
  • Host over committing memory check
  • VM Swap and Ballooning
  • ESXi hosts without Lockdown enabled
  • ESXi hosts with unsupported mode enabled
  • General Capacity information based on CPU/MEM usage of the VMs
  • vSwitch free ports
  • Disk over commit check
  • Host configuration issues
  • VCB Garbage (left snapshots)
  • HA VM restarts and resets
  • Inaccessible VMs
  • Much, Much more.......

Back to top

Copy the vCheck files to the desired location. Run the script 'vCheck.ps1' -Config to do initial configuration of the script.

Back to top

  • Unit Testing / CI - We are working on full support for Pester tests, which will help automate code validation. We will start small and work to provide as much documentation as we can to help with integration.

  • Module Support - We are looking at our options to convert some, or all of the plugins to PowerShell modules. This will make things much easier to version and track, individually. Additionally, if we convert vCheck, itself, to a module, we open our options to support publishing to the PowerShell Gallery, or at least providing users and organizations a standard platform to distribute it. Again, these options are currently under review.

  • Settings GUI - A settings GUI would be a basic form that would allow a user to view/set/change current vCheck configuration settings, without the complexity of settings values from within a file. This initiative is currently in development.

In the meantime, don't hesitate to pop over to the #vCheck channel on slack and join in on active conversations about anything you see- or don't see- here!

Back to top

See out Contributions guidelines

Back to top

Plugin Structure

This section describes the basic structure of a vCheck plugin so that you can write your own plugins for either private use, or to contribute to the vCheck project.

Settings

Your plugin must contain a section for settings. This may be blank, or may contain one or more variables that must be defined for your plugin to determine how it operates.

Examples

No Settings

# Start of Settings   
# End of Settings

Settings to define two variables

# Start of Settings   
# Comment - presented as part of the setup wizard   
$variable = "value"     
# Second variable     
$variable2 = "value2"     
...     
# End of Settings

Required variables

Each plugin must define the following variables: $Title - The display name of the plugin $Header - the header of the plugin in the report $Display - The format of the plugin (See Content section) $Author - The author's name $PluginVersion - Version of the plugin $PluginCategory - The Category of the plugin

Content

Report output

Anything that is written to stdout is included in the report. This should be either an object or hashtable in order to generate the report information.

$Display variable

  • List
  • Table
  • Chart - Not currently merged to master

Plugin Template

# Start of Settings
# End of Settings

# generate your report content here. Simple placeholder hashtable for the sake of example
@{"Plugin"="Awesome"}

$Title = "Plugin Template"
$Header =  "Plugin Template"
$Comments = "Comment about this awesome plugin"
$Display = "List"
$Author = "Plugin Author"
$PluginVersion = 1.0
$PluginCategory = "vSphere"

Table Formatting

Since v6.16, vCheck has supported Table formatting rules in plugins. This allows you to define a set of rules for data, in order to provide more richly formatted HTML reports.

Using Formatting Rules

To use formatting rules, a $TableFormat variable must be defined in the module.

The $TableFormat variable is a Hastable, with the key being the "column" of the table that the rule should apply to.

The Value of the Hashtable is an array of rule. Each rule is a hashtable, with the Key being the expression to evaluate, and the value containing the formatting options.

Formatting options

The Formatting options are made up of two comma-separated values:

  1. The scope of the formatting rule - "Row" to apply to the entire row, or "Cell" to only apply to that particular cell.
  2. A pipe-separated HTML attribute, and value. E.g. class|green to apply the "green" class to the HTML element specified in number 1.

Examples

Example 1

Assume you have a CSS class named "green", which you want to apply to any compliant objects. Similarly, you have a "red" class that you wish to use to highlight non-compliant objects. We would define the formatting rules as follows:

$TableFormat = @{"Compliant" = @(@{ "-eq $true" = "Cell,class|green"; }, @{ "-eq$false" = "Cell,class|red" })}

Here we can see two rules; the first checks if the value in the Compliant column is equal to $true, in which case it applies the "green" class to the table cell (i.e. element). The second rule applies when the compliant column is equal to $false, and applied the "red" class.

Example 2

Suppose you now want to run a report on Datastores. You wish to highlight datastores with less than 25% free space as "warning", those with free space less than 15% as "critical". To make them stand out more, you want to highlight the entire row on the report. You also wish to highlight datastores with a capacity less than 500GB as silver.

To achieve this, you could use the following:

$TableFormat = @{"PercentFree" = @(@{ "-le 25" = "Row,class|warning"; }, @{ "-le 15" = "Row,class|critical" }); "CapacityGB" = @(@{ "-lt 500" = "Cell,style|background-color: silver"})}

Here we see the rules that apply to two different columns, with rules applied to the values in a fashion similar to Example 1.

Back to top

Each style must implement a function named Get-ReportHTML, as this is what is called by vCheck to generate the HTML report.

An array of plugin results is passed to Get-ReportHTML, which contains the following properties:

  • Title
  • Author
  • Version
  • Details
  • Display
  • TableFormat
  • Header
  • Comments
  • TimeToRun

Additionally, if the style is to define colours to be used by charts, the following variables need to be defined:

  • [string[]] $ChartColours - Array containing HTML colours without the hash e.g. $ChartColours = @("377C2B", "0A77BA", "1D6325", "89CBE1")
  • [string] $ChartBackground - HTML colour without the hash. e.g. "FFFFFF"
  • [string] $ChartSize - YYYxZZZ formatted string - where YYY is horizontal size, and ZZZ is height. E.g. "200x200"

To include image resources, you may call Add-ReportResource, specifying CID and data. As these are not referenced by table formatting rules, this will need to be called with the -Used $true parameter.

Back to top

Job XML Specifications

In order to use the -Job parameter, an XML configuration file is used.

The root element is <vCheck>, under this there are two elements:

  • <globalVariables> element specifies the path to the file containing the vCheck settings (by default globalVariables.ps1)
  • <plugins> element has a semi-colon separated attribute name path, which contains the path(s) to search for plugins contained in child <plugin> elements.

Each <plugin> element contains the plugin name.

Config Example

<vCheck>
  <globalVariables>GlobalVariables.ps1</globalVariables>
  <plugins path="plugins-vSphere">
     <plugin>00 Connection Plugin for vCenter.ps1</plugin>
     <plugin>03 Datastore Information.ps1</plugin>
     <plugin>11 VMs with over CPU Count LOL WRONG PATH.ps1</plugin>
     <plugin>99 VeryLastPlugin Used to Disconnect.ps1</plugin>
  </plugins>
</vCheck>

Export/Import Settings

This section describes how to import and export your vCheck settings between builds.

These functions were added to vCheckUtils.ps1 in June '14 (first release build TBD)

You can copy a newer version of vCheckUtils.ps1 to your existing build in order to use the new functions.

To utilize the new functions, simply dot source the vCheckUtils.ps1 file in a PowerShell console:

PS E:\scripts\vCheck-vSphere> . .\vCheckUtils.ps1

This should load and list the functions available to you. We will be focusing on Export-vCheckSettings and Import-vCheckSettings. If you do not see these listed, you will need a newer version of vCheckUtils.ps1.

Example

Lets assume we have an existing build located at E:\Scripts\vCheck-vSphere

First lets rename the folder E:\Scripts\vCheck-vSphere-old

Now we can download the latest build, unblock the zip file and unpack to E:\Scripts leaving us with two builds in our Scripts directory - vCheck-vSphere-old and vCheck-vSphere

Next we'll export the settings from the old build - using PowerShell navigate to E:\Scripts\vCheck-vSphere-old and dot source vCheckUtils.ps1

Export Settings

Running Export-vCheckSettings will by default create a CSV file named vCheckSettings.csv in the current directory. You can also specify a settings file

PS E:\scripts\vCheck-vSphere-old> Export-vCheckSettings -outfile E:\MyvCheckSettings.csv

That's all there is to exporting your vCheck settings. Note that the settings file will be overwritten if you were to run the function again.

Import Settings

To import your vCheck settings, in PowerShell navigate to the new build at E:\Scripts\vCheck-vSphere and dot source vCheckUtils.ps1 once again.

Here we have two options - if we run Import-vCheckSettings with no parameters it will expect the vCheckSettings.csv file to be in the same directory. If not found it will prompt for the full path to the settings CSV file. The second option is to specify the path to the settings CSV file when running Import-vCheckSettings

PS E:\scripts\vCheck-vSphere> Import-vCheckSettings -csvfile E:\MyvCheckSettings.csv

If new settings or plugins have been added to the new build you will be asked to answer the questions, similar to running the initial config. During the import, the initial config is disabled, so once the import is complete you are ready to run your new build.

Back to top

For more information please read here: http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/

For an example vSphere output (doesnt contain all info) click here http://virtu-al.net/Downloads/vCheck/vCheck.htm

vcheck-vsphere's People

Contributors

alanrenouf avatar bottkars avatar ckotte avatar coterl avatar danbarr avatar danjellesma avatar doogleit avatar fabiofreireny avatar ferranespigares avatar gibsonj avatar haripetrov avatar jonathanmedd avatar jones-g avatar kdmhorn avatar linotelera avatar lucdekens avatar monahancj avatar othercwood avatar pall-valmundsson avatar pauljordan avatar paulwalkeruk avatar rnelson0 avatar rvdnieuwendijk avatar smasterson avatar sneddo avatar subnet192 avatar swerveshot avatar thebillness avatar vmdude avatar vscripter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vcheck-vsphere's Issues

Error running 101 ESXi Inode Usage plugin

When I ran this on a single datacenter there were no errors. When I expanded my selection to multiple datacenters I get this:

6:21:22 PM ..start calculating ESXi Inode Exhaustion by Matthias Koehler v1.0
Get-EsxCli : 2/6/2014 6:22:39 PM Get-EsxCli Thread failed to start.
At C:\Users\xxxx\Downloads\vCheck-vSphere-master-2014-02-06\vCheck-vSphere-master\Plugins\101 ESXi Inode Usage.ps1:7 char:12

  • $EsxCli = Get-EsxCli -VMHost $_
    
  •           ~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Get-EsxCli], VimException
    • FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEsxCli

At this point the execution of vCheck seems to have come to a sudden stop.

Any suggestions about what might be the issue?

Bug - 106 Find Phantom Snapshots - grabs legit files

My apologies for not understanding how GitHub works...

Issue - script is pulling legit files
Example - You have a VM named 'abc-abc-abcabc' which will result in a valid vmdk file named 'abc-abc-abcabc.vmdk' and will be identified improperly as a phantom vmdk.

A simple fix seems to be to replace:
if ($theVMdisk.Filename -like "*-??????.vmdk"){

with:
if ($theVMdisk.Filename -match "-\d{6}.vmdk"){

This way it is looking for 6 digits as opposed to 6 characters

98 License Report : problem with vCSA 5.5

It used to work great when i was running vCenter Server 5.0 on windows, but doesn't' work anymore since i upgraded to vCSA 5.5.
Powershell reports a null object value for line 14.

Plugins/80 DvPG with less than x Ports Free.ps1 failure

The term 'Get-VDSwitch' is not recognized as the name of a cmdlet, function, script file, or operable program.

The term 'Get-VDPortgroup' is not recognized as the name of a cmdlet, function, script file, or operable program.

RuntimeException - vCheck.ps1

I am currently testing with only two plugins:

  • 00 Connection Plugin for vCenter.ps1
  • 999 VeryLastPlugin Used to Disconnect.ps1

I am getting the following message with latest version of vCheck:

You cannot call a method on a null-valued expression.
At ... vCheck.ps1:289 char:25

  •                     $type = $path.substring($path.LastIndexOf(".")+1)
    
  •                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

52 Datastore Consistency -- invalid match expression.

$DSDoNotInclude =":local|datastore"

How can this be a valid match expression? "*" is not allowed to be the 1st character of a regex unless it is quoted. I'm getting errors:

parsing ":local|datastore" - Quantifier {x,y} following nothing.
At \YYY\Users\xxx\PowerShell\vCheck\vCheck-vSphere-master-2014-02-21\Plugins\52 Datastore Consistency.ps1:23 char:33

  • @($problemDatastores | Where { $_.Datastore -notmatch $DSDoNotInclude })
  •                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (:) [], ArgumentException
    • FullyQualifiedErrorId : System.ArgumentException

Does this string actually work for anyone? Or is everyone replacing it with their own valid string?

64 Snapshots Oversize.ps1 failure

Cannot convert argument "0", with value: "VimApi_50.ManagedObjectReference", for "SearchDatastoreSubFolders_Task" to type "VimApi_51.ManagedObjectReference": "Cannot convert the "VimApi_50.ManagedObjectReference" value of type "VimApi_50.
ManagedObjectReference" to type "VimApi_51.ManagedObjectReference"."
At C:\vCheck\Plugins\64 Snapshots Oversize.ps1:44 char:71

  •         $taskMoRef  = $dsb.Client.VimService.SearchDatastoreSubFolders_Task <<<< ($dsBrowserMoRef, $dir, $searchSpec)
    
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
Parameter name: moRef"
At C:\vCheck\Plugins\64 Snapshots Oversize.ps1:45 char:67

  •         $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask <<<< ([VMware.Vim.VIConvert]::ToVim($taskMoRef)))
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : DotNetMethodException

79, (Uncontrolled Snapshot) Issues with Datastores with spaces as well as folder hierarchy

Two things I'm hoping someone can help with when updating/modifying "79 Find VMs in uncontrolled snapshot mode.ps1"

  1. Some of my Datacenters are under a folder named "NZ", this is fact is not being picked up by the uncontrolled snapshots script and therefore the script using the wrong path to locate my files.
    The path to my files should be similar to "VC.local@443\NZ\Datacenter1\ABC Datastore01" vs "VC.local@443\Datacenter1\ABC Datastore01"
  2. My Datastores have a space in their name, this means when the split of the path happens inside the script, instead of getting "ABC Datastore01", I am getting "ABC\Datastore01"

Below is the full error:

Get-ChildItem : Cannot find path '\VC.local@443\Datacenter1\ABC\Datastore01\machine1' because it does not exist.
At D:\Plugins\79 Find VMs in uncontrolled snapshot mode.ps1:15 char:38

  •         $fileList = Get-ChildItem <<<<  "vmstores:\$gciloc\$dc\$Path"
    
    • CategoryInfo : ObjectNotFound: (\vc.local:String) [Get-ChildItem], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Is there a simple fix? Thank you in advance.

Feedback - Email Changes

Just wanted to post a comment on the recent email changes.
Course I love the progress(!), but it's not without a bit of issues.
For example, the new format is pretty much unreadable via Gmail and Lotus Notes (which happen to be the way I read daily reports).
I do understand formatting HTML emails across different clients is a very difficult task. Just wanted to make everyone aware...as unfortunately, not everyone uses Exchange/Outlook (boy I miss those days!!).
The fix me for so far has been to switch to using an attachment, which isn't quite as convenient but works well.

48 FindVmDiskFormat

When using "thick" as $diskformat, EagerZeroedThick format disks are not returned.

Replacing -eq $diskformat with -match $dsikformat would do the trick.

SMTP server config - Auth and SSL support

Now that we are using the .NET mail code introduced for resource handling, we have some more configuration options which we should aim to support (mostly because it annoys me when I am required to authenticate on our internal Exchange server!):

  • Authentication
  • SSL

I'd also like to try to flag configuration items with dependancies somehow- it doesn't make sense to force the user to configure SMTP settings if $SendEmail is $false for example. But this is a longer-term goal I think.

Enhancement: Formatting rules for tables

Something that I found useful in our environment, posting here to see if there is any value in merging to vCheck.

The basic idea is that the vCheck.ps1 has been extended to allow table formatting rules to be passed along to it. These rules are defined in the plugin (see 03 Datastore Information.ps1 for example). Formatting can be applied to Cells, Rows, or Columns.

Can be grabbed from here (only datastores report has been modified at this stage)
https://github.com/Sneddo/vCheck-vSphere

It may not be as easy to use as possible (i.e. perhaps this could be defined in a similar fashion to settings?), but the basic idea is there.

51 syslog name.ps1

Unexpected Token "isnotnullempty" in expression or statement
51 Syslog Name.ps1: line13 character:256

  • @($VMH | Where-Object {$.ExtensionData.Summary.Config.Product.Name -eq 'VMware ESXi'} | Select-Object Name,@{Name='SyslogSetting';Expression = {(Get-VMHostAdvancedConfiguration -VMHost $ -Name Syslog.Local.DatastorePath).Values| Where {$_ isnotnullempty <<<< }}})
    • CategoryInfo : ParserError: (isnotnullempty:String) [], ParseException
    • FullyQualifiedErrorId : UnexpectedToken

vCheckUtils.ps1

Is there a reason why vCheckUtils.ps1 is double the size than the printable text?

The first 288 lines have content, but the remaining lines don't display.

Downloading the zipfile and opening the vCheckUtils.ps1 in wordPad displays lots or garbage (although notepad and ISE seem to display the correct lines of code - 288 lines)

The file size is also around double the size (19632 Bytes instead compared to 9815 Bytes when the code is just copied to a new file)

dvSwitch Security

$Title = "Security settings of Distibuted Virtual Switches"
$Header = "Security settings of Distibuted Virtual Switches"
$Comments = "Security settings of Distibuted Virtual Switches, further information is available here."
$Display = "Table"
$Author = "Fred Witteman"
$Version = 1.0

Start of Settings

End of Settings

$dvSwitchSecurity = (Get-View -ViewType VmwareDistributedVirtualSwitch -Property Name,Config.DefaultPortConfig | `
Select-Object -Property Name,
@{N="Allow Promiscuous";E= {$.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="Allow MAC Address Change";E= {$
.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}},
@{N="Allow Forged Transmits";E= {$_.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}})

@($dvSwitchSecurity)

79 - Find VMs in uncontrolled snapshot mode - Fails on VMs with spaces

This is failing on VMs that have spaces in the name. I have vCenter Operations Manager loaded, and the OVF File places the VMs in a vApp and names them "Analytics VM" and "UI VM" similar problems with HyTrust VMs, and other OVF created VMs that have their own naming convention.

There is a
-replace " ",""
in there. What was the intent of that?

01 General Information missing value descriptions

Using 6.18... My HTML Report output is missing the descriptions of the values it's reporting making it seem like random numbers or just being spit out. For example:

image

I have spent hours trying to make sense of the code and have a much better understanding of how vCheck works, however I am no programmer and it's above my head. I wish I could figure it out and contribute back, I just don't have the skills necessary. Here is the HTML output for that section:

            <div style='
    BORDER-RIGHT: #bbbbbb 1px solid;
    BORDER-TOP: #bbbbbb 1px solid;
    PADDING-LEFT: 0px;
    FONT-SIZE: 8pt;
    MARGIN-BOTTOM: -1px;
    PADDING-BOTTOM: 5px;
    MARGIN-LEFT: 0px;
    BORDER-LEFT: #bbbbbb 1px solid;
    WIDTH: 95%;
    COLOR: #000000;
    MARGIN-RIGHT: 0px;
    PADDING-TOP: 4px;
    BORDER-BOTTOM: #bbbbbb 1px solid;
    FONT-FAMILY: Tahoma;
    POSITION: relative;
    BACKGROUND-COLOR: #f9f9f9
'><table><tr><td>9</td><td>0</td><td>1</td><td>2</td><td>6</td><td>12</td><td>13</td><td>0</td><td>0</td><td>0</td></tr></table>    <!-- CustomHeaderClose -->
        </DIV>

New Plugin $Display type: Graph

This one is a long way off, but I think we should aim to support graphs as an output now that the resource code is pretty much done. Probably a 7.x release goal, but logging to get ideas flowing.

Will need to investigate different graphing APIs.

  • Features and styling
  • Graph types (pie, bar, line, etc)
  • Local vs remote graph generation
  • Embed image in report vs HTML reference

From memory Google has one that you can specify the graph parameters via URL, and we can download the resulting image to include in the report, or include in img tags.

45 VMs needing snapshot consolidation Exceptions

I keep getting these errors -- quite a few of them. Here are some examples:

2:48:59 PM .. start calculating VMs needing snapshot consolidation by Luc Dekens, Frederic Martin v1.2
Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'HostSystem-host-116' Key being
added: 'HostSystem-host-116'"
At C:\Users\xxx\Downloads\vCheck-vSphere-master (1)\vCheck-vSphere-master\Plugins\45 VMs needing snapshot
consolidation.ps1:5 char:17

  • $HostsViews | %{$htabHostVersion.Add($.MoRef,$.config.product.version)}
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentException

Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'HostSystem-host-1648' Key being
added: 'HostSystem-host-1648'"
At C:\Users\xxx\Downloads\vCheck-vSphere-master (1)\vCheck-vSphere-master\Plugins\45 VMs needing snapshot
consolidation.ps1:5 char:17

  • $HostsViews | %{$htabHostVersion.Add($.MoRef,$.config.product.version)}
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentException

Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'HostSystem-host-1700' Key being
added: 'HostSystem-host-1700'"
At C:\Users\xxx\Downloads\vCheck-vSphere-master (1)\vCheck-vSphere-master\Plugins\45 VMs needing snapshot
consolidation.ps1:5 char:17

  • $HostsViews | %{$htabHostVersion.Add($.MoRef,$.config.product.version)}
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ArgumentException

52 Datastore Consistency v1.2.5

I'm curious as to what to do about this error.

12:44:24 AM ..start calculating Datastore Consistency by Robert Sexstone v1.2.5
parsing ":local|datastore" - Quantifier {x,y} following nothing.
At C:\Users\xxx\Downloads\vCheck-vSphere-master-2014-02-06\vCheck-vSphere-master\Plugins\52 Datastore Consistency.ps1:23
char:33

  • @($problemDatastores | Where { $_.Datastore -notmatch $DSDoNotInclude })
  •                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (:) [], ArgumentException
    • FullyQualifiedErrorId : System.ArgumentException

I get quite a few of these errors. Does there need to be some logic added to see if problemDatastores actually has something in it? Or is there something else wrong with the way the match is constructed?

It looks like there should be this

if ($problemDatastores -ne $null) {

}
put around line 23 of the current version.

vCheck error

I get some errors when running vCheck.ps1, installed it today from GIT so latest version.

....
15:46:35 ..finished calculating Datastores with Storage IO Control Disabled by Robert van den Nieuwendijk v1,1
15:46:35 ..finished calculating VMs by Operating System by Raymond v1,1
15:46:35 ..finished calculating Unwanted virtual hardware found by Frederic Martin v1,1
Cannot convert argument "_this", with value: "VimApi_50.ManagedObjectReference", for "SearchDatastoreSubFolders_Task" t
o type "VimApi_51.ManagedObjectReference": "Cannot convert the "VimApi_50.ManagedObjectReference" value of type "VimApi
_50.ManagedObjectReference" to type "VimApi_51.ManagedObjectReference"."
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:44 char:4

  •         $taskMoRef  = $dsb.Client.VimService.SearchDatastoreSubFolders_Task($dsBrowse ...
    
  • CategoryInfo : NotSpecified: (:) [], MethodException
  • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
Parameter name: moRef"
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:45 char:13

  •         $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask([VMware.Vim.V ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentNullException
    
    

Cannot convert argument "_this", with value: "VimApi_50.ManagedObjectReference", for "SearchDatastoreSubFolders_Task" t
o type "VimApi_51.ManagedObjectReference": "Cannot convert the "VimApi_50.ManagedObjectReference" value of type "VimApi
_50.ManagedObjectReference" to type "VimApi_51.ManagedObjectReference"."
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:44 char:4

  •         $taskMoRef  = $dsb.Client.VimService.SearchDatastoreSubFolders_Task($dsBrowse ...
    
  • CategoryInfo : NotSpecified: (:) [], MethodException
  • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
Parameter name: moRef"
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:45 char:13

  •         $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask([VMware.Vim.V ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentNullException
    
    

Cannot convert argument "_this", with value: "VimApi_50.ManagedObjectReference", for "SearchDatastoreSubFolders_Task" t
o type "VimApi_51.ManagedObjectReference": "Cannot convert the "VimApi_50.ManagedObjectReference" value of type "VimApi
_50.ManagedObjectReference" to type "VimApi_51.ManagedObjectReference"."
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:44 char:4

  •         $taskMoRef  = $dsb.Client.VimService.SearchDatastoreSubFolders_Task($dsBrowse ...
    
  • CategoryInfo : NotSpecified: (:) [], MethodException
  • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
Parameter name: moRef"
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:45 char:13

  •         $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask([VMware.Vim.V ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentNullException
    
    

Cannot convert argument "_this", with value: "VimApi_50.ManagedObjectReference", for "SearchDatastoreSubFolders_Task" t
o type "VimApi_51.ManagedObjectReference": "Cannot convert the "VimApi_50.ManagedObjectReference" value of type "VimApi
_50.ManagedObjectReference" to type "VimApi_51.ManagedObjectReference"."
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:44 char:4

  •         $taskMoRef  = $dsb.Client.VimService.SearchDatastoreSubFolders_Task($dsBrowse ...
    
  • CategoryInfo : NotSpecified: (:) [], MethodException
  • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
Parameter name: moRef"
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:45 char:13

  •         $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask([VMware.Vim.V ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentNullException
    
    

Cannot convert argument "_this", with value: "VimApi_50.ManagedObjectReference", for "SearchDatastoreSubFolders_Task" t
o type "VimApi_51.ManagedObjectReference": "Cannot convert the "VimApi_50.ManagedObjectReference" value of type "VimApi
_50.ManagedObjectReference" to type "VimApi_51.ManagedObjectReference"."
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:44 char:4

  •         $taskMoRef  = $dsb.Client.VimService.SearchDatastoreSubFolders_Task($dsBrowse ...
    
  • CategoryInfo : NotSpecified: (:) [], MethodException
  • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Exception calling "WaitForTask" with "1" argument(s): "Value cannot be null.
Parameter name: moRef"
At C:\temp\vCheck-vSphere-master\Plugins\64 Snapshots Oversize.ps1:45 char:13

  •         $task = [VMware.Vim.VIConvert]::ToVim($dsb.WaitForTask([VMware.Vim.V ...
    
  • - CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    - FullyQualifiedErrorId : ArgumentNullException
    
    

15:46:40 ..finished calculating Snapshots Oversize by Raphael Schitz v1,1
15:46:40 ..finished calculating Mis-named virtual machines by Frederic Martin v1,1
15:46:40 ..finished calculating Host Build versions in use by Frederic Martin v1,1
15:46:45 ..finished calculating Disk Max Total Latency by Raphael Schitz, Frederic Martin v1,1

52 (Datastore Consistency) only displays last cluster

Running this script on a vcenter with several clusters, only the last cluster collected by Get-Cluster is displayed in report.

I think $problemDatastores is erased each time a cluster is processed by foreach iteration, then only the last cluster is kept.

Merge Plugin reports into vCheck.ps1

Adding as an enhancement until someone has time to look at it- if there is benefit to it?

I feel like the functionality of the following plugins should be merged into the main vCheck script:
Plugins Not up to date or installed.ps1
Report on Plugins.ps1

We could then have a GlobalVariables.ps1 entry to determine if they are appended to the report.

This would mean that if these plugins are updated, there is no need to update across all vCheck projects. This also means that plugins in the plugins directory only refer to information about that particular environment (i.e. vSphere/Exchange/etc), whereas these plugins refer more to the vCheck environment.

If these plugins are to be useful, the plugins.xml also needs to be updated when plugins are updated or added:
http://www.virtu-al.net/vcheck/plugins/plugins.xml

What do you think?

Add table of contents and nav links to reports

Just flagging this as a "Todo" item...

On long reports it can be a bit tedious navigating. I'm suggesting we include a table of contents (enabled by global variable), and have "back to top" links for each plugin to allow quick navigation.

This could possibly be expanded in future releases to include a summary section. e.g. instead of just linking to the plugin section by name "Datastore Information", link using the Plugin title "Datastores (Less than 25% Free) : 118". This will require a bit more work and changes to style handling.

vCheck default answers (first run)

when running vCheck for the first time, some of the default values have a space before, or after, or both.

This is not a problem for integer, but for strings the match or notmatch operators don't work.

Example : I use the default value provided for 62 Unwanted Virtual Hardware which is [ VirtualUSBController|VirtualParallelPort|VirtualSerialPort]

so the generated var $unwantedHadware in the script is " VirtualUSBController|VirtualParallelPort|VirtualSerialPort" instead of "VirtualUSBController|VirtualParallelPort|VirtualSerialPort"

and then the script reports nothing because of the match operator not matching.

Default values provided during first run should be [something](not [ something] or [ something ]).

Push style variables to style from GlobalVariables.ps1

Just adding these as possible enhancements, if someone has time to look at them. Otherwise I'll get to them at some point...

We should be aiming on moving all style-related variables to the style files. This will require less configuration on first run, and greater separation of script logic and markup.

Remove style variables from GlobalVariables.ps1 and push to style .ps1 files:
$Colour1
$Colour2
$TitleTxtColour

Should also remove the "00 1st Plugin - Select Report Header Image.ps1" file and incorporate this into style files. We can also remove the Headers directory and all headers it contains (or move them to "default" style).

Suggestion - Ordering Plugins

I'm sure this has been thought about before but...wouldn't it be nice to have some sort of organization to the plugins?

I'm not sure of the best way to do this, maybe a numbering scheme that would group similar plugins?
For Example:
100-199 - All vCenter related plugins
200-299 - All Host related plugins
300-399 - All Cluster related plugins
400-499 - All VM related plugins
etc

Far from perfect but would at least keep the major categories together.

A more drastic approach may be to add a category/group to each plugin defining the output order.

Thoughts?

Hardware status warnings/errors

We have moved to vCentre 5.1 and upgraded our HOST from 4.1 to ESXi5.1. We moved our vCheck as well. The issue we are having is under Hardware status warnings/errors we are seeing alerts status (Yellow) but in vCentre under Hardware Status the sensors are all normal

77 Lost access to volume.ps1 Error

Blank line between last setting and "#End of Settings" causes an equal sign to appear on line 5 after running vcheck -config.

The term '=' 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 D:\77 Lost access to volume.ps1:5 char:2

  • = <<<<
    • CategoryInfo : ObjectNotFound: (=:String) [], CommandNotFoundEx
      ception
    • FullyQualifiedErrorId : CommandNotFoundException

63 & 65 - Snapshot User Exception

I need to provide multiple users in which these scripts will not check for snapshots for users listed.

Is this how it should be formatted?

$snapshotUserException = "s-veeam, domain\username"

or should we modify the get-view statement to take multiple variables?

$snapshotUserException1 = "s-veeam"
$snapshotUserException2 = "domain\username"

    (($_.userName -notmatch $snapshotUserException1) -or ($_.userName -notmatch $snapshotUserException2))

98 (vSwitchSecurity) is not friendly with vSwitch2

All of my ESX Hosts have 5 or 6 vswitch, and all of these vswitch and their port group have security policies set to reject.

Don't know why but when running this script, it reports that all vSwitch2 for all hosts have their 3 security policies set to accept ...

Filter request for 27,66 and 100

Not sure if this is correct way of asking for an enhancement, but..
We use Zerto as a DR replication tool and the helper VM's always clutter the vCheck report. Would it be possible to add a VM name filter to plugins 27, 66 and 100?
These are the plugins for VM Tools Issues, Misnamed VM's and VM's with CPU and Memory Reservations.
Please point me in the right direction if this is not the correct forum.

79 Find VMs in uncontrolled snapshot mode.ps1 Errors

The name of the vcenter server is hardcoded in line 10 as lacvcenter1@443.

Get-ChildItem : Cannot find path '\lacvcenter1@443\datacenter\datastore23\server1
At D:\79 Find VMs in uncontrolled snapshot mode.p
s1:10 char:38

  •         $fileList = Get-ChildItem <<<<  "vmstores:\lacvcenter1@443\$dc\$P
    
    ath"
    • CategoryInfo : ObjectNotFound: (\[email protected]\server1
      50:String) [Get-ChildItem], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCh
      ildItemCommand

52 Datastore Consistency.ps1

I got this error when i ran the main script

Unexpected token '.5' in expression or statement.
At c:\vCheck-vSphere-master\Plugins\52 Datastore Consistency.ps1:30 char:23

  • $PluginVersion = 1.2.5 <<<<
    • CategoryInfo : ParserError: (.5:String) [], ParseException
    • FullyQualifiedErrorId : UnexpectedToken

71 Capacity Planning.ps1 Errors

This plugin throws divide by 0 errors if you have a cluster with no vm's in it. I'm using powercli 5.1.
Attempted to divide by zero.
At D:\71 Capacity Planning.ps1:25 char:36

  •         $VmCpuAverage = $CluCpuUsageAvg/ <<<< (Get-Cluster $cluv.name|Get
    
    -VM).count
    • CategoryInfo : NotSpecified: (:) [], RuntimeException
    • FullyQualifiedErrorId : RuntimeException

Attempted to divide by zero.
At D:\71 Capacity Planning.ps1:36 char:36

  •         $VmMemAverage = $CluMemUsageAvg/ <<<< (Get-Cluster $cluv.name|Get
    
    -VM).count
    • CategoryInfo : NotSpecified: (:) [], RuntimeException
    • FullyQualifiedErrorId : RuntimeException

x of y plugins

Just logging this so i remember to make this change, was thinking it would be cool to either have the output telling us how many plugins have run, this is useful when watching it run.....

[1 of 109] 5:25:35 PM ..start calculating s/vMotion Information by Alan Renouf v1.0

Or what would be cooler is if we could get write-progress to add the status bar. Must look into this when its not 3:30 AM!

vCheck.ps1 - Only saves output to file under certain circumstances

I like to email the reports as well as save a copy in case I want to look back.

There seems to be only two ways to get the output saved to file

  1. Add as an attachment to email
  2. Display in local browser (DisplayToScreen)

Else the output is not saved. It appears the path is verified (line 530) but no Out-File occurs unless one of the two options above are triggered.

Not sure when this changed, just getting around to all the new improvements

98 vSwitch Security error messages

Are these error messages something I should do something about? Or is it something that needs attention in the way this plugin is coded?

3:54:40 AM ..start calculating vSwitch Security by Justin Mercier, Sam McGeown, John Sneddon v1.2
Add-PSSnapin : The Windows PowerShell snap-in 'VMware.VimAutomation.Vds' is not installed on this computer.
At C:\Users\xxx\Downloads\vCheck-vSphere-master-2014-02-06\vCheck-vSphere-master\Plugins\98 vSwitch Security.ps1:24 char:10

  •      Add-PSSnapin VMware.VimAutomation.Vds
    
  •      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (VMware.VimAutomation.Vds:String) [Add-PSSnapin], PSArgumentException
    • FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

Get-VDPortGroup : The term 'Get-VDPortGroup' 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 C:\Users\xxx\Downloads\vCheck-vSphere-master-2014-02-06\vCheck-vSphere-master\Plugins\98 vSwitch Security.ps1:49 char:4

  • Get-VDPortGroup | % {
  • CategoryInfo : ObjectNotFound: (Get-VDPortGroup:String) [], CommandNotFoundException
  • FullyQualifiedErrorId : CommandNotFoundException

3:55:43 AM ..finished calculating vSwitch Security by Justin Mercier, Sam McGeown, John Sneddon v1.2

Plugins with very long run times ( 32, 33, 36, 72, and 79 )

This report took 1580.7 minutes to run all checks.
The following plugins took longer than 60 seconds to run, there may be a way to optimize these or remove them if not needed

79 Find VMs in uncontrolled snapshot mode.ps1 65309.3
33 VM CPU Usage.ps1 10618.72
32 VM CPU Percent RDY.ps1 6150.4
72 s-vMotion Information.ps1 3273.73
36 Host Alarms.ps1 2446.52

How can I best go about getting some insight into how these run times might be reduced? It seems crazy that these plugins should take this long. Perhaps there is a different way to get the results for these plugins? I ran this against an environment with approximately 2200 VMs on 75 hosts across 12 clusters

91 dvSwitch Portgroup Security

$Title = "Security settings of Portgroups of Distibuted Virtual Switches"
$Header = "Security settings of Portgroups of Distibuted Virtual Switches"
$Comments = "Security settings o fPortgroups of Distibuted Virtual Switches, further information is available here."
$Display = "Table"
$Author = "Fred Witteman"
$Version = 1.0

Start of Settings

End of Settings

$dvSwitchnames=Get-View -ViewType VmwareDistributedVirtualSwitch -Property Name,Portgroup | Select *
foreach($dvSwitchnames.Name in $dvSwitchnames){
$dvSwitchPortgroupSecurity+=Get-View $dvSwitchnames.Portgroup | %{$_ | Select-Object -Property @{N="dvSwitch";E={$dvSwitchnames.Name}},Name,
@{N="Allow Promiscuous";E={$.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value}},
@{N="Allow MAC Address Change";E={$
.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value}},
@{N="Allow Forged Transmits";E={$_.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value}}
}
}

@($dvSwitchPortgroupSecurity)

Plugin - 27 VM Tools Issues

It reports about VMTool issues on VMs PowerOff

I replaced
$.Guest.GuestState -eq "Running"
($
.Guest.GuestState -eq "Running" -And $_.Runtime.PowerState -ne "poweredOff")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.