Combining 2 labels from 2 different groups into 1 smart label
New to KBox so I am looking for some help on an issue. I am trying to create a smart label that looks for an IP Scan Label as well as a Machine Label. Any idea how I can do this. if I try to create the smart label in IPScan it wont see the machine label I am looking for and vice versa when I go too machine tab.
0 Comments
[ + ] Show comments
Answers (11)
Please log in to answer
Posted by:
GillySpy
13 years ago
Posted by:
Echelon
13 years ago
Not exactly. What I am trying to do is run a script against a label for machines but i have to exclude a whole floor. easiest way to do that is to create a label for the IP range of the floor and exclude that label. problem is if i try to create a smart label for an IP range in "machine" it doesn't work. I get IP's in the list from all over the spectrum. I found if I create the same label in IPScan it works fine. So how does one go about creating this custom smart label? I have a smart label in "machine" called Workstations and I have a smart label in IPscan called 5th floor. all I am trying to do is create a smart label that goes like this: Label = Workstations AND Does not contain 5th Floor.
Posted by:
GillySpy
13 years ago
problem is if i try to create a smart label for an IP range in "machine" it doesn't work
Okay this is the root of the problem. Post the SQL for your attempt to create a machine label and we'll get that to work.
We'll end up with:
machine label "5thFloor"
machine label "workstations"
sql for new label will be:
select MACHINE.ID
from MACHINE JOIN MACHINE_LABEL_JT ML ON ML.MACHINE_ID=MACHINE.ID
JOIN LABEL L ON L.ID=ML.LABEL_ID and L.NAME='workstations'
LEFT JOIN (select MACHINE_ID FROM MACHINE_LABEL_JT ML JOIN LABEL L ON ML.LABEL_ID=L.ID and L.NAME='5thfloor') EXCLUDE ON EXCLUDE.MACHINE_ID=MACHINE.ID
WHERE
EXCLUDE.MACHINE_ID IS NULL
Remember we still need to establish the sql for your 5thfloor machine label
Posted by:
Echelon
13 years ago
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 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP > '172.24.65.0' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP > '172.24.65.0')) ) AND (1 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP < '172.24.73.255' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP < '172.24.73.255')) ))
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 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP > '172.24.65.0' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP > '172.24.65.0')) ) AND (1 in (select 1 from ORG1.MACHINE M2 where M2.ID = MACHINE.ID and M2.IP < '172.24.73.255' union select 1 from ORG1.MACHINE_NICS where MACHINE.ID = MACHINE_NICS.ID and MACHINE_NICS.IP < '172.24.73.255')) ))
Posted by:
GillySpy
13 years ago
This should do it.
Don't forget to change the evaluation order of the smart labels so that the one dependant upon other labels run last (ie higher eval number)
select MACHINE.ID
from ORG1.MACHINE
where
INET_ATON(MACHINE.IP ) > INET_ATON('172.24.65.0')
and INET_ATON(MACHINE.IP ) < INET_ATON('172.24.73.255')
Don't forget to change the evaluation order of the smart labels so that the one dependant upon other labels run last (ie higher eval number)
Posted by:
Echelon
13 years ago
Posted by:
GillySpy
13 years ago
Posted by:
Echelon
13 years ago
Posted by:
GillySpy
13 years ago
Posted by:
Echelon
13 years ago
Posted by:
Echelon
13 years ago
Just wanted to update everyone what the resolution was. It turns out that the best way to create a smarl label for an IP range using computer inventory is to use REGEX in your smart label. here is a link to a tool to easly create REGEX code.
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55572
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55572
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.