Ad Widget

Collapse

Howto use Zabbix Agent in discovered VM Guests

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ApolloDS
    Junior Member
    • Dec 2010
    • 11

    #1

    Howto use Zabbix Agent in discovered VM Guests

    Hi all,
    I'm monitoring our VMWare Environment with the new VMWare Templates in Zabbix v2.2 which is absolutely great!!
    I see now all the Guest VM which are known on our vCenter Server and I can monitor Network and Storage Items which were discovered.

    Now, how can I mnonitor the discovered guest with a Zabbix Agent?
    I tried to link another Template to the discovered hosts but this seems not to work.
    The problem seems to be that the agent entry of the discovered guest VM is the vCenter IP and not the Guest VM IP, therefore no connection to the Zabbix Agent is possible (I think).

    Anyone who is also doing advanced VM Monitoring with the new v2.2 Features yet?

    Thanks for your reply.

    Peter
  • safpsr
    Member
    • Aug 2007
    • 70

    #2
    I am interested in this question too. Does someone have an idea to do it ?

    Comment

    • GeneBean
      Junior Member
      • Jan 2012
      • 21

      #3
      I was actually just looking into the same thing... hoping someone here knows how to make all this work.

      Comment

      • safpsr
        Member
        • Aug 2007
        • 70

        #4
        There is a feature request: https://support.zabbix.com/browse/ZBXNEXT-2043

        Comment

        • Kryol
          Member
          • Feb 2011
          • 70

          #5
          Originally posted by safpsr
          But I see another features here and nothing related to the problem described above.

          Comment

          • GeneBean
            Junior Member
            • Jan 2012
            • 21

            #6
            Originally posted by safpsr
            That link has some good points but does not address this question.

            Comment

            • GeneBean
              Junior Member
              • Jan 2012
              • 21

              #7
              I made a feature request... please chime in. https://support.zabbix.com/browse/ZBXNEXT-2088

              Comment

              • tatapoum
                Senior Member
                • Jan 2014
                • 185

                #8
                +1

                Two major issues :
                - the VMWare discovery feature needs to collect the IP address or DNS name of the VMs, in order to be able to poll a Zabbix agent inside the VM for example.
                - the created VMs are mostly readonly : you can't link them to a template, except at the VM discovery. This means that you can link a template, but only to all discovered VMs, thus not allowing to differentiate between prod/dev servers, app/db servers, etc.

                Comment

                • kblackwell
                  Junior Member
                  • Oct 2013
                  • 22

                  #9
                  Check out this posting for a solution

                  Comment

                  • omarmdz
                    Junior Member
                    • Dec 2012
                    • 1

                    #10
                    Zabbix 2.2.3 Monitor with VMware Guest Template and OS Windows/Linux Template on a VM

                    I came across the issue where i couldn't utilize the Template OS Windows and Linux Template on my Guest VM's after they were discovered by my Hypervisors. The Guest VM's take on the IP Address of the Hypervisor it lives on and not its own IP address that is assigned to the Guest VM so the Zabbix Agent installed on my host is not able to communicate to the Zabbix Server and vice versa. The option to add another Agent Interface is is not allowed on the discovered VM. For now this is my workaround until the feature request is implemented on a future Zabbix version.

                    1. Do a Full Clone of the Discovered VM.
                    2. Do not remove the "Host Name" or "Visible Name". Simply put "New" at the end of both fields or whatever you may like so that you can save the cloned VM since it won't let you save duplicate hosts with the same names. By keeping the "Host Name" the Hypervisor won't re-discover the VM and also allow you to monitor with the VM Guest Template.
                    3. Now you can go back and delete the discovered VM since you cloned it. Once you do that go back to the "New" VM and delete the "New" from the end of the host name fields you added.
                    4. Now on the new cloned VM you have the option to add an Agent Interface where you should enter the IP Address of the VM.
                    5. Once you add the IP address of the VM you can add the Template OS Windows or Linux Template or whatever other template you want to use.

                    Yes this requires alot of manual work but works for me so far. Hopefully someone else has a better way. Another thing to do to speed up the assigning of multiple templates is to add it to the Hypervisors Discovery where it tells it what template to use for the discovered VM. The reason why i didn't add it to the Hypervisors Discovery Template is because i have VM's on my Hypervisors with different OS's.

                    Comment

                    • miramira007
                      Member
                      • Sep 2015
                      • 89

                      #11
                      Dear omarmdz,

                      when i red your post i was very excited. Then i followed your steps. But In my case it does not work. My cloned host get this status on template virt vmware guest: "not supported" with following infor "Unknown virtual machine uuid.".

                      have u got an idea, why i get this error? Or where can i add the uuid? The macros are right.

                      cu,mira

                      Comment

                      • duy
                        Junior Member
                        • Jan 2016
                        • 5

                        #12
                        Solution

                        Hello friends,

                        I discovered a way to monitor the zimbra agent of vms found by discover vmware.

                        Follow the steps below:

                        - Set as recommended discover
                        - Install the agents on computers configured to listen on port 10051, but not start yet.

                        - In the main host VMware or Vcenter in zabbix, add all of the VMs IP and DNS and port.

                        E.x: 172.16.1.6 vm01.domain.com 10051


                        - Associate the Template "template app zabbix agent" in the template "template Virt VMware Guest"


                        For the zabbix find the agent, do the following.


                        1 - Set the default agent for the IP of the VM you want to monitor "is just click the vmware host and there is where you configure the agent and choose the standard agent"

                        2 - Delete the VM you want to monitor the list automatically discovery

                        3 - Wait for it be recorded again.

                        4 - Make sure the agent of IP is that it filled the ip you "when you're offline give to check the ip passing the mouse over"

                        5 - If the IP is correct, just start the agent that VM and leave as automatic


                        To set up another Vms, follow step 1-5 for each VM that you want to set.


                        Good luck to all.

                        Comment

                        • LemurTech
                          Junior Member
                          • Mar 2018
                          • 8

                          #13
                          Here's how I achieved this in a small local-network vSphere implementation with 2 ESXi hosts. This is long so I will have to create several posts. Pulling now from the internal how-to doc I created for Future Me. (Very likely the images won't come through when I post this, but you can easily infer their contents by the text):

                          Part 1

                          Zabbix 4.0 includes 3 templates that can be used to discover and monitor a VMware infrastructure. The templates are:
                          • Template VM VMware. This template is to be linked to a "dummy" host. Macros are configured to point to the vCenter Server web SDK service. Discovery rules then create host items for ESXi hypervisors and guest VMs.
                          • Template VM VMware Guest. This template is not intended to be linked to a Zabbix host object by you, the administrator. Instead, it is auto-linked to discovered guest VMs via a Host prototype in Template VM VMware.
                          • Template VM VMware Hypervisor. This template is not to be linked to a Zabbix host object by you, the administrator. Instead, it is linked to discovered ESXi hypervisors through a Host prototype in Template VM VMware.
                          The official configuration method will create host objects for all your hypervisors auto-assign them to Host Groups corresponding to clusters and data centers defined in your vSphere infrastructure. Host objects for guest VMs will also be created and assigned to Host Groups corresponding to the hypervisor where they currently reside.

                          This is all very well when you have a large, dynamic infrastructure and require that monitored servers auto-populate into your Zabbix installation. However, a limitation of Zabbix is that when host objects are created from discovery rules, you cannot then link additional templates to the host object--at least not directly. For example, for a Windows VM, you may want to install the Zabbix Agent and assign templates that monitor SQL server, Event Logs, or some other aspect of the operating system for which items are not included in the Template VM VMware Guest.

                          You might thing that you could link your additional templates to the Template VM VMware Guest. Then auto-discovered hosts would inherit these additional templates. But there are two problems with this:
                          1. This would only be practical when you have guest VM that are all of one "flavor"--for example, all Windows VMs, all Linux VMs, etc. For most of us, this will not be the case.
                          2. More importantly, you will find that the Agent interfaces option of auto-discovered Zabbix hosts will be hard-coded at 127.0.0.1. So all of your templates that rely on being pointed at the Zabbix Agent's IP address will not work.
                          My workaround is to:
                          1. Disable the hypervisor and guest VM discovery rules in Template VM VMware.
                          2. Manually create Zabbix host objects for hypervisors and link Template VM VMware Hypervisor to them.
                          3. Create a custom clone of the Template VM VMware Guest, which I name Template VM VMware Guest Standalone.
                          4. Manually create (or use a Zabbix network discovery rule) host objects for guest VMs, and link Template VM VMware Guest Standalone to those hosts.
                          5. Link other templates to host objects (hypervisors and/or guest VMs) as needed.
                          Requirements
                          1. Administrative access to your Active Directory Users and Computers, so that you can create a read-only account used by Zabbix to discover and monitor vSphere systems and services.
                          2. Administrative access to your vCenter Server web interface, so that you can configure the above AD account for read-only access.
                          3. Access to and basic understanding of how to use the vSphere PowerCLI. You will have to run several commands to retrieve UUIDs for VMware hosts and VMs.
                          4. Administrative access to Zabbix, natch.

                          Comment

                          • LemurTech
                            Junior Member
                            • Mar 2018
                            • 8

                            #14
                            Part 2

                            Basic configuration

                            In Zabbix, open Template VM VMware, navigate to the Discovery rules, and disable the rules to Discover VMware hypervisors and Discover VMware VMs:

                            [IMG]file:///C:/Users/matthew.arciniega/AppData/Local/Temp/enhtmlclip/Image.png[/IMG][image]

                            (Remember, if you intend to auto-create Zabbix host objects for all your guest VMs, you should NOT take the above step.)

                            Next, create the following Zabbix global Macros:
                            1. {$URL} Enter the URL for your vCenter Server SDK service. This will be: https://[vcenter host name or IP]/sdk
                            2. {$USERNAME} Enter the username of an account with read access to the vCenter inventory. As we use SSO authenticating against our local Active Directory, I created a new vSphereReader account in AD Users and Computers, and then assigned it read-only permissions through the vCenter web interface. Note that I use a UPN suffix to indicate the domain: @vortx.local. If you haven't yet created this account and configured it for read-only access in vCenter, now is the time to do that.
                            3. {$PASSWORD} This is the password used for the account in item 2.

                            Now create a "dummy" host with a name like "vSphere System" (item 1), assign it to a host group (item 2), and leave the interface pointed at 127.0.0.1 (item 3):

                            [IMG]file:///C:/Users/matthew.arciniega/AppData/Local/Temp/enhtmlclip/Image(2).png[/IMG]

                            Link the Template VM VMware:

                            [IMG]file:///C:/Users/matthew.arciniega/AppData/Local/Temp/enhtmlclip/Image(3).png[/IMG][image]

                            Now save ("Add") the new host.

                            Open the new host, navigate to the Discovery rules, and run the following rules to discover VMware datacenters and VMware clusters.

                            If everything is working, then within some seconds the new host should be populated with a bunch of new items originating from these discovery rules. If not, then you have some troubleshooting to do.

                            Comment

                            • LemurTech
                              Junior Member
                              • Mar 2018
                              • 8

                              #15
                              Part 3

                              Add ESXi Hosts

                              Create a new host object, navigate to Templates, and immediately link the Template VM VMware Hypervisor. You may also want to link Template ICMP Ping, as shown here:

                              [IMG]file:///C:/Users/matthew.arciniega/AppData/Local/Temp/enhtmlclip/Image(5).png[/IMG][image]

                              Now return to the main Host configuration tab, and fill in the following items:

                              [IMG]file:///C:/Users/matthew.arciniega/AppData/Local/Temp/enhtmlclip/Image(6).png[/IMG][image]
                              1. Host name. This is the UUID of the ESXi host in vCenter. The Template VM VMware Hypervisor will use this field (i.e., via the HOST.HOST macro) to populate various monitoring items. The PowerCLI command to retrieve a list of ESXi hosts and their UUIDs is:
                                Get-VMHost | Select Name,@{n="HostUUID";e={$_.ExtensionData.hardware.s ysteminfo.uuid}}
                              2. Visible name. The visible name of the host object. This can be whatever you need it to be.
                              3. Host group. A host group is required.
                              4. Agent interfaces. The management IP of the ESXi host. This is required only if you use additional templates like Template ICMP Ping, which require the configuration of a proper interface address.

                              Add Guest VMs: Prepare Template (only on initial configuration)

                              You need to do a full clone of Template VM VMware Guest to a new template: Template VM VMware Guest Standalone.

                              Now add a new {$VM_UUID} Macro, which you can leave blank for now:

                              [IMG]file:///C:/Users/matthew.arciniega/AppData/Local/Temp/enhtmlclip/Image(7).png[/IMG][image]

                              Now the tedious part! You must edit every discovery rule, item prototype, and item in this template, replacing the {HOST.HOST} macro with {$VM_UUID}. Why are you doing this? Because out-of-the-box, these VMware templates rely on the host name of an auto-discovered guest VM being configured to the UUID recorded in vCenter. We need to recover the use of that field by other Zabbix templates, because the Zabbix Agent uses {HOST.HOST} in the Zabbix Server object to confirm it is populating the correct items. So we tell our Template VM VMware Guest Standalone to use a different macro, which we can now manually populate on host objects that inherit that template.

                              Of course, each time we link this template to a new host object, we must plug in (i.e., customize) the {$VM_UUID} macro value by retrieving it from vCenter using the PowerCLI. Here's the bitchin' one-liner that gets you a list of guest VMs and their InstanceUUID, which is what you need in this case:

                              Get-VM | Select Name,@{n="InstanceUUID";e={(Get-View $_.Id).config.InstanceUUID}} | Sort Name

                              If you only need one UUID, you can use this command:

                              Get-VM [guest VM name] | %{(Get-View $_.Id).config.InstanceUUID}

                              Add Guest VMs: For Real

                              Adding a new Zabbix host for a guest VM is now easy:
                              1. Manually create the host (or Pro Tip: have it created for you using a network discovery rule).
                              2. Link the Template VM VMware Guest Standalone. You can link any other agent-based templates you may need at this time. (Don't save just yet!)
                              3. Customize the {$VM_UUID} macro inherited from the above template. Use the PowerCLI command (above) to pull the UUID from vCenter.
                              4. Add/Save the host. Boom chikka-BOOM! You are basically done. You may manually run discovery rules in the host object if you are impatient to see your items list populate.
                              That's it! I'll answer any questions about the implementation specifically, but not about troubleshooting your vSphere system, working with PowerCLI, what a Zabbix macro is, or anything that you can RTFM elsewhere.

                              Comment

                            Working...