/build/static/layout/Breadcrumb_cap_w.png

How to exclude machines from a smart label when they exist in another specified manual label?

I have machines named by building location. Some machines are not to get Java updates so I created a nojava label as an offshoot for each building. I deploy regular patches to the regular label and I deploy nojava patch listings to the nojava machines. The problem is some machines are showing up in both the regular label and the nojava label.

I have a manual label named "M_TESTIE" that contains 55 nojava computers I added to it. Many of those computers could have names that contain "XYZ-R" or "ABC-R". I want those 55 machines excluded from another label that their name criteria would put them in.

If a machine name contains "XYZ-R" or "ABC-R", but is in the "M_TESTIE" label, then I don't want it to be in the nojava smart label that the script below builds.

Is the code below correct in order to exclude machines that are in the M_TESTIE label?


M_XYZ\ABC-R smart label script is below. This is the label that should exclude machines that are in the M_TESTIE label. But in my case, the machines are still showing up in the label the script below creates.:

select MACHINE.*, C.CLIENT_CONNECTED, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,
                       UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_SECONDS
                  from ORG1.MACHINE
                  LEFT JOIN KBSYS.KUID_ORGANIZATION O ON O.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION C ON C.KUID = MACHINE.KUID AND O.ORGANIZATION_ID = 1
                 where ((((  MACHINE.NAME like '%XYZ-R%') OR MACHINE.NAME like '%ABC-R%') AND (1 not in (select 1 from ORG1.LABEL, ORG1.MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID and MACHINE_LABEL_JT.LABEL_ID = LABEL.ID and LABEL.TYPE != 'hidden' and LABEL.NAME like '%M_TESTIE%')) ))

2 Comments   [ + ] Show comments
  • Did you create the smart label using the wizard and change it later? The syntax looks the same as one that I have for a similar purpose. Here's mine for computers with the "Admissions/FinAid" label but don't have the "No Patching" label:

    select *, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,
    UNIX_TIMESTAMP(MACHINE.LAST_SYNC) as LAST_SYNC_SECONDS
    from ORG1.MACHINE
    LEFT JOIN KBSYS.KUID_ORGANIZATION ON KUID_ORGANIZATION.KUID=MACHINE.KUID LEFT JOIN KBSYS.SMMP_CONNECTION ON SMMP_CONNECTION.KUID = MACHINE.KUID AND KUID_ORGANIZATION.ORGANIZATION_ID = 1
    where ((( (1 not in (select 1 from ORG1.LABEL, ORG1.MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID and MACHINE_LABEL_JT.LABEL_ID = LABEL.ID and LABEL.TYPE != 'hidden' and LABEL.NAME like '%No Patching%')) ) AND (1 in (select 1 from ORG1.LABEL, ORG1.MACHINE_LABEL_JT where MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID and MACHINE_LABEL_JT.LABEL_ID = LABEL.ID and LABEL.TYPE != 'hidden' and LABEL.NAME like '%Admissions/FinAid%')) )) - chucksteel 10 years ago
  • Sort of. We originally created labels for each building, then a couple years later (via the GUI), created dups of the same labels, and added the criteria "does not contain" >> "M_TESTIE". I manually added machines to the M_TESTIE label hoping that would keep those machines out of the "M_Building XX nojava" label. My sample code in my OP is from one of my nojava labels.
    The problem is machines that are in the M_TESTIE label are showing up in both the regular and nojava labels. - murbot 10 years ago
    • You might want to try making a new smart label with the wizard and see if that works. - chucksteel 10 years ago

Answers (0)

Be the first to answer this question

 
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