Ad Widget

Collapse

How to get information about "Resource Pool" for discovered VM in VMware environment?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Everlasting
    Junior Member
    • Aug 2020
    • 2

    #1

    How to get information about "Resource Pool" for discovered VM in VMware environment?

    Hi everyone!

    I would like to group all my discovered VMware VM's not only by Cluster/Hypervisor/Datacenter names (Zabbix LLD macros "{#CLUSTER.NAME} (vm)" / "{#HV.NAME}" / "{#DATACENTER.NAME} (vm)"), but also by using VMware "Resource Pool" names.
    What I see is what build-in discovery Item ("vmware.vm.discovery[{$URL}]") is returning only this list of Macros:
    Code:
    {"{#VM.UUID}":"12345678-3hh6-c882-f113-5eae51234567",
    "{#VM.ID}":"vm-1337",
    "{#VM.NAME}":"MyVMname",
    "{#HV.NAME}":"ESXi-host01",
    "{#DATACENTER.NAME}":"MyDatacenter",
    "{#CLUSTER.NAME}":"MyCluster"}
    Is there are way how to get "{#RESOURCEPOOL.NAME}" from LLD to use it in "Host Prototype" / "Groups" ?

    Or I should put some effort and white my own discovery script and use it as a "External Check" data source in "Template VM VMware" / "Discover VMware VMs"?
    I am using Zabbix 4.4.10.

    Thanks in advance.
  • Everlasting
    Junior Member
    • Aug 2020
    • 2

    #2
    Bump.

    So far I investigated what I can get list of all Resource Pools from vCenter by using it's REST API:
    Code:
    curl -i -k -H 'Accept:application/json' -u '[email protected]:MYPASSW0RD' -X POST https://vcsa.local.lv/rest/com/vmware/cis/session
    
    HTTP/1.1 200 OK
    Date: Mon, 24 Aug 2020 11:24:19 GMT
    Set-Cookie: vmware-api-session-id=f8888416677811b77777f980c751337f;Path=/rest;Secure;HttpOnly
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    Content-Type: application/json
    Transfer-Encoding: chunked
    
    ===
    
    curl -i -k -H 'Accept:application/json' -H 'vmware-api-session-id: f8888416677811b77777f980c751337f' -X GET https://vcsa.local.lv/rest/vcenter/resource-pool
    
    {"value":[{"name":"Resources","resource_pool":"resgroup-10786"},
    {"name":"Resources","resource_pool":"resgroup-11872"},
    {"name":"Resources","resource_pool":"resgroup-6653"},
    {"name":"My_System","resource_pool":"resgroup-6111"},
    {"name":"My_TestDev","resource_pool":"resgroup-6112"},
    {"name":"My_Production","resource_pool":"resgroup-6113"}]}
    So, I guess what I can create new "Discovery Rule" in template "Template VM VMware" and use it to automatically create "Host Groups" for all VMware "Resource Pools" what vCenter reporting.

    Next question - how can I automatically put discovered Host objects (VM's) into this Host Groups (Resource Pools)? Is there any way how to bind them together?
    Last edited by Everlasting; 25-08-2020, 13:41.

    Comment


    • lptarik
      lptarik commented
      Editing a comment
      Did you able to solve this issue?
Working...