Merge remote-tracking branch 'origin/develop' into ent-9086-eliminacion-de-la-replicacion-de-eventos-duplicado

Conflicts:
	pandora_console/operation/events/events.php
This commit is contained in:
Daniel Barbero Martin 2022-06-03 09:28:18 +02:00
commit 1cd680a971
48 changed files with 309 additions and 208 deletions

View File

@ -4,7 +4,7 @@
# define variables # define variables
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2021100601' S_VERSION='2022052301'
LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log" LOGFILE="/tmp/pandora-agent-deploy-$(date +%F).log"
# Ansi color code variables # Ansi color code variables
@ -49,7 +49,6 @@ check_cmd_status () {
} }
check_repo_connection () { 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 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' 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. # 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=$([[ $(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 =~ 'rhel' ]] && OS_RELEASE=$OS
[[ $OS =~ 'fedora' ]] && OS_RELEASE=$OS
[[ $OS =~ 'debian' ]] && OS_RELEASE=$OS [[ $OS =~ 'debian' ]] && OS_RELEASE=$OS
#[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS #[[ $OS == 'rhel fedora' ]] && OS_RELEASE=$OS
#[[ $OS == 'centos 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 # Downloading and installing packages
if [[ $OS_RELEASE =~ 'rhel' ]]; then if [[ $OS_RELEASE =~ 'rhel' ]] || [[ $OS_RELEASE =~ 'fedora' ]]; then
yum install -y perl wget curl perl-Sys-Syslog unzip &>> $LOGFILE ## Extra steps on redhat
echo -e "${cyan}Instaling agent dependencies...${reset}" ${green}OK${reset} 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 # Insatall pandora agent
echo -e "${cyan}Instaling Pandora FMS agent...${reset}" ${green}OK${reset} $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 fi
if [[ $OS_RELEASE == 'debian' ]]; then if [[ $OS_RELEASE == 'debian' ]]; then
execute_cmd "apt update" 'Updating repos' 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 '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' execute_cmd 'apt install -y ./pandorafms.agent_unix_7.0NG.deb' 'Installing Pandora FMS agent'
fi fi

View File

@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf
PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf
S_VERSION='2022050501' S_VERSION='2022052501'
LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log"
# define default variables # define default variables
@ -420,7 +420,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." 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 "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 echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
export MYSQL_PWD=$DBPASS export MYSQL_PWD=$DBPASS
#Generating my.cnf #Generating my.cnf

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.762-220602 Version: 7.0NG.762-220603
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.762-220602" pandora_version="7.0NG.762-220603"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.762'; use constant AGENT_VERSION => '7.0NG.762';
use constant AGENT_BUILD => '220602'; use constant AGENT_BUILD => '220603';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.762" PI_VERSION="7.0NG.762"
PI_BUILD="220602" PI_BUILD="220603"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{220602} {220603}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.762 Build 220602") #define PANDORA_VERSION ("7.0NG.762 Build 220603")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.762(Build 220602))" VALUE "ProductVersion", "(7.0NG.762(Build 220603))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.762-220602 Version: 7.0NG.762-220603
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.762-220602" pandora_version="7.0NG.762-220603"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `tservice` ADD COLUMN `enable_sunburst` tinyint(1) NOT NULL default 0;
COMMIT;

View File

@ -258,9 +258,9 @@ $table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;'; $table->style[2] = 'font-weight: bold;';
$table->size = []; $table->size = [];
$table->size[0] = '15%'; $table->size[0] = '15%';
$table->size[1] = '40%'; $table->size[1] = '35%';
$table->size[2] = '15%'; $table->size[2] = '15%';
$table->size[3] = '40%'; $table->size[3] = '35%';
$table->data = []; $table->data = [];
@ -276,7 +276,12 @@ $table->data[0][1] = html_print_select(
false, false,
__('Select'), __('Select'),
0, 0,
true true,
false,
true,
'',
false,
'width: 100%;'
); );
$table->data[0][2] = ''; $table->data[0][2] = '';
$table->data[0][3] = ''; $table->data[0][3] = '';
@ -295,7 +300,8 @@ $table->data[1][1] = html_print_select_groups(
false, false,
true, true,
'', '',
$id_alert_template == 0 $id_alert_template == 0,
'width: 100%;'
); );
$table->data[0][2] = __('Show alerts on disabled modules'); $table->data[0][2] = __('Show alerts on disabled modules');

