diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index f3b522f453..86b23fdb7a 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.729-181119
+Version: 7.0NG.729-181121
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index 744c15faa3..9c23f55258 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.729-181119"
+pandora_version="7.0NG.729-181121"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index 5dcb204f4b..7950a9ac3b 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.729';
-use constant AGENT_BUILD => '181119';
+use constant AGENT_BUILD => '181121';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 1b73e1a002..36ab5fd73a 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
-%define release 181119
+%define release 181121
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 1bee404d62..e40aa2d331 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.729
-%define release 181119
+%define release 181121
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index c890a0fee8..4472239b6e 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.729"
-PI_BUILD="181119"
+PI_BUILD="181121"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index e59a1cfd83..474db7ba2c 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{181119}
+{181121}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index f763576e59..6e4ccb69da 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.729(Build 181119)")
+#define PANDORA_VERSION ("7.0NG.729(Build 181121)")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index b0a3ce4c02..839789b48d 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
- VALUE "ProductVersion", "(7.0NG.729(Build 181119))"
+ VALUE "ProductVersion", "(7.0NG.729(Build 181121))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 98449ce593..e82acca4ce 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.729-181119
+Version: 7.0NG.729-181121
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index c5087fdc30..bd4a3bd65d 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.729-181119"
+pandora_version="7.0NG.729-181121"
package_pear=0
package_pandora=1
diff --git a/pandora_console/extras/mr/22.sql b/pandora_console/extras/mr/22.sql
index 39c18cad6c..6ddb2bf5ac 100644
--- a/pandora_console/extras/mr/22.sql
+++ b/pandora_console/extras/mr/22.sql
@@ -1,5 +1,7 @@
START TRANSACTION;
+ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
+
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
ALTER TABLE `tusuario` ADD COLUMN `default_custom_view` int(10) unsigned NULL default '0';
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index a2d81b64d9..e27569a0cf 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -1159,8 +1159,8 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
-- Table `talert_commands`
-- ---------------------------------------------------------------------
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket';
-
UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:
_field1_ as destination email address, and
_field2_ as subject for message.
_field3_ as text of message.
_field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
+ALTER TABLE `talert_commands` ADD COLUMN `id_group` mediumint(8) unsigned NULL default 0;
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php
index a80ba40a23..2c2357541d 100644
--- a/pandora_console/godmode/alerts/alert_actions.php
+++ b/pandora_console/godmode/alerts/alert_actions.php
@@ -57,7 +57,7 @@ else {
$sec = 'galertas';
}
-if ((!$copy_action) && (!$delete_action) && (!$update_action)) {
+if ((!$copy_action) && (!$delete_action)) {
// Header
if (defined('METACONSOLE')) {
alerts_meta_print_header ();
@@ -141,135 +141,8 @@ if ($copy_action) {
__('Could not be copied'));
}
-if ($create_action) {
- $name = (string) get_parameter ('name');
- $id_alert_command = (int) get_parameter ('id_command');
-
- $fields_descriptions = array();
- $fields_values = array();
- $info_fields = '';
- $values = array();
- for($i=1;$i<=$config['max_macro_fields'];$i++) {
- $values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
- $info_fields .= ' Field'.$i.': ' . $values['field'.$i];
- $values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
- $info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
- }
-
- $values['id_group'] = (string) get_parameter ('group');
- $values['action_threshold'] = (int) get_parameter ('action_threshold');
-
- $name_check = db_get_value ('name', 'talert_actions', 'name', $name);
-
- if ($name_check) {
- $result = '';
- }
- else {
- $result = alerts_create_alert_action ($name, $id_alert_command,
- $values);
-
- $info = '{"Name":"'.$name.'", "ID alert Command":"'.$id_alert_command.'", "Field information":"'.$info_fields.'", "Group":"'.$values['id_group'].'",
- "Action threshold":"'.$values['action_threshold'].'"}';
- }
-
- if ($result) {
- db_pandora_audit("Command management", "Create alert action #" . $result, false, false, $info);
- }
- else {
- db_pandora_audit("Command management", "Fail try to create alert action", false, false);
- }
-
-
- /* Show errors */
- if (!isset($messageAction)) {
- $messageAction = __('Could not be created');
- }
-
- if ($name == "") {
- $messageAction = __('No name specified');
- }
-
- if ($id_alert_command == "") {
- $messageAction = __('No command specified');
- }
-
- $messageAction = ui_print_result_message ($result,
- __('Successfully created'),
- $messageAction);
-}
-
-if ($update_action) {
- $id = (string) get_parameter ('id');
-
- $al_action = alerts_get_alert_action ($id);
-
- if ($al_action !== false) {
- if ($al_action['id_group'] == 0) {
- if (! check_acl ($config['id_user'], 0, "PM")) {
- db_pandora_audit("ACL Violation",
- "Trying to access Alert Management");
- require ("general/noaccess.php");
- exit;
- }
- else {
- // Header
- if (defined('METACONSOLE')) {
- alerts_meta_print_header ();
- }
- else {
- ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
- }
- }
- }
- }
- else {
- // Header
- if (defined('METACONSOLE')) {
- alerts_meta_print_header ();
- }
- else {
- ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/gm_alerts.png", false, "alerts_config", true);
- }
- }
-
-
- $name = (string) get_parameter ('name');
- $id_alert_command = (int) get_parameter ('id_command');
- $group = get_parameter ('group');
- $action_threshold = (int) get_parameter ('action_threshold');
-
- $info_fields = '';
- $values = array();
-
- for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
- $values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
- $info_fields .= ' Field1: ' . $values['field'.$i];
- $values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
- $info_fields .= ' Field'.$i.'Recovery: ' . $values['field'.$i.'_recovery'];
- }
-
- $values['name'] = $name;
- $values['id_alert_command'] = $id_alert_command;
- $values['id_group'] = $group;
- $values['action_threshold'] = $action_threshold;
-
- if (!$name) {
- $result = '';
- }
- else {
- $result = alerts_update_alert_action ($id, $values);
- }
-
- if ($result) {
- db_pandora_audit("Command management", "Update alert action #" . $id, false, false, json_encode($values));
- }
- else {
- db_pandora_audit("Command management", "Fail try to update alert action #" . $id, false, false, json_encode($values));
- }
-
- ui_print_result_message ($result,
- __('Successfully updated'),
- __('Could not be updated'));
+if ($update_action || $create_action) {
+ alerts_ui_update_or_create_actions($update_action);
}
if ($delete_action) {
@@ -363,9 +236,13 @@ $table->align[3] = 'left';
$filter = array();
if (!is_user_admin($config['id_user']))
- $filter['id_group'] = array_keys(users_get_groups(false, "LM"));
+ $filter['talert_actions.id_group'] = array_keys(users_get_groups(false, "LM"));
-$actions = db_get_all_rows_filter ('talert_actions', $filter);
+$actions = db_get_all_rows_filter (
+ 'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
+ $filter,
+ 'talert_actions.* , talert_commands.id_group AS command_group'
+);
if ($actions === false)
$actions = array ();
@@ -380,11 +257,19 @@ foreach ($actions as $action) {
$iterator++;
$data = array ();
-
+
$data[0] = ''.
$action['name'].'';
$data[1] = ui_print_group_icon ($action["id_group"], true) .' ';
-
+ if (!alerts_validate_command_to_action($action["id_group"], $action["command_group"])) {
+ $data[1].= html_print_image(
+ "images/error.png",
+ true,
+ // FIXME: Translation.
+ array("title" => __("The action and the command associated with it do not have the same group. Please contact an administrator to fix it.")
+ ));
+ }
+
if (check_acl($config['id_user'], $action["id_group"], "LM")) {
$data[2] = '' .
@@ -393,7 +278,7 @@ foreach ($actions as $action) {
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
html_print_image("images/cross.png", true) . '';
}
-
+
array_push ($table->data, $data);
}
if (isset($data)) {
diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php
index 9ca4ea501a..3f890e1190 100644
--- a/pandora_console/godmode/alerts/alert_commands.php
+++ b/pandora_console/godmode/alerts/alert_commands.php
@@ -38,6 +38,7 @@ $pure = (int)get_parameter('pure', 0);
$update_command = (bool) get_parameter ('update_command');
$create_command = (bool) get_parameter ('create_command');
$delete_command = (bool) get_parameter ('delete_command');
+$copy_command = (bool) get_parameter ('copy_command');
if (is_ajax ()) {
$get_alert_command = (bool) get_parameter ('get_alert_command');
@@ -57,37 +58,13 @@ if (is_ajax ()) {
if (isset($command['description'])) {
$command['description'] = io_safe_input(str_replace("\r\n","
", io_safe_output($command['description'])));
}
-
- // Get the html rows of the fields form
- switch ($config["dbtype"]) {
- case "mysql":
- case "postgresql":
- // Descriptions are stored in json
- $fields_descriptions = empty($command['fields_descriptions']) ?
- '' : json_decode(io_safe_output($command['fields_descriptions']), true);
-
- // Fields values are stored in json
- $fields_values = empty($command['fields_values']) ?
- '' : io_safe_output(json_decode($command['fields_values'], true));
- break;
- case "oracle":
- // Descriptions are stored in json
- $description_field = str_replace("\\\"","\"",$command['fields_descriptions']);
- $description_field = str_replace("\\","",$description_field);
-
- $fields_descriptions = empty($command['fields_descriptions']) ?
- '' : json_decode(io_safe_output($description_field), true);
-
- // Fields values are stored in json
- $values_fields = str_replace("\\\"","\"",$command['fields_values']);
- $values_fields = str_replace("\\","",$values_fields);
-
- $fields_values = empty($command['fields_values']) ?
- '' : io_safe_output(json_decode($values_fields, true));
-
- break;
- }
-
+ // Descriptions are stored in json
+ $fields_descriptions = empty($command['fields_descriptions']) ?
+ '' : json_decode(io_safe_output($command['fields_descriptions']), true);
+ // Fields values are stored in json
+ $fields_values = empty($command['fields_values']) ?
+ '' : io_safe_output(json_decode($command['fields_values'], true));
+
$fields_rows = array();
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
@@ -266,13 +243,11 @@ if (defined('METACONSOLE'))
else
ui_print_page_header (__('Alerts').' » '.__('Alert commands'), "images/gm_alerts.png", false, "alerts_config", true);
-
-
-
if ($create_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
+ $id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@@ -287,7 +262,8 @@ if ($create_command) {
$values['fields_values'] = io_json_mb_encode($fields_values);
$values['fields_descriptions'] = io_json_mb_encode($fields_descriptions);
$values['description'] = $description;
-
+ $values['id_group'] = $id_group;
+
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
if (!$name_check) {
@@ -349,8 +325,27 @@ if ($delete_command) {
ui_print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
-
-
+}
+
+if ($copy_command) {
+ $id = (int) get_parameter ('id');
+
+ // Get the info from the source command
+ $command_to_copy = db_get_row('talert_commands', 'id', $id);
+ if ($command_to_copy === false) {
+ ui_print_error_message(__("Command with id $id does not found."));
+ } else {
+ // Prepare to insert the copy with same values
+ unset ($command_to_copy['id']);
+ $command_to_copy['name'].= __(' (copy)');
+ $result = db_process_sql_insert('talert_commands', $command_to_copy);
+
+ // Print the result
+ ui_print_result_message ($result,
+ __('Successfully copied'),
+ __('Could not be copied')
+ );
+ }
}
$table->width = '100%';
@@ -358,45 +353,54 @@ $table->class = 'databox data';
$table->data = array ();
$table->head = array ();
-$table->head[0] = __('Name');
-$table->head[1] = __('ID');
-$table->head[2] = __('Description');
-$table->head[3] = __('Delete');
+$table->head['name'] = __('Name');
+$table->head['id'] = __('ID');
+$table->head['group'] = __('Group');
+$table->head['description'] = __('Description');
+$table->head['action'] = __('Actions');
$table->style = array ();
-$table->style[0] = 'font-weight: bold';
+$table->style['name'] = 'font-weight: bold';
$table->size = array ();
-$table->size[3] = '40px';
+$table->size['action'] = '40px';
$table->align = array ();
-$table->align[3] = 'left';
+$table->align['action'] = 'left';
-$commands = db_get_all_rows_in_table ('talert_commands');
-if ($commands === false)
- $commands = array ();
+$commands = db_get_all_rows_filter(
+ 'talert_commands',
+ array('id_group' => array_keys(users_get_groups(false, "LM")))
+);
+if ($commands === false) $commands = array ();
foreach ($commands as $command) {
$data = array ();
-
- $data[0] = '';
+
+ $data['name'] = '';
if (! $command['internal'])
- $data[0] .= ''.
+ $data['name'] .= ''.
$command['name'].'';
else
- $data[0] .= $command['name'];
- $data[0] .= '';
- $data[1] = $command['id'];
- $data[2] = str_replace("\r\n","
",
+ $data['name'] .= $command['name'];
+ $data['name'] .= '';
+ $data['id'] = $command['id'];
+ $data['group'] = ui_print_group_icon ($command["id_group"], true);
+ $data['description'] = str_replace("\r\n","
",
io_safe_output($command['description']));
- $data[3] = '';
+ $data['action'] = '';
if (! $command['internal']) {
- $data[3] = '';
+ $data['action'].= ''.
+ html_print_image("images/copy.png", true) . '';
+ $data['action'].= ''.
html_print_image("images/cross.png", true) . '';
+ $data['action'].= '';
}
-
+
array_push ($table->data, $data);
}
-if (isset($data)) {
+if (count($table->data) > 0) {
html_print_table ($table);
}
else {
diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php
index d1fe842469..46b1ce8a4c 100644
--- a/pandora_console/godmode/alerts/configure_alert_action.php
+++ b/pandora_console/godmode/alerts/configure_alert_action.php
@@ -122,7 +122,6 @@ $table->colspan[0][1] = 2;
$table->data[1][0] = __('Group');
-$groups = users_get_groups ();
$own_info = get_user_info ($config['id_user']);
// Only display group "All" if user is administrator or has "PM" privileges
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
@@ -133,9 +132,17 @@ $table->data[1][1] = html_print_select_groups(false, "LW", $display_all_group, '
$table->colspan[1][1] = 2;
$table->data[2][0] = __('Command');
-$table->data[2][1] = html_print_select_from_sql ('SELECT id, name
- FROM talert_commands',
- 'id_command', $id_command, '', __('None'), 0, true);
+$commands_sql = db_get_all_rows_filter(
+ 'talert_commands',
+ array('id_group' => array_keys(users_get_groups(false, "LW"))),
+ array('id', 'name'),
+ 'AND',
+ false,
+ true
+);
+$table->data[2][1] = html_print_select_from_sql ($commands_sql, 'id_command', $id_command,
+ '', __('None'), 0, true
+);
$table->data[2][1] .= ' ';
if (check_acl ($config['id_user'], 0, "PM")) {
$table->data[2][1] .= html_print_image ('images/add.png', true);
@@ -282,6 +289,19 @@ $(document).ready (function () {
var max_fields = parseInt('');
+ // Change the selected group
+ $("#group option").each(function(index, value) {
+ var current_group = $(value).val();
+ if (data.id_group != 0 && current_group != 0 && current_group != data.id_group) {
+ $(value).hide();
+ } else {
+ $(value).show();
+ }
+ });
+ if (data.id_group != 0 && $("#group").val() != data.id_group) {
+ $("#group").val(0);
+ }
+
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';
diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php
index 983b8d90ff..55254cdadf 100644
--- a/pandora_console/godmode/alerts/configure_alert_command.php
+++ b/pandora_console/godmode/alerts/configure_alert_command.php
@@ -54,6 +54,7 @@ if ($update_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
+ $id_group = (string) get_parameter ('id_group', 0);
$fields_descriptions = array();
$fields_values = array();
@@ -71,7 +72,8 @@ if ($update_command) {
$values['name'] = $name;
$values['command'] = $command;
$values['description'] = $description;
-
+ $values['id_group'] = $id_group;
+
//Check it the new name is used in the other command.
$id_check = db_get_value ('id', 'talert_commands', 'name', $name);
if (($id_check != $id) && (!empty($id_check))) {
@@ -100,12 +102,13 @@ $command = '';
$description = '';
$fields_descriptions = '';
$fields_values = '';
+$id_group = 0;
if ($id) {
$alert = alerts_get_alert_command ($id);
$name = $alert['name'];
$command = $alert['command'];
$description = $alert['description'];
-
+ $id_group = $alert['id_group'];
$fields_descriptions = $alert['fields_descriptions'];
$fields_values = $alert['fields_values'];
}
@@ -123,13 +126,7 @@ $table->width = '100%';
$table->class = 'databox filters';
if (defined('METACONSOLE')) {
- if ($id) {
- $table->head[0] = __('Update Command');
- }
- else {
- $table->head[0] = __('Create Command');
- }
-
+ $table->head[0] = ($id) ? __('Update Command') : __('Create Command');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
@@ -142,18 +139,25 @@ $table->size = array ();
$table->size[0] = '20%';
$table->data = array ();
-$table->colspan[0][1] = 3;
-$table->data[0][0] = __('Name');
-$table->data[0][2] = html_print_input_text ('name', $name, '', 35, 255, true);
+$table->colspan['name'][1] = 3;
+$table->data['name'][0] = __('Name');
+$table->data['name'][2] = html_print_input_text ('name', $name, '', 35, 255, true);
-$table->colspan[1][1] = 3;
-$table->data[1][0] = __('Command');
-$table->data[1][0] .= ui_print_help_icon ('alert_macros', true);
-$table->data[1][1] = html_print_textarea ('command', 8, 30, $command, '', true);
+$table->colspan['command'][1] = 3;
+$table->data['command'][0] = __('Command');
+$table->data['command'][0] .= ui_print_help_icon ('alert_macros', true);
+$table->data['command'][1] = html_print_textarea ('command', 8, 30, $command, '', true);
+
+$table->colspan['group'][1] = 3;
+$table->data['group'][0] = __('Group');
+$table->data['group'][1] = html_print_select_groups(false, "LM",
+ true, 'id_group', $id_group, false,
+ '', 0, true);
+
+$table->colspan['description'][1] = 3;
+$table->data['description'][0] = __('Description');
+$table->data['description'][1] = html_print_textarea ('description', 10, 30, $description, '', true);
-$table->colspan[2][1] = 3;
-$table->data[2][0] = __('Description');
-$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
diff --git a/pandora_console/images/agent_mc.menu-2.png b/pandora_console/images/agent_mc.menu-2.png
new file mode 100644
index 0000000000..8c5b304b7f
Binary files /dev/null and b/pandora_console/images/agent_mc.menu-2.png differ
diff --git a/pandora_console/include/ajax/custom_fields.php b/pandora_console/include/ajax/custom_fields.php
index dfe7cf8c57..91a3ddb115 100644
--- a/pandora_console/include/ajax/custom_fields.php
+++ b/pandora_console/include/ajax/custom_fields.php
@@ -155,16 +155,67 @@ if($build_table_custom_fields){
$count = db_get_sql($query_count);
+ //for link nodes.
+ $array_nodes = metaconsole_get_connections();
+ if(isset($array_nodes) && is_array($array_nodes)){
+ $hash_array_nodes = array();
+ foreach ($array_nodes as $key => $server) {
+ $pwd = $server['auth_token'];
+ $auth_serialized = json_decode($pwd,true);
+
+ if (is_array($auth_serialized)) {
+ $pwd = $auth_serialized['auth_token'];
+ $api_password = $auth_serialized['api_password'];
+ $console_user = $auth_serialized['console_user'];
+ $console_password = $auth_serialized['console_password'];
+ }
+
+ $user = $config['id_user'];
+ $user_rot13 = str_rot13($config['id_user']);
+ $hashdata = $user.$pwd;
+ $hashdata = md5($hashdata);
+ $url_hash = '&' .
+ 'loginhash=auto&' .
+ 'loginhash_data=' . $hashdata . '&' .
+ 'loginhash_user=' . $user_rot13;
+
+ $hash_array_nodes[$server['id']]['hashurl'] = $url_hash;
+ $hash_array_nodes[$server['id']]['server_url'] = $server['server_url'];
+ }
+ }
+
//prepare rows for table dinamic
$data = array();
foreach ($result as $values) {
$image_status = agents_get_image_status($values['status']);
+ //link nodes
+ $agent_link = ''
+ ;
+
+ $agent_alias = ui_print_truncate_text($values['alias'],
+ 'agent_small', false, true, false, '[…]',
+ 'font-size:7.5pt;'
+ );
+
+ if (can_user_access_node ()) {
+ $agent = $agent_link . '' . $agent_alias . '';
+ }
+ else {
+ $agent = $agent_alias;
+ }
+
$data[] = array(
"ref" => $referencia,
"data_custom_field" => $values['name_custom_fields'],
"server" => $values['server_name'],
- "agent" => $values['alias'],
+ "agent" => $agent,
"IP" => $values['direccion'],
"status" => "