mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Merge branch 'ent-9229-revisar-comportamiento-de-widgets-con-elementos-eliminados' into 'develop'
fixed widget dashboards no exist item pandora_enterprise#9229 pandora_enterprise#9229 See merge request artica/pandorafms!5035
This commit is contained in:
commit
3ec710a62f
@ -86,7 +86,8 @@ function groupview_get_modules_counters($groups_ids=false)
|
|||||||
WHERE tasg.id_group IN ($groups_ids)
|
WHERE tasg.id_group IN ($groups_ids)
|
||||||
GROUP BY tasg.id_group
|
GROUP BY tasg.id_group
|
||||||
) x GROUP BY g";
|
) x GROUP BY g";
|
||||||
return db_get_all_rows_sql($sql);
|
$data = db_get_all_rows_sql($sql);
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11537,7 +11537,7 @@ function reporting_get_group_stats_resume($id_group=0, $access='AR', $ignore_per
|
|||||||
$data['status'] = 'critical';
|
$data['status'] = 'critical';
|
||||||
} else if ($data['monitor_warning'] > 0) {
|
} else if ($data['monitor_warning'] > 0) {
|
||||||
$data['status'] = 'warning';
|
$data['status'] = 'warning';
|
||||||
} else if (($data['monitor_unknown'] > 0) || ($data['agents_unknown'] > 0)) {
|
} else if (($data['monitor_unknown'] > 0) || ($data['agent_unknown'] > 0)) {
|
||||||
$data['status'] = 'unknown';
|
$data['status'] = 'unknown';
|
||||||
} else if ($data['monitor_ok'] > 0) {
|
} else if ($data['monitor_ok'] > 0) {
|
||||||
$data['status'] = 'ok';
|
$data['status'] = 'ok';
|
||||||
|
@ -3788,6 +3788,7 @@ function visual_map_get_user_layouts(
|
|||||||
unset($filter['can_manage_group_all']);
|
unset($filter['can_manage_group_all']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$where = '';
|
||||||
if ($check_user_groups === true && !empty($groups)) {
|
if ($check_user_groups === true && !empty($groups)) {
|
||||||
if (empty($where)) {
|
if (empty($where)) {
|
||||||
$where = '';
|
$where = '';
|
||||||
@ -4080,7 +4081,7 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
|
|||||||
// When the status calculation type is 'default', only one critical
|
// When the status calculation type is 'default', only one critical
|
||||||
// element is required to set the layout status as critical, so we can
|
// element is required to set the layout status as critical, so we can
|
||||||
// return the critical status right now.
|
// return the critical status right now.
|
||||||
if ($status_data['linked_layout_status_type'] === 'default'
|
if ((isset($status_data['linked_layout_status_type']) === true && $status_data['linked_layout_status_type'] === 'default')
|
||||||
&& ($status == VISUAL_MAP_STATUS_CRITICAL_BAD
|
&& ($status == VISUAL_MAP_STATUS_CRITICAL_BAD
|
||||||
|| $status == VISUAL_MAP_STATUS_CRITICAL_ALERT)
|
|| $status == VISUAL_MAP_STATUS_CRITICAL_ALERT)
|
||||||
) {
|
) {
|
||||||
@ -4104,71 +4105,73 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
|
|||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status calculation.
|
if (isset($status_data['linked_layout_status_type']) === true) {
|
||||||
switch ($status_data['linked_layout_status_type']) {
|
// Status calculation.
|
||||||
default:
|
switch ($status_data['linked_layout_status_type']) {
|
||||||
case 'default':
|
default:
|
||||||
$num_items_critical_alert = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
|
case 'default':
|
||||||
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD];
|
$num_items_critical_alert = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
|
||||||
$num_items_warning_alert = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING_ALERT];
|
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD];
|
||||||
$num_items_warning = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING];
|
$num_items_warning_alert = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING_ALERT];
|
||||||
$num_items_unknown = $num_elements_by_status[VISUAL_MAP_STATUS_UNKNOWN];
|
$num_items_warning = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING];
|
||||||
|
$num_items_unknown = $num_elements_by_status[VISUAL_MAP_STATUS_UNKNOWN];
|
||||||
|
|
||||||
if ($num_items_critical_alert > 0) {
|
if ($num_items_critical_alert > 0) {
|
||||||
return VISUAL_MAP_STATUS_CRITICAL_ALERT;
|
return VISUAL_MAP_STATUS_CRITICAL_ALERT;
|
||||||
} else if ($num_items_critical > 0) {
|
} else if ($num_items_critical > 0) {
|
||||||
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||||
} else if ($num_items_warning_alert > 0) {
|
} else if ($num_items_warning_alert > 0) {
|
||||||
return VISUAL_MAP_STATUS_WARNING_ALERT;
|
return VISUAL_MAP_STATUS_WARNING_ALERT;
|
||||||
} else if ($num_items_warning > 0) {
|
} else if ($num_items_warning > 0) {
|
||||||
return VISUAL_MAP_STATUS_WARNING;
|
return VISUAL_MAP_STATUS_WARNING;
|
||||||
} else if ($num_items_unknown > 0) {
|
} else if ($num_items_unknown > 0) {
|
||||||
return VISUAL_MAP_STATUS_UNKNOWN;
|
return VISUAL_MAP_STATUS_UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
return VISUAL_MAP_STATUS_NORMAL;
|
return VISUAL_MAP_STATUS_NORMAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'weight':
|
case 'weight':
|
||||||
$weight = $status_data['id_layout_linked_weight'];
|
$weight = $status_data['id_layout_linked_weight'];
|
||||||
$num_items = count($valid_layout_items);
|
$num_items = count($valid_layout_items);
|
||||||
$num_items_critical_alert = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
|
$num_items_critical_alert = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT];
|
||||||
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD];
|
$num_items_critical = $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD];
|
||||||
$num_items_warning_alert = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING_ALERT];
|
$num_items_warning_alert = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING_ALERT];
|
||||||
$num_items_warning = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING];
|
$num_items_warning = $num_elements_by_status[VISUAL_MAP_STATUS_WARNING];
|
||||||
$num_items_unknown = $num_elements_by_status[VISUAL_MAP_STATUS_UNKNOWN];
|
$num_items_unknown = $num_elements_by_status[VISUAL_MAP_STATUS_UNKNOWN];
|
||||||
|
|
||||||
if (($num_items_critical > 0 || $num_items_critical_alert > 0)
|
if (($num_items_critical > 0 || $num_items_critical_alert > 0)
|
||||||
&& ((($num_items_critical_alert + $num_items_critical) * 100) / $num_items) >= $weight
|
&& ((($num_items_critical_alert + $num_items_critical) * 100) / $num_items) >= $weight
|
||||||
) {
|
) {
|
||||||
return ($num_items_critical_alert > 0) ? VISUAL_MAP_STATUS_CRITICAL_ALERT : VISUAL_MAP_STATUS_CRITICAL_BAD;
|
return ($num_items_critical_alert > 0) ? VISUAL_MAP_STATUS_CRITICAL_ALERT : VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||||
} else if (($num_items_warning > 0 || $num_items_warning_alert > 0)
|
} else if (($num_items_warning > 0 || $num_items_warning_alert > 0)
|
||||||
&& (($num_items_warning_alert + $num_items_warning * 100) / $num_items) >= $weight
|
&& (($num_items_warning_alert + $num_items_warning * 100) / $num_items) >= $weight
|
||||||
) {
|
) {
|
||||||
return ($num_items_warning_alert > 0) ? VISUAL_MAP_STATUS_WARNING_ALERT : VISUAL_MAP_STATUS_WARNING;
|
return ($num_items_warning_alert > 0) ? VISUAL_MAP_STATUS_WARNING_ALERT : VISUAL_MAP_STATUS_WARNING;
|
||||||
} else if ($num_items_unknown > 0
|
} else if ($num_items_unknown > 0
|
||||||
&& (($num_items_unknown * 100) / $num_items) >= $weight
|
&& (($num_items_unknown * 100) / $num_items) >= $weight
|
||||||
) {
|
) {
|
||||||
return VISUAL_MAP_STATUS_UNKNOWN;
|
return VISUAL_MAP_STATUS_UNKNOWN;
|
||||||
} else {
|
} else {
|
||||||
return VISUAL_MAP_STATUS_NORMAL;
|
return VISUAL_MAP_STATUS_NORMAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'service':
|
case 'service':
|
||||||
$num_items_critical = ($num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD] + $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT]);
|
$num_items_critical = ($num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_BAD] + $num_elements_by_status[VISUAL_MAP_STATUS_CRITICAL_ALERT]);
|
||||||
$critical_percentage = (($num_items_critical * 100) / count($valid_layout_items));
|
$critical_percentage = (($num_items_critical * 100) / count($valid_layout_items));
|
||||||
|
|
||||||
$num_items_warning = ($num_elements_by_status[VISUAL_MAP_STATUS_WARNING] + $num_elements_by_status[VISUAL_MAP_STATUS_WARNING_ALERT]);
|
$num_items_warning = ($num_elements_by_status[VISUAL_MAP_STATUS_WARNING] + $num_elements_by_status[VISUAL_MAP_STATUS_WARNING_ALERT]);
|
||||||
$warning_percentage = (($num_items_warning * 100) / count($valid_layout_items));
|
$warning_percentage = (($num_items_warning * 100) / count($valid_layout_items));
|
||||||
|
|
||||||
if ($critical_percentage >= $status_data['linked_layout_status_as_service_critical'] && $critical_percentage !== 0) {
|
if ($critical_percentage >= $status_data['linked_layout_status_as_service_critical'] && $critical_percentage !== 0) {
|
||||||
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
return VISUAL_MAP_STATUS_CRITICAL_BAD;
|
||||||
} else if ($warning_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) {
|
} else if ($warning_percentage >= $status_data['linked_layout_status_as_service_warning'] && $warning_percentage !== 0) {
|
||||||
return VISUAL_MAP_STATUS_WARNING;
|
return VISUAL_MAP_STATUS_WARNING;
|
||||||
} else {
|
} else {
|
||||||
return VISUAL_MAP_STATUS_NORMAL;
|
return VISUAL_MAP_STATUS_NORMAL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,8 +526,7 @@ function print_clock_analogic_1(
|
|||||||
$color,
|
$color,
|
||||||
$title=true
|
$title=true
|
||||||
) {
|
) {
|
||||||
global $config;
|
$output = '<style type="text/css">
|
||||||
$output .= '<style type="text/css">
|
|
||||||
#rim {
|
#rim {
|
||||||
fill: none;
|
fill: none;
|
||||||
stroke: #999;
|
stroke: #999;
|
||||||
|
@ -387,17 +387,17 @@ class BlockHistogram extends Widget
|
|||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
if (is_metaconsole() === true) {
|
||||||
$modules_nodes = array_reduce(
|
$modules_nodes = array_reduce(
|
||||||
$this->values['moduleBlockHistogram'],
|
$this->values['moduleBlockHistogram'],
|
||||||
function ($carry, $item) {
|
function ($carry, $item) {
|
||||||
$explode = explode('|', $item);
|
$explode = explode('|', $item);
|
||||||
$carry[$explode[0]][] = $explode[1];
|
$carry[$explode[0]][] = $explode[1];
|
||||||
return $carry;
|
return $carry;
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
$modules = [];
|
$modules = [];
|
||||||
foreach ($modules_nodes as $n => $mod) {
|
foreach ($modules_nodes as $n => $mod) {
|
||||||
try {
|
try {
|
||||||
$node = new Node((int) $n);
|
$node = new Node((int) $n);
|
||||||
@ -475,7 +475,8 @@ class BlockHistogram extends Widget
|
|||||||
private function getInfoModules(array $modules): array
|
private function getInfoModules(array $modules): array
|
||||||
{
|
{
|
||||||
$where = sprintf(
|
$where = sprintf(
|
||||||
'tagente_modulo.id_agente_modulo IN (%s)',
|
'tagente_modulo.id_agente_modulo IN (%s)
|
||||||
|
AND tagente_modulo.delete_pending = 0',
|
||||||
implode(',', $modules)
|
implode(',', $modules)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -426,7 +426,8 @@ class ColorModuleTabs extends Widget
|
|||||||
private function getInfoModules(array $modules): array
|
private function getInfoModules(array $modules): array
|
||||||
{
|
{
|
||||||
$where = sprintf(
|
$where = sprintf(
|
||||||
'tagente_modulo.id_agente_modulo IN (%s)',
|
'tagente_modulo.id_agente_modulo IN (%s)
|
||||||
|
AND tagente_modulo.delete_pending = 0',
|
||||||
implode(',', $modules)
|
implode(',', $modules)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -170,6 +170,17 @@ class AlertsFiredWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (isset($this->values['groupId']) === false) {
|
if (isset($this->values['groupId']) === false) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
$check_exist = \db_get_value(
|
||||||
|
'id_grupo',
|
||||||
|
'tgrupo',
|
||||||
|
'id_grupo',
|
||||||
|
$this->values['groupId']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom graph Widgets
|
* Custom graph Widgets
|
||||||
*/
|
*/
|
||||||
@ -178,6 +180,41 @@ class CustomGraphWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['id_graph']) === true) {
|
if (empty($this->values['id_graph']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['node']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = \db_get_value(
|
||||||
|
'name',
|
||||||
|
'tgraph',
|
||||||
|
'id_graph',
|
||||||
|
$this->values['id_graph']
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -553,6 +553,18 @@ class EventsListWidget extends Widget
|
|||||||
);
|
);
|
||||||
$filter['module_search'] = $name[0]['nombre'];
|
$filter['module_search'] = $name[0]['nombre'];
|
||||||
}
|
}
|
||||||
|
} else if (empty($this->values['customFilter']) === false
|
||||||
|
&& (int) $this->values['customFilter'] !== -1
|
||||||
|
) {
|
||||||
|
$output = '<div class="container-center">';
|
||||||
|
$output .= \ui_print_error_message(
|
||||||
|
__('Widget cannot be loaded').'. '.__('Please, event filter has been removed.'),
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
echo $output;
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Filtering.
|
// Filtering.
|
||||||
$filter['event_view_hr'] = $this->values['maxHours'];
|
$filter['event_view_hr'] = $this->values['maxHours'];
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,6 +185,44 @@ class GraphModuleHistogramWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -304,7 +344,6 @@ class GraphModuleHistogramWidget extends Widget
|
|||||||
'label' => __('Module'),
|
'label' => __('Module'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'autocomplete_module',
|
'type' => 'autocomplete_module',
|
||||||
'fields' => $fields,
|
|
||||||
'name' => 'moduleId',
|
'name' => 'moduleId',
|
||||||
'selected' => $values['moduleId'],
|
'selected' => $values['moduleId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
@ -312,7 +351,9 @@ class GraphModuleHistogramWidget extends Widget
|
|||||||
'agent_id' => $values['agentId'],
|
'agent_id' => $values['agentId'],
|
||||||
'metaconsole_id' => $values['metaconsoleId'],
|
'metaconsole_id' => $values['metaconsoleId'],
|
||||||
'style' => 'width: inherit;',
|
'style' => 'width: inherit;',
|
||||||
'filter_modules' => users_access_to_agent($values['agentId']) === false ? [$values['moduleId']] : [],
|
'filter_modules' => (users_access_to_agent($values['agentId']) === false) ? [$values['moduleId']] : [],
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -166,6 +166,17 @@ class GroupsStatusWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['groupId']) === true) {
|
if (empty($this->values['groupId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
$check_exist = \db_get_value(
|
||||||
|
'id_grupo',
|
||||||
|
'tgrupo',
|
||||||
|
'id_grupo',
|
||||||
|
$this->values['groupId']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -520,7 +531,7 @@ class GroupsStatusWidget extends Widget
|
|||||||
{
|
{
|
||||||
$size = [
|
$size = [
|
||||||
'width' => 400,
|
'width' => 400,
|
||||||
'height' => 270,
|
'height' => 330,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $size;
|
return $size;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
// Load Visual Console.
|
// Load Visual Console.
|
||||||
use Models\VisualConsole\Container as VisualConsole;
|
use Models\VisualConsole\Container as VisualConsole;
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
use PandoraFMS\User;
|
use PandoraFMS\User;
|
||||||
/**
|
/**
|
||||||
* Maps by users Widgets.
|
* Maps by users Widgets.
|
||||||
@ -183,12 +184,36 @@ class MapsMadeByUser extends Widget
|
|||||||
if (empty($this->values['vcId']) === true) {
|
if (empty($this->values['vcId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
} else {
|
} else {
|
||||||
$check_exist = db_get_value(
|
try {
|
||||||
'id',
|
if (is_metaconsole() === true
|
||||||
'tlayout',
|
&& $this->values['node'] > 0
|
||||||
'id',
|
) {
|
||||||
$this->values['vcId']
|
$node = new Node($this->values['node']);
|
||||||
);
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_value(
|
||||||
|
'id',
|
||||||
|
'tlayout',
|
||||||
|
'id',
|
||||||
|
$this->values['vcId']
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($check_exist === false) {
|
if ($check_exist === false) {
|
||||||
$this->loadError = true;
|
$this->loadError = true;
|
||||||
@ -334,12 +359,14 @@ class MapsMadeByUser extends Widget
|
|||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'label' => __('Visual console'),
|
'label' => __('Visual console'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'id' => 'vcId',
|
'id' => 'vcId',
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'fields' => $fields,
|
'fields' => $fields,
|
||||||
'name' => 'vcId',
|
'name' => 'vcId',
|
||||||
'selected' => $values['vcId'],
|
'selected' => $values['vcId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -320,6 +320,17 @@ class MapsStatusWidget extends Widget
|
|||||||
$output = '';
|
$output = '';
|
||||||
if (isset($maps) === true && empty($maps) === false) {
|
if (isset($maps) === true && empty($maps) === false) {
|
||||||
foreach ($maps as $id_layout) {
|
foreach ($maps as $id_layout) {
|
||||||
|
$check_exist = db_get_value(
|
||||||
|
'id',
|
||||||
|
'tlayout',
|
||||||
|
'id',
|
||||||
|
$id_layout
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
$url = $config['homeurl'];
|
$url = $config['homeurl'];
|
||||||
@ -366,12 +377,22 @@ class MapsStatusWidget extends Widget
|
|||||||
array_push($table->data, $data);
|
array_push($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 31 px for each map.
|
if (empty($table->data) === false) {
|
||||||
$minHeight = (count($maps) * 31);
|
// 31 px for each map.
|
||||||
$style = 'min-width:200px; min-height:'.$minHeight.'px';
|
$minHeight = (count($maps) * 31);
|
||||||
$output = '<div class="container-center" style="'.$style.'">';
|
$style = 'min-width:200px; min-height:'.$minHeight.'px';
|
||||||
$output .= html_print_table($table, true);
|
$output = '<div class="container-center" style="'.$style.'">';
|
||||||
$output .= '</div>';
|
$output .= html_print_table($table, true);
|
||||||
|
$output .= '</div>';
|
||||||
|
} else {
|
||||||
|
$output .= '<div class="container-center">';
|
||||||
|
$output .= \ui_print_error_message(
|
||||||
|
__('Widget cannot be loaded').'. '.__('Please, configure the widget again to recover it'),
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
use PandoraFMS\Dashboard;
|
use PandoraFMS\Dashboard;
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -186,6 +187,44 @@ class ModuleIconWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -334,7 +373,6 @@ class ModuleIconWidget extends Widget
|
|||||||
'label' => __('Module'),
|
'label' => __('Module'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'autocomplete_module',
|
'type' => 'autocomplete_module',
|
||||||
'fields' => $fields,
|
|
||||||
'name' => 'moduleId',
|
'name' => 'moduleId',
|
||||||
'selected' => $values['moduleId'],
|
'selected' => $values['moduleId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
@ -343,6 +381,8 @@ class ModuleIconWidget extends Widget
|
|||||||
'metaconsole_id' => $values['metaconsoleId'],
|
'metaconsole_id' => $values['metaconsoleId'],
|
||||||
'style' => 'width: inherit;',
|
'style' => 'width: inherit;',
|
||||||
'filter_modules' => users_access_to_agent($values['agentId']) === false ? [$values['moduleId']] : [],
|
'filter_modules' => users_access_to_agent($values['agentId']) === false ? [$values['moduleId']] : [],
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,6 +183,44 @@ class ModuleStatusWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -324,7 +364,6 @@ class ModuleStatusWidget extends Widget
|
|||||||
'label' => __('Module'),
|
'label' => __('Module'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'autocomplete_module',
|
'type' => 'autocomplete_module',
|
||||||
'fields' => $fields,
|
|
||||||
'name' => 'moduleId',
|
'name' => 'moduleId',
|
||||||
'selected' => $values['moduleId'],
|
'selected' => $values['moduleId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
@ -332,7 +371,9 @@ class ModuleStatusWidget extends Widget
|
|||||||
'agent_id' => $values['agentId'],
|
'agent_id' => $values['agentId'],
|
||||||
'metaconsole_id' => $values['metaconsoleId'],
|
'metaconsole_id' => $values['metaconsoleId'],
|
||||||
'style' => 'width: inherit;',
|
'style' => 'width: inherit;',
|
||||||
'filter_modules' => users_access_to_agent($values['agentId']) === false ? [$values['moduleId']] : [],
|
'filter_modules' => (users_access_to_agent($values['agentId']) === false) ? [$values['moduleId']] : [],
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -454,15 +495,8 @@ class ModuleStatusWidget extends Widget
|
|||||||
*/
|
*/
|
||||||
public function load()
|
public function load()
|
||||||
{
|
{
|
||||||
global $config;
|
$output = '';
|
||||||
|
|
||||||
$output .= '';
|
|
||||||
|
|
||||||
$id_agent = $this->values['agentId'];
|
|
||||||
$id_group = agents_get_agent_group($id_agent);
|
|
||||||
|
|
||||||
$id_module = $this->values['moduleId'];
|
$id_module = $this->values['moduleId'];
|
||||||
|
|
||||||
$icon = $this->values['imageSrc'];
|
$icon = $this->values['imageSrc'];
|
||||||
$label = $this->values['label'];
|
$label = $this->values['label'];
|
||||||
$sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 30;
|
$sizeLabel = (isset($this->values['sizeLabel']) === true) ? $this->values['sizeLabel'] : 30;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
|
||||||
@ -183,6 +185,44 @@ class ModuleTableValueWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -293,6 +333,8 @@ class ModuleTableValueWidget extends Widget
|
|||||||
'filter_modules' => users_access_to_agent(
|
'filter_modules' => users_access_to_agent(
|
||||||
($values['agentId']) === false
|
($values['agentId']) === false
|
||||||
) ? [$values['moduleId']] : [],
|
) ? [$values['moduleId']] : [],
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_agents.php';
|
require_once $config['homedir'].'/include/functions_agents.php';
|
||||||
@ -181,6 +183,44 @@ class ModuleValueWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -308,7 +348,6 @@ class ModuleValueWidget extends Widget
|
|||||||
'label' => __('Module'),
|
'label' => __('Module'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'autocomplete_module',
|
'type' => 'autocomplete_module',
|
||||||
'fields' => $fields,
|
|
||||||
'name' => 'moduleId',
|
'name' => 'moduleId',
|
||||||
'selected' => $values['moduleId'],
|
'selected' => $values['moduleId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
@ -316,7 +355,9 @@ class ModuleValueWidget extends Widget
|
|||||||
'agent_id' => $values['agentId'],
|
'agent_id' => $values['agentId'],
|
||||||
'metaconsole_id' => $values['metaconsoleId'],
|
'metaconsole_id' => $values['metaconsoleId'],
|
||||||
'style' => 'width: inherit;',
|
'style' => 'width: inherit;',
|
||||||
'filter_modules' => users_access_to_agent($values['agentId']) === false ? [$values['moduleId']] : [],
|
'filter_modules' => (users_access_to_agent($values['agentId']) === false) ? [$values['moduleId']] : [],
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -380,9 +421,6 @@ class ModuleValueWidget extends Widget
|
|||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
$id_agent = $this->values['agentId'];
|
|
||||||
$id_group = agents_get_agent_group($id_agent);
|
|
||||||
|
|
||||||
$id_module = $this->values['moduleId'];
|
$id_module = $this->values['moduleId'];
|
||||||
|
|
||||||
$data_module = \modules_get_last_value($id_module);
|
$data_module = \modules_get_last_value($id_module);
|
||||||
|
@ -236,7 +236,7 @@ class MonitorHealthWidget extends Widget
|
|||||||
|
|
||||||
$all_data = tactical_status_modules_agents(
|
$all_data = tactical_status_modules_agents(
|
||||||
$config['id_user'],
|
$config['id_user'],
|
||||||
$user_strict,
|
false,
|
||||||
'AR'
|
'AR'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
use PandoraFMS\Dashboard\Manager;
|
use PandoraFMS\Dashboard\Manager;
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network map Widgets.
|
* Network map Widgets.
|
||||||
@ -180,6 +181,42 @@ class NetworkMapWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['networkmapId']) === true) {
|
if (empty($this->values['networkmapId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['node']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reports.
|
||||||
|
$check_exist = db_get_value(
|
||||||
|
'id',
|
||||||
|
'tmap',
|
||||||
|
'id',
|
||||||
|
$this->values['networkmapId']
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -312,8 +349,6 @@ class NetworkMapWidget extends Widget
|
|||||||
$values['networkmapId']
|
$values['networkmapId']
|
||||||
);
|
);
|
||||||
|
|
||||||
$fields[$selected] = $selected_networkmap;
|
|
||||||
|
|
||||||
if ((bool) is_metaconsole() === true) {
|
if ((bool) is_metaconsole() === true) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
@ -322,11 +357,13 @@ class NetworkMapWidget extends Widget
|
|||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'label' => __('Map'),
|
'label' => __('Map'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'fields' => $fields,
|
'fields' => $fields,
|
||||||
'name' => 'networkmapId',
|
'name' => 'networkmapId',
|
||||||
'selected' => $selected,
|
'selected' => $selected,
|
||||||
'return' => true,
|
'return' => true,
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
require_once $config['homedir'].'/include/Image/image_functions.php';
|
require_once $config['homedir'].'/include/Image/image_functions.php';
|
||||||
require_once $config['homedir'].'/include/functions_reporting_html.php';
|
require_once $config['homedir'].'/include/functions_reporting_html.php';
|
||||||
@ -173,12 +175,37 @@ class ReportsWidget extends Widget
|
|||||||
if (empty($this->values['reportId']) === true) {
|
if (empty($this->values['reportId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
} else {
|
} else {
|
||||||
$check_exist = db_get_value(
|
try {
|
||||||
'id_report',
|
if (is_metaconsole() === true
|
||||||
'treport',
|
&& $this->values['node'] > 0
|
||||||
'id_report',
|
) {
|
||||||
$this->values['reportId']
|
$node = new Node($this->values['node']);
|
||||||
);
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reports.
|
||||||
|
$check_exist = db_get_value(
|
||||||
|
'id_report',
|
||||||
|
'treport',
|
||||||
|
'id_report',
|
||||||
|
$this->values['reportId']
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($check_exist === false) {
|
if ($check_exist === false) {
|
||||||
$this->loadError = true;
|
$this->loadError = true;
|
||||||
@ -227,15 +254,39 @@ class ReportsWidget extends Widget
|
|||||||
$return_all_group = true;
|
$return_all_group = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reports.
|
try {
|
||||||
$reports = \reports_get_reports(
|
if (is_metaconsole() === true
|
||||||
false,
|
&& $this->values['node'] > 0
|
||||||
[
|
) {
|
||||||
'id_report',
|
$node = new Node($this->values['node']);
|
||||||
'name',
|
$node->connect();
|
||||||
],
|
}
|
||||||
$return_all_group
|
|
||||||
);
|
// Reports.
|
||||||
|
$reports = \reports_get_reports(
|
||||||
|
false,
|
||||||
|
[
|
||||||
|
'id_report',
|
||||||
|
'name',
|
||||||
|
],
|
||||||
|
$return_all_group
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$reports = [];
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['node'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If currently selected report is not included in fields array
|
// If currently selected report is not included in fields array
|
||||||
// (it belongs to a group over which user has no permissions), then add
|
// (it belongs to a group over which user has no permissions), then add
|
||||||
@ -363,7 +414,7 @@ class ReportsWidget extends Widget
|
|||||||
$output .= 'Click to view: <a href="?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$this->values['reportId'].'">'.__('Report').'</a>';
|
$output .= 'Click to view: <a href="?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$this->values['reportId'].'">'.__('Report').'</a>';
|
||||||
$output .= '</div>';
|
$output .= '</div>';
|
||||||
} else {
|
} else {
|
||||||
$this->load_error = true;
|
$this->loadError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -200,6 +200,17 @@ class ServiceMapWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['serviceId']) === true) {
|
if (empty($this->values['serviceId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
$check_exist = db_get_value(
|
||||||
|
'id',
|
||||||
|
'tservice',
|
||||||
|
'id',
|
||||||
|
$this->values['serviceId']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
|
@ -194,11 +194,9 @@ class ServiceViewWidget extends Widget
|
|||||||
$this->name = 'service_view';
|
$this->name = 'service_view';
|
||||||
}
|
}
|
||||||
|
|
||||||
// // This forces at least a first configuration.
|
// This forces at least a first configuration.
|
||||||
// $this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
// if (empty($this->values['serviceId']) === true) {
|
|
||||||
// $this->configurationRequired = true;
|
|
||||||
// }
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -178,6 +180,44 @@ class SingleGraphWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -286,6 +326,8 @@ class SingleGraphWidget extends Widget
|
|||||||
'agent_id' => $values['agentId'],
|
'agent_id' => $values['agentId'],
|
||||||
'metaconsole_id' => $values['metaconsoleId'],
|
'metaconsole_id' => $values['metaconsoleId'],
|
||||||
'style' => 'width: inherit;',
|
'style' => 'width: inherit;',
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
namespace PandoraFMS\Dashboard;
|
namespace PandoraFMS\Dashboard;
|
||||||
|
|
||||||
|
use PandoraFMS\Enterprise\Metaconsole\Node;
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_agents.php';
|
require_once $config['homedir'].'/include/functions_agents.php';
|
||||||
@ -182,6 +184,44 @@ class SLAPercentWidget extends Widget
|
|||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['moduleId']) === true) {
|
if (empty($this->values['moduleId']) === true) {
|
||||||
$this->configurationRequired = true;
|
$this->configurationRequired = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node = new Node($this->values['metaconsoleId']);
|
||||||
|
$node->connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = db_get_sql(
|
||||||
|
sprintf(
|
||||||
|
'SELECT id_agente_modulo
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo = %s
|
||||||
|
AND delete_pending = 0',
|
||||||
|
$this->values['moduleId']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Unexistent agent.
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$check_exist = false;
|
||||||
|
} finally {
|
||||||
|
if (is_metaconsole() === true
|
||||||
|
&& $this->values['metaconsoleId'] > 0
|
||||||
|
) {
|
||||||
|
$node->disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($check_exist === false) {
|
||||||
|
$this->loadError = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
@ -315,7 +355,6 @@ class SLAPercentWidget extends Widget
|
|||||||
'label' => __('Module'),
|
'label' => __('Module'),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'type' => 'autocomplete_module',
|
'type' => 'autocomplete_module',
|
||||||
'fields' => $fields,
|
|
||||||
'name' => 'moduleId',
|
'name' => 'moduleId',
|
||||||
'selected' => $values['moduleId'],
|
'selected' => $values['moduleId'],
|
||||||
'return' => true,
|
'return' => true,
|
||||||
@ -323,6 +362,8 @@ class SLAPercentWidget extends Widget
|
|||||||
'agent_id' => $values['agentId'],
|
'agent_id' => $values['agentId'],
|
||||||
'metaconsole_id' => $values['metaconsoleId'],
|
'metaconsole_id' => $values['metaconsoleId'],
|
||||||
'style' => 'width: inherit;',
|
'style' => 'width: inherit;',
|
||||||
|
'nothing' => __('None'),
|
||||||
|
'nothing_value' => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -459,18 +459,19 @@ class SystemGroupStatusWidget extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
$module_counters = groupview_get_modules_counters($selected_groups);
|
$module_counters = groupview_get_modules_counters($selected_groups);
|
||||||
|
$result_groups = [];
|
||||||
|
if (empty($module_counters) === false) {
|
||||||
|
foreach ($module_counters as $key => $item) {
|
||||||
|
$module_counters[$key]['name'] = groups_get_name($item['g']);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($module_counters as $key => $item) {
|
$keys = array_column($module_counters, 'g');
|
||||||
$module_counters[$key]['name'] = groups_get_name($item['g']);
|
$values = array_values($module_counters);
|
||||||
}
|
$result_groups = array_combine($keys, $values);
|
||||||
|
|
||||||
$keys = array_column($module_counters, 'g');
|
if (empty($all_counters) === false) {
|
||||||
$values = array_values($module_counters);
|
$result_groups[0] = $all_counters;
|
||||||
|
}
|
||||||
$result_groups = array_combine($keys, $values);
|
|
||||||
|
|
||||||
if (empty($all_counters) === false) {
|
|
||||||
$result_groups[0] = $all_counters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->values['groupId'] = $selected_groups;
|
$this->values['groupId'] = $selected_groups;
|
||||||
|
@ -501,7 +501,10 @@ class TreeViewWidget extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
$id_cell = $this->cellId;
|
$id_cell = $this->cellId;
|
||||||
$all_nodes = $this->values['openAllGroups'];
|
$all_nodes = false;
|
||||||
|
if (isset($this->values['openAllGroups']) === true) {
|
||||||
|
$all_nodes = $this->values['openAllGroups'];
|
||||||
|
}
|
||||||
|
|
||||||
$tab = 'group';
|
$tab = 'group';
|
||||||
if (empty($this->values['typeTree']) === false) {
|
if (empty($this->values['typeTree']) === false) {
|
||||||
@ -587,7 +590,7 @@ class TreeViewWidget extends Widget
|
|||||||
|
|
||||||
$output .= \html_print_input_hidden(
|
$output .= \html_print_input_hidden(
|
||||||
'publi_dash_tree_view_hash',
|
'publi_dash_tree_view_hash',
|
||||||
$hash,
|
'',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$output .= \html_print_input_hidden(
|
$output .= \html_print_input_hidden(
|
||||||
|
@ -1150,7 +1150,7 @@ class Item extends CachedModel
|
|||||||
'sec2' => 'screens/screens',
|
'sec2' => 'screens/screens',
|
||||||
'action' => 'visualmap',
|
'action' => 'visualmap',
|
||||||
'id_visualmap' => $vcId,
|
'id_visualmap' => $vcId,
|
||||||
'pure' => (int) $config['pure'],
|
'pure' => (int) (isset($config['pure']) === true) ? $config['pure'] : 0,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else if (empty($linkedLayoutNodeId) === true
|
} else if (empty($linkedLayoutNodeId) === true
|
||||||
@ -1175,7 +1175,7 @@ class Item extends CachedModel
|
|||||||
'sec' => 'network',
|
'sec' => 'network',
|
||||||
'sec2' => 'operation/visual_console/view',
|
'sec2' => 'operation/visual_console/view',
|
||||||
'id' => $vcId,
|
'id' => $vcId,
|
||||||
'pure' => (int) $config['pure'],
|
'pure' => (int) (isset($config['pure']) === true) ? $config['pure'] : 0,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else if (\is_metaconsole() === true
|
} else if (\is_metaconsole() === true
|
||||||
@ -1313,7 +1313,7 @@ class Item extends CachedModel
|
|||||||
'operation/agentes/status_monitor',
|
'operation/agentes/status_monitor',
|
||||||
['id_module' => $moduleId],
|
['id_module' => $moduleId],
|
||||||
// No autologin from the public view.
|
// No autologin from the public view.
|
||||||
!$config['public_view'],
|
!((isset($config['public_view']) === true) ? $config['public_view'] : false),
|
||||||
$mobile_navigation,
|
$mobile_navigation,
|
||||||
[
|
[
|
||||||
'id' => $moduleId,
|
'id' => $moduleId,
|
||||||
|
@ -236,6 +236,7 @@ li#div-textarea label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.container-center > .parent_graph p {
|
.container-center > .parent_graph p {
|
||||||
|
margin-top: 0px;
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user