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
Barb Ramirez
·2 years agoThis might help
https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creation-Date-Script/td-p/2815700
LM User
·2 years agoI would think that would work if createDate is an attribute of the vmConfig object. I’d have to dig into the code specifics to do that, but I usually charge for that:
Stuart Weenig, Ninja Jedi | Community (logicmonitor.com)
Manoj_Hegde
·2 years agoHi @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
Joe Williams
·2 years agoWe’ve solved this by a few easy steps (if I understand your goal):
While this works, this is in no way supportable on a larger scale.
Jared Meidal
·2 years agoWe’ve solved this by a few easy steps (if I understand your goal):
Barb Ramirez
·2 years agosubmitted
LM User
·2 years agoIs this actually possible to do - adding `<dsname>.disable` as a property ?? This would be so handy.
Not currently. That’s the feed request: make it implied on all datasources. Please submit it through your portal.
Barb Ramirez
·2 years agook so i can do this but we still have to modify the Applies to
Barb Ramirez
·2 years agoIs this actually possible to do - adding `<dsname>.disable` as a property ?? This would be so handy.
LM User
·2 years agoYou’re totally welcome to it. More than once, I’ve put in a feed that all DSs have implied logic for applies to and discovery filters.
Imagine you could exclude a DS from a device simply by adding `<dsname>.disable` as a property and not having to modify the AppliesTo. Imagine you could disable at a group level, then enable on a few devices in the group. When you combine implied logic in the appliesto/discovery filters, things could get really powerful.
Barb Ramirez
·2 years agoYessss i Love your work :) Totally a Fan! hehehehe i should have put a mention to you in it sorry for that. BTW i use your filtering theory across many datasources so thank you for that ❤
LM User
·2 years agoThis is how i handle that kind of filtering using a property.
Love to see my stuff in action.
Barb Ramirez
·2 years agoThis is how i handle that kind of filtering using a property.
Dave Lee
OP3 years agoI realised that I needed to put the customproperty esx.tags=true on the vCenter Server, for the Active Discovery script to return the tags on each VM. That’s working now.
I’m trying to understand how to best use the Active Discovery Filters. Ideally I want to exclude any instance that has the tag “exclude” in the “monitoring” category. This comes through in the properties as
I’ve setup the filter as follows:
Which excludes the instance that I’ve put the tag on, but also includes all other instances. It seems that, if the instance doesn’t have an “auto.monitoring” property, then it gets filtered out as well.
The following does work, but I think this will exclude an instance that has ANY value for auto.monitoring - so if a VM has other tags in the “monitoring” category then it will get filtered out.
Is there any way to set the Auto Discovery Filter so that it only returns items where “auto.monitoring” is not “exclude” but allows any that have to “auto.monitoring” property set at all?
Dave
Dave Lee
OP3 years agoThanks @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
tswisdom
·3 years agoGood afternoon @Dave Lee,
While our enhanced netscan script for adding VMWare resources allows you to leverage several filters to exclude VM’s and other components, the datasources for various VMWare resources do not currently include native filtering.
With that said, there are two approaches you could take to automate how instances are handled.
The first would be as you suggested, modifying the Active Discovery script to pull tags or other items you wish to key off of, then configuring Active Discovery Filters to exclude instances based off of the data.
Alternatively, you can configure your alert rules to only match, or exclude, particular instances for these modules, routing some but not others.