diff --git a/extras/deploy-scripts/pandora_agent_deploy.sh b/extras/deploy-scripts/pandora_agent_deploy.sh
index 74db9d7c72..281ad530a9 100644
--- a/extras/deploy-scripts/pandora_agent_deploy.sh
+++ b/extras/deploy-scripts/pandora_agent_deploy.sh
@@ -4,7 +4,7 @@
# define variables
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
-S_VERSION='2021100601'
+S_VERSION='2022052301'
LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log"
# Ansi color code variables
@@ -49,7 +49,6 @@ check_cmd_status () {
}
check_repo_connection () {
- execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
}
@@ -79,10 +78,15 @@ echo "Starting PandoraFMS Agent deployment ver. $S_VERSION"
execute_cmd "[ $PANDORA_SERVER_IP ]" 'Check Server IP Address' 'Please define env variable PANDORA_SERVER_IP'
+#Detect OS
+os_name=$(grep ^PRETTY_NAME= /etc/os-release | cut -d '=' -f2 | tr -d '"')
+execute_cmd "echo $os_name" "OS detected: ${os_name}"
+
# Check OS.
OS=$([[ $(grep '^ID_LIKE=' /etc/os-release) ]] && grep ^ID_LIKE= /etc/os-release | cut -d '=' -f2 | tr -d '"' || grep ^ID= /etc/os-release | cut -d '=' -f2 | tr -d '"')
[[ $OS =~ 'rhel' ]] && OS_RELEASE=$OS
+[[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
#[[ $OS == 'centos rhel fedora' ]] && OS_RELEASE=$OS
@@ -113,17 +117,40 @@ execute_cmd "cd $HOME/pandora_deploy_tmp" "Moving to workspace: $HOME/pandora_d
# Downloading and installing packages
-if [[ $OS_RELEASE =~ 'rhel' ]]; then
- yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE
- echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset}
+if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
+ ## Extra steps on redhat
+ if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then
+ ## In case REDHAT
+ # Check susbscription manager status:
+ echo -en "${cyan}Checking Red Hat Enterprise subscription... ${reset}"
+ subscription-manager list &>> "$LOGFILE"
+ subscription-manager status &>> "$LOGFILE"
+ check_cmd_status 'Error checking subscription status, make sure your server is activated and suscribed to Red Hat Enterprise repositories'
+
+ fi
+
+ # Check rh version
+ if [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '8' ] ; then
+ package_manager_cmd=dnf
+ elif [ $(sed -nr 's/VERSION_ID+=\s*"([0-9]).*"$/\1/p' /etc/os-release) -eq '7' ] ; then
+ package_manager_cmd=yum
+
+ fi
+
+ # Install dependencies
+ $package_manager_cmd install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE
+ echo -e "${cyan}Installing agent dependencies...${reset}" ${green}OK${reset}
- yum install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
- echo -e "${cyan}Instaling Pandora FMS agent...${reset}" ${green}OK${reset}
+ # Insatall pandora agent
+ $package_manager_cmd install -y http://firefly.artica.es/pandorafms/latest/RHEL_CentOS/pandorafms_agent_unix-7.0NG.noarch.rpm &>> $LOGFILE
+ echo -en "${cyan}Installing Pandora FMS agent...${reset}"
+ check_cmd_status 'Error installing Pandora FMS agent'
+
fi
if [[ $OS_RELEASE == 'debian' ]]; then
execute_cmd "apt update" 'Updating repos'
- execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Instaling agent dependencies'
+ execute_cmd "apt install -y perl wget curl unzip procps python3 python3-pip" 'Installing agent dependencies'
execute_cmd 'wget http://firefly.artica.es/pandorafms/latest/Debian_Ubuntu/pandorafms.agent_unix_7.0NG.deb' 'Downloading Pandora FMS agent dependencies'
execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
fi
diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh
index cb800cf29b..87e4bb4b35 100644
--- a/extras/deploy-scripts/pandora_deploy_community.sh
+++ b/extras/deploy-scripts/pandora_deploy_community.sh
@@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
-S_VERSION='2022020801'
+S_VERSION='2022050901'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@@ -82,7 +82,6 @@ check_pre_pandora () {
}
check_repo_connection () {
- execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
}
@@ -422,7 +421,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA
execute_cmd "yum install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "installing PandoraFMS packages"
# Copy gotty utility
-execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
+execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh
index 0b17821b46..c8c7561ffc 100644
--- a/extras/deploy-scripts/pandora_deploy_community_el8.sh
+++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh
@@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
-S_VERSION='2022050501'
+S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables
@@ -86,7 +86,6 @@ check_pre_pandora () {
}
check_repo_connection () {
- execute_cmd "ping -c 2 8.8.8.8" "Checking internet connection"
execute_cmd "ping -c 2 firefly.artica.es" "Checking Community repo"
execute_cmd "ping -c 2 support.pandorafms.com" "Checking Enterprise repo"
}
@@ -420,7 +419,9 @@ echo "create database $DBNAME" | mysql -uroot -P$DBPORT -h$DBHOST
check_cmd_status "Error creating database $DBNAME, is this an empty node? if you have a previus installation please contact with support."
echo "CREATE USER \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
+echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
+
export MYSQL_PWD=$DBPASS
#Generating my.cnf
@@ -495,7 +496,7 @@ execute_cmd "curl -LSs --output pandorafms_agent_unix-7.0NG.noarch.rpm ${PANDORA
execute_cmd "dnf install -y $HOME/pandora_deploy_tmp/pandorafms*.rpm" "Installing Pandora FMS packages"
# Copy gotty utility
-execute_cmd "wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
+execute_cmd "wget https://pandorafms.com/library/wp-content/uploads/2019/11/gotty_linux_amd64.tar.gz" 'Dowloading gotty util'
tar xvzf gotty_linux_amd64.tar.gz &>> $LOGFILE
execute_cmd "mv gotty /usr/bin/" 'Installing gotty util'
diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 13cb3bee5f..12bc038128 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.762-220525
+Version: 7.0NG.762-220606
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 76f0e68db6..613172a1aa 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.762-220525"
+pandora_version="7.0NG.762-220606"
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 e08a85b85a..bcf2e39f6c 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.762';
-use constant AGENT_BUILD => '220525';
+use constant AGENT_BUILD => '220606';
# 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 e7d93603e5..71effc4fb8 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.762
-%define release 220525
+%define release 220606
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 ade2b94d6a..0289274f67 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.762
-%define release 220525
+%define release 220606
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 3a60ee06de..30c6cf0e86 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.762"
-PI_BUILD="220525"
+PI_BUILD="220606"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 2e3f877e04..cc1aeeb539 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{220525}
+{220606}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 6474693de9..76560d4a5d 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.762 Build 220525")
+#define PANDORA_VERSION ("7.0NG.762 Build 220606")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 7f95015691..79b995fcab 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.762(Build 220525))"
+ VALUE "ProductVersion", "(7.0NG.762(Build 220606))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 9044acc834..a6b3e0bc06 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.762-220525
+Version: 7.0NG.762-220606
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 15eca79b25..b90d79665d 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.762-220525"
+pandora_version="7.0NG.762-220606"
package_pear=0
package_pandora=1
diff --git a/pandora_console/extras/mr/55.sql b/pandora_console/extras/mr/55.sql
index d9693047c1..f53133c456 100644
--- a/pandora_console/extras/mr/55.sql
+++ b/pandora_console/extras/mr/55.sql
@@ -1,5 +1,7 @@
START TRANSACTION;
+ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0;
+
ALTER TABLE `tdashboard` MODIFY `name` TEXT NOT NULL DEFAULT '';
-COMMIT;
\ No newline at end of file
+COMMIT;
diff --git a/pandora_console/general/first_task/HA_cluster_builder.php b/pandora_console/general/first_task/HA_cluster_builder.php
index 2f0bb24a20..e475dfdf1a 100644
--- a/pandora_console/general/first_task/HA_cluster_builder.php
+++ b/pandora_console/general/first_task/HA_cluster_builder.php
@@ -37,7 +37,7 @@ ui_require_css_file('first_task');
ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]);
?>
-
+
__('Clusters')]); ?>
diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php
index 9c63363df2..a84bf918f8 100644
--- a/pandora_console/godmode/agentes/modificar_agente.php
+++ b/pandora_console/godmode/agentes/modificar_agente.php
@@ -315,7 +315,20 @@ html_print_select_groups(
'',
false
);
-echo '
';
+echo '
';
+
+// Recursion checkbox.
+echo '';
+echo __('Recursion').' ';
+html_print_checkbox(
+ 'recursion',
+ 1,
+ $recursion,
+ false,
+ false,
+ 'this.form.submit()'
+);
+echo ' ';
echo '';
echo __('Show Agents').' ';
$fields = [
@@ -346,19 +359,6 @@ foreach ($pre_fields as $key => $value) {
html_print_select($fields, 'os', $os, 'this.form.submit()', 'All', 0);
-echo ' ';
-
-echo '';
-echo __('Recursion').' ';
-html_print_checkbox(
- 'recursion',
- 1,
- $recursion,
- false,
- false,
- 'this.form.submit()'
-);
-
echo ' ';
echo __('Search').' ';
html_print_input_text('search', $search, '', 12);
diff --git a/pandora_console/godmode/massive/massive_delete_alerts.php b/pandora_console/godmode/massive/massive_delete_alerts.php
index 39028789de..37961cded8 100755
--- a/pandora_console/godmode/massive/massive_delete_alerts.php
+++ b/pandora_console/godmode/massive/massive_delete_alerts.php
@@ -258,9 +258,9 @@ $table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->size = [];
$table->size[0] = '15%';
-$table->size[1] = '40%';
+$table->size[1] = '35%';
$table->size[2] = '15%';
-$table->size[3] = '40%';
+$table->size[3] = '35%';
$table->data = [];
@@ -276,7 +276,12 @@ $table->data[0][1] = html_print_select(
false,
__('Select'),
0,
- true
+ true,
+ false,
+ true,
+ '',
+ false,
+ 'width: 100%;'
);
$table->data[0][2] = '';
$table->data[0][3] = '';
@@ -295,7 +300,8 @@ $table->data[1][1] = html_print_select_groups(
false,
true,
'',
- $id_alert_template == 0
+ $id_alert_template == 0,
+ 'width: 100%;'
);
$table->data[0][2] = __('Show alerts on disabled modules');
diff --git a/pandora_console/godmode/setup/performance.php b/pandora_console/godmode/setup/performance.php
index ad74c490c2..8c41cdda18 100644
--- a/pandora_console/godmode/setup/performance.php
+++ b/pandora_console/godmode/setup/performance.php
@@ -256,16 +256,18 @@ $table->style[0] = 'font-weight: bold';
$table->size[0] = '70%';
$table->size[1] = '30%';
-// enterprise_hook('enterprise_warnings_history_days');
$table->data[1][0] = __('Max. days before delete events');
-
-$table->data[1][1] = html_print_input_text(
- 'event_purge',
- $config['event_purge'],
- '',
- 5,
- 5,
- true
+$table->data[1][1] = html_print_input(
+ [
+ 'type' => 'number',
+ 'size' => 5,
+ 'max' => 99999,
+ 'name' => 'event_purge',
+ 'value' => $config['event_purge'],
+ 'return' => true,
+ 'min' => ((((bool) $config['history_event_enabled'] === true) && $config['history_event_days'] > 0) ? $config['history_event_days'] + 1 : null),
+ 'style' => 'width:43px',
+ ]
);
$table->data[2][0] = __('Max. days before delete traps');
diff --git a/pandora_console/godmode/update_manager/update_manager.setup.php b/pandora_console/godmode/update_manager/update_manager.setup.php
index e282028f9f..e22c31031d 100644
--- a/pandora_console/godmode/update_manager/update_manager.setup.php
+++ b/pandora_console/godmode/update_manager/update_manager.setup.php
@@ -274,7 +274,7 @@ $table->data[$i++][1] = html_print_input_text(
$url_update_manager,
__('URL update manager'),
80,
- 60,
+ 255,
true
);
diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php
index 90e43aa526..5ef4b23614 100644
--- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php
+++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php
@@ -713,7 +713,7 @@ class DiscoveryTaskList extends HTML
}
if ($task['id_recon_script'] == 0 || $ipam === true) {
- $data[4] = $subnet;
+ $data[4] = ui_print_truncate_text($subnet, 50, true, true, true, '[…]');
} else {
$data[4] = '-';
}
diff --git a/pandora_console/images/widgets/os_quick_report.png b/pandora_console/images/widgets/os_quick_report.png
new file mode 100644
index 0000000000..eda6e7adbe
Binary files /dev/null and b/pandora_console/images/widgets/os_quick_report.png differ
diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php
index b8e23d235e..3a6c8b8b60 100644
--- a/pandora_console/include/ajax/events.php
+++ b/pandora_console/include/ajax/events.php
@@ -136,7 +136,7 @@ if ($get_comments === true) {
// Default grouped message filtering (evento and estado).
$whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s"',
- io_safe_output($event['evento']),
+ $event['evento'],
$event['estado']
);
// If id_agente is reported, filter the messages by them as well.
diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php
index ebca4562a6..0b29b3a895 100644
--- a/pandora_console/include/class/TreeService.class.php
+++ b/pandora_console/include/class/TreeService.class.php
@@ -530,33 +530,6 @@ class TreeService extends Tree
$tmp['elementDescription'] = $item->description();
$tmp['disabled'] = $item->service()->disabled();
- if ($this->connectedToNode === false
- && is_metaconsole() === true
- && $tmp['metaID'] > 0
- ) {
- // Impersonate node.
- \enterprise_include_once('include/functions_metaconsole.php');
- \enterprise_hook(
- 'metaconsole_connect',
- [
- null,
- $tmp['metaID'],
- ]
- );
- }
-
- if (check_acl($config['id_user'], $item->service()->id_group(), 'AR')) {
- $grandchildren = $item->service()->children();
- }
-
- if ($this->connectedToNode === false
- && is_metaconsole() === true
- && $tmp['metaID'] > 0
- ) {
- // Restore connection.
- \enterprise_hook('metaconsole_restore_db');
- }
-
$counters = [
'total_modules' => 0,
'total_agents' => 0,
@@ -565,29 +538,66 @@ class TreeService extends Tree
'total' => 0,
];
- if (is_array($grandchildren) === true) {
- $counters = array_reduce(
- $grandchildren,
- function ($carry, $item) {
- if ($item->type() === SERVICE_ELEMENT_MODULE) {
- $carry['total_modules']++;
- } else if ($item->type() === SERVICE_ELEMENT_AGENT) {
- $carry['total_agents']++;
- } else if ($item->type() === SERVICE_ELEMENT_SERVICE) {
- $carry['total_services']++;
- } else if ($item->type() === SERVICE_ELEMENT_DYNAMIC) {
- $carry['total_dynamic']++;
- }
+ if (is_metaconsole() === false
+ || (isset($config['realtimestats']) === true
+ && $config['realtimestats'] === true
+ && $tmp['metaID'] > 0)
+ ) {
+ // Look for counters.
+ if ($this->connectedToNode === false
+ && is_metaconsole() === true
+ && $tmp['metaID'] > 0
+ ) {
+ // Impersonate node.
+ \enterprise_include_once('include/functions_metaconsole.php');
+ \enterprise_hook(
+ 'metaconsole_connect',
+ [
+ null,
+ $tmp['metaID'],
+ ]
+ );
+ }
- $carry['total']++;
+ if (check_acl($config['id_user'], $item->service()->id_group(), 'AR')) {
+ $grandchildren = $item->service()->children();
+ }
- return $carry;
- },
- $counters
- );
- }
+ if ($this->connectedToNode === false
+ && is_metaconsole() === true
+ && $tmp['metaID'] > 0
+ ) {
+ // Restore connection.
+ \enterprise_hook('metaconsole_restore_db');
+ }
- if ($counters['total'] > 0) {
+ if (is_array($grandchildren) === true) {
+ $counters = array_reduce(
+ $grandchildren,
+ function ($carry, $item) {
+ if ($item->type() === SERVICE_ELEMENT_MODULE) {
+ $carry['total_modules']++;
+ } else if ($item->type() === SERVICE_ELEMENT_AGENT) {
+ $carry['total_agents']++;
+ } else if ($item->type() === SERVICE_ELEMENT_SERVICE) {
+ $carry['total_services']++;
+ } else if ($item->type() === SERVICE_ELEMENT_DYNAMIC) {
+ $carry['total_dynamic']++;
+ }
+
+ $carry['total']++;
+
+ return $carry;
+ },
+ $counters
+ );
+ }
+
+ if ($counters['total'] > 0) {
+ $tmp['searchChildren'] = 1;
+ }
+ } else {
+ // Always search for.
$tmp['searchChildren'] = 1;
}
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 18830c5462..eb7f300d32 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 = 'PC220525';
+$build_version = 'PC220606';
$pandora_version = 'v7.0NG.762';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index 71128946c5..b5aac630c1 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -1855,7 +1855,19 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return;
}
- $alias = io_safe_input(trim(preg_replace('/[\/\\\|%#&$]/', '', $other['data'][0])));
+ $alias = io_safe_input(
+ trim(
+ preg_replace(
+ '/[\/\\\|%#&$]/',
+ '',
+ preg_replace(
+ '/x20;/',
+ ' ',
+ $other['data'][0]
+ )
+ )
+ )
+ );
$direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$id_parent = (int) $other['data'][2];
diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php
index 7e53b6fd7b..855bc67a7d 100644
--- a/pandora_console/include/functions_config.php
+++ b/pandora_console/include/functions_config.php
@@ -2096,6 +2096,10 @@ function config_process_config()
config_update_value('metaconsole_events_history', 0);
}
+ if (!isset($config['realtimestats'])) {
+ config_update_value('realtimestats', 1);
+ }
+
if (!isset($config['trap_purge'])) {
config_update_value('trap_purge', 7);
}
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 934d7c27bc..2e53c6abf3 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -2297,6 +2297,7 @@ function events_comment(
$comments_format = 'new';
} else {
// If comments are not stored in json, the format is old.
+ $event_comments[0]['user_comment'] = str_replace(["\n", '
'], ' ', $event_comments[0]['user_comment']);
$event_comments_array = json_decode($event_comments[0]['user_comment']);
if (empty($event_comments_array) === true) {
@@ -5227,6 +5228,8 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
$comm = $comm['user_comment'];
}
+ $comm = str_replace(["\n", '
'], ' ', $comm);
+
$comments_array[] = io_safe_output(json_decode($comm, true));
}
diff --git a/pandora_console/include/functions_os.php b/pandora_console/include/functions_os.php
index d616c3e94f..2b5b25c24d 100755
--- a/pandora_console/include/functions_os.php
+++ b/pandora_console/include/functions_os.php
@@ -14,54 +14,190 @@
// Get critical agents by using the status code in modules.
function os_agents_critical($id_os)
{
- // TODO REVIEW ORACLE AND POSTGRES
- return db_get_sql(
- "
- SELECT COUNT(*)
- FROM tagente
- WHERE tagente.disabled=0 AND
- critical_count>0 AND id_os=$id_os"
- );
+ global $config;
+
+ $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
+
+ if (users_is_admin() === true) {
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ critical_count>0 AND id_os=%d',
+ $table,
+ $id_os
+ )
+ );
+ } else {
+ $groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
+
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ critical_count>0 AND
+ id_os=%d AND id_grupo IN (%s)',
+ $table,
+ $id_os,
+ implode(',', $groups)
+ )
+ );
+ }
}
// Get ok agents by using the status code in modules.
function os_agents_ok($id_os)
{
- return db_get_sql(
- "
- SELECT COUNT(*)
- FROM tagente
- WHERE tagente.disabled=0 AND
- normal_count=total_count AND id_os=$id_os"
- );
+ global $config;
+
+ $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
+
+ if (users_is_admin() === true) {
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ normal_count=total_count AND id_os=%d',
+ $table,
+ $id_os
+ )
+ );
+ } else {
+ $groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
+
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ normal_count=total_count AND
+ id_os=%d AND id_grupo IN (%s)',
+ $table,
+ $id_os,
+ implode(',', $groups)
+ )
+ );
+ }
}
// Get warning agents by using the status code in modules.
function os_agents_warning($id_os)
{
- return db_get_sql(
- "
- SELECT COUNT(*)
- FROM tagente
- WHERE tagente.disabled=0 AND
- critical_count=0 AND warning_count>0 AND id_os=$id_os"
- );
+ global $config;
+
+ $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
+
+ if (users_is_admin() === true) {
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ critical_count=0 AND warning_count>0
+ AND id_os=%d',
+ $table,
+ $id_os
+ )
+ );
+ } else {
+ $groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
+
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ critical_count=0 AND warning_count>0 AND
+ id_os=%d AND id_grupo IN (%s)',
+ $table,
+ $id_os,
+ implode(',', $groups)
+ )
+ );
+ }
}
// Get unknown agents by using the status code in modules.
function os_agents_unknown($id_os)
{
- return db_get_sql(
- "
- SELECT COUNT(*)
- FROM tagente
- WHERE tagente.disabled=0 AND
- critical_count=0 AND warning_count=0 AND
- unknown_count>0 AND id_os=$id_os"
- );
+ global $config;
+
+ $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
+
+ if (users_is_admin() === true) {
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ critical_count=0 AND warning_count=0 AND
+ unknown_count>0 AND id_os=%d',
+ $table,
+ $id_os
+ )
+ );
+ } else {
+ $groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
+
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND
+ critical_count=0 AND warning_count=0 AND
+ unknown_count>0 AND id_os=%d AND id_grupo IN (%s)',
+ $table,
+ $id_os,
+ implode(',', $groups)
+ )
+ );
+ }
+}
+
+
+/**
+ * Get total agents
+ *
+ * @param integer $id_os OS id.
+ *
+ * @return array|boolean
+ */
+function os_agents_total(int $id_os)
+{
+ global $config;
+
+ $table = (is_metaconsole() === true) ? 'tmetaconsole_agent' : 'tagente';
+
+ if (users_is_admin() === true) {
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND id_os=%d',
+ $table,
+ $id_os
+ )
+ );
+ } else {
+ $groups = array_keys(users_get_groups($config['id_user'], 'AR', false));
+
+ return db_get_sql(
+ sprintf(
+ 'SELECT COUNT(*)
+ FROM %s
+ WHERE tagente.disabled=0 AND id_os=%d AND id_grupo IN (%s)',
+ $table,
+ $id_os,
+ implode(',', $groups)
+ )
+ );
+ }
}
diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js
index bdd3aa3038..3e286acddd 100644
--- a/pandora_console/include/graphs/flot/pandora.flot.js
+++ b/pandora_console/include/graphs/flot/pandora.flot.js
@@ -15,6 +15,8 @@ function pandoraFlotPie(
colors,
hide_labels
) {
+ height = parseInt(height);
+
labels = labels.split(separator);
var data = values.split(separator);
@@ -79,11 +81,22 @@ function pandoraFlotPie(
break;
}
+ var discount = 20;
+ if (water_mark) {
+ discount = 40;
+ }
+
var plot = $.plot($("#" + graph_id), data, conf_pie);
var legends = $("#" + graph_id + " .legendLabel");
legends.css("font-size", font_size + "pt");
+ var tableDiv = $("#" + graph_id + " .legend > div");
+ tableDiv.css("max-height", height - discount + "px");
+
+ var tableLegend = $("#" + graph_id + " .legend table");
+ tableLegend.css("max-height", height - discount + "px");
+
// Events
$("#" + graph_id).bind("plothover", pieHover);
//$("#" + graph_id).bind("plotclick", pieClick);
@@ -443,14 +456,15 @@ function pandoraFlotHBars(
"pt !important;" +
"margin: 0; max-width: 200px;" +
"margin-right:5px;" +
- "margin-left: -1.5em" +
- "text-align: right" +
+ "margin-left: -1.5em;" +
+ "text-align: right;" +
"text-overflow: ellipsis;" +
"overflow: hidden;" +
"white-space: pre;";
if (label.indexOf(" ") != -1) {
- div_attributes += "min-height: 2.5em;";
+ var label_array = label.split(" ");
+ label = label_array[0] + label_array[1];
}
div_attributes += '" title="' + label + '" style="overflow: hidden;"';
diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php
index 57cf3a1f43..8c4a1b6ade 100644
--- a/pandora_console/include/graphs/functions_d3.php
+++ b/pandora_console/include/graphs/functions_d3.php
@@ -150,7 +150,7 @@ function d3_tree_map_graph($data, $width=700, $height=700, $return=false)
}
-function d3_sunburst_graph($data, $width=700, $height=700, $return=false)
+function d3_sunburst_graph($data, $width=700, $height=700, $return=false, $tooltip=true)
{
global $config;
@@ -167,7 +167,7 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false)
}
';
$output .= "";
if (!$return) {
diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js
index 8495a8728b..aad0506f86 100644
--- a/pandora_console/include/graphs/pandora.d3.js
+++ b/pandora_console/include/graphs/pandora.d3.js
@@ -796,7 +796,7 @@ function treeMap(recipient, data, width, height) {
// The area (or angle, depending on implementation) of each arc corresponds to its value.
// Sunburst design by John Stasko. Data courtesy Jeff Heer.
// http://bl.ocks.org/mbostock/4348373
-function sunburst(recipient, data, width, height) {
+function sunburst(recipient, data, width, height, tooltip = true) {
if (width === "auto") {
width = $(recipient).innerWidth();
}
@@ -858,11 +858,14 @@ function sunburst(recipient, data, width, height) {
})
.style("cursor", "pointer")
.on("click", click)
- .on("mouseover", over_user)
+ .on("mouseover", tooltip === "1" ? over_user : "")
.on("mouseout", out_user)
.on("mousemove", move_tooltip);
function computeTextRotation(d) {
+ if (d.type === "central_service") {
+ return 0;
+ }
var ang = ((x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI) * 180;
return ang > 90 ? 180 + ang : ang;
}
@@ -882,9 +885,18 @@ function sunburst(recipient, data, width, height) {
return computeTextRotation(d) > 180 ? -40 : -30;
})
.attr("dx", "6") // margin
- .attr("dy", ".35em") // vertical-align
+ .attr("dy", function(d) {
+ if (d.type === "central_service") {
+ return "-7em";
+ }
+ return ".35em";
+ }) // vertical-align
.attr("opacity", function(d) {
- if (typeof d.show_name != "undefined" && d.show_name) return 1;
+ if (
+ (typeof d.show_name != "undefined" && d.show_name) ||
+ d.type === "central_service"
+ )
+ return 1;
else return 0;
})
.text(function(d) {
@@ -899,7 +911,11 @@ function sunburst(recipient, data, width, height) {
window.location.href = d.link;
} else {
// fade out all text elements
- text.transition().attr("opacity", 0);
+ if (d.type === "central_service") {
+ text.transition().attr("opacity", 1);
+ } else {
+ text.transition().attr("opacity", 0);
+ }
path
.transition()
@@ -965,8 +981,8 @@ function sunburst(recipient, data, width, height) {
}
function move_tooltip(d) {
- var x = d3.event.pageX + 10;
- var y = d3.event.pageY + 10;
+ var x = d3.event.pageX + 10 - $("#menu_full").width();
+ var y = d3.event.pageY - 90;
$("#tooltip").css("left", x + "px");
$("#tooltip").css("top", y + "px");
@@ -1017,10 +1033,10 @@ function sunburst(recipient, data, width, height) {
"-moz-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" +
"box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" +
"left: " +
- x +
+ 100 +
"px;" +
"top: " +
- y +
+ 100 +
"px;"
);
}
diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js
index 740ff0f265..eb8118a911 100644
--- a/pandora_console/include/javascript/pandora.js
+++ b/pandora_console/include/javascript/pandora.js
@@ -2027,3 +2027,33 @@ function inArray(needle, haystack) {
}
return false;
}
+
+/**
+ * Filter selector item by text based on a text input.
+ *
+ * @param {string} textbox Text input.
+ *
+ * @return {void}
+ */
+$.fn.filterByText = function(textbox) {
+ var select = this;
+
+ $(textbox).bind("change keyup", function() {
+ var search = $.trim($(textbox).val());
+ var regex = new RegExp(search, "gi");
+
+ $(select)
+ .find("option")
+ .each(function() {
+ if (
+ $(this)
+ .text()
+ .match(regex) !== null
+ ) {
+ $(this).show();
+ } else {
+ $(this).hide();
+ }
+ });
+ });
+};
diff --git a/pandora_console/include/lib/Dashboard/Widget.php b/pandora_console/include/lib/Dashboard/Widget.php
index 320280718b..1c5904e74a 100644
--- a/pandora_console/include/lib/Dashboard/Widget.php
+++ b/pandora_console/include/lib/Dashboard/Widget.php
@@ -412,6 +412,10 @@ class Widget
$className .= '\WuxWidget';
break;
+ case 'os_quick_report':
+ $className .= '\OsQuickReportWidget';
+ break;
+
default:
$className = false;
break;
diff --git a/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php b/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php
new file mode 100644
index 0000000000..c1bad5c63f
--- /dev/null
+++ b/pandora_console/include/lib/Dashboard/Widgets/os_quick_report.php
@@ -0,0 +1,350 @@
+width = $width;
+
+ // Height.
+ $this->height = $height;
+
+ // Cell Id.
+ $this->cellId = $cellId;
+
+ // Widget ID.
+ $this->widgetId = $widgetId;
+
+ // Dashboard ID.
+ $this->dashboardId = $dashboardId;
+
+ // Options.
+ $this->values = $this->decoders($this->getOptionsWidget());
+
+ // Positions.
+ $this->position = $this->getPositionWidget();
+
+ // Page.
+ $this->page = basename(__FILE__);
+
+ // ClassName.
+ $class = new \ReflectionClass($this);
+ $this->className = $class->getShortName();
+
+ // Title.
+ $this->title = __('OS quick report');
+
+ // Name.
+ if (empty($this->name) === true) {
+ $this->name = 'os_quick_report';
+ }
+
+ $this->overflow_scrollbars = false;
+ }
+
+
+ /**
+ * Decoders hack for retrocompability.
+ *
+ * @param array $decoder Values.
+ *
+ * @return array Returns the values with the correct key.
+ */
+ public function decoders(array $decoder): array
+ {
+ $values = [];
+ // Retrieve global - common inputs.
+ $values = parent::decoders($decoder);
+
+ return $values;
+ }
+
+
+ /**
+ * Generates inputs for form (specific).
+ *
+ * @return array Of inputs.
+ *
+ * @throws Exception On error.
+ */
+ public function getFormInputs(): array
+ {
+ // Retrieve global - common inputs.
+ $inputs = parent::getFormInputs();
+
+ return $inputs;
+ }
+
+
+ /**
+ * Get Post for widget.
+ *
+ * @return array
+ */
+ public function getPost():array
+ {
+ // Retrieve global - common inputs.
+ $values = parent::getPost();
+
+ return $values;
+ }
+
+
+ /**
+ * Draw widget.
+ *
+ * @return string;
+ */
+ public function load()
+ {
+ global $config;
+
+ $values = $this->values;
+
+ $result = [];
+ $os_array = os_get_os();
+ foreach ($os_array as $os) {
+ $id_os = (int) $os['id_os'];
+ $total = os_agents_total($id_os);
+ if ((int) $total === 0) {
+ continue;
+ }
+
+ $result[$id_os]['name'] = $os['name'];
+ $result[$id_os]['total'] = (int) $total;
+ $result[$id_os]['normal'] = (int) os_agents_ok($id_os);
+ $result[$id_os]['critical'] = (int) os_agents_critical($id_os);
+ $result[$id_os]['unknown'] = (int) os_agents_unknown($id_os);
+ }
+
+ $output = '';
+ if (empty($result) === false) {
+ $table = new \stdClass();
+
+ $table->class = 'info_table';
+ $table->width = '100%';
+ $table->cellpadding = 0;
+ $table->cellspacing = 0;
+ $table->size = [];
+ $table->size[0] = '10%';
+ $table->size[1] = '10%';
+ $table->size[2] = '20%';
+ $table->size[3] = '20%';
+ $table->size[4] = '20%';
+ $table->size[5] = '20%';
+
+ $table->align = [];
+ $table->align[0] = 'center';
+ $table->align[1] = 'left';
+ $table->align[2] = 'center';
+ $table->align[3] = 'center';
+ $table->align[4] = 'center';
+ $table->align[5] = 'center';
+
+ $table->head = [];
+ $table->head[0] = __('OS');
+ $table->head[1] = __('OS name');
+ $table->head[2] = ucfirst(__('total agents'));
+ $table->head[3] = ucfirst(__('normal agents'));
+ $table->head[4] = ucfirst(__('critical agents'));
+ $table->head[5] = ucfirst(__('unknown agents'));
+
+ $table->headstyle = [];
+ $table->headstyle[0] = 'text-align:center;background-color: '.$values['background'];
+ $table->headstyle[1] = 'background-color: '.$values['background'];
+ $table->headstyle[2] = 'text-align:center;background-color: '.$values['background'];
+ $table->headstyle[3] = 'text-align:center;background-color: '.$values['background'];
+ $table->headstyle[4] = 'text-align:center;background-color: '.$values['background'];
+ $table->headstyle[5] = 'text-align:center;background-color: '.$values['background'];
+
+ $table->style = [];
+ $table->style[0] = 'background-color: '.$values['background'];
+ $table->style[1] = 'background-color: '.$values['background'];
+ $table->style[2] = 'font-size: 22px;background-color: '.$values['background'];
+ $table->style[3] = 'font-size: 22px;background-color: '.$values['background'];
+ $table->style[4] = 'font-size: 22px;background-color: '.$values['background'];
+ $table->style[5] = 'font-size: 22px;background-color: '.$values['background'];
+
+ foreach ($result as $id => $os) {
+ $data = [];
+
+ $data[0] = ui_print_os_icon($id, false, true);
+ $data[1] = $os['name'];
+ $data[2] = $os['total'];
+ $data[3] = $os['normal'];
+ $data[4] = $os['critical'];
+ $data[5] = $os['unknown'];
+
+ $table->data[] = $data;
+ }
+
+ $output = html_print_table($table, true);
+ } else {
+ $output = 'No data available';
+ }
+
+ return $output;
+ }
+
+
+ /**
+ * Get description.
+ *
+ * @return string.
+ */
+ public static function getDescription()
+ {
+ return __('OS quick report');
+ }
+
+
+ /**
+ * Get Name.
+ *
+ * @return string.
+ */
+ public static function getName()
+ {
+ return 'os_quick_report';
+ }
+
+
+}
diff --git a/pandora_console/include/lib/Dashboard/Widgets/service_map.php b/pandora_console/include/lib/Dashboard/Widgets/service_map.php
index a2122c6dca..21a7edc82c 100644
--- a/pandora_console/include/lib/Dashboard/Widgets/service_map.php
+++ b/pandora_console/include/lib/Dashboard/Widgets/service_map.php
@@ -235,6 +235,10 @@ class ServiceMapWidget extends Widget
$values['showLegend'] = $decoder['showLegend'];
}
+ if (isset($decoder['sunburst']) === true) {
+ $values['sunburst'] = $decoder['sunburst'];
+ }
+
return $values;
}
@@ -296,19 +300,16 @@ class ServiceMapWidget extends Widget
],
];
- // TODO refactoriced services: Hidden legend.
- /*
- // Show legend.
- $inputs[] = [
- 'label' => __('Show legend'),
+ $inputs[] = [
+ 'label' => __('Enable sunburst'),
'arguments' => [
- 'name' => 'showLegend',
- 'id' => 'showLegend',
- 'type' => 'switch',
- 'value' => $values['showLegend'],
+ 'type' => 'switch',
+ 'name' => 'sunburst',
+ 'class' => 'event-widget-input',
+ 'value' => $values['sunburst'],
+ 'return' => true,
],
- ];
- */
+ ];
return $inputs;
}
@@ -325,7 +326,9 @@ class ServiceMapWidget extends Widget
$values = parent::getPost();
$values['serviceId'] = \get_parameter('serviceId', 0);
- // $values['showLegend'] = \get_parameter_switch('showLegend');
+
+ $values['sunburst'] = \get_parameter_switch('sunburst', 0);
+
return $values;
}
@@ -341,6 +344,7 @@ class ServiceMapWidget extends Widget
$size = parent::getSize();
+ $output = '';
if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '';
$output .= \ui_print_error_message(
@@ -367,42 +371,6 @@ class ServiceMapWidget extends Widget
$style = 'position: relative; text-align: center;';
$output .= "
";
- // TODO refactoriced services: Hidden legend.
- /*
- if ($this->values['showLegend'] === 1) {
- $output .= "
cellId."'>";
- $output .= '
';
- $output .= "".__('Legend').' ';
- $output .= " ";
-
- $output .= "";
- $output .= " ";
- $output .= ' '.__('Services').' ';
-
- // Coulour legend.
- $output .= "";
- $output .= '';
- $output .= "
".__('Critical').' ';
- $output .= "
".__('Warning').' ';
- $output .= "
".__('Ok').' ';
- $output .= "
".__('Unknown').' ';
- $output .= '
';
- $output .= ' ';
-
- $output .= "";
- $output .= " ";
- $output .= ' '.__('Agents').' ';
- $output .= ' ';
-
- $output .= "";
- $output .= " ";
- $output .= ' '.__('Modules').' ';
- $output .= ' ';
- $output .= '
';
- $output .= '
';
- }
- */
-
// TODO: removed refactoriced services. Only 1 widget Zoom.
$sql = sprintf(
'SELECT COUNT(*)
@@ -425,14 +393,21 @@ class ServiceMapWidget extends Widget
);
// TODO:XXX fix draw service map.
ob_start();
- servicemap_print_servicemap(
- $this->values['serviceId'],
- false,
- $size['width'],
- $size['height'],
- $this->cellId,
- $disableZoom
- );
+
+ if ($this->values['sunburst'] === 0) {
+ servicemap_print_servicemap(
+ $this->values['serviceId'],
+ false,
+ $size['width'],
+ $size['height'],
+ $this->cellId,
+ $disableZoom
+ );
+ } else {
+ include_once $config['homedir'].'/include/graphs/functions_d3.php';
+ servicemap_print_sunburst($this->values['serviceId'], $size['width'], $size['height'], false);
+ }
+
$output .= ob_get_clean();
$output .= '
';
return $output;
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index df286eaf49..20e611ca26 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -6048,9 +6048,9 @@ table.table_modal_alternate tr td:first-child {
font-family: "lato" !important;
}
-.flot-text {
- width: 100%;
- font-family: inherit !important;
+.flot-text .flot-x-axis div {
+ white-space: normal;
+ word-break: break-all;
}
/*Font header feedback*/
@@ -6226,6 +6226,9 @@ div.graph td.legendLabel {
div.graph div.legend div,
div.graph div.legend table {
top: 25px !important;
+ display: block;
+ overflow: auto;
+ text-align: left;
}
.rotate_text_module {
diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css
index 8057c926f3..3db3587bef 100644
--- a/pandora_console/include/styles/pandora_black.css
+++ b/pandora_console/include/styles/pandora_black.css
@@ -340,8 +340,8 @@ a.pandora_pagination {
/* firts_task.css */
.new_task,
-div.new_task_cluster,
-div.new_task_cluster > div {
+div.new_task,
+div.new_task > div {
background-color: #222;
}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 2e33f3d8d9..df9b54b2cf 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
'noaccess'];
}
@@ -67,14 +67,14 @@ if (! $event_a
}
-$access = ($event_a == true) ? 'ER' : (($event_w == true) ? 'EW' : (($event_m == true) ? 'EM' : 'ER'));
+$access = ($event_a === true) ? 'ER' : (($event_w === true) ? 'EW' : (($event_m === true) ? 'EM' : 'ER'));
$readonly = false;
if (is_metaconsole() === false
- && isset($config['event_replication'])
- && $config['event_replication'] == 1
- && $config['show_events_in_local'] == 1
+ && isset($config['event_replication']) === true
+ && (int) $config['event_replication'] === 1
+ && (int) $config['show_events_in_local'] === 1
) {
$readonly = true;
}
@@ -100,7 +100,7 @@ $default_filter = [
];
$fb64 = get_parameter('fb64', null);
-if (isset($fb64)) {
+if (isset($fb64) === true) {
$filter = json_decode(base64_decode($fb64), true);
$filter['tag_with'] = [];
$filter['tag_without'] = [];
@@ -238,20 +238,20 @@ $custom_data = get_parameter(
if (is_metaconsole() === true) {
// Connect to node database.
- $id_node = $server_id;
- if ($id_node != 0) {
- if (metaconsole_connect(null, $id_node) != NOERR) {
+ $id_node = (int) $server_id;
+ if ($id_node !== 0) {
+ if (metaconsole_connect(null, $id_node) !== NOERR) {
return false;
}
}
}
-if (empty($text_agent) && empty($id_agent) === false) {
+if (empty($text_agent) === true && empty($id_agent) === false) {
$text_agent = agents_get_alias($id_agent);
}
-if (empty($text_module) && empty($id_agent_module) === false) {
+if (empty($text_module) === true && empty($id_agent_module) === false) {
$text_module = modules_get_agentmodule_name($id_agent_module);
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
}
@@ -501,7 +501,7 @@ if ($load_filter_id === 0) {
// Do not load the user filter if we come from the 24h event graph.
$from_event_graph = get_parameter('filter[from_event_graph]', $filter['from_event_graph']);
-if ($loaded_filter !== false && $from_event_graph != 1 && !isset($fb64)) {
+if ($loaded_filter !== false && $from_event_graph != 1 && isset($fb64) === false) {
$filter = events_get_event_filter($loaded_filter['id_filter']);
if ($filter !== false) {
$id_group = $filter['id_group'];
@@ -1136,15 +1136,19 @@ $in = '
'.__('Free search').' ';
$in .= $data.'
';
$inputs[] = $in;
-if (empty($severity) === true && $severity !== '0') {
- $severity = -1;
+if (is_array($severity) === false) {
+ if (empty($severity) === true && $severity !== '0') {
+ $severity = -1;
+ } else {
+ $severity = explode(',', $severity);
+ }
}
// Criticity - severity.
$data = html_print_select(
get_priorities(),
'severity',
- explode(',', $severity),
+ $severity,
'',
__('All'),
-1,
diff --git a/pandora_console/pandora_console.redhat.spec b/pandora_console/pandora_console.redhat.spec
index f589abf977..85de87f0d2 100644
--- a/pandora_console/pandora_console.redhat.spec
+++ b/pandora_console/pandora_console.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.762
-%define release 220525
+%define release 220606
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.rhel7.spec b/pandora_console/pandora_console.rhel7.spec
index 64e2e1d81a..c9605f09b9 100644
--- a/pandora_console/pandora_console.rhel7.spec
+++ b/pandora_console/pandora_console.rhel7.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.762
-%define release 220525
+%define release 220606
# User and Group under which Apache is running
%define httpd_name httpd
diff --git a/pandora_console/pandora_console.spec b/pandora_console/pandora_console.spec
index db4fc25362..4f2676d72c 100644
--- a/pandora_console/pandora_console.spec
+++ b/pandora_console/pandora_console.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.762
-%define release 220525
+%define release 220606
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 49f5edb991..ebd940c749 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -2817,6 +2817,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`cascade_protection` TINYINT NOT NULL DEFAULT 0,
`evaluate_sla` INT NOT NULL DEFAULT 0,
`is_favourite` TINYINT NOT NULL DEFAULT 0,
+ `enable_sunburst` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor'
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index a9961bcc00..8f60368737 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -219,7 +219,7 @@ INSERT INTO `tlink` VALUES
(1,'Documentation','https://pandorafms.com/manual'),
(2,'Enterprise Edition','http://pandorafms.com'),
(3,'Report a bug','https://github.com/pandorafms/pandorafms/issues'),
-(4,'Suggest new feature','http://forums.pandorafms.com/index.php?board=22.0'),
+(4,'Suggest new feature','https://pandorafms.com/community/beta-program/'),
(5,'Module library','http://library.pandorafms.com/');
UNLOCK TABLES;
diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control
index f59d1bb94d..0c2ca1b9e6 100644
--- a/pandora_server/DEBIAN/control
+++ b/pandora_server/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-server
-Version: 7.0NG.762-220525
+Version: 7.0NG.762-220606
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh
index 6e1c3ed8e5..1c030c76ee 100644
--- a/pandora_server/DEBIAN/make_deb_package.sh
+++ b/pandora_server/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.762-220525"
+pandora_version="7.0NG.762-220606"
package_cpan=0
package_pandora=1
diff --git a/pandora_server/FreeBSD/pandora_server.conf.new b/pandora_server/FreeBSD/pandora_server.conf.new
index 74f70a8f54..b081473adc 100644
--- a/pandora_server/FreeBSD/pandora_server.conf.new
+++ b/pandora_server/FreeBSD/pandora_server.conf.new
@@ -68,10 +68,6 @@ dbhost 127.0.0.1
#dbport 3306
-# By default, parent agent will not be updated
-
-#update_parent 0
-
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments.
diff --git a/pandora_server/NetBSD/pandora_server.conf.new b/pandora_server/NetBSD/pandora_server.conf.new
index ddb8be2b9e..314c398d2d 100644
--- a/pandora_server/NetBSD/pandora_server.conf.new
+++ b/pandora_server/NetBSD/pandora_server.conf.new
@@ -68,10 +68,6 @@ dbhost 127.0.0.1
#dbport 3306
-# By default, parent agent will not be updated
-
-#update_parent 0
-
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments.
diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new
index 72657ae20c..f8fec2bd7d 100644
--- a/pandora_server/conf/pandora_server.conf.new
+++ b/pandora_server/conf/pandora_server.conf.new
@@ -79,10 +79,6 @@ dbssl 0
# dbsslcapath
-# By default, parent agent will not be updated
-
-#update_parent 0
-
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments.
@@ -434,6 +430,7 @@ sample_agent_interval 600
# Update parent from the agent xml
update_parent 1
+
#
#
# This enable realtime reverse geocoding using Google Maps public api.
diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows
index 7bfc3ccb70..7299ea6f12 100644
--- a/pandora_server/conf/pandora_server.conf.windows
+++ b/pandora_server/conf/pandora_server.conf.windows
@@ -68,10 +68,6 @@ dbhost 192.168.55.1
#dbport 3306
-# By default, parent agent will not be updated
-
-#update_parent 0
-
# verbosity: level of detail on errors/messages (0 default, 1 verbose, 2 debug.... 10 noisy)
# -v in command line (verbose) or -d (debug). Set this to 10 when try to locate problems and
# set to 1 or 3 on production enviroments.
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index 20b71f5ae5..f3502cff1a 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.762";
-my $pandora_build = "220525";
+my $pandora_build = "220606";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 2e46c246ee..afa16cc2fa 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.762";
-my $pandora_build = "220525";
+my $pandora_build = "220606";
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 4b585dff06..54d2ac5459 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.762
-%define release 220525
+%define release 220606
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index b607d1bfdf..4b64e3661c 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.762
-%define release 220525
+%define release 220606
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 040a2f1c65..01cd132aaa 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.762"
-PI_BUILD="220525"
+PI_BUILD="220606"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index a1070b8eb0..cb3fc978d7 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.762 Build 220525";
+my $version = "7.0NG.762 Build 220606";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 55a268e228..8ce7f33f32 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.762 Build 220525";
+my $version = "7.0NG.762 Build 220606";
# save program name for logging
my $progname = basename($0);
@@ -3078,7 +3078,7 @@ sub cli_user_update() {
$new_value = md5($new_value);
}
else {
- print_log "[ERROR] Field '$field' doesnt exist\n\n";
+ print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit;
}
@@ -3107,7 +3107,7 @@ sub cli_agent_update_custom_fields() {
my $found = 0;
if($agent_name eq '') {
- print_log "[ERROR] Agent '$id_agent' doesnt exist\n\n";
+ print_log "[ERROR] Agent '$id_agent' doesn't exist\n\n";
exit;
}
@@ -3116,7 +3116,7 @@ sub cli_agent_update_custom_fields() {
if($custom_field eq '') {
- print_log "[ERROR] Field '$field' doesnt exist\n\n";
+ print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit;
}
@@ -3142,7 +3142,7 @@ sub cli_agent_update_custom_fields() {
if($result == "0E0"){
print_log "[ERROR] Error updating field '$field'\n\n";
} else {
- print_log "[INFO] Field '$field' updated succesfully!\n\n";
+ print_log "[INFO] Field '$field' updated successfully!\n\n";
}
exit;
@@ -3210,7 +3210,7 @@ sub cli_agent_update() {
# Check if the address already exist
my $address_id = get_addr_id($dbh,$new_value);
- # If the addres doesnt exist, we add it to the addresses list
+ # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) {
$address_id = add_address($dbh,$new_value);
}
@@ -3233,7 +3233,7 @@ sub cli_agent_update() {
$field = 'direccion';
}
else {
- print_log "[ERROR] Field '$field' doesnt exist\n\n";
+ print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit;
}
@@ -3299,7 +3299,7 @@ sub cli_alert_template_update() {
$field = 'id_group';
}
else {
- print_log "[ERROR] Field '$field' doesnt exist\n\n";
+ print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit;
}
@@ -3346,7 +3346,7 @@ sub pandora_check_network_module_fields($) {
# Check if the address already exist
my $address_id = get_addr_id($dbh,$field_value->{'new_value'});
- # If the addres doesnt exist, we add it to the addresses list
+ # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) {
$address_id = add_address($dbh,$field_value->{'new_value'});
}
@@ -3419,7 +3419,7 @@ sub pandora_check_snmp_module_fields($) {
# Check if the address already exist
my $address_id = get_addr_id($dbh,$field_value->{'new_value'});
- # If the addres doesnt exist, we add it to the addresses list
+ # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) {
$address_id = add_address($dbh,$field_value->{'new_value'});
}
@@ -3482,7 +3482,7 @@ sub pandora_check_plugin_module_fields($) {
# Check if the address already exist
my $address_id = get_addr_id($dbh,$field_value->{'new_value'});
- # If the addres doesnt exist, we add it to the addresses list
+ # If the addres doesn't exist, we add it to the addresses list
if($address_id == -1) {
$address_id = add_address($dbh,$field_value->{'new_value'});
}
@@ -3584,7 +3584,7 @@ sub cli_module_update() {
my $module_group_id = get_module_group_id($dbh,$new_value);
if ($module_group_id == -1) {
- print_log "[ERROR] Module group '$new_value' doesnt exist\n\n";
+ print_log "[ERROR] Module group '$new_value' doesn't exist\n\n";
exit;
}
$field = 'id_module_group';
@@ -3728,7 +3728,7 @@ sub cli_module_update() {
my $module_group_id = get_module_group_id($dbh,$new_value);
if ($module_group_id == -1) {
- print_log "[ERROR] Module group '$new_value' doesnt exist\n\n";
+ print_log "[ERROR] Module group '$new_value' doesn't exist\n\n";
exit;
}
$field = 'id_module_group';
@@ -4749,7 +4749,7 @@ if($result == 0) {
print_log "[ERROR] Alert could not be validated\n\n";
}
else {
- print_log "[INFO] Alert succesfully validated\n\n";
+ print_log "[INFO] Alert successfully validated\n\n";
;
}
@@ -5589,7 +5589,7 @@ sub cli_delete_conf_file() {
}
if($conf_deleted == 1 || $md5_deleted == 1) {
- print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted succesfully\n\n";
+ print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted successfully\n\n";
}
else {
print_log "[ERROR] Local conf file of the agent '$agent_name' was not found\n\n";
@@ -5607,7 +5607,7 @@ sub cli_delete_conf_file() {
}
if($conf_deleted == 1 || $md5_deleted == 1) {
- print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted succesfully\n\n";
+ print_log "[INFO] Local conf files of the agent '$agent_name' has been deleted successfully\n\n";
}
else {
print_log "[ERROR] Local conf file of the agent '$agent_name' was not found\n\n";
@@ -5913,7 +5913,7 @@ sub cli_create_group() {
$parent_group_id, 0, 0, '', 0, $description);
};
if ($@) {
- print_log "[ERROR] Problems with IDS and doesnt created group\n\n";
+ print_log "[ERROR] Problems with IDS and doesn't created group\n\n";
$count_error++;
next;
}
@@ -6563,7 +6563,7 @@ sub cli_update_special_day() {
$field = 'id_group';
}
else {
- print_log "[ERROR] Field '$field' doesnt exist\n\n";
+ print_log "[ERROR] Field '$field' doesn't exist\n\n";
exit;
}