/build/static/layout/Breadcrumb_cap_w.png

Smart Label for machines in ip range and exclusions

I have a query where I want to add a smart label for all machines in a given ip range, but exclude those that start with TC.  
It works successfully on the IP range but it still includes those with names that start with TC
here is an excerpt from my query:
OR (1 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP like '%172.16.12.%' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP like '%172.16.12.%' and MACHINE.NAME not like '%TC%' ))  )

0 Comments   [ + ] Show comments

Answers (2)

Posted by: chucksteel 6 years ago
Red Belt
1
Your query is much more complicated than it needs to be. This should work:
SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE  WHERE MACHINE.IP like "172.16.12.%" and MACHINE.NAME not like "TC%"


Posted by: DaveMT 6 years ago
4th Degree Black Belt
0

Try this for your SQL Code.

SELECT MACHINE.NAME AS SYSTEM_NAME,SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROMMACHINE  WHERE ((MACHINE.IP like '172.16.12.%') AND ((MACHINE.NAME notlike 'TC%'))) 

You could also open yourInventory>Devices section, choose the Smart Label tab to create a smartlabel from manual Advanced searches.  Choose your first line to filteryour IP to IP Address Begins with 172.16.12. then click Add Group and in that newgroup, choose a filter for System Name Does NOT begin with TC.  Save thatlabel and it should work as well.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