function status() { $amavis = new amavis(); $max_servers = $amavis->main_array["BEHAVIORS"]["max_servers"]; $tpl = new templates(); $page = CurrentPageName(); if (!is_file("ressources/logs/amavis.infos.array")) { $sock = new sockets(); $sock->getFrameWork("cmd.php?amavis-watchdog=yes"); } $table = "<table style='width:250px'>\n\t<th colspan=2>{cpu}</th>\n\t<th> </th>\n\t<th>{type}</th>\n\t<th> </th>\n\t<th>RSS</th>\n\t<th>VMSIZE</th>\n\t</tr>\n\t\n\t"; $datas = unserialize(@file_get_contents("ressources/logs/amavis.infos.array")); $childs = 0; while (list($pid, $array) = each($datas)) { $TYPE = $array["TYPE"]; $CPU = $array["CPU"]; $TIME = $array["TIME"]; $RSS = $array["RSS"]; $VMSIZE = $array["VMSIZE"]; $color = "#5DD13D"; if ($CPU > 75) { $color = "#F59C44"; } if ($CPU > 85) { $color = "#D32D2D"; } $childs_text = '-'; if ($TYPE != "master") { if ($TYPE != "virgin") { if ($TYPE != "virgin child") { $childs++; $childs_text = $childs; } } } $pourc = pourcentage_basic($CPU, $color, " {$CPU}%"); $TOT_RSS = $TOT_RSS + $RSS; $TOT_VMSIZE = $TOT_VMSIZE + $VMSIZE; $table = $table . "\n\t\t<tr>\n\t\t\t<td>{$pourc}</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$CPU}%</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$childs_text}</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TYPE}</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TIME}Mn</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$RSS}Mb</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$VMSIZE}Mb</td>\n\t\t</tr>\n\t\t\n\t\t"; } if (preg_match("#([0-9]+)\\*([0-9]+)#", $amavis->main_array["BEHAVIORS"]["child_timeout"], $re)) { $seconds = intval($re[2]); $int = intval($re[1]); $total_seconds = round($int * $seconds) / 60; } for ($i = 1; $i < 60; $i++) { if ($i < 10) { $t = "0{$i}"; } else { $t = $i; } $mins[$i] = $t; } $table = $table . "\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TOT_RSS}Mb</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TOT_VMSIZE}Mb</td>\n\t\t</tr>\t\n\t\n\t</table>"; $html = "<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>{$table}</td>\n\t\t<td valign='top' align='left' width=99%>\n\t\t\t<div style='font-size:14px;font-weight:bold;margin-bottom:10px'>{processes}:{$childs}/{$max_servers} {used}</div>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{processes}:</td>\n\t\t\t\t<td>" . Field_text("max_servers", $max_servers, "font-size:16px;padding:3px") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend nowrap>{child_ttl}:</td>\n\t\t\t\t<td style='font-size:16px;padding:3px'>" . Field_array_Hash($mins, "child_timeout", $total_seconds, "style:font-size:16px;padding:3px") . " Mn</td>\n\t\t\t</tr>\t\n\t\t\t<tr><td colspan=2 align='right'><i style='font-size:12px'>{$amavis->main_array["BEHAVIORS"]["child_timeout"]} = {$total_seconds}Mn</i></td></tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align='right'><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('amavis.daemon.watchdog.php')\"\n\t\t\t\tstyle='font-size:14px;text-decoration:underline'\n\t\t\t\t><i>{watchdog_parameters}</i></a></td>\t\t\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align=right><hr>" . button("{apply}", "SaveMaxProcesses()") . "</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<br>\n\t\t\t<div style='text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "RefreshTab('main_config_amavis');") . "</div>\n\t\t\t<br>\n\t\t\t<div class=explain id='mmmdiv'>{amavis_max_server_explain}</div>\n\t\t\t\n\t</tr>\n\t</table>\n\t\n\t<script>\n\tvar x_SaveMaxProcesses= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue);}\t\n\t\tRefreshTab('main_config_amavis');\n\t}\t\t\n\t\n\tfunction SaveMaxProcesses(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('max_servers',document.getElementById('max_servers').value);\n\t\tXHR.appendData('child_timeout',document.getElementById('child_timeout').value);\t\t\n\t\tdocument.getElementById('mmmdiv').innerHTML='<center style=\"width:100%\"><img src=img/wait_verybig.gif></center>';\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_SaveMaxProcesses);\n\t\t}\t\n\n\t</script>\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function main_page() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $SYSTEMS_ALL_PARTITIONS = unserialize(base64_decode($sock->getFrameWork("system.php?SYSTEMS_ALL_PARTITIONS=yes"))); while (list($partition, $array) = each($SYSTEMS_ALL_PARTITIONS)) { $SIZE = $array["SIZE"]; $USED = $array["USED"]; $AIVA = $array["AIVA"]; $POURC = $array["POURC"]; $MOUNTED = $array["MOUNTED"]; $ico = "64-hd.png"; if ($partition == "tmpfs") { $ico = "bg_memory-64.png"; } $purc_inodes = null; $purc = null; $INODES_POURC = $array["VALUES"]["INODES_POURC"]; //print_r($array["VALUES"]); $color = "#5DD13D"; if ($INODES_POURC > 40) { $color = "#F59C44"; } if ($INODES_POURC > 90) { $color = "#D32D2D"; } if ($INODES_POURC > 0) { $purc_inodes = pourcentage_basic($INODES_POURC, $color, "{$INODES_POURC}%"); } $color = "#5DD13D"; if ($POURC > 40) { $color = "#F59C44"; } if ($POURC > 90) { $color = "#D32D2D"; } $purc = pourcentage_basic($POURC, $color, "{$USED}/{$SIZE} ({$POURC}%)"); $tr[] = "\n\t\t<tr>\n\t\t<td width=1% nowrap><img src='img/{$ico}'></td>\n\t\t<td style='font-size:18px' width=1% nowrap>{$partition} ({$SIZE})</td>\n\t\t<td style='font-size:18px'>{$MOUNTED}</td>\n\t\t<td style='font-size:18px' width=1% nowrap>{$purc_inodes}</td>\n\t\t<td style='font-size:18px' width=1% nowrap>{$AIVA}<div style='font-size:10px;font-weight:bold'>{$USED} ({$POURC}%)</div></td>\n\t\t<td style='font-size:18px' width=1% nowrap>{$purc}</td>\n\t\t</tr>\n\t\t"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan=2>{partition}</th>\n\t\t\t\t\t<th >{mounted}</th>\n\t\t\t\t\t<th >Inodes</th>\n\t\t\t\t\t<th >{available}</th>\n\t\t\t\t\t<th >{use}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function status() { $amavis = new amavis(); $max_servers = $amavis->main_array["BEHAVIORS"]["max_servers"]; $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); if (!is_file("ressources/logs/amavis.infos.array")) { $sock->getFrameWork("cmd.php?amavis-watchdog=yes"); } $table = "<table style='width:250px'>\n\t<th colspan=2>{cpu}</th>\n\t<th> </th>\n\t<th>{type}</th>\n\t<th> </th>\n\t<th>RSS</th>\n\t<th>VMSIZE</th>\n\t</tr>\n\t\n\t"; $datas = unserialize(@file_get_contents("ressources/logs/amavis.infos.array")); if (!is_array($datas)) { $sock->getFrameWork("cmd.php?amavis-watchdog=yes"); $datas = unserialize(@file_get_contents("ressources/logs/amavis.infos.array")); } if (count($datas) < 2) { $sock->getFrameWork("cmd.php?amavis-watchdog=yes"); $datas = unserialize(@file_get_contents("ressources/logs/amavis.infos.array")); } $childs = 0; while (list($pid, $array) = each($datas)) { $TYPE = $array["TYPE"]; $CPU = $array["CPU"]; $TIME = $array["TIME"]; $RSS = $array["RSS"]; $VMSIZE = $array["VMSIZE"]; $color = "#5DD13D"; if ($CPU > 75) { $color = "#F59C44"; } if ($CPU > 85) { $color = "#D32D2D"; } $childs_text = '-'; if ($TYPE != "master") { if ($TYPE != "virgin") { if ($TYPE != "virgin child") { $childs++; $childs_text = $childs; } } } $pourc = pourcentage_basic($CPU, $color, " {$CPU}%"); $TOT_RSS = $TOT_RSS + $RSS; $TOT_VMSIZE = $TOT_VMSIZE + $VMSIZE; $table = $table . "\n\t\t<tr>\n\t\t\t<td>{$pourc}</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$CPU}%</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$childs_text}</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TYPE}</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TIME}Mn</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$RSS}Mb</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$VMSIZE}Mb</td>\n\t\t</tr>\n\t\t\n\t\t"; } $table = $table . "\n\t\t<tr>\n\t\t\t<td> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'> </td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TOT_RSS}Mb</td>\n\t\t\t<td width=1% nowrap style='font-size:11px;font-weight:bold'>{$TOT_VMSIZE}Mb</td>\n\t\t</tr>\t\n\t\n\t</table>"; $html = "<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>{$table}</td>\n\t\t<td valign='top' align='left' width=99%>\n\t\t\t<div style='font-size:14px;font-weight:bold;margin-bottom:10px'>{processes}:{$childs}/{$max_servers} {used}</div>\n\n\t\t\t<br>\n\t\t\t<div style='text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "RefreshTab('main_config_amavis');") . "</div>\n\t\t\t<br>\n\t\t\t<div class=text-info id='mmmdiv'>{}</div>\n\t\t\t\n\t</tr>\n\t</table>\n\t\n\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function main_disks_discover() { $users = new usersMenus(); $Disks = $users->disks_size; $page = CurrentPageName(); $sock = new sockets(); $dd = new harddrive(); $ArticaDBPath = $sock->GET_INFO("ArticaDBPath"); if ($ArticaDBPath == null) { $ArticaDBPath = "/opt/articatech"; } $arrayDisks = $dd->getDiskList(); $html = "<tr>"; if (is_array($arrayDisks)) { $count = 0; $tr = null; while (list($disk, $ARRAY_FINAL) = each($arrayDisks)) { $content = null; $path = $ARRAY_FINAL["MOUNTED"]; if ($path == "/boot") { continue; } if ($path == "{$ArticaDBPath}") { continue; } if ($path == "/usr/share/artica-postfix") { continue; } if (isset($already[$path])) { continue; } if ($path == null) { continue; } $already[$path] = true; $size = $ARRAY_FINAL["SIZE"]; $label = $ARRAY_FINAL["LABEL"]; if ($size == null) { continue; } $pourc = $ARRAY_FINAL["POURC"]; $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={$_GET["no-hidden"]}&functionAfter={$_GET["functionAfter"]}')"; $disk_name = $disk; if (preg_match("#mapper\\/.+?\\-(.+)#", $disk_name, $re)) { $disk_name = $re[1]; } if (preg_match("#([0-9]+)\\s+MB#", $size, $re)) { $size = $size * 1000; $size = FormatBytes($size); $size = str_replace(" ", " ", $size); } $dirname = basename($path); $bandwith_color = "#5DD13D"; if ($pourc > 70) { $bandwith_color = "#F59C44"; } if ($pourc > 95) { $bandwith_color = "#D32D2D"; } $count = $count + 1; if ($count == 2) { $tr = "</tr><tr>"; $count = 0; } else { $tr = null; } $content = "({$size} - {$pourc}% {used})<br><strong>{$path}</strong><br><strong>{$label}</strong>\n\t\t\t\t\t<br><div style='margin-top:-10px'>" . pourcentage_basic($pourc, $bandwith_color, $size) . "</div>"; $FINALDISKS[] = Paragraphe32("noacco:{$disk_name}", "{$content}", $js, "48-hd.png"); } } if (is_array($added_disks_array)) { while (list($disk, $path) = each($added_disks_array)) { $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={&functionAfter={$_GET["functionAfter"]}}')"; $delete = imgtootltip("ed_delete.gif", "{delete} {$disk}...", "DeleteHiddenDisk('{$disk}')"); $FINALDISKS[] = Paragraphe32("noacco:{$disk}", "{$disk}<br>", $js, "48-hd.png", 220); } } if ($_GET["field"] != null) { $js = "Loadjs('autofs.wizard.php?field={$_GET["field"]}')"; $FINALDISKS[] = Paragraphe32("remote_connection", "remote_connection_wizard_text", $js, "folder-granted-properties-48.png", 220); } $finalfinal = CompileTr3($FINALDISKS); $add_disk = Paragraphe("64-hd-plus.png", "{invisible_disk}", "{add_invisible_disk_text}", "javascript:Loadjs('{$page}?hidden-add=yes')"); $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:100%'><div style='font-size:18px'>{select_disk}</div></td>\n\t\t<td>\n\t<table style='width:5%'>\n\t<tr>\n\t\t<td width=1%>" . imgtootltip("32-hd-plus.png", "{add_invisible_disk_text}", "Loadjs('{$page}?hidden-add=yes')") . "</td>\n\t\t<td width=99% nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$page}?hidden-add=yes')\" style='font-size:14px;text-decoration:underline'>{invisible_disk}</a></td>\n\t</tr>\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n{$finalfinal}\n\t\n\t\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, 'fileshares.index.php'); }
function health_table(){ $sock=new sockets(); $page=CurrentPageName(); $tpl=new templates(); $datas=unserialize(base64_decode($sock->getFrameWork("smart.php?health={$_GET["dev"]}"))); //http://fr.wikipedia.org/wiki/Self-Monitoring%2C_Analysis_and_Reporting_Technology#Attributs_S.M.A.R.T._connus //http://en.wikipedia.org/wiki/S.M.A.R.T. $warns[1]=true; $warns[5]=true; $warns[10]=true; $warns[196]=true; $warns[197]=true; $warns[198]=true; $warns[201]=true; $warns[220]=true; //lower=tresh $html=" <table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'> <thead class='thead'> <tr> <th colspan=2>{attribute}</th> <th>{current}</th> <th>{treshold}</th> <th>{worst}</th> <th>{health}</th> </tr> </thead> <tbody class='tbody'>"; while (list ($ID, $array) = each ($datas) ){ $help=help_icon("ID <strong>$ID</strong>:<hr>{{$array["ATTRIBUTE"]}_text}"); if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";} if($array["ATTRIBUTE"]=="Unknown_Attribute"){continue;} $a=(intval($array["TRESH"])/$array["VALUE"])*100; $p=100-$a; $d=intval($p); $color="#5DD13D"; if($d<75){$color="#F59C44";} if($d<50){$color="#D32D2D";} $health=pourcentage_basic($d,$color,"$d%"); $html=$html."<tr class=$classtr> <td width=1% nowrap>$help</td> <td style='font-size:14px;font-weight:bold;text-align:right' width=1% nowrap>{{$array["ATTRIBUTE"]}}:</td> <td style='font-size:14px;font-weight:bold;text-align:left' width=1% nowrap>{$array["VALUE"]}</td> <td style='font-size:14px;font-weight:bold;text-align:left' width=1% nowrap>{$array["TRESH"]}</td> <td style='font-size:14px;font-weight:bold;text-align:left' width=1% nowrap>{$array["WORST"]}</td> <td style='font-size:14px;font-weight:bold;text-align:left' width=1% nowrap>$health</td> </tr> "; } $html=$html." </table>"; echo $tpl->_ENGINE_parse_body($html); }
function caches_status() { $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $cacheinfo = unserialize(base64_decode($sock->getFrameWork("cmd.php?squid-cache-infos=yes"))); if (!is_array($cacheinfo)) { return null; } $html = "<h2>{caches_squid}</h2>"; while (list($path, $array) = each($cacheinfo)) { $color = "#5DD13D"; if ($array["POURC"] > 90) { $color = "#F59C44"; } if ($array["POURC"] > 98) { $color = "#D32D2D"; } $currentsize = FormatBytes($array["CURRENT"]); $pourc = pourcentage_basic($array["POURC"], $color, "{$array["POURC"]}%", "{used}:{$currentsize}"); $path = basename($path); $max = FormatBytes($array["MAX"]); $html = $html . "\n\t\t\t\n\t\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td valign='top' style='font-size:11px;font-weight:bold' nowrap>{$path} ({$max})</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>{$pourc}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top' style='font-size:11px;font-weight:bold' nowrap align='right'><i>{used}:{$currentsize}</i></td>\n\t\t\t</tr>\t\t\t\n\t\t\t</table>\n\t\t\t"; } echo $tpl->_ENGINE_parse_body($html); }