2013-02-21 Sergio Martin <sergio.martin@artica.es>

* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
	extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
	godmode/alerts/configure_alert_action.php
	godmode/alerts/alert_commands.php: Update the commands data
	to new alerts macro in migration. Hide the not used fields
	on actions. bug #3605461



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7695 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-02-21 11:37:19 +00:00
parent c86f525048
commit 916e18ffbe
6 changed files with 78 additions and 11 deletions

View File

@ -1,3 +1,13 @@
2013-02-21 Sergio Martin <sergio.martin@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
godmode/alerts/configure_alert_action.php
godmode/alerts/alert_commands.php: Update the commands data
to new alerts macro in migration. Hide the not used fields
on actions. bug #3605461
2013-02-21 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php

View File

@ -1079,3 +1079,15 @@ ALTER TABLE tevento ADD INDEX `idx_utimestamp` USING BTREE (`utimestamp`);
ALTER TABLE tserver DROP INDEX keepalive;
ALTER TABLE tserver DROP INDEX status;
------------------------------------------------------------------------
-- Adapt the talert commands to new macro system
------------------------------------------------------------------------
UPDATE talert_commands SET fields_descriptions = '["Destination&#x20;address","Subject","Text","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 1;
UPDATE talert_commands SET fields_descriptions = '["Description","","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 2;
UPDATE talert_commands SET fields_descriptions = '["Event&#x20;text","Event&#x20;type","Source","Agent&#x20;name&#x20;or&#x20;_agent_","Event&#x20;criticity","ID&#x20;extra","Tags&#x20;separated&#x20;by&#x20;commas","Comments","Not&#x20;used","Not&#x20;used"]', fields_values = '["","alert_ceased,Alert&#x20;ceased;alert_fired,Alert&#x20;fired;alert_manual_validation,Alert&#x20;manual&#x20;validation;alert_recovered,Alert&#x20;recovered;configuration_change,Configuration&#x20;change&#x20;;error,Error;critical,Monitor&#x20;Critical;normal,Monitor&#x20;Normal;going_unknown,Monitor","","","4,Critical;1,Informational;0,Maintenance;6,Major;5,Minor;2,Normal;3,Warning","","","","",""]' WHERE id = 3;
UPDATE talert_commands SET fields_descriptions = '["Log&#x20;Info&#x20;1","Log&#x20;Info&#x20;2","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 4;
UPDATE talert_commands SET fields_descriptions = '["Community","Destination&#x20;address","OID","Source&#x20;address","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 5;
UPDATE talert_commands SET fields_descriptions = '["Log&#x20;Info&#x20;1","Log&#x20;Info&#x20;2","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 6;
UPDATE talert_commands SET fields_descriptions = '["Destination&#x20;number","Message","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 9;
UPDATE talert_commands SET fields_descriptions = '["Agent&#x20;name","Module&#x20;name","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 10;

View File

@ -1082,3 +1082,16 @@ INSERT INTO tnetwork_component_group (id_sg, name, parent) SELECT * FROM (SELECT
INSERT INTO tnetwork_component_group (id_sg, name, parent) SELECT * FROM (SELECT 46,'AIX',5 FROM dual) AS tmp WHERE NOT EXISTS (SELECT id_sg FROM tnetwork_component_group WHERE id_sg = 46);
INSERT INTO tnetwork_component_group (id_sg, name, parent) SELECT * FROM (SELECT 47,'BSD',5 FROM dual) AS tmp WHERE NOT EXISTS (SELECT id_sg FROM tnetwork_component_group WHERE id_sg = 47);
INSERT INTO tnetwork_component_group (id_sg, name, parent) SELECT * FROM (SELECT 48,'MacOS',0 FROM dual) AS tmp WHERE NOT EXISTS (SELECT id_sg FROM tnetwork_component_group WHERE id_sg = 48);
------------------------------------------------------------------------
-- Adapt the talert commands to new macro system
------------------------------------------------------------------------
UPDATE talert_commands SET fields_descriptions = '["Destination&#x20;address","Subject","Text","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 1;
UPDATE talert_commands SET fields_descriptions = '["Description","","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 2;
UPDATE talert_commands SET fields_descriptions = '["Event&#x20;text","Event&#x20;type","Source","Agent&#x20;name&#x20;or&#x20;_agent_","Event&#x20;criticity","ID&#x20;extra","Tags&#x20;separated&#x20;by&#x20;commas","Comments","Not&#x20;used","Not&#x20;used"]', fields_values = '["","alert_ceased,Alert&#x20;ceased;alert_fired,Alert&#x20;fired;alert_manual_validation,Alert&#x20;manual&#x20;validation;alert_recovered,Alert&#x20;recovered;configuration_change,Configuration&#x20;change&#x20;;error,Error;critical,Monitor&#x20;Critical;normal,Monitor&#x20;Normal;going_unknown,Monitor","","","4,Critical;1,Informational;0,Maintenance;6,Major;5,Minor;2,Normal;3,Warning","","","","",""]' WHERE id = 3;
UPDATE talert_commands SET fields_descriptions = '["Log&#x20;Info&#x20;1","Log&#x20;Info&#x20;2","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 4;
UPDATE talert_commands SET fields_descriptions = '["Community","Destination&#x20;address","OID","Source&#x20;address","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 5;
UPDATE talert_commands SET fields_descriptions = '["Log&#x20;Info&#x20;1","Log&#x20;Info&#x20;2","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 6;
UPDATE talert_commands SET fields_descriptions = '["Destination&#x20;number","Message","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 9;
UPDATE talert_commands SET fields_descriptions = '["Agent&#x20;name","Module&#x20;name","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 10;

View File

@ -1073,3 +1073,16 @@ INSERT INTO "tnetwork_component_group" ("id_sg", "name", "parent") SELECT * FROM
INSERT INTO "tnetwork_component_group" ("id_sg", "name", "parent") SELECT * FROM (SELECT 46,'AIX',5 FROM dual) AS tmp WHERE NOT EXISTS (SELECT "id_sg" FROM "tnetwork_component_group" WHERE "id_sg" = 46);
INSERT INTO "tnetwork_component_group" ("id_sg", "name", "parent") SELECT * FROM (SELECT 47,'BSD',5 FROM dual) AS tmp WHERE NOT EXISTS (SELECT "id_sg" FROM "tnetwork_component_group" WHERE "id_sg" = 47);
INSERT INTO "tnetwork_component_group" ("id_sg", "name", "parent") SELECT * FROM (SELECT 48,'MacOS',0 FROM dual) AS tmp WHERE NOT EXISTS (SELECT "id_sg" FROM "tnetwork_component_group" WHERE "id_sg" = 48);
------------------------------------------------------------------------
-- Adapt the talert commands to new macro system
------------------------------------------------------------------------
UPDATE "talert_commands" SET "fields_descriptions" = '["Destination&#x20;address","Subject","Text","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 1;
UPDATE "talert_commands" SET "fields_descriptions" = '["Description","","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 2;
UPDATE "talert_commands" SET "fields_descriptions" = '["Event&#x20;text","Event&#x20;type","Source","Agent&#x20;name&#x20;or&#x20;_agent_","Event&#x20;criticity","ID&#x20;extra","Tags&#x20;separated&#x20;by&#x20;commas","Comments","Not&#x20;used","Not&#x20;used"]', fields_values = '["","alert_ceased,Alert&#x20;ceased;alert_fired,Alert&#x20;fired;alert_manual_validation,Alert&#x20;manual&#x20;validation;alert_recovered,Alert&#x20;recovered;configuration_change,Configuration&#x20;change&#x20;;error,Error;critical,Monitor&#x20;Critical;normal,Monitor&#x20;Normal;going_unknown,Monitor","","","4,Critical;1,Informational;0,Maintenance;6,Major;5,Minor;2,Normal;3,Warning","","","","",""]' WHERE id = 3;
UPDATE "talert_commands" SET "fields_descriptions" = '["Log&#x20;Info&#x20;1","Log&#x20;Info&#x20;2","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 4;
UPDATE "talert_commands" SET "fields_descriptions" = '["Community","Destination&#x20;address","OID","Source&#x20;address","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 5;
UPDATE "talert_commands" SET "fields_descriptions" = '["Log&#x20;Info&#x20;1","Log&#x20;Info&#x20;2","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 6;
UPDATE "talert_commands" SET "fields_descriptions" = '["Destination&#x20;number","Message","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 9;
UPDATE "talert_commands" SET "fields_descriptions" = '["Agent&#x20;name","Module&#x20;name","","","","","","","",""]', fields_values = '["","","","","","","","","",""]' WHERE id = 10;

View File

@ -61,7 +61,13 @@ if (is_ajax ()) {
$fdesc = $fields_descriptions[$i-1].' <br><span style="font-size:xx-small; font-weight:normal;">'.sprintf(__('Field %s'), $i).'</span>';
}
else {
$fdesc = sprintf(__('Field %s'), $i);
// If the macro hasn't description and doesnt appear in command, set with empty description to dont show it
if(substr_count($command['command'], "_field$i_") > 0) {
$fdesc = sprintf(__('Field %s'), $i);
}
else {
$fdesc = '';
}
}
if(!empty($fields_values[$i-1])) {
@ -84,14 +90,20 @@ if (is_ajax ()) {
$ffield = html_print_textarea ('field'.$i.'_value', 1, 1, '', 'style="min-height:40px" class="fields"', true);
}
$fields_rows[$i] = '<tr id="table1-field'.$i.'" class="datos">
<td style="font-weight:bold;width:20%" class="datos">
'.$fdesc.'
</td>
<td class="datos">
'.$ffield.'
</td>
</tr>';
// The empty descriptions will be ignored
if($fdesc == '') {
$fields_rows[$i] = '';
}
else {
$fields_rows[$i] = '<tr id="table1-field'.$i.'" class="datos">
<td style="font-weight:bold;width:20%" class="datos">
'.$fdesc.'
</td>
<td class="datos">
'.$ffield.'
</td>
</tr>';
}
}
$command['fields_rows'] = $fields_rows;

View File

@ -206,8 +206,15 @@ $(document).ready (function () {
old_value = $("[name=field"+i+"_value]").val();
}
$('#table1-field'+i).replaceWith(data["fields_rows"][i]);
$("[name=field"+i+"_value]").val(old_value);
// If the row is empty, hide de row
if(data["fields_rows"][i] == '') {
$('#table1-field'+i).hide();
}
else {
$('#table1-field'+i).replaceWith(data["fields_rows"][i]);
$("[name=field"+i+"_value]").val(old_value);
$('#table1-field').show();
}
}
render_command_preview(original_command);