diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 7806457604..46732e0f08 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,24 @@ +2012-10-10 Sergio Martin + + * pandoradb_data.sql + pandoradb.data.postgreSQL.sql + pandoradb.data.oracle.sql: Add the default + responses to data scripts. + + * pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: + Added the new table of event responses to oracle + and postgresql schemmas. + + * godmode/events/event_responses.editor.php + include/help/en/help_response_parameters.php + include/help/en/help_response_macros.php + include/help/es/help_response_parameters.php + include/help/es/help_response_macros.php: Add help to + parameters and macros in event responses + 2012-10-09 Sergio Martin * pandoradb.sql: Added tevent_response to diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index a5db72fb18..0f682fae00 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -347,3 +347,20 @@ ALTER TABLE tnetwork_map ADD (pandoras_children NUMBER(10, 0) default 0 NOT NULL -- Table `tagente_estado` ------------------------------------------------------------------------ ALTER TABLE tagente_estado ADD (last_known_status NUMBER(5, 0) default 0 NOT NULL); + +-- ----------------------------------------------------- +-- Table `tevent_response` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS tevent_response ( + id NUMBER(10) NOT NULL PRIMARY KEY, + name varchar2(600) NOT NULL default '', + description CLOB, + target CLOB, + type varchar2(60) NOT NULL, + id_group MEDIUMINT(4) NOT NULL default 0, + modal_width NUMBER(10, 0) NOT NULL DEFAULT 0, + modal_height NUMBER(10, 0) NOT NULL DEFAULT 0, + new_window NUMBER(10, 0) NOT NULL DEFAULT 0, + params CLOB +); +CREATE SEQUENCE tevent_response_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index 2f841b66b9..69f88e8800 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -338,3 +338,19 @@ ALTER TABLE "tnetwork_map" ADD COLUMN "pandoras_children" INTEGER NOT NULL DEFAU -- Table `tagente_estado` ------------------------------------------------------------------------ ALTER TABLE "tagente_estado" ADD COLUMN "last_known_status" INTEGER default 0; + +-- ----------------------------------------------------- +-- Table `tevent_response` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS "tevent_response" ( + "id" SERIAL NOT NULL PRIMARY KEY, + "name" varchar(600) NOT NULL default '', + "description" TEXT, + "target" TEXT, + "type" varchar(60) NOT NULL, + "id_group" INTEGER NOT NULL default 0, + "modal_width" INTEGER NOT NULL DEFAULT 0, + "modal_height" INTEGER NOT NULL DEFAULT 0, + "new_window" INTEGER NOT NULL DEFAULT 0, + "params" TEXT, +); diff --git a/pandora_console/godmode/events/event_responses.editor.php b/pandora_console/godmode/events/event_responses.editor.php index c04745c311..b3925c9e44 100644 --- a/pandora_console/godmode/events/event_responses.editor.php +++ b/pandora_console/godmode/events/event_responses.editor.php @@ -92,27 +92,11 @@ $table->data[3] = $data; $data = array(); $table->colspan[4][1] = 3; -$data[0] = ''.__('Command').''; +$data[0] = ''.__('Command').''.ui_print_help_icon ("response_macros", true); $data[1] = html_print_input_text('target',$event_response['target'],'',150,255,true); $types = array('url' => __('URL'), 'command' => __('Command')); $table->data[4] = $data; -$data = array(); -$table->colspan[5][0] = 4; - -$macros = events_get_macros(); - -$macros_info = "
"; -foreach($macros as $k=>$v) { - $macros_info .= "$v: $k
"; -} -$macros_info .= "
"; - -$data[0] = ui_print_info_message(array('title'=>__('Available macros'), 'message' => '
'.$macros_info), '', true); -$table->data[5] = $data; - -echo '
'; - if($event_response_id == 0) { echo '
'; html_print_table($table); diff --git a/pandora_console/include/help/en/help_response_macros.php b/pandora_console/include/help/en/help_response_macros.php new file mode 100644 index 0000000000..95650884d9 --- /dev/null +++ b/pandora_console/include/help/en/help_response_macros.php @@ -0,0 +1,31 @@ +Event responses macros + +

+The response target (command or URL) accepts macros to custom it. +

+The macros accepted are the following: + +

    +
  • Agent address: _agent_address_
  • +
  • Agent id: _agent_id_
  • +
  • Event id: _event_id_
  • +
+ +

Basic use

+In example, to ping the agent associated to the event: +

+Configure command like: ping -c 5 _agent_address_ +

+If there are configured parameters, is possible use it as macros too. + +

Parameters macros

+In example, to custom a URL with parameters: +

+Configure parameters like: User,Section +

+And configure the URL like: http://example.com/index.php?user=_User_&section=_Section_ +

diff --git a/pandora_console/include/help/en/help_response_parameters.php b/pandora_console/include/help/en/help_response_parameters.php new file mode 100644 index 0000000000..b66df30416 --- /dev/null +++ b/pandora_console/include/help/en/help_response_parameters.php @@ -0,0 +1,22 @@ + + +

Event responses parameters

+ +

The response parameters will be separated by commas. +

+In example: +

+User,Password,Port +

+Each parameter can be used as macro in the command/URL adding before and after a low bar. +

+In example: +

+_Port_ +

+Please, don't use blank spaces in the Parameters +

diff --git a/pandora_console/include/help/es/help_response_macros.php b/pandora_console/include/help/es/help_response_macros.php new file mode 100644 index 0000000000..a8c3556ba8 --- /dev/null +++ b/pandora_console/include/help/es/help_response_macros.php @@ -0,0 +1,31 @@ + +

Macros en Respuestas de eventos

+ +

+El target de la respuesta (comando o URL) acepta macros para personalizarlo. +

+Las macros aceptadas son las siguientes: + +

    +
  • Dirección del agente: _agent_address_
  • +
  • Id del agente: _agent_id_
  • +
  • Id del evento: _event_id_
  • +
+ +

Uso básico

+Por ejemplo, para hacer un ping al agente asociado al evento: +

+Configurar el comando así: ping -c 5 _agent_address_ +

+Si hay parámetros configurados, es posible usarlos como macros también. +

Macros de parámetros

+Por ejemplo, para personalizar una URL con parámetros: +

+Configurar los parámetros así: User,Section +

+Y configurar la URL así: http://example.com/index.php?user=_User_&section=_Section_ +

diff --git a/pandora_console/include/help/es/help_response_parameters.php b/pandora_console/include/help/es/help_response_parameters.php new file mode 100644 index 0000000000..1e8375e7a1 --- /dev/null +++ b/pandora_console/include/help/es/help_response_parameters.php @@ -0,0 +1,21 @@ + +

Parámetros de respuestas de eventos

+ +

Los parámetros de respuesta van separados por comas. +

+Por ejemplo: +

+User,Password,Port +

+Cada parámetro puede ser usado como una macro en el comando/URL añadiendo antes y después un guió:n bajo. +

+Por ejemplo: +

+_Port_ +

+Por favor, no use espacios en blanco en los parámetros +

diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index 5831f04d0e..4d59286196 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -608,3 +608,4 @@ INSERT INTO tagent_custom_fields VALUES (1,'Serial Number',0),(2,'Departmen INSERT INTO ttag VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); +INSERT INTO tevent_response VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,''),(2,'SSH to host','Connect via SSH to the agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,''),(4,'Create Integria IMS incident from event','Create a incident from the event with integria incidents system of Pandora FMS. Is necessary to enable and configure the Integria incidents in Pandora FMS setup.','index.php?sec=workspace&sec2=operation/integria_incidents/incident&tab=editor&from_event=_event_id_','url',0,0,0,1,''),(5,'Restart agent','Restart the agent with using UDP protocol. To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,''); diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 602fdea1c7..47db3c4a10 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -448,3 +448,5 @@ INSERT INTO "tplugin" ("id", "name", "description", "max_timeout", "execute", "p INSERT INTO "tagent_custom_fields" VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0); INSERT INTO "ttag" VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); + +INSERT INTO "tevent_response" VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,''),(2,'SSH to host','Connect via SSH to the agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,''),(4,'Create Integria IMS incident from event','Create a incident from the event with integria incidents system of Pandora FMS. Is necessary to enable and configure the Integria incidents in Pandora FMS setup.','index.php?sec=workspace&sec2=operation/integria_incidents/incident&tab=editor&from_event=_event_id_','url',0,0,0,1,''),(5,'Restart agent','Restart the agent with using UDP protocol. To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,''); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 99dfef36ae..14bf2bfd59 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1693,3 +1693,20 @@ CREATE TABLE IF NOT EXISTS tpassword_history ( date_end TIMESTAMP DEFAULT 0 ); CREATE SEQUENCE tpassword_history_s INCREMENT BY 1 START WITH 1; + +-- ----------------------------------------------------- +-- Table `tevent_response` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS tevent_response ( + id NUMBER(10) NOT NULL PRIMARY KEY, + name varchar2(600) NOT NULL default '', + description CLOB, + target CLOB, + type varchar2(60) NOT NULL, + id_group MEDIUMINT(4) NOT NULL default 0, + modal_width NUMBER(10, 0) NOT NULL DEFAULT 0, + modal_height NUMBER(10, 0) NOT NULL DEFAULT 0, + new_window NUMBER(10, 0) NOT NULL DEFAULT 0, + params CLOB +); +CREATE SEQUENCE tevent_response_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 04e0dbc1aa..5e1168ad92 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1432,3 +1432,19 @@ CREATE TABLE "tpassword_history" ( "date_begin" BIGINT NOT NULL default 0, "date_end" BIGINT NOT NULL default 0, ); + +-- ----------------------------------------------------- +-- Table `tevent_response` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS "tevent_response" ( + "id" SERIAL NOT NULL PRIMARY KEY, + "name" varchar(600) NOT NULL default '', + "description" TEXT, + "target" TEXT, + "type" varchar(60) NOT NULL, + "id_group" INTEGER NOT NULL default 0, + "modal_width" INTEGER NOT NULL DEFAULT 0, + "modal_height" INTEGER NOT NULL DEFAULT 0, + "new_window" INTEGER NOT NULL DEFAULT 0, + "params" TEXT, +); diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 7d6071d0b0..0e055dd695 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -438,3 +438,4 @@ INSERT INTO `tagent_custom_fields` VALUES (1,'Serial Number',0),(2,'Departm INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es'),(2,'critical','Critical modules',''),(3,'dmz','DMZ Network Zone',''),(4,'performance','Performance anda capacity modules',''),(5,'configuration','',''); +INSERT INTO `tevent_response` VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,''),(2,'SSH to host','Connect via SSH to the agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,''),(4,'Create Integria IMS incident from event','Create a incident from the event with integria incidents system of Pandora FMS. Is necessary to enable and configure the Integria incidents in Pandora FMS setup.','index.php?sec=workspace&sec2=operation/integria_incidents/incident&tab=editor&from_event=_event_id_','url',0,0,0,1,''),(5,'Restart agent','Restart the agent with using UDP protocol. To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,'');