Bas Grolleman’s Blog

Place where I put my written thoughts, though I usually just make video’s these days

I found a few solutions on the net, but people just attach the last 2 digits and I would like to avoid issues like this where 10.0.1.11 and 10.0.11.1 would both produce server-id 111.

So to fix that, I seperate the IP and multiply the 3rd digit by a 1000.

$serverid = inline_template(‘<%= scope.lookupvar(\’::ipaddress\’).split(\’.\’)[2].to_i * 1000 + scope.lookupvar(\’::ipaddress\’).split(\’.\’)[3].to_i %>’)