03 Jan 2025 11:59 AM - last edited on 07 Jan 2025 12:54 PM by MaciejNeumann
I have around 100 hosts in my management zone. But they are for different instance, some for QA1, QA2, etc..
I added a tag, to each of the hosts. However, I probably missed 2 of the hosts. Now I am unable to find the host where I missed this custom tag.
How can I query to find which host is not having my instance tag.
Filter I can search using this tag. but how to find host which do not have this tag
Solved! Go to Solution.
03 Jan 2025 01:10 PM - edited 03 Jan 2025 01:13 PM
First and foremost, this is why Automatic Tags are preferred.
If DQL is a curve ball, One of the easy ways to do this would be to create an opposing tag. So you made a tag that says "environment" you can create an Auto Tag rule that tags hosts as "Missed" if they dont have a Host tag of Environment.
In terms of your host, is the environment in your naming convention? Do you have a CMDB? Ideally you should leverage an auto tag rule that read the host name of the metadata then provides the applicable value as an environment tag.
If you want to go the DQL route you can do the following:
fetch dt.entity.host
| fieldsAdd tags
| filter NOT contains(tags, "[Environment]")
03 Jan 2025 01:16 PM - edited 03 Jan 2025 01:24 PM
Hi,
You have more than one way to do it. I will tell you without DQL because it will work in Managed as well:
builtin:host.cpu.usage:filter(and(or(in("dt.entity.host",entitySelector("type(host),not(tag(~"XXXXX~"))"))))):splitBy("dt.entity.host"):sort(value(auto,descending))
It is just pick it up a metric always available in every host, splitting it by host and filtering negating tag value. Replace "XXXXX" for your tag.
If you change to table view, it will be better maybe:
And if they are manual tags, you can do it visually from UI, selecting your tag, and untagged:
Best regards