View File

@ -256,16 +256,18 @@ $table->style[0] = 'font-weight: bold';
$table->size[0] = '70%'; $table->size[0] = '70%';
$table->size[1] = '30%'; $table->size[1] = '30%';
// enterprise_hook('enterprise_warnings_history_days');
$table->data[1][0] = __('Max. days before delete events'); $table->data[1][0] = __('Max. days before delete events');
$table->data[1][1] = html_print_input(
$table->data[1][1] = html_print_input_text( [
'event_purge', 'type' => 'number',
$config['event_purge'], 'size' => 5,
'', 'max' => 99999,
5, 'name' => 'event_purge',
5, 'value' => $config['event_purge'],
true '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'); $table->data[2][0] = __('Max. days before delete traps');

View File

@ -274,7 +274,7 @@ $table->data[$i++][1] = html_print_input_text(
$url_update_manager, $url_update_manager,
__('URL update manager'), __('URL update manager'),
80, 80,
60, 255,
true true
); );

View File

@ -136,7 +136,7 @@ if ($get_comments === true) {
// Default grouped message filtering (evento and estado). // Default grouped message filtering (evento and estado).
$whereGrouped = sprintf( $whereGrouped = sprintf(
'`evento` = "%s" AND `estado` = "%s"', '`evento` = "%s" AND `estado` = "%s"',
io_safe_output($event['evento']), $event['evento'],
$event['estado'] $event['estado']
); );
// If id_agente is reported, filter the messages by them as well. // If id_agente is reported, filter the messages by them as well.

View File

@ -530,33 +530,6 @@ class TreeService extends Tree
$tmp['elementDescription'] = $item->description(); $tmp['elementDescription'] = $item->description();
$tmp['disabled'] = $item->service()->disabled(); $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 = [ $counters = [
'total_modules' => 0, 'total_modules' => 0,
'total_agents' => 0, 'total_agents' => 0,
@ -565,29 +538,66 @@ class TreeService extends Tree
'total' => 0, 'total' => 0,
]; ];
if (is_array($grandchildren) === true) { if (is_metaconsole() === false
$counters = array_reduce( || (isset($config['realtimestats']) === true
$grandchildren, && $config['realtimestats'] === true
function ($carry, $item) { && $tmp['metaID'] > 0)
if ($item->type() === SERVICE_ELEMENT_MODULE) { ) {
$carry['total_modules']++; // Look for counters.
} else if ($item->type() === SERVICE_ELEMENT_AGENT) { if ($this->connectedToNode === false
$carry['total_agents']++; && is_metaconsole() === true
} else if ($item->type() === SERVICE_ELEMENT_SERVICE) { && $tmp['metaID'] > 0
$carry['total_services']++; ) {
} else if ($item->type() === SERVICE_ELEMENT_DYNAMIC) { // Impersonate node.
$carry['total_dynamic']++; \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; if ($this->connectedToNode === false
}, && is_metaconsole() === true
$counters && $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; $tmp['searchChildren'] = 1;
} }

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC220602'; $build_version = 'PC220603';
$pandora_version = 'v7.0NG.762'; $pandora_version = 'v7.0NG.762';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -1855,7 +1855,19 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3)
return; 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]); $direccion_agente = io_safe_input($other['data'][1]);
$nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000))); $nombre_agente = hash('sha256', $direccion_agente.'|'.$direccion_agente.'|'.time().'|'.sprintf('%04d', rand(0, 10000)));
$id_parent = (int) $other['data'][2]; $id_parent = (int) $other['data'][2];

View File

@ -2096,6 +2096,10 @@ function config_process_config()
config_update_value('metaconsole_events_history', 0); config_update_value('metaconsole_events_history', 0);
} }
if (!isset($config['realtimestats'])) {
config_update_value('realtimestats', 1);
}
if (!isset($config['trap_purge'])) { if (!isset($config['trap_purge'])) {
config_update_value('trap_purge', 7); config_update_value('trap_purge', 7);
} }

View File

