[Fusioninventory-devel] Adding criteria ing entities computer rules for fusion inventory.

J. Fernando Lagrange fernando+fusioninventory at demo-tic.org
Sun Mar 2 10:46:15 UTC 2014


Hello,

Even if IP regexp can be found in many situations (see below), getting accurate regexp can be a difficult, if not impossible, goal to achieve.

I also believe that having opportunity to filter results by network address would be of great benefits for FusionInventory, though its implementation can be tricky.
Stéphane: maybe can you accelerate implementation sponsoring a GLPI developer to have work done ?

Le 28/02/2014 19:10, Lafarguette Stéphane a écrit :
> Le 28/02/2014 13:44, Guillaume Rousse a écrit :
>> Le 28/02/2014 12:27, David DURIEUX a écrit :
>>> Another solution is to have criteria:
>>> * IP regex match /^172.16.(84|85)./
>> Remember than '.' match anything...
>>
>> You probably want:
>> /^172\.16\.(84|85)\./
>> or
>> /^172\.16\.8(4|5)\./
>> or
>> /^172\.16\.8[45]\./
> 
> For understanding my problem for entities :
>
> First entity        network/mask    '172.21.144.192/255.255.255.224'
> Second entity   network/mask    '172.21.144.224/255.255.255.240'
> […]
Using <http://www.aelius.com/njh/subnet_sheet.html>, it seems that:
First entity corresponds to network 172.21.144.192/27 and contains 34 addresses (for 32 machines): from 172.21.144.192 to 172.21.144.223

Second entity corresponds to network 172.21.144.224/28 and contains 16 addresses (for 14 machines): from 172.21.144.224 to 172.21.144.239


Using these 4 boundaries IP values on <http://www.analyticsmarket.com/freetools/ipregex> webpage, sends back following regexp:
First Entity regexp: ^172\.21\.144\.(1(9[2-9])|2([0-1][0-9]|2[0-3]))$

Second Entity regexp:  ^172\.21\.144\.(2(2[4-9]|3[0-9]))$

I've tested
grep -E "^172\.21\.144\.(1(9[2-9])|2([0-1][0-9]|2[0-3]))$" /tmp/ip_list
and
grep -E "^172\.21\.144\.(2(2[4-9]|3[0-9]))$" /tmp/ip_list
commands. They do work (with /tmp/ip_list files containing same lines as on <http://paste.debian.net/84716/>).

Stéphane: maybe could you give a try to these values in GLPI (and send feedback) ?

You can also try breaking regexps down as "simples regexps":
First Entity:
^172\.21\.144\.19[2-9]$
^172\.21\.144\.2[0-1][0-9]$
^172\.21\.144\.22[0-3]$

Second Entity:
^172\.21\.144\.22[4-9]$
^172\.21\.144\.23[0-9]$

Hope this helps,

@+
-- 
J. Fernando Lagrange
Demo-TIC - Outils En Ligne
http://www.demo-tic.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/fusioninventory-devel/attachments/20140302/5533b6f8/attachment.sig>


More information about the Fusioninventory-devel mailing list