mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2012-07-18 Miguel de Dios <miguel.dedios@artica.es>
* general/logon_ok.php, godmode/db/db_event.php, godmode/db/db_purge.php, include/functions_config.php, include/functions_ui.php, include/functions_netflow.php, include/functions.php, include/constants.php, include/functions_graph.php, operation/agentes/estado_ultimopaquete.php: clean source code style and kill some unicorns and magical numbers. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6788 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
469abc72fe
commit
5da06e0448
@ -1,3 +1,13 @@
|
|||||||
|
2012-07-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* general/logon_ok.php, godmode/db/db_event.php,
|
||||||
|
godmode/db/db_purge.php, include/functions_config.php,
|
||||||
|
include/functions_ui.php, include/functions_netflow.php,
|
||||||
|
include/functions.php, include/constants.php,
|
||||||
|
include/functions_graph.php,
|
||||||
|
operation/agentes/estado_ultimopaquete.php: clean source code style
|
||||||
|
and kill some unicorns and magical numbers.
|
||||||
|
|
||||||
2012-07-18 Miguel de Dios <miguel.dedios@artica.es>
|
2012-07-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/javascript/pandora.js, include/functions_agents.php,
|
* include/javascript/pandora.js, include/functions_agents.php,
|
||||||
|
@ -180,19 +180,19 @@ switch ($config["dbtype"]) {
|
|||||||
case "mysql":
|
case "mysql":
|
||||||
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
|
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
|
||||||
FROM tsesion
|
FROM tsesion
|
||||||
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - 604800)
|
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ")
|
||||||
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
|
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion
|
$sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion
|
||||||
FROM tsesion
|
FROM tsesion
|
||||||
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 604800)
|
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ")
|
||||||
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
|
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion
|
$sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion
|
||||||
FROM tsesion
|
FROM tsesion
|
||||||
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - 604800)
|
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ")
|
||||||
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]);
|
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,12 @@ echo '<table width="98%" cellpadding="4" cellspacing="4" class="databox">
|
|||||||
|
|
||||||
$time = get_system_time ();
|
$time = get_system_time ();
|
||||||
$fields = array ();
|
$fields = array ();
|
||||||
$fields[$time - 7776000] = __('Purge event data over 90 days');
|
$fields[$time - SECONDS_3MONTHS] = __('Purge event data over 90 days');
|
||||||
$fields[$time - 2592000] = __('Purge event data over 30 days');
|
$fields[$time - SECONDS_1MONTH] = __('Purge event data over 30 days');
|
||||||
$fields[$time - 1209600] = __('Purge event data over 14 days');
|
$fields[$time - SECONDS_2WEEK] = __('Purge event data over 14 days');
|
||||||
$fields[$time - 604800] = __('Purge event data over 7 days');
|
$fields[$time - SECONDS_1WEEK] = __('Purge event data over 7 days');
|
||||||
$fields[$time - 259200] = __('Purge event data over 3 days');
|
$fields[$time - (SECONDS_1WEEK * 3)] = __('Purge event data over 3 days');
|
||||||
$fields[$time - 86400] = __('Purge event data over 1 day');
|
$fields[$time - SECONDS_1DAY] = __('Purge event data over 1 day');
|
||||||
$fields[$time] = __('Purge all event data');
|
$fields[$time] = __('Purge all event data');
|
||||||
|
|
||||||
html_print_select ($fields, "date_purge", '', '', '', '0', false, false, false, "w255");
|
html_print_select ($fields, "date_purge", '', '', '', '0', false, false, false, "w255");
|
||||||
|
@ -43,24 +43,18 @@ echo '<h4>'.__('Get data from agent').'</h4>';
|
|||||||
|
|
||||||
// All data (now)
|
// All data (now)
|
||||||
$time["all"] = get_system_time ();
|
$time["all"] = get_system_time ();
|
||||||
|
|
||||||
// 1 day ago
|
// 1 day ago
|
||||||
$time["1day"] = $time["all"]-86400;
|
$time["1day"] = $time["all"] - SECONDS_1DAY;
|
||||||
|
|
||||||
// 3 days ago
|
// 3 days ago
|
||||||
$time["3day"] = $time["all"] - 259200;
|
$time["3day"] = $time["all"] - SECONDS_1DAY * 3;
|
||||||
|
|
||||||
// 1 week ago
|
// 1 week ago
|
||||||
$time["1week"] = $time["all"] - 604800;
|
$time["1week"] = $time["all"] - SECONDS_1WEEK;
|
||||||
|
|
||||||
// 2 weeks ago
|
// 2 weeks ago
|
||||||
$time["2week"] = $time["all"] - 1209600;
|
$time["2week"] = $time["all"] - SECONDS_1WEEK * 2;
|
||||||
|
|
||||||
// 1 month ago
|
// 1 month ago
|
||||||
$time["1month"] = $time["all"] - 2592000;
|
$time["1month"] = $time["all"] - SECONDS_1MONTH;
|
||||||
|
|
||||||
// Three months ago
|
// Three months ago
|
||||||
$time["3month"] = $time["all"] - 7776000;
|
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
|
||||||
|
|
||||||
//Init data
|
//Init data
|
||||||
$data["1day"] = 0;
|
$data["1day"] = 0;
|
||||||
@ -137,7 +131,8 @@ if (isset($_POST["purgedb"])) {
|
|||||||
|
|
||||||
echo __('Total records deleted: ') . $affected;
|
echo __('Total records deleted: ') . $affected;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
//All agents
|
//All agents
|
||||||
echo __('Deleting records for all agents');
|
echo __('Deleting records for all agents');
|
||||||
flush ();
|
flush ();
|
||||||
@ -166,7 +161,8 @@ echo '</noscript><br />';
|
|||||||
|
|
||||||
if ($id_agent > 0) {
|
if ($id_agent > 0) {
|
||||||
$title = __('Information on agent %s in the database', agents_get_name ($id_agent));
|
$title = __('Information on agent %s in the database', agents_get_name ($id_agent));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$title = __('Information on all agents in the database');
|
$title = __('Information on all agents in the database');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,6 +167,12 @@ define('SERVICE_STATUS_UNKNOW', -1);
|
|||||||
define('SERVICE_STATUS_NORMAL', 0);
|
define('SERVICE_STATUS_NORMAL', 0);
|
||||||
define('SERVICE_STATUS_CRITICAL', 1);
|
define('SERVICE_STATUS_CRITICAL', 1);
|
||||||
define('SERVICE_STATUS_WARNING', 2);
|
define('SERVICE_STATUS_WARNING', 2);
|
||||||
|
//Default weights
|
||||||
|
define('SERVICE_WEIGHT_CRITICAL', 1);
|
||||||
|
define('SERVICE_WEIGHT_WARNING', 0.5);
|
||||||
|
define('SERVICE_ELEMENT_WEIGHT_CRITICAL', 1);
|
||||||
|
define('SERVICE_ELEMENT_WEIGHT_WARNING', 0.5);
|
||||||
|
define('SERVICE_ELEMENT_WEIGHT_OK', 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -405,6 +405,10 @@ function set_user_language() {
|
|||||||
*/
|
*/
|
||||||
function human_time_description_raw ($seconds, $exactly = false, $units = 'large') {
|
function human_time_description_raw ($seconds, $exactly = false, $units = 'large') {
|
||||||
|
|
||||||
|
//Miguel: I think that I can kill this unicorns and magical numbers
|
||||||
|
// because this function may call without loaded the
|
||||||
|
// constants.php file.
|
||||||
|
|
||||||
switch ($units) {
|
switch ($units) {
|
||||||
case 'large':
|
case 'large':
|
||||||
$secondsString = __('seconds');
|
$secondsString = __('seconds');
|
||||||
|
@ -295,7 +295,7 @@ function config_process_config () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) {
|
if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) {
|
||||||
config_update_value ('sla_period', 604800);
|
config_update_value ('sla_period', SECONDS_1WEEK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config["prominent_time"])) {
|
if (!isset ($config["prominent_time"])) {
|
||||||
|
@ -1071,25 +1071,22 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
|
|||||||
if ($id_agent < 1) {
|
if ($id_agent < 1) {
|
||||||
$id_agent = -1;
|
$id_agent = -1;
|
||||||
$query = "";
|
$query = "";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$modules = agents_get_modules ($id_agent);
|
$modules = agents_get_modules ($id_agent);
|
||||||
$query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules)));
|
$query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// All data (now)
|
// All data (now)
|
||||||
$time["all"] = get_system_time ();
|
$time["all"] = get_system_time ();
|
||||||
|
|
||||||
// 1 day ago
|
// 1 day ago
|
||||||
$time["1day"] = $time["all"] - 86400;
|
$time["1day"] = $time["all"] - SECONDS_1DAY;
|
||||||
|
|
||||||
// 1 week ago
|
// 1 week ago
|
||||||
$time["1week"] = $time["all"] - 604800;
|
$time["1week"] = $time["all"] - SECONDS_1WEEK;
|
||||||
|
|
||||||
// 1 month ago
|
// 1 month ago
|
||||||
$time["1month"] = $time["all"] - 2592000;
|
$time["1month"] = $time["all"] - SECONDS_1MONTH;
|
||||||
|
|
||||||
// Three months ago
|
// Three months ago
|
||||||
$time["3month"] = $time["all"] - 7776000;
|
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
|
||||||
|
|
||||||
$data[__("Today")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query), 0, true);
|
$data[__("Today")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query), 0, true);
|
||||||
$data["1 ".__("Week")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query), 0, true);
|
$data["1 ".__("Week")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query), 0, true);
|
||||||
@ -1493,10 +1490,12 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
|
|||||||
if (!isset ($data[__('Other')]))
|
if (!isset ($data[__('Other')]))
|
||||||
$data[__('Other')] = 0;
|
$data[__('Other')] = 0;
|
||||||
$data[__('Other')] += $row["count"];
|
$data[__('Other')] += $row["count"];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ($row["id_agente"] == 0) {
|
if ($row["id_agente"] == 0) {
|
||||||
$name = __('SYSTEM')." (".$row["count"].")";
|
$name = __('SYSTEM')." (".$row["count"].")";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
|
$name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
|
||||||
}
|
}
|
||||||
$data[$name] = $row["count"];
|
$data[$name] = $row["count"];
|
||||||
@ -1718,7 +1717,8 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||||||
$bottom = $datelimit + ($periodtime * $i);
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
$name = date('H\h', $bottom);
|
$name = date('H\h', $bottom);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$name = $bottom;
|
$name = $bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1737,11 +1737,14 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||||||
if (!empty($event['utimestamp'])){
|
if (!empty($event['utimestamp'])){
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
switch ($event['criticity']) {
|
switch ($event['criticity']) {
|
||||||
case 3: $data[$cont]['data'] = 2;
|
case 3:
|
||||||
|
$data[$cont]['data'] = 2;
|
||||||
break;
|
break;
|
||||||
case 4: $data[$cont]['data'] = 3;
|
case 4:
|
||||||
|
$data[$cont]['data'] = 3;
|
||||||
break;
|
break;
|
||||||
default:$data[$cont]['data'] = 1;
|
default:
|
||||||
|
$data[$cont]['data'] = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1755,8 +1758,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||||||
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
||||||
|
|
||||||
// Draw slicebar graph
|
// Draw slicebar graph
|
||||||
|
if ($config['flash_charts']) {
|
||||||
if($config['flash_charts']) {
|
|
||||||
echo flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
echo flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1765,7 +1767,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||||||
// Draw legend
|
// Draw legend
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
echo " ";
|
echo " ";
|
||||||
foreach ($legend as $hour){
|
foreach ($legend as $hour) {
|
||||||
echo "<span style='font-size: 6pt'>" . $hour . "</span>";
|
echo "<span style='font-size: 6pt'>" . $hour . "</span>";
|
||||||
echo " ";
|
echo " ";
|
||||||
}
|
}
|
||||||
@ -1783,6 +1785,7 @@ function fs_error_image () {
|
|||||||
function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
||||||
$width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0,
|
$width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0,
|
||||||
$date = 0, $only_image = false, $homeurl = '', $adapt_key) {
|
$date = 0, $only_image = false, $homeurl = '', $adapt_key) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
@ -1830,7 +1833,8 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
$min_necessary = 1;
|
$min_necessary = 1;
|
||||||
|
|
||||||
// Compressed module data
|
// Compressed module data
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Get previous data
|
// Get previous data
|
||||||
$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
|
$previous_data = modules_get_previous_data ($agent_module_id, $datelimit);
|
||||||
if ($previous_data !== false) {
|
if ($previous_data !== false) {
|
||||||
@ -1842,7 +1846,8 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
$nextData = modules_get_next_data ($agent_module_id, $date);
|
$nextData = modules_get_next_data ($agent_module_id, $date);
|
||||||
if ($nextData !== false) {
|
if ($nextData !== false) {
|
||||||
array_push ($data, $nextData);
|
array_push ($data, $nextData);
|
||||||
} else if (count ($data) > 0) {
|
}
|
||||||
|
else if (count ($data) > 0) {
|
||||||
// Propagate the last known data to the end of the interval
|
// Propagate the last known data to the end of the interval
|
||||||
$nextData = array_pop ($data);
|
$nextData = array_pop ($data);
|
||||||
array_push ($data, $nextData);
|
array_push ($data, $nextData);
|
||||||
@ -1878,7 +1883,8 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
if ($data[0]['utimestamp'] == $datelimit) {
|
if ($data[0]['utimestamp'] == $datelimit) {
|
||||||
$previous_data = $data[0]['datos'];
|
$previous_data = $data[0]['datos'];
|
||||||
$j++;
|
$j++;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$previous_data = 0;
|
$previous_data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1891,10 +1897,13 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
// Read data that falls in the current interval
|
// Read data that falls in the current interval
|
||||||
while (isset ($data[$j]) && $data[$j]['utimestamp'] >= $timestamp && $data[$j]['utimestamp'] <= ($timestamp + $interval)) {
|
while (isset ($data[$j]) &&
|
||||||
|
$data[$j]['utimestamp'] >= $timestamp &&
|
||||||
|
$data[$j]['utimestamp'] <= ($timestamp + $interval)) {
|
||||||
if ($data[$j]['datos'] == 0) {
|
if ($data[$j]['datos'] == 0) {
|
||||||
$zero = 1;
|
$zero = 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$total += $data[$j]['datos'];
|
$total += $data[$j]['datos'];
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
@ -1910,7 +1919,9 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
// Read events and alerts that fall in the current interval
|
// Read events and alerts that fall in the current interval
|
||||||
$event_value = 0;
|
$event_value = 0;
|
||||||
$alert_value = 0;
|
$alert_value = 0;
|
||||||
while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] < ($timestamp + $interval)) {
|
while (isset ($events[$k]) &&
|
||||||
|
$events[$k]['utimestamp'] >= $timestamp &&
|
||||||
|
$events[$k]['utimestamp'] < ($timestamp + $interval)) {
|
||||||
if ($show_events == 1) {
|
if ($show_events == 1) {
|
||||||
$event_value++;
|
$event_value++;
|
||||||
}
|
}
|
||||||
@ -1921,16 +1932,16 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the title and time format
|
// Set the title and time format
|
||||||
if ($period <= 21600) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
$time_format = 'H:i:s';
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($period < SECONDS_1DAY) {
|
||||||
$time_format = 'H:i';
|
$time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
$time_format = 'M d H:i';
|
$time_format = 'M d H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 2592000) {
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
$time_format = 'M d H\h';
|
$time_format = 'M d H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1960,26 +1971,24 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
'alert' => $alert_value);
|
'alert' => $alert_value);
|
||||||
}
|
}
|
||||||
$previous_data = 0;
|
$previous_data = 0;
|
||||||
// Just zeros
|
}
|
||||||
} else if ($zero == 1) {
|
else if ($zero == 1) { // Just zeros
|
||||||
$chart[$timestamp]['sum'] = 0;
|
$chart[$timestamp]['sum'] = 0;
|
||||||
$previous_data = 0;
|
$previous_data = 0;
|
||||||
// No zeros
|
}
|
||||||
} else if ($count > 0) {
|
else if ($count > 0) { // No zeros
|
||||||
$chart[$timestamp]['sum'] = $total;
|
$chart[$timestamp]['sum'] = $total;
|
||||||
$previous_data = $total;
|
$previous_data = $total;
|
||||||
// Compressed data
|
}
|
||||||
} else {
|
else { // Compressed data
|
||||||
if ($uncompressed_module || ($timestamp > time ())) {
|
if ($uncompressed_module || ($timestamp > time ())) {
|
||||||
$chart[$timestamp]['sum'] = 0;
|
$chart[$timestamp]['sum'] = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$chart[$timestamp]['sum'] = $previous_data;
|
$chart[$timestamp]['sum'] = $previous_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$chart[$timestamp]['count'] = 0;
|
|
||||||
//$chart[$timestamp]['timestamp_bottom'] = $timestamp;
|
|
||||||
//$chart[$timestamp]['timestamp_top'] = $timestamp + $interval;
|
|
||||||
if (!$avg_only) {
|
if (!$avg_only) {
|
||||||
$chart[$timestamp]['min'] = 0;
|
$chart[$timestamp]['min'] = 0;
|
||||||
$chart[$timestamp]['max'] = 0;
|
$chart[$timestamp]['max'] = 0;
|
||||||
@ -1996,9 +2005,6 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
else {
|
else {
|
||||||
unset($chart[$timestamp]['alert']);
|
unset($chart[$timestamp]['alert']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get min, max and avg (less efficient but centralized for all modules and reports)
|
// Get min, max and avg (less efficient but centralized for all modules and reports)
|
||||||
@ -2009,7 +2015,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
// Fix event and alert scale
|
// Fix event and alert scale
|
||||||
$event_max = $max_value * 1.25;
|
$event_max = $max_value * 1.25;
|
||||||
foreach ($chart as $timestamp => $chart_data) {
|
foreach ($chart as $timestamp => $chart_data) {
|
||||||
if($show_events) {
|
if ($show_events) {
|
||||||
if ($chart_data['event'] > 0) {
|
if ($chart_data['event'] > 0) {
|
||||||
$chart[$timestamp]['event'] = $event_max;
|
$chart[$timestamp]['event'] = $event_max;
|
||||||
}
|
}
|
||||||
@ -2022,16 +2028,16 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
|
|||||||
}
|
}
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
// Set the title and time format
|
// Set the title and time format
|
||||||
if ($period <= 21600) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
$time_format = 'H:i:s';
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($period < SECONDS_1DAY) {
|
||||||
$time_format = 'H:i';
|
$time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
$time_format = 'M d H:i';
|
$time_format = 'M d H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 2592000) {
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
$time_format = 'M d H\h';
|
$time_format = 'M d H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2098,16 +2104,16 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_im
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($period <= 21600) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
$chart_time_format = 'H:i:s';
|
$chart_time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($period < SECONDS_1DAY) {
|
||||||
$chart_time_format = 'H:i';
|
$chart_time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
$chart_time_format = 'M d H:i';
|
$chart_time_format = 'M d H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 2592000) {
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
$chart_time_format = 'M d H\h';
|
$chart_time_format = 'M d H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2143,7 +2149,8 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $only_im
|
|||||||
|
|
||||||
if ($config['homeurl'] != '') {
|
if ($config['homeurl'] != '') {
|
||||||
$homeurl = $config['homeurl'] . '/';
|
$homeurl = $config['homeurl'] . '/';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$homeurl = '';
|
$homeurl = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2170,16 +2177,16 @@ function graph_netflow_total_area ($data, $period, $width, $height, $only_image)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($period <= 21600) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
$chart_time_format = 'H:i:s';
|
$chart_time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($period < SECONDS_1DAY) {
|
||||||
$chart_time_format = 'H:i';
|
$chart_time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
$chart_time_format = 'M d H:i';
|
$chart_time_format = 'M d H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 2592000) {
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
$chart_time_format = 'M d H\h';
|
$chart_time_format = 'M d H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2199,7 +2206,8 @@ function graph_netflow_total_area ($data, $period, $width, $height, $only_image)
|
|||||||
|
|
||||||
if ($config['homeurl'] != '') {
|
if ($config['homeurl'] != '') {
|
||||||
$homeurl = $config['homeurl'] . '/';
|
$homeurl = $config['homeurl'] . '/';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$homeurl = '';
|
$homeurl = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2231,7 +2239,8 @@ function graph_netflow_aggregate_pie ($data, $aggregate) {
|
|||||||
$agg = $data[$i]['agg'];
|
$agg = $data[$i]['agg'];
|
||||||
if (!isset($values[$agg])){
|
if (!isset($values[$agg])){
|
||||||
$values[$agg] = $data[$i]['data'];
|
$values[$agg] = $data[$i]['data'];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$values[$agg] += $data[$i]['data'];
|
$values[$agg] += $data[$i]['data'];
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -2264,7 +2273,8 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
// Set variables
|
// Set variables
|
||||||
if ($date == 0) $date = get_system_time();
|
if ($date == 0)
|
||||||
|
$date = get_system_time();
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
||||||
$interval = (int) ($period / $resolution);
|
$interval = (int) ($period / $resolution);
|
||||||
@ -2305,9 +2315,10 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
// Uncompressed module data
|
// Uncompressed module data
|
||||||
if ($uncompressed_module) {
|
if ($uncompressed_module) {
|
||||||
$min_necessary = 1;
|
$min_necessary = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Compressed module data
|
// Compressed module data
|
||||||
} else {
|
|
||||||
// Get previous data
|
// Get previous data
|
||||||
$previous_data = modules_get_previous_data ($agent_module_id, $datelimit, 1);
|
$previous_data = modules_get_previous_data ($agent_module_id, $datelimit, 1);
|
||||||
if ($previous_data !== false) {
|
if ($previous_data !== false) {
|
||||||
@ -2319,7 +2330,8 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
$nextData = modules_get_next_data ($agent_module_id, $date, 1);
|
$nextData = modules_get_next_data ($agent_module_id, $date, 1);
|
||||||
if ($nextData !== false) {
|
if ($nextData !== false) {
|
||||||
array_push ($data, $nextData);
|
array_push ($data, $nextData);
|
||||||
} else if (count ($data) > 0) {
|
}
|
||||||
|
else if (count ($data) > 0) {
|
||||||
// Propagate the last known data to the end of the interval
|
// Propagate the last known data to the end of the interval
|
||||||
$nextData = array_pop ($data);
|
$nextData = array_pop ($data);
|
||||||
array_push ($data, $nextData);
|
array_push ($data, $nextData);
|
||||||
@ -2349,7 +2361,8 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
if ($data[0]['utimestamp'] == $datelimit) {
|
if ($data[0]['utimestamp'] == $datelimit) {
|
||||||
$previous_data = 1;
|
$previous_data = 1;
|
||||||
$j++;
|
$j++;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$previous_data = 0;
|
$previous_data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2380,16 +2393,16 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Set the title and time format
|
// Set the title and time format
|
||||||
if ($period <= 21600) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
$time_format = 'H:i:s';
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($period < SECONDS_1DAY) {
|
||||||
$time_format = 'H:i';
|
$time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
$time_format = 'M d H:i';
|
$time_format = 'M d H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 2592000) {
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
$time_format = 'M d H\h';
|
$time_format = 'M d H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2406,14 +2419,12 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$chart[$timestamp]['sum'] = $count;
|
$chart[$timestamp]['sum'] = $count;
|
||||||
$previous_data = $total;
|
$previous_data = $total;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Compressed data
|
// Compressed data
|
||||||
} else {
|
|
||||||
$chart[$timestamp]['sum'] = $previous_data;
|
$chart[$timestamp]['sum'] = $previous_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$chart[$timestamp]['count'] = 0;
|
|
||||||
//$chart[$timestamp]['timestamp_bottom'] = $timestamp;
|
|
||||||
//$chart[$timestamp]['timestamp_top'] = $timestamp + $interval;
|
|
||||||
$chart[$timestamp]['min'] = 0;
|
$chart[$timestamp]['min'] = 0;
|
||||||
$chart[$timestamp]['max'] = 0;
|
$chart[$timestamp]['max'] = 0;
|
||||||
$chart[$timestamp]['event'] = $event_value;
|
$chart[$timestamp]['event'] = $event_value;
|
||||||
@ -2469,6 +2480,116 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
|
|||||||
$config['fontpath'], $config['font_size'], $unit, 1, array(), array(), 0, 0, $adapt_key, true);
|
$config['fontpath'], $config['font_size'], $unit, 1, array(), array(), 0, 0, $adapt_key, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a graph with event data of module
|
||||||
|
*
|
||||||
|
* @param integer id_module Module ID
|
||||||
|
* @param integer width graph width
|
||||||
|
* @param integer height graph height
|
||||||
|
* @param integer period time period
|
||||||
|
* @param string homeurl Home url if the complete path is needed
|
||||||
|
* @param int Zoom factor over the graph
|
||||||
|
* @param string adaptation width and margin left key (could be adapter_[something] or adapted_[something])
|
||||||
|
*/
|
||||||
|
function graphic_module_events ($id_module, $width, $height, $period = 0, $homeurl = '', $zoom = 0, $adapt_key = '') {
|
||||||
|
global $config;
|
||||||
|
global $graphic_type;
|
||||||
|
|
||||||
|
$data = array ();
|
||||||
|
|
||||||
|
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
|
|
||||||
|
$interval = (int) ($period / $resolution);
|
||||||
|
$date = get_system_time ();
|
||||||
|
$datelimit = $date - $period;
|
||||||
|
$periodtime = floor ($period / $interval);
|
||||||
|
$time = array ();
|
||||||
|
$data = array ();
|
||||||
|
|
||||||
|
// Set the title and time format
|
||||||
|
if ($period <= SECONDS_6HOURS) {
|
||||||
|
$time_format = 'H:i:s';
|
||||||
|
}
|
||||||
|
elseif ($period < SECONDS_1DAY) {
|
||||||
|
$time_format = 'H:i';
|
||||||
|
}
|
||||||
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
|
$time_format = 'M d H:i';
|
||||||
|
}
|
||||||
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
|
$time_format = 'M d H\h';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$time_format = 'M d H\h';
|
||||||
|
}
|
||||||
|
|
||||||
|
$legend = array();
|
||||||
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
|
if (! $graphic_type) {
|
||||||
|
$name = date($time_format, $bottom);
|
||||||
|
//$name = date('H\h', $bottom);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$name = $bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
$top = $datelimit + ($periodtime * ($i + 1));
|
||||||
|
|
||||||
|
|
||||||
|
$event = db_get_row_filter ('tevento',
|
||||||
|
array ('id_agentmodule' => $id_module,
|
||||||
|
'utimestamp > '.$bottom,
|
||||||
|
'utimestamp < '.$top), 'criticity, utimestamp');
|
||||||
|
|
||||||
|
if (!empty($event['utimestamp'])){
|
||||||
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
|
switch ($event['criticity']) {
|
||||||
|
case 3:
|
||||||
|
$data[$cont]['data'] = 2;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
$data[$cont]['data'] = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$data[$cont]['data'] = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$current_timestamp = $event['utimestamp'];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
|
$data[$cont]['data'] = 1;
|
||||||
|
$current_timestamp = $bottom;
|
||||||
|
}
|
||||||
|
$legend[] = date($time_format, $current_timestamp);
|
||||||
|
$cont++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pixels_between_xdata = 25;
|
||||||
|
$max_xdata_display = round($width / $pixels_between_xdata);
|
||||||
|
$ndata = count($data);
|
||||||
|
if($max_xdata_display > $ndata) {
|
||||||
|
$xdata_display = $ndata;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$xdata_display = $max_xdata_display;
|
||||||
|
}
|
||||||
|
|
||||||
|
$step = round($ndata/$xdata_display);
|
||||||
|
|
||||||
|
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
||||||
|
|
||||||
|
// Draw slicebar graph
|
||||||
|
if($config['flash_charts']) {
|
||||||
|
echo flot_slicesbar_graph($data, $period, $width, 15, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///Functions for the LOG4X graphs
|
||||||
function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
|
function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
|
||||||
$width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0,
|
$width, $height , $title, $unit_name, $show_alert, $avg_only = 0, $pure=0,
|
||||||
$date = 0) {
|
$date = 0) {
|
||||||
@ -2486,22 +2607,16 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
|
|||||||
$nombre_modulo = modules_get_agentmodule_name ($id_agente_modulo);
|
$nombre_modulo = modules_get_agentmodule_name ($id_agente_modulo);
|
||||||
$id_agente = agents_get_agent_id ($nombre_agente);
|
$id_agente = agents_get_agent_id ($nombre_agente);
|
||||||
|
|
||||||
$one_second = 1;
|
$adjust_time = SECONDS_1MINUTE;
|
||||||
$one_minute = 60 * $one_second;
|
|
||||||
$one_hour = 60 * $one_minute;
|
|
||||||
$one_day = 24 * $one_hour;
|
|
||||||
$one_week = 7 * $one_day;
|
|
||||||
|
|
||||||
$adjust_time = $one_minute; // 60 secs
|
if ($periodo == SECONDS_1DAY)
|
||||||
|
$adjust_time = SECONDS_1HOUR;
|
||||||
if ($periodo == 86400) // day
|
elseif ($periodo == SECONDS_1WEEK)
|
||||||
$adjust_time = $one_hour;
|
$adjust_time = SECONDS_1DAY;
|
||||||
elseif ($periodo == 604800) // week
|
elseif ($periodo == SECONDS_1HOUR)
|
||||||
$adjust_time =$one_day;
|
$adjust_time = SECONDS_10MINUTES;
|
||||||
elseif ($periodo == 3600) // hour
|
elseif ($periodo == SECONDS_1MONTH)
|
||||||
$adjust_time = 10 * $one_minute;
|
$adjust_time = SECONDS_1WEEK;
|
||||||
elseif ($periodo == 2419200) // month
|
|
||||||
$adjust_time = $one_week;
|
|
||||||
else
|
else
|
||||||
$adjust_time = $periodo / 12.0;
|
$adjust_time = $periodo / 12.0;
|
||||||
|
|
||||||
@ -2577,20 +2692,20 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
|
|||||||
|
|
||||||
$Graph->setFont($Font);
|
$Graph->setFont($Font);
|
||||||
|
|
||||||
if ($periodo == 86400)
|
if ($periodo == SECONDS_1DAY)
|
||||||
$title_period = $lang_label["last_day"];
|
$title_period = $lang_label["last_day"];
|
||||||
elseif ($periodo == 604800)
|
elseif ($periodo == SECONDS_1WEEK)
|
||||||
$title_period = $lang_label["last_week"];
|
$title_period = $lang_label["last_week"];
|
||||||
elseif ($periodo == 3600)
|
elseif ($periodo == SECONDS_1HOUR)
|
||||||
$title_period = $lang_label["last_hour"];
|
$title_period = $lang_label["last_hour"];
|
||||||
elseif ($periodo == 2419200)
|
elseif ($periodo == SECONDS_1MONTH)
|
||||||
$title_period = $lang_label["last_month"];
|
$title_period = $lang_label["last_month"];
|
||||||
else {
|
else {
|
||||||
$suffix = $lang_label["days"];
|
$suffix = $lang_label["days"];
|
||||||
$graph_extension = $periodo / (3600*24); // in days
|
$graph_extension = $periodo / SECONDS_1DAY;
|
||||||
|
|
||||||
if ($graph_extension < 1) {
|
if ($graph_extension < 1) {
|
||||||
$graph_extension = $periodo / (3600); // in hours
|
$graph_extension = $periodo / SECONDS_1HOUR;
|
||||||
$suffix = $lang_label["hours"];
|
$suffix = $lang_label["hours"];
|
||||||
}
|
}
|
||||||
//$title_period = "Last ";
|
//$title_period = "Last ";
|
||||||
@ -2625,7 +2740,8 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event,
|
|||||||
$Legend->setPlotarea($Plotarea);
|
$Legend->setPlotarea($Plotarea);
|
||||||
$Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
|
$Title->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
|
||||||
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
|
$Subtitle->setAlignment(IMAGE_GRAPH_ALIGN_LEFT);
|
||||||
} else { // Pure, without title and legends
|
}
|
||||||
|
else { // Pure, without title and legends
|
||||||
$Graph->add($Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis', 'Image_Graph_Axis')));
|
$Graph->add($Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis', 'Image_Graph_Axis')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2782,30 +2898,6 @@ function grafico_modulo_log4x_bubble_size($count, $max_count, $max_bubble_radius
|
|||||||
$v2 = pow($max_count,1/2.0);
|
$v2 = pow($max_count,1/2.0);
|
||||||
|
|
||||||
return $r1*pow($count,1/2.0)/($v2)+$r0;
|
return $r1*pow($count,1/2.0)/($v2)+$r0;
|
||||||
|
|
||||||
|
|
||||||
// Esta custion no sirve paaaaaaaaaaaa naaaaaaaaaaaaaaaadaaaaaaaaaaaaaa
|
|
||||||
//Cementerio de formulas ... QEPD
|
|
||||||
$a = pow(($r1 - $r0)/(pow($v2,1/4.0)-1),4);
|
|
||||||
$b = $r0 - pow($a,1/4.0);
|
|
||||||
|
|
||||||
return pow($a * $count, 1/4.0) + $b;
|
|
||||||
|
|
||||||
$r = pow($count / pow(3.1415, 3), 0.25);
|
|
||||||
|
|
||||||
$q = 0.9999;
|
|
||||||
$x = $count;
|
|
||||||
$x0 = $max_count;
|
|
||||||
$y0 = $max_size;
|
|
||||||
|
|
||||||
$y = 4 * $y0 * $x * (((1 - 2 * $q) / (2 * $x0))* $x + ((4 * $q - 1) / 4)) / $x0;
|
|
||||||
|
|
||||||
return $y;
|
|
||||||
|
|
||||||
return 3 * (0.3796434104 + pow($count * 0.2387394557, 0.333333333));
|
|
||||||
|
|
||||||
return sqrt($count / 3.1415);
|
|
||||||
return 5 + log($count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
|
function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
|
||||||
@ -2822,124 +2914,27 @@ function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point=
|
|||||||
|
|
||||||
function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
|
function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",")
|
||||||
{
|
{
|
||||||
$n = "";
|
|
||||||
|
|
||||||
switch($number) {
|
switch($number) {
|
||||||
case 6: $n = "FATAL"; break;
|
case 6:
|
||||||
case 5: $n = "ERROR"; break;
|
return "FATAL";
|
||||||
case 4: $n = "WARN"; break;
|
|
||||||
case 3: $n = "INFO"; break;
|
|
||||||
case 2: $n = "DEBUG"; break;
|
|
||||||
case 1: $n = "TRACE"; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "$n";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print a graph with event data of module
|
|
||||||
*
|
|
||||||
* @param integer id_module Module ID
|
|
||||||
* @param integer width graph width
|
|
||||||
* @param integer height graph height
|
|
||||||
* @param integer period time period
|
|
||||||
* @param string homeurl Home url if the complete path is needed
|
|
||||||
* @param int Zoom factor over the graph
|
|
||||||
* @param string adaptation width and margin left key (could be adapter_[something] or adapted_[something])
|
|
||||||
*/
|
|
||||||
function graphic_module_events ($id_module, $width, $height, $period = 0, $homeurl = '', $zoom = 0, $adapt_key = '') {
|
|
||||||
global $config;
|
|
||||||
global $graphic_type;
|
|
||||||
|
|
||||||
$data = array ();
|
|
||||||
|
|
||||||
$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
|
||||||
|
|
||||||
$interval = (int) ($period / $resolution);
|
|
||||||
$date = get_system_time ();
|
|
||||||
$datelimit = $date - $period;
|
|
||||||
$periodtime = floor ($period / $interval);
|
|
||||||
$time = array ();
|
|
||||||
$data = array ();
|
|
||||||
|
|
||||||
// Set the title and time format
|
|
||||||
if ($period <= 21600) {
|
|
||||||
$time_format = 'H:i:s';
|
|
||||||
}
|
|
||||||
elseif ($period < 86400) {
|
|
||||||
$time_format = 'H:i';
|
|
||||||
}
|
|
||||||
elseif ($period < 1296000) {
|
|
||||||
$time_format = "M d H:i";
|
|
||||||
}
|
|
||||||
elseif ($period < 2592000) {
|
|
||||||
$time_format = "M d H\h";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$time_format = "M d H\h";
|
|
||||||
}
|
|
||||||
|
|
||||||
$legend = array();
|
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
|
||||||
$bottom = $datelimit + ($periodtime * $i);
|
|
||||||
if (! $graphic_type) {
|
|
||||||
$name = date($time_format, $bottom);
|
|
||||||
//$name = date('H\h', $bottom);
|
|
||||||
} else {
|
|
||||||
$name = $bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
$top = $datelimit + ($periodtime * ($i + 1));
|
|
||||||
|
|
||||||
|
|
||||||
$event = db_get_row_filter ('tevento',
|
|
||||||
array ('id_agentmodule' => $id_module,
|
|
||||||
'utimestamp > '.$bottom,
|
|
||||||
'utimestamp < '.$top), 'criticity, utimestamp');
|
|
||||||
|
|
||||||
if (!empty($event['utimestamp'])){
|
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
|
||||||
switch ($event['criticity']) {
|
|
||||||
case 3: $data[$cont]['data'] = 2;
|
|
||||||
break;
|
break;
|
||||||
case 4: $data[$cont]['data'] = 3;
|
case 5:
|
||||||
|
return "ERROR";
|
||||||
break;
|
break;
|
||||||
default:$data[$cont]['data'] = 1;
|
case 4:
|
||||||
|
return "WARN";
|
||||||
break;
|
break;
|
||||||
}
|
case 3:
|
||||||
$current_timestamp = $event['utimestamp'];
|
return "INFO";
|
||||||
}
|
break;
|
||||||
else{
|
case 2:
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
return "DEBUG";
|
||||||
$data[$cont]['data'] = 1;
|
break;
|
||||||
$current_timestamp = $bottom;
|
case 1:
|
||||||
}
|
return "TRACE";
|
||||||
$legend[] = date($time_format, $current_timestamp);
|
break;
|
||||||
$cont++;
|
default:
|
||||||
|
return "";
|
||||||
}
|
|
||||||
|
|
||||||
$pixels_between_xdata = 25;
|
|
||||||
$max_xdata_display = round($width / $pixels_between_xdata);
|
|
||||||
$ndata = count($data);
|
|
||||||
if($max_xdata_display > $ndata) {
|
|
||||||
$xdata_display = $ndata;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$xdata_display = $max_xdata_display;
|
|
||||||
}
|
|
||||||
|
|
||||||
$step = round($ndata/$xdata_display);
|
|
||||||
|
|
||||||
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
|
||||||
|
|
||||||
// Draw slicebar graph
|
|
||||||
if($config['flash_charts']) {
|
|
||||||
echo flot_slicesbar_graph($data, $period, $width, 15, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -35,6 +35,7 @@ function netflow_get_filters ($filter = false) {
|
|||||||
else {
|
else {
|
||||||
$filters = db_get_all_rows_filter ("tnetflow_filter", $filter);
|
$filters = db_get_all_rows_filter ("tnetflow_filter", $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = array ();
|
$return = array ();
|
||||||
if ($filters === false) {
|
if ($filters === false) {
|
||||||
return $return;
|
return $return;
|
||||||
@ -60,6 +61,7 @@ function netflow_get_reports ($filter = false) {
|
|||||||
else {
|
else {
|
||||||
$filters = db_get_all_rows_filter ("tnetflow_report", $filter);
|
$filters = db_get_all_rows_filter ("tnetflow_report", $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = array ();
|
$return = array ();
|
||||||
if ($filters === false) {
|
if ($filters === false) {
|
||||||
return $return;
|
return $return;
|
||||||
@ -126,9 +128,9 @@ function netflow_check_report_group ($id_report, $mode=false) {
|
|||||||
* @return array A netflow filter matching id and filter.
|
* @return array A netflow filter matching id and filter.
|
||||||
*/
|
*/
|
||||||
function netflow_filter_get_filter ($id_sg, $filter = false, $fields = false) {
|
function netflow_filter_get_filter ($id_sg, $filter = false, $fields = false) {
|
||||||
|
|
||||||
if (! is_array ($filter))
|
if (! is_array ($filter))
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
|
|
||||||
$filter['id_sg'] = (int) $id_sg;
|
$filter['id_sg'] = (int) $id_sg;
|
||||||
|
|
||||||
return db_get_row_filter ('tnetflow_filter', $filter, $fields);
|
return db_get_row_filter ('tnetflow_filter', $filter, $fields);
|
||||||
@ -238,16 +240,16 @@ function netflow_data_table ($data, $start_date, $end_date, $aggregate) {
|
|||||||
$end_date = date ($nfdump_date_format, $end_date);
|
$end_date = date ($nfdump_date_format, $end_date);
|
||||||
|
|
||||||
// Set the format
|
// Set the format
|
||||||
if ($period <= 21600) {
|
if ($period <= SECONDS_6HOURS) {
|
||||||
$time_format = 'H:i:s';
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($period < 86400) {
|
elseif ($period < SECONDS_1DAY) {
|
||||||
$time_format = 'H:i';
|
$time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 1296000) {
|
elseif ($period < SECONDS_15DAYS) {
|
||||||
$time_format = 'M d H:i';
|
$time_format = 'M d H:i';
|
||||||
}
|
}
|
||||||
elseif ($period < 2592000) {
|
elseif ($period < SECONDS_1MONTH) {
|
||||||
$time_format = 'M d H\h';
|
$time_format = 'M d H\h';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -338,7 +340,8 @@ function netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggreg
|
|||||||
$val = explode(' ',$line);
|
$val = explode(' ',$line);
|
||||||
$values['sources'][$val[4]] = 1;
|
$values['sources'][$val[4]] = 1;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$values = array ();
|
$values = array ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,6 +430,7 @@ function netflow_get_stats ($start_date, $end_date, $command, $aggregate, $max,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort_netflow_data ($values);
|
sort_netflow_data ($values);
|
||||||
|
|
||||||
return $values;
|
return $values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +487,8 @@ function netflow_get_filter_arguments ($filter) {
|
|||||||
|
|
||||||
if (netflow_is_net ($val_ipdst[$i]) == 0) {
|
if (netflow_is_net ($val_ipdst[$i]) == 0) {
|
||||||
$filter_args .= 'dst ip '.$val_ipdst[$i];
|
$filter_args .= 'dst ip '.$val_ipdst[$i];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$filter_args .= 'dst net '.$val_ipdst[$i];
|
$filter_args .= 'dst net '.$val_ipdst[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -492,7 +497,8 @@ function netflow_get_filter_arguments ($filter) {
|
|||||||
if ($filter['ip_src'] != ''){
|
if ($filter['ip_src'] != ''){
|
||||||
if ($filter_args == '') {
|
if ($filter_args == '') {
|
||||||
$filter_args .= ' "(';
|
$filter_args .= ' "(';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$filter_args .= ' and (';
|
$filter_args .= ' and (';
|
||||||
}
|
}
|
||||||
$val_ipsrc = explode(',', $filter['ip_src']);
|
$val_ipsrc = explode(',', $filter['ip_src']);
|
||||||
@ -503,7 +509,8 @@ function netflow_get_filter_arguments ($filter) {
|
|||||||
|
|
||||||
if (netflow_is_net ($val_ipsrc[$i]) == 0) {
|
if (netflow_is_net ($val_ipsrc[$i]) == 0) {
|
||||||
$filter_args .= 'src ip '.$val_ipsrc[$i];
|
$filter_args .= 'src ip '.$val_ipsrc[$i];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$filter_args .= 'src net '.$val_ipsrc[$i];
|
$filter_args .= 'src net '.$val_ipsrc[$i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -512,7 +519,8 @@ function netflow_get_filter_arguments ($filter) {
|
|||||||
if ($filter['dst_port'] != 0) {
|
if ($filter['dst_port'] != 0) {
|
||||||
if ($filter_args == '') {
|
if ($filter_args == '') {
|
||||||
$filter_args .= ' "(';
|
$filter_args .= ' "(';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$filter_args .= ' and (';
|
$filter_args .= ' and (';
|
||||||
}
|
}
|
||||||
$val_dstport = explode(',', $filter['dst_port']);
|
$val_dstport = explode(',', $filter['dst_port']);
|
||||||
@ -527,7 +535,8 @@ function netflow_get_filter_arguments ($filter) {
|
|||||||
if ($filter['src_port'] != 0) {
|
if ($filter['src_port'] != 0) {
|
||||||
if ($filter_args == '') {
|
if ($filter_args == '') {
|
||||||
$filter_args .= ' "(';
|
$filter_args .= ' "(';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$filter_args .= ' and (';
|
$filter_args .= ' and (';
|
||||||
}
|
}
|
||||||
$val_srcport = explode(',', $filter['src_port']);
|
$val_srcport = explode(',', $filter['src_port']);
|
||||||
@ -586,7 +595,8 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
|
|||||||
if ($aggregate != 'none') {
|
if ($aggregate != 'none') {
|
||||||
$interval_total = array ();
|
$interval_total = array ();
|
||||||
$interval_count = array ();
|
$interval_count = array ();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$interval_total = 0;
|
$interval_total = 0;
|
||||||
$interval_count = 0;
|
$interval_count = 0;
|
||||||
}
|
}
|
||||||
@ -610,7 +620,7 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
|
|||||||
$flow['date'] = $val[0];
|
$flow['date'] = $val[0];
|
||||||
$flow['time'] = $val[1];
|
$flow['time'] = $val[1];
|
||||||
|
|
||||||
switch ($aggregate){
|
switch ($aggregate) {
|
||||||
case "proto":
|
case "proto":
|
||||||
$flow['agg'] = $val[3];
|
$flow['agg'] = $val[3];
|
||||||
break;
|
break;
|
||||||
@ -657,12 +667,14 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
|
|||||||
$interval_total[$flow['agg']] += $flow['data'];
|
$interval_total[$flow['agg']] += $flow['data'];
|
||||||
$interval_count[$flow['agg']] += 1;
|
$interval_count[$flow['agg']] += 1;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$interval_total += $flow['data'];
|
$interval_total += $flow['data'];
|
||||||
$interval_count += 1;
|
$interval_count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while ($read_flag == 1);
|
}
|
||||||
|
while ($read_flag == 1);
|
||||||
|
|
||||||
if ($aggregate != 'none') {
|
if ($aggregate != 'none') {
|
||||||
foreach ($interval_total as $agg => $val) {
|
foreach ($interval_total as $agg => $val) {
|
||||||
@ -675,7 +687,8 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
|
|||||||
// Read previous data for this interval
|
// Read previous data for this interval
|
||||||
if (isset ($values['data'][$timestamp][$agg])) {
|
if (isset ($values['data'][$timestamp][$agg])) {
|
||||||
$previous_value = $values['data'][$timestamp][$agg];
|
$previous_value = $values['data'][$timestamp][$agg];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$previous_value = 0;
|
$previous_value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +700,8 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
|
|||||||
$values['data'][$timestamp][$agg] = (int) (($values['data'][$timestamp][$agg] + $previous_data) / 2);
|
$values['data'][$timestamp][$agg] = (int) (($values['data'][$timestamp][$agg] + $previous_data) / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
// No data for this interval
|
// No data for this interval
|
||||||
if ($interval_count == 0) {
|
if ($interval_count == 0) {
|
||||||
@ -697,7 +711,8 @@ function netflow_parse_file ($start_date, $end_date, $file, &$values, $aggregate
|
|||||||
// Read previous data for this interval
|
// Read previous data for this interval
|
||||||
if (isset ($values[$timestamp]['data'])) {
|
if (isset ($values[$timestamp]['data'])) {
|
||||||
$previous_value = $values[$timestamp]['data'];
|
$previous_value = $values[$timestamp]['data'];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$previous_value = 0;
|
$previous_value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,5 +907,4 @@ function netflow_draw_item ($start_date, $end_date, $type, $filter, $command, $f
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -270,6 +270,7 @@ function ui_print_message ($message, $class = '', $attributes = '', $return = fa
|
|||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
return $output;
|
return $output;
|
||||||
|
else
|
||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +343,9 @@ function ui_print_result_message ($result, $good = '', $bad = '', $attributes =
|
|||||||
if (empty ($result)) {
|
if (empty ($result)) {
|
||||||
return ui_print_error_message ($bad, $attributes, $return, $tag);
|
return ui_print_error_message ($bad, $attributes, $return, $tag);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return ui_print_success_message ($good, $attributes, $return, $tag);
|
return ui_print_success_message ($good, $attributes, $return, $tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -823,7 +826,8 @@ function ui_print_string_substr ($string, $cutoff = 16, $return = false, $fontsi
|
|||||||
$string2 = io_safe_output ($string);
|
$string2 = io_safe_output ($string);
|
||||||
if (mb_strlen($string2, "UTF-8") > $cutoff){
|
if (mb_strlen($string2, "UTF-8") > $cutoff){
|
||||||
$string3 = "...";
|
$string3 = "...";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$string3 = "";
|
$string3 = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1298,7 +1302,8 @@ function ui_process_page_head ($string, $bitfield) {
|
|||||||
$output .= $string;
|
$output .= $string;
|
||||||
|
|
||||||
if (!empty ($config["compact_header"])) {
|
if (!empty ($config["compact_header"])) {
|
||||||
$output = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $output);
|
$output = str_replace(array("\r\n", "\r", "\n", "\t", ' ',
|
||||||
|
' ', ' '), '', $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
@ -1315,7 +1320,8 @@ function ui_process_page_head ($string, $bitfield) {
|
|||||||
function ui_process_page_body ($string, $bitfield) {
|
function ui_process_page_body ($string, $bitfield) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (isset ($config['ignore_callback']) && $config['ignore_callback'] == true) {
|
if (isset ($config['ignore_callback']) &&
|
||||||
|
$config['ignore_callback'] == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1326,7 +1332,8 @@ function ui_process_page_body ($string, $bitfield) {
|
|||||||
require_once ($config["homedir"]."/include/htmlawed.php");
|
require_once ($config["homedir"]."/include/htmlawed.php");
|
||||||
$htmLawedconfig = array ("valid_xhtml" => 1, "tidy" => -1);
|
$htmLawedconfig = array ("valid_xhtml" => 1, "tidy" => -1);
|
||||||
$output .= htmLawed ($string, $htmLawedconfig);
|
$output .= htmLawed ($string, $htmLawedconfig);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$output .= $string;
|
$output .= $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1433,7 +1440,8 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
|
|||||||
$output .= '<a class="pagination" href="'.$url.'&'.$offset_name.'='.$inicio_bloque.'">';
|
$output .= '<a class="pagination" href="'.$url.'&'.$offset_name.'='.$inicio_bloque.'">';
|
||||||
if ($inicio_bloque == $offset) {
|
if ($inicio_bloque == $offset) {
|
||||||
$output .= "<b>[ $i ]</b>";
|
$output .= "<b>[ $i ]</b>";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$output .= "[ $i ]";
|
$output .= "[ $i ]";
|
||||||
}
|
}
|
||||||
$output .= '</a></span>';
|
$output .= '</a></span>';
|
||||||
@ -1527,7 +1535,8 @@ function ui_debug ($var, $backtrace = true) {
|
|||||||
echo ' - <span class="filename">';
|
echo ' - <span class="filename">';
|
||||||
echo str_replace ($config['homedir'].'/', '', $trace['file']);
|
echo str_replace ($config['homedir'].'/', '', $trace['file']);
|
||||||
echo ':'.$trace['line'].'</span>';
|
echo ':'.$trace['line'].'</span>';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
echo ' - <span class="filename"><em>Unknown file</em></span>';
|
echo ' - <span class="filename"><em>Unknown file</em></span>';
|
||||||
}
|
}
|
||||||
echo '<pre id="args-'.$trace_id.'" class="invisible">';
|
echo '<pre id="args-'.$trace_id.'" class="invisible">';
|
||||||
@ -1550,6 +1559,7 @@ function ui_debug ($var, $backtrace = true) {
|
|||||||
echo '<pre class="debug">';
|
echo '<pre class="debug">';
|
||||||
print_r ($var);
|
print_r ($var);
|
||||||
echo '</pre>';
|
echo '</pre>';
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1576,12 +1586,12 @@ function ui_print_moduletype_icon ($id_moduletype, $return = false, $relative =
|
|||||||
if (! file_exists ($config['homedir'].'/'.$imagepath))
|
if (! file_exists ($config['homedir'].'/'.$imagepath))
|
||||||
$imagepath = ENTERPRISE_DIR.'/'.$imagepath;
|
$imagepath = ENTERPRISE_DIR.'/'.$imagepath;
|
||||||
|
|
||||||
if ($options){
|
if ($options) {
|
||||||
return html_print_image ($imagepath, $return,
|
return html_print_image ($imagepath, $return,
|
||||||
array ("border" => 0,
|
array ("border" => 0,
|
||||||
"title" => $type["descripcion"]), false, $relative);
|
"title" => $type["descripcion"]), false, $relative);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
return html_print_image ($imagepath, $return,
|
return html_print_image ($imagepath, $return,
|
||||||
false, false, $relative);
|
false, false, $relative);
|
||||||
}
|
}
|
||||||
@ -1672,7 +1682,7 @@ function ui_get_status_images_path () {
|
|||||||
function ui_print_status_image ($type, $title = "", $return = false, $options = false) {
|
function ui_print_status_image ($type, $title = "", $return = false, $options = false) {
|
||||||
list ($imagepath) = ui_get_status_images_path ();
|
list ($imagepath) = ui_get_status_images_path ();
|
||||||
|
|
||||||
$imagepath .= "/".$type;
|
$imagepath .= "/" . $type;
|
||||||
|
|
||||||
if($options === false) {
|
if($options === false) {
|
||||||
$options = array();
|
$options = array();
|
||||||
|
@ -481,9 +481,9 @@ foreach ($modules as $module) {
|
|||||||
if ($module['history_data'] == 1) {
|
if ($module['history_data'] == 1) {
|
||||||
// RAW Table data
|
// RAW Table data
|
||||||
echo "<td class=".$tdcolor." width=70>";
|
echo "<td class=".$tdcolor." width=70>";
|
||||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=2592000&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_m.png', true, array("border" => '0', "alt" => '')) . "</a> ";
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=" . SECONDS_1MONTH . "&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_m.png', true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=604800&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_w.png', true, array("border" => '0', "alt" => '')) . "</a> ";
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_w.png', true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_d.png', true, array("border" => '0', "alt" => '')) . "</a>";
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=" . SECONDS_1DAY ."&id=".$module["id_agente_modulo"]."'>" . html_print_image('images/data_d.png', true, array("border" => '0', "alt" => '')) . "</a>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<td class=".$tdcolor."></td>";
|
echo "<td class=".$tdcolor."></td>";
|
||||||
@ -494,7 +494,8 @@ foreach ($modules as $module) {
|
|||||||
$seconds = get_system_time () - $module["utimestamp"];
|
$seconds = get_system_time () - $module["utimestamp"];
|
||||||
if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) {
|
if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) {
|
||||||
echo '<span class="redb">';
|
echo '<span class="redb">';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
echo '<span>';
|
echo '<span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -503,5 +504,4 @@ foreach ($modules as $module) {
|
|||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
x
Reference in New Issue
Block a user