Help Creating Advanced Function

If I wanted to compare the value of one OID against the 3rd octet of an IP address to see if they match would this be possible? We set our IP scheme to match another value in the radio and I’d like a probe that could alert me to any that are setup incorrectly.

Yes it should be possible I will help you work on it, it may take a few posts. (I did it this way but you might reverse the whole logic and use string_find, that way you can just check that your string is in the IP address but there are ways it can be wrong)

The trouble is the ip address is variable length. So you will need multiple Function probe combinations to dig up the 3rd octet. Therefore I don’t think this is what you were hoping for…

The function string_substring returns substring of first parameter. Second parameter position, third - length

Say your IP Address range is 192.168.x.x, for the first 0-9 networks you need this to get the third octet.
string_substring(device_property(“FirstAddress”),8,1) "Return 1 digit starting at the 9th position.

For the next 10-99 networks you need this to get the third octet.
string_substring(device_property(“FirstAddress”),8,2) "Return 2 digits starting at the 9th position.

And finally for the networks 100-255 you need this to get the third octet.
string_substring(device_property(“FirstAddress”),8,3) "Return 3 digits starting at the 9th position.

We can use string compare to find out if they are the same… but you will need 3 functions and 3 probes.
string_compare(x,x) Returns 0 if equal, ok deal with it.

function for 3-digit 3rd octet - named “testRadio3”
if (string_compare(oid_with_your_manual_setting, string_substring(device_property(“FirstAddress”),8,3))<>0, “failed test”, “passed”)

Probe for 3-digit 3rd octet - on the error line…
if(testradio3()=“passed”,“”,“Fix me”)

I might have some of the logic screwed up in the function but I hope you can see what is going on and how you would get this to work…