Session Relevance for Subnets

Hey folks.

Trying to get a report of all machines that are not in a specific subnet (and some other goodies). I took out most of the stuff that didn’t matter and left what appears to be my pain point.

How can I check if a subnet/ip address is inside of a given set of subnets? Here is what i have so far but everytime it comes back as 0 results. I removed the truple at end as it wouldn’t have worked in other enivornments, fill in with the tupple of your choosing.

Any ideas?

( names of it , ( values of property results
   whose  ( name of property of it = "Subnet Address"  ) 
   of it  ))
 of computers 
    whose
// This part is the part I can't figure out 
( size of 
        ( intersection of 
  (
   set of 
    (
      "192.168.2.0" ; "192.168.1.0"
    )
  )  ;  (
   set of 
   ( (
      value of property result 
       whose   
( name of property of it = "Subnet Address"  ) of it
      )
     as string 
   )  ) ) is not 0 )
// From here on works...
    of results 
    of bes properties 
    whose
    (
        id of it = 
        (
            XXX , YYY , Z 
        )
    )

When I run this without the middle section, it shows the list of every system and the subnet. So how can you (using session relevance) get an exclusion or inclusion set?

thanks you big fix heros!

-c

1 Like

I’m a little fuzzy on the parameters…I don’t see where

of results 
    of bes properties 
    whose
    (
        id of it = 
        (
            XXX , YYY , Z 
        )
    )

is being used anywhere else in the query, I don’t see any “it” referring to this…

Can you assume a computer has only one subnet address? If a computer has two subnet addresses and one of them is contained by your list of subnets, should that computer be included or excluded?

I don’t have a console in front of me, so please take this with a grain of salt. I think the following would give you the computer name and subnets that are not contained by your list (a multihomed computer with at least one subnet outside of this list would be included):

(name of computer of it, value of it) of results ( bes computers , bes properties whose ( name of property of it = "Subnet Address" )) whose (value of it as string is not contained by set of ("192.168.2.0" ; "192.168.1.0"))

I think that this should get the list of subnets on all computers which do not have at least one interface on your subnet list:

(name of it, values of results (it, bes properties whose ( name of property of it = "Subnet Address" ) )) of bes computers whose (not exists results ( it, bes properties whose ( name of property of it = "Subnet Address" )) whose (value of it as string is contained by set of ("192.168.2.0" ; "192.168.1.0")))

Thanks Jason,

Been a while since I was working in Session Relevance, so I may be a bit rusty on what I was doing with the bestsellers properties. I think I was initially also using it to filter somehow. It probably wasn’t important.

I’ll give your try a shot in the morning. The end result would be to have a toggle between including or excluding multi-subnet, but that would be done on the web reports side.

I’ll let you know how it goes!