include SMARTY_LIB; $spine = new Smarty(); $dbh = DBconnect(); // pobieramy liste serwerow z bazy $HostMenu = serverList($dbh); $spine->assign('HostMenu', $HostMenu); $HostTotalCount = serverCount($dbh); $spine->assign('HostTotalCount', $HostTotalCount); // calkowita liczba wolnego miejsca na serwerach w GB $FreeTotalGB = hddFreeTotal($dbh); $spine->assign('FreeTotalGB', round($FreeTotalGB, 1)); // ilosc wolnego miejsca na poszczegolnych serwerach $SrvHDDFree = hddFreePerServer($dbh); $spine->assign('SrvHDDFree', $SrvHDDFree); // uptime na poszczegolnych serwerach $uptimePerHost = uptimePerServer($dbh); $spine->assign('uptimePerHost', $uptimePerHost); // calkowita liczba stron www $websiteCount = allWebsitesCount($dbh); $spine->assign('websiteCount', $websiteCount); // status wszystkich hostow z z bazy $allHostStatus = serverStatus($dbh); $spine->assign('allHostStatus', $allHostStatus); // tworzymy jsona z opcjami konfiguracyjnymi apacza vhostOptionFile($dbh); if (isset($_GET['serverid'])) { // komplet informacji na temat systemu i zuzycia zasobow $q = $dbh->prepare("SELECT ip, ext_ip, hostname, distro, uptime, hdd_total, hdd_free, ram_total, ram_free, host_status, cpu_usage FROM sysinfo WHERE id = " . $_GET['serverid']); $q->execute(); $r = $q->fetch(); $hdd_used = $r['hdd_total'] - $r['hdd_free'];
<?php include_once './include/config.php'; include_once './include/functions.php'; include_once './include/dashboard.php'; if (isset($_GET['uptime'])) { $dbh = DBconnect(); $uptimeData = uptimePerServer($dbh); $chartDataLabels = array(); $chartDataSet = array(); $chartDataSetColors = array(); foreach ($uptimeData as $key => $value) { array_push($chartDataLabels, $key); $sec[0] = $value; $color = "#" . substr(md5(rand()), 0, 6); array_push($chartDataSet, $sec[0][0]['seconds']); array_push($chartDataSetColors, $color); } $json = "labels: ["; foreach ($chartDataLabels as $value) { $json .= "\"" . $value . "\","; } $json .= "], datasets: [{data: ["; foreach ($chartDataSet as $value) { $json .= $value . ","; } $json .= "],backgroundColor: ["; foreach ($chartDataSetColors as $value) { $json .= "\"" . $value . "\","; } $json .= "],hoverBackgroundColor: [";