Setting Up a Monitoring System to Run vCheck 6.15 for Scheduled Monitoring of Multiple vCenter Servers

*vCheck is an excellent script utilizing the vSphere Power CLI, which is written and maintained by Alan Renouf with contributions from the VMware community at large. vCheck is available from www.virtu-al.net.

Contents
1. Pre-requisites*
2. Installing vCheck on a Monitoring Station.
3. Testing the Script from MS-DOS
4. Setting up a Scheduled Task.
5. Applying to Multiple vCenter Servers
*Includes recommendations on user account to use to connect to client vCenters and minimum vCenter permissions to run the script; and plugins to use.

1. Pre-requisites
1) A suitable system with PowerShell installed, and capable of running vSphere Power CLI.
Here using a Windows 7 32-bit machine on an internal domain with access to clients vCenters. The machine is fully patched, with up to date anti-virus, and with unnecessary services locked down.
Note 1: Choosing domain or workgroup is up to individual circumstances - ideally the system would be in a DMZ.
Note 2: Windows Server or Windows 7 machine is up to individual circumstances – ideally this would be setup utilizing a pre-existing monitoring server.

2) User accounts:
i: User account with local administrator privileges on the Monitoring Station to install vSphere Power CLI and run the script.
ii: vCenter connection accounts.
The minimum required account permissions would be a local user account on the customer's vCenter server, with Read Only permission in vCenter applied across 'Hosts and Clusters' / 'VMs and Templates' and Datastores, with the Datastore > Browse Datastore, and Global > Health permissions (also selected Global > Diagnostics)

2. Installing vCheck on a Monitoring Station
1) Download and install vSphere Power CLI (5.0.1 is the current latest version) from http://www.vmware.com
2) Run Windows PowerShell as an administrator, and set the PowerShell execution policy to RemoteSigned:
> Set-Execution Policy RemoteSigned
3) Download vCheck (6.15 is the current latest version) from http://www.virtu-al.net
4) Before unzip vCheck.zip, check the properties of the file and on the General tab click Unblock
5) Unzip vCheck.zip and – to make life easier – can place the unzipped vCheck folder at the root of a drive (e.g. V:\ in the examples below)
6) Before first running the script, reduce the number of plugins to speed up the running of the script, and avoid information overload. Can move the unused plugins to a 'Removed Plugins' folder within the Plugins folder. The below image gives an example set of plugins to keep (also listed in the Appendix below):
Note: You may want to run a different set of plugins for different customers, so later can copy the entire vCheck folder to give each customer their own vCheck folder, and just edit a few lines in the scripts, and apply a new scheduled task.
7) In Windows PowerShell, navigate to the location of the vCheck.ps1 script and use the command .\vCheck.ps1 to do an initial run of the script
> .\vCheck.ps1
8) Run through the prompts answering as per requirements
Note: To re-run wizard use vCheck.ps1 -Config, alternatively can edit the GlobalVariables.ps1 file.
9) PowerShell prompts for 'Please specify server credential' for connection to the vCenter server.
If all is setup correctly, the script should run with no errors and an email report should be received:
10) Create of a copy of the vCheck folder called say vCheckCustomerName

3. Testing the Script from MS-DOS
Test running of the script from the MS-DOS command line with syntax similar to the below:
> C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -file "V:\vCheckCustomerName\vCheck.ps1" -noconsole –noninteractive
Example:
Note 1: On a 64 bit system use Program Files (x86) instead of Program Files
Note 2: If continuously being prompted for vCenter credentials, edit the '00 Connection Plugin for vCenter.ps1' file in the plugins folder, at roughly line 26 – which is:
$VIConnection = Connect-VIServer $VIServer
- with arguments for user, password and protocol as below:
$VIConnection = Connect-VIServer $VIServer -user “vCheck” -Pass “PASSWORD” -Protocol Https

4. Setting up a Scheduled Task.
Now create the scheduled task via Administrative Tools > Task Scheduler (taskschd.msc)
Select 'Create Task...' and configure as required.
Paste the tested line from section 3 into the 'Program/script:' box when specifying the New Action:
Note: To add multiple email correspondents, edit the GlobalVariables.ps1 file and $EmailTo line as below:
$EmailTo =”user01@example.com”, “user02@example.com”


5. Applying to Multiple vCenter Servers
There are various ways to run the script for other customers/multiple vCenters; one easy way that gives granular control across what plugins run and the contents of GlobalVariables.ps1 and '00 Connection Plugin for vCenter.ps1' (if modification required), is to simply copy the vCheckCustomerName folder, rename the folder for the new customer, apply custom configuration changes, and either add a New Action to the existing scheduled task, or create a new scheduled task.

The lines in GlobalVariables.ps1 that will/might need modification are just:
$Server
$EmailFrom (depending on requirements)
$EmailTo (depending on requirements)
$EmailSubject (depending on requirements)

If you have the same local user account across all vCenters (set up with the minimum permissions to vCenter as described in section 1), then the '00 Connection Plugin for vCenter.ps1' does not need to be modified, otherwise just modify the following line as required:
$VIConnection

Appendix: Recommended Plugins
The following is a selection of plugins that will provide the most essential information for a scheduled daily report (the most common VMware problems tend to be unmonitored snapshots running out of control and filling up the underlying datastore) and will not take too long to run:

00 Connection Plugin for vCenter
01 General Information
03 Datastore Information
06 Hosts not responding or Disconnected
07 Hosts Overcommit State
08 Hosts Dead Lun Path
12 VMs Swapping or Ballooning
13 invalid or inaccessible VMs
19 Guest with less than X MB free
23 VI Events
35 Host Configuration Issues
36 Host Alarms
37 VM Alarms
44 VMKernel Warnings
47 HAHostMonitoring
53 Hardware status warnings-errors
56 Clusters with HA Disabled
64 Snapshots Oversize

Comments

  1. Vidad, thanks so much for posting this. It's exactly what I was looking for. Tremendous help.

    ReplyDelete
  2. Excellent.. I see where I went wrong with the multiple e-mail addresses. It differs in vcheck 5.

    ReplyDelete
  3. do you know how I add SMTP authentication on the script? Thanks

    ReplyDelete
    Replies
    1. Hello Justin,
      I'm not sure I understand the question, but the best source for info on vCheck is the source:
      http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/
      Tonnes of stuff on their. Alan Renouf is a scripting Wizard!
      Cheers

      Delete
    2. i'm running vcheck6.15 against ESXI5 every time i have to provide username and password. hardcoding of username and password is not working
      $VIConnection = Connect-VIServer $VIServer -user “vCheck” -Pass “PASSWORD” -Protocol Https

      Delete
    3. i'm running vcheck6.15 against ESXI5 every time i have to provide username and password. hardcoding of username and password is not working
      $VIConnection = Connect-VIServer $VIServer -user “vCheck” -Pass “PASSWORD” -Protocol Https

      -- its working fine my password had special characters ( S@ )so it was giving error. :-)

      Delete
    4. Hi Anonymous,

      I'm pleased you resolved your issue.

      Cheers!
      VCosonok

      Delete
  4. Great information, I really like all your post. I will keep visiting this blog very often. It’s good to visit your website. And also please Read link bvba Woodstone which provide information server monitoring & monitoring tools

    ReplyDelete

Post a Comment