2010-09-21 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_html.php: fixed the width by default in the function
	"print_table", now there isn't a default width (before it was 80%).
	
	* include/pchart_graph.php: fixed in the function "add_events" when tryed
	to add a event out the data. 
	
	* include/fgraph.php: check the user with the mobile methods.
	
	* include/functions_db.php: in function "check_login" check the user with
	the mobile methods.
	
	* images/status_sets/default/severity_warning_pixel.png,
	images/status_sets/default/severity_normal_pixel.png,
	images/status_sets/default/severity_informational_pixel.png,
	images/status_sets/default/severity_maintenance_pixel.png,
	images/status_sets/default/severity_critical_pixel.png: added the image
	files for to show in the event mobile's page.
	
	* mobile/operation/agents/view_agents.php,
	mobile/operation/agents/tactical.php,
	mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
	mobile/operation/servers/view_servers.php, mobile/include/user.class.php,
	mobile/include/system.class.php: changed the style the some pages to show
	more clearly the pages in old m$-mobiles.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3265 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-09-21 08:59:01 +00:00
parent 933e50b145
commit 63a7d6730c
18 changed files with 153 additions and 64 deletions

View File

@ -1,3 +1,30 @@
2010-09-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: fixed the width by default in the function
"print_table", now there isn't a default width (before it was 80%).
* include/pchart_graph.php: fixed in the function "add_events" when tryed
to add a event out the data.
* include/fgraph.php: check the user with the mobile methods.
* include/functions_db.php: in function "check_login" check the user with
the mobile methods.
* images/status_sets/default/severity_warning_pixel.png,
images/status_sets/default/severity_normal_pixel.png,
images/status_sets/default/severity_informational_pixel.png,
images/status_sets/default/severity_maintenance_pixel.png,
images/status_sets/default/severity_critical_pixel.png: added the image
files for to show in the event mobile's page.
* mobile/operation/agents/view_agents.php,
mobile/operation/agents/tactical.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/operation/servers/view_servers.php, mobile/include/user.class.php,
mobile/include/system.class.php: changed the style the some pages to show
more clearly the pages in old m$-mobiles.
2010-09-21 Junichi Satoh <junichi@rworks.jp>
* godmode/massive/massive_add_action_alerts.php,

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

View File