@ -2293,6 +2293,7 @@ function events_comment(
$comments_format = 'new'; $comments_format = 'new';
} else { } else {
// If comments are not stored in json, the format is old. // If comments are not stored in json, the format is old.
$event_comments[0]['user_comment'] = str_replace(["\n", '&#x0a;'], '<br>', $event_comments[0]['user_comment']);
$event_comments_array = json_decode($event_comments[0]['user_comment']); $event_comments_array = json_decode($event_comments[0]['user_comment']);
if (empty($event_comments_array) === true) { if (empty($event_comments_array) === true) {
@ -5183,6 +5184,8 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
$comm = $comm['user_comment']; $comm = $comm['user_comment'];
} }
$comm = str_replace(["\n", '&#x0a;'], '<br>', $comm);
$comments_array[] = io_safe_output(json_decode($comm, true)); $comments_array[] = io_safe_output(json_decode($comm, true));
} }

View File

@ -15,6 +15,8 @@ function pandoraFlotPie(
colors, colors,
hide_labels hide_labels
) { ) {
height = parseInt(height);
labels = labels.split(separator); labels = labels.split(separator);
var data = values.split(separator); var data = values.split(separator);
@ -79,11 +81,22 @@ function pandoraFlotPie(
break; break;
} }
var discount = 20;
if (water_mark) {
discount = 40;
}
var plot = $.plot($("#" + graph_id), data, conf_pie); var plot = $.plot($("#" + graph_id), data, conf_pie);
var legends = $("#" + graph_id + " .legendLabel"); var legends = $("#" + graph_id + " .legendLabel");
legends.css("font-size", font_size + "pt"); 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 // Events
$("#" + graph_id).bind("plothover", pieHover); $("#" + graph_id).bind("plothover", pieHover);
//$("#" + graph_id).bind("plotclick", pieClick); //$("#" + graph_id).bind("plotclick", pieClick);
@ -443,14 +456,15 @@ function pandoraFlotHBars(
"pt !important;" + "pt !important;" +
"margin: 0; max-width: 200px;" + "margin: 0; max-width: 200px;" +
"margin-right:5px;" + "margin-right:5px;" +
"margin-left: -1.5em" + "margin-left: -1.5em;" +
"text-align: right" + "text-align: right;" +
"text-overflow: ellipsis;" + "text-overflow: ellipsis;" +
"overflow: hidden;" + "overflow: hidden;" +
"white-space: pre;"; "white-space: pre;";
if (label.indexOf("<br>") != -1) { if (label.indexOf("<br>") != -1) {
div_attributes += "min-height: 2.5em;"; var label_array = label.split("<br>");
label = label_array[0] + label_array[1];
} }
div_attributes += '" title="' + label + '" style="overflow: hidden;"'; div_attributes += '" title="' + label + '" style="overflow: hidden;"';

View File

@ -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; global $config;
@ -167,7 +167,7 @@ function d3_sunburst_graph($data, $width=700, $height=700, $return=false)
} }
</style>'; </style>';
$output .= "<script language=\"javascript\" type=\"text/javascript\"> $output .= "<script language=\"javascript\" type=\"text/javascript\">
sunburst('#sunburst', $data, '$width', '$height'); sunburst('#sunburst', $data, '$width', '$height', '$tooltip');
</script>"; </script>";
if (!$return) { if (!$return) {

View File

@ -796,7 +796,7 @@ function treeMap(recipient, data, width, height) {
// The area (or angle, depending on implementation) of each arc corresponds to its value. // The area (or angle, depending on implementation) of each arc corresponds to its value.
// Sunburst design by John Stasko. Data courtesy Jeff Heer. // Sunburst design by John Stasko. Data courtesy Jeff Heer.
// http://bl.ocks.org/mbostock/4348373 // http://bl.ocks.org/mbostock/4348373
function sunburst(recipient, data, width, height) { function sunburst(recipient, data, width, height, tooltip = true) {
if (width === "auto") { if (width === "auto") {
width = $(recipient).innerWidth(); width = $(recipient).innerWidth();
} }
@ -858,11 +858,14 @@ function sunburst(recipient, data, width, height) {
}) })
.style("cursor", "pointer") .style("cursor", "pointer")
.on("click", click) .on("click", click)
.on("mouseover", over_user) .on("mouseover", tooltip === "1" ? over_user : "")
.on("mouseout", out_user) .on("mouseout", out_user)
.on("mousemove", move_tooltip); .on("mousemove", move_tooltip);
function computeTextRotation(d) { function computeTextRotation(d) {
if (d.type === "central_service") {
return 0;
}
var ang = ((x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI) * 180; var ang = ((x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI) * 180;
return ang > 90 ? 180 + ang : ang; return ang > 90 ? 180 + ang : ang;
} }
@ -882,9 +885,18 @@ function sunburst(recipient, data, width, height) {
return computeTextRotation(d) > 180 ? -40 : -30; return computeTextRotation(d) > 180 ? -40 : -30;
}) })
.attr("dx", "6") // margin .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) { .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; else return 0;
}) })
.text(function(d) { .text(function(d) {
@ -899,7 +911,11 @@ function sunburst(recipient, data, width, height) {
window.location.href = d.link; window.location.href = d.link;
} else { } else {
// fade out all text elements // 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 path
.transition() .transition()
@ -965,8 +981,8 @@ function sunburst(recipient, data, width, height) {
} }
function move_tooltip(d) { function move_tooltip(d) {
var x = d3.event.pageX + 10; var x = d3.event.pageX + 10 - $("#menu_full").width();
var y = d3.event.pageY + 10; var y = d3.event.pageY - 90;
$("#tooltip").css("left", x + "px"); $("#tooltip").css("left", x + "px");
$("#tooltip").css("top", y + "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);" + "-moz-box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" +
"box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" + "box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.75);" +
"left: " + "left: " +
x + 100 +
"px;" + "px;" +
"top: " + "top: " +
y + 100 +
"px;" "px;"
); );
} }

View File

@ -2027,3 +2027,33 @@ function inArray(needle, haystack) {
} }
return false; 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();
}
});
});
};

