2009-10-07 Miguel de Dios <miguel.dedios@artica.es>

* pandoradb.sql, extras/pandoradb_migrate_v2.x_to_v3.0.sql: change the field
	"name" in the table "tagente" to binary varchar.
	* include/functions_events.php, operation/events/events.php: add new
	columns, the severity colummn and the validate colummn.
	* images/tag_red.png, images/tick.png,
	images/status_sets/default/severity_informational.png,
	images/status_sets/default/severity_maintenance.png,
	images/status_sets/default/severity_critical.png,
	images/status_sets/default/severity_warning.png,
	images/status_sets/default/severity_normal.png: add the new files to use in
	the events list new colummns.
	* include/help/en/help_eventview.php: change the content in this help for
	show help info of new colummns.
	Comments: I hate the massive and mixed commits...but I have not choice, and
	in this commit there are two parts, the changes in the sql table and the
	changes in the event list colummn. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2011 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-10-07 18:43:08 +00:00
parent 0205f8fd9b
commit c5109fccb8
13 changed files with 217 additions and 99 deletions

View File

@ -1,3 +1,22 @@
2009-10-07 Miguel de Dios <miguel.dedios@artica.es>
* pandoradb.sql, extras/pandoradb_migrate_v2.x_to_v3.0.sql: change the field
"name" in the table "tagente" to binary varchar.
* include/functions_events.php, operation/events/events.php: add new
columns, the severity colummn and the validate colummn.
* images/tag_red.png, images/tick.png,
images/status_sets/default/severity_informational.png,
images/status_sets/default/severity_maintenance.png,
images/status_sets/default/severity_critical.png,
images/status_sets/default/severity_warning.png,
images/status_sets/default/severity_normal.png: add the new files to use in
the events list new colummns.
* include/help/en/help_eventview.php: change the content in this help for
show help info of new colummns.
Comments: I hate the massive and mixed commits...but I have not choice, and
in this commit there are two parts, the changes in the sql table and the
changes in the event list colummn.
2009-10-06 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.php: fix in part the bug #2870769,

View File

@ -297,3 +297,8 @@ ALTER TABLE tgraph ADD `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE talert_templates ADD `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE talert_actions ADD `id_group` mediumint(8) unsigned NULL default 0;
ALTER TABLE tplanned_downtime ADD `id_group` mediumint(8) unsigned NULL default 0;
-- Oct 2009
ALTER TABLE `pandora`.`tagente` MODIFY COLUMN `nombre` VARCHAR(100) BINARY CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '';

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View File

