diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 7d9cee8f9c..14de36cabe 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.769-230308
+Version: 7.0NG.769-230309
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 53c9f200aa..c7bdb71c28 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.769-230308"
+pandora_version="7.0NG.769-230309"
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 492ec37320..aa9f3d34fc 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1023,7 +1023,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.769';
-use constant AGENT_BUILD => '230308';
+use constant AGENT_BUILD => '230309';
# 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 77859b1dde..280a0f9cf9 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.769
-%define release 230308
+%define release 230309
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 857f141c94..fbeaabfb83 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_agent_linux
%define version 7.0NG.769
-%define release 230308
+%define release 230309
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 79cc3133b3..78d93e1b93 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.769"
-PI_BUILD="230308"
+PI_BUILD="230309"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index a78a35121f..be335eee78 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{230308}
+{230309}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index d7ef085547..8ad89b00e1 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.769 Build 230308")
+#define PANDORA_VERSION ("7.0NG.769 Build 230309")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 76b5c3540e..1f5b52a6f5 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.769(Build 230308))"
+ VALUE "ProductVersion", "(7.0NG.769(Build 230309))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index b3ce245f17..a517d56d88 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.769-230308
+Version: 7.0NG.769-230309
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 0a19d7c0e3..e4d89b8e69 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.769-230308"
+pandora_version="7.0NG.769-230309"
package_pear=0
package_pandora=1
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index d785a6a4bd..6002d19cfe 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -923,6 +923,12 @@ switch ($action) {
$selected_agent_group_filter = $es['agent_group_filter'];
$selected_module_group = $es['module_group'];
+
+ $search_module_name = $es['search_module_name'];
+ $tags = $es['tags'];
+ $alias = $es['alias'];
+ $description_switch = $es['description_switch'];
+ $last_status_change = $es['last_status_change'];
break;
case 'inventory':
@@ -3921,38 +3927,93 @@ $class = 'databox filters';
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+ |
+ |
+
+
+
+
+
+ |
+ |
+
@@ -6422,6 +6483,11 @@ function chooseType() {
$("#row_agent_group_filter").hide();
$("#row_module_group_filter").hide();
$("#row_module_group_filter").hide();
+ $("#row_alias").hide();
+ $("#row_search_module_name").hide();
+ $("#row_description_switch").hide();
+ $("#row_last_status_change").hide();
+ $("#row_tags").hide();
$("#row_os").hide();
$("#row_custom_field_filter").hide();
$("#row_custom_field").hide();
@@ -7048,7 +7114,6 @@ function chooseType() {
$("#row_agents_inventory_display_options").show();
$("#row_agent_server_filter").show();
$("#row_agent_group_filter").show();
- $("#row_group").show();
$("#row_os").show();
$("#row_custom_field").show();
$("#row_custom_field_filter").show();
@@ -7074,10 +7139,14 @@ function chooseType() {
break;
case 'modules_inventory':
- $("#row_group").show();
$("#row_agent_server_filter").show();
$("#row_agent_group_filter").show();
$("#row_module_group_filter").show();
+ $("#row_alias").show();
+ $("#row_search_module_name").show();
+ $("#row_description_switch").show();
+ $("#row_last_status_change").show();
+ $("#row_tags").show();
break;
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 12d5266f34..a4f688ab05 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -2411,6 +2411,11 @@ switch ($action) {
$es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['module_group'] = get_parameter('module_group');
$es['agent_group_filter'] = get_parameter('agent_group_filter');
+ $es['search_module_name'] = get_parameter('search_module_name');
+ $es['tags'] = get_parameter('tags');
+ $es['alias'] = get_parameter('alias', '');
+ $es['description_switch'] = get_parameter('description_switch', '');
+ $es['last_status_change'] = get_parameter('last_status_change', '');
$values['external_source'] = json_encode($es);
break;
@@ -3199,6 +3204,11 @@ switch ($action) {
$es['agent_server_filter'] = get_parameter('agent_server_filter');
$es['module_group'] = get_parameter('module_group');
$es['agent_group_filter'] = get_parameter('agent_group_filter');
+ $es['search_module_name'] = get_parameter('search_module_name');
+ $es['tags'] = get_parameter('tags');
+ $es['alias'] = get_parameter('alias', '');
+ $es['description_switch'] = get_parameter('description_switch', '');
+ $es['last_status_change'] = get_parameter('last_status_change', '');
$values['external_source'] = json_encode($es);
break;
diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php
index 4e14a73048..4dc665fb26 100644
--- a/pandora_console/include/class/ConsoleSupervisor.php
+++ b/pandora_console/include/class/ConsoleSupervisor.php
@@ -2862,7 +2862,7 @@ class ConsoleSupervisor
return;
}
- $sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer();
+ $sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer(true);
$counts = $sync->getQueues(true);
if (count($counts) === 0) {
@@ -2919,7 +2919,7 @@ class ConsoleSupervisor
return;
}
- $sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer();
+ $sync = new PandoraFMS\Enterprise\Metaconsole\Synchronizer(true);
$queues = $sync->getQueues();
if (count($queues) === 0) {
// Clean all.
diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php
index 6ef72c40c4..d94756603a 100644
--- a/pandora_console/include/class/SatelliteCollection.class.php
+++ b/pandora_console/include/class/SatelliteCollection.class.php
@@ -84,7 +84,7 @@ class SatelliteCollection extends HTML
return;
}
- if ((int) $config['license_nms'] === 0) {
+ if ((int) $config['license_nms'] === 1) {
db_pandora_audit(
AUDIT_LOG_NMS_VIOLATION,
'Trying to access satellite collections'
diff --git a/pandora_console/include/class/SnmpConsole.class.php b/pandora_console/include/class/SnmpConsole.class.php
index 5999479c64..ec7e3394dd 100644
--- a/pandora_console/include/class/SnmpConsole.class.php
+++ b/pandora_console/include/class/SnmpConsole.class.php
@@ -947,14 +947,26 @@ class SnmpConsole extends HTML
).' ';
}
- $tmp->action .= ''.html_print_image(
+ $tmp->action .= ''.html_print_image(
'images/see-details@svg.svg',
true,
[
+ 'id' => 'img_'.$tmp->id_trap,
'alt' => __('Show more'),
'title' => __('Show more'),
'class' => 'invert_filter main_menu_icon',
]
+ ).' '.html_print_image(
+ 'images/disable.svg',
+ true,
+ [
+ 'id' => 'img_hide_'.$tmp->id_trap,
+ 'alt' => __('Hide details'),
+ 'title' => __('Hide details'),
+ 'class' => 'invert_filter main_menu_icon',
+ 'style' => 'display:none',
+ ]
).'';
if ($config['enterprise_installed']) {
@@ -1380,119 +1392,138 @@ class SnmpConsole extends HTML
* Show more information
*/
function toggleVisibleExtendedInfo(id, position) {
- $('tr[id^=show_]').remove()
- $.ajax({
- method: 'get',
- url: '',
- data: {
- page: 'operation/snmpconsole/snmp_view',
- method: 'showInfo',
- id: id,
- group_by : $('#filter_group_by').val(),
- alert: $('#filter_alert').val(),
- severity: $('#filter_severity').val(),
- search: $('#text-filter_free_search').val(),
- status: $('#filter_status').val(),
- hours_ago: $('#text-filter_hours_ago').val(),
- trap_type: $('#filter_trap_type').val()
- },
- datatype: "json",
- success: function(data) {
- let trap = JSON.parse(data);
- var tr = $('#snmp_console tr').eq(position+1);
-
- // Count.
- if ($('#filter_group_by').val() == 1) {
- let labelCount = ' | ';
- let variableCount = `${trap['count']}${trap['first']}${trap['last']} | `;
-
- tr.after(`${labelCount}${variableCount}
`);
- }
-
- // Type.
- desc_trap_type = "";
- switch (trap['type']) {
- case -1:
- desc_trap_type = "";
- break;
-
- case 0:
- desc_trap_type = "";
- break;
-
- case 1:
- desc_trap_type = "";
- break;
-
- case 2:
- desc_trap_type = "";
- break;
-
- case 3:
- desc_trap_type = "";
- break;
-
- case 4:
- desc_trap_type = "";
- break;
-
- default:
- desc_trap_type = "";
- break;
- }
-
- let labelType = ' | ';
- let variableType = `${desc_trap_type} | `;
-
- tr.after(`${labelType}${variableType}
`);
-
- // Description.
- if (trap['description']) {
- let labelDesc = ' | ';
- let variableDesc = `${trap['description']} | `;
-
- tr.after(`${labelDesc}${variableDesc}
`);
- }
-
- // Enterprise String.
- let labelOid = ' | ';
- let variableOId = `${trap['oid']} | `;
-
- tr.after(`${labelOid}${variableOId}
`);
-
- // Variable bindings.
- let labelBindings = '';
- let variableBindings = '';
- if ($('#filter_group_by').val() == 1) {
- labelBindings = ' | ';
-
- let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
- new_url += '&filter_severity='+$('#filter_severity').val();
- new_url += '&filter_status='+$('#filter_status').val();
- new_url += '&filter_alert='+$('#filter_alert').val();
- new_url += '&filter_group_by=0&filter_free_search='+$('#text-filter_free_search').val();
- new_url += '&filter_hours_ago='+$('#text-filter_hours_ago').val();
- new_url += '&filter_trap_type='+$('#filter_trap_type').val();
-
- const string = '';
-
- variableBindings = `${string} | `;
- } else {
- labelBindings = ' | ';
- const binding_vars = trap['oid_custom'].split("\t");
- let string = '';
- binding_vars.forEach(function(oid) {
- string += oid+'
';
- });
- variableBindings = `${string} | `;
- }
-
- tr.after(`${labelBindings}${variableBindings}
`);
- },
- error: function(e) {
- console.error(e);
- }
+ // Show all "Show more"
+ $('[id^=img_]').each(function() {
+ $(this).show();
});
+ // Hide all "Hide details"
+ $('[id^=img_hide_]').each(function() {
+ $(this).hide();
+ });
+ var status = $('#eye_'+id).attr('data-show');
+ if(status == "show"){
+ $('tr[id^=show_]').remove()
+ $.ajax({
+ method: 'get',
+ url: '',
+ data: {
+ page: 'operation/snmpconsole/snmp_view',
+ method: 'showInfo',
+ id: id,
+ group_by : $('#filter_group_by').val(),
+ alert: $('#filter_alert').val(),
+ severity: $('#filter_severity').val(),
+ search: $('#text-filter_free_search').val(),
+ status: $('#filter_status').val(),
+ hours_ago: $('#text-filter_hours_ago').val(),
+ trap_type: $('#filter_trap_type').val()
+ },
+ datatype: "json",
+ success: function(data) {
+ let trap = JSON.parse(data);
+ var tr = $('#snmp_console tr').eq(position+1);
+
+ // Count.
+ if ($('#filter_group_by').val() == 1) {
+ let labelCount = ' | ';
+ let variableCount = `${trap['count']}${trap['first']}${trap['last']} | `;
+
+ tr.after(`${labelCount}${variableCount}
`);
+ }
+
+ // Type.
+ desc_trap_type = "";
+ switch (trap['type']) {
+ case -1:
+ desc_trap_type = "";
+ break;
+
+ case 0:
+ desc_trap_type = "";
+ break;
+
+ case 1:
+ desc_trap_type = "";
+ break;
+
+ case 2:
+ desc_trap_type = "";
+ break;
+
+ case 3:
+ desc_trap_type = "";
+ break;
+
+ case 4:
+ desc_trap_type = "";
+ break;
+
+ default:
+ desc_trap_type = "";
+ break;
+ }
+
+ let labelType = ' | ';
+ let variableType = `${desc_trap_type} | `;
+
+ tr.after(`${labelType}${variableType}
`);
+
+ // Description.
+ if (trap['description']) {
+ let labelDesc = ' | ';
+ let variableDesc = `${trap['description']} | `;
+
+ tr.after(`${labelDesc}${variableDesc}
`);
+ }
+
+ // Enterprise String.
+ let labelOid = ' | ';
+ let variableOId = `${trap['oid']} | `;
+
+ tr.after(`${labelOid}${variableOId}
`);
+
+ // Variable bindings.
+ let labelBindings = '';
+ let variableBindings = '';
+ if ($('#filter_group_by').val() == 1) {
+ labelBindings = ' | ';
+
+ let new_url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view';
+ new_url += '&filter_severity='+$('#filter_severity').val();
+ new_url += '&filter_status='+$('#filter_status').val();
+ new_url += '&filter_alert='+$('#filter_alert').val();
+ new_url += '&filter_group_by=0&filter_free_search='+$('#text-filter_free_search').val();
+ new_url += '&filter_hours_ago='+$('#text-filter_hours_ago').val();
+ new_url += '&filter_trap_type='+$('#filter_trap_type').val();
+
+ const string = '';
+
+ variableBindings = `${string} | `;
+ } else {
+ labelBindings = ' | ';
+ const binding_vars = trap['oid_custom'].split("\t");
+ let string = '';
+ binding_vars.forEach(function(oid) {
+ string += oid+'
';
+ });
+ variableBindings = `${string} | `;
+ }
+
+ tr.after(`${labelBindings}${variableBindings}
`);
+ },
+ error: function(e) {
+ console.error(e);
+ }
+ });
+ $('#eye_'+id).attr('data-show', 'hide');
+ $('#img_'+id).hide();
+ $('#img_hide_'+id).show();
+ } else{
+ $('tr[id^=show_]').remove();
+ $('#eye_'+id).attr('data-show', 'show');
+ $('#img_'+id).show();
+ $('#img_hide_'+id).hide();
+ }
}
$(document).ready(function() {
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index e4b91d9635..c2c1269c2f 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC230308';
+$build_version = 'PC230309';
$pandora_version = 'v7.0NG.769';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 61a79e224b..0c3a0a6db5 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -2624,9 +2624,10 @@ function reporting_agents_inventory($report, $content)
$custom_field_sql = '';
$search_sql = '';
+ $sql_order_by = 'ORDER BY tagente.id_agente ASC';
if (empty(array_filter($es_agent_custom_fields)) === false) {
- $custom_field_sql = 'INNER JOIN tagent_custom_data tacd ON tacd.id_agent = tagente.id_agente';
+ $custom_field_sql = 'LEFT JOIN tagent_custom_data tacd ON tacd.id_agent = tagente.id_agente';
if ($es_agent_custom_fields[0] != 0) {
$custom_field_sql .= ' AND tacd.id_field IN ('.implode(',', $es_agent_custom_fields).')';
}
@@ -2660,6 +2661,12 @@ function reporting_agents_inventory($report, $content)
$user_groups_to_sql = implode(',', array_keys(users_get_groups()));
+ if (array_search('alias', $es_agents_inventory_display_options) !== false) {
+ $sql_order_by = 'ORDER BY tagente.alias ASC';
+ } else if (array_search('direccion', $es_agents_inventory_display_options) !== false) {
+ $sql_order_by = 'ORDER BY tagente.direccion ASC';
+ }
+
$sql = sprintf(
'SELECT DISTINCT(tagente.id_agente) AS id_agente,
tagente.id_os,
@@ -2675,12 +2682,12 @@ function reporting_agents_inventory($report, $content)
LEFT JOIN tagente_modulo tam
ON tam.id_agente = tagente.id_agente
%s
- WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))
- %s',
+ WHERE (tagente.id_grupo IN (%s) OR tasg.id_group IN (%s))%s%s',
$custom_field_sql,
$user_groups_to_sql,
$user_groups_to_sql,
- $search_sql
+ $search_sql,
+ $sql_order_by
);
if (is_metaconsole()) {
@@ -2812,11 +2819,16 @@ function reporting_modules_inventory($report, $content)
$search_sql = '';
if (empty($es_agent_group_filter) === false) {
- $search_sql .= ' AND (ta.id_grupo = '.$es_agent_group_filter.' OR tasg.id_group = '.$es_agent_group_filter.')';
+ $search_sql .= '(ta.id_grupo = '.$es_agent_group_filter.' OR tasg.id_group = '.$es_agent_group_filter.')';
}
if (empty($module_group) === false && $module_group > -1) {
- $search_sql .= ' AND tam.id_module_group = '.$module_group;
+ $modules = implode(',', $module_group);
+ if ($search_sql !== '') {
+ $search_sql .= ' AND ';
+ }
+
+ $search_sql .= 'tam.id_module_group IN ('.$modules.')';
}
$user_groups_to_sql = '';
@@ -2826,25 +2838,80 @@ function reporting_modules_inventory($report, $content)
$user_groups = $user_groupsAR;
$user_groups_to_sql = implode(',', array_keys($user_groups));
+ $sql_alias = '';
+ $sql_order_by = 'ORDER BY tam.nombre ASC';
+ if ((int) $external_source['alias'] === 1) {
+ $sql_alias = " ta.alias,\n ";
+ $sql_order_by = 'ORDER BY ta.alias ASC, tam.nombre ASC';
+ }
+
+ $sql_description = '';
+ if ((int) $external_source['description_switch'] === 1) {
+ $sql_description = "\n tam.descripcion,";
+ }
+
+ $sql_last_status = '';
+ $sql_last_status_join = '';
+ if ((int) $external_source['last_status_change'] === 1) {
+ $sql_last_status = ",\n tae.last_status_change";
+ $sql_last_status_join = "\n LEFT JOIN tagente_estado tae";
+ $sql_last_status_join .= "\n ON tae.id_agente_modulo = tam.id_agente_modulo";
+ }
+
+ if (empty($external_source['search_module_name']) === false) {
+ if ($search_sql !== '') {
+ $search_sql .= ' AND ';
+ }
+
+ $search_sql .= "tam.nombre LIKE '%".$external_source['search_module_name']."%'";
+ }
+
+ $tags_condition = tags_get_user_tags();
+ $tags_imploded = implode(',', array_keys($tags_condition));
+ if (users_is_admin() === false) {
+ if ($search_sql !== '') {
+ $search_sql .= ' AND ';
+ }
+
+ $search_sql .= 'ttm.id_tag IN ('.$tags_imploded.')';
+ }
+
+ if (empty($external_source['tags']) === false) {
+ $external_tags_imploded = implode(',', $external_source['tags']);
+ if ($search_sql !== '') {
+ $search_sql .= ' AND ';
+ }
+
+ $search_sql .= 'ttm.id_tag IN ('.$external_tags_imploded.')';
+ }
+
+ $sql_where = '';
+ if (empty($search_sql) === false) {
+ $sql_where .= 'WHERE '.$search_sql;
+ }
+
$sql = sprintf(
- 'SELECT tam.id_agente_modulo,
- tam.nombre,
- tam.descripcion,
+ 'SELECT DISTINCT(tam.id_agente_modulo),
+ %s tam.id_agente_modulo,
+ tam.nombre,%s
tam.id_module_group,
- ttm.id_tag,
ta.id_grupo AS group_id,
- tasg.id_group AS sec_group_id
+ tasg.id_group AS sec_group_id%s
FROM tagente_modulo tam
INNER JOIN tagente ta
ON tam.id_agente = ta.id_agente
LEFT JOIN tagent_secondary_group tasg
ON ta.id_agente = tasg.id_agent
LEFT JOIN ttag_module ttm
- ON ttm.id_agente_modulo = tam.id_agente_modulo
- WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)) %s',
- $user_groups_to_sql,
- $user_groups_to_sql,
- $search_sql
+ ON ttm.id_agente_modulo = tam.id_agente_modulo%s
+ %s
+ %s',
+ $sql_alias,
+ $sql_description,
+ $sql_last_status,
+ $sql_last_status_join,
+ $sql_where,
+ $sql_order_by
);
if (is_metaconsole()) {
@@ -2870,6 +2937,23 @@ function reporting_modules_inventory($report, $content)
$agents = db_get_all_rows_sql($sql);
+ foreach ($agents as $agent_key => $agent_value) {
+ $sql2 = 'SELECT tm.id_tag
+ FROM ttag_module tm
+ WHERE tm.id_agente_modulo = '.$agent_value['id_agente_modulo'];
+
+ $tags_rows = db_get_all_rows_sql($sql2);
+ $tags_ids = [];
+
+ foreach ($tags_rows as $tag_row) {
+ array_push($tags_ids, $tag_row['id_tag']);
+ }
+
+ $column_value = implode(',', $tags_ids);
+ $agents[$agent_key]['tags'] = $column_value;
+ $agents[$agent_key]['server_id'] = $server_id;
+ }
+
$return_data[$server_id] = $agents;
if (is_metaconsole()) {
@@ -2889,33 +2973,44 @@ function reporting_modules_inventory($report, $content)
$module_row_data = [];
+ $i = 0;
+
foreach ($return['data'] as $row) {
- if (is_array($module_row_data[$row['id_agente_modulo']]) === false) {
- $module_row_data[$row['id_agente_modulo']]['nombre'] = $row['nombre'];
- $module_row_data[$row['id_agente_modulo']]['descripcion'] = $row['descripcion'];
- $module_row_data[$row['id_agente_modulo']]['id_module_group'] = $row['id_module_group'];
- $module_row_data[$row['id_agente_modulo']]['id_tag'] = [];
- $module_row_data[$row['id_agente_modulo']]['group_id'] = [];
- $module_row_data[$row['id_agente_modulo']]['sec_group_id'] = [];
+ if (array_key_exists('alias', $row) === true) {
+ $module_row_data[$i]['alias'] = $row['alias'];
}
- if (in_array($row['id_tag'], $module_row_data[$row['id_agente_modulo']]['id_tag']) === false
- && $row['id_tag'] !== null
- ) {
- $module_row_data[$row['id_agente_modulo']]['id_tag'][] = $row['id_tag'];
+ if (array_key_exists('nombre', $row) === true) {
+ $module_row_data[$i]['nombre'] = $row['nombre'];
}
- if (in_array($row['group_id'], $module_row_data[$row['id_agente_modulo']]['group_id']) === false
- && $row['group_id'] !== null
- ) {
- $module_row_data[$row['id_agente_modulo']]['group_id'][] = $row['group_id'];
+ if (array_key_exists('descripcion', $row) === true) {
+ $module_row_data[$i]['descripcion'] = $row['descripcion'];
}
- if (in_array($row['sec_group_id'], $module_row_data[$row['id_agente_modulo']]['sec_group_id']) === false
- && $row['sec_group_id'] !== null
- ) {
- $module_row_data[$row['id_agente_modulo']]['sec_group_id'][] = $row['sec_group_id'];
+ $module_row_data[$i]['id_module_group'] = $row['id_module_group'];
+ $module_row_data[$i]['id_tag'] = [];
+ $module_row_data[$i]['group_id'] = [];
+ $module_row_data[$i]['sec_group_id'] = [];
+
+ if (array_key_exists('tags', $row) === true) {
+ $module_row_data[$i]['id_tag'][] = $row['tags'];
}
+
+ if (array_key_exists('id_group', $row) === true) {
+ $module_row_data[$i]['group_id'][] = $row['group_id'];
+ }
+
+ if (array_key_exists('sec_group_id', $row) === true) {
+ $module_row_data[$i]['sec_group_id'][] = $row['sec_group_id'];
+ }
+
+ if (array_key_exists('last_status_change', $row) === true) {
+ $human_last_status_change = human_time_comparation($row['last_status_change']);
+ $module_row_data[$i]['last_status_change'] = $human_last_status_change;
+ }
+
+ $i++;
}
$return['data'] = $module_row_data;
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 3cc7031303..59140ac1a2 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -1557,6 +1557,57 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
$table1->head = [];
+ // Sort array columns.
+ $tmp_sort_array = [];
+ foreach ($item['data'] as $data_key => $data_value) {
+ if (array_key_exists('alias', $data_value) === true) {
+ $tmp_sort_array['alias'] = $data_value['alias'];
+ }
+
+ if (array_key_exists('direccion', $data_value) === true) {
+ $tmp_sort_array['direccion'] = $data_value['direccion'];
+ }
+
+ if (array_key_exists('id_os', $data_value) === true) {
+ $tmp_sort_array['id_os'] = $data_value['id_os'];
+ }
+
+ if (array_key_exists('agent_version', $data_value) === true) {
+ $tmp_sort_array['agent_version'] = $data_value['agent_version'];
+ }
+
+ if (array_key_exists('id_grupo', $data_value) === true) {
+ $tmp_sort_array['id_grupo'] = $data_value['id_grupo'];
+ }
+
+ if (array_key_exists('comentarios', $data_value) === true) {
+ $tmp_sort_array['comentarios'] = $data_value['comentarios'];
+ }
+
+ if (array_key_exists('url_address', $data_value) === true) {
+ $tmp_sort_array['url_address'] = $data_value['url_address'];
+ }
+
+ if (array_key_exists('remote', $data_value) === true) {
+ $tmp_sort_array['remote'] = $data_value['remote'];
+ }
+
+ if (array_key_exists('secondary_groups', $data_value) === true) {
+ $tmp_sort_array['secondary_groups'] = $data_value['secondary_groups'];
+ }
+
+ if (array_key_exists('custom_fields', $data_value) === true) {
+ $tmp_sort_array['custom_fields'] = $data_value['custom_fields'];
+ }
+
+ if (array_key_exists('estado', $data_value) === true) {
+ $tmp_sort_array['estado'] = $data_value['estado'];
+ }
+
+ unset($item['data'][$data_key]);
+ $item['data'][$data_key] = $tmp_sort_array;
+ }
+
foreach ($item['data'][0] as $field_key => $field_value) {
switch ($field_key) {
case 'alias':
@@ -1638,7 +1689,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
} else if ($data_field_key === 'estado') {
$column_value = ($pdf === 0) ? ui_print_module_status((int) $data_field_value, true) : modules_get_modules_status((int) $data_field_value);
} else if ($data_field_key === 'id_grupo') {
- $column_value = ui_print_group_icon((int) $data_field_value, true, 'groups_small', '', $show_link);
+ $column_value = groups_get_name((int) $data_field_value);
} else if ($data_field_key === 'custom_fields') {
$custom_fields_value = [];
@@ -1654,7 +1705,7 @@ function reporting_html_agents_inventory($table, $item, $pdf=0)
if (is_array($data_field_value)) {
foreach ($data_field_value as $value) {
- $custom_fields_value[] = ui_print_group_icon((int) $value['id_group'], true, 'groups_small', '', $show_link);
+ $custom_fields_value[] = groups_get_name((int) $value['id_group']);
}
}
@@ -1711,19 +1762,50 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$table1->style[0] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[1] = 'text-align: left;vertical-align: top;min-width: 100px;';
- $table1->style[2] = 'text-align: left;vertical-align: top; min-width: 100px';
+ $table1->style[2] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[3] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->style[4] = 'text-align: left;vertical-align: top;min-width: 100px;';
- $table1->style[5] = 'text-align: left;vertical-align: top; min-width: 100px';
+ $table1->style[5] = 'text-align: left;vertical-align: top;min-width: 100px;';
+ $table1->style[6] = 'text-align: left;vertical-align: top;min-width: 100px;';
+ $table1->style[7] = 'text-align: left;vertical-align: top;min-width: 100px;';
$table1->head = [];
+ $first_index = array_key_first($item['data']);
- $table1->head[] = __('Name');
- $table1->head[] = __('Description');
- $table1->head[] = __('Module group');
- $table1->head[] = __('Tags');
- $table1->head[] = __('Agent group');
- $table1->head[] = __('Agent secondary groups');
+ foreach ($item['data'][$first_index] as $field_key => $field_value) {
+ switch ($field_key) {
+ case 'alias':
+ $table1->head[] = __('Alias');
+ break;
+
+ case 'nombre':
+ $table1->head[] = __('Name');
+ break;
+
+ case 'descripcion':
+ $table1->head[] = __('Description');
+ break;
+
+ case 'id_module_group':
+ $table1->head[] = __('Module group');
+ break;
+
+ case 'id_tag':
+ $table1->head[] = __('Tags');
+ break;
+
+ case 'group_id':
+ $table1->head[] = __('Agent group');
+ break;
+
+ case 'sec_group_id':
+ $table1->head[] = __('Agent secondary groups');
+ break;
+
+ case 'last_status_change':
+ $table1->head[] = __('Last status change');
+ }
+ }
$table1->headstyle[0] = 'text-align: left';
$table1->headstyle[1] = 'text-align: left';
@@ -1731,15 +1813,20 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$table1->headstyle[3] = 'text-align: left';
$table1->headstyle[4] = 'text-align: left';
$table1->headstyle[5] = 'text-align: left';
+ $table1->headstyle[6] = 'text-align: left';
+ $table1->headstyle[7] = 'text-align: left';
$table1->data = [];
foreach ($item['data'] as $module_id => $module_data) {
+ unset($module_data['server_id']);
$row = [];
$first_item = array_pop(array_reverse($module_data));
foreach ($module_data as $data_field_key => $data_field_value) {
- if ($data_field_key === 'nombre') {
+ if ($data_field_key === 'alias') {
+ $column_value = $data_field_value;
+ } else if ($data_field_key === 'nombre') {
$column_value = $data_field_value;
} else if ($data_field_key === 'descripcion') {
$column_value = $data_field_value;
@@ -1752,13 +1839,27 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
$column_value = $module_group_name;
} else if ($data_field_key === 'id_tag') {
- $tags_names = array_map(
- function ($tag_id) {
- return db_get_value('name', 'ttag', 'id_tag', $tag_id);
- },
- $data_field_value
- );
- $column_value = implode('
', $tags_names);
+ if (empty($data_field_value[0]) === false) {
+ $sql = 'SELECT name
+ FROM ttag
+ WHERE id_tag IN ('.$data_field_value[0].')';
+
+ $tags_rows = db_get_all_rows_sql($sql);
+ $tags_names = [];
+ foreach ($tags_rows as $tag_row) {
+ array_push($tags_names, $tag_row['name']);
+ }
+
+ $column_value = implode('
', $tags_names);
+ } else {
+ $tags_names = array_map(
+ function ($tag_id) {
+ return db_get_value('name', 'ttag', 'id_tag', $tag_id);
+ },
+ $data_field_value
+ );
+ $column_value = implode('
', $tags_names);
+ }
} else if ($data_field_key === 'group_id') {
$column_value = groups_get_name($data_field_value[0]);
} else if ($data_field_key === 'sec_group_id') {
@@ -1770,6 +1871,8 @@ function reporting_html_modules_inventory($table, $item, $pdf=0)
);
$column_value = implode('
', $sec_groups_names);
+ } else if ($data_field_key === 'last_status_change') {
+ $column_value = $data_field_value;
}
$row[] = $column_value;
diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php
index 9e7d55a648..c664828a84 100644
--- a/pandora_console/include/functions_tags.php
+++ b/pandora_console/include/functions_tags.php
@@ -1048,7 +1048,7 @@ function tags_has_user_acl_tags($id_user=false)
* @param string Access flag where check what tags have the user
* @param bool returns 0 if the user has all the tags
*
- * @return string SQL condition for tagente_module
+ * @return array Returns the user's Tags
*/
function tags_get_user_tags($id_user=false, $access='AR', $return_tag_any=false)
{
diff --git a/pandora_console/include/javascript/massive_operations.js b/pandora_console/include/javascript/massive_operations.js
index eb874c5310..6a372f703e 100644
--- a/pandora_console/include/javascript/massive_operations.js
+++ b/pandora_console/include/javascript/massive_operations.js
@@ -110,6 +110,16 @@ function form_controls_massive_operations_agents(metaconsole) {
$("#id_group").trigger("change");
});
+ if (metaconsole == 1) {
+ $("#nodes").change(function() {
+ disabled = $("#disabled").val();
+ });
+
+ $("#id_group").change(function() {
+ disabled = $("#disabled").val();
+ });
+ }
+
var nodes;
$("#nodes").change(function() {
nodes = $("#nodes").val();
diff --git a/pandora_console/include/styles/maintenance.css b/pandora_console/include/styles/maintenance.css
index a9b87c9d83..30a484032f 100644
--- a/pandora_console/include/styles/maintenance.css
+++ b/pandora_console/include/styles/maintenance.css
@@ -58,7 +58,7 @@ body {
}
a {
- color: #dc8100;
+ color: #dc8100 !important;
text-decoration: none;
}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 68d69a23d6..c3b7a890f7 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -131,7 +131,7 @@
AGENT_MODULE_STATUS_WARNING
# 0 -> AGENT_MODULE_STATUS_NORMAL
- my $module_status = 3;
+ my $module_status = 4;
my $modules_async = 0;
foreach my $module (@modules) {
my $m_status = get_agentmodule_status($pa_config, $dbh,
$module->{'id_agente_modulo'});
#This is the order to check
- # AGENT_MODULE_STATUS_CRITICAL_ALERT
# AGENT_MODULE_STATUS_CRITICAL_BAD
# AGENT_MODULE_STATUS_WARNING
# AGENT_MODULE_STATUS_UNKNOWN
# AGENT_MODULE_STATUS_NORMAL
- if ($m_status == 4) {
- $module_status = 4;
+
+ if ($m_status == MODULE_CRITICAL) {
+ $module_status = MODULE_CRITICAL;
}
- elsif ($module_status != 4) {
- if ($m_status == 1) {
- $module_status = 1;
+ elsif ($module_status != MODULE_CRITICAL) {
+ if ($m_status == MODULE_WARNING) {
+ $module_status = MODULE_WARNING;
}
- elsif ($module_status != 1) {
- if ($m_status == 2) {
- $module_status = 2;
+ elsif ($module_status != MODULE_WARNING) {
+ if ($m_status == MODULE_UNKNOWN) {
+ $module_status = MODULE_UNKNOWN;
}
- elsif ($module_status != 2) {
- if ($m_status == 3) {
- $module_status = 3;
+ elsif ($module_status != MODULE_UNKNOWN) {
+ if ($m_status == MODULE_NORMAL) {
+ $module_status = MODULE_NORMAL;
}
- elsif ($module_status != 3) {
- if ($m_status == 0) {
- $module_status = 0;
+ elsif ($module_status != MODULE_NORMAL) {
+ if($m_status == MODULE_NOTINIT) {
+ $module_status = MODULE_NOTINIT;
}
}
}
}
}
+
my $module_type = get_db_value($dbh, 'SELECT id_tipo_modulo
FROM tagente_modulo
WHERE id_agente_modulo = ?', $module->{'id_agente_modulo'});
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 2bfc545a3f..b4b3e01200 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.769";
-my $pandora_build = "230308";
+my $pandora_build = "230309";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index a4738c6552..da60fe76d3 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.769
-%define release 230308
+%define release 230309
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index b108390a3d..f5b92bebb9 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -4,7 +4,7 @@
%global __os_install_post %{nil}
%define name pandorafms_server
%define version 7.0NG.769
-%define release 230308
+%define release 230309
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 2a76611dde..72451776b4 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.769"
-PI_BUILD="230308"
+PI_BUILD="230309"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index ce08881710..7646b7caa7 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
-my $version = "7.0NG.769 Build 230308";
+my $version = "7.0NG.769 Build 230309";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 0b193ab6c6..cb33123905 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
-my $version = "7.0NG.769 Build 230308";
+my $version = "7.0NG.769 Build 230309";
# save program name for logging
my $progname = basename($0);