Example #1
0
         }
         $cluster->save_default_configs($_POST["configs"] ? $_POST["configs"] : array(), $cfgs, $_POST["add_config"], "default_config_chain");
         $list_configs = true;
     } else {
         $xtpl->perex(_("Error"), 'Error, contact your administrator');
         $list_configs = true;
     }
     break;
 case "configs_regen":
     $cluster->regenerate_all_configs();
     $xtpl->perex(_("Regeneration scheduled"), _("Regeneration of all configs on all nodes scheduled."));
     break;
 case "node_toggle_maintenance":
     $node = new cluster_node($_GET["node_id"]);
     $node->toggle_maintenance();
     notify_user($node->s["server_name"] . ': ' . _('maintenance') . ' ' . ($node->is_under_maintenance() ? _('ON') : _('OFF')));
     redirect('?page=cluster');
     break;
 case "newnode":
     $xtpl->title2(_("Register new server into cluster"));
     $xtpl->table_add_category('');
     $xtpl->table_add_category('');
     $xtpl->form_create('?page=cluster&action=newnode_save', 'post');
     $xtpl->form_add_input(_("ID") . ':', 'text', '8', 'server_id', '', '');
     $xtpl->form_add_input(_("Name") . ':', 'text', '30', 'server_name', '', '');
     $xtpl->form_add_select(_("Type") . ':', 'server_type', $server_types);
     $xtpl->form_add_select(_("Location") . ':', 'server_location', $cluster->list_locations(), '', '');
     $xtpl->form_add_input(_("Server IPv4 address") . ':', 'text', '30', 'server_ip4', '', '');
     $xtpl->form_add_textarea(_("Availability icon (if you wish)") . ':', 28, 4, 'server_availstat', '', _("Paste HTML link here"));
     $xtpl->form_out(_("Save changes"));
     break;
Example #2
0
     $xtpl->table_td(_("Free"), '#5EAFFF; color:#FFF; font-weight:bold;');
     $xtpl->table_td('', '#5EAFFF; color:#FFF; font-weight:bold;');
     $xtpl->table_td(_("Node"), '#5EAFFF; color:#FFF; font-weight:bold;');
     $xtpl->table_td(_("VPS"), '#5EAFFF; color:#FFF; font-weight:bold;');
     $xtpl->table_td(_("Free"), '#5EAFFF; color:#FFF; font-weight:bold;');
     $xtpl->table_tr(true);
     $position = 1;
 }
 $last_location = $srv["server_location"];
 $sql = 'SELECT * FROM servers_status WHERE server_id ="' . $srv["server_id"] . '"';
 if ($result = $db->query($sql)) {
     $status = $db->fetch_array($result);
 }
 $icons = "";
 $last_update = date('Y-m-d H:i:s', $status["timestamp"]) . ' (' . date('i:s', time() - $status["timestamp"]) . ')';
 if ($node->is_under_maintenance()) {
     $icons .= '<img title="' . _("The server is currently under maintenance.") . '" src="template/icons/maintenance_mode.png">';
 } elseif ($cluster_cfg->get("lock_cron_" . $srv["server_id"])) {
     $icons .= '<img title="' . _("The server is currently processing") . ', last update: ' . $last_update . '" src="template/icons/warning.png"/>';
 } elseif (time() - $status["timestamp"] > 150) {
     $icons .= '<img title="' . _("The server is not responding") . ', last update: ' . $last_update . '" src="template/icons/error.png"/>';
 } elseif ($status['daemon'] > 0) {
     $icons .= '<img title="' . _("vpsAdmin on this server is not responding") . ', last update: ' . $last_update . '" src="template/icons/server_daemon_offline.png" alt="' . _("vpsAdmin is down") . '" />';
 } else {
     $icons .= '<img title="' . _("The server is online") . ', last update: ' . $last_update . '" src="template/icons/server_online.png"/>';
 }
 if ($cluster_cfg->get("lock_cron_backup_" . $srv["server_id"])) {
     if ($_SESSION["is_admin"]) {
         $icons .= ' <a href="?page=cluster&action=freelock&lock=backuper&id=' . $srv["server_id"] . '"><img title="' . _("The server is performing a backup; click to free this lock (WARNING: can corrupt backups!)") . '" src="template/icons/backup_progress.png"/></a>';
     } else {
         $icons .= ' <img title="' . _("The server is performing a backup") . '" src="template/icons/backup_progress.png"/>';