Location by IP Range Relevance

(imported topic written by TallTomD)

I’m using the “Location Property Wizard” to create an Action to assign information to machines based on IP Address ranges.

What I’d like to change is this: IF data already exists in the “Location By IP Range” Property, then I’d like the Action to do nothing. Just leave the data that is already there. As it is currently written it evaluates, and if the IP Range is not specified in the relevance clause then it changes the Property data to “N/A”. I’d prefer that if the IP Range is not specified in the relevance clause, and the Property already contains data, then it should just leave it as is and do not overwrite the current data with “N/A”.

Attached is the current relevance from the Action.

Thanks for any help or suggestions!

(imported comment written by jgolembi)

Not sure I understand the entire use case, but I have used this in the past.

value of setting “Location By Subnet” of client != “N\A”

So you could easily use

value of setting “Location By IP Range” of client = “N\A”

Then you could do something in the action of the fixlet.

(imported comment written by TallTomD)

Thanks for the reply, but I’m not sure where in the relevance to insert your logic.

If I add your logic just before the "else “N/A” portion of my relevance (close to the end), then it could still evaluate to N/A if the IP address of the client is not specified in the relevance.

What I want is to assign the property data based on IP address, but if the IP of the Client is not specified in my relevance, AND the client already has something defined in the property, then it should leave it alone. It should ONLY make it an “N/A” if the IP is not defined in my relevance AND there is no data already existing in that property.

Does that explain it more clearly?

(imported comment written by jgolembi)

TallTomD,

That does explain it much more clearly. Hopefully this is short and sweet.

I would just add a line to the action that would test to make sure that “N/A” would not be marked.

//I used my subnets for ease of use.... This should only set the location if it does not equal "N/A" 

continue 

if 
{

if (exists ((addresses whose (it as string != 
"0.0.0.0") of ip interfaces whose (loopback of it = 

false) of network) as string as version) whose (it >= 
"192.168.1.1" as version and it <= 
"192.168.1.255" as version)) then 
"Panera" 

else 
"N/A" != 
"N/A"
}   setting 
"Location By IP Range"=
"{if (exists ((addresses whose (it as string != "0.0.0.0
") of ip interfaces whose (loopback of it = false) of network) as string as version) whose (it >= "192.168.1.1
" as version and it <= "192.168.1.255
" as version)) then "Panera
" else "N/A
"}" on 
"Wed, 10 Oct 2012 20:05:03 +0000" 

for client

Does that help?

-John G

(imported comment written by TallTomD)

I don’t think you’re understanding what I’m looking for. Let me try to be more clear.

IF there is ANY data in the Property then do nothing.

IF the IP is included in my relevance AND there is NOT data in the Property, then update the property.

IF the IP is NOT included in my relevance AND there is NOT data in the Property, then put N/A.

Using your logic appears that it would only make the update if the data contained in the property is not = “N/A”. That means the update could happen if the data contained in the property = “Location 1”. The Action would then change the data from “Location 1” to “N/A”, which is exactly what I’m trying to avoid.

Is there a way to accomplish the relevance of NOT updating when ANY data is already present in the Property, but updating when there is NOT data in the Property?

Thanks for your help!

Tom

(imported comment written by jgolembi)

TallTomD,

Base on your description.

I would use this as an example of your action:

setting "Location By IP Range"="{if (exists ((addresses whose (it as string != "0.0.0.0") of ip interfaces whose (loopback of it = false) of network) as string as version) whose (it >= "192.168.1.1" as version and it <= "192.168.1.255" as version)) then "Panera" else "N/A"}" on "Wed, 10 Oct 2012 20:05:03 +0000" for client

With this as the applicability:

(not exists setting "Location By IP Range" of client) OR (value of setting "Location By IP Range" of client = "N\A")

Hope this is what you need!

-John G

(imported comment written by TallTomD)

First let me say that I very much appreciate your help on this!

Second: I’m not quite sure I follow your suggestion. I normally use the Location Proprty Wizard to deploy these Actions which update the Property on the Client machines. At the last step of that Wizard I can define the Action with things like the Applicability tab (which is where I pulled the logic I posted earlier). I can also define the Success Criteria and the Action Script using the tabs which are included in the Action.

And then also at the last step of that same Wizard I can edit the settings if the Property being defined. I can edit Relevance inside that Property.

I’m not sure where you’re suggesting I incorporate your idea to adjust the relevance / result of the wizard.

Please advise,

Tom

(imported comment written by TallTomD)

This is very frustrating. Every time I need to add new IP ranges and I re-run the wizard the darned thing over-writes machines that already have the property defined correctly!!! The fact that it over-writes those machines then causes a ripple effect in the entire environment because my site subscriptions and groups are based on the Location by IP Range property.

There has got to be a simple way to tell the system: If the property already contains data then just leave it alone. DO NOT EVER OVER-WRITE EXISTING DATA IN THIS PROPERTY.

Can you give me more detail on how / where to incorporate your suggestions?

Thanks,

Tom

(imported comment written by SystemAdmin)

If you change the applicability relevance of the Location Property Wizard to include:

(not exists setting “Location By IP Range” of client) OR (value of setting “Location By IP Range” of client = “N\A”)

Then it will not run if the client already has a setting, unless the setting for location by IP range is “N\A”

(imported comment written by TallTomD)

Thanks for the reply. So this is what my Applicability Relevance would look like?

((not exists setting “Location By IP Range” of client) OR ((value of setting “Location By IP Range” of client = “N/A”) AND ((not exists value of it) OR (value of it does not equal ((if (exists ((addresses whose (it as string != “0.0.0.0”) of ip interfaces whose (loopback of it = false) of network) as string as version) whose (it >= “10.0.0.1” as version and it <= “10.0.0.15” as version)) then “Site1” else if (exists ((addresses whose (it as string != “0.0.0.0”) of ip interfaces whose (loopback of it = false) of network) as string as version) whose (it >= “10.0.0.16” as version and it <= “10.0.0.30” as version)) then “Site2” else “N/A”) as string)))) of setting “Location By IP Range” of client)

Thanks,

Tom