New Smart label ignoring existing labels despite being after them in the "Order" list
K1000 question: I built a smart label for "Standard issue" equipment. This label is only to be applied to systems that do not belong to the IT, SERVER, THIN or ODDBALL smart labels. The IT and Oddball labels are manually appiled, SERVER and THIN labels are smart. I have the new "Standard Issue" label setup in the order label setup to be the last label applied (highest number) but it appears to be ignoring the manual labels.
Is there a way to ensure that this smart label also pays attention to manual labels when it's applied? I don't see an option to include or order non-smart labels.
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 '%SERVER%')) ) OR (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 '%IT%')) ) OR (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 '%Oddball%')) OR (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 '%THIN%')) )))
Answers (1)
Did these machines inventory after you created this label?
Try removing the "%" in your query. Instead of '%Server%' just use 'Server', 'IT', 'OddBall', and 'Thin'. It could be conflicting with other label names.
Comments:
-
Some additional information: When creating the label, testing works as expected. It's during the application of the label as a machine inventories that the problem occurs. I made the suggested changes, it has not prevented machines in the server, IT or oddball labels from picking up the "standard equipment" label during their next inventory. - Asevera 12 years ago
-
I would try replacing the ORs with ANDs and see what that does, or try this (which is what I use for one of my smart labels that does the same thing you're currently trying to do) - the main thing is being aware if the "it" string (or any of the others) is going to be present in any of your other labels (present or planned).
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 rlike 'server|it|oddball|thin')) ))
If you'd like to see more examples, check this out:
http://www.itninja.com/blog/view/k1000-labels-effective-organization-process-flow-using-manual-smart-ldap-labels-and-label-groups
Hope that helps!
John - jverbosk 12 years ago-
Worked flawlessly, thanks! - Asevera 12 years ago