Ad Widget

Collapse

Hyper-V Template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nick0909
    Member
    • Apr 2013
    • 73

    #1

    Hyper-V Template

    I am working on making a Hyper-V template using perfmon counters for my Server 2012 HyperV hosts. I am reading up on what counters are useful, testing and tweaking it now and can post it to the template wiki once I am done, but I was wondering if anyone already had one created or comments on what is good to monitor. Currently I am basing most of it off of this article and things I discover along the way that look interesting. I only have a smallish Hyper V cluster (4 nodes but only about 8VMs) right now (but it will be growing soon, which is why I am putting in the time now) so if anyone is interested in testing it on a larger environment that would be helpful as well.
  • JDNight
    Junior Member
    • Nov 2006
    • 15

    #2
    Hyper V Template

    Just finished off my first version of a Hyper-V Template. Link here

    The template monitors the Hyper V Service, CPU, Memory, and auto discovers the virtual machines running on the server. It uses a powershell script to get some of the information.

    I'm still working on improving it, so thanks for the link I will look to add additional monitors. I too have a small but rapidly growing Hyper V cluster.

    Comment

    • nick0909
      Member
      • Apr 2013
      • 73

      #3
      I have uploaded mine here:
      Join the friendly and open Zabbix community on our forums and social media platforms.

      It uses quite a few perfmon counters on the host to monitor health, I am still working on adding more and taking out things that don't really seem to matter as I learn more about what counters represent in real world performance. I will take a look at yours as well, maybe we can merge the best of the two in to one.

      Comment

      • nick0909
        Member
        • Apr 2013
        • 73

        #4
        I like the powershell output! I wonder if there is another item you could help me add? I want to know if there are snapshots running on a VM. If possible, also I would like to know their age, so I could alert if there were snapshots more than 5 days old (or whatever you pick in the trigger). If that is too difficult then just alert if there are any snapshots will work. So far I have the basic command:
        Code:
        PS C:\Windows\system32> get-vmsnapshot zabbix
        
        VMName Name                              SnapshotType CreationTime         ParentSnapshotName
        ------ ----                              ------------ ------------         ------------------
        Zabbix Zabbix - (4/26/2013 - 4:02:08 PM) Standard     4/26/2013 4:03:16 PM
        You could select the creationtime, but could you input that in to zabbix in a date it would understand and be able to tell you if it was older than a specific age? If not simply inputting a 1 that a snapshot exists would be great.

        Comment

        • nick0909
          Member
          • Apr 2013
          • 73

          #5
          I have added snapshot detection to your original script by adding this in the $QueryName section:
          Code:
          ('Snapshots') {$Results = Get-VMSnapshot -VMName "$VMName" | select Name | Format-Table -HideTableHeaders -AutoSize}
          Then I just created an item for that, and a trigger that fires if the string is longer than 0. I hope to improve this in the future to only alert if there is a snapshot older than X number of days, as we use snapshots quickly sometimes but don't want them hanging around forgotten about.

          Discovery item:
          Code:
          hyperv.check[Snapshots,{#VMNAME}]
          Discovery trigger:
          Code:
          {Template_Windows_HyperV_Guests:hyperv.check[Snapshots,{#VMNAME}].strlen(0)}>1

          Comment

          • lucsmitty
            Junior Member
            • Apr 2014
            • 1

            #6
            I'm not quite there...

            Nick,
            I want to use your HyperV template. I imported it, graphs show "No Data".

            On the agent side, I'm using: PerfCounter=perf_counter[\Hyper-V Hypervisor\Logical Processors],"\Hyper-V Hypervisor\Logical Processors",30

            That's how I think it would work as I look through the xml of the template file. I'm new to Zabbix, so I'm not ruling out that I'm totally wrong, but any help would be gladly accepted. Thanks,
            Greg

            Comment

            • Deslok
              Junior Member
              • Jan 2016
              • 2

              #7
              Originally posted by lucsmitty
              Nick,
              I want to use your HyperV template. I imported it, graphs show "No Data".

              On the agent side, I'm using: PerfCounter=perf_counter[\Hyper-V Hypervisor\Logical Processors],"\Hyper-V Hypervisor\Logical Processors",30

              That's how I think it would work as I look through the xml of the template file. I'm new to Zabbix, so I'm not ruling out that I'm totally wrong, but any help would be gladly accepted. Thanks,
              Greg
              Did you ever get this working? I have a large 3 node/30ish vm cluster i'm trying to monitor

              Comment

              • nick0909
                Member
                • Apr 2013
                • 73

                #8
                We are phasing out our HyperV cluster in favor of VMWare, but I did have decent enough monitoring. Here are the templates and the scripts, import the template and put the scripts the agent folder. I only applied the CSV template to one host in the cluster, otherwise they will all alert at the same time as they share the same CSV's.

                Add this to your Zabbix agent config, change the path to the script if you install the agent somewhere else:
                Code:
                #HyperV discovery
                UserParameter=hyperv.discover,powershell.exe -file "C:\Zabbix\HyperV_Status.ps1"
                UserParameter=hyperv.check[*],powershell.exe -file "C:\Zabbix\HyperV_Status.ps1" $1 $2
                UserParameter=windisk.discover,powershell.exe -NoProfile -ExecutionPolicy Bypass -file "C:\Zabbix\CSVDrives_Status.ps1"
                UserParameter=windisk.check[*],powershell.exe -NoProfile -ExecutionPolicy Bypass -file "C:\Zabbix\CSVDrives_Status.ps1" $1 "$2"
                Let me know if it works out.
                Nick

                Comment

                • mrjibbles
                  Junior Member
                  • Mar 2016
                  • 1

                  #9
                  Hi,
                  I have been trying to get your Hyper-V template working on a test Windows 2012/2016 server, however I may be missing something!
                  I have imported the template and attached to my test server.
                  I have added the additional lines to the zabbix_agent.conf file running on the server.
                  The 2 PS scripts work fine, but I am not seeing any data appearing or able to see any graphs.
                  Have I missed something to get this reporting?
                  The Zabbix queue is showing 38 Hyper-V item waiting to be updated.
                  Thanks in advance.
                  Mr Jibbles
                  Attached Files

                  Comment

                  • ruediger.wahl
                    Junior Member
                    • Mar 2017
                    • 1

                    #10
                    @ Mr Jibbles

                    have you ever solved the Problem with the refresh of the values?
                    i try the Hyper-V template but have the same problem like you

                    Comment

                    • Gijs007
                      Member
                      • Oct 2017
                      • 40

                      #11
                      You might want to try this script instead:


                      This works fine on my Hyper-V host.

                      Comment

                      • karzer
                        Member
                        • Mar 2010
                        • 61

                        #12
                        Multiple client creation after moving between nodes

                        Hello,

                        I'm using your Hyper-V template script and it works nice. Thanks for this.
                        On the other hand, I have a problem with hyper-v server with cluster structure.
                        When a virtual machine moved-migrated to another hyper-v node on it create an another Host on Hyperv VM hostgroup.

                        For example
                        This list of the host group on first HyperV Node;
                        VirtualMachineABC_Node1

                        The list of the host group when moved-migrated to another node;
                        VirtualMachineABC_Node1 (This one stays and values became passive )
                        VirtualMachineABC_Node2 (Creates another host for older VM)

                        I hope i could explain.

                        Thanks anyway

                        Comment

                        • kolele
                          Junior Member
                          • Nov 2016
                          • 11

                          #13
                          Import failed

                          I have an issue when trying to import https://share.zabbix.com/virtualizat...lication-state

                          It says - Invalid tag "/zabbix_export/templates/template(1)": unexpected tag "httptests". My zabbix version is 3.0.14 - how to solve it ?

                          Comment

                          Working...