From 42b8b97f82fc243752e7c0351492f2e6709e7414 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:26:46 +0100 Subject: [PATCH 01/31] Fixed an error that made impossible the connection with the metaconsole nodes --- pandora_console/include/ajax/module.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 6e5e937da3..d6218d9843 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -79,14 +79,15 @@ if ($get_module_detail) { if (defined ('METACONSOLE')) { $server = metaconsole_get_connection ($server_name); - $conexion = mysql_connect ($server['dbhost'], $server['dbuser'], - $server['dbpass']); - $select_db = mysql_select_db ($server['dbname'], $conexion); + + if (metaconsole_connect($server) != NOERR) + return; + $conexion = false; } else { $conexion = false; } - + html_debug_print($conexion, true); $selection_mode = get_parameter('selection_mode', 'fromnow'); $date_from = (string) get_parameter ('date_from', date ('Y-m-j')); $time_from = (string) get_parameter ('time_from', date ('h:iA')); @@ -266,6 +267,7 @@ if ($get_module_detail) { html_print_table($table); } + metaconsole_restore_db(); return; } From 3b449f378931ff209dc0c39d0533b734123a8483 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:53:00 +0100 Subject: [PATCH 02/31] Now the the items detail is returned correctly --- pandora_console/include/ajax/tree.ajax.php | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 13639f97fa..64e1416e7c 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -27,7 +27,7 @@ if (is_ajax ()) { $getChildren = (bool) get_parameter('getChildren', 0); $getGroupStatus = (bool) get_parameter('getGroupStatus', 0); - $get_detail = (bool) get_parameter('getDetail'); + $getDetail = (bool) get_parameter('getDetail'); if ($getChildren) { $type = get_parameter('type', 'group'); @@ -82,35 +82,36 @@ if (is_ajax ()) { return; } - if ($get_detail) { + if ($getDetail) { require_once($config['homedir']."/include/functions_treeview.php"); - // Clean the output - ob_clean(); - $id = (int) get_parameter('id'); $type = (string) get_parameter('type'); $server = array(); if (defined ('METACONSOLE')) { - $server_name = (string) get_parameter('server'); - $server = metaconsole_get_connection($server_name); + $server_id = (int) get_parameter('serverID'); + $server = metaconsole_get_servers($server_id); metaconsole_connect($server); } - switch ($type) { - case 'agent': - treeview_printTable($id, $server); - break; - case 'module': - treeview_printModuleTable($id, $server); - break; - case 'alert': - treeview_printAlertsTable($id, $server); - break; - default: - // Nothing - break; + ob_clean(); + + if (!empty($id) && !empty($type)) { + switch ($type) { + case 'agent': + treeview_printTable($id, $server); + break; + case 'module': + treeview_printModuleTable($id, $server); + break; + case 'alert': + treeview_printAlertsTable($id, $server); + break; + default: + // Nothing + break; + } } if (!empty($server) && defined ('METACONSOLE')) { From 5c8956193dabb8c8dc7fae22c478843e45537dd9 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:58:33 +0100 Subject: [PATCH 03/31] Improved the tree view styles --- pandora_console/include/styles/tree.css | 53 +++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/styles/tree.css b/pandora_console/include/styles/tree.css index 2db5b7ae26..b49a1b83d4 100644 --- a/pandora_console/include/styles/tree.css +++ b/pandora_console/include/styles/tree.css @@ -5,7 +5,7 @@ .tree-group { margin-left: 16px; - padding-top: 4px; + padding-top: 1px; } .tree-node { @@ -22,11 +22,16 @@ background: 0 0; } .node-content { - height: 21px; + height: 16px; +} + +.node-content>img { + position: relative; + top: -2px; } .node-content:hover { - background-color: #9AB8DF; + background-color: #FFF; -moz-border-radius: 3px; -webkit-border-radius: 3px; @@ -101,6 +106,7 @@ .tree-node>.node-content>img.module-server-type, .tree-node>.node-content>img.agent-status, .tree-node>.node-content>img.agent-alerts-fired, +.tree-node>.node-content>img.agent-quiet, .tree-node>.node-content>img.module-status { padding-right: 3px; } @@ -122,4 +128,43 @@ font-weight: bold; font-size: 7pt; cursor: default; -} \ No newline at end of file +} + +div.tree-table { + display: table; + width: 98%; + margin-top: 10px; +} + +div.tree-table-row { + display: table-row; +} + +div.tree-table-cell { + display: table-cell; + vertical-align: top; +} + +div.tree-table-cell.tree-table-cell-tree { + /*width: 70%;*/ + max-width: 600px; + overflow-x: auto; + overflow-y: hidden; +} + +div.tree-table-cell.tree-table-cell-detail { + padding-left: 10px; + width: 350px; +} + +div.tree-element-detail-closed { + display: none; +} + +div#tree-controller-recipient { + text-align: left; +} + +div#tree-controller-detail-recipient { + /*text-align: right;*/ +} From 81a844d1f39d090766155a5506e6cf41b9274268 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Thu, 29 Jan 2015 20:59:28 +0100 Subject: [PATCH 04/31] Fixed the tree item detail output --- pandora_console/operation/tree2.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pandora_console/operation/tree2.php b/pandora_console/operation/tree2.php index 58056ce40c..3f6f21c55f 100644 --- a/pandora_console/operation/tree2.php +++ b/pandora_console/operation/tree2.php @@ -105,7 +105,8 @@ ui_print_page_header( // --------------------- form filter ----------------------------------- -$table = null; +$table = new StdClass(); +// $table->class = "blank"; $table->width = "100%"; $table->data = array(); $table->rowspan = array(); @@ -160,9 +161,18 @@ ui_require_javascript_file("TreeController", "include/javascript/tree/"); html_print_image('images/spinner.gif', false, array('class' => "loading_tree", 'style' => 'display: none;')); -echo "
"; -echo "
"; -echo "
"; + +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; +echo "
"; echo "
"; ?> From 62cb13cd6c4186d431de1fbe3c80bf2a053a0351 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 30 Jan 2015 20:09:38 +0100 Subject: [PATCH 20/31] Removed the tree views test file --- pandora_console/operation/tree2.php | 355 ---------------------------- 1 file changed, 355 deletions(-) delete mode 100644 pandora_console/operation/tree2.php diff --git a/pandora_console/operation/tree2.php b/pandora_console/operation/tree2.php deleted file mode 100644 index 3f6f21c55f..0000000000 --- a/pandora_console/operation/tree2.php +++ /dev/null @@ -1,355 +0,0 @@ - "" . - html_print_image("images/operating_system.png", true, - array("title" => __('OS'))) . "", - 'active' => ($tab == "os")); - -$tabs['group'] = array( - 'text' => "" . - html_print_image("images/group.png", true, - array("title" => __('Groups'))) . "", - 'active' => ($tab == "group")); - -$tabs['module_group'] = array( - 'text' => "" . - html_print_image("images/module_group.png", true, - array("title" => __('Module groups'))) . "", - 'active' => ($tab == "module_group")); - -$tabs['module'] = array( - 'text' => "" . - html_print_image("images/brick.png", true, - array("title" => __('Modules'))) . "", - 'active' => ($tab == "module")); - -$tabs['tag'] = array( - 'text' => "" . - html_print_image("images/tag.png", true, - array("title" => __('Tags'))) . "", - 'active' => ($tab == "tag")); - -if ($enterpriseEnable) { - $tabs['policies'] = array( - 'text' => "" . - html_print_image("images/policies_mc.png", true, - array("title" => __('Policies'))) . "", - 'active' => ($tab == "policies")); -} - -$header_title = ""; -switch ($tab) { - case 'os': - $header_title = - __('Tree view - Sort the agents by OS'); - break; - case 'group': - $header_title = - __('Tree view - Sort the agents by groups'); - break; - case 'module_group': - $header_title = - __('Tree view - Sort the agents by module groups'); - break; - case 'module': - $header_title = - __('Tree view - Sort the agents by modules'); - break; - case 'tag': - $header_title = - __('Tree view - Sort the agents by tags'); - break; -} - -ui_print_page_header( - $header_title, "images/extensions.png", false, "", false, $tabs); -// ---------------------Tabs ------------------------------------------- - - -// --------------------- form filter ----------------------------------- -$table = new StdClass(); -// $table->class = "blank"; -$table->width = "100%"; -$table->data = array(); -$table->rowspan = array(); - -// Agent filter -$agent_status_arr = array(); -$agent_status_arr[AGENT_STATUS_ALL] = __('All'); //default -$agent_status_arr[AGENT_STATUS_NORMAL] = __('Normal'); -$agent_status_arr[AGENT_STATUS_WARNING] = __('Warning'); -$agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical'); -$agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown'); -$agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init'); - -$row = array(); -$row[] = __('Agent status'); -$row[] = html_print_select($agent_status_arr, "status_agent", $status_agent, '', '', 0, true); -$row[] = __('Search agent'); -$row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true); - -// Button -$row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true); -$table->rowspan[][count($row)-1] = 2; - -$table->data[] = $row; - -// Module filter -$module_status_arr = array(); -$module_status_arr[-1] = __('All'); //default -$module_status_arr[AGENT_MODULE_STATUS_NORMAL] = __('Normal'); -$module_status_arr[AGENT_MODULE_STATUS_WARNING] = __('Warning'); -$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); -$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); -$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); - -$row = array(); -$row[] = __('Module status'); -$row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true); -$row[] = __('Search module'); -$row[] = html_print_input_text("search_module", $search_module, '', 40, 30, true); - -$table->data[] = $row; - -echo ''; - -// --------------------- form filter ----------------------------------- -ui_include_time_picker(); -ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/"); - -ui_require_javascript_file("TreeController", "include/javascript/tree/"); -html_print_image('images/spinner.gif', false, - array('class' => "loading_tree", - 'style' => 'display: none;')); - -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -echo "
"; -?> - \ No newline at end of file From f6e31d4a17243e4d6ee066c58c5dd553883f4fa6 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Fri, 30 Jan 2015 20:41:54 +0100 Subject: [PATCH 21/31] Modified the view to restrict some controls when the strict ACL is enabled --- pandora_console/operation/tree.php | 105 ++++++++++++++++------------- 1 file changed, 60 insertions(+), 45 deletions(-) diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index baa7d8c626..738d26df05 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -23,6 +23,8 @@ $status_agent = get_parameter('statusAgent', AGENT_STATUS_ALL); $search_module = get_parameter('searchModule', ''); $status_module = get_parameter('statusModule', -1); +$strict_acl = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']); + // ---------------------Tabs ------------------------------------------- $enterpriseEnable = false; if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) { @@ -38,71 +40,82 @@ $url = 'index.php?' . $tabs = array(); -$tabs['tag'] = array( - 'text' => "" . - html_print_image("images/tag.png", true, - array("title" => __('Tags'))) . "", - 'active' => ($tab == "tag")); +if (!$strict_acl) { + $tabs['tag'] = array( + 'text' => "" . + html_print_image("images/tag.png", true, + array("title" => __('Tags'))) . "", + 'active' => ($tab == "tag")); -$tabs['os'] = array( - 'text' => "" . - html_print_image("images/operating_system.png", true, - array("title" => __('OS'))) . "", - 'active' => ($tab == "os")); + $tabs['os'] = array( + 'text' => "" . + html_print_image("images/operating_system.png", true, + array("title" => __('OS'))) . "", + 'active' => ($tab == "os")); -$tabs['group'] = array( - 'text' => "" . - html_print_image("images/group.png", true, - array("title" => __('Groups'))) . "", - 'active' => ($tab == "group")); + $tabs['group'] = array( + 'text' => "" . + html_print_image("images/group.png", true, + array("title" => __('Groups'))) . "", + 'active' => ($tab == "group")); -$tabs['module_group'] = array( - 'text' => "" . - html_print_image("images/module_group.png", true, - array("title" => __('Module groups'))) . "", - 'active' => ($tab == "module_group")); + $tabs['module_group'] = array( + 'text' => "" . + html_print_image("images/module_group.png", true, + array("title" => __('Module groups'))) . "", + 'active' => ($tab == "module_group")); -$tabs['module'] = array( - 'text' => "" . - html_print_image("images/brick.png", true, - array("title" => __('Modules'))) . "", - 'active' => ($tab == "module")); + $tabs['module'] = array( + 'text' => "" . + html_print_image("images/brick.png", true, + array("title" => __('Modules'))) . "", + 'active' => ($tab == "module")); -if ($enterpriseEnable) { - $tabs['policies'] = array( - 'text' => "" . - html_print_image("images/policies_mc.png", true, - array("title" => __('Policies'))) . "", - 'active' => ($tab == "policies")); + if ($enterpriseEnable) { + $tabs['policies'] = array( + 'text' => "" . + html_print_image("images/policies_mc.png", true, + array("title" => __('Policies'))) . "", + 'active' => ($tab == "policies")); + } } -$header_title = __('Tree view') . " - " . __('Sort the agents by %s'); +$header_title = __('Tree view'); +$header_sub_title = __('Sort the agents by %s'); switch ($tab) { case 'tag': - $header_title = sprintf($header_title, __('tags')); + $header_sub_title = sprintf($header_sub_title, __('tags')); break; case 'os': - $header_title = sprintf($header_title, __('OS')); + $header_sub_title = sprintf($header_sub_title, __('OS')); break; case 'group': - $header_title = sprintf($header_title, __('groups')); + $header_sub_title = sprintf($header_sub_title, __('groups')); break; case 'module_group': - $header_title = sprintf($header_title, __('module groups')); + $header_sub_title = sprintf($header_sub_title, __('module groups')); break; case 'module': - $header_title = sprintf($header_title, __('modules')); + $header_sub_title = sprintf($header_sub_title, __('modules')); break; case 'policies': if ($enterpriseEnable) - $header_title = sprintf($header_title, __('policies')); + $header_sub_title = sprintf($header_sub_title, __('policies')); break; } -if (defined('METACONSOLE')) - ui_meta_print_header($header_title, "", $tabs); -else +if (defined('METACONSOLE')) { + if ($strict_acl) + $header_sub_title = ''; + + ui_meta_print_header($header_title, $header_sub_title, $tabs); +} +else{ + if (!$strict_acl) + $header_title = $header_title ." - ". $header_sub_title; + ui_print_page_header($header_title, "images/extensions.png", false, "", false, $tabs); +} // ---------------------Tabs ------------------------------------------- @@ -128,8 +141,8 @@ else { } // --------------------- form filter ----------------------------------- + $table = new StdClass(); -// $table->class = "blank"; $table->width = "100%"; $table->data = array(); $table->rowspan = array(); @@ -174,9 +187,11 @@ $table->data[] = $row; enterprise_hook('open_meta_frame'); -echo ''; +if (!$strict_acl) { + echo ''; +} // --------------------- form filter ----------------------------------- ui_include_time_picker(); From 52758574b79b217a4599c0abb065495f7ed80483 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 30 Jan 2015 19:32:35 +0100 Subject: [PATCH 22/31] Update the server's version. Fixes ticket #1739. --- pandora_server/lib/PandoraFMS/Core.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index d3587caf2d..f3034a3e07 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -2005,6 +2005,7 @@ sub pandora_update_server ($$$$$$;$$) { $queue_size = 0 unless defined ($queue_size); my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime()); + my $version = $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'}; # First run if ($server_id == 0) { @@ -2014,7 +2015,7 @@ sub pandora_update_server ($$$$$$;$$) { if (! defined ($server)) { $server_id = db_insert ($dbh, 'id_server', 'INSERT INTO tserver (name, server_type, description, version, threads, queued_modules) VALUES (?, ?, ?, ?, ?, ?)', $server_name, $server_type, - 'Autocreated at startup', $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'}, $num_threads, $queue_size); + 'Autocreated at startup', $version, $num_threads, $queue_size); $server = get_db_single_row ($dbh, 'SELECT status FROM tserver WHERE id_server = ?', $server_id); if (! defined ($server)) { @@ -2023,15 +2024,14 @@ sub pandora_update_server ($$$$$$;$$) { } } - my $version = $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'}; db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, laststart = ?, version = ?, threads = ?, queued_modules = ? WHERE id_server = ?', 1, $timestamp, $pa_config->{'pandora_master'}, $timestamp, $version, $num_threads, $queue_size, $server_id); return; } - db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, threads = ?, queued_modules = ? - WHERE id_server = ?', $status, $timestamp, $pa_config->{'pandora_master'}, $num_threads, $queue_size, $server_id); + db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, version = ?, threads = ?, queued_modules = ? + WHERE id_server = ?', $status, $timestamp, $pa_config->{'pandora_master'}, $version, $num_threads, $queue_size, $server_id); } ########################################################################## From 62aa56ec1e62a6430dc6d6ad044ace671cd42bdf Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 31 Jan 2015 00:01:42 +0100 Subject: [PATCH 23/31] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index f7bd40ef05..bae7638836 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150130 +Version: 6.0dev-150131 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 73ac5f90bf..ea34957cf3 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="6.0dev-150130" +pandora_version="6.0dev-150131" 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 069a5e79ef..4b04d02768 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150130'; +use constant AGENT_BUILD => '150131'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d6a3dd3db1..c0c4797b6e 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 6.0dev -%define release 150130 +%define release 150131 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 e016380e24..8a072e467c 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 6.0dev -%define release 150130 +%define release 150131 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c066c0d96b..4b1728141e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150130} +{150131} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 7ffc06231b..b7e2664603 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 ("6.0dev(Build 150130)") +#define PANDORA_VERSION ("6.0dev(Build 150131)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d047b3533b..953f817830 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", "(6.0dev(Build 150130))" + VALUE "ProductVersion", "(6.0dev(Build 150131))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 077cfbc673..bf8601db8f 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150130 +Version: 6.0dev-150131 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 3137c0b3fd..3e37883a73 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="6.0dev-150130" +pandora_version="6.0dev-150131" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 2593bc6ba5..ecc7f33893 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150130'; +$build_version = 'PC150131'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 7e6debf347..caaa0763ad 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Sun, 1 Feb 2015 00:01:08 +0100 Subject: [PATCH 24/31] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index bae7638836..69e71521e7 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150131 +Version: 6.0dev-150201 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 ea34957cf3..3ad2450df9 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="6.0dev-150131" +pandora_version="6.0dev-150201" 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 4b04d02768..91ddc5e20e 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150131'; +use constant AGENT_BUILD => '150201'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index c0c4797b6e..1807a50bc0 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 6.0dev -%define release 150131 +%define release 150201 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 8a072e467c..2b656ddf37 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 6.0dev -%define release 150131 +%define release 150201 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 4b1728141e..fb308304d1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150131} +{150201} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b7e2664603..d48d0124c7 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 ("6.0dev(Build 150131)") +#define PANDORA_VERSION ("6.0dev(Build 150201)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 953f817830..6ac359d00c 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", "(6.0dev(Build 150131))" + VALUE "ProductVersion", "(6.0dev(Build 150201))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index bf8601db8f..e46cafbecf 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150131 +Version: 6.0dev-150201 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 3e37883a73..f50a9af3cc 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="6.0dev-150131" +pandora_version="6.0dev-150201" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index ecc7f33893..690feb4980 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150131'; +$build_version = 'PC150201'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index caaa0763ad..9939ef12a9 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Mon, 2 Feb 2015 00:01:07 +0100 Subject: [PATCH 25/31] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb_data.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 69e71521e7..312bc851d2 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150201 +Version: 6.0dev-150202 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 3ad2450df9..216882340b 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="6.0dev-150201" +pandora_version="6.0dev-150202" 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 91ddc5e20e..82e6922af4 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '6.0dev'; -use constant AGENT_BUILD => '150201'; +use constant AGENT_BUILD => '150202'; # Commands to retrieve total memory information in kB use constant TOTALMEMORY_CMDS => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 1807a50bc0..f9571a9bf9 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 6.0dev -%define release 150201 +%define release 150202 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 2b656ddf37..6dff49351f 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 6.0dev -%define release 150201 +%define release 150202 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index fb308304d1..c139e76d4e 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150201} +{150202} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index d48d0124c7..0c6c1affdd 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 ("6.0dev(Build 150201)") +#define PANDORA_VERSION ("6.0dev(Build 150202)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 6ac359d00c..8ecb32af98 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", "(6.0dev(Build 150201))" + VALUE "ProductVersion", "(6.0dev(Build 150202))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index e46cafbecf..1162767340 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150201 +Version: 6.0dev-150202 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 f50a9af3cc..5b153d86f8 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="6.0dev-150201" +pandora_version="6.0dev-150202" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 690feb4980..6191a1c1fa 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC150201'; +$build_version = 'PC150202'; $pandora_version = 'v6.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 9939ef12a9..0048b1c1aa 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
Date: Mon, 2 Feb 2015 10:19:53 +0100 Subject: [PATCH 26/31] Fixed align in view table data in tree view (cherry picked from commit 18939f42497a46946861219cb04d90c7d6de0747) --- pandora_console/include/ajax/module.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 3b2d928179..5b2e0c34eb 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -164,7 +164,7 @@ if ($get_module_detail) { "Time" => array( "utimestamp", "modules_format_time", - "align" => "center") + "align" => "left") ); if ($selection_mode == "fromnow") { @@ -236,21 +236,21 @@ if ($get_module_detail) { $datos = "" . $datos . ""; // I dont why, but using index (value) method, data is automatically converted to html entities ¿? - $data[$attr[1]] = $datos; + $data[] = $datos; } elseif ($is_web_content_string) { //Fixed the goliat sends the strings from web //without HTML entities - $data[$attr[1]] = io_safe_input($row[$attr[0]]); + $data[] = io_safe_input($row[$attr[0]]); } else { // Just a string of alphanumerical data... just do print //Fixed the data from Selenium Plugin if ($row[$attr[0]] != strip_tags($row[$attr[0]])) - $data[$attr[1]] = io_safe_input($row[$attr[0]]); + $data[] = io_safe_input($row[$attr[0]]); else - $data[$attr[1]] = $row[$attr[0]]; + $data[] = $row[$attr[0]]; } } From d4de8b385640133731649c6c5365f226bc53e592 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Mon, 2 Feb 2015 10:24:29 +0100 Subject: [PATCH 27/31] Add width in table view data in tree view --- pandora_console/include/ajax/module.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 5b2e0c34eb..f25f422fec 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -160,11 +160,13 @@ if ($get_module_detail) { "Data" => array( "data", "modules_format_data", - "align" => "left"), + "align" => "left", + "width" => 500), "Time" => array( "utimestamp", "modules_format_time", - "align" => "left") + "align" => "left", + "width" => 500) ); if ($selection_mode == "fromnow") { From a74dafdb497c509fdcfc5d6f36a8cfcc14bb619d Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 2 Feb 2015 13:16:31 +0100 Subject: [PATCH 28/31] Fixed an error with the ip retrieving on the function "agents_get_network_interfaces" --- pandora_console/include/functions_agents.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 22e1da590d..e6ce865e7b 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -2263,19 +2263,18 @@ function agents_get_network_interfaces ($agents = false, $agents_filter = false) modules_get_status($module_id, $db_status, $module_value, $status, $title); $status_image = ui_print_status_image($status, $title, true); - $ip_target = ""; - if (isset($module['ip_target']) && !empty($module['ip_target'])) { - $ip_target = $module['ip_target']; - } + $ip_target = "--"; // Trying to get something like an IP from the description - else if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $module_description, $matches) + if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $module_description, $matches) || preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]| - (2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", $module_description, $matches)) { - if ($matches[0]) { - $ip_target = $matches[0]; - } + (2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", $module_description, $matches) && $matches[0]) { + + $ip_target = $matches[0]; } - $mac = ""; + // else if (isset($module['ip_target']) && !empty($module['ip_target'])) { + // $ip_target = $module['ip_target']; + // } + $mac = "--"; // Trying to get something like a mac from the description if (preg_match ("/([0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2})/i", $module_description, $matches)) { if ($matches[0]) { From 107b2bdb1cc5083227eb169c5b02b0777be0cfe2 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 2 Feb 2015 13:22:35 +0100 Subject: [PATCH 29/31] Improved the creation of the network interfaces table --- .../agentes/estado_generalagente.php | 182 +++++------------- 1 file changed, 49 insertions(+), 133 deletions(-) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 5d2b9a82dd..6cdea6fa22 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -385,143 +385,59 @@ if ($last_incident != false) { // START: TABLE INTERFACES -$columns = array( - "id_agente_modulo", - "nombre", - "descripcion", - "ip_target" - ); -$filter = array( - "id_agente" => $id_agente, - "id_tipo_modulo" => (int)db_get_value("id_tipo", "ttipo_modulo", "nombre", "remote_snmp_proc"), - "disabled" => 0 - ); -$modules = agents_get_modules($id_agente, $columns, $filter, true, false); -$interfaces = array(); +$network_interfaces_by_agents = agents_get_network_interfaces(array($agent)); -if (!empty($modules)) { - foreach ($modules as $key => $module) { - // Trying to get the interface name from the module name - if (preg_match ("/_(.+)$/", (string)$module['nombre'], $matches)) { - if ($matches[1]) { - $interface_name = $matches[1]; - $interface_name_escaped = str_replace("/", "\/", $interface_name); - - if (!isset($interfaces[$interface_name]) - || (isset($interfaces[$interface_name]) - && preg_match ("/^ifOperStatus_$interface_name_escaped$/i", (string)$module['nombre'], $matches))) { - $interfaces[$interface_name] = $module; - } - - } - } - } - unset($modules); +$network_interfaces = array(); +if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) { + $network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces']; +} + +if (!empty($network_interfaces)) { + $table_interface = new stdClass(); + $table_interface->id = 'agent_interface_info'; + $table_interface->class = 'databox'; + $table_interface->width = '100%'; + $table_interface->style = array(); + $table_interface->style['interface_status'] = 'width: 30px;'; + $table_interface->style['interface_graph'] = 'width: 20px;'; + $table_interface->head = array(); + $options = array( + "class" => "closed", + "style" => "vertical-align:middle; cursor:pointer;"); + $table_interface->head[0] = html_print_image("images/go.png", true, $options) . "  "; + $table_interface->head[0] .= '' . __('Interface information') .' (SNMP)'; + $table_interface->head_colspan = array(); + $table_interface->head_colspan[0] = 5; + $table_interface->data = array(); - if (!empty($interfaces)) { - - $table_interface = new stdClass(); - $table_interface->id = 'agent_interface_info'; - $table_interface->class = 'databox'; - $table_interface->width = '100%'; - $table_interface->style = array(); - $table_interface->style['interface_status'] = 'width: 30px;'; - $table_interface->style['interface_graph'] = 'width: 20px;'; - $table_interface->head = array(); - $options = array( - "class" => "closed", - "style" => "vertical-align:middle; cursor:pointer;"); - $table_interface->head[0] = html_print_image("images/go.png", true, $options) . "  "; - $table_interface->head[0] .= '' . __('Interface information') .' (SNMP)'; - $table_interface->head_colspan = array(); - $table_interface->head_colspan[0] = 5; - $table_interface->data = array(); - - foreach ($interfaces as $interface_name => $module) { - $interface_name_escaped = str_replace("/", "\/", $interface_name); - - $module_id = $module['id_agente_modulo']; - $db_status = modules_get_agentmodule_status($module_id); - $module_value = modules_get_last_value ($module_id); - modules_get_status($module_id, $db_status, $module_value, $status, $title); - $status = ui_print_status_image($status, $title, true); - - $ip_target = "--"; - // Trying to get something like an IP from the description - if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", (string)$module['descripcion'], $matches) || - preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]| - (2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", (string)$module['descripcion'], $matches)) { - if ($matches[0]) { - $ip_target = $matches[0]; - } - } - $mac = "--"; - // Trying to get something like a mac from the description - if (preg_match ("/([0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2})/i", (string)$module['descripcion'], $matches)) { - if ($matches[0]) { - $mac = $matches[0]; - } - } - - // Get the ifInOctets and ifOutOctets modules of the interface - $columns = array( - "id_agente_modulo", - "nombre" - ); - $interface_traffic_modules = agents_get_modules($id_agente, $columns, "nombre LIKE 'if%Octets_$interface_name'"); - if (!empty($interface_traffic_modules) && count($interface_traffic_modules) >= 2) { - $interface_traffic_modules_aux = array('in' => '', 'out' => ''); - foreach ($interface_traffic_modules as $interface_traffic_module) { - $interface_name_escaped = str_replace("/", "\/", $interface_name); - if (preg_match ("/^if(.+)Octets_$interface_name_escaped$/i", $interface_traffic_module['nombre'], $matches)) { - if (strtolower($matches[1]) == 'in') { - $interface_traffic_modules_aux['in'] = $interface_traffic_module['id_agente_modulo']; - } - elseif (strtolower($matches[1]) == 'out') { - $interface_traffic_modules_aux['out'] = $interface_traffic_module['id_agente_modulo']; - } - } - } - if (!empty($interface_traffic_modules_aux['in']) && !empty($interface_traffic_modules_aux['out'])) { - $interface_traffic_modules = $interface_traffic_modules_aux; - } - else { - $interface_traffic_modules = false; - } - } - else { - $interface_traffic_modules = false; - } - - if ($interface_traffic_modules != false) { - $params = array( - 'interface_name' => $interface_name, - 'agent_id' => $id_agente, - 'traffic_module_in' => $interface_traffic_modules_aux['in'], - 'traffic_module_out' => $interface_traffic_modules_aux['out'] - ); - $params_json = json_encode($params); - $params_encoded = base64_encode($params_json); - $win_handle = dechex(crc32($module_id.$interface_name)); - $graph_link = "" . - html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . ""; - } - else { - $graph_link = ""; - } - - $data = array(); - $data['interface_name'] = "" . $interface_name . ""; - $data['interface_status'] = $status; - $data['interface_graph'] = $graph_link; - $data['interface_ip'] = $ip_target; - $data['interface_mac'] = $mac; - $table_interface->data[] = $data; + foreach ($network_interfaces as $interface_name => $interface) { + if (!empty($interface['traffic'])) { + $params = array( + 'interface_name' => $interface_name, + 'agent_id' => $id_agente, + 'traffic_module_in' => $interface['traffic']['in'], + 'traffic_module_out' => $interface['traffic']['out'] + ); + $params_json = json_encode($params); + $params_encoded = base64_encode($params_json); + $win_handle = dechex(crc32($interface['status_module_id'].$interface_name)); + $graph_link = "" . + html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . ""; } + else { + $graph_link = ""; + } + + $data = array(); + $data['interface_name'] = "" . $interface_name . ""; + $data['interface_status'] = $interface['status_image']; + $data['interface_graph'] = $graph_link; + $data['interface_ip'] = $interface['ip']; + $data['interface_mac'] = $interface['mac']; + $table_interface->data[] = $data; } - // This javascript piece of code is used to make expandible the body of the table - ?> +?> - Date: Mon, 2 Feb 2015 13:26:47 +0100 Subject: [PATCH 30/31] Fixed the forced title --- pandora_console/include/javascript/tree/TreeController.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora_console/include/javascript/tree/TreeController.js b/pandora_console/include/javascript/tree/TreeController.js index e70bd121e2..552a017b3f 100644 --- a/pandora_console/include/javascript/tree/TreeController.js +++ b/pandora_console/include/javascript/tree/TreeController.js @@ -757,6 +757,9 @@ TreeNodeDetailController = { $label.addClass('tree-element-detail-loaded'); $content.html(data); + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); + controller.open(); }, error: function(xhr, textStatus, errorThrown) { From f59ba6f8602fe8dd648efcf60daf12a3cd662a90 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 2 Feb 2015 13:27:32 +0100 Subject: [PATCH 31/31] Added a network interfaces table to the agent detail table --- .../include/functions_treeview.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 4b0f2198f3..3a46ad414f 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -521,6 +521,58 @@ function treeview_printTable($id_agente, $server_data = array()) { $events_graph .= '

'; ui_toggle($events_graph, __('Events (24h)')); + + // Table network interfaces + $network_interfaces_by_agents = agents_get_network_interfaces(array($agent)); + + $network_interfaces = array(); + if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) { + $network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces']; + } + + if (!empty($network_interfaces)) { + $table = new stdClass(); + $table->id = 'agent_interface_info'; + $table->class = 'databox'; + $table->width = '100%'; + $table->style = array(); + $table->style['interface_status'] = 'width: 30px;'; + $table->style['interface_graph'] = 'width: 20px;'; + $table->head = array(); + $table->data = array(); + + foreach ($network_interfaces as $interface_name => $interface) { + if (!empty($interface['traffic'])) { + $params = array( + 'interface_name' => $interface_name, + 'agent_id' => $id_agente, + 'traffic_module_in' => $interface['traffic']['in'], + 'traffic_module_out' => $interface['traffic']['out'] + ); + $params_json = json_encode($params); + $params_encoded = base64_encode($params_json); + $win_handle = dechex(crc32($interface['status_module_id'].$interface_name)); + $graph_link = "" . + html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . ""; + } + else { + $graph_link = ""; + } + + $data = array(); + $data['interface_name'] = "" . $interface_name . ""; + $data['interface_status'] = $interface['status_image']; + $data['interface_graph'] = $graph_link; + $data['interface_ip'] = $interface['ip']; + $data['interface_mac'] = $interface['mac']; + $table->data[] = $data; + } + //End of table network interfaces + $table_interfaces = html_print_table($table, true); + $table_interfaces .= "
"; + + ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)'); + } return; }