Forum Discussion

Dave_Lee's avatar
Dave_Lee
Icon for Neophyte rankNeophyte
8 months ago
Solved

Excluding VMware VMs from instance discovery

When we add a vCenter into Logic Monitor, the VMs in it’s managed clusters are discovered as instances of underneath datasources applied to the vCenter, like:

VMware VM Status
VMware VM Snapshots
VMware VM Performance

Sometimes there are VMs that we have no interest in monitoring, so we don’t want them to be picked up by these datasources.  At the moment, we’re manually adding an Instance Group, putting those VMs in the group and then disabling alerts, which is quite a manual process.

Ideally we’d like LM to not discover VMs that have had a specific tag/value applied to them in vCenter.  I think we should be able to do this by modifying the Groovy script used for Active Discovery on these data sources, but I’m not sure how to go about that.

Has anyone managed to do something similar?

Dave

  • Thanks @tswisdom - I think Active Discovery Filters is just what I’m looking for here.  Looking through the Active Discovery script for the VMware_vCenter_VMStatus datasource, it look as though that should be returning tags in it’s output, but doesn’t seem to be doing so.  I’ll have to dig a little deeper into that, then look at the Active Discovery Filters.

    thanks

    Dave

16 Replies

  • Is this actually possible to do - adding `<dsname>.disable` as a property ?? This would be so handy.

  • ok so i can do this but we still have to modify the Applies to

  • We’ve solved this by a few easy steps (if I understand your goal):

    1. add tags to VMs within vSphere
    2. add the property esx.tags=true to the vSphere resource
    3. cloned the “VMware_vSphere_VMsnapshots” module and excluded the original from the target resource
    4. in the cloned module assigned it only to the target resource, and added a filter under the Active Discovery script:
      1. Attribute=auto.logicmonitor
      2. Operation=Equal
      3. Value={tag name}
  • We’ve solved this by a few easy steps (if I understand your goal):

    1. add tags to VMs within vSphere
    2. add the property esx.tags=true to the vSphere resource
    3. cloned the “VMware_vSphere_VMsnapshots” module and excluded the original from the target resource
    4. in the cloned module assigned it only to the target resource, and added a filter under the Active Discovery script:
      1. Attribute=auto.logicmonitor
      2. Operation=Equal
      3. Value={tag name}

    While this works, this is in no way supportable on a larger scale.

  • Hi @Barb / @Stuart Weenig, is there a way i can filter out the VMs based on creation date?

    from below blogs i see that VMware has a property on config file named “createDate”, but getting an error while i try same:
    https://asvignesh.in/how-to-get-a-virtual-machine-created-time/
    https://vdc-repo.vmware.com/vmwb-repository/dcr-public/e1580753-930f-4c00-9105-77dd2e8913f8/98ce8e90-a51b-4e41-8dac-3e8fd5409f2b/vim.vm.ConfigSpec.html

    I tried adding below line to Active discovery script in order to filter out the VMs based on the attribute’s value:
    'auto.config.create_Date'     : vmConfig?.createDate,

    Datasource: VMware_vSphere_VirtualMachinePerformance


    but getting error: The script returned non-zero exit code - 3