2013-02-27 Sergio Martin <sergio.martin@artica.es>
* include/functions_html.php include/styles/pandora.css include/functions_graph.php include/graphs/functions_pchart.php include/functions_reporting.php include/functions_servers.php include/constants.php operation/agentes/tactical.php general/logon_ok.php: A lot of improvements in tactical views git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7736 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9f5f4bbdbd
commit
83f352f09e
|
@ -1,3 +1,16 @@
|
|||
2013-02-27 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_html.php
|
||||
include/styles/pandora.css
|
||||
include/functions_graph.php
|
||||
include/graphs/functions_pchart.php
|
||||
include/functions_reporting.php
|
||||
include/functions_servers.php
|
||||
include/constants.php
|
||||
operation/agentes/tactical.php
|
||||
general/logon_ok.php: A lot of improvements in
|
||||
tactical views
|
||||
|
||||
2013-02-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/agentes/networkmap_list.php,
|
||||
|
|
|
@ -81,147 +81,9 @@ echo '<div style="width:30%; float:left; padding-left: 30px;" id="rightcolumn">'
|
|||
$data = reporting_get_group_stats ();
|
||||
|
||||
///////////////
|
||||
// Overview
|
||||
// Overview Table
|
||||
///////////////
|
||||
|
||||
// Link URLS
|
||||
$urls = array();
|
||||
$urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
$urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1";
|
||||
$urls['monitor_critical'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2";
|
||||
$urls['monitor_warning'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1";
|
||||
$urls['monitor_ok'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0";
|
||||
$urls['monitor_unknown'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3";
|
||||
$urls['monitor_not_init'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=5";
|
||||
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
|
||||
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
|
||||
if (check_acl ($config['id_user'], 0, "UM")) {
|
||||
$urls['defined_users'] = "index.php?sec=gusuarios&sec2=godmode/users/user_list";
|
||||
}
|
||||
else{
|
||||
$urls['defined_users'] = 'javascript:';
|
||||
}
|
||||
|
||||
// Transparent table as template to build subtables
|
||||
$table_transparent->class = "none";
|
||||
$table_transparent->cellpadding = 0;
|
||||
$table_transparent->cellspacing = 0;
|
||||
$table_transparent->head = array ();
|
||||
$table_transparent->data = array ();
|
||||
$table_transparent->style[0] = $table_transparent->style[1] = $table_transparent->style[2] = $table_transparent->style[3] = 'text-align:center; width: 25%;';
|
||||
$table_transparent->width = "100%";
|
||||
|
||||
// Indicators table
|
||||
$table_ind = clone $table_transparent;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Monitor health') . ui_print_help_tip (sprintf(__('%d Not OK monitors'), $data["monitor_not_normal"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($data["monitor_health"], 280, 20, $data["monitor_health"].'% '.__('of monitors up'), 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Module sanity') . ui_print_help_tip (sprintf(__('%d Not inited monitors'), $data["monitor_not_init"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($data["module_sanity"], 280, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Alert level') . ui_print_help_tip (sprintf(__('%d Fired alerts'), $data["monitor_alerts_fired"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($data["alert_level"], 280, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
// Agents and modules table
|
||||
$table_am = clone $table_transparent;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/bricks.png', true, array('title' => __('Total agents'), 'width' => '20px'));
|
||||
$tdata[1] = $data["total_agents"] == 0 ? '-' : $data["total_agents"];
|
||||
$tdata[1] = '<a style="color: black;" class="big_data" href="' . $urls['total_agents'] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/brick.png', true, array('title' => __('Monitor checks'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_checks"] == 0 ? '-' : $data["monitor_checks"];
|
||||
$tdata[3] = '<a style="color: black;" class="big_data" href="' . $urls['monitor_checks'] . '">' . $tdata[3] . '</a>';
|
||||
$table_am->rowclass[] = '';
|
||||
$table_am->data[] = $tdata;
|
||||
|
||||
// Modules by status table
|
||||
$table_mbs = clone $table_transparent;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/status_sets/default/agent_critical_ball.png', true, array('title' => __('Monitor critical'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_critical"] == 0 ? '-' : $data["monitor_critical"];
|
||||
$tdata[1] = '<a style="color: ' . COL_CRITICAL . ';" class="big_data" href="' . $urls['monitor_critical'] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/status_sets/default/agent_warning_ball.png', true, array('title' => __('Monitor warning'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_warning"] == 0 ? '-' : $data["monitor_warning"];
|
||||
$tdata[3] = '<a style="color: ' . COL_WARNING_DARK . ';" class="big_data" href="' . $urls['monitor_warning'] . '">' . $tdata[3] . '</a>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/status_sets/default/agent_ok_ball.png', true, array('title' => __('Monitor normal'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_ok"] == 0 ? '-' : $data["monitor_ok"];
|
||||
$tdata[1] = '<a style="color: ' . COL_NORMAL . ';" class="big_data" href="' . $urls["monitor_ok"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/status_sets/default/agent_no_monitors_ball.png', true, array('title' => __('Monitor unknown'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_unknown"] == 0 ? '-' : $data["monitor_unknown"];
|
||||
$tdata[3] = '<a style="color: ' . COL_UNKNOWN . ';" class="big_data" href="' . $urls["monitor_unknown"] . '">' . $tdata[3] . '</a>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/status_sets/default/agent_no_data_ball.png', true, array('title' => __('Monitor not init'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_not_init"] == 0 ? '-' : $data["monitor_not_init"];
|
||||
$tdata[1] = '<a style="color: ' . COL_NOTINIT . ';" class="big_data" href="' . $urls["monitor_not_init"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = $tdata[3] = '';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
|
||||
if($data["monitor_checks"] > 0) {
|
||||
$tdata = array();
|
||||
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
|
||||
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
|
||||
$tdata[0] = '<div style="margin: auto; width: 250px;">' . graph_agent_status (false, 250, 150, true, true) . '</div>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
}
|
||||
|
||||
// Alerts table
|
||||
$table_al = clone $table_transparent;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_alerts"] == 0 ? '-' : $data["monitor_alerts"];
|
||||
$tdata[1] = '<a style="color: black;" class="big_data" href="' . $urls["monitor_alerts"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_alerts_fired"] == 0 ? '-' : $data["monitor_alerts_fired"];
|
||||
$tdata[3] = '<a style="color: ' . COL_ALERTFIRED . ';" class="big_data" href="' . $urls["monitor_alerts_fired"] . '">' . $tdata[3] . '</a>';
|
||||
$table_al->rowclass[] = '';
|
||||
$table_al->data[] = $tdata;
|
||||
|
||||
// Users table
|
||||
$table_us = clone $table_transparent;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/group.png', true, array('title' => __('Defined users'), 'width' => '20px'));
|
||||
$tdata[1] = count (get_users ());
|
||||
$tdata[1] = '<a style="color: black;" class="big_data" href="' . $urls["defined_users"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = $tdata[3] = ' ';
|
||||
$table_us->rowclass[] = '';
|
||||
$table_us->data[] = $tdata;
|
||||
|
||||
// Overview table build
|
||||
$table->class = "databox";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
|
@ -234,47 +96,32 @@ $table->head_colspan[0] = 4;
|
|||
|
||||
// Indicators
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_table($table_ind, true);
|
||||
$tdata[0] = reporting_get_stats_indicators($data);
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Total agents and modules
|
||||
// Alerts
|
||||
$tdata = array();
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Total agents and monitors') .
|
||||
'</legend>' .
|
||||
html_print_table($table_am, true) . '</fieldset>';
|
||||
$tdata[0] = reporting_get_stats_alerts($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Modules by status
|
||||
$tdata = array();
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Monitors by status') .
|
||||
'</legend>' .
|
||||
html_print_table($table_mbs, true) . '</fieldset>';
|
||||
$tdata[0] = reporting_get_stats_modules_status($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Alerts
|
||||
// Total agents and modules
|
||||
$tdata = array();
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Defined and fired alerts') .
|
||||
'</legend>' .
|
||||
html_print_table($table_al, true) . '</fieldset>';
|
||||
$tdata[0] = reporting_get_stats_agents_monitors($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
// Users
|
||||
$tdata = array();
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Users') .
|
||||
'</legend>' .
|
||||
html_print_table($table_us, true) . '</fieldset>';
|
||||
$tdata[0] = reporting_get_stats_users($data);
|
||||
$table->rowclass[] = '';
|
||||
$table->data[] = $tdata;
|
||||
|
||||
|
|
|
@ -239,4 +239,19 @@ define ('SNMP_DIR_MIBS', "attachment/mibs");
|
|||
define('PASSSWORD_POLICIES_OK', 0);
|
||||
define('PASSSWORD_POLICIES_FIRST_CHANGE', 1);
|
||||
define('PASSSWORD_POLICIES_EXPIRED', 2);
|
||||
|
||||
/* SERVER TYPES */
|
||||
define ('SERVER_TYPE_DATA', 0);
|
||||
define ('SERVER_TYPE_NETWORK', 1);
|
||||
define ('SERVER_TYPE_SNMP', 2);
|
||||
define ('SERVER_TYPE_RECON', 3);
|
||||
define ('SERVER_TYPE_PLUGIN', 4);
|
||||
define ('SERVER_TYPE_PREDICTION', 5);
|
||||
define ('SERVER_TYPE_WMI', 6);
|
||||
define ('SERVER_TYPE_EXPORT', 7);
|
||||
define ('SERVER_TYPE_INVENTORY', 8);
|
||||
define ('SERVER_TYPE_WEB', 9);
|
||||
define ('SERVER_TYPE_EVENT', 10);
|
||||
define ('SERVER_TYPE_ENTERPRISE_ICMP', 11);
|
||||
define ('SERVER_TYPE_ENTERPRISE_SNMP', 12);
|
||||
?>
|
||||
|
|
|
@ -1338,6 +1338,35 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a pie graph with alerts defined/fired data
|
||||
*
|
||||
* @param integer Number of defined alerts
|
||||
* @param integer Number of fired alerts
|
||||
* @param integer width pie graph width
|
||||
* @param integer height pie graph height
|
||||
* @param bool return or echo flag
|
||||
*/
|
||||
function graph_alert_status ($defined_alerts, $fired_alerts, $width = 300, $height = 200, $return = false) {
|
||||
global $config;
|
||||
|
||||
$data = array(__('Defined alerts') => $defined_alerts, __('Fired alerts') => $fired_alerts);
|
||||
$colors = array(COL_NORMAL, COL_ALERTFIRED);
|
||||
|
||||
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
|
||||
|
||||
$out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
||||
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
}
|
||||
else {
|
||||
echo $out;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a pie graph with events data of agent or all agents (if id_agent = false)
|
||||
*
|
||||
|
|
|
@ -1151,6 +1151,33 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes =
|
|||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a table parameters predefined
|
||||
*
|
||||
* @param string model
|
||||
* - Transparent: More basic template. No borders, all the columns with same width
|
||||
* @param int number of columns
|
||||
*
|
||||
* @return object Table object
|
||||
*/
|
||||
function html_get_predefined_table ($model = 'transparent', $columns = 4) {
|
||||
$width_percent = 100/$columns;
|
||||
|
||||
switch($model) {
|
||||
case 'transparent':
|
||||
default:
|
||||
$table->class = "none";
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->style = array_fill(0, 4, 'text-align:center; width: ' . $width_percent . '%;');
|
||||
$table->width = "100%";
|
||||
}
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a nicely formatted table. Code taken from moodle.
|
||||
*
|
||||
|
@ -1231,6 +1258,7 @@ function html_print_table (&$table, $return = false) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$styleTable = '';
|
||||
if (isset ($table->styleTable)) {
|
||||
$styleTable = $table->styleTable;
|
||||
|
@ -1259,8 +1287,8 @@ function html_print_table (&$table, $return = false) {
|
|||
}
|
||||
if (isset ($table->cellstyle)) {
|
||||
foreach ($table->cellstyle as $keyrow => $cstyle) {
|
||||
foreach ($cstyle as $key => $style) {
|
||||
$cellstyle[$keyrow][$key] = $style;
|
||||
foreach ($cstyle as $key => $cst) {
|
||||
$cellstyle[$keyrow][$key] = $cst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1405,7 +1433,7 @@ function html_print_table (&$table, $return = false) {
|
|||
if (!isset ($style[$key])) {
|
||||
$style[$key] = '';
|
||||
}
|
||||
|
||||
|
||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'. $cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key] .'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.'">'. $item .'</td>'."\n";
|
||||
}
|
||||
$output .= '</tr>'."\n";
|
||||
|
|
|
@ -863,6 +863,375 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
|||
return $data_colors;
|
||||
}
|
||||
|
||||
function reporting_get_stats_servers($tiny = true) {
|
||||
$server_performance = servers_get_performance();
|
||||
|
||||
// Alerts table
|
||||
$table_srv = html_get_predefined_table();
|
||||
|
||||
$table_srv->style[0] = $table_srv->style[2] = 'text-align: right; padding: 5px;';
|
||||
$table_srv->style[1] = $table_srv->style[3] = 'text-align: left; padding: 5px;';
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/brick.png', true, array('title' => __('Total running modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["total_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = '<hr style="border: 0; height: 1px; background: #DDD">';
|
||||
$table_srv->colspan[count($table_srv->data)][0] = 4;
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/data.png', true, array('title' => __('Local modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_local_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["local_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
|
||||
if($tiny) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_remote_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["remote_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
else {
|
||||
if(isset($server_performance ["total_network_modules"])) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_network_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["network_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
|
||||
if(isset($server_performance ["total_plugin_modules"])) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/plugin.png', true, array('title' => __('Plugin modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_plugin_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["plugin_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
|
||||
if(isset($server_performance ["total_prediction_modules"])) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/chart_bar.png', true, array('title' => __('Prediction modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_prediction_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["prediction_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
|
||||
if(isset($server_performance ["total_wmi_modules"])) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/wmi.png', true, array('title' => __('WMI modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_wmi_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["wmi_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
|
||||
if(isset($server_performance ["total_web_modules"])) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/world.png', true, array('title' => __('Web modules'), 'width' => '20px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_web_modules"]) . '</span>';
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["web_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/brick.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '10px')) . '/sec </span>';
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$output = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Server performance') .
|
||||
'</legend>' .
|
||||
html_print_table($table_srv, true) . '</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_height = 150) {
|
||||
global $config;
|
||||
|
||||
// Link URLS
|
||||
$urls = array();
|
||||
$urls['monitor_critical'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2";
|
||||
$urls['monitor_warning'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1";
|
||||
$urls['monitor_ok'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0";
|
||||
$urls['monitor_unknown'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3";
|
||||
$urls['monitor_not_init'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=5";
|
||||
|
||||
// Modules by status table
|
||||
$table_mbs = html_get_predefined_table();
|
||||
|
||||
$table_mbs->style[0] = $table_mbs->style[2] = 'text-align: right; padding-right: 3px;';
|
||||
$table_mbs->style[1] = $table_mbs->style[3] = 'text-align: left; padding-left: 3px;';
|
||||
|
||||
if($data["monitor_checks"] > 0) {
|
||||
$tdata = array();
|
||||
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
|
||||
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
|
||||
$tdata[0] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
}
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/status_sets/default/agent_critical_ball.png', true, array('title' => __('Monitor critical'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_critical"] == 0 ? '-' : $data["monitor_critical"];
|
||||
$tdata[1] = '<a style="color: ' . COL_CRITICAL . ';" class="big_data" href="' . $urls['monitor_critical'] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/status_sets/default/agent_warning_ball.png', true, array('title' => __('Monitor warning'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_warning"] == 0 ? '-' : $data["monitor_warning"];
|
||||
$tdata[3] = '<a style="color: ' . COL_WARNING_DARK . ';" class="big_data" href="' . $urls['monitor_warning'] . '">' . $tdata[3] . '</a>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/status_sets/default/agent_ok_ball.png', true, array('title' => __('Monitor normal'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_ok"] == 0 ? '-' : $data["monitor_ok"];
|
||||
$tdata[1] = '<a style="color: ' . COL_NORMAL . ';" class="big_data" href="' . $urls["monitor_ok"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/status_sets/default/agent_no_monitors_ball.png', true, array('title' => __('Monitor unknown'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_unknown"] == 0 ? '-' : $data["monitor_unknown"];
|
||||
$tdata[3] = '<a style="color: ' . COL_UNKNOWN . ';" class="big_data" href="' . $urls["monitor_unknown"] . '">' . $tdata[3] . '</a>';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/status_sets/default/agent_no_data_ball.png', true, array('title' => __('Monitor not init'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_not_init"] == 0 ? '-' : $data["monitor_not_init"];
|
||||
$tdata[1] = '<a style="color: ' . COL_NOTINIT . ';" class="big_data" href="' . $urls["monitor_not_init"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = $tdata[3] = '';
|
||||
$table_mbs->rowclass[] = '';
|
||||
$table_mbs->data[] = $tdata;
|
||||
|
||||
$output = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Monitors by status') .
|
||||
'</legend>' .
|
||||
html_print_table($table_mbs, true) . '</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
||||
global $config;
|
||||
|
||||
// Alerts table
|
||||
$table_sum = html_get_predefined_table();
|
||||
|
||||
$tdata = array();
|
||||
$table_sum->colspan[count($table_sum->data)][0] = 2;
|
||||
$table_sum->colspan[count($table_sum->data)][2] = 2;
|
||||
$table_sum->cellstyle[count($table_sum->data)][0] = 'text-align: center;';
|
||||
$table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;';
|
||||
$tdata[0] = '<span class="med_data" style="color: #666">' . __('Module status') . '</span>';
|
||||
$tdata[2] = '<span class="med_data" style="color: #666">' . __('Alert status') . '</span>';
|
||||
$table_sum->rowclass[] = '';
|
||||
$table_sum->data[] = $tdata;
|
||||
|
||||
$tdata = array();
|
||||
$table_sum->colspan[count($table_sum->data)][0] = 2;
|
||||
$table_sum->colspan[count($table_sum->data)][2] = 2;
|
||||
$table_sum->cellstyle[count($table_sum->data)][0] = 'text-align: center;';
|
||||
$table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;';
|
||||
|
||||
if($data["monitor_checks"] > 0) {
|
||||
$tdata[0] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '</div>';
|
||||
}
|
||||
else {
|
||||
$tdata[2] = html_print_image('images/image_problem.png', true, array('width' => $graph_width));
|
||||
}
|
||||
if($data["monitor_alerts"] > 0) {
|
||||
$tdata[2] = '<div style="margin: auto; width: ' . $graph_width . 'px;">' . graph_alert_status ($data["monitor_alerts"], $data["monitor_alerts_fired"], $graph_width, $graph_height, true, true) . '</div>';
|
||||
}
|
||||
else {
|
||||
$tdata[2] = html_print_image('images/image_problem.png', true, array('width' => $graph_width));
|
||||
}
|
||||
$table_sum->rowclass[] = '';
|
||||
$table_sum->data[] = $tdata;
|
||||
|
||||
$output = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Summary') .
|
||||
'</legend>' .
|
||||
html_print_table($table_sum, true) . '</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function reporting_get_stats_alerts($data) {
|
||||
global $config;
|
||||
|
||||
// Link URLS
|
||||
$urls = array();
|
||||
$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
|
||||
$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired";
|
||||
|
||||
// Alerts table
|
||||
$table_al = html_get_predefined_table();
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'), 'width' => '20px'));
|
||||
$tdata[1] = $data["monitor_alerts"] == 0 ? '-' : $data["monitor_alerts"];
|
||||
$tdata[1] = '<a style="color: ' . COL_NORMAL . ';" class="big_data" href="' . $urls["monitor_alerts"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_alerts_fired"] == 0 ? '-' : $data["monitor_alerts_fired"];
|
||||
$tdata[3] = '<a style="color: ' . COL_ALERTFIRED . ';" class="big_data" href="' . $urls["monitor_alerts_fired"] . '">' . $tdata[3] . '</a>';
|
||||
$table_al->rowclass[] = '';
|
||||
$table_al->data[] = $tdata;
|
||||
|
||||
$output = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Defined and fired alerts') .
|
||||
'</legend>' .
|
||||
html_print_table($table_al, true) . '</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function reporting_get_stats_users($data) {
|
||||
global $config;
|
||||
|
||||
// Link URLS
|
||||
$urls = array();
|
||||
if (check_acl ($config['id_user'], 0, "UM")) {
|
||||
$urls['defined_users'] = "index.php?sec=gusuarios&sec2=godmode/users/user_list";
|
||||
}
|
||||
else{
|
||||
$urls['defined_users'] = 'javascript:';
|
||||
}
|
||||
|
||||
// Users table
|
||||
$table_us = html_get_predefined_table();
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/group.png', true, array('title' => __('Defined users'), 'width' => '20px'));
|
||||
$tdata[1] = count (get_users ());
|
||||
$tdata[1] = '<a style="color: black;" class="big_data" href="' . $urls["defined_users"] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = $tdata[3] = ' ';
|
||||
$table_us->rowclass[] = '';
|
||||
$table_us->data[] = $tdata;
|
||||
|
||||
$output = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Users') .
|
||||
'</legend>' .
|
||||
html_print_table($table_us, true) . '</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function reporting_get_stats_agents_monitors($data) {
|
||||
global $config;
|
||||
|
||||
// Link URLS
|
||||
$urls = array();
|
||||
$urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
$urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1";
|
||||
|
||||
// Agents and modules table
|
||||
$table_am = html_get_predefined_table();
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/bricks.png', true, array('title' => __('Total agents'), 'width' => '20px'));
|
||||
$tdata[1] = $data["total_agents"] == 0 ? '-' : $data["total_agents"];
|
||||
$tdata[1] = '<a style="color: black;" class="big_data" href="' . $urls['total_agents'] . '">' . $tdata[1] . '</a>';
|
||||
|
||||
$tdata[2] = html_print_image('images/brick.png', true, array('title' => __('Monitor checks'), 'width' => '20px'));
|
||||
$tdata[3] = $data["monitor_checks"] == 0 ? '-' : $data["monitor_checks"];
|
||||
$tdata[3] = '<a style="color: black;" class="big_data" href="' . $urls['monitor_checks'] . '">' . $tdata[3] . '</a>';
|
||||
$table_am->rowclass[] = '';
|
||||
$table_am->data[] = $tdata;
|
||||
|
||||
$output = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Total agents and monitors') .
|
||||
'</legend>' .
|
||||
html_print_table($table_am, true) . '</fieldset>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function reporting_get_stats_indicators($data, $width = 280, $height = 20) {
|
||||
$table_ind = html_get_predefined_table();
|
||||
|
||||
$servers = array();
|
||||
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
|
||||
$servers["up"] = (int) servers_check_status ();
|
||||
$servers["down"] = $servers["all"] - $servers["up"];
|
||||
$servers["health"] = $servers["up"] / ($servers["all"] / 100);
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Server health') . ui_print_help_tip (sprintf(__('%d Downed servers'), $servers["down"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($servers["health"], $width, $height, '', 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Monitor health') . ui_print_help_tip (sprintf(__('%d Not Normal monitors'), $data["monitor_not_normal"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($data["monitor_health"], $width, $height, $data["monitor_health"].'% '.__('of monitors up'), 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Module sanity') . ui_print_help_tip (sprintf(__('%d Not inited monitors'), $data["monitor_not_init"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($data["module_sanity"], $width, $height, $data["module_sanity"].'% '.__('of total modules inited'), 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
$tdata[0] = '<fieldset class="databox" style="width:97%;">
|
||||
<legend style="text-align:left; color: #666;">' .
|
||||
__('Alert level') . ui_print_help_tip (sprintf(__('%d Fired alerts'), $data["monitor_alerts_fired"]), true) .
|
||||
'</legend>' .
|
||||
progress_bar($data["alert_level"], $width, $height, $data["alert_level"].'% '.__('of defined alerts not fired'), 0) . '</fieldset>';
|
||||
$table_ind->rowclass[] = '';
|
||||
$table_ind->data[] = $tdata;
|
||||
|
||||
return html_print_table($table_ind, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get general statistical info on a group
|
||||
*
|
||||
|
@ -6183,4 +6552,4 @@ function reporting_get_count_events_validated ($filter, $period = 0,
|
|||
$filter_event_validated, $filter_event_critical,
|
||||
$filter_event_warning, $filter_event_no_validated);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -72,59 +72,170 @@ function servers_get_performance () {
|
|||
global $config;
|
||||
|
||||
$data = array();
|
||||
|
||||
// For remote modules:
|
||||
// Get total modules running
|
||||
$data["total_modules"] = 0;
|
||||
$data["total_remote_modules"] = 0;
|
||||
$data["total_local_modules"] = 0;
|
||||
$data["avg_interval_total_modules"] = array();
|
||||
$data["avg_interval_remote_modules"] = array();
|
||||
$data["avg_interval_local_modules"] = 0;
|
||||
|
||||
if ($config["realtimestats"] == 1){
|
||||
$data["total_remote_modules"] = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo)
|
||||
$counts = db_get_all_rows_sql ("SELECT tagente_modulo.id_modulo, COUNT(tagente_modulo.id_agente_modulo) modules
|
||||
FROM tagente_modulo, tagente_estado, tagente
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.id_modulo != 1 AND tagente_modulo.disabled = 0 AND utimestamp > 0
|
||||
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente");
|
||||
AND tagente_modulo.disabled = 0 AND module_interval > 0 AND utimestamp > 0 AND delete_pending = 0
|
||||
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente GROUP BY tagente_modulo.id_modulo");
|
||||
|
||||
if(empty($counts)) {
|
||||
$counts = array();
|
||||
}
|
||||
|
||||
foreach($counts as $c) {
|
||||
switch($c['id_modulo']) {
|
||||
case MODULE_DATA:
|
||||
$data["total_local_modules"] = $c['modules'];
|
||||
break;
|
||||
case MODULE_NETWORK:
|
||||
$data["total_network_modules"] = $c['modules'];
|
||||
break;
|
||||
case MODULE_PLUGIN:
|
||||
$data["total_plugin_modules"] = $c['modules'];
|
||||
break;
|
||||
case MODULE_PREDICTION:
|
||||
$data["total_prediction_modules"] = $c['modules'];
|
||||
break;
|
||||
case MODULE_WMI:
|
||||
$data["total_wmi_modules"] = $c['modules'];
|
||||
break;
|
||||
case MODULE_WEB:
|
||||
$data["total_web_modules"] = $c['modules'];
|
||||
break;
|
||||
}
|
||||
|
||||
if($c['id_modulo'] != MODULE_DATA) {
|
||||
$data["total_remote_modules"] += $c['modules'];
|
||||
}
|
||||
|
||||
$data["total_modules"] += $c['modules'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$data["total_remote_modules"] = db_get_sql ("SELECT SUM(my_modules) FROM tserver WHERE server_type != 0");
|
||||
$counts = db_get_all_rows_sql ("SELECT server_type, my_modules modules FROM tserver GROUP BY server_type");
|
||||
|
||||
if(empty($counts)) {
|
||||
$counts = array();
|
||||
}
|
||||
|
||||
foreach($counts as $c) {
|
||||
switch ($c['server_type']) {
|
||||
case SERVER_TYPE_DATA:
|
||||
$data["total_local_modules"] = $c['modules'];
|
||||
break;
|
||||
case SERVER_TYPE_NETWORK:
|
||||
case SERVER_TYPE_SNMP:
|
||||
case SERVER_TYPE_ENTERPRISE_ICMP:
|
||||
case SERVER_TYPE_ENTERPRISE_SNMP:
|
||||
$data["total_network_modules"] = $c['modules'];
|
||||
break;
|
||||
case SERVER_TYPE_PLUGIN:
|
||||
$data["total_plugin_modules"] = $c['modules'];
|
||||
break;
|
||||
case SERVER_TYPE_PREDICTION:
|
||||
$data["total_prediction_modules"] = $c['modules'];
|
||||
break;
|
||||
case SERVER_TYPE_WMI:
|
||||
$data["total_wmi_modules"] = $c['modules'];
|
||||
break;
|
||||
case SERVER_TYPE_WEB:
|
||||
$data["total_web_modules"] = $c['modules'];
|
||||
break;
|
||||
case SERVER_TYPE_EXPORT:
|
||||
case SERVER_TYPE_INVENTORY:
|
||||
case SERVER_TYPE_EVENT:
|
||||
case SERVER_TYPE_RECON:
|
||||
break;
|
||||
}
|
||||
|
||||
if($c['server_type'] != SERVER_TYPE_DATA) {
|
||||
$data["total_remote_modules"] += $c['modules'];
|
||||
}
|
||||
|
||||
$data["total_modules"] += $c['modules'];
|
||||
}
|
||||
}
|
||||
|
||||
$interval_avgs = db_get_all_rows_sql ("SELECT tagente_modulo.id_modulo, AVG(tagente_modulo.module_interval) avg_interval
|
||||
FROM tagente_modulo, tagente_estado, tagente
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0 AND module_interval > 0 AND utimestamp > 0 AND delete_pending = 0
|
||||
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente GROUP BY tagente_modulo.id_modulo");
|
||||
|
||||
foreach($interval_avgs as $ia) {
|
||||
switch($ia['id_modulo']) {
|
||||
case MODULE_DATA:
|
||||
$data["avg_interval_local_modules"] = $ia['avg_interval'];
|
||||
$data["local_modules_rate"] = servers_get_rate($data["avg_interval_local_modules"], $data["total_local_modules"]);
|
||||
break;
|
||||
case MODULE_NETWORK:
|
||||
$data["avg_interval_network_modules"] = $ia['avg_interval'];
|
||||
$data["network_modules_rate"] = servers_get_rate($data["avg_interval_network_modules"], $data["total_network_modules"]);
|
||||
break;
|
||||
case MODULE_PLUGIN:
|
||||
$data["avg_interval_plugin_modules"] = $ia['avg_interval'];
|
||||
$data["plugin_modules_rate"] = servers_get_rate($data["avg_interval_plugin_modules"], $data["total_plugin_modules"]);
|
||||
break;
|
||||
case MODULE_PREDICTION:
|
||||
$data["avg_interval_prediction_modules"] = $ia['avg_interval'];
|
||||
$data["prediction_modules_rate"] = servers_get_rate($data["avg_interval_prediction_modules"], $data["total_prediction_modules"]);
|
||||
break;
|
||||
case MODULE_WMI:
|
||||
$data["avg_interval_wmi_modules"] = $ia['avg_interval'];
|
||||
$data["wmi_modules_rate"] = servers_get_rate($data["avg_interval_wmi_modules"], $data["total_wmi_modules"]);
|
||||
break;
|
||||
case MODULE_WEB:
|
||||
$data["avg_interval_web_modules"] = $ia['avg_interval'];
|
||||
$data["web_modules_rate"] = servers_get_rate($data["avg_interval_web_modules"], $data["total_web_modules"]);
|
||||
break;
|
||||
}
|
||||
|
||||
if($ia['id_modulo'] != MODULE_DATA) {
|
||||
$data["avg_interval_remote_modules"][] = $ia['avg_interval'];
|
||||
}
|
||||
|
||||
$data["avg_interval_total_modules"][] = $ia['avg_interval'];
|
||||
}
|
||||
|
||||
$data["avg_interval_remote_modules"] = db_get_sql ("SELECT AVG(module_interval)
|
||||
FROM tagente_modulo, tagente_estado, tagente
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0 AND id_modulo != 1 AND module_interval > 0 AND utimestamp > 0
|
||||
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente");
|
||||
|
||||
if ($data["avg_interval_remote_modules"] == 0)
|
||||
$data["remote_modules_rate"] = 0;
|
||||
else
|
||||
$data["remote_modules_rate"] = $data["total_remote_modules"] / $data["avg_interval_remote_modules"];
|
||||
|
||||
// For local modules (ignoring local modules with custom invervals for simplicity).
|
||||
if ($config["realtimestats"] == 1){
|
||||
$data["total_local_modules"] = db_get_sql ("SELECT COUNT(tagente_modulo.id_agente_modulo)
|
||||
FROM tagente_modulo, tagente_estado, tagente
|
||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
AND id_modulo = 1 AND tagente_modulo.disabled = 0 AND utimestamp > 0
|
||||
AND tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente");
|
||||
if (empty($data["avg_interval_remote_modules"])) {
|
||||
$data["avg_interval_remote_modules"] = 0;
|
||||
}
|
||||
else {
|
||||
$data["total_local_modules"] = db_get_sql ("SELECT SUM(my_modules) FROM tserver WHERE server_type = 0");
|
||||
$data["avg_interval_remote_modules"] = array_sum($data["avg_interval_remote_modules"]) / count($data["avg_interval_remote_modules"]);
|
||||
}
|
||||
|
||||
$data["avg_interval_local_modules"] = db_get_sql ("SELECT AVG(tagente.intervalo) FROM tagente WHERE disabled = 0 AND intervalo > 0");
|
||||
|
||||
if ($data["avg_interval_local_modules"] > 0){
|
||||
$data["local_modules_rate"] = $data["total_local_modules"] / $data["avg_interval_local_modules"];
|
||||
if (empty($data["avg_interval_total_modules"])) {
|
||||
$data["avg_interval_total_modules"] = 0;
|
||||
}
|
||||
else {
|
||||
$data["local_modules_rate"] = 0;
|
||||
$data["avg_interval_total_modules"] = array_sum($data["avg_interval_total_modules"]) / count($data["avg_interval_total_modules"]);
|
||||
}
|
||||
|
||||
$data["total_modules"] = $data["total_local_modules"] + $data["total_remote_modules"];
|
||||
|
||||
$data["remote_modules_rate"] = servers_get_rate($data["avg_interval_remote_modules"], $data["total_remote_modules"]);
|
||||
$data["total_modules_rate"] = servers_get_rate($data["avg_interval_total_modules"], $data["total_modules"]);
|
||||
|
||||
return ($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get server rate
|
||||
*
|
||||
* @param float avg of interval of these modules
|
||||
* @param int number of modules
|
||||
*
|
||||
* @return float number of modules processed by second
|
||||
*/
|
||||
function servers_get_rate($avg_interval, $num_modules) {
|
||||
return $avg_interval > 0 ? ($num_modules / $avg_interval) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will get all the server information in an array or a specific server
|
||||
|
@ -157,76 +268,71 @@ function servers_get_info ($id_server = -1) {
|
|||
$return = array ();
|
||||
foreach ($result as $server) {
|
||||
switch ($server['server_type']) {
|
||||
case 0:
|
||||
case SERVER_TYPE_DATA:
|
||||
$server["img"] = html_print_image ("images/data.png", true, array ("title" => __('Data server')));
|
||||
$server["type"] = "data";
|
||||
$id_modulo = 1;
|
||||
break;
|
||||
case 1:
|
||||
case SERVER_TYPE_NETWORK:
|
||||
$server["img"] = html_print_image ("images/network.png", true, array ("title" => __('Network server')));
|
||||
$server["type"] = "network";
|
||||
$id_modulo = 2;
|
||||
break;
|
||||
case 2:
|
||||
case SERVER_TYPE_SNMP:
|
||||
$server["img"] = html_print_image ("images/snmp.png", true, array ("title" => __('SNMP Trap server')));
|
||||
$server["type"] = "snmp";
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
case 3:
|
||||
case SERVER_TYPE_RECON:
|
||||
$server["img"] = html_print_image ("images/recon.png", true, array ("title" => __('Recon server')));
|
||||
$server["type"] = "recon";
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
case 4:
|
||||
case SERVER_TYPE_PLUGIN:
|
||||
$server["img"] = html_print_image ("images/plugin.png", true, array ("title" => __('Plugin server')));
|
||||
$server["type"] = "plugin";
|
||||
$id_modulo = 4;
|
||||
break;
|
||||
case 5:
|
||||
case SERVER_TYPE_PREDICTION:
|
||||
$server["img"] = html_print_image ("images/chart_bar.png", true, array ("title" => __('Prediction server')));
|
||||
$server["type"] = "prediction";
|
||||
$id_modulo = 5;
|
||||
break;
|
||||
case 6:
|
||||
case SERVER_TYPE_WMI:
|
||||
$server["img"] = html_print_image ("images/wmi.png", true, array ("title" => __('WMI server')));
|
||||
$server["type"] = "wmi";
|
||||
$id_modulo = 6;
|
||||
break;
|
||||
case 7:
|
||||
case SERVER_TYPE_EXPORT:
|
||||
$server["img"] = html_print_image ("images/server_export.png", true, array ("title" => __('Export server')));
|
||||
$server["type"] = "export";
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
case 8:
|
||||
case SERVER_TYPE_INVENTORY:
|
||||
$server["img"] = html_print_image ("images/page_white_text.png", true, array ("title" => __('Inventory server')));
|
||||
$server["type"] = "inventory";
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
case 9:
|
||||
case SERVER_TYPE_WEB:
|
||||
$server["img"] = html_print_image ("images/world.png", true, array ("title" => __('Web server')));
|
||||
$server["type"] = "web";
|
||||
$id_modulo = 0;
|
||||
break;
|
||||
case 10:
|
||||
case SERVER_TYPE_EVENT:
|
||||
$server["img"] = html_print_image ("images/lightning_go.png", true, array ("title" => __('Event server')));
|
||||
$server["type"] = "event";
|
||||
$id_modulo = 2;
|
||||
break;
|
||||
case 11:
|
||||
case SERVER_TYPE_ENTERPRISE_ICMP:
|
||||
$server["img"] = html_print_image ("images/network.png", true, array ("title" => __('Enterprise ICMP server')));
|
||||
$server["type"] = "enterprise icmp";
|
||||
$id_modulo = 2;
|
||||
break;
|
||||
case 12:
|
||||
case SERVER_TYPE_ENTERPRISE_SNMP:
|
||||
$server["img"] = html_print_image ("images/network.png", true, array ("title" => __('Enterprise SNMP server')));
|
||||
$server["type"] = "enterprise snmp";
|
||||
$id_modulo = 2;
|
||||
break;
|
||||
case 13:
|
||||
$server["img"] = html_print_image ("images/network.png", true, array ("title" => __('Enterprise SNMP server')));
|
||||
$server["type"] = "netflow";
|
||||
$id_modulo = 2;
|
||||
break;
|
||||
default:
|
||||
$server["img"] = '';
|
||||
$server["type"] = "unknown";
|
||||
|
|
|
@ -407,7 +407,6 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
|
|||
|
||||
foreach($data_values as $key => $value) {
|
||||
if(isset($colors[$key])) {
|
||||
html_debug_print(hex_2_rgb($colors[$key]), true);
|
||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$key]));
|
||||
}
|
||||
}
|
||||
|
@ -872,4 +871,4 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
|
|||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -1054,9 +1054,14 @@ div#main_pure {
|
|||
*margin-top: 10px !important;
|
||||
}
|
||||
/* big_data is used in tactical and logon_ok */
|
||||
a.big_data {
|
||||
.big_data {
|
||||
text-decoration: none; font: bold 2em Arial, Sans-serif;
|
||||
}
|
||||
|
||||
.med_data {
|
||||
text-decoration: none; font: bold 1.5em Arial, Sans-serif;
|
||||
}
|
||||
|
||||
.notify {
|
||||
background-color: #f7ffa5;
|
||||
text-align: center;
|
||||
|
|
|
@ -38,29 +38,6 @@ if ($force_refresh == 1) {
|
|||
db_process_sql ("UPDATE tgroup_stat SET utimestamp = 0");
|
||||
}
|
||||
|
||||
//This is an intermediary function to print out a set of cells
|
||||
//Cells is an array with the explanation, value, link and color
|
||||
function print_cells_temp ($cells) {
|
||||
foreach ($cells as $key => $row) {
|
||||
//Switch class around
|
||||
$class = (($key % 2) ? "datos2" : "datos");
|
||||
echo '<tr><td class="'.$class.'"><b>'.$row[0].'</b></td>';
|
||||
if ($row[1] === 0) {
|
||||
$row[1] = "-";
|
||||
}
|
||||
|
||||
// Prevents error for empty color
|
||||
$color = '';
|
||||
if (isset($row["color"]))
|
||||
$color = 'style="color: ' . $row["color"] . ';"';
|
||||
|
||||
if (isset($row["href"]) and !empty($row["href"]))
|
||||
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.io_safe_input ($row["href"]).'" ' . $color . '>'.$row[1].'</a></td></tr>';
|
||||
else
|
||||
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" ' . $color . '>'.$row[1].'</a></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($config["realtimestats"] == 0) {
|
||||
$updated_time ="<a href='index.php?sec=estado&sec2=operation/agentes/tactical&force_refresh=1'>";
|
||||
$updated_time .= __('Last update'). " : ". ui_print_timestamp (db_get_sql ("SELECT min(utimestamp) FROM tgroup_stat"), true);
|
||||
|
@ -83,41 +60,16 @@ echo '<div style="width:20%; float:left; padding-right: 5%;" id="leftcolumn">';
|
|||
// The status horizontal bars (Global health, Monitor sanity...
|
||||
// ---------------------------------------------------------------------
|
||||
$table->width = "100%";
|
||||
$table->class = "databox";
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->class = "";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->border = 0;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
|
||||
$table->style[0] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[0][0] ='<b>'.__('Global health').'</b>';
|
||||
$table->data[0][0] = reporting_get_stats_indicators($data, 140, 20);
|
||||
|
||||
$table->style[1] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[1][0] =
|
||||
progress_bar($data["global_health"], 140, 20, $data["global_health"].'% '.__('of monitors OK'), 0);
|
||||
|
||||
$table->style[2] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[2][0] ='<b>'.__('Monitor health').'</b>';
|
||||
|
||||
$table->style[3] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[3][0] =
|
||||
progress_bar($data["monitor_health"], 140, 20, $data["monitor_health"].'% '.__('of monitors up'), 0);
|
||||
|
||||
$table->style[4] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[4][0] = '<b>'.__('Module sanity').'</b>';
|
||||
|
||||
$table->style[5] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[5][0] =
|
||||
progress_bar($data["module_sanity"], 140, 20, $data["module_sanity"].'% '.__('of total modules inited'), 0);
|
||||
|
||||
$table->style[6] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[6][0] = '<b>'.__('Alert level').'</b>';
|
||||
|
||||
$table->style[7] = "padding-top:4px; padding-bottom:4px;";
|
||||
$table->data[7][0] =
|
||||
progress_bar($data["alert_level"], 140, 20, $data["alert_level"].'% '.__('of defined alerts not fired'), 0);
|
||||
|
||||
html_print_table ($table);
|
||||
unset ($table);
|
||||
|
@ -125,111 +77,38 @@ unset ($table);
|
|||
// ---------------------------------------------------------------------
|
||||
// Monitor checks
|
||||
// ---------------------------------------------------------------------
|
||||
echo '<table class="databox" cellpadding="4" cellspacing="4" width="100%">';
|
||||
echo '<tr><th colspan="2">'.__('Monitor checks').'</th></tr>';
|
||||
$table->width = "100%";
|
||||
$table->class = "";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->border = 0;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
|
||||
$cells = array ();
|
||||
$cells[0][0] = __('Monitor checks');
|
||||
$cells[0][1] = $data["monitor_checks"];
|
||||
$cells[0]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; //All
|
||||
$cells[0]["color"] = "#000";
|
||||
|
||||
$cells[3][0] = __('Monitors critical');
|
||||
$cells[3][1] = $data["monitor_critical"];
|
||||
$cells[3]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2"; //Down
|
||||
$cells[3]["color"] = "#c00";
|
||||
|
||||
$cells[2][0] = __('Monitors warning');
|
||||
$cells[2][1] = $data["monitor_warning"];
|
||||
$cells[2]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1"; //Down
|
||||
$cells[2]["color"] = "#ffcc00";
|
||||
|
||||
$cells[1][0] = __('Monitors normal');
|
||||
$cells[1][1] = $data["monitor_ok"];
|
||||
$cells[1]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0"; //Up
|
||||
$cells[1]["color"] = "#8ae234";
|
||||
|
||||
$cells[4][0] = __('Monitors unknown');
|
||||
$cells[4][1] = $data["monitor_unknown"];
|
||||
$cells[4]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3"; //Unknown
|
||||
$cells[4]["color"] = "#aaa";
|
||||
|
||||
$cells[5][0] = __('Monitors not init');
|
||||
$cells[5][1] = $data["monitor_not_init"];
|
||||
$cells[5]["color"] = "#ef2929";
|
||||
$cells[5]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=5"; //Not init
|
||||
|
||||
$cells[6][0] = __('Alerts defined');
|
||||
$cells[6][1] = $data["monitor_alerts"];
|
||||
$cells[6]["href"] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60"; //All alerts defined
|
||||
$cells[6]["color"] = "#000";
|
||||
|
||||
$cells[7][0] = __('Alerts fired');
|
||||
$cells[7][1] = $data["monitor_alerts_fired"];
|
||||
$cells[7]["href"] = "index.php?sec=eventos&sec2=operation/events/events&search=&event_type=alert_fired"; //Fired alert events
|
||||
$cells[7]["color"] = "#ff8800";
|
||||
|
||||
print_cells_temp ($cells);
|
||||
$table->data[0][0] = reporting_get_stats_alerts($data);
|
||||
$table->data[0][0] .= reporting_get_stats_modules_status($data, 200, 100) . '<br>';
|
||||
$table->data[0][0] .= reporting_get_stats_agents_monitors($data) . '<br>';
|
||||
|
||||
html_print_table($table);
|
||||
// ---------------------------------------------------------------------
|
||||
// Server performance
|
||||
// ---------------------------------------------------------------------
|
||||
if ($is_admin) {
|
||||
$server_performance = servers_get_performance();
|
||||
|
||||
echo '<tr><th colspan="2">'.__('Server performance').'</th></tr>';
|
||||
$cells = array ();
|
||||
|
||||
$cells[0][0] = __('Local modules rate');
|
||||
$cells[0][1] = format_numeric($server_performance ["local_modules_rate"]);
|
||||
$cells[0]["color"] = "#729fcf";
|
||||
$cells[0]["href"] = "";
|
||||
|
||||
$cells[1][0] = __('Remote modules rate');
|
||||
$cells[1][1] = format_numeric($server_performance ["remote_modules_rate"]);
|
||||
$cells[1]["color"] = "#729fcf";
|
||||
$cells[1]["href"] = "";
|
||||
|
||||
$cells[2][0] = __('Local modules');
|
||||
$cells[2][1] = format_numeric($server_performance ["total_local_modules"]);
|
||||
$cells[2]["color"] = "#3465a4";
|
||||
$cells[2]["href"] = "";
|
||||
|
||||
$cells[3][0] = __('Remote modules');
|
||||
$cells[3][1] = format_numeric($server_performance ["total_remote_modules"]);
|
||||
$cells[3]["color"] = "#3465a4";
|
||||
$cells[3]["href"] = "";
|
||||
|
||||
$cells[4][0] = __('Total running modules');
|
||||
$cells[4][1] = format_numeric($server_performance ["total_modules"]);
|
||||
$cells[4]["color"] = "#000";
|
||||
$cells[4]["href"] = "";
|
||||
|
||||
print_cells_temp ($cells);
|
||||
$table->width = "100%";
|
||||
$table->class = "";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->border = 0;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
|
||||
$table->data[0][0] = reporting_get_stats_servers(false);
|
||||
|
||||
html_print_table($table);
|
||||
}
|
||||
|
||||
echo '<tr><th colspan="2">'.__('Summary').'</th></tr>';
|
||||
|
||||
$cells = array ();
|
||||
$cells[0][0] = __('Total agents');
|
||||
$cells[0][1] = $data["total_agents"];
|
||||
$cells[0]["color"] = "#000";
|
||||
$cells[0]["href"] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
|
||||
|
||||
$cells[1][0] = __('Uninitialized modules');
|
||||
$cells[1][1] = $data["server_sanity"] . "%";
|
||||
$cells[1]["color"] = "#ef2929";
|
||||
$cells[1]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=5";
|
||||
|
||||
$cells[2][0] = __('Agents unknown');
|
||||
$cells[2][1] = $data["agents_unknown"];
|
||||
$cells[2]["color"] = "#aaa";
|
||||
$cells[2]["href"] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&status=3";
|
||||
|
||||
|
||||
print_cells_temp ($cells);
|
||||
|
||||
echo "</table>";
|
||||
echo '</div>'; //Left column
|
||||
|
||||
echo '<div style="width: 70%; float:left;" id="rightcolumn">';
|
||||
|
@ -318,4 +197,4 @@ if ($is_admin) {
|
|||
|
||||
|
||||
echo '</div>';
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue