Merge remote-tracking branch 'origin/develop' into ent-9662-Restyling-fuentes-colores-botones
This commit is contained in:
commit
a5e6e569e8
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.769-230301
|
||||
Version: 7.0NG.769-230302
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.769-230301"
|
||||
pandora_version="7.0NG.769-230302"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1023,7 +1023,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.769';
|
||||
use constant AGENT_BUILD => '230301';
|
||||
use constant AGENT_BUILD => '230302';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_agent_linux
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.769"
|
||||
PI_BUILD="230301"
|
||||
PI_BUILD="230302"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{230301}
|
||||
{230302}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.769 Build 230301")
|
||||
#define PANDORA_VERSION ("7.0NG.769 Build 230302")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.769(Build 230301))"
|
||||
VALUE "ProductVersion", "(7.0NG.769(Build 230302))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.769-230301
|
||||
Version: 7.0NG.769-230302
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.769-230301"
|
||||
pandora_version="7.0NG.769-230302"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -281,7 +281,7 @@ switch ($action) {
|
|||
$server_name = $item['server_name'];
|
||||
|
||||
// Metaconsole db connection.
|
||||
if ($meta && empty($server_name) === false) {
|
||||
if ($meta && empty($server_name) === false && $server_name !== 'all') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
$server_id = $connection['id'];
|
||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||
|
@ -1233,6 +1233,29 @@ $class = 'databox filters';
|
|||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$servers_all_opt = array_merge(['all' => 'All nodes'], $servers);
|
||||
if ($meta) {
|
||||
?>
|
||||
<tr id="row_servers_all_opt" class="datos">
|
||||
<td class="bolder"><?php echo __('Server'); ?></td>
|
||||
<td >
|
||||
<?php
|
||||
html_print_select(
|
||||
$servers_all_opt,
|
||||
'combo_server',
|
||||
$server_name,
|
||||
'',
|
||||
$nothing,
|
||||
$nothing_value
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($meta) {
|
||||
?>
|
||||
|
@ -6338,6 +6361,7 @@ function chooseType() {
|
|||
$("#row_alert_templates").hide();
|
||||
$("#row_alert_actions").hide();
|
||||
$("#row_servers").hide();
|
||||
$("#row_servers_all_opt").hide();
|
||||
$("#row_multiple_servers").hide();
|
||||
$("#row_sort").hide();
|
||||
$("#row_date").hide();
|
||||
|
@ -6652,7 +6676,7 @@ function chooseType() {
|
|||
$("#row_header").show();
|
||||
$("#row_custom").show();
|
||||
$("#row_custom_example").show();
|
||||
$("#row_servers").show();
|
||||
$("#row_servers_all_opt").show();
|
||||
$("#row_historical_db_check").show();
|
||||
break;
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC230301';
|
||||
$build_version = 'PC230302';
|
||||
$pandora_version = 'v7.0NG.769';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -5838,3 +5838,58 @@ function get_events_get_response_target(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the count of events by criticity.
|
||||
*
|
||||
* @param integer $utimestamp Utimestamp to search.
|
||||
* @param integer $eventType Event type.
|
||||
* @param array $groupId Groups.
|
||||
* @param integer $eventStatus Event status.
|
||||
* @param array $criticityId Criticity to search.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_count_event_criticity(
|
||||
$utimestamp,
|
||||
$eventType,
|
||||
$groupId,
|
||||
$eventStatus,
|
||||
$criticityId
|
||||
) {
|
||||
$type = ' ';
|
||||
if ($eventType !== '0') {
|
||||
$type = 'AND event_type = "'.$eventType.'"';
|
||||
}
|
||||
|
||||
$groups = ' ';
|
||||
if ((int) $groupId !== 0) {
|
||||
$groups = 'AND id_grupo IN ('.$groupId.')';
|
||||
}
|
||||
|
||||
$status = ' ';
|
||||
if ((int) $eventStatus !== -1) {
|
||||
$status = 'AND estado = '.$eventStatus;
|
||||
}
|
||||
|
||||
$criticity = ' ';
|
||||
if (empty($criticityId) === false) {
|
||||
$criticity = 'AND criticity IN ('.$criticityId.')';
|
||||
}
|
||||
|
||||
$sql_meta = sprintf(
|
||||
'SELECT COUNT(id_evento) AS count,
|
||||
criticity
|
||||
FROM tevento
|
||||
WHERE utimestamp >= %d %s %s %s %s
|
||||
GROUP BY criticity',
|
||||
$utimestamp,
|
||||
$type,
|
||||
$groups,
|
||||
$status,
|
||||
$criticity
|
||||
);
|
||||
|
||||
return db_get_all_rows_sql($sql_meta);
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ define('REPORT_STATUS_IGNORED', 5);
|
|||
|
||||
// Clases.
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
|
||||
use PandoraFMS\Event;
|
||||
use PandoraFMS\Module;
|
||||
|
||||
|
@ -7421,6 +7422,14 @@ function reporting_text($report, $content)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build SQL report item.
|
||||
*
|
||||
* @param array $report Report info.
|
||||
* @param array $content Content info.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_sql($report, $content)
|
||||
{
|
||||
global $config;
|
||||
|
@ -7438,15 +7447,97 @@ function reporting_sql($report, $content)
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text();
|
||||
|
||||
if ($config['metaconsole'] && !empty($content['server_name'])) {
|
||||
$id_meta = metaconsole_get_id_server(
|
||||
if (is_metaconsole() === true
|
||||
&& empty($content['server_name']) === false
|
||||
&& $content['server_name'] !== 'all'
|
||||
) {
|
||||
$id_server = metaconsole_get_id_server(
|
||||
$content['server_name']
|
||||
);
|
||||
|
||||
$server = metaconsole_get_connection_by_id($id_meta);
|
||||
metaconsole_connect($server);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && $content['server_name'] === 'all') {
|
||||
$sync = new Synchronizer();
|
||||
$results = $sync->apply(
|
||||
function ($node) use ($report, $content) {
|
||||
try {
|
||||
$node->connect();
|
||||
$rs = reporting_sql_auxiliary($report, $content);
|
||||
$node->disconnect();
|
||||
} catch (Exception $e) {
|
||||
return [
|
||||
'error' => __(
|
||||
'Failed to connect to node %s',
|
||||
$node->server_name()
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
if ($rs === false) {
|
||||
return ['result' => []];
|
||||
}
|
||||
|
||||
return ['result' => $rs];
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
$data = [];
|
||||
$return['correct'] = 1;
|
||||
$return['error'] = '';
|
||||
|
||||
foreach ($results as $id_node => $items) {
|
||||
foreach ($items['result']['data'] as $key => $item) {
|
||||
$items['result']['data'][$key] = ['node_id' => $id_node] + $items['result']['data'][$key];
|
||||
}
|
||||
|
||||
if ((int) $items['result']['correct'] !== 1) {
|
||||
$return['correct'] = 0;
|
||||
}
|
||||
|
||||
if ($items['result']['error'] !== '') {
|
||||
$return['error'] = $items['result']['error'];
|
||||
}
|
||||
|
||||
$return['sql'] = $items['result']['sql'];
|
||||
|
||||
$data = array_merge($data, $items['result']['data']);
|
||||
}
|
||||
|
||||
$return['data'] = $data;
|
||||
} else {
|
||||
try {
|
||||
if (is_metaconsole() === true && $id_server > 0) {
|
||||
$node = new Node($id_server);
|
||||
$node->connect();
|
||||
}
|
||||
|
||||
$query_result = reporting_sql_auxiliary($report, $content);
|
||||
$return = array_merge($return, $query_result);
|
||||
|
||||
if (is_metaconsole() === true && $id_server > 0) {
|
||||
$node->disconnect();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if (is_metaconsole() === true && $id_server > 0) {
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Auxiliary function for reporting_sql.
|
||||
*
|
||||
* @param array $report Report info.
|
||||
* @param array $content Content info.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function reporting_sql_auxiliary($report, $content) {
|
||||
if ($content['treport_custom_sql_id'] != 0) {
|
||||
$sql = io_safe_output(
|
||||
db_get_value_filter(
|
||||
|
@ -7459,7 +7550,7 @@ function reporting_sql($report, $content)
|
|||
$sql = $content['external_source'];
|
||||
}
|
||||
|
||||
// Check if exist sql macro.
|
||||
// Check if SQL macro exists.
|
||||
$sql = reporting_sql_macro($report, $sql);
|
||||
|
||||
// Do a security check on SQL coming from the user.
|
||||
|
@ -7514,11 +7605,7 @@ function reporting_sql($report, $content)
|
|||
$return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.');
|
||||
}
|
||||
|
||||
if ($config['metaconsole'] && !empty($content['server_name'])) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -420,6 +420,7 @@ class Widget
|
|||
case 'ColorModuleTabs':
|
||||
case 'BlockHistogram':
|
||||
case 'DataMatrix':
|
||||
case 'EventCardboard':
|
||||
$className .= '\\'.$name;
|
||||
break;
|
||||
|
||||
|
|
|
@ -0,0 +1,664 @@
|
|||
<?php
|
||||
/**
|
||||
* Widget Event cardboard Pandora FMS Console
|
||||
*
|
||||
* @category Console Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Widget Event cardboard
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
namespace PandoraFMS\Dashboard;
|
||||
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||
|
||||
/**
|
||||
* Event cardboard Widgets.
|
||||
*/
|
||||
class EventCardboard extends Widget
|
||||
{
|
||||
|
||||
/**
|
||||
* Name widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Title widget.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Page widget;
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Class name widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* Values options for each widget.
|
||||
*
|
||||
* @var [type]
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Configuration required.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $configurationRequired;
|
||||
|
||||
/**
|
||||
* Error load widget.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $loadError;
|
||||
|
||||
/**
|
||||
* Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $width;
|
||||
|
||||
/**
|
||||
* Heigth.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $height;
|
||||
|
||||
/**
|
||||
* Grid Width.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $gridWidth;
|
||||
|
||||
/**
|
||||
* Cell ID.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $cellId;
|
||||
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param integer $cellId Cell ID.
|
||||
* @param integer $dashboardId Dashboard ID.
|
||||
* @param integer $widgetId Widget ID.
|
||||
* @param integer|null $width New width.
|
||||
* @param integer|null $height New height.
|
||||
* @param integer|null $gridWidth Grid width.
|
||||
*/
|
||||
public function __construct(
|
||||
int $cellId,
|
||||
int $dashboardId=0,
|
||||
int $widgetId=0,
|
||||
?int $width=0,
|
||||
?int $height=0,
|
||||
?int $gridWidth=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
include_once $config['homedir'].'/include/functions_modules.php';
|
||||
|
||||
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||
parent::__construct(
|
||||
$cellId,
|
||||
$dashboardId,
|
||||
$widgetId
|
||||
);
|
||||
|
||||
// Width.
|
||||
$this->width = $width;
|
||||
|
||||
// Height.
|
||||
$this->height = $height;
|
||||
|
||||
// Grid Width.
|
||||
$this->gridWidth = $gridWidth;
|
||||
|
||||
// Cell Id.
|
||||
$this->cellId = $cellId;
|
||||
|
||||
// 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 = __('Event cardboard');
|
||||
|
||||
// Name.
|
||||
if (empty($this->name) === true) {
|
||||
$this->name = 'EventCardboard';
|
||||
}
|
||||
|
||||
// This forces at least a first configuration.
|
||||
$this->configurationRequired = false;
|
||||
if (isset($this->values['groupId']) === false) {
|
||||
$this->configurationRequired = true;
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
if (isset($decoder['eventType']) === true) {
|
||||
$values['eventType'] = $decoder['eventType'];
|
||||
}
|
||||
|
||||
if (isset($decoder['maxHours']) === true) {
|
||||
$values['maxHours'] = $decoder['maxHours'];
|
||||
}
|
||||
|
||||
if (isset($decoder['eventStatus']) === true) {
|
||||
$values['eventStatus'] = $decoder['eventStatus'];
|
||||
}
|
||||
|
||||
if (isset($decoder['severity']) === true) {
|
||||
$values['severity'] = $decoder['severity'];
|
||||
}
|
||||
|
||||
if (isset($decoder['groupId']) === true) {
|
||||
$values['groupId'] = $decoder['groupId'];
|
||||
}
|
||||
|
||||
if (isset($decoder['nodes']) === true) {
|
||||
$values['nodes'] = $decoder['nodes'];
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates inputs for form (specific).
|
||||
*
|
||||
* @return array Of inputs.
|
||||
*
|
||||
* @throws Exception On error.
|
||||
*/
|
||||
public function getFormInputs(): array
|
||||
{
|
||||
$values = $this->values;
|
||||
|
||||
// Retrieve global - common inputs.
|
||||
$inputs = parent::getFormInputs();
|
||||
|
||||
// Remove background field, this widget doesn't use it.
|
||||
foreach ($inputs as $kIn => $vIn) {
|
||||
if ($vIn['label'] === 'Background') {
|
||||
unset($inputs[$kIn]);
|
||||
}
|
||||
}
|
||||
|
||||
$blocks = [
|
||||
'row1',
|
||||
'row2',
|
||||
];
|
||||
|
||||
$inputs['blocks'] = $blocks;
|
||||
|
||||
foreach ($inputs as $kInput => $vInput) {
|
||||
$inputs['inputs']['row1'][] = $vInput;
|
||||
}
|
||||
|
||||
// Event Type.
|
||||
$fields = get_event_types();
|
||||
$fields['not_normal'] = __('Not normal');
|
||||
|
||||
$inputs['inputs']['row1'][] = [
|
||||
'label' => __('Event type'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'class' => 'event-widget-input',
|
||||
'name' => 'eventType',
|
||||
'selected' => $values['eventType'],
|
||||
'return' => true,
|
||||
'nothing' => __('Any'),
|
||||
'nothing_value' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
// Max. hours old. Default 8.
|
||||
if (isset($values['maxHours']) === false) {
|
||||
$values['maxHours'] = 8;
|
||||
}
|
||||
|
||||
$inputs['inputs']['row1'][] = [
|
||||
'label' => __('Max. hours old'),
|
||||
'arguments' => [
|
||||
'name' => 'maxHours',
|
||||
'type' => 'number',
|
||||
'class' => 'event-widget-input',
|
||||
'value' => $values['maxHours'],
|
||||
'return' => true,
|
||||
'min' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
// Event status.
|
||||
$fields = [
|
||||
-1 => __('All event'),
|
||||
1 => __('Only validated'),
|
||||
0 => __('Only pending'),
|
||||
];
|
||||
|
||||
$inputs['inputs']['row1'][] = [
|
||||
'label' => __('Event status'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'class' => 'event-widget-input',
|
||||
'name' => 'eventStatus',
|
||||
'selected' => $values['eventStatus'],
|
||||
'return' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Groups.
|
||||
$return_all_group = false;
|
||||
$selected_groups_array = explode(',', $values['groupId'][0]);
|
||||
|
||||
if (empty($values['groupId'][0]) === true) {
|
||||
$selected_groups_array = [0];
|
||||
}
|
||||
|
||||
if ((bool) \users_can_manage_group_all('RM') === true
|
||||
|| ($selected_groups_array[0] !== ''
|
||||
&& in_array(0, $selected_groups_array) === true)
|
||||
) {
|
||||
// Return all group if user has permissions or it is a currently
|
||||
// selected group.
|
||||
$return_all_group = true;
|
||||
}
|
||||
|
||||
$inputs['inputs']['row1'][] = [
|
||||
'label' => __('Groups'),
|
||||
'arguments' => [
|
||||
'type' => 'select_groups',
|
||||
'name' => 'groupId[]',
|
||||
'class' => 'event-widget-input',
|
||||
'returnAllGroup' => true,
|
||||
'privilege' => 'AR',
|
||||
'selected' => $selected_groups_array,
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'returnAllGroup' => $return_all_group,
|
||||
'required' => true,
|
||||
],
|
||||
];
|
||||
|
||||
// Nodes.
|
||||
if (is_metaconsole() === true) {
|
||||
$nodes_fields = [];
|
||||
$servers_ids = metaconsole_get_servers();
|
||||
|
||||
foreach ($servers_ids as $server) {
|
||||
$nodes_fields[$server['id']] = $server['server_name'];
|
||||
}
|
||||
|
||||
$nodes_fields[0] = __('Metaconsola');
|
||||
|
||||
$nodes_selected = explode(',', $values['nodes']);
|
||||
|
||||
(isset($values['nodes']) === false) ? $nodes_selected = $servers_ids : '';
|
||||
|
||||
$nodes_height = count($nodes_fields);
|
||||
if (count($nodes_fields) > 5) {
|
||||
$nodes_height = 5;
|
||||
}
|
||||
|
||||
$inputs['inputs']['row2'][] = [
|
||||
'label' => __('Servers'),
|
||||
'arguments' => [
|
||||
'name' => 'nodes',
|
||||
'type' => 'select',
|
||||
'fields' => $nodes_fields,
|
||||
'selected' => $nodes_selected,
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
'class' => 'overflow-hidden',
|
||||
'size' => $nodes_height,
|
||||
'select_all' => false,
|
||||
'required' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
// Severity.
|
||||
$fields = get_priorities();
|
||||
|
||||
$severity_selected = explode(',', $values['severity']);
|
||||
|
||||
if (isset($values['severity']) === false) {
|
||||
$severity_selected = array_keys($fields);
|
||||
}
|
||||
|
||||
$inputs['inputs']['row2'][] = [
|
||||
'label' => __('Severity'),
|
||||
'arguments' => [
|
||||
'type' => 'select',
|
||||
'fields' => $fields,
|
||||
'class' => 'event-widget-input',
|
||||
'name' => 'severity',
|
||||
'selected' => $severity_selected,
|
||||
'return' => true,
|
||||
'multiple' => true,
|
||||
],
|
||||
];
|
||||
|
||||
return $inputs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Post for widget.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPost():array
|
||||
{
|
||||
// Retrieve global - common inputs.
|
||||
$values = parent::getPost();
|
||||
|
||||
$values['eventType'] = \get_parameter('eventType', 0);
|
||||
$values['maxHours'] = \get_parameter('maxHours', 8);
|
||||
$values['eventStatus'] = \get_parameter('eventStatus', -1);
|
||||
$values['groupId'] = \get_parameter('groupId', []);
|
||||
$values['severity'] = \get_parameter('severity', -1);
|
||||
$values['nodes'] = \get_parameter('nodes', 0);
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw widget.
|
||||
*
|
||||
* @return string;
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
$output = '';
|
||||
|
||||
ui_require_css_file('events', 'include/styles/', true);
|
||||
ui_require_javascript_file('pandora_events', 'include/javascript/', true);
|
||||
|
||||
$eventType = $this->values['eventType'];
|
||||
$groupId = implode(',', $this->values['groupId']);
|
||||
$utimestamp = strtotime('-'.$this->values['maxHours'].' hours');
|
||||
$eventStatus = $this->values['eventStatus'];
|
||||
$severity = $this->values['severity'];
|
||||
|
||||
$priorities = explode(',', $severity);
|
||||
// Sort criticity array.
|
||||
asort($priorities);
|
||||
|
||||
$count_meta = [];
|
||||
$count_meta_tmp = [];
|
||||
if (is_metaconsole() === true) {
|
||||
$meta = false;
|
||||
$nodes = $this->values['nodes'];
|
||||
|
||||
if (isset($nodes) === true) {
|
||||
$servers_ids = explode(',', $nodes);
|
||||
}
|
||||
|
||||
if (in_array(0, $servers_ids) === true) {
|
||||
$meta = true;
|
||||
unset($servers_ids[0]);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === true && $meta === true) {
|
||||
$events_meta_rows = get_count_event_criticity(
|
||||
$utimestamp,
|
||||
$eventType,
|
||||
$groupId,
|
||||
$eventStatus,
|
||||
$severity
|
||||
);
|
||||
|
||||
array_push($count_meta_tmp, $events_meta_rows);
|
||||
}
|
||||
|
||||
foreach ($servers_ids as $server_id) {
|
||||
try {
|
||||
$node = new Node((int) $server_id);
|
||||
$node->connect();
|
||||
|
||||
$events_meta_rows = get_count_event_criticity(
|
||||
$utimestamp,
|
||||
$eventType,
|
||||
$groupId,
|
||||
$eventStatus,
|
||||
$severity
|
||||
);
|
||||
|
||||
array_push($count_meta_tmp, $events_meta_rows);
|
||||
$node->disconnect();
|
||||
} catch (\Exception $e) {
|
||||
// Unexistent envents.
|
||||
$node->disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($count_meta_tmp as $tmpValue) {
|
||||
foreach ($tmpValue as $value) {
|
||||
array_push($count_meta, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$events_rows = [];
|
||||
foreach ($priorities as $pKey) {
|
||||
$count = 0;
|
||||
$tmp['criticity'] = $pKey;
|
||||
foreach ($count_meta as $kEventMeta => $vEventMeta) {
|
||||
if ((int) $pKey === (int) $vEventMeta['criticity']) {
|
||||
$count += (int) $vEventMeta['count'];
|
||||
}
|
||||
}
|
||||
|
||||
$tmp['count'] = $count;
|
||||
array_push($events_rows, $tmp);
|
||||
}
|
||||
} else {
|
||||
$events_rows = get_count_event_criticity(
|
||||
$utimestamp,
|
||||
$eventType,
|
||||
$groupId,
|
||||
$eventStatus,
|
||||
$severity
|
||||
);
|
||||
}
|
||||
|
||||
$output .= '<table class="w100p h100p table-border-0"><tbody><tr>';
|
||||
|
||||
$width_td = (100 / count(explode(',', $severity)));
|
||||
|
||||
$td_count = 0;
|
||||
foreach ($priorities as $key) {
|
||||
$count = 0;
|
||||
foreach ($events_rows as $event) {
|
||||
if ((int) $key === (int) $event['criticity']) {
|
||||
$count = $event['count'];
|
||||
}
|
||||
}
|
||||
|
||||
switch ((int) $key) {
|
||||
case 0:
|
||||
$text = __('Maintenance');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$text = __('Informational');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$text = __('Normal');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$text = __('Warning');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$text = __('Critical');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$text = __('Minor');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$text = __('Major');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 20:
|
||||
$text = __('Not normal');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 21:
|
||||
$text = __('Critical').'/'.__('Normal');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
case 34:
|
||||
$text = __('Warning').'/'.__('Critical');
|
||||
$color = get_priority_class((int) $key);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
$border = '';
|
||||
$td_count++;
|
||||
if (count($priorities) > $td_count) {
|
||||
$border = ' border-right: 1px solid white; border-collapse: collapse;';
|
||||
}
|
||||
|
||||
$output .= '<td class="'.$color.'" style="width: '.$width_td.'%;'.$border.'"><span class="med_data">';
|
||||
$output .= $count;
|
||||
$output .= '</span><br>';
|
||||
$output .= $text;
|
||||
$output .= '</td>';
|
||||
}
|
||||
|
||||
$output .= '</tr></tbody></table>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get description.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return __('Event cardboard');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Name.
|
||||
*
|
||||
* @return string.
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'EventCardboard';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get size Modal Configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSizeModalConfiguration(): array
|
||||
{
|
||||
if (is_metaconsole() === true) {
|
||||
$size = [
|
||||
'width' => 950,
|
||||
'height' => 450,
|
||||
];
|
||||
} else {
|
||||
$size = [
|
||||
'width' => 900,
|
||||
'height' => 450,
|
||||
];
|
||||
}
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -29,3 +29,18 @@ li#select_multiple_modules_filtered {
|
|||
#menu_tab li.nomn form#form-select-dashboard {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.table-border-0 {
|
||||
border: none !important;
|
||||
border-spacing: 0px !important;
|
||||
}
|
||||
|
||||
.big_data {
|
||||
text-decoration: none;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.med_data {
|
||||
text-decoration: none;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<div style='padding-bottom: 50px'>
|
||||
<?php
|
||||
$version = '7.0NG.769';
|
||||
$build = '230301';
|
||||
$build = '230302';
|
||||
$banner = "v$version Build $build";
|
||||
error_reporting(0);
|
||||
|
||||
|
|
|
@ -359,7 +359,7 @@ if (is_ajax() === true) {
|
|||
'te.warning_instructions',
|
||||
'te.unknown_instructions',
|
||||
'te.owner_user',
|
||||
'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp',
|
||||
'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp',
|
||||
'te.custom_data',
|
||||
'te.data',
|
||||
'te.module_status',
|
||||
|
@ -389,7 +389,7 @@ if (is_ajax() === true) {
|
|||
$order['field'] = 'agent_name';
|
||||
break;
|
||||
|
||||
case 'if(te.ack_utimestamp > 0, from_unixtime(te.ack_utimestamp),"") as ack_utimestamp':
|
||||
case 'if(te.ack_utimestamp > 0, te.ack_utimestamp,"") as ack_utimestamp':
|
||||
$order['field'] = 'ack_utimestamp';
|
||||
break;
|
||||
|
||||
|
@ -530,14 +530,14 @@ if (is_ajax() === true) {
|
|||
|
||||
$tmp->agent_name = io_safe_output($tmp->agent_name);
|
||||
|
||||
$tmp->ack_utimestamp_raw = strtotime($tmp->ack_utimestamp);
|
||||
$tmp->ack_utimestamp_raw = $tmp->ack_utimestamp;
|
||||
|
||||
$tmp->ack_utimestamp = ui_print_timestamp(
|
||||
(empty($tmp->ack_utimestamp) === true) ? 0 : $tmp->ack_utimestamp,
|
||||
true
|
||||
);
|
||||
$tmp->timestamp = ui_print_timestamp(
|
||||
$tmp->timestamp,
|
||||
$tmp->utimestamp,
|
||||
true
|
||||
);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.769-230301
|
||||
Version: 7.0NG.769-230302
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.769-230301"
|
||||
pandora_version="7.0NG.769-230302"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -46,7 +46,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.769";
|
||||
my $pandora_build = "230301";
|
||||
my $pandora_build = "230302";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.769";
|
||||
my $pandora_build = "230301";
|
||||
my $pandora_build = "230302";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -118,12 +118,12 @@ sub check_lib_version {
|
|||
|
||||
$plugin_version = "0NG.0" if empty($plugin_version);
|
||||
|
||||
my ($main,$oum) = split /NG./, $plugin_version;
|
||||
my ($main,$oum) = ($plugin_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/);
|
||||
|
||||
$main = 0 if empty($main) || !looks_like_number($main);
|
||||
$oum = 0 if empty($oum) || !looks_like_number($oum);
|
||||
|
||||
my ($libmain,$liboum) = split /NG./, $pandora_version;
|
||||
my ($libmain,$liboum) = ($pandora_version =~ m/(\d*\.?\d+)NG\.(\d*\.?\d+)/);
|
||||
|
||||
if (($liboum < $oum)
|
||||
|| ($libmain != $main)) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
%global __os_install_post %{nil}
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.769
|
||||
%define release 230301
|
||||
%define release 230302
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.769"
|
||||
PI_BUILD="230301"
|
||||
PI_BUILD="230302"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.769 Build 230301";
|
||||
my $version = "7.0NG.769 Build 230302";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.769 Build 230301";
|
||||
my $version = "7.0NG.769 Build 230302";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue