Dear Guys,
we are using OCSNG_UNIX_SERVER-2.2 and at IpDiscover it is not calculating the percentage column. Or it shows 0% or 100%. I have attached screenshot to clarify the problem.
Executed in DEBUG mode
mysql> SELECT SQL_CALC_FOUND_ROWS * from (select inv.RSX as ID, inv.c as 'INVENTORIE', non_ident.c as 'NON_INVENTORIE', ipdiscover.c as 'IPDISCOVER', ident.c as 'IDENTIFIE', CASE WHEN ident.c IS NULL and ipdiscover.c IS NULL THEN 100 WHEN ident.c IS NULL THEN 0 ELSE round(100-(non_ident.c*100/(ident.c+non_ident.c)),1) END as 'pourcentage' from (SELECT COUNT(DISTINCT hardware_id) as c,'IPDISCOVER' as TYPE,tvalue as RSX FROM devices WHERE name='IPDISCOVER' and tvalue in ( '172.26.169.128', '172.30.195.128', '10.10.0.0', '10.44.123.64', '172.28.130.192', '172.26.169.0', '169.254.0.0' ) GROUP BY tvalue) ipdiscover right join (SELECT count(distinct(hardware_id)) as c,'INVENTORIE' as TYPE,ipsubnet as RSX FROM networks left join subnet on networks.ipsubnet=subnet.netid WHERE ipsubnet in ( '172.26.169.128', '172.30.195.128', '10.10.0.0', '10.44.123.64', '172.28.130.192', '172.26.169.0', '169.254.0.0' ) and status='Up' GROUP BY ipsubnet) inv on ipdiscover.RSX=inv.RSX left join (SELECT COUNT(DISTINCT mac) as c,'IDENTIFIE' as TYPE,netid as RSX FROM netmap WHERE mac IN (SELECT DISTINCT(macaddr) FROM network_devices) and netid in ( '172.26.169.128', '172.30.195.128', '10.10.0.0', '10.44.123.64', '172.28.130.192', '172.26.169.0', '169.254.0.0' ) GROUP BY netid) ident on ipdiscover.RSX=ident.RSX left join (SELECT COUNT(DISTINCT mac) as c,'NON IDENTIFIE' as TYPE,netid as RSX FROM netmap n LEFT JOIN networks ns ON ns.macaddr=n.mac WHERE n.mac NOT IN (SELECT DISTINCT(macaddr) FROM network_devices) and (ns.macaddr IS NULL OR ns.IPSUBNET <> n.netid) and n.netid in ( '172.26.169.128', '172.30.195.128', '10.10.0.0', '10.44.123.64', '172.28.130.192', '172.26.169.0', '169.254.0.0' ) GROUP BY netid) non_ident on non_ident.RSX=inv.RSX ) toto order by ID asc limit 0 , 10
-> ;
+----------------+------------+----------------+------------+-----------+-------------+
| ID | INVENTORIE | NON_INVENTORIE | IPDISCOVER | IDENTIFIE | pourcentage |
+----------------+------------+----------------+------------+-----------+-------------+
| 10.10.0.0 | 3 | 290 | 2 | NULL | 0.0 |
| 10.44.123.64 | 3 | 25 | 2 | NULL | 0.0 |
| 169.254.0.0 | 1 | NULL | NULL | NULL | 100.0 |
| 172.26.169.0 | 2 | 16 | 2 | NULL | 0.0 |
| 172.26.169.128 | 1 | 54 | 1 | NULL | 0.0 |
| 172.28.130.192 | 3 | 26 | 1 | NULL | 0.0 |
| 172.30.195.128 | 1 | NULL | NULL | NULL | 100.0 |
+----------------+------------+----------------+------------+-----------+-------------+
7 rows in set (0.03 sec)
Helio Paixao