$Total = $pieces[1]; $Total *= 1024; $flag = 0; } if (preg_match('/^MemFree:\\s+(\\d+)\\skB$/', $line, $pieces)) { $Free = $pieces[1]; $Free *= 1024; break; } } fclose($fh); $info = libvirt_connect_get_information($libvirt->conn); echo "<tr><th>Hostname</th><td>: " . $info['hostname'] . "</td></tr>"; echo "<tr><th>Hypervisor</th><td>: " . $info['hypervisor_string'] . "</td></tr>"; echo "<tr><th>Max VCPU(s) per VM</th><td>: " . $info['hypervisor_maxvcpus'] . "</td></tr>"; $info = libvirt_node_get_info($libvirt->conn); echo "<tr><th>CPU(s)</th><td>: " . $info['cpus'] . "</td></tr>"; echo "<tr><th>Architecture</th><td>: " . $info['model'] . "</td></tr>"; $Total = $login->convertfilesize($Total); echo "<tr><th>Total Memory</th><td>: " . $Total . "</td></tr>"; $Free = $login->convertfilesize($Free); echo "<tr><th>Free Memory</th><td>: " . $Free . "</td></tr>"; $ds = disk_total_space("/"); $ds = $login->convertfilesize($ds); echo "<tr><th>Total Disk Space</th><td>: " . $ds . "</td></tr>"; $df = disk_free_space("/"); $df = $login->convertfilesize($df); echo "<tr><th>Free Disk Space</th><td>: " . $df . "</td></tr>"; ?> </table> </div>
echo "<div id=\"strip\">"; echo "NODE :" . $ip; echo "<button type=\"button\" class=\"primary\">-</button>"; echo "</div>"; echo "<div id=\"widget-main\">"; echo "<table style=\"font:serif;font-size:100%;text-align:left;\">"; $uri = "qemu+tcp://" . $ip . "/system"; $con = libvirt_connect($uri, false); if (!$con) { echo libvirt_get_last_error(); } $info = libvirt_connect_get_information($con); echo "<tr><th>Hostname</th><td>: " . $info['hostname'] . "</td></tr>"; echo "<tr><th>Hypervisor</th><td>: " . $info['hypervisor_string'] . "</td></tr>"; echo "<tr><th>Max VCPU(s) per VM</th><td>: " . $info['hypervisor_maxvcpus'] . "</td></tr>"; $info1 = libvirt_node_get_info($con); echo "<tr><th>CPU(s)</th><td>: " . $info1['cpus'] . "</td></tr>"; echo "<tr><th>CPU frequency</th><td>: " . $info1['mhz'] . "</td></tr>"; echo "<tr><th>Architecture</th><td>: " . $info1['model'] . "</td></tr>"; echo "<tr><th>Memory</th><td>: " . $info1['memory'] . "</td></tr>"; echo "<tr><th>Total Number of VM(s)</th><td>: " . $info['num_total_domains'] . "</td></tr>"; echo "<tr><th>Running VM(s)</th><td>: " . $info['num_active_domains'] . "</td></tr>"; echo "<tr><th>Stopped VM(s)</th><td>: " . $info['num_inactive_domains'] . "</td></tr>"; echo "</table>"; echo "</div>"; echo "</div>"; } } echo "</div>"; $redis->close(); }
function host_get_node_info() { $tmp = libvirt_node_get_info($this->conn); return $tmp ? $tmp : $this->_set_last_error(); }
/** * fetch live physical information about the remote virt host * * @global resource @host_conn libvirt connection * * @return string|bool physical host info or FALSE on error */ function ace_kvm_get_physical_info() { global $host_conn; $physical_info = libvirt_node_get_info($host_conn); ace_kvm_log_last_error(); return $physical_info; }