Smart label - Machines not in a patch lable
I'm trying to create a smart label that will exclude all machines that has assigned a label used by a patch schedule.
I go about this using "Label Name", and was wondering about best practices. Can you add more labels on one filter, or do you require one line for each device lable?
Now I have about 20 lables used in different Patch Schedules. And using the following smart label formula:
Label Names != "label name" OR
Label Names != "label name2" OR
and so on.
Is there a better way to do this?
Currently this is not working as expected, showing all machines.
Answer Chosen by the Author
Here is the method I use:
I have a smart label that will apply to any machines that don't have a label that contains the word Patching. Here is the SQL code:
select *, UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(LAST_SYNC) as LAST_SYNC_TIME,
UNIX_TIMESTAMP(MACHINE.LAST_SYNC) as LAST_SYNC_SECONDS
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 '%Patching%')) ))
All of our other patching schedules are in the format of "Lab Patching", "Test Patching", etc. This way I don't have to go back and change my default patching label/schedule when new schedules are added.
Answered 05/17/2017 by: chucksteel
Please log in to comment
log in to commentPlease