select a1.host, a1.g_name, round((1 - a1.value / a2.value) * 100, 2) pct_used, round(a2.value / 1024 / 1024 / 1024, 2) "total_size(G)" from (select host, value, graphid, g_name from (select t1.itemid, t1.i_name, t1.g_name, t1.host, from_unixtime(h.clock), h.value, t1.graphid, t1.type from (select i.itemid, i.name i_name, g.graphid, g.name g_name, h.hostid, h.host, gi.type from items i join graphs_items gi on i.itemid = gi.itemid join graphs g on gi.graphid = g.graphid join hosts h on i.hostid = h.hostid where h.name like '192.168.%' and g.name like 'Disk space usage %' and g.name not like '%{#FSNAME}') t1, history_uint h, (select itemid, max(clock) clock from history_uint group by itemid) t2 where t1.itemid = h.itemid and t1.itemid = t2.itemid and h.clock = t2.clock) b1 where type = 0) a1 join (select host, value, graphid, g_name from (select t1.itemid, t1.i_name, t1.g_name, t1.host, from_unixtime(h.clock), h.value, t1.graphid, t1.type from (select i.itemid, i.name i_name, g.graphid, g.name g_name, h.hostid, h.host, gi.type from items i join graphs_items gi on i.itemid = gi.itemid join graphs g on gi.graphid = g.graphid join hosts h on i.hostid = h.hostid where h.name like '192.168.%' and g.name like 'Disk space usage %' and g.name not like '%{#FSNAME}') t1, history_uint h, (select itemid, max(clock) clock from history_uint group by itemid) t2 where t1.itemid = h.itemid and t1.itemid = t2.itemid and h.clock = t2.clock) b2 where type = 2) a2 on a1.host = a2.host and a1.graphid = a2.graphid order by 3;
+----------------+----------------------------------+----------+---------------+ | host | g_name | pct_used | total_size(G) | +----------------+----------------------------------+----------+---------------+ | 192.168.44.151 | Disk space usage /oacle | 5.60 | 503.97 | | 192.168.44.132 | Disk space usage / | 7.31 | 200.81 | | 192.168.44.135 | Disk space usage / | 7.58 | 200.81 | | 192.168.44.153 | Disk space usage /oot | 8.08 | 0.19 | | 192.168.44.53 | Disk space usage /oracle | 8.58 | 362.70 | | 192.168.44.250 | Disk space usage / | 8.99 | 192.25 | | 192.168.44.249 | Disk space usage / | 10.01 | 192.25 | | 192.168.241.6 | Disk space usage /oracle/u1 | 10.27 | 916.89 | | 192.168.44.130 | Disk space usage / | 10.33 | 200.81 | | 192.168.44.134 | Disk space usage /oracle | 10.84 | 3347.70 | | 192.168.241.3 | Disk space usage /boot | 11.26 | 0.19 | | 192.168.241.2 | Disk space usage /boot | 11.26 | 0.19 | | 192.168.241.10 | Disk space usage /boot | 11.26 | 0.19 | | 192.168.44.55 | Disk space usage /boot | 11.30 | 0.19 | | 192.168.44.151 | Disk space usage /boot | 11.30 | 0.19 | | 192.168.241.6 | Disk space usage /boot | 11.30 | 0.19 | | 192.168.44.154 | Disk space usage /boot | 11.30 | 0.19 | | 192.168.44.53 | Disk space usage /boot | 11.36 | 0.19 | | 192.168.44.135 | Disk space usage /oracle | 11.38 | 3347.70 | | 192.168.44.52 | Disk space usage /boot | 11.39 | 0.19 | | 192.168.44.134 | Disk space usage / | 11.39 | 200.81 | | 192.168.44.54 | Disk space usage /boot | 11.41 | 0.19 | | 192.168.44.134 | Disk space usage /boot | 11.45 | 0.19 | | 192.168.44.132 | Disk space usage /boot | 11.45 | 0.19 | | 192.168.44.130 | Disk space usage /boot | 11.45 | 0.19 | | 192.168.44.131 | Disk space usage /boot | 11.45 | 0.19 | | 192.168.44.133 | Disk space usage /boot | 11.45 | 0.19 | | 192.168.44.135 | Disk space usage /boot | 11.45 | 0.19 | | 192.168.44.56 | Disk space usage /boot | 11.85 | 0.19 | | 192.168.44.102 | Disk space usage /boot | 11.98 | 0.19 | | 192.168.44.57 | Disk space usage /boot | 12.12 | 0.19 | | 192.168.44.131 | Disk space usage / | 13.47 | 200.81 | | 192.168.44.53 | Disk space usage / | 14.86 | 28.38 | | 192.168.44.132 | Disk space usage /oracle | 17.42 | 3347.70 | | 192.168.241.10 | Disk space usage / | 17.73 | 28.38 | | 192.168.44.131 | Disk space usage /oracle | 18.01 | 3347.70 | | 192.168.44.151 | Disk space usage / | 18.07 | 28.38 | | 192.168.241.3 | Disk space usage / | 19.98 | 28.38 | | 192.168.44.250 | Disk space usage /boot | 20.93 | 0.19 | | 192.168.44.249 | Disk space usage /boot | 20.94 | 0.19 | | 192.168.44.154 | Disk space usage /oracle | 23.45 | 491.22 | | 192.168.44.154 | Disk space usage / | 23.51 | 28.38 | | 192.168.44.55 | Disk space usage / | 24.07 | 28.38 | | 192.168.44.52 | Disk space usage / | 24.62 | 28.38 | | 192.168.241.6 | Disk space usage / | 26.20 | 28.38 | | 192.168.44.249 | Disk space usage /oracle | 26.49 | 1761.90 | | 192.168.44.153 | Disk space usage / | 28.37 | 28.38 | | 192.168.44.57 | Disk space usage /oracle | 28.96 | 232.28 | | 192.168.44.54 | Disk space usage / | 29.40 | 28.38 | | 192.168.44.56 | Disk space usage / | 30.41 | 28.83 | | 192.168.44.250 | Disk space usage /oracle | 32.92 | 1761.90 | | 192.168.241.2 | Disk space usage / | 32.99 | 28.38 | | 192.168.44.133 | Disk space usage / | 39.06 | 200.81 | | 192.168.44.54 | Disk space usage /oracle | 43.43 | 486.09 | | 192.168.241.3 | Disk space usage /oracle | 54.91 | 250.75 | | 192.168.44.102 | Disk space usage / | 56.31 | 108.40 | | 192.168.44.130 | Disk space usage /oracle | 56.55 | 3347.70 | | 192.168.44.52 | Disk space usage /oracle | 57.65 | 626.13 | | 192.168.241.6 | Disk space usage /oracle | 61.26 | 503.97 | | 192.168.44.153 | Disk space usage /oracle | 62.64 | 1021.01 | | 192.168.44.151 | Disk space usage /oracle | 66.70 | 916.89 | | 192.168.44.55 | Disk space usage /oracle | 72.50 | 491.22 | | 192.168.44.56 | Disk space usage /oracle | 76.33 | 368.56 | | 192.168.44.133 | Disk space usage /oracle | 82.00 | 3347.70 | | 192.168.44.102 | Disk space usage /oracle_oradata | 83.86 | 98.43 | | 192.168.241.2 | Disk space usage /oracle | 91.82 | 250.75 | | 192.168.44.57 | Disk space usage / | 94.83 | 28.83 | | 192.168.241.10 | Disk space usage /oracle | 96.30 | 250.75 | +----------------+----------------------------------+----------+---------------+ 68 rows in set (0.77 sec)