@ -278,24 +278,27 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
$table->data = array ();
$table->align = array ();
$table->head[0] = __('St');
$table->align[0] = "center";
$table->head[0] = "<span title='" . __('Validate') . "'>" . __('V.') . "</span>";
$table->align[0] = 'center';
$table->head[1] = __('Type');
$table->headclass[1] = "datos3 f9";
$table->align[1] = "center";
$table->head[1] = "<span title='" . __('Severity') . "'>" . __('S.') . "</span>";
$table->align[1] = 'center';
$table->head[2] = __('Event name');
$table->head[2] = __('Type');
$table->headclass[2] = "datos3 f9";
$table->align[2] = "center";
$table->head[3] = __('Agent name');
$table->head[3] = __('Event name');
$table->head[4] = __('User ID');
$table->headclass[4] = "datos3 f9";
$table->align[4] = "center";
$table->head[4] = __('Agent name');
$table->head[5] = __('Timestamp');
$table->head[5] = __('User ID');
$table->headclass[5] = "datos3 f9";
$table->align[5] = "right";
$table->align[5] = "center";
$table->head[6] = __('Timestamp');
$table->headclass[6] = "datos3 f9";
$table->align[6] = "right";
foreach ($result as $event) {
if (! give_acl ($config["id_user"], $event["id_grupo"], "AR")) {
@ -303,42 +306,75 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
}
$data = array ();
/* Colored box */
if ($event["estado"] == 1) {
$img = 'images/pixel_red.png';
} else {
$img = 'images/pixel_green.png';
// Colored box
if ($event["estado"] == 0) {
$img = "images/cross.png";
$title = __('Event validate');
}
$data[0] = print_image ($img, true, array ("width" => 20,
"height" => 20,
"title" => get_priority_name ($event["criticity"])));
else {
$img = "images/tick.png";
$title = __('Event not validate');
}
$data[0] = print_image ($img, true,
array ("class" => "image_status",
"width" => 16,
"height" => 16,
"title" => $title));
switch ($event["criticity"]) {
default:
case 0:
$img = "images/status_sets/default/severity_maintenance.png";
break;
case 1:
$img = "images/status_sets/default/severity_informational.png";
break;
case 2:
$img = "images/status_sets/default/severity_normal.png";
break;
case 3:
$img = "images/status_sets/default/severity_warning.png";
break;
case 4:
$img = "images/status_sets/default/severity_critical.png";
break;
}
$data[1] = print_image ($img, true,
array ("class" => "image_status",
"width" => 12,
"height" => 12,
"title" => get_priority_name ($event["criticity"])));
/* Event type */
$data[1] = print_event_type_img ($event["event_type"], true);
$data[2] = print_event_type_img ($event["event_type"], true);
// Event description wrap around by default at 44 or ~3 lines (10 seems to be a good ratio to wrap around for most sizes. Smaller number gets longer strings)
$wrap = floor ($width / 10);
$data[2] = '<span class="'.get_priority_class ($event["criticity"]).'f9" title="'.safe_input ($event["evento"]).'">'.safe_input ($event["evento"]).'</span>';
$data[3] = '<span class="'.get_priority_class ($event["criticity"]).'f9" title="'.safe_input ($event["evento"]).'">'.safe_input ($event["evento"]).'</span>';
if ($event["id_agente"] > 0) {
// Agent name
$data[3] = print_agent_name ($event["id_agente"], true);
$data[4] = print_agent_name ($event["id_agente"], true);
// for System or SNMP generated alerts
} elseif ($event["event_type"] == "system") {
$data[3] = __('System');
} else {
$data[3] = __('Alert')."SNMP";
}
elseif ($event["event_type"] == "system") {
$data[4] = __('System');
}
else {
$data[4] = __('Alert')."SNMP";
}
// User who validated event
if ($event["estado"] != 0) {
$data[4] = print_username ($event["id_usuario"], true);
} else {
$data[4] = '';
$data[5] = print_username ($event["id_usuario"], true);
}
else {
$data[5] = '';
}
// Timestamp
$data[5] = print_timestamp ($event["timestamp"], true);
$data[6] = print_timestamp ($event["timestamp"], true);
array_push ($table->rowclass, get_priority_class ($event["criticity"]));
array_push ($table->data, $data);

View File

@ -5,10 +5,30 @@
?>
<h1>Event viewer</h1>
<br><br>
<br>
<br>
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
<h3>Status</h3><img src="../images/pixel_green.png" title="Validated event" alt="Validated event" width="10" height="10"> - Validated event<br><img src="../images/pixel_red.png" title="Event not validated" alt="Event not validated" width="10" height="10"> - Event not validated</div><div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;"><h3>Actions</h3><img src="../images/ok.png" title="Validate event" alt="Validate event"> - Validate event<br><img src="../images/cross.png" title="Delete event" alt="Delete event"> - Delete event<br><img src="../images/page_lightning.png" title="Create incident from event" alt="Create incident from event"> - Create incident from event</div><div style="clear: both;">&nbsp;</div></div>
<h3>Validate</h3>
<img src="../images/tick.png" title="Validated event" alt="Validated event" width="10" height="10"> - Validated event<br>
<img src="../images/cross.png" title="Event not validated" alt="Event not validated" width="10" height="10"> - Event not validated
</div>
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
<h3>Severity</h3>
<img src="../images/status_sets/default/severity_maintenance.png" title="Maintenance event" alt="Maintenance event"> - Maintenance event<br>
<img src="../images/status_sets/default/severity_informational.png" title="Informational event" alt="Informational event"> - Informational event<br>
<img src="../images/status_sets/default/severity_normal.png" title="Normal event" alt="Normal event"> - Normal event<br>
<img src="../images/status_sets/default/severity_warning.png" title="Warning event" alt="Warning event"> - Warning event<br>
<img src="../images/status_sets/default/severity_critical.png" title="Critical event" alt="Critical event"> - Critical event<br>
</div>
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
<h3>Actions</h3>
<img src="../images/ok.png" title="Validate event" alt="Validate event"> - Validate event<br>
<img src="../images/cross.png" title="Delete event" alt="Delete event"> - Delete event<br>
<img src="../images/page_lightning.png" title="Create incident from event" alt="Create incident from event"> - Create incident from event
</div>
<div style="clear: both;">&nbsp;</div>
</div>

View File

@ -352,7 +352,7 @@ if (empty ($result)) {
$result = array ();
}
$table->width = '99%';
$table->width = '100%';
$table->id = "eventtable";
$table->cellpadding = 4;
$table->cellspacing = 4;
@ -360,39 +360,43 @@ $table->class = "databox";
$table->head = array ();
$table->data = array ();
$table->head[0] = '';
$table->head[0] = "<span title='" . __('Validate') . "'>" . __('V.') . "</span>";
$table->align[0] = 'center';
$table->head[1] = __('Type');
$table->headclass[1] = 'f9';
$table->head[1] = "<span title='" . __('Severity') . "'>" . __('S.') . "</span>";
$table->align[1] = 'center';
$table->head[2] = __('Event name');
$table->head[2] ="<span title='" . __('Type') . "'>" . __('T.') . "</span>";
$table->headclass[2] = 'f9';
$table->align[2] = 'center';
$table->head[3] = __('Agent name');
$table->align[3] = 'center';
$table->head[3] = __('Event name');
$table->head[4] = __('Source');
$table->head[4] = __('Agent name');
$table->align[4] = 'center';
$table->head[5] = __('Group');
$table->head[5] = __('S.');
$table->align[5] = 'center';
if ($group_rep == 0) {
$table->head[6] = __('User ID');
} else {
$table->head[6] = __('Count');
}
$table->head[6] = __('G.');
$table->align[6] = 'center';
$table->head[7] = __('Timestamp');
if ($group_rep == 0) {
$table->head[7] = __('User ID');
} else {
$table->head[7] = __('Count');
}
$table->align[7] = 'center';
$table->head[8] = __('Action');
$table->head[8] = __('Timestamp');
$table->align[8] = 'center';
$table->head[9] = print_checkbox ("allbox", "1", false, true);
$table->align[9] = 'center';
$table->head[9] = __('Action');
$table->align[9] = 'right';
$table->size[9] = '50px';
$table->head[10] = print_checkbox ("allbox", "1", false, true);
$table->align[10] = 'center';
//Arrange data. We already did ACL's in the query
foreach ($result as $event) {
@ -402,102 +406,136 @@ foreach ($result as $event) {
$table->rowclass[] = get_priority_class ($event["criticity"]);
// Colored box
if ($event["estado"] == 0) {
$img = "images/pixel_red.png";
} else {
$img = "images/pixel_green.png";
$img = "images/cross.png";
$title = __('Event validate');
}
else {
$img = "images/tick.png";
$title = __('Event not validate');
}
$data[0] = print_image ($img, true,
array ("class" => "image_status",
"width" => 20,
"height" => 20,
"width" => 16,
"height" => 16,
"title" => $title));
switch ($event["criticity"]) {
default:
case 0:
$img = "images/status_sets/default/severity_maintenance.png";
break;
case 1:
$img = "images/status_sets/default/severity_informational.png";
break;
case 2:
$img = "images/status_sets/default/severity_normal.png";
break;
case 3:
$img = "images/status_sets/default/severity_warning.png";
break;
case 4:
$img = "images/status_sets/default/severity_critical.png";
break;
}
$data[1] = print_image ($img, true,
array ("class" => "image_status",
"width" => 12,
"height" => 12,
"title" => get_priority_name ($event["criticity"])));
$data[1] = print_event_type_img ($event["event_type"], true);
$data[2] = print_event_type_img ($event["event_type"], true);
// Event description
$data[2] = '<span title="'.$event["evento"].'" class="f9">';
$data[2] .= '<a href="'.$url.'&amp;group_rep=0&amp;id_agent='.$event["id_agente"].'&amp;pure='.$config["pure"].'&amp;search='.rawurlencode ($event["evento"]).'">';
$data[3] = '<span title="'.$event["evento"].'" class="f9">';
$data[3] .= '<a href="'.$url.'&amp;group_rep=0&amp;id_agent='.$event["id_agente"].'&amp;pure='.$config["pure"].'&amp;search='.rawurlencode ($event["evento"]).'">';
if (strlen ($event["evento"]) > 50) {
$data[2] .= mb_substr ($event["evento"], 0, 50)."...";
} else {
$data[2] .= $event["evento"];
$data[3] .= mb_substr ($event["evento"], 0, 50)."...";
}
$data[2] .= '</a></span>';
else {
$data[3] .= $event["evento"];
}
$data[3] .= '</a></span>';
if ($event["event_type"] == "system") {
$data[3] = __('System');
} elseif ($event["id_agente"] > 0) {
$data[4] = __('System');
}
elseif ($event["id_agente"] > 0) {
// Agent name
$data[3] = print_agent_name ($event["id_agente"], true);
} else {
$data[3] = __('Alert').__('SNMP');
$data[4] = print_agent_name ($event["id_agente"], true);
}
else {
$data[4] = __('Alert').__('SNMP');
}
$data[4] = '';
$data[5] = '';
if ($event["id_agentmodule"] != 0) {
$data[4] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event["id_agente"].'&amp;tab=data">';
$data[4] .= print_image ("images/bricks.png", true,
$data[5] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event["id_agente"].'&amp;tab=data">';
$data[5] .= print_image ("images/bricks.png", true,
array ("title" => __('Go to data overview')));
$data[4] .= '</a>&nbsp;';
$data[5] .= '</a>&nbsp;';
}
if ($event["id_alert_am"] != 0) {
$data[4] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event["id_agente"].'&amp;tab=alert">';
$data[4] .= print_image ("images/bell.png", true,
$data[5] .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$event["id_agente"].'&amp;tab=alert">';
$data[5] .= print_image ("images/bell.png", true,
array ("title" => __('Go to alert overview')));
$data[4] .= '</a>';
$data[5] .= '</a>';
}
$data[5] = print_group_icon ($event["id_grupo"], true);
$data[6] = print_group_icon ($event["id_grupo"], true);
if ($group_rep == 1) {
$data[6] = $event["event_rep"];
} else {
$data[7] = $event["event_rep"];
}
else {
if (!empty ($event["estado"])) {
if ($event["id_usuario"] != '0' && $event["id_usuario"] != ''){
$data[6] = '<a href="index.php?sec=usuario&amp;sec2=operation/user/user_edit&amp;ver='.$event["id_usuario"].'" title="'.dame_nombre_real ($event["id_usuario"]).'">'.mb_substr ($event["id_usuario"],0,8).'</a>';
} else {
$data[6] = __('System');
$data[7] = '<a href="index.php?sec=usuario&amp;sec2=operation/user/user_edit&amp;ver='.$event["id_usuario"].'" title="'.dame_nombre_real ($event["id_usuario"]).'">'.mb_substr ($event["id_usuario"],0,8).'</a>';
}
} else {
$data[6] = '';
else {
$data[7] = __('System');
}
}
else {
$data[7] = '';
}
}
//Time
if ($group_rep == 1) {
$data[7] = print_timestamp ($event['timestamp_rep'], true);
} else {
$data[7] = print_timestamp ($event["timestamp"], true);
$data[8] = print_timestamp ($event['timestamp_rep'], true);
}
else {
$data[8] = print_timestamp ($event["timestamp"], true);
}
//Actions
$data[8] = '';
$data[9] = '';
// Validate event
if (($event["estado"] == 0) and (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1)) {
$data[8] .= '<a class="validate_event" href="#" onclick="return false" id="delete-'.$event["id_evento"].'">';
$data[8] .= print_image ("images/ok.png", true,
$data[9] .= '<a class="validate_event" href="#" onclick="return false" id="delete-'.$event["id_evento"].'">';
$data[9] .= print_image ("images/ok.png", true,
array ("title" => __('Validate event')));
$data[8] .= '</a>';
$data[9] .= '</a>';
}
// Delete event
if (give_acl ($config["id_user"], $event["id_grupo"], "IM") == 1) {
$data[8] .= '<a class="delete_event" href="#" onclick="return false" id="validate-'.$event['id_evento'].'">';
$data[8] .= print_image ("images/cross.png", true,
$data[9] .= '<a class="delete_event" href="#" onclick="return false" id="validate-'.$event['id_evento'].'">';
$data[9] .= print_image ("images/cross.png", true,
array ("title" => __('Delete event')));
$data[8] .= '</a>';
$data[9] .= '</a>';
}
// Create incident from this event
if (give_acl ($config["id_user"], $event["id_grupo"], "IW") == 1) {
$data[8] .= '<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event='.$event["id_evento"].'">';
$data[8] .= print_image ("images/page_lightning.png", true,
$data[9] .= '<a href="index.php?sec=incidencias&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event='.$event["id_evento"].'">';
$data[9] .= print_image ("images/page_lightning.png", true,
array ("title" => __('Create incident from event')));
$data[8] .= '</a>';
$data[9] .= '</a>';
}
//Checkbox
$data[9] = print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true);
$data[10] = print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true);
array_push ($table->data, $data);
}

View File

@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS `taddress_agent` (
CREATE TABLE IF NOT EXISTS `tagente` (
`id_agente` int(10) unsigned NOT NULL auto_increment,
`nombre` varchar(100) NOT NULL default '',
`nombre` varchar(100) BINARY NOT NULL default '',
`direccion` varchar(100) default NULL,
`comentarios` varchar(255) default '',
`id_grupo` int(10) unsigned NOT NULL default '0',