Ad Widget

Collapse

VMWare ESXi hardware health via PowerShell (part 1)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    VMWare ESXi hardware health via PowerShell (part 1)

    Here's another way to monitor ESXi hardware health using Windows and PowerShell. This is still fairly new and I will post updates if there is interest. To Setup:

    On Zabbix:
    1. Import the two templates (one for Dell, one for HP)
    2. Setup your VMWare host using IP address that you use for vSphere
    3. Link one of the templates to your host. Even if you don't have Dell or HP hardware you can still use one of the templates and get basic hardware status.


    On a Windows computer (like the one that has vSphere Manager):
    1. Make sure Powershell is installed. It's included in Windows 7 and Windows Server 2008. For Windows XP and windows Server 2003: http://support.microsoft.com/kb/968929
    2. Make sure Zabbix agent is installed. You will need Zabbix_Sender.exe
    3. Install the VMWare VSphere Power CLI: See http://www.vmware.com/go/powercli
    4. Verify that PowerCLI is working.
    5. To allow local scripts to run, you need to modify PowerShell with "Set-ExecutionPolicy RemoteSigned" http://technet.microsoft.com/en-us/l.../ee176961.aspx
    6. Save PostVMWareStatus.CMD and PostVMWareStatus.ps1 to a folder. (C:\Scripts was used)
    7. Edit the CMD file and list the vmware servers that you want to check including the Zabbix host name, ip address, userid and password.
    8. Edit the PS1 file and update the IP Address of your Zabbix proxy or server. Verify that the path to Zabbix_Sender is correct. On Win7 you might need to right click on the file, properties and "Unblock".


    Once this is complete, you should be able to open a cmd prompt, go into powershell and test:

    Code:
    C:\Scripts>powershell
    Windows PowerShell
    Copyright (C) 2009 Microsoft Corporation. All rights reserved.
    
    PS C:\Scripts> .\PostVMWareStatus.ps1 vmware1.localhost.net 192.168.1.1 root password -test
    unable to post more without error "too many live links". The short version is to schedule the CMD via windows task manager
    Last edited by bradh; 25-02-2013, 09:23.

    #2
    ZIP file with templates, cmd and powershell script are here:
    Attached Files
    Last edited by bradh; 25-02-2013, 04:59.

    Comment


      #3
      Cool, any reason to not use the perl vmware api for linux ?

      I am presume (wrongly maybe) that every one run their zabbix server on a linux box

      Comment


        #4
        There is a long thread started by dima_dm on using the perl api plus wbem for monitoring mostly HP hardware. I've looked through the details and it looks very good and is capturing lots of data but it looked non-trivial - especially when it looks like modifications are probably required to Zabbix. I was looking for something very simple to set up that worked easily with primarily Dell hardware. That's what started me down a different path.

        But biggest thing is that this script works from behind a firewall. I have vmware hosts to monitor that are behind firewalls. (Yes... I could set up a proxy servers...)

        This is just an alternative that I thought I would make available. If someone already has perl + wbem working there is absolutely no reason to do anything different.
        Last edited by bradh; 26-02-2013, 08:46.

        Comment


          #5
          Nice work.

          Comment


            #6
            The process looks like it's gonna take at least a day or 2 to complete but overall, I think it's very feasible.

            Nice job.

            Comment

            Announcement

            Collapse
            No announcement yet.
            Working...
            X