';
html_print_input_hidden ("server",$id_server);
$table->cellpadding=4;
$table->cellspacing=4;
$table->width='98%';
$table->class="databox_color";
$table->data[] = array (__('Name'),$row["name"]);
$table->data[] = array (__('IP Address'),html_print_input_text ('address',$row["ip_address"],'',50,0,true));
$table->data[] = array (__('Description'),html_print_input_text ('description',$row["description"],'',50,0,true));
html_print_table ($table);
echo '
';
echo '';
echo "
";
}
else {
// Header
ui_print_page_header (__('Pandora servers'), "", false, "servers", true);
if (isset ($_GET["delete"])) {
$id_server = get_parameter_get ("server_del");
$result = db_process_sql_delete('tserver', array('id_server' => $id_server));
if ($result !== false) {
echo ''.__('Server deleted successfully').'
';
}
else {
echo ''.__('There was a problem deleting the server').'
';
}
}
elseif (isset($_GET["update"])) {
$address = get_parameter_post ("address");
$description = get_parameter_post ("description");
$id_server = get_parameter_post ("server");
$values = array('ip_address' => $address, 'description' => $description);
$result = db_process_sql_update('tserver', $values, array('id_server' => $id_server));
if ($result !== false) {
echo ''.__('Server updated successfully').'
';
}
else {
echo ''.__('There was a problem updating the server').'
';
}
}
$servers = servers_get_info ();
if ($servers === false) {
echo "".__('There are no servers configured into the database')."
";
return;
}
$table->width = '98%';
$table->size = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->align = array ();
$table->align[1] = 'center';
$table->align[8] = 'center';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Status');
$table->head[2] = __('Type');
$table->head[3] = __('Load') . ui_print_help_tip (__("Modules running on this server / Total modules of this type"), true);
$table->head[4] = __('Modules');
$table->head[5] = __('Lag') . ui_print_help_tip (__("Modules delayed / Max. Delay (sec)"), true);
$table->head[6] = __('T/Q') . ui_print_help_tip (__("Threads / Queued modules currently"), true);
// This will have a column of data such as "6 hours"
$table->head[7] = __('Updated');
//Only Pandora Administrator can delete servers
if (check_acl ($config["id_user"], 0, "PM")) {
$table->head[8] = '' . __('Op.') . '';
}
$table->data = array ();
foreach ($servers as $server) {
$data = array ();
$data[0] = ''.$server['name'].'';
$data[0] = ''.$server["name"].'';
if ($server['status'] == 0) {
$data[1] = ui_print_status_image (STATUS_SERVER_DOWN, '', true);
}
else {
$data[1] = ui_print_status_image (STATUS_SERVER_OK, '', true);
}
// Type
$data[2] = ''.$server["img"].' ('.ucfirst($server["type"]).")";
if ($server["master"] == 1)
$data[2] .= ui_print_help_tip (__("This is a master server"), true);
switch ($server['type']) {
case "snmp":
case "event":
$data[3] = 'N/A';
$data[4] = 'N/A';
$data[5] = 'N/A';
break;
case "export":
$data[3] = progress_bar($server["load"], 60, 20, $server["lag_txt"], 0);
$data[4] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
$data[5] = 'N/A';
break;
default:
$data[3] = progress_bar($server["load"], 60, 20, $server["lag_txt"], 0);
$data[4] = $server["modules"] . " ".__('of')." ". $server["modules_total"];
$data[5] = ''.$server["lag_txt"].'';
break;
}
$data[6] = $server['threads'].' : '.$server['queued_modules'];
$data[7] = ui_print_timestamp ($server['keepalive'], true);
//Only Pandora Administrator can delete servers
if (check_acl ($config["id_user"], 0, "PM")) {
$data[8] = '';
$data[8] .= html_print_image ('images/config.png', true, array ('title' => __('Edit')));
$data[8] .= '';
$data[8] .= ' ';
$data[8] .= html_print_image ('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" . __('Modules run by this server will stop working. Do you want to continue?') ."')) return false"));
$data[8] .= '';
}
array_push ($table->data, $data);
}
html_print_table ($table);
//Legend
echo "";
echo "" . __('Legend') . " |
";
echo "";
echo ''.__('Network server').' | ';
echo ''.__('Master').' | ';
echo ''.__('Data server').' | ';
echo ''.__('MD5 check').' | ';
echo ''.__('SNMP console').' | ';
echo ''.__('Plugin server').' | ';
echo "
";
echo ''.__('Recon server').' | ';
echo ''.__('WMI server').' | ';
echo ''.__('Export server').' | ';
echo ''.__('Inventory server').' | ';
echo ''.__('Web server').' | ';
echo ''.__('Prediction server').' | ';
echo "
";
}
?>