@ -48,7 +48,17 @@ error_reporting (E_ALL);
if (! isset ($config["id_user"])) {
session_start ();
session_write_close ();
$config["id_user"] = $_SESSION["id_usuario"];
if (isset($_SESSION["id_usuario"])) {
$config["id_user"] = $_SESSION["id_usuario"];
}
}
if (! isset ($config["id_user"])) {
require_once('../mobile/include/user.class.php');
session_start ();
session_write_close ();
$user = $_SESSION['user'];
$config["id_user"] = $user->getIdUser();
}
//Fixed the graph for cron (that it's login)
@ -1530,7 +1540,7 @@ function grafico_modulo_sparse_mobile ($agent_module_id, $period, $show_events,
"utimestamp > $datelimit",
"utimestamp < $date",
'order' => 'utimestamp ASC'),
array ('evento', 'utimestamp'));
array ('evento', 'utimestamp', 'event_type'));
if ($events === false) {
$events = array ();
}
@ -1634,6 +1644,7 @@ function grafico_modulo_sparse_mobile ($agent_module_id, $period, $show_events,
// Read events and alerts that fall in the current interval
$event_value = 0;
$alert_value = 0;
while (isset ($events[$k]) && $events[$k]['utimestamp'] >= $timestamp && $events[$k]['utimestamp'] <= ($timestamp + $interval)) {
if ($show_events == 1) {
$event_value++;
@ -1666,7 +1677,7 @@ function grafico_modulo_sparse_mobile ($agent_module_id, $period, $show_events,
$chart[$timestamp]['count'] = 0;
$chart[$timestamp]['timestamp_bottom'] = $timestamp;
$chart[$timestamp]['timestamp_top'] = $timestamp + $interval;
$chart[$timestamp]['event'] = $event_value;
$chart[$timestamp]['events'] = $event_value;
$chart[$timestamp]['alert'] = $alert_value;
}
@ -1678,8 +1689,8 @@ function grafico_modulo_sparse_mobile ($agent_module_id, $period, $show_events,
// Fix event and alert scale
$event_max = $max_value * 1.25;
foreach ($chart as $timestamp => $chart_data) {
if ($chart_data['event'] > 0) {
$chart[$timestamp]['event'] = $event_max;
if ($chart_data['events'] > 0) {
$chart[$timestamp]['events'] = $event_max;
}
if ($chart_data['alert'] > 0) {
$chart[$timestamp]['alert'] = $event_max;
@ -1724,7 +1735,7 @@ function grafico_modulo_sparse_mobile ($agent_module_id, $period, $show_events,
$engine->show_title = false; //true;
$engine->max_value = $max_value;
$engine->min_value = $min_value;
$engine->events = (bool) $show_event;
$engine->events = (bool) $show_events;
$engine->alert_top = false;
$engine->alert_bottom = false;;
if (! $pure) {

View File

@ -978,6 +978,21 @@ function set_delete_module($id, $id2, $other, $trash1) {
}
}
function set_module_data($id, $thrash2, $other, $trash1) {
if ($other['type'] == 'array') {
$idAgentModule = $id;
$data = $other['data'][0];
$time = $other['data'][1];
if ($time == 'now') $time = time();
}
else {
returnError('error_parameter', 'Error in the parameters.');
return;
}
}
function set_new_module($id, $id2, $other, $trash1) {
if ($other['type'] == 'string') {
returnError('error_parameter', 'Error in the parameters.');

View File

@ -46,6 +46,17 @@ function check_login () {
return 0;
}
}
else {
require_once('../mobile/include/user.class.php');
session_start ();
session_write_close ();
$user = $_SESSION['user'];
$id_user = $user->getIdUser();
if (is_user ($id_user)) {
return 0;
}
}
audit_db ("N/A", getenv ("REMOTE_ADDR"), "No session", "Trying to access without a valid session");
include ($config["homedir"]."/general/noaccess.php");
exit;
@ -2155,9 +2166,11 @@ function get_db_all_rows_filter ($table, $filter = array(), $fields = false, $wh
//TODO: Validate and clean filter options
if (is_array ($filter)) {
$filter = format_array_to_where_clause_sql ($filter, $where_join, ' WHERE ');
} elseif (is_string ($filter)) {
}
elseif (is_string ($filter)) {
$filter = 'WHERE '.$filter;
} else {
}
else {
$filter = '';
}
@ -2527,6 +2540,7 @@ $sql = 'SELECT * FROM table WHERE '.format_array_to_where_clause_sql ($values, '
* clause of an SQL sentence.
*/
function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = false) {
$fields = array ();
if (! is_array ($values)) {
@ -2592,13 +2606,17 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal
if (is_null ($value)) {
$query .= sprintf ("%s IS NULL", $field);
} elseif (is_int ($value) || is_bool ($value)) {
}
elseif (is_int ($value) || is_bool ($value)) {
$query .= sprintf ("%s = %d", $field, $value);
} else if (is_float ($value) || is_double ($value)) {
}
else if (is_float ($value) || is_double ($value)) {
$query .= sprintf ("%s = %f", $field, $value);
} elseif (is_array ($value)) {
}
elseif (is_array ($value)) {
$query .= sprintf ('%s IN ("%s")', $field, implode ('", "', $value));
} else {
}
else {
if ($value[0] == ">"){
$value = substr($value,1,strlen($value)-1);
$query .= sprintf ("%s > '%s'", $field, $value);

View File

@ -781,7 +781,7 @@ function print_table (&$table, $return = false) {
if (empty ($table->width)) {
$table->width = '80%';
//$table->width = '80%';
}
if (empty ($table->border)) {
@ -812,7 +812,12 @@ function print_table (&$table, $return = false) {
$tableid = empty ($table->id) ? 'table'.$table_count : $table->id;
$output .= '<table style="' . $styleTable . '" width="'.$table->width.'"'.$table->tablealign;
if (!empty($table->width)) {
$output .= '<table style="' . $styleTable . '" width="'.$table->width.'"'.$table->tablealign;
}
else {
$output .= '<table style="' . $styleTable . '" "'.$table->tablealign;
}
$output .= ' cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'"';
$output .= ' border="'.$table->border.'" class="'.$table->class.'" id="'.$tableid.'">';
$countcols = 0;

View File

@ -509,10 +509,12 @@ class PchartGraph extends PandoraGraphAbstract {
foreach ($this->data as $i => $data) {
/* Finally, check if there were events */
if (! $data['events'])
continue;
if (!isset($this->dataset->Data[$i]))
continue;
$x1 = (int) ($this->x1 + $i * $this->graph->DivisionWidth);
$y1 = (int) ($this->y2 - ($this->dataset->Data[$i][$serie] * $this->graph->DivisionRatio));
$this->graph->drawFilledCircle ($x1, $y1, 1.5, 255, 0, 0);

View File

@ -59,6 +59,12 @@ class System {
}
}
public function setSessionBase($name, $value) {
session_start();
$_SESSION[$name] = $value;
session_write_close();
}
public function setSession($name, $value) {
$this->session[$name] = $value;

View File

@ -39,7 +39,8 @@ class User {
if ($this->logged) {
//hack to compatibility with pandora
global $config;
$config['id_user'] = $this->user;
$config['id_user'] = $this->user;
$this->system->setSessionBase('id_usuario', $this->user);
}
}

View File

@ -27,7 +27,7 @@ class Tactical {
$data = get_group_stats();
$table = null;
$table->width = '100%';
//$table->width = '100%';
$table->size[0] = '10px';
@ -77,7 +77,7 @@ class Tactical {
$server_performance = get_server_performance();
$table = null;
$table->width = '100%';
//$table->width = '100%';
$table->align = array();
$table->align[1] = 'right';
@ -98,7 +98,7 @@ class Tactical {
echo "<h3 class='title_h3_server'>" . __('Summary') . "</h3>";
$table = null;
$table->width = '100%';
//$table->width = '100%';
$table->align[1] = 'right';
$table->data[0][0] = '<span style="color: #000;">' . __('Total agents') . '</span>';
$table->data[0][1] = '<span style="color: #000;">' . $data["total_agents"] . '</span>';

View File

@ -105,7 +105,7 @@ class ViewAgents {
$data = array();
$truncName = printTruncateText($agent['nombre'], 10, true, true);
$truncName = printTruncateText($agent['nombre'], 25, true, true);
$data[] = print_group_icon2($agent["id_grupo"], true, "../images/groups_small", '', false);
$data[] = '<a href="index.php?page=agent&id=' . $agent['id_agente'] . '">' . $truncName . '</a>';
@ -125,8 +125,8 @@ class ViewAgents {
$moduleInfo .= '</b>';
$data[] = $moduleInfo;
$data[] = '<img src="../images/status_sets/default/' . str_replace('.png', '_ball.png', $agent_info['status']) . '" />';
$data[] = '<img src="../images/status_sets/default/' . str_replace('.png', '_ball.png', $agent_info['alert_value']) . '" />';
$data[] = '<img width="12" height="12" src="../images/status_sets/default/' . $agent_info['status'] . '" />';
$data[] = '<img width="12" height="12" src="../images/status_sets/default/' . $agent_info['alert_value'] . '" />';
$table->data[] = $data;
@ -215,7 +215,7 @@ class ViewAgent {
echo "<h3 class='title_h3'>" . __('Modules') . "</h3>";
$table = null;
$table->width = '100%';
//$table->width = '100%';
$table->head = array();
$table->head[0] = __('Module');
$table->head[1] = '<span title="' . __('Status') . '" alt="' . __('Status') . '">' . __('S') . '</span>';
@ -236,7 +236,8 @@ class ViewAgent {
$data = array();
$data[] = '<a href="index.php?page=agent&action=view_module_graph&id=' . $module['id_agente_modulo'] . '">' . printTruncateText($module["nombre"], 10, true, true) . '</a>';
$data[] = '<a href="index.php?page=agent&action=view_module_graph&id=' . $module['id_agente_modulo'] . '">' .
printTruncateText($module["nombre"], 20, true, true) . '</a>';
$status = STATUS_MODULE_WARNING;
$title = "";
@ -274,8 +275,8 @@ class ViewAgent {
$title .= ": " . substr(safe_output($module["datos"]),0,42);
}
$data[] = str_replace('.png', '_ball.png', str_replace('images/status_sets',
'../images/status_sets', print_status_image($status, $title, true)));
$data[] = str_replace(array('images/status_sets', '<img'),
array('../images/status_sets', '<img height="15" width="15"') , print_status_image($status, $title, true));
if ($module["id_tipo_modulo"] == 24) { // log4x
switch($module["datos"]) {
@ -338,10 +339,10 @@ class ViewAgent {
$data = array();
$data[] = printTruncateText(get_agentmodule_name($alert["id_agent_module"]), 10, true, true);
$data[] = printTruncateText(get_agentmodule_name($alert["id_agent_module"]), 20, true, true);
$template = safe_output(get_alert_template ($alert['id_alert_template']));
$data[] = printTruncateText(safe_output($template['name']), 10, true, true);
$data[] = printTruncateText(safe_output($template['name']), 20, true, true);
// $actions = get_alert_agent_module_actions ($alert['id'], false, false);
// if (!empty($actions)){
@ -377,8 +378,8 @@ class ViewAgent {
$title = __('Alert not fired');
}
$data[] = str_replace('.png', '_ball.png', str_replace('images/status_sets',
'../images/status_sets', print_status_image($status, $title, true)));
$data[] = str_replace(array('images/status_sets', '<img'),
array('../images/status_sets', '<img width="15" height="15"'), print_status_image($status, $title, true));
$table->data[] = $data;
}
@ -423,8 +424,8 @@ class viewGraph {
return;
}
$image = "../include/fgraph.php?tipo=sparse_mobile&draw_alerts=1&draw_events=1' .
'&id=" . $this->idAgentModule . "&zoom=1&label=".safe_output($this->agentModule['nombre']) .
$image = "../include/fgraph.php?tipo=sparse_mobile&draw_alerts=1&draw_events=1" .
'&id=' . $this->idAgentModule . "&zoom=1&label=".safe_output($this->agentModule['nombre']) .
"&height=120&width=240&period=" . $this->period . "&avg_only=0";
$image .= "&date=" . get_system_time ();
@ -432,7 +433,7 @@ class viewGraph {
echo "<h3 class='title_h3'><a href='index.php?page=agent&id=" . $this->agentModule['id_agente'] . "'>" . get_agentmodule_agent_name($this->idAgentModule)."</a> / ".safe_output($this->agentModule['nombre']) . "</h3>";
echo "<h3 class='title_h3'>" . __('Graph') . "</h3>";
print_image ($image, false, array ("border" => 0));
print_image ($image, false, array ("border" => 0));
echo "<h3 class='title_h3'>" . __('Data') . "</h3>";

View File

@ -23,7 +23,7 @@ class ViewAlerts {
public function show() {
$table = null;
$table->width = '100%';
//$table->width = '100%';
$table->head = array();
$table->head[0] = __('Module');
$table->head[1] = __('Template');
@ -58,9 +58,9 @@ class ViewAlerts {
$idAgent = get_agentmodule_agent($alert["id_agent_module"]);
$data[] = '<a href="index.php?page=agent&id=' . $idAgent . '">' . printTruncateText(get_agentmodule_name($alert["id_agent_module"]), 10, true, true) . '</a>';
$data[] = '<a href="index.php?page=agent&id=' . $idAgent . '">' . printTruncateText(get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . '</a>';
$template = safe_output(get_alert_template ($alert['id_alert_template']));
$data[] = printTruncateText(safe_output($template['name']), 10, true, true);
$data[] = printTruncateText(safe_output($template['name']), 20, true, true);
$data[] = print_timestamp ($alert["last_fired"], true, array('units' => 'tiny'));
$status = STATUS_ALERT_NOT_FIRED;
@ -77,8 +77,8 @@ class ViewAlerts {
$title = __('Alert not fired');
}
$data[] = str_replace('.png', '_ball.png', str_replace('images/status_sets',
'../images/status_sets', print_status_image($status, $title, true)));
$data[] = str_replace(array('images/status_sets', '<img'),
array('../images/status_sets', '<img width="15" height="15"'), print_status_image($status, $title, true));
$table->data[] = $data;
}

View File

@ -123,14 +123,16 @@ class EventsView {
$count = get_db_value_sql($sql_count);
$rows = get_db_all_rows_sql($sql);
if ($rows === false)
$rows = array();
$table = null;
$table->width = '100%';
$table->head = array();
$table->head[0] = '<span title="' . __('Severity') . '" alt="' . __('Severity') . '">' . __('S') . '</span>';
$table->head[1] = '<span title="' . __('Group') . '" alt="' . __('Group') . '">' . __('G') . '</span>';
$table->head[2] = '<span title="' . __('Type') . '" alt="' . __('Type') . '">' . __('T') . '</span>';
// $table->head[1] = '<span title="' . __('Group') . '" alt="' . __('Group') . '">' . __('G') . '</span>';
// $table->head[2] = '<span title="' . __('Type') . '" alt="' . __('Type') . '">' . __('T') . '</span>';
$table->head[3] = '<span title="' . __('Timestamp') . '" alt="' . __('Timestamp') . '">' . __('T') . '</span>';
$table->head[4] = '<span title="' . __('Description') . '" alt="' . __('Description') . '">' . __('Des.') . '</span>';
$table->head[5] = '<span title="' . __('Agent') . '" alt="' . __('Agent') . '">' . __('Agent') . '</span>';
@ -142,19 +144,19 @@ class EventsView {
switch ($row["criticity"]) {
default:
case 0:
$img = "../images/status_sets/default/severity_maintenance.png";
$img = "../images/status_sets/default/severity_maintenance_pixel.png";
break;
case 1:
$img = "../images/status_sets/default/severity_informational.png";
$img = "../images/status_sets/default/severity_informational_pixel.png";
break;
case 2:
$img = "../images/status_sets/default/severity_normal.png";
$img = "../images/status_sets/default/severity_normal_pixel.png";
break;
case 3:
$img = "../images/status_sets/default/severity_warning.png";
$img = "../images/status_sets/default/severity_warning_pixel.png";
break;
case 4:
$img = "../images/status_sets/default/severity_critical.png";
$img = "../images/status_sets/default/severity_critical_pixel.png";
break;
}
@ -163,34 +165,35 @@ class EventsView {
'&severity=' . $row["criticity"] . '&search=' . $search . '">' .
print_image ($img, true,
array ("class" => "image_status",
"width" => 12,
"height" => 12,
"width" => 15,
"height" => 15,
"title" => get_priority_name($row["criticity"]))) . '</a>';
$data[] = '<a href="index.php?page=events&ev_group=' .
$row["id_grupo"] . '&event_type=' . $event_type .
'&severity='. $severity . '&search=' . $search . '">' .
str_replace('images/', '../images/', print_group_icon ($row["id_grupo"], true, "groups_small", '', false))
. '</a>';
$data[] = '<a href="index.php?page=events&ev_group=' . $ev_group .
'&event_type=' . $row["event_type"] . '&severity=' . $severity .
'&search=' . $search . '">' .
str_replace('images/', '../images/', print_event_type_img($row["event_type"], true)) .
'</a>';
// $data[] = '<a href="index.php?page=events&ev_group=' .
// $row["id_grupo"] . '&event_type=' . $event_type .
// '&severity='. $severity . '&search=' . $search . '">' .
// str_replace('images/', '../images/', print_group_icon ($row["id_grupo"], true, "groups_small", '', false))
// . '</a>';
//
// $data[] = '<a href="index.php?page=events&ev_group=' . $ev_group .
// '&event_type=' . $row["event_type"] . '&severity=' . $severity .
// '&search=' . $search . '">' .
// str_replace('images/', '../images/', print_event_type_img($row["event_type"], true)) .
// '</a>';
$data[] = print_timestamp($row["timestamp"], true, array('units' => 'tiny'));
$data[] = printTruncateText($row["evento"], 8, true, true);
$data[] = printTruncateText($row["evento"], 40, true, true);
if ($row["event_type"] == "system") {
$data[] = printTruncateText(__('System'), 8, true, true);
$data[] = printTruncateText(__('System'), 20, true, true);
}
elseif ($row["id_agente"] > 0) {
// Agent name
$data[] = printTruncateText(get_agent_name($row["id_agente"]), 8, true, true);
$data[] = printTruncateText(get_agent_name($row["id_agente"]), 20, true, true);
}
else {
$data[] = printTruncateText(__('Alert SNMP'), 8, true, true);
$data[] = printTruncateText(__('Alert SNMP'), 20, true, true);
}
$table->data[] = $data;

View File

@ -56,8 +56,8 @@ class ViewServers {
$data[] = str_replace('images/', '../images/', $server['img']);
$data[] = human_time_comparation ($server["laststart"], 'tiny');
$data[] = human_time_comparation ($server["keepalive"], 'tiny');
$data[] = str_replace('.png', '_ball.png', str_replace('images/status_sets',
'../images/status_sets', $server_status));
$data[] = str_replace(array('images/status_sets', '<img'),
array('../images/status_sets', '<img width="15" height="15"'), $server_status);
// $this->system->debug($server["name"]);
$table->data[] = $data;