View File

@ -235,6 +235,10 @@ class ServiceMapWidget extends Widget
$values['showLegend'] = $decoder['showLegend']; $values['showLegend'] = $decoder['showLegend'];
} }
if (isset($decoder['sunburst']) === true) {
$values['sunburst'] = $decoder['sunburst'];
}
return $values; return $values;
} }
@ -296,19 +300,16 @@ class ServiceMapWidget extends Widget
], ],
]; ];
// TODO refactoriced services: Hidden legend. $inputs[] = [
/* 'label' => __('Enable sunburst'),
// Show legend.
$inputs[] = [
'label' => __('Show legend'),
'arguments' => [ 'arguments' => [
'name' => 'showLegend', 'type' => 'switch',
'id' => 'showLegend', 'name' => 'sunburst',
'type' => 'switch', 'class' => 'event-widget-input',
'value' => $values['showLegend'], 'value' => $values['sunburst'],
'return' => true,
], ],
]; ];
*/
return $inputs; return $inputs;
} }
@ -325,7 +326,9 @@ class ServiceMapWidget extends Widget
$values = parent::getPost(); $values = parent::getPost();
$values['serviceId'] = \get_parameter('serviceId', 0); $values['serviceId'] = \get_parameter('serviceId', 0);
// $values['showLegend'] = \get_parameter_switch('showLegend');
$values['sunburst'] = \get_parameter_switch('sunburst', 0);
return $values; return $values;
} }
@ -341,6 +344,7 @@ class ServiceMapWidget extends Widget
$size = parent::getSize(); $size = parent::getSize();
$output = '';
if (check_acl($config['id_user'], 0, 'AR') === 0) { if (check_acl($config['id_user'], 0, 'AR') === 0) {
$output .= '<div class="container-center">'; $output .= '<div class="container-center">';
$output .= \ui_print_error_message( $output .= \ui_print_error_message(
@ -367,42 +371,6 @@ class ServiceMapWidget extends Widget
$style = 'position: relative; text-align: center;'; $style = 'position: relative; text-align: center;';
$output .= "<div id='".$containerId."' style='".$style."'>"; $output .= "<div id='".$containerId."' style='".$style."'>";
// TODO refactoriced services: Hidden legend.
/*
if ($this->values['showLegend'] === 1) {
$output .= "<div id='container_servicemap_legend".$this->values['serviceId'].'_'.$this->cellId."'>";
$output .= '<table>';
$output .= "<tr class='legend_servicemap_title'><td colspan='3' style='padding-bottom: 10px; min-width: 177px;'><b>".__('Legend').'</b></td>';
$output .= "<td><img class='legend_servicemap_toggle' style='padding-bottom: 10px;' src='images/darrowup.png'></td></tr>";
$output .= "<tr class='legend_servicemap_item'><td>";
$output .= "<img src='images/service.png'>";
$output .= '</td><td>'.__('Services').'</td>';
// Coulour legend.
$output .= "<td rowspan='3'>";
$output .= '<table>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_CRITICAL.";'></div></td><td>".__('Critical').'</td></tr>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_WARNING.";'></div></td><td>".__('Warning').'</td></tr>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_NORMAL.";'></div></td><td>".__('Ok').'</td></tr>';
$output .= "<tr><td class='legend_square'><div style='background-color: ".COL_UNKNOWN.";'></div></td><td>".__('Unknown').'</td></tr>';
$output .= '</table>';
$output .= '</td></tr>';
$output .= "<tr class='legend_servicemap_item'><td>";
$output .= "<img src='images/agent.png'>";
$output .= '</td><td>'.__('Agents').'</td>';
$output .= '</tr>';
$output .= "<tr class='legend_servicemap_item'><td>";
$output .= "<img src='images/module.png'>";
$output .= '</td><td>'.__('Modules').'</td>';
$output .= '</tr>';
$output .= '</table>';
$output .= '</div>';
}
*/
// TODO: removed refactoriced services. Only 1 widget Zoom. // TODO: removed refactoriced services. Only 1 widget Zoom.
$sql = sprintf( $sql = sprintf(
'SELECT COUNT(*) 'SELECT COUNT(*)
@ -425,14 +393,21 @@ class ServiceMapWidget extends Widget
); );
// TODO:XXX fix draw service map. // TODO:XXX fix draw service map.
ob_start(); ob_start();
servicemap_print_servicemap(
$this->values['serviceId'], if ($this->values['sunburst'] === 0) {
false, servicemap_print_servicemap(
$size['width'], $this->values['serviceId'],
$size['height'], false,
$this->cellId, $size['width'],
$disableZoom $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 .= ob_get_clean();
$output .= '</div>'; $output .= '</div>';
return $output; return $output;

View File

@ -6048,9 +6048,9 @@ table.table_modal_alternate tr td:first-child {
font-family: "lato" !important; font-family: "lato" !important;
} }
.flot-text { .flot-text .flot-x-axis div {
width: 100%; white-space: normal;
font-family: inherit !important; word-break: break-all;
} }
/*Font header feedback*/ /*Font header feedback*/
@ -6226,6 +6226,9 @@ div.graph td.legendLabel {
div.graph div.legend div, div.graph div.legend div,
div.graph div.legend table { div.graph div.legend table {
top: 25px !important; top: 25px !important;
display: block;
overflow: auto;
text-align: left;
} }
.rotate_text_module { .rotate_text_module {

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.762'; $version = '7.0NG.762';
$build = '220602'; $build = '220603';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
* *
* ============================================================================ * ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list * Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -46,19 +46,19 @@ check_login();
enterprise_include_once('/include/class/CommandCenter.class.php'); enterprise_include_once('/include/class/CommandCenter.class.php');
$event_a = check_acl($config['id_user'], 0, 'ER'); $event_a = (bool) check_acl($config['id_user'], 0, 'ER');
$event_w = check_acl($config['id_user'], 0, 'EW'); $event_w = (bool) check_acl($config['id_user'], 0, 'EW');
$event_m = check_acl($config['id_user'], 0, 'EM'); $event_m = (bool) check_acl($config['id_user'], 0, 'EM');
if (! $event_a if ($event_a === false
&& ! $event_w && $event_w === false
&& ! $event_m && $event_m === false
) { ) {
db_pandora_audit( db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION, AUDIT_LOG_ACL_VIOLATION,
'Trying to access event viewer' 'Trying to access event viewer'
); );
if (is_ajax()) { if (is_ajax() === true) {
return ['error' => 'noaccess']; return ['error' => '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; $readonly = false;
if (is_metaconsole() === false if (is_metaconsole() === false
&& isset($config['event_replication']) && isset($config['event_replication']) === true
&& $config['event_replication'] == 1 && (int) $config['event_replication'] === 1
&& $config['show_events_in_local'] == 1 && (int) $config['show_events_in_local'] === 1
) { ) {
$readonly = true; $readonly = true;
} }
@ -100,7 +100,7 @@ $default_filter = [
]; ];
$fb64 = get_parameter('fb64', null); $fb64 = get_parameter('fb64', null);
if (isset($fb64)) { if (isset($fb64) === true) {
$filter = json_decode(base64_decode($fb64), true); $filter = json_decode(base64_decode($fb64), true);
$filter['tag_with'] = []; $filter['tag_with'] = [];
$filter['tag_without'] = []; $filter['tag_without'] = [];
@ -238,19 +238,21 @@ $custom_data = get_parameter(
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
// Connect to node database. // Connect to node database.
$id_node = $server_id; $id_node = (int) $server_id;
if ($id_node != 0) { if ($id_node !== 0) {
if (metaconsole_connect(null, $id_node) != NOERR) { if (metaconsole_connect(null, $id_node) !== NOERR) {
return false; 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); $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_module = modules_get_agentmodule_name($id_agent_module);
$text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module)); $text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module));
} }
@ -494,7 +496,7 @@ if ($load_filter_id === 0) {
// Do not load the user filter if we come from the 24h event graph. // 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'] ?? '')); $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']); $filter = events_get_event_filter($loaded_filter['id_filter']);
if ($filter !== false) { if ($filter !== false) {
$id_group = $filter['id_group']; $id_group = $filter['id_group'];
@ -1129,15 +1131,19 @@ $in = '<div class="filter_input"><label>'.__('Free search').'</label>';
$in .= $data.'</div>'; $in .= $data.'</div>';
$inputs[] = $in; $inputs[] = $in;
if (empty($severity) === true && $severity !== '0') { if (is_array($severity) === false) {
$severity = -1; if (empty($severity) === true && $severity !== '0') {
$severity = -1;
} else {
$severity = explode(',', $severity);
}
} }
// Criticity - severity. // Criticity - severity.
$data = html_print_select( $data = html_print_select(
get_priorities(), get_priorities(),
'severity', 'severity',
explode(',', $severity), $severity,
'', '',
__('All'), __('All'),
-1, -1,

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -2817,6 +2817,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`cascade_protection` TINYINT NOT NULL DEFAULT 0, `cascade_protection` TINYINT NOT NULL DEFAULT 0,
`evaluate_sla` INT NOT NULL DEFAULT 0, `evaluate_sla` INT NOT NULL DEFAULT 0,
`is_favourite` TINYINT NOT NULL DEFAULT 0, `is_favourite` TINYINT NOT NULL DEFAULT 0,
`enable_sunburst` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB ) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor' COMMENT = 'Table to define services to monitor'

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.762-220602 Version: 7.0NG.762-220603
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.762-220602" pandora_version="7.0NG.762-220603"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -68,10 +68,6 @@ dbhost 127.0.0.1
#dbport 3306 #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) # 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 # -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. # set to 1 or 3 on production enviroments.

View File

@ -68,10 +68,6 @@ dbhost 127.0.0.1
#dbport 3306 #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) # 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 # -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. # set to 1 or 3 on production enviroments.

View File

@ -79,10 +79,6 @@ dbssl 0
# dbsslcapath # 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) # 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 # -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. # set to 1 or 3 on production enviroments.
@ -434,6 +430,7 @@ sample_agent_interval 600
# Update parent from the agent xml # Update parent from the agent xml
update_parent 1 update_parent 1
# #
# #
# This enable realtime reverse geocoding using Google Maps public api. # This enable realtime reverse geocoding using Google Maps public api.

View File

@ -68,10 +68,6 @@ dbhost 192.168.55.1
#dbport 3306 #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) # 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 # -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. # set to 1 or 3 on production enviroments.

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.762"; my $pandora_version = "7.0NG.762";
my $pandora_build = "220602"; my $pandora_build = "220603";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.762"; my $pandora_version = "7.0NG.762";
my $pandora_build = "220602"; my $pandora_build = "220603";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.762 %define version 7.0NG.762
%define release 220602 %define release 220603
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.762" PI_VERSION="7.0NG.762"
PI_BUILD="220602" PI_BUILD="220603"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.762 Build 220602"; my $version = "7.0NG.762 Build 220603";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.762 Build 220602"; my $version = "7.0NG.762 Build 220603";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);