Ad Widget

Collapse

Monitoring Hyper -V VM's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cgroothius
    Member
    • Sep 2008
    • 37

    #1

    Monitoring Hyper -V VM's

    Is this possible? Searched the forums and cant find apost with a straight answer...

    Thanks for any assistance.

    PS If it is possible, is the a FAQ / Post that describes the method?

    Cheers
    Colin.
  • cgroothius
    Member
    • Sep 2008
    • 37

    #2
    Anyone comment ?

    Comment

    • cgroothius
      Member
      • Sep 2008
      • 37

      #3
      Anyone home?

      Comment

      • cgroothius
        Member
        • Sep 2008
        • 37

        #4
        Can no one amswer this question? Herein lies the problem with community based support...

        Comment

        • alixen
          Senior Member
          • Apr 2006
          • 474

          #5
          Hi,

          I'll try to help you, however I don't have any experience with Hyper-V (I am a Unix/Linux guy

          If you want to monitor what is going on inside VMs, you could install a Zabbix agent in each VM and monitor them as any physical server.

          If you want to monitor Hyper-V itself, you'll probably have to find out what information Hyper-V provides and how to access it. A quick google search of "Hyper-V SNMP" returns a few answers, I don't know if they are relevant.

          Hope this helps,
          Alixen
          http://www.alixen.fr/zabbix.html

          Comment

          • cgroothius
            Member
            • Sep 2008
            • 37

            #6
            Problem With Agent on Hyper-V Hosts

            OK I have installed Zabbix agent on Hyper-V guest VM's but they are not talking back to Zabbix server (availablity is "unknown" in host configuration screen. I can telnet from Zabbix Server to VM's no worries.


            [cgroothius@zabbix ~]$ telnet 192.168.87.50 10050
            Trying 192.168.87.50...
            Connected to 192.168.87.50.
            Escape character is '^]'.
            agent.version
            ZBXD1.6.5Connection closed by foreign host.
            [cgroothius@zabbix ~]$ PuTTY


            anyone got any ideas?

            Comment

            • cgroothius
              Member
              • Sep 2008
              • 37

              #7
              Collecting Hyper-V Perfmon Statistics

              OK...so I see that the best way to monitor Hyper-V is from the Server 2008 host performance monitors.

              Logging on to the Server 2008 Host and typing typeperf -qx > typeperf.txt puts a list of counters to a file....

              So far so good.

              There are quite a few Hyper-V counters. Adding some to the items monitored in Zabbix UI yields no results...

              Not so good.

              From the command prompt on the Server 2008 host issue the following command for example

              typeperf "\Hyper-V VM Vid Driver\ProcessorCount"

              Returns values...
              So far So good.


              C:\>typeperf "\Hyper-V VM Vid Driver\ProcessorCount"

              "(PDH-CSV 4.0)"
              "10/07/2009 10:57:34.282","-1"
              "10/07/2009 10:57:35.296","-1"
              "10/07/2009 10:57:36.310","-1"
              "10/07/2009 10:57:37.324","-1"
              "10/07/2009 10:57:38.338","- etc etc

              Issuing the command to Zabbix agent to get same values returns


              c:\Program Files (x86)\Zabbix Agent>zabbix_agentd.exe -t perf_counter["\Hyper-V
              VM Vid Driver\ProcessorCount"]
              perf_counter[\Hyper-V VM Vid Driver\ProcessorCount] [m|ZBX_NOTSUPPORTED]

              Not Supported.
              Hmm
              Not so good.

              So, am I doing this wrong or is Hyper-V basically "not supported"??


              Thanks
              Colin.

              Comment

              • cgroothius
                Member
                • Sep 2008
                • 37

                #8
                Some Counters Are Supported

                Spoke too soon.

                Seems I will have to go through one by one by one and see what is and isn't. Deep joy.

                Anyone got a list ? Yeah right....

                I will provide when Im done.

                Comment

                • EvilEugene
                  Junior Member
                  • Mar 2012
                  • 20

                  #9
                  I have same problem

                  Hi, Its an old post, but I made template for this.
                  first, you need to add this line to zabbix_agentd.conf :

                  Code:
                  UserParameter=system.hvms,powershell.exe "$VMstate = gwmi -class \"MSVM_ComputerSystem\"-namespace \"root\virtualization\"-computername \".\" ;foreach ($VM in $VMstate) { switch ($VM.EnabledState) { 2{$state=\"Running\"; $color=\"green\"} 3{$state=\"Stopped\"; $color=\"red\" } 32768{$state=\"Paused\"; $color=\"gray\" } 32769{$state=\"Suspended\"; $color=\"gray\" } 32770 {$state=\"Starting\"; $color=\"yellow\" } 32771{$state=\"Taking Snapshot\"; $color=\"gray\" } 32773{$state=\"Saving\"; $color=\"gray\" } 32774{$state=\"Stopping\"; $color=\"pink\" } } if ($VM.Description -eq 'Microsoft Virtual Machine') {write-host -nonewline $VM.ElementName `,` '<b><font color=\"'$color'\">' $state '</font></b></br>' }}"
                  and here is template :

                  Code:
                  <?xml version="1.0" encoding="UTF-8"?>
                  <zabbix_export version="1.0" date="15.01.11" time="03.06">
                    <hosts>
                      <host name="windows_hyper-v_vms">
                        <proxy_hostid>0</proxy_hostid>
                        <useip>1</useip>
                        <dns></dns>
                        <ip>127.0.0.1</ip>
                        <port>10050</port>
                        <status>3</status>
                        <useipmi>0</useipmi>
                        <ipmi_ip>127.0.0.1</ipmi_ip>
                        <ipmi_port>623</ipmi_port>
                        <ipmi_authtype>0</ipmi_authtype>
                        <ipmi_privilege>2</ipmi_privilege>
                        <ipmi_username></ipmi_username>
                        <ipmi_password></ipmi_password>
                        <groups>
                          <group>Templates</group>
                        </groups>
                        <items>
                           <item type="7" key="system.hvms[*]" value_type="4">
                            <description>hyper-v vm status</description>
                            <ipmi_sensor></ipmi_sensor>
                            <delay>30</delay>
                            <history>90</history>
                            <trends>365</trends>
                            <status>0</status>
                            <data_type>0</data_type>
                            <units></units>
                            <multiplier>0</multiplier>
                            <delta>0</delta>
                            <formula>1</formula>
                            <lastlogsize>0</lastlogsize>
                            <logtimefmt></logtimefmt>
                            <delay_flex></delay_flex>
                            <authtype>0</authtype>
                            <username></username>
                            <password></password>
                            <publickey></publickey>
                            <privatekey></privatekey>
                            <params></params>
                            <trapper_hosts></trapper_hosts>
                            <snmp_community>public</snmp_community>
                            <snmp_oid>interfaces.ifTable.ifEntry.ifInOctets.1</snmp_oid>
                            <snmp_port>161</snmp_port>
                            <snmpv3_securityname></snmpv3_securityname>
                            <snmpv3_securitylevel>0</snmpv3_securitylevel>
                            <snmpv3_authpassphrase></snmpv3_authpassphrase>
                            <snmpv3_privpassphrase></snmpv3_privpassphrase>
                            <applications>
                              <application>hyper-v vm</application>
                            </applications>
                          </item>
                        </items>
                        <templates/>
                        <graphs/>
                        <macros/>
                      </host>
                    </hosts>
                    <dependencies/>
                  </zabbix_export>
                  just copy and paste. and with 'show text ad html' option on screen, It will be like this :

                  Last edited by EvilEugene; 31-05-2012, 06:54.

                  Comment

                  • Zuzuka
                    Member
                    • Aug 2011
                    • 39

                    #10
                    Originally posted by EvilEugene
                    ... and with 'show text ad html' option on screen, It will be like this ...
                    Can you explain where I can find this option? Is it in the browser or in the Zabbix config?

                    Comment

                    • EvilEugene
                      Junior Member
                      • Mar 2012
                      • 20

                      #11
                      Zuzuka, you can found it on screen configuration. see the picture below
                      Last edited by EvilEugene; 31-05-2012, 06:50.

                      Comment

                      • HullZabbix
                        Senior Member
                        • Feb 2011
                        • 104

                        #12
                        Just for future reference Hyper-V is supported just like a normal 2008 server.

                        Just install the .exe for normal windows agents via the command line

                        Comment

                        • Boghdan
                          Junior Member
                          • Jun 2012
                          • 18

                          #13
                          Thanks for the template, EvilEugene. Works just perfect for me, except for one host, which returns me the following value:

                          Code:
                          Get-WmiObject : Invalid namespace 
                          At line:1 char:16
                          + $VMstate = gwmi <<<<  -class "MSVM_ComputerSystem"-namespace "root\virtualiza
                          tion"-computername "." ;foreach ($VM in $VMstate) { switch ($VM.EnabledState) {
                           2{$state="Running"; $color="green"} 3{$state="Stopped"; $color="red" } 32768{$
                          state="Paused"; $color="gray" } 32769{$state="Suspended"; $color="gray" } 32770
                           {$state="Starting"; $color="yellow" } 32771{$state="Taking Snapshot"; $color="
                          gray" } 32773{$state="Saving"; $color="gray" } 32774{$state="Stopping"; $color=
                          "pink" } } if ($VM.Description -eq 'Microsoft Virtual Machine') {write-host -no
                          newline $VM.ElementName `,` '<b><font color="'$color'">' $state '</font></b></b
                          r>' }}
                              + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], Managemen 
                             tException
                              + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C 
                             ommands.GetWmiObjectCommand
                          The mentioned line is present in the agent's config file, everything else also looks like to be pretty same as on other hosts... Any ideas of where the problem could be? 10x 4ward

                          Comment

                          • EvilEugene
                            Junior Member
                            • Mar 2012
                            • 20

                            #14
                            Hi Boghdan!
                            run this command on power shell :
                            Code:
                            $VMstate = gwmi -class "MSVM_ComputerSystem" -namespace "root\virtualization" -computername "." ;
                            	foreach ($VM in $VMstate)
                            		{ switch ($VM.EnabledState)
                            			{ 
                            				2{$state="Running"; $color="green"} 
                            				3{$state="Stopped"; $color="red" }
                            				32768{$state="Paused"; $color="gray" }
                            				32769{$state="Suspended"; $color="gray" }
                            				32770 {$state="Starting"; $color="yellow" }
                            				32771{$state="Taking Snapshot"; $color="gray" }
                            				32773{$state="Saving"; $color="gray" } 
                            				32774{$state="Stopping"; $color="pink" }
                            			} 
                            			if ($VM.Description -eq 'Microsoft Virtual Machine') 
                            			{
                            				write-host -nonewline $VM.ElementName `,` '<b><font color="'$color'">' $state '</font></b></br>' 
                            			}
                            		}
                            it should return your vm status and some html tags. would you post its result on here?

                            Comment

                            • Boghdan
                              Junior Member
                              • Jun 2012
                              • 18

                              #15
                              Looks like smth is missing on the host's side... The bold text is the error in PS i get in red. Same text i get when i copy your text to a text file and run it as a script (execution policy is set to unrestricted).

                              Code:
                              PS C:\Windows\system32> $VMstate = gwmi -class "MSVM_ComputerSystem" -namespace "root\virtualization" -computername "."
                              ;
                              [B]Get-WmiObject : Invalid namespace
                              At line:1 char:16
                              + $VMstate = gwmi <<<<  -class "MSVM_ComputerSystem" -namespace "root\virtualization" -computername "." ;
                                  + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
                                  + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand[/B]
                              
                              PS C:\Windows\system32>     foreach ($VM in $VMstate)
                              >>         { switch ($VM.EnabledState)
                              >>             {
                              >>                 2{$state="Running"; $color="green"}
                              >>                 3{$state="Stopped"; $color="red" }
                              >>                 32768{$state="Paused"; $color="gray" }
                              >>                 32769{$state="Suspended"; $color="gray" }
                              >>                 32770 {$state="Starting"; $color="yellow" }
                              >>                 32771{$state="Taking Snapshot"; $color="gray" }
                              >>                 32773{$state="Saving"; $color="gray" }
                              >>                 32774{$state="Stopping"; $color="pink" }
                              >>             }
                              >>             if ($VM.Description -eq 'Microsoft Virtual Machine')
                              >>             {
                              >>                 write-host -nonewline $VM.ElementName `,` '<b><font color="'$color'">' $state '</font></b></br>'
                              >>             }
                              >>         }
                              >>

                              Comment

                              Working...