merge
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.744-200311
|
||||
Version: 7.0NG.744-200326
|
||||
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.744-200311"
|
||||
pandora_version="7.0NG.744-200326"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.744';
|
||||
use constant AGENT_BUILD => '200311';
|
||||
use constant AGENT_BUILD => '200326';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.744
|
||||
%define release 200311
|
||||
%define release 200326
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.744
|
||||
%define release 200311
|
||||
%define release 200326
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.744"
|
||||
PI_BUILD="200311"
|
||||
PI_BUILD="200326"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -612,6 +612,12 @@ sub get_steps {
|
|||
$desc = 'Step unreachable';
|
||||
}
|
||||
|
||||
my $name = $preffix . $host;
|
||||
|
||||
if (defined $previous && $name eq $previous) {
|
||||
next;
|
||||
}
|
||||
|
||||
push @modules, {
|
||||
name => $preffix . $host,
|
||||
type => "generic_data",
|
||||
|
@ -710,6 +716,12 @@ sub get_steps {
|
|||
$desc = 'Step unreachable';
|
||||
}
|
||||
|
||||
my $name = $preffix . $host;
|
||||
|
||||
if (defined $previous && $name eq $previous) {
|
||||
next;
|
||||
}
|
||||
|
||||
push @modules, {
|
||||
name => $preffix . $host,
|
||||
type => "generic_data",
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{200311}
|
||||
{200326}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.744(Build 200311)")
|
||||
#define PANDORA_VERSION ("7.0NG.744(Build 200326)")
|
||||
|
||||
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.744(Build 200311))"
|
||||
VALUE "ProductVersion", "(7.0NG.744(Build 200326))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.744-200311
|
||||
Version: 7.0NG.744-200326
|
||||
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.744-200311"
|
||||
pandora_version="7.0NG.744-200326"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -71,21 +71,8 @@ if (isset($_GET['loginhash'])) {
|
|||
}
|
||||
}
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
|
||||
// Check user.
|
||||
if ($public_hash == false) {
|
||||
check_login();
|
||||
} else {
|
||||
enterprise_include_once('include/functions_dashboard.php');
|
||||
if (dashboard_check_public_hash($public_hash) === false) {
|
||||
db_pandora_audit('Invalid public hash', 'Trying to access public dashboard');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
check_login();
|
||||
|
||||
// Enterprise support.
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
|
|
|
@ -45,4 +45,14 @@ CREATE TABLE `tpen` (
|
|||
REFERENCES `tnetwork_profile` (`id_np`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `twidget_dashboard` ADD COLUMN `position` TEXT NOT NULL default '';
|
||||
|
||||
ALTER TABLE `tagente_estado` ADD COLUMN `last_status_change` bigint(20) NOT NULL default '0';
|
||||
|
||||
UPDATE `tconfig` SET `value`='policy,agent,data_type,module_name,server_type,interval,status,last_status_change,graph,warn,data,timestamp' WHERE `token` = 'status_monitor_fields';
|
||||
|
||||
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -666,6 +666,7 @@ CREATE TABLE IF NOT EXISTS `tevent_alert` (
|
|||
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `special_days` tinyint(1) default 0;
|
||||
ALTER TABLE `tevent_alert` MODIFY COLUMN `time_threshold` int(10) NOT NULL default 86400;
|
||||
ALTER TABLE `tevent_alert` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tevent_alert_action`
|
||||
|
@ -1239,6 +1240,7 @@ ALTER TABLE talert_templates ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT
|
|||
ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE `talert_templates` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_snmp`
|
||||
|
@ -1248,6 +1250,7 @@ ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
|
|||
ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `disable_event` tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE `talert_snmp` MODIFY COLUMN `al_field11` text NOT NULL,
|
||||
MODIFY COLUMN `al_field12` text NOT NULL,
|
||||
MODIFY COLUMN `al_field13` text NOT NULL,
|
||||
|
@ -1284,6 +1287,7 @@ ALTER TABLE `tagente_estado` MODIFY COLUMN `datos` mediumtext NOT NULL,
|
|||
MODIFY COLUMN `last_known_status` tinyint(4) NULL DEFAULT '0',
|
||||
MODIFY COLUMN `last_dynamic_update` bigint(20) NOT NULL DEFAULT '0',
|
||||
MODIFY COLUMN `last_unknown_update` bigint(20) NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `tagente_estado` ADD COLUMN `last_status_change` bigint(20) NOT NULL DEFAULT '0';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_actions`
|
||||
|
@ -1338,13 +1342,13 @@ ALTER TABLE `tmap` MODIFY COLUMN `id_user` varchar(250) NOT NULL DEFAULT '';
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 36);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 37);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '744');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '745');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
|
||||
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
|
||||
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
|
||||
|
@ -1650,7 +1654,8 @@ UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.no
|
|||
-- ---------------------------------------------------------------------
|
||||
-- Table `twidget_dashboard`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE twidget_dashboard MODIFY options LONGTEXT NOT NULL default "";
|
||||
ALTER TABLE `twidget_dashboard` MODIFY `options` LONGTEXT NOT NULL default "";
|
||||
ALTER TABLE `twidget_dashboard` ADD COLUMN `position` TEXT NOT NULL default "";
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `trecon_task`
|
||||
|
|
|
@ -180,7 +180,7 @@ if ($config['menu_type'] == 'classic') {
|
|||
break;
|
||||
|
||||
case 'Dashboard':
|
||||
$_GET['sec2'] = 'enterprise/dashboard/main_dashboard';
|
||||
$_GET['sec2'] = 'operation/dashboard/dashboard';
|
||||
break;
|
||||
|
||||
case 'Visual console':
|
||||
|
@ -779,9 +779,7 @@ if ($config['menu_type'] == 'classic') {
|
|||
}
|
||||
}
|
||||
|
||||
$new_dashboard = get_parameter('new_dashboard', 0);
|
||||
|
||||
if ($_GET['sec2'] == 'enterprise/dashboard/main_dashboard' && $new_dashboard) {
|
||||
if ($_GET['sec2'] == 'operation/dashboard/dashboard' && $new_dashboard) {
|
||||
$do_refresh = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,21 +160,21 @@ echo '<div class="login_page">';
|
|||
echo '<a href="'.$logo_link.'">';
|
||||
if (defined('METACONSOLE')) {
|
||||
if (!isset($config['custom_logo_login'])) {
|
||||
html_print_image('images/custom_logo_login/login_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
html_print_image(ui_get_full_url('images/custom_logo_login/login_logo.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
} else {
|
||||
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
html_print_image(ui_get_full_url('images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
}
|
||||
} else if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if (!isset($config['custom_logo_login'])) {
|
||||
html_print_image('enterprise/images/custom_logo_login/login_logo_v7.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/login_logo_v7.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
} else {
|
||||
html_print_image('enterprise/images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
html_print_image(ui_get_full_url('enterprise/images/custom_logo_login/'.$config['custom_logo_login']), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
}
|
||||
} else {
|
||||
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] === 0) {
|
||||
html_print_image('images/custom_logo_login/pandora_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
if (empty($config['custom_logo_login']) === true) {
|
||||
html_print_image(ui_get_full_url('images/custom_logo_login/pandora_logo.png'), false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
} else {
|
||||
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
html_print_image(ui_get_full_url('images/custom_logo_login/').$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
|
||||
}
|
||||
|
||||
// I comment this in case in the future we put a logo without text.
|
||||
|
|
|
@ -181,7 +181,7 @@ function open_submenus () {
|
|||
if (value)
|
||||
$('div.menu>ul>li#' + index + '>ul').show();
|
||||
});
|
||||
$('div.menu>ul>li.selected>ul').removeClass('invisible');
|
||||
//$('div.menu>ul>li.selected>ul').removeClass('invisible');
|
||||
}
|
||||
|
||||
function close_submenus () {
|
||||
|
@ -189,7 +189,7 @@ function close_submenus () {
|
|||
if (value)
|
||||
$('div.menu>ul>li#' + index + '>ul').hide();
|
||||
});
|
||||
$('div.menu>ul>li.selected>ul').addClass('invisible');
|
||||
//$('div.menu>ul>li.selected>ul').addClass('invisible');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -227,7 +227,9 @@ if (!$new_agent && $alias != '') {
|
|||
$agent_options_update = 'agent_options_update';
|
||||
|
||||
// Delete link from here.
|
||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
||||
if (!is_central_policies_on_node()) {
|
||||
$table_agent_name .= "<a onClick=\"if (!confirm('".__('Are you sure?')."')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=".$id_agente."&search=&offset=0&sort_field=&sort=none'>".html_print_image('images/cross.png', true, ['title' => __('Delete agent')]).'</a>';
|
||||
}
|
||||
|
||||
// Remote configuration available.
|
||||
if (isset($filename)) {
|
||||
|
|
|
@ -62,6 +62,10 @@ $onheader = ['view' => $viewtab];
|
|||
// Header.
|
||||
ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader);
|
||||
|
||||
if (is_central_policies_on_node()) {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
|
||||
}
|
||||
|
||||
// Perform actions.
|
||||
$agent_to_delete = (int) get_parameter('borrar_agente');
|
||||
$enable_agent = (int) get_parameter('enable_agent');
|
||||
|
@ -694,7 +698,7 @@ if ($agents !== false) {
|
|||
echo html_print_image('images/lightbulb.png', true, ['alt' => __('Disable agent'), 'title' => __('Disable agent')]).'</a>';
|
||||
}
|
||||
|
||||
if ($check_aw) {
|
||||
if ($check_aw && !is_central_policies_on_node()) {
|
||||
echo "<a href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&
|
||||
borrar_agente=".$agent['id_agente']."&group_id=$ag_group&recursion=$recursion&search=$search&offset=$offsetArg&sort_field=$sortField&sort=$sort&disabled=$disabled'";
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ $table_advanced->style = [];
|
|||
$table_advanced->style[0] = $table_advanced->style[3] = $table_advanced->style[5] = 'font-weight: bold;';
|
||||
$table_advanced->colspan = [];
|
||||
|
||||
$table_advanced->colspan[17][1] = 3;
|
||||
$table_advanced->colspan[5][1] = 3;
|
||||
|
||||
$table_advanced->data[0][0] = __('Custom ID');
|
||||
$table_advanced->colspan[0][1] = 2;
|
||||
|
@ -612,7 +612,59 @@ $table_advanced->data[2][3] = __('Max. Value');
|
|||
$table_advanced->data[2][4] = html_print_input_text('max', $max, '', 5, 15, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Any value over this number is discarted.'), true);
|
||||
$table_advanced->colspan[2][4] = 3;
|
||||
|
||||
$table_advanced->data[3][0] = __('Export target');
|
||||
|
||||
$table_advanced->data[3][0] = __('Dynamic Threshold Interval');
|
||||
$table_advanced->data[3][1] = html_print_extended_select_for_time(
|
||||
'dynamic_interval',
|
||||
$dynamic_interval,
|
||||
'',
|
||||
'None',
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
'width:150px',
|
||||
false,
|
||||
$classdisabledBecauseInPolicy,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[3][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||
|
||||
$table_advanced->cellclass[3][2] = 'hide_dinamic';
|
||||
$table_advanced->cellclass[3][3] = 'hide_dinamic';
|
||||
|
||||
|
||||
$table_advanced->data[3][2] = '<span><em>'.__('Dynamic Threshold Min. ').'</em>';
|
||||
$table_advanced->data[3][2] .= html_print_input_text(
|
||||
'dynamic_min',
|
||||
$dynamic_min,
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[3][2] .= '<br /><em>'.__('Dynamic Threshold Max. ').'</em>';
|
||||
$table_advanced->data[3][2] .= html_print_input_text(
|
||||
'dynamic_max',
|
||||
$dynamic_max,
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[3][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
|
||||
$table_advanced->data[3][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
|
||||
|
||||
|
||||
|
||||
$table_advanced->data[4][0] = __('Export target');
|
||||
// Default text message for export target select and disabled option
|
||||
$none_text = __('None');
|
||||
$disabled_export = false;
|
||||
|
@ -622,7 +674,7 @@ if ($__code_from == 'policies') {
|
|||
$disabled_export = true;
|
||||
}
|
||||
|
||||
$table_advanced->data[3][1] = html_print_select_from_sql(
|
||||
$table_advanced->data[4][1] = html_print_select_from_sql(
|
||||
'SELECT id, name FROM tserver_export ORDER BY name',
|
||||
'id_export',
|
||||
$id_export,
|
||||
|
@ -634,7 +686,7 @@ $table_advanced->data[3][1] = html_print_select_from_sql(
|
|||
false,
|
||||
$disabled_export
|
||||
).ui_print_help_tip(__('In case you use an Export server you can link this module and export data to one these.'), true);
|
||||
$table_advanced->colspan[3][1] = 2;
|
||||
$table_advanced->colspan[4][1] = 2;
|
||||
|
||||
// Code comes from module_editor
|
||||
if ($__code_from == 'modules') {
|
||||
|
@ -645,18 +697,105 @@ if ($__code_from == 'modules') {
|
|||
$throw_unknown_events_check = policy_module_is_disable_type_event($__id_pol_mod, EVENTS_GOING_UNKNOWN);
|
||||
}
|
||||
|
||||
$table_advanced->data[3][3] = __('Discard unknown events');
|
||||
$table_advanced->data[3][4] = html_print_checkbox(
|
||||
$table_advanced->data[4][3] = __('Discard unknown events');
|
||||
$table_advanced->data[4][4] = html_print_checkbox(
|
||||
'throw_unknown_events',
|
||||
1,
|
||||
$throw_unknown_events_check,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->colspan[3][4] = 3;
|
||||
$table_advanced->colspan[4][4] = 3;
|
||||
|
||||
$table_advanced->data[4][0] = __('FF interval');
|
||||
$table_advanced->data[4][1] = html_print_input_text(
|
||||
|
||||
// FF stands for Flip-flop.
|
||||
$table_advanced->data[5][0] = __('FF threshold').' ';
|
||||
|
||||
$table_advanced->data[5][1] .= __('Keep counters');
|
||||
$table_advanced->data[5][1] .= html_print_checkbox(
|
||||
'ff_type',
|
||||
1,
|
||||
$ff_type,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
).'<br />';
|
||||
|
||||
$table_advanced->data[5][1] .= html_print_radio_button(
|
||||
'each_ff',
|
||||
0,
|
||||
'',
|
||||
$each_ff,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[5][1] .= ' '.__('All state changing').' : ';
|
||||
$table_advanced->data[5][1] .= html_print_input_text(
|
||||
'ff_event',
|
||||
$ff_event,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).'<br />';
|
||||
$table_advanced->data[5][1] .= html_print_radio_button(
|
||||
'each_ff',
|
||||
1,
|
||||
'',
|
||||
$each_ff,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$table_advanced->data[5][1] .= ' '.__('Each state changing').' : ';
|
||||
$table_advanced->data[5][1] .= __('To normal');
|
||||
$table_advanced->data[5][1] .= html_print_input_text(
|
||||
'ff_event_normal',
|
||||
$ff_event_normal,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).' ';
|
||||
|
||||
$table_advanced->data[5][1] .= __('To warning');
|
||||
$table_advanced->data[5][1] .= html_print_input_text(
|
||||
'ff_event_warning',
|
||||
$ff_event_warning,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).' ';
|
||||
|
||||
$table_advanced->data[5][1] .= __('To critical');
|
||||
$table_advanced->data[5][1] .= html_print_input_text(
|
||||
'ff_event_critical',
|
||||
$ff_event_critical,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
|
||||
|
||||
$table_advanced->data[6][0] = __('FF interval');
|
||||
$table_advanced->data[6][1] = html_print_input_text(
|
||||
'module_ff_interval',
|
||||
$ff_interval,
|
||||
'',
|
||||
|
@ -668,14 +807,14 @@ $table_advanced->data[4][1] = html_print_input_text(
|
|||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).ui_print_help_tip(__('Module execution flip flop time interval (in secs).'), true);
|
||||
$table_advanced->colspan[4][1] = 2;
|
||||
$table_advanced->colspan[6][1] = 2;
|
||||
|
||||
$table_advanced->data[4][3] = __('FF timeout');
|
||||
$table_advanced->data[6][3] = __('FF timeout');
|
||||
|
||||
$module_type_name = modules_get_type_name($id_module_type);
|
||||
$table_advanced->data[4][4] = '';
|
||||
$table_advanced->data[6][4] = '';
|
||||
if (preg_match('/async/', $module_type_name) || $edit) {
|
||||
$table_advanced->data[4][4] .= '<span id="ff_timeout">'.html_print_input_text(
|
||||
$table_advanced->data[6][4] .= '<span id="ff_timeout">'.html_print_input_text(
|
||||
'ff_timeout',
|
||||
$ff_timeout,
|
||||
'',
|
||||
|
@ -687,16 +826,16 @@ if (preg_match('/async/', $module_type_name) || $edit) {
|
|||
}
|
||||
|
||||
if (!preg_match('/async/', $module_type_name) || $edit) {
|
||||
$table_advanced->data[4][4] .= '<span id="ff_timeout_disable">'.__('Disabled').ui_print_help_tip(__('This value can be set only in the async modules.'), true).'</span>';
|
||||
$table_advanced->data[6][4] .= '<span id="ff_timeout_disable">'.__('Disabled').ui_print_help_tip(__('This value can be set only in the async modules.'), true).'</span>';
|
||||
}
|
||||
|
||||
$table_advanced->colspan[4][4] = 3;
|
||||
$table_advanced->colspan[6][4] = 3;
|
||||
|
||||
/*
|
||||
Tags */
|
||||
// This var comes from module_manager_editor.php or policy_modules.php
|
||||
global $__code_from;
|
||||
$table_advanced->data[5][0] = __('Tags available');
|
||||
$table_advanced->data[7][0] = __('Tags available');
|
||||
// Code comes from module_editor
|
||||
if ($__code_from == 'modules') {
|
||||
$__table_modules = 'ttag_module';
|
||||
|
@ -716,7 +855,7 @@ if ($__code_from == 'modules') {
|
|||
}
|
||||
|
||||
if (!tags_has_user_acl_tags($config['id_user'])) {
|
||||
$table_advanced->data[5][1] = html_print_select_from_sql(
|
||||
$table_advanced->data[7][1] = html_print_select_from_sql(
|
||||
"SELECT id_tag, name
|
||||
FROM ttag
|
||||
WHERE id_tag NOT IN (
|
||||
|
@ -741,7 +880,7 @@ if (!tags_has_user_acl_tags($config['id_user'])) {
|
|||
if (!empty($user_tags)) {
|
||||
$id_user_tags = array_keys($user_tags);
|
||||
|
||||
$table_advanced->data[5][1] = html_print_select_from_sql(
|
||||
$table_advanced->data[7][1] = html_print_select_from_sql(
|
||||
'SELECT id_tag, name
|
||||
FROM ttag
|
||||
WHERE id_tag IN ('.implode(',', $id_user_tags).") AND
|
||||
|
@ -763,7 +902,7 @@ if (!tags_has_user_acl_tags($config['id_user'])) {
|
|||
'5'
|
||||
);
|
||||
} else {
|
||||
$table_advanced->data[5][1] = html_print_select_from_sql(
|
||||
$table_advanced->data[7][1] = html_print_select_from_sql(
|
||||
"SELECT id_tag, name
|
||||
FROM ttag
|
||||
WHERE id_tag NOT IN (
|
||||
|
@ -786,12 +925,12 @@ if (!tags_has_user_acl_tags($config['id_user'])) {
|
|||
}
|
||||
}
|
||||
|
||||
$table_advanced->data[5][2] = html_print_image('images/darrowright.png', true, ['id' => 'right', 'title' => __('Add tags to module')]);
|
||||
$table_advanced->data[7][2] = html_print_image('images/darrowright.png', true, ['id' => 'right', 'title' => __('Add tags to module')]);
|
||||
// html_print_input_image ('add', 'images/darrowright.png', 1, '', true, array ('title' => __('Add tags to module')));
|
||||
$table_advanced->data[5][2] .= '<br><br><br><br>'.html_print_image('images/darrowleft.png', true, ['id' => 'left', 'title' => __('Delete tags to module')]);
|
||||
$table_advanced->data[7][2] .= '<br><br><br><br>'.html_print_image('images/darrowleft.png', true, ['id' => 'left', 'title' => __('Delete tags to module')]);
|
||||
// html_print_input_image ('add', 'images/darrowleft.png', 1, '', true, array ('title' => __('Delete tags to module')));
|
||||
$table_advanced->data[5][3] = '<b>'.__('Tags selected').'</b>';
|
||||
$table_advanced->data[5][4] = html_print_select_from_sql(
|
||||
$table_advanced->data[7][3] = '<b>'.__('Tags selected').'</b>';
|
||||
$table_advanced->data[7][4] = html_print_select_from_sql(
|
||||
"SELECT a.id_tag, name
|
||||
FROM ttag a, $__table_modules b
|
||||
WHERE a.id_tag = b.id_tag AND $__id_where = $__id
|
||||
|
@ -811,8 +950,8 @@ $table_advanced->data[5][4] = html_print_select_from_sql(
|
|||
);
|
||||
|
||||
if ($__code_from == 'modules') {
|
||||
$table_advanced->data[5][5] = '<b>'.__('Tags from policy').'</b>';
|
||||
$table_advanced->data[5][6] = html_print_select_from_sql(
|
||||
$table_advanced->data[7][5] = '<b>'.__('Tags from policy').'</b>';
|
||||
$table_advanced->data[7][6] = html_print_select_from_sql(
|
||||
"SELECT a.id_tag, name
|
||||
FROM ttag a, $__table_modules b
|
||||
WHERE a.id_tag = b.id_tag AND $__id_where = $__id
|
||||
|
@ -832,9 +971,9 @@ if ($__code_from == 'modules') {
|
|||
);
|
||||
}
|
||||
|
||||
$table_advanced->data[6][0] = __('Quiet');
|
||||
$table_advanced->data[6][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->data[6][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->data[8][0] = __('Quiet');
|
||||
$table_advanced->data[8][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->data[8][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy);
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if ($cps_module > 0) {
|
||||
|
@ -851,17 +990,17 @@ if ($cps_module > 0) {
|
|||
$cps_array[$cps_inc] = __('Enabled');
|
||||
}
|
||||
|
||||
$table_advanced->data[6][2] = '';
|
||||
$table_advanced->data[6][3] = __('Cascade Protection Services');
|
||||
$table_advanced->data[6][3] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table_advanced->colspan[6][4] = 3;
|
||||
$table_advanced->data[6][4] = html_print_select($cps_array, 'cps_module', $cps_module, '', '', 0, true, false, true, '', $disabledBecauseInPolicy);
|
||||
$table_advanced->data[8][2] = '';
|
||||
$table_advanced->data[8][3] = __('Cascade Protection Services');
|
||||
$table_advanced->data[8][3] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table_advanced->colspan[8][4] = 3;
|
||||
$table_advanced->data[8][4] = html_print_select($cps_array, 'cps_module', $cps_module, '', '', 0, true, false, true, '', $disabledBecauseInPolicy);
|
||||
|
||||
$textarea_custom_style = ' style="min-height: 0px;"';
|
||||
|
||||
$table_advanced->data[7][0] = __('Description');
|
||||
$table_advanced->colspan[7][1] = 6;
|
||||
$table_advanced->data[7][1] = html_print_textarea(
|
||||
$table_advanced->data[9][0] = __('Description');
|
||||
$table_advanced->colspan[9][1] = 6;
|
||||
$table_advanced->data[9][1] = html_print_textarea(
|
||||
'description',
|
||||
3,
|
||||
65,
|
||||
|
@ -871,58 +1010,58 @@ $table_advanced->data[7][1] = html_print_textarea(
|
|||
$largeClassDisabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$table_advanced->data[8][0] = __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true);
|
||||
$table_advanced->data[8][1] = html_print_textarea('critical_instructions', 3, 65, $critical_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
|
||||
$table_advanced->data[10][0] = __('Critical instructions').ui_print_help_tip(__('Instructions when the status is critical'), true);
|
||||
$table_advanced->data[10][1] = html_print_textarea('critical_instructions', 3, 65, $critical_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->colspan[8][1] = 6;
|
||||
|
||||
$table_advanced->data[9][0] = __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true);
|
||||
$table_advanced->data[9][1] = html_print_textarea('warning_instructions', 3, 65, $warning_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
|
||||
$table_advanced->colspan[9][1] = 6;
|
||||
|
||||
$table_advanced->data[10][0] = __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true);
|
||||
$table_advanced->data[10][1] = html_print_textarea('unknown_instructions', 3, 65, $unknown_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
|
||||
$table_advanced->colspan[10][1] = 6;
|
||||
|
||||
$table_advanced->data[11][0] = __('Warning instructions').ui_print_help_tip(__('Instructions when the status is warning'), true);
|
||||
$table_advanced->data[11][1] = html_print_textarea('warning_instructions', 3, 65, $warning_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
|
||||
$table_advanced->data[12][0] = __('Unknown instructions').ui_print_help_tip(__('Instructions when the status is unknown'), true);
|
||||
$table_advanced->data[12][1] = html_print_textarea('unknown_instructions', 3, 65, $unknown_instructions, $disabledTextBecauseInPolicy.$textarea_custom_style, true, $largeClassDisabledBecauseInPolicy);
|
||||
$table_advanced->colspan[12][1] = 6;
|
||||
|
||||
if (isset($id_agente) && $moduletype == MODULE_DATA) {
|
||||
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']]);
|
||||
if ($has_remote_conf) {
|
||||
$table_advanced->data[11][0] = __('Cron from');
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
$table_advanced->data[13][0] = __('Cron from');
|
||||
$table_advanced->data[13][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[13][1] = 6;
|
||||
|
||||
$table_advanced->data[12][0] = __('Cron to');
|
||||
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||
$table_advanced->colspan[12][1] = 6;
|
||||
$table_advanced->data[14][0] = __('Cron to');
|
||||
$table_advanced->data[14][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||
$table_advanced->colspan[14][1] = 6;
|
||||
} else {
|
||||
$table_advanced->data[11][0] = __('Cron from');
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
$table_advanced->data[13][0] = __('Cron from');
|
||||
$table_advanced->data[13][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
|
||||
$table_advanced->colspan[13][1] = 6;
|
||||
|
||||
$table_advanced->data[12][0] = __('Cron to');
|
||||
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, true, true);
|
||||
$table_advanced->colspan[12][1] = 6;
|
||||
$table_advanced->data[14][0] = __('Cron to');
|
||||
$table_advanced->data[14][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, true, true);
|
||||
$table_advanced->colspan[14][1] = 6;
|
||||
}
|
||||
} else {
|
||||
$table_advanced->data[11][0] = __('Cron from');
|
||||
$table_advanced->data[11][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[11][1] = 6;
|
||||
$table_advanced->data[13][0] = __('Cron from');
|
||||
$table_advanced->data[13][1] = html_print_extended_select_for_cron($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->colspan[13][1] = 6;
|
||||
|
||||
$table_advanced->data[12][0] = __('Cron to');
|
||||
$table_advanced->data[12][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||
$table_advanced->colspan[12][1] = 6;
|
||||
$table_advanced->data[14][0] = __('Cron to');
|
||||
$table_advanced->data[14][1] = html_print_extended_select_for_cron($hour_to, $minute_to, $mday_to, $month_to, $wday_to, true, $disabledBecauseInPolicy, true);
|
||||
$table_advanced->colspan[14][1] = 6;
|
||||
}
|
||||
|
||||
$table_advanced->data[13][0] = __('Timeout');
|
||||
$table_advanced->data[13][1] = html_print_input_text('max_timeout', $max_timeout, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Seconds that agent will wait for the execution of the module.'), true);
|
||||
$table_advanced->data[13][2] = '';
|
||||
$table_advanced->data[13][3] = __('Retries');
|
||||
$table_advanced->data[13][4] = html_print_input_text('max_retries', $max_retries, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Number of retries that the module will attempt to run.'), true);
|
||||
$table_advanced->colspan[13][4] = 3;
|
||||
$table_advanced->data[15][0] = __('Timeout');
|
||||
$table_advanced->data[15][1] = html_print_input_text('max_timeout', $max_timeout, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Seconds that agent will wait for the execution of the module.'), true);
|
||||
$table_advanced->data[15][2] = '';
|
||||
$table_advanced->data[15][3] = __('Retries');
|
||||
$table_advanced->data[15][4] = html_print_input_text('max_retries', $max_retries, '', 5, 10, true, $disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy).' '.ui_print_help_tip(__('Number of retries that the module will attempt to run.'), true);
|
||||
$table_advanced->colspan[15][4] = 3;
|
||||
|
||||
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||
$table_advanced->data[14][0] = __('Category');
|
||||
$table_advanced->data[14][1] = html_print_select(
|
||||
$table_advanced->data[16][0] = __('Category');
|
||||
$table_advanced->data[16][1] = html_print_select(
|
||||
categories_get_all_categories('forselect'),
|
||||
'id_category',
|
||||
$id_category,
|
||||
|
@ -935,16 +1074,16 @@ if (check_acl($config['id_user'], 0, 'PM')) {
|
|||
'',
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->colspan[14][1] = 6;
|
||||
$table_advanced->colspan[16][1] = 6;
|
||||
} else {
|
||||
// Store in a hidden field if is not visible to avoid delete the value
|
||||
$table_advanced->data[13][4] .= html_print_input_hidden('id_category', $id_category, true);
|
||||
$table_advanced->data[15][4] .= html_print_input_hidden('id_category', $id_category, true);
|
||||
}
|
||||
|
||||
if (!$in_policy) {
|
||||
// Cannot select the current module to be itself parent.
|
||||
$module_parent_filter = ($id_agent_module) ? ['tagente_modulo.id_agente_modulo' => "<>$id_agent_module"] : '';
|
||||
$table_advanced->data[15][0] = __('Module parent');
|
||||
$table_advanced->data[17][0] = __('Module parent');
|
||||
$modules_can_be_parent = agents_get_modules(
|
||||
$id_agente,
|
||||
false,
|
||||
|
@ -954,14 +1093,14 @@ if (!$in_policy) {
|
|||
if ($parent_module_id != 0
|
||||
&& !in_array($parent_module_id, array_keys($modules_can_be_parent))
|
||||
) {
|
||||
$table_advanced->data[15][1] = db_get_value(
|
||||
$table_advanced->data[17][1] = db_get_value(
|
||||
'nombre',
|
||||
'tagente_modulo',
|
||||
'id_agente_modulo',
|
||||
$parent_module_id
|
||||
);
|
||||
} else {
|
||||
$table_advanced->data[15][1] = html_print_select(
|
||||
$table_advanced->data[17][1] = html_print_select(
|
||||
$modules_can_be_parent,
|
||||
'parent_module_id',
|
||||
$parent_module_id,
|
||||
|
@ -973,142 +1112,6 @@ if (!$in_policy) {
|
|||
}
|
||||
}
|
||||
|
||||
$table_advanced->data[16][0] = __('Dynamic Threshold Interval');
|
||||
$table_advanced->data[16][1] = html_print_extended_select_for_time(
|
||||
'dynamic_interval',
|
||||
$dynamic_interval,
|
||||
'',
|
||||
'None',
|
||||
'0',
|
||||
10,
|
||||
true,
|
||||
'width:150px',
|
||||
false,
|
||||
$classdisabledBecauseInPolicy,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[16][1] .= '<a onclick=advanced_option_dynamic()>'.html_print_image('images/cog.png', true, ['title' => __('Advanced options Dynamic Threshold')]).'</a>';
|
||||
|
||||
$table_advanced->cellclass[16][2] = 'hide_dinamic';
|
||||
$table_advanced->cellclass[16][3] = 'hide_dinamic';
|
||||
|
||||
|
||||
$table_advanced->data[16][2] = '<span><em>'.__('Dynamic Threshold Min. ').'</em>';
|
||||
$table_advanced->data[16][2] .= html_print_input_text(
|
||||
'dynamic_min',
|
||||
$dynamic_min,
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[16][2] .= '<br /><em>'.__('Dynamic Threshold Max. ').'</em>';
|
||||
$table_advanced->data[16][2] .= html_print_input_text(
|
||||
'dynamic_max',
|
||||
$dynamic_max,
|
||||
'',
|
||||
10,
|
||||
255,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[16][3] = '<span><em>'.__('Dynamic Threshold Two Tailed: ').'</em>';
|
||||
$table_advanced->data[16][3] .= html_print_checkbox('dynamic_two_tailed', 1, $dynamic_two_tailed, true, $disabledBecauseInPolicy);
|
||||
|
||||
|
||||
|
||||
// FF stands for Flip-flop.
|
||||
$table_advanced->data[17][0] = __('FF threshold').' ';
|
||||
|
||||
$table_advanced->data[17][1] .= __('Keep counters');
|
||||
$table_advanced->data[17][1] .= html_print_checkbox(
|
||||
'ff_type',
|
||||
1,
|
||||
$ff_type,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
).'<br />';
|
||||
|
||||
$table_advanced->data[17][1] .= html_print_radio_button(
|
||||
'each_ff',
|
||||
0,
|
||||
'',
|
||||
$each_ff,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
$table_advanced->data[17][1] .= ' '.__('All state changing').' : ';
|
||||
$table_advanced->data[17][1] .= html_print_input_text(
|
||||
'ff_event',
|
||||
$ff_event,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).'<br />';
|
||||
$table_advanced->data[17][1] .= html_print_radio_button(
|
||||
'each_ff',
|
||||
1,
|
||||
'',
|
||||
$each_ff,
|
||||
true,
|
||||
$disabledBecauseInPolicy
|
||||
);
|
||||
|
||||
$table_advanced->data[17][1] .= ' '.__('Each state changing').' : ';
|
||||
$table_advanced->data[17][1] .= __('To normal');
|
||||
$table_advanced->data[17][1] .= html_print_input_text(
|
||||
'ff_event_normal',
|
||||
$ff_event_normal,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).' ';
|
||||
|
||||
$table_advanced->data[17][1] .= __('To warning');
|
||||
$table_advanced->data[17][1] .= html_print_input_text(
|
||||
'ff_event_warning',
|
||||
$ff_event_warning,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
).' ';
|
||||
|
||||
$table_advanced->data[17][1] .= __('To critical');
|
||||
$table_advanced->data[17][1] .= html_print_input_text(
|
||||
'ff_event_critical',
|
||||
$ff_event_critical,
|
||||
'',
|
||||
5,
|
||||
15,
|
||||
true,
|
||||
$disabledBecauseInPolicy,
|
||||
false,
|
||||
'',
|
||||
$classdisabledBecauseInPolicy
|
||||
);
|
||||
|
||||
|
||||
// Advanced form part
|
||||
$table_macros = new stdClass();
|
||||
|
|
|
@ -97,6 +97,10 @@ if ($fields_selected[0] != '') {
|
|||
$result = __('Status');
|
||||
break;
|
||||
|
||||
case 'last_status_change':
|
||||
$result = __('Last status change');
|
||||
break;
|
||||
|
||||
case 'graph':
|
||||
$result = __('Graph');
|
||||
break;
|
||||
|
@ -112,10 +116,6 @@ if ($fields_selected[0] != '') {
|
|||
case 'timestamp':
|
||||
$result = __('Timestamp');
|
||||
break;
|
||||
|
||||
case 'to_critical':
|
||||
$result = __('Last status change');
|
||||
break;
|
||||
}
|
||||
|
||||
$result_selected[$field_selected] = $result;
|
||||
|
@ -146,11 +146,11 @@ $fields_available['module_name'] = __('Module name');
|
|||
$fields_available['server_type'] = __('Server type');
|
||||
$fields_available['interval'] = __('Interval');
|
||||
$fields_available['status'] = __('Status');
|
||||
$fields_available['last_status_change'] = __('Last status change');
|
||||
$fields_available['graph'] = __('Graph');
|
||||
$fields_available['warn'] = __('Warn');
|
||||
$fields_available['data'] = __('Data');
|
||||
$fields_available['timestamp'] = __('Timestamp');
|
||||
$fields_available['to_critical'] = __('Last status change');
|
||||
|
||||
// remove fields already selected
|
||||
foreach ($fields_available as $key => $available) {
|
||||
|
|
|
@ -175,6 +175,52 @@ if ($delete_action) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
$search_string = (string) get_parameter('search_string', '');
|
||||
$group = (int) get_parameter('group', 0);
|
||||
$url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions';
|
||||
|
||||
// Filter table.
|
||||
$table_filter = new stdClass();
|
||||
$table_filter->width = '100%';
|
||||
$table_filter->class = 'databox filters';
|
||||
$table_filter->style = [];
|
||||
$table_filter->style[0] = 'font-weight: bold';
|
||||
$table_filter->style[2] = 'font-weight: bold';
|
||||
$table_filter->data = [];
|
||||
|
||||
$table_filter->data[0][0] = __('Search');
|
||||
$table_filter->data[0][1] = html_print_input_text(
|
||||
'search_string',
|
||||
$search_string,
|
||||
'',
|
||||
25,
|
||||
255,
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][2] = __('Group');
|
||||
$table_filter->data[0][3] = html_print_select_groups($config['id_user'], 'LM', true, 'group', $group, '', '', 0, true);
|
||||
$table_filter->data[0][4] = '<div class="action-buttons">';
|
||||
$table_filter->data[0][4] .= html_print_submit_button(
|
||||
__('Search'),
|
||||
'',
|
||||
false,
|
||||
'class="sub search"',
|
||||
true
|
||||
);
|
||||
$table_filter->data[0][4] .= '</div>';
|
||||
|
||||
|
||||
$show_table_filter = '<form method="post" action="'.$url.'">';
|
||||
$show_table_filter .= html_print_table($table_filter, true);
|
||||
$show_table_filter .= '</form>';
|
||||
if (is_metaconsole()) {
|
||||
ui_toggle($show_table_filter, __('Show Options'));
|
||||
} else {
|
||||
echo $show_table_filter;
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
|
@ -196,10 +242,18 @@ $table->align[2] = 'left';
|
|||
$table->align[3] = 'left';
|
||||
|
||||
$filter = [];
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
if (!is_user_admin($config['id_user']) && $group === 0) {
|
||||
$filter['talert_actions.id_group'] = array_keys(users_get_groups(false, 'LM'));
|
||||
}
|
||||
|
||||
if ($group !== 0) {
|
||||
$filter['talert_actions.id_group'] = $group;
|
||||
}
|
||||
|
||||
if ($search_string !== '') {
|
||||
$filter['talert_actions.name'] = '%'.$search_string.'%';
|
||||
}
|
||||
|
||||
$actions = db_get_all_rows_filter(
|
||||
'talert_actions INNER JOIN talert_commands ON talert_actions.id_alert_command = talert_commands.id',
|
||||
$filter,
|
||||
|
@ -209,6 +263,12 @@ if ($actions === false) {
|
|||
$actions = [];
|
||||
}
|
||||
|
||||
// Pagination.
|
||||
$total_actions = count($actions);
|
||||
$offset = (int) get_parameter('offset');
|
||||
$limit = (int) $config['block_size'];
|
||||
$actions = array_slice($actions, $offset, $limit);
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($actions as $action) {
|
||||
|
@ -254,8 +314,10 @@ foreach ($actions as $action) {
|
|||
array_push($table->data, $data);
|
||||
}
|
||||
|
||||
ui_pagination($total_actions, $url);
|
||||
if (isset($data)) {
|
||||
html_print_table($table);
|
||||
ui_pagination($total_actions, $url, 0, 0, false, 'offset', true, 'pagination-bottom');
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No alert actions configured') ]);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,19 @@ if (is_ajax()) {
|
|||
|
||||
// If is setted a description, we change the carriage return by <br> tags
|
||||
if (isset($command['description'])) {
|
||||
$command['description'] = io_safe_input(str_replace("\r\n", '<br>', io_safe_output($command['description'])));
|
||||
$command['description'] = str_replace(
|
||||
[
|
||||
'<',
|
||||
'>',
|
||||
"\r\n",
|
||||
],
|
||||
[
|
||||
'',
|
||||
'',
|
||||
'<br>',
|
||||
],
|
||||
io_safe_output($command['description'])
|
||||
);
|
||||
}
|
||||
|
||||
// Descriptions are stored in json.
|
||||
|
@ -431,8 +443,16 @@ foreach ($commands as $command) {
|
|||
$data['id'] = $command['id'];
|
||||
$data['group'] = ui_print_group_icon($command['id_group'], true);
|
||||
$data['description'] = str_replace(
|
||||
"\r\n",
|
||||
'<br>',
|
||||
[
|
||||
'<',
|
||||
'>',
|
||||
"\r\n",
|
||||
],
|
||||
[
|
||||
'',
|
||||
'',
|
||||
'<br>',
|
||||
],
|
||||
io_safe_output($command['description'])
|
||||
);
|
||||
$data['action'] = '';
|
||||
|
|
|
@ -133,6 +133,16 @@ $sb_list = [];
|
|||
$sb_list[1] = __('Standby on');
|
||||
$sb_list[0] = __('Standby off');
|
||||
$form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true);
|
||||
$form_filter .= '</td>';
|
||||
$form_filter .= "</td><td style='font-weight: bold;'>".__('Group').'</td><td>';
|
||||
$own_info = get_user_info($config['id_user']);
|
||||
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
|
||||
$return_all_group = false;
|
||||
} else {
|
||||
$return_all_group = true;
|
||||
}
|
||||
|
||||
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false);
|
||||
$form_filter .= '</td></tr>';
|
||||
if (defined('METACONSOLE')) {
|
||||
$form_filter .= '<tr>';
|
||||
|
@ -214,7 +224,7 @@ $total = agents_get_alerts_simple(
|
|||
$where,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
$ag_group,
|
||||
true
|
||||
);
|
||||
|
||||
|
@ -375,7 +385,7 @@ switch ($sortField) {
|
|||
break;
|
||||
}
|
||||
|
||||
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby;
|
||||
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group;
|
||||
$sort_params = '&sort_field='.$sortField.'&sort='.$sort;
|
||||
|
||||
if ($id_agente) {
|
||||
|
@ -394,7 +404,9 @@ $simple_alerts = agents_get_alerts_simple(
|
|||
'order' => $order,
|
||||
],
|
||||
$where,
|
||||
false
|
||||
false,
|
||||
false,
|
||||
$ag_group
|
||||
);
|
||||
|
||||
if (!$id_agente) {
|
||||
|
|
|
@ -67,6 +67,7 @@ $searchFlag = get_parameter('search', 0);
|
|||
$enabledisable = get_parameter('enabledisable', '');
|
||||
$standby = get_parameter('standby', '');
|
||||
$pure = get_parameter('pure', 0);
|
||||
$ag_group = get_parameter('ag_group', 0);
|
||||
$messageAction = '';
|
||||
|
||||
if ($update_alert) {
|
||||
|
|
|
@ -305,7 +305,7 @@ $(document).ready (function () {
|
|||
var origicommand_descriptionnal_command;
|
||||
|
||||
if (<?php echo (int) $id_command; ?>) {
|
||||
original_command = "<?php echo addslashes(io_safe_output(alerts_get_alert_command_command($id_command))); ?>";
|
||||
original_command = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_command($id_command)))); ?>";
|
||||
render_command_preview(original_command);
|
||||
command_description = "<?php echo str_replace("\r\n", '<br>', addslashes(io_safe_output(alerts_get_alert_command_description($id_command)))); ?>";
|
||||
|
||||
|
|
|
@ -290,6 +290,7 @@ function update_template($step)
|
|||
$max_alerts = (int) get_parameter('max_alerts');
|
||||
$min_alerts = (int) get_parameter('min_alerts');
|
||||
$min_alerts_reset_counter = (int) get_parameter('min_alerts_reset_counter');
|
||||
$disable_event = (int) get_parameter('disable_event');
|
||||
$type = (string) get_parameter('type');
|
||||
$value = (string) html_entity_decode(get_parameter('value'));
|
||||
$max = (float) get_parameter('max');
|
||||
|
@ -320,6 +321,7 @@ function update_template($step)
|
|||
'max_value' => $max,
|
||||
'min_value' => $min,
|
||||
'matches_value' => $matches,
|
||||
'disable_event' => $disable_event,
|
||||
];
|
||||
|
||||
// Different datetimes format for oracle
|
||||
|
@ -532,6 +534,7 @@ if ($id && ! $create_template) {
|
|||
$max_alerts = $template['max_alerts'];
|
||||
$min_alerts = $template['min_alerts'];
|
||||
$min_alerts_reset_counter = $template['min_alerts_reset_counter'];
|
||||
$disable_event = $template['disable_event'];
|
||||
$threshold = $template['time_threshold'];
|
||||
$fields = [];
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
|
@ -578,8 +581,7 @@ if ($step == 2) {
|
|||
|
||||
// Firing conditions and events
|
||||
$table->colspan = [];
|
||||
$table->colspan[4][1] = 3;
|
||||
|
||||
// $table->colspan[4][1] = 1;
|
||||
$table->data[0][0] = __('Days of week');
|
||||
$table->data[0][1] = __('Mon');
|
||||
$table->data[0][1] .= html_print_checkbox('monday', 1, $monday, true);
|
||||
|
@ -653,6 +655,9 @@ if ($step == 2) {
|
|||
true
|
||||
);
|
||||
|
||||
$table->data[4][2] = __('Disable event');
|
||||
$table->data[4][3] = html_print_checkbox('disable_event', 1, $disable_event, true);
|
||||
|
||||
$table->data[5][0] = __('Default action');
|
||||
$usr_groups = implode(',', array_keys(users_get_groups($config['id_user'], 'LM', true)));
|
||||
switch ($config['dbtype']) {
|
||||
|
|
|
@ -443,37 +443,140 @@ if (($delete_group) && (check_acl($config['id_user'], 0, 'PM'))) {
|
|||
$usedGroup = groups_check_used($id_group);
|
||||
|
||||
if (!$usedGroup['return']) {
|
||||
$group = db_get_row_filter(
|
||||
'tgrupo',
|
||||
['id_grupo' => $id_group]
|
||||
);
|
||||
$errors_meta = false;
|
||||
if (is_metaconsole()) {
|
||||
$group_name = groups_get_name($id_group);
|
||||
$servers = metaconsole_get_servers();
|
||||
|
||||
db_process_sql_update(
|
||||
'tgrupo',
|
||||
['parent' => $group['parent']],
|
||||
['parent' => $id_group]
|
||||
);
|
||||
$error_counter = 0;
|
||||
$success_counter = 0;
|
||||
$success_nodes = [];
|
||||
$error_nodes = [];
|
||||
// Check if the group can be deleted or not.
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$result_exist_group = db_get_row_filter('tgrupo', ['nombre' => $group_name, 'id_grupo' => $id_group]);
|
||||
if ($result_exist_group !== false) {
|
||||
$used_group = groups_check_used($id_group);
|
||||
// Save the names of the nodes that are empty and can be deleted, and those that cannot.
|
||||
if (!$used_group['return']) {
|
||||
$success_nodes[] .= $server['server_name'];
|
||||
$success_counter++;
|
||||
} else {
|
||||
$error_nodes[] .= $server['server_name'];
|
||||
$error_counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = db_process_sql_delete(
|
||||
'tgroup_stat',
|
||||
['id_group' => $id_group]
|
||||
);
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$result = db_process_sql_delete(
|
||||
'tgrupo',
|
||||
['id_grupo' => $id_group]
|
||||
);
|
||||
if ($error_counter > 0) {
|
||||
ui_print_error_message(
|
||||
__('The group %s could not be deleted because it is not empty in the nodes', $group_name).': '.implode(', ', $error_nodes)
|
||||
);
|
||||
$errors_meta = true;
|
||||
} else {
|
||||
if ($success_counter > 0) {
|
||||
$error_deleting_counter = 0;
|
||||
$success_deleting_counter = 0;
|
||||
$error_deleting = [];
|
||||
$success_deleting = [];
|
||||
$error_connecting_node = [];
|
||||
// Delete the group in the nodes.
|
||||
foreach ($servers as $server) {
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$group = db_get_row_filter(
|
||||
'tgrupo',
|
||||
['id_grupo' => $id_group]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tgrupo',
|
||||
['parent' => $group['parent']],
|
||||
['parent' => $id_group]
|
||||
);
|
||||
|
||||
db_process_sql_delete(
|
||||
'tgroup_stat',
|
||||
['id_group' => $id_group]
|
||||
);
|
||||
|
||||
$result = db_process_sql_delete(
|
||||
'tgrupo',
|
||||
['id_grupo' => $id_group]
|
||||
);
|
||||
|
||||
if ($result === false) {
|
||||
$error_deleting[] .= $server['server_name'];
|
||||
$error_deleting_counter++;
|
||||
} else {
|
||||
$success_deleting[] .= $server['server_name'];
|
||||
$success_deleting_counter++;
|
||||
}
|
||||
} else {
|
||||
$error_deleting_counter++;
|
||||
$error_connecting_node[] .= $server['server_name'];
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
// If the group could not be deleted in any node, do not delete it in meta.
|
||||
if ($error_deleting_counter > 0) {
|
||||
$errors_meta = true;
|
||||
if (!empty($error_connecting_node)) {
|
||||
ui_print_error_message(__('Error connecting to %s', implode(', ', $error_connecting_node).'. The group has not been deleted in the metaconsole.'));
|
||||
}
|
||||
|
||||
if (!empty($error_deleting)) {
|
||||
ui_print_error_message(
|
||||
__('The group has not been deleted in the metaconsole due to an error in the node database').': '.implode(', ', $error_deleting)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($success_deleting_counter > 0) {
|
||||
ui_print_success_message(__('The group %s has been deleted in the nodes', $group_name).': '.implode(', ', $success_deleting));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors_meta === false) {
|
||||
$group = db_get_row_filter(
|
||||
'tgrupo',
|
||||
['id_grupo' => $id_group]
|
||||
);
|
||||
|
||||
db_process_sql_update(
|
||||
'tgrupo',
|
||||
['parent' => $group['parent']],
|
||||
['parent' => $id_group]
|
||||
);
|
||||
|
||||
$result = db_process_sql_delete(
|
||||
'tgroup_stat',
|
||||
['id_group' => $id_group]
|
||||
);
|
||||
|
||||
$result = db_process_sql_delete(
|
||||
'tgrupo',
|
||||
['id_grupo' => $id_group]
|
||||
);
|
||||
|
||||
if ($result && (!$usedGroup['return'])) {
|
||||
ui_print_success_message(__('Group successfully deleted'));
|
||||
} else {
|
||||
ui_print_error_message(__('There was a problem deleting group'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ui_print_error_message(
|
||||
sprintf(__('The group is not empty. It is use in %s.'), implode(', ', $usedGroup['tables']))
|
||||
);
|
||||
}
|
||||
|
||||
if ($result && (!$usedGroup['return'])) {
|
||||
ui_print_success_message(__('Group successfully deleted'));
|
||||
} else {
|
||||
ui_print_error_message(__('There was a problem deleting group'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -636,7 +739,12 @@ if ($tab == 'tree') {
|
|||
]
|
||||
).'</a>';
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if (is_metaconsole()) {
|
||||
$confirm_message = __('Are you sure? This group will also be deleted in all the nodes.');
|
||||
} else {
|
||||
$confirm_message = __('Are you sure?');
|
||||
}
|
||||
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group').'. '.$confirm_message;
|
||||
}
|
||||
|
|
|
@ -186,11 +186,13 @@ $table->data[2][1] = html_print_select(
|
|||
|
||||
echo '<form method="post" id="form_agents" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=delete_agents">';
|
||||
html_print_table($table);
|
||||
if (!is_central_policies_on_node()) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
html_print_input_hidden('delete', 1);
|
||||
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'" onsubmit="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
html_print_input_hidden('delete', 1);
|
||||
html_print_submit_button(__('Delete'), 'go', false, 'class="sub delete"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
echo '<h3 class="error invisible" id="message"> </h3>';
|
||||
|
|
|
@ -101,10 +101,17 @@ function process_manage_delete($id_alert_template, $id_agents, $module_names)
|
|||
|
||||
$module_selection_mode = get_parameter('modules_selection_mode');
|
||||
|
||||
$alert_list = db_get_all_rows_filter('talert_template_modules', ['id_alert_template' => $id_alert_template], 'id_agent_module');
|
||||
|
||||
foreach ($module_names as $module) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
// The module can exist in several of the selected agents, but we have to check if it has an alert.
|
||||
foreach ($alert_list as $alert) {
|
||||
if ($alert['id_agent_module'] == $module_id['id_agente_modulo']) {
|
||||
$modules_id[] = $module_id['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -305,6 +305,10 @@ echo '</div>';
|
|||
</script>
|
||||
|
||||
<?php
|
||||
if (is_central_policies_on_node() && $option == 'delete_agents') {
|
||||
ui_print_warning_message(__('This node is configured with centralized mode. To delete an agent go to metaconsole.'));
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
echo '<form method="post" id="form_options" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations">';
|
||||
echo '<table border="0"><tr><td>';
|
||||
|
|
|
@ -18,7 +18,7 @@ check_login();
|
|||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access SNMP Group Management'
|
||||
|
@ -283,7 +283,6 @@ html_print_input_hidden('new', 1);
|
|||
html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
?>
|
||||
|
|
|
@ -16,7 +16,7 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access SNMO Groups Management'
|
||||
|
|
|
@ -33,7 +33,7 @@ check_login();
|
|||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
|
|
|
@ -31,7 +31,7 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
global $config;
|
||||
require_once $config['homedir'].'/include/graphs/functions_d3.php';
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
|
|
|
@ -31,7 +31,7 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Agent Management'
|
||||
|
|
|
@ -130,7 +130,7 @@ if ($update) {
|
|||
];
|
||||
|
||||
// Save filter args
|
||||
$values['filter_args'] = netflow_get_filter_arguments($values);
|
||||
$values['filter_args'] = netflow_get_filter_arguments($values, true);
|
||||
|
||||
$result = db_process_sql_update('tnetflow_filter', $values, ['id_sg' => $id]);
|
||||
|
||||
|
@ -164,7 +164,7 @@ if ($create) {
|
|||
];
|
||||
|
||||
// Save filter args
|
||||
$values['filter_args'] = netflow_get_filter_arguments($values);
|
||||
$values['filter_args'] = netflow_get_filter_arguments($values, true);
|
||||
|
||||
$id = db_process_sql_insert('tnetflow_filter', $values);
|
||||
if ($id === false) {
|
||||
|
|
|
@ -94,7 +94,7 @@ require_once $config['homedir'].'/include/functions_filemanager.php';
|
|||
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
||||
if (! check_acl($config['id_user'], 0, 'PM') && ! check_acl($config['id_user'], 0, 'AW')) {
|
||||
db_pandora_audit(
|
||||
'ACL Violation',
|
||||
'Trying to access Plugin Management'
|
||||
|
|
|
@ -170,6 +170,7 @@ if ($save_alert || $modify_alert) {
|
|||
$trap_type = (int) get_parameter('trap_type', -1);
|
||||
$single_value = (string) get_parameter('single_value');
|
||||
$position = (int) get_parameter('position');
|
||||
$disable_event = (int) get_parameter('disable_event');
|
||||
$group = (int) get_parameter('group');
|
||||
|
||||
if ($time_threshold == -1) {
|
||||
|
@ -245,6 +246,7 @@ if ($save_alert || $modify_alert) {
|
|||
'trap_type' => $trap_type,
|
||||
'single_value' => $single_value,
|
||||
'position' => $position,
|
||||
'disable_event' => $disable_event,
|
||||
'id_group' => $group,
|
||||
];
|
||||
|
||||
|
@ -296,8 +298,8 @@ if ($save_alert || $modify_alert) {
|
|||
order_11 = '%d', order_12 = '%d', order_13 = '%d',
|
||||
order_14 = '%d', order_15 = '%d', order_16 = '%d',
|
||||
order_17 = '%d', order_18 = '%d', order_19 = '%d',
|
||||
order_20 = '%d', trap_type = %d,
|
||||
single_value = '%s', position = '%s', id_group ='%s'
|
||||
order_20 = '%d', trap_type = %d, single_value = '%s',
|
||||
position = '%s', disable_event = %d, id_group ='%s'
|
||||
WHERE id_as = %d",
|
||||
$priority,
|
||||
$alert_type,
|
||||
|
@ -366,6 +368,7 @@ if ($save_alert || $modify_alert) {
|
|||
$trap_type,
|
||||
$single_value,
|
||||
$position,
|
||||
$disable_event,
|
||||
$group,
|
||||
$id_as
|
||||
);
|
||||
|
@ -460,6 +463,7 @@ if ($update_alert || $duplicate_alert) {
|
|||
$trap_type = $alert['trap_type'];
|
||||
$single_value = $alert['single_value'];
|
||||
$position = $alert['position'];
|
||||
$disable_event = $alert['disable_event'];
|
||||
$group = $alert['id_group'];
|
||||
} else if ($create_alert) {
|
||||
// Variable init
|
||||
|
@ -532,6 +536,7 @@ if ($update_alert || $duplicate_alert) {
|
|||
$trap_type = -1;
|
||||
$single_value = '';
|
||||
$position = 0;
|
||||
$disable_event = 0;
|
||||
$group = 0;
|
||||
}
|
||||
|
||||
|
@ -566,7 +571,7 @@ if ($duplicate_alert) {
|
|||
'.db_escape_key_identifier('_snmp_f18_').',
|
||||
'.db_escape_key_identifier('_snmp_f19_').',
|
||||
'.db_escape_key_identifier('_snmp_f20_').",
|
||||
trap_type, single_value, position, id_group,
|
||||
trap_type, single_value, position, disable_event, id_group,
|
||||
order_1, order_2, order_3, order_4, order_5, order_6, order_7, order_8,
|
||||
order_9, order_10, order_11, order_12, order_13, order_14, order_15,
|
||||
order_16, order_17, order_18, order_19, order_20)
|
||||
|
@ -574,7 +579,7 @@ if ($duplicate_alert) {
|
|||
(%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
|
||||
'%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s',
|
||||
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',
|
||||
'%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d,
|
||||
'%s', '%s', '%s', '%s', %d, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d,
|
||||
%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
|
||||
$id_alert,
|
||||
$al_field1,
|
||||
|
@ -627,6 +632,7 @@ if ($duplicate_alert) {
|
|||
$trap_type,
|
||||
$single_value,
|
||||
$position,
|
||||
$disable_event,
|
||||
$group,
|
||||
$order_1,
|
||||
$order_2,
|
||||
|
@ -1080,6 +1086,10 @@ if ($create_alert || $update_alert) {
|
|||
|
||||
html_print_input_text('position', $position, '', 3);
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td class="datos">'.__('Disable event').'</td><td class="datos">';
|
||||
|
||||
html_print_checkbox('disable_event', 1, $disable_event, false);
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
|
||||
echo "<table style='width:100%'>";
|
||||
|
|
|
@ -16,6 +16,10 @@ global $config;
|
|||
|
||||
check_login();
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
use PandoraFMS\Dashboard\Manager;
|
||||
|
||||
enterprise_hook('open_meta_frame');
|
||||
|
||||
require_once $config['homedir'].'/include/functions_profile.php';
|
||||
|
@ -31,7 +35,6 @@ if (enterprise_installed() && defined('METACONSOLE')) {
|
|||
}
|
||||
|
||||
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
|
||||
enterprise_include_once('include/functions_dashboard.php');
|
||||
|
||||
// Add the columns for the enterprise Pandora edition.
|
||||
$enterprise_include = false;
|
||||
|
@ -833,27 +836,27 @@ $values = [
|
|||
'External link' => __('External link'),
|
||||
'Other' => __('Other'),
|
||||
];
|
||||
if (enterprise_installed() && !is_metaconsole()) {
|
||||
if (!is_metaconsole()) {
|
||||
$values['Dashboard'] = __('Dashboard');
|
||||
}
|
||||
|
||||
|
||||
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info['section']), 'show_data_section();', '', -1, true, false, false);
|
||||
|
||||
if (enterprise_installed()) {
|
||||
$dashboards = dashboard_get_dashboards();
|
||||
$dashboards_aux = [];
|
||||
if ($dashboards === false) {
|
||||
$dashboards = ['None' => 'None'];
|
||||
} else {
|
||||
foreach ($dashboards as $key => $dashboard) {
|
||||
$dashboards_aux[$dashboard['name']] = $dashboard['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[12][1] .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
|
||||
$dashboards = Manager::getDashboards(-1, -1);
|
||||
$dashboards_aux = [];
|
||||
if ($dashboards === false) {
|
||||
$dashboards = ['None' => 'None'];
|
||||
} else {
|
||||
foreach ($dashboards as $key => $dashboard) {
|
||||
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[12][1] .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
|
||||
|
||||
|
||||
$layouts = visual_map_get_user_layouts($config['id_user'], true);
|
||||
$layouts_aux = [];
|
||||
if ($layouts === false) {
|
||||
|
|
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.1 KiB |
|
@ -24,6 +24,7 @@ $disable_alert = (bool) get_parameter('disable_alert');
|
|||
$enable_alert = (bool) get_parameter('enable_alert');
|
||||
$get_actions_module = (bool) get_parameter('get_actions_module');
|
||||
$show_update_action_menu = (bool) get_parameter('show_update_action_menu');
|
||||
$get_agent_alerts_agent_view = (bool) get_parameter('get_agent_alerts_agent_view');
|
||||
|
||||
if ($get_agent_alerts_simple) {
|
||||
$id_agent = (int) get_parameter('id_agent');
|
||||
|
@ -75,6 +76,258 @@ if ($get_agent_alerts_simple) {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($get_agent_alerts_agent_view) {
|
||||
include_once $config['homedir'].'/include/functions_agents.php';
|
||||
include_once $config['homedir'].'/operation/agentes/alerts_status.functions.php';
|
||||
include_once $config['homedir'].'/include/functions_users.php';
|
||||
|
||||
$agent_a = check_acl($config['id_user'], 0, 'AR');
|
||||
$agent_w = check_acl($config['id_user'], 0, 'AW');
|
||||
$access = ($agent_a == true) ? 'AR' : (($agent_w == true) ? 'AW' : 'AR');
|
||||
|
||||
$free_search_alert = get_parameter('free_search_alert', '');
|
||||
$all_groups = json_decode(io_safe_output(get_parameter('all_groups')));
|
||||
$idAgent = (int) get_parameter('id_agent');
|
||||
$filter = get_parameter('filter', 'all_enabled');
|
||||
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$idAgent;
|
||||
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
$selected = true;
|
||||
$selectModuleUp = false;
|
||||
$selectModuleDown = false;
|
||||
$selectTemplateUp = false;
|
||||
$selectTemplateDown = false;
|
||||
$selectLastFiredUp = false;
|
||||
$selectLastFiredDown = false;
|
||||
switch ($sortField) {
|
||||
case 'module':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectModuleUp = $selected;
|
||||
$order = [
|
||||
'field' => 'agent_module_name',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectModuleDown = $selected;
|
||||
$order = [
|
||||
'field' => 'agent_module_name',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'template':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectTemplateUp = $selected;
|
||||
$order = [
|
||||
'field' => 'template_name',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectTemplateDown = $selected;
|
||||
$order = [
|
||||
'field' => 'template_name',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'last_fired':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectLastFiredUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_fired',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectLastFiredDown = $selected;
|
||||
$order = [
|
||||
'field' => 'last_fired',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$selectDisabledUp = '';
|
||||
$selectDisabledDown = '';
|
||||
$selectModuleUp = $selected;
|
||||
$selectModuleDown = false;
|
||||
$selectTemplateUp = false;
|
||||
$selectTemplateDown = false;
|
||||
$selectLastFiredUp = false;
|
||||
$selectLastFiredDown = false;
|
||||
$order = [
|
||||
'field' => 'agent_module_name',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
if ($free_search_alert != '') {
|
||||
$whereAlertSimple = 'AND ('.'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE name LIKE "%'.$free_search_alert.'%") OR '.'id_alert_template IN (
|
||||
SELECT id
|
||||
FROM talert_templates
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'talert_template_modules.id IN (
|
||||
SELECT id_alert_template_module
|
||||
FROM talert_template_module_actions
|
||||
WHERE id_alert_action IN (
|
||||
SELECT id
|
||||
FROM talert_actions
|
||||
WHERE name LIKE "%'.$free_search_alert.'%")) OR '.'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE nombre LIKE "%'.$free_search_alert.'%") OR '.'id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE alias LIKE "%'.$free_search_alert.'%")'.')';
|
||||
} else {
|
||||
$whereAlertSimple = '';
|
||||
}
|
||||
|
||||
// Add checks for user ACL.
|
||||
$groups = users_get_groups($config['id_user'], $access);
|
||||
$id_groups = array_keys($groups);
|
||||
|
||||
if (empty($id_groups)) {
|
||||
$whereAlertSimple .= ' AND (1 = 0) ';
|
||||
} else {
|
||||
$whereAlertSimple .= sprintf(
|
||||
' AND id_agent_module IN (
|
||||
SELECT tam.id_agente_modulo
|
||||
FROM tagente_modulo tam
|
||||
WHERE tam.id_agente IN (SELECT ta.id_agente
|
||||
FROM tagente ta LEFT JOIN tagent_secondary_group tasg ON
|
||||
ta.id_agente = tasg.id_agent
|
||||
WHERE (ta.id_grupo IN (%s) OR tasg.id_group IN (%s)))) ',
|
||||
implode(',', $id_groups),
|
||||
implode(',', $id_groups)
|
||||
);
|
||||
}
|
||||
|
||||
$alerts = [];
|
||||
|
||||
$filter_alert = [];
|
||||
if ($filter_standby == 'standby_on') {
|
||||
$filter_alert['disabled'] = $filter;
|
||||
$filter_alert['standby'] = '1';
|
||||
} else if ($filter_standby == 'standby_off') {
|
||||
$filter_alert['disabled'] = $filter;
|
||||
$filter_alert['standby'] = '0';
|
||||
} else {
|
||||
$filter_alert['disabled'] = $filter;
|
||||
}
|
||||
|
||||
$options_simple = ['order' => $order];
|
||||
|
||||
$alerts['alerts_simple'] = agents_get_alerts_simple($idAgent, $filter_alert, $options_simple, $whereAlertSimple, false, false, false, false, $strict_user, $tag_filter);
|
||||
$countAlertsSimple = agents_get_alerts_simple($idAgent, $filter_alert, false, $whereAlertSimple, false, false, false, true, $strict_user, $tag_filter);
|
||||
|
||||
// Urls to sort the table.
|
||||
$url_up_module = $url.'&sort_field=module&sort=up';
|
||||
$url_down_module = $url.'&sort_field=module&sort=down';
|
||||
$url_up_template = $url.'&sort_field=template&sort=up';
|
||||
$url_down_template = $url.'&sort_field=template&sort=down';
|
||||
$url_up_lastfired = $url.'&sort_field=last_fired&sort=up';
|
||||
$url_down_lastfired = $url.'&sort_field=last_fired&sort=down';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'info_table';
|
||||
$table->cellpadding = '0';
|
||||
$table->cellspacing = '0';
|
||||
$table->size = [];
|
||||
$table->head = [];
|
||||
$table->align = [];
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[7] = '5%';
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
|
||||
$table->head[8] = __('Validate');
|
||||
$table->align[8] = 'left';
|
||||
$table->size[8] = '5%';
|
||||
}
|
||||
|
||||
$table->head[0] = "<span title='".__('Policy')."'>".__('P.').'</span>';
|
||||
$table->head[1] = "<span title='".__('Standby')."'>".__('S.').'</span>';
|
||||
|
||||
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
|
||||
$table->head[2] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
|
||||
}
|
||||
|
||||
$table->head[3] = __('Module');
|
||||
$table->head[4] = __('Template');
|
||||
$table->head[5] = __('Action');
|
||||
$table->head[6] = __('Last fired');
|
||||
$table->head[7] = __('Status');
|
||||
|
||||
$table->align[7] = 'center';
|
||||
|
||||
$table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
||||
$table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
||||
$table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
|
||||
} else {
|
||||
$table->size[6] = '5%';
|
||||
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
$table->head[7] = __('Validate');
|
||||
$table->align[7] = 'left';
|
||||
$table->size[7] = '5%';
|
||||
}
|
||||
|
||||
$table->head[0] = "<span title='".__('Standby')."'>".__('S.').'</span>';
|
||||
|
||||
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
$table->head[1] = "<span title='".__('Force execution')."'>".__('F.').'</span>';
|
||||
}
|
||||
|
||||
$table->head[2] = __('Module');
|
||||
$table->head[3] = __('Template');
|
||||
$table->head[4] = __('Action');
|
||||
$table->head[5] = __('Last fired');
|
||||
$table->head[6] = __('Status');
|
||||
|
||||
$table->align[6] = 'center';
|
||||
|
||||
$table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown);
|
||||
$table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown);
|
||||
$table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown);
|
||||
}
|
||||
|
||||
$table->data = [];
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($alerts['alerts_simple'] as $alert) {
|
||||
$row = ui_format_alert_row($alert, false, $url, 'font-size: 7pt;');
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
if (!empty($table->data)) {
|
||||
html_print_table($table);
|
||||
} else {
|
||||
ui_print_info_message(['no_close' => true, 'message' => __('No alerts found') ]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($enable_alert) {
|
||||
if (! check_acl($config['id_user'], 0, 'LW')) {
|
||||
db_pandora_audit(
|
||||
|
|
|
@ -923,7 +923,7 @@ if ($perform_event_response) {
|
|||
|
||||
$event_response = db_get_row('tevent_response', 'id', $response_id);
|
||||
|
||||
$command_timeout = $event_response['command_timeout'];
|
||||
$command_timeout = $event_response !== false ? $event_response['command_timeout'] : 90;
|
||||
|
||||
if (enterprise_installed()) {
|
||||
if ($event_response['server_to_exec'] != 0 && $event_response['type'] == 'command') {
|
||||
|
|
|
@ -64,7 +64,6 @@ if ($print_custom_graph) {
|
|||
'only_image' => (bool) get_parameter('only_image', false),
|
||||
'homeurl' => (string) get_parameter('homeurl', ''),
|
||||
'ttl' => (int) get_parameter('ttl', 1),
|
||||
'dashboard' => (bool) get_parameter('dashboard', false),
|
||||
'vconsole' => (bool) get_parameter('vconsole', false),
|
||||
'fullscale' => (bool) get_parameter('fullscale', false),
|
||||
'backgroundColor' => (string) get_parameter('background_color', 'white'),
|
||||
|
@ -114,7 +113,6 @@ if ($print_sparse_graph) {
|
|||
'menu' => (bool) get_parameter('menu', true),
|
||||
'backgroundColor' => (string) get_parameter('background_color', 'white'),
|
||||
'percentil' => get_parameter('percentil', null),
|
||||
'dashboard' => (bool) get_parameter('dashboard'),
|
||||
'vconsole' => (bool) get_parameter('vconsole'),
|
||||
'type_graph' => get_parameter('type_g', $config['type_module_charts']),
|
||||
'fullscale' => get_parameter('fullscale', 0),
|
||||
|
|
|
@ -1028,7 +1028,10 @@ if (check_login()) {
|
|||
$title
|
||||
);
|
||||
|
||||
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true);
|
||||
$last_status_change_text = 'Time elapsed since last status change: ';
|
||||
$last_status_change_text .= !empty($module['last_status_change']) ? human_time_comparation($module['last_status_change']) : __('N/A');
|
||||
|
||||
$data[5] = ui_print_status_image($status, htmlspecialchars($title), true, false, false, false, $last_status_change_text);
|
||||
if (!$show_context_help_first_time) {
|
||||
$show_context_help_first_time = true;
|
||||
|
||||
|
|
|
@ -14,28 +14,8 @@
|
|||
if (is_ajax()) {
|
||||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_dashboard.php');
|
||||
|
||||
$public_hash = get_parameter('hash', 0);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash == 0) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
[
|
||||
$public_hash,
|
||||
'tree_view',
|
||||
]
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit('Invalid public hash', 'Trying to access report builder');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
include_once $config['homedir'].'/include/class/Tree.class.php';
|
||||
include_once $config['homedir'].'/include/class/TreeOS.class.php';
|
||||
|
@ -61,10 +41,6 @@ if (is_ajax()) {
|
|||
$rootID = get_parameter('rootID', -1);
|
||||
$serverID = get_parameter('serverID', false);
|
||||
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
|
||||
$hash = get_parameter('hash', false);
|
||||
if ($hash !== false) {
|
||||
enterprise_hook('dasboard_validate_public_hash', [$hash, 'tree_view']);
|
||||
}
|
||||
|
||||
$default_filters = [
|
||||
'searchAgent' => '',
|
||||
|
|
|
@ -12,32 +12,13 @@
|
|||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_dashboard.php');
|
||||
require_once 'include/functions_visual_map.php';
|
||||
enterprise_include_once('include/functions_visual_map.php');
|
||||
|
||||
$public_hash = get_parameter('hash', false);
|
||||
$id_visual_console = get_parameter('id_visual_console', null);
|
||||
|
||||
// Try to authenticate by hash on public dashboards
|
||||
if ($public_hash === false) {
|
||||
// Login check
|
||||
check_login();
|
||||
} else {
|
||||
$validate_hash = enterprise_hook(
|
||||
'dasboard_validate_public_hash',
|
||||
[
|
||||
$public_hash,
|
||||
$id_visual_console,
|
||||
'visual_console',
|
||||
]
|
||||
);
|
||||
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
|
||||
db_pandora_audit('Invalid public hash', 'Trying to access report builder');
|
||||
include 'general/noaccess.php';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
// Fix: IW was the old ACL to check for report editing, now is RW
|
||||
if (! check_acl($config['id_user'], 0, 'VR')) {
|
||||
|
|
|
@ -216,24 +216,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|||
break;
|
||||
|
||||
case 'vbar':
|
||||
echo flot_vcolumn_chart(
|
||||
$params['chart_data'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['color'],
|
||||
$params['legend'],
|
||||
$params['long_index'],
|
||||
$params['homeurl'],
|
||||
$params['unit'],
|
||||
$params['water_mark_url'],
|
||||
$params['homedir'],
|
||||
$params['font'],
|
||||
$config['font_size'],
|
||||
$params['from_ux'],
|
||||
$params['from_wux'],
|
||||
$params['backgroundColor'],
|
||||
$params['tick_color']
|
||||
);
|
||||
echo flot_vcolumn_chart($params);
|
||||
break;
|
||||
|
||||
case 'hbar':
|
||||
|
@ -292,7 +275,7 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
|
|||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
$params['ttl'],
|
||||
$params['widgets'],
|
||||
$params['sizeForTicks'],
|
||||
$params['show'],
|
||||
$params['date_to']
|
||||
);
|
||||
|
|
|
@ -2676,10 +2676,15 @@ class NetworkMap
|
|||
|
||||
$simulate = false;
|
||||
if (isset($networkmap['__simulated']) === false) {
|
||||
$networkmap['filter'] = json_decode(
|
||||
$networkmap['filter'],
|
||||
true
|
||||
);
|
||||
if ($this->widget) {
|
||||
$networkmap['filter'] = $this->mapOptions;
|
||||
} else {
|
||||
$networkmap['filter'] = json_decode(
|
||||
$networkmap['filter'],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$networkmap['filter']['holding_area'] = [
|
||||
500,
|
||||
500,
|
||||
|
@ -3460,7 +3465,11 @@ class NetworkMap
|
|||
// Open networkconsole_id div.
|
||||
$output .= '<div id="networkconsole_'.$networkmap['id'].'"';
|
||||
if ($this->fullSize) {
|
||||
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">';
|
||||
if ($this->widget) {
|
||||
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden;">';
|
||||
} else {
|
||||
$output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">';
|
||||
}
|
||||
} else {
|
||||
$output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">';
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ class OrderInterpreter extends Wizard
|
|||
'images/op_reporting.menu_gray.png'
|
||||
),
|
||||
'url' => ui_get_full_url(
|
||||
'index.php?sec=reporting&sec2=enterprise/dashboard/dashboards'
|
||||
'index.php?sec=reporting&sec2=operation/dashboard/dashboard'
|
||||
),
|
||||
'acl' => check_acl(
|
||||
$config['id_user'],
|
||||
|
|
|
@ -122,6 +122,8 @@ class TreeService extends Tree
|
|||
{
|
||||
$fields = $this->getFirstLevelFields();
|
||||
|
||||
$is_favourite = $this->getServiceFavouriteFilter();
|
||||
|
||||
if (users_can_manage_group_all('AR')) {
|
||||
$groups_acl = '';
|
||||
} else {
|
||||
|
@ -143,13 +145,15 @@ class TreeService extends Tree
|
|||
ON ts.id=tse.id_service
|
||||
WHERE
|
||||
1=1
|
||||
%s
|
||||
%s
|
||||
GROUP BY id
|
||||
) as t1
|
||||
ON tss.id_service_child = t1.id
|
||||
WHERE tss.id_service_child IS NULL
|
||||
",
|
||||
$groups_acl
|
||||
$groups_acl,
|
||||
$is_favourite
|
||||
);
|
||||
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
|
@ -364,4 +368,14 @@ class TreeService extends Tree
|
|||
}
|
||||
|
||||
|
||||
protected function getServiceFavouriteFilter()
|
||||
{
|
||||
if (isset($this->filter['is_favourite']) && !empty($this->filter['is_favourite'])) {
|
||||
return ' AND is_favourite = 1';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC200311';
|
||||
$build_version = 'PC200326';
|
||||
$pandora_version = 'v7.0NG.744';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -227,7 +227,7 @@ $config['extensions'] = extensions_get_extensions();
|
|||
// Detect if enterprise extension is installed
|
||||
// NOTICE: This variable (config[enterprise_installed] is used in several
|
||||
// sections. Faking or forcing to 1 will make pandora fails.
|
||||
if (file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/index.php')) {
|
||||
if (file_exists($config['homedir'].'/'.ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
$config['enterprise_installed'] = 1;
|
||||
enterprise_include_once('include/functions_enterprise.php');
|
||||
} else {
|
||||
|
|
|
@ -2482,12 +2482,12 @@ function get_os_name($id_os)
|
|||
function get_user_dashboards($id_user)
|
||||
{
|
||||
if (users_is_admin($id_user)) {
|
||||
$sql = "SELECT name
|
||||
$sql = "SELECT id, name
|
||||
FROM tdashboard WHERE id_user = '".$id_user."' OR id_user = ''";
|
||||
} else {
|
||||
$user_can_manage_all = users_can_manage_group_all('RR');
|
||||
if ($user_can_manage_all) {
|
||||
$sql = "SELECT name
|
||||
$sql = "SELECT id, name
|
||||
FROM tdashboard WHERE id_user = '".$id_user."' OR id_user = ''";
|
||||
} else {
|
||||
$user_groups = users_get_groups($id_user, 'RR', false);
|
||||
|
@ -2500,7 +2500,7 @@ function get_user_dashboards($id_user)
|
|||
$u_groups[] = $id;
|
||||
}
|
||||
|
||||
$sql = 'SELECT name
|
||||
$sql = 'SELECT id, name
|
||||
FROM tdashboard
|
||||
WHERE id_group IN ('.implode(',', $u_groups).") AND (id_user = '".$id_user."' OR id_user = '')";
|
||||
}
|
||||
|
@ -3870,12 +3870,17 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false
|
|||
$img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file;
|
||||
}
|
||||
|
||||
$width_img = 550;
|
||||
$height_img = $params['height'];
|
||||
if ($type_graph_pdf === 'vbar') {
|
||||
$width_img = $params['generals']['pdf']['width'];
|
||||
$height_img = $params['generals']['pdf']['height'];
|
||||
} else {
|
||||
$width_img = 550;
|
||||
$height_img = $params['height'];
|
||||
|
||||
if ((int) $params['landscape'] === 1) {
|
||||
$height_img = 150;
|
||||
$params['height'] = 150;
|
||||
if ((int) $params['landscape'] === 1) {
|
||||
$height_img = 150;
|
||||
$params['height'] = 150;
|
||||
}
|
||||
}
|
||||
|
||||
$params_encode_json = urlencode(json_encode($params));
|
||||
|
|
|
@ -295,10 +295,17 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
|
|||
|
||||
if (($id_agent !== false) && ($idGroup !== false)) {
|
||||
if ($idGroup != 0) {
|
||||
$has_secondary = enterprise_hook('agents_is_using_secondary_groups');
|
||||
// All group
|
||||
$subQuery = 'SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE delete_pending = 0 AND id_agente IN (SELECT id_agente FROM tagente WHERE id_grupo = '.$idGroup.')';
|
||||
WHERE delete_pending = 0 AND id_agente IN (SELECT id_agente FROM tagente WHERE id_grupo = '.$idGroup;
|
||||
|
||||
if ($has_secondary) {
|
||||
$subQuery .= ' OR tasg.id_group = '.$idGroup;
|
||||
}
|
||||
|
||||
$subQuery .= ')';
|
||||
} else {
|
||||
$subQuery = 'SELECT id_agente_modulo
|
||||
FROM tagente_modulo WHERE delete_pending = 0';
|
||||
|
@ -337,17 +344,31 @@ function agents_get_alerts_simple($id_agent=false, $filter='', $options=false, $
|
|||
$selectText = 'COUNT(talert_template_modules.id) AS count';
|
||||
}
|
||||
|
||||
$secondary_join = '';
|
||||
if ($idGroup) {
|
||||
if (isset($has_secondary) && $has_secondary) {
|
||||
$secondary_join = sprintf(
|
||||
'LEFT JOIN tagent_secondary_group tasg
|
||||
ON t3.id_agente = tasg.id_agent
|
||||
AND tasg.id_group = %d',
|
||||
$idGroup
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM talert_template_modules
|
||||
INNER JOIN tagente_modulo t2
|
||||
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
||||
INNER JOIN tagente t3
|
||||
ON t2.id_agente = t3.id_agente
|
||||
INNER JOIN talert_templates t4
|
||||
ON talert_template_modules.id_alert_template = t4.id
|
||||
INNER JOIN tagente_modulo t2
|
||||
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
||||
INNER JOIN tagente t3
|
||||
ON t2.id_agente = t3.id_agente
|
||||
%s
|
||||
INNER JOIN talert_templates t4
|
||||
ON talert_template_modules.id_alert_template = t4.id
|
||||
WHERE id_agent_module in (%s) %s %s %s',
|
||||
$selectText,
|
||||
$secondary_join,
|
||||
$subQuery,
|
||||
$where,
|
||||
$filter,
|
||||
|
@ -1057,7 +1078,7 @@ function agents_get_group_agents(
|
|||
}
|
||||
|
||||
if ($childGroups) {
|
||||
if (is_array($id_group)) {
|
||||
if (is_array($id_group) === true) {
|
||||
foreach ($id_group as $parent) {
|
||||
$id_group = array_merge(
|
||||
$id_group,
|
||||
|
@ -1077,7 +1098,7 @@ function agents_get_group_agents(
|
|||
}
|
||||
|
||||
// Search for primary and secondary groups.
|
||||
if (!empty($id_group)) {
|
||||
if (empty($id_group) === false) {
|
||||
$filter[] = '('.db_format_array_where_clause_sql(
|
||||
[
|
||||
'id_group' => $id_group,
|
||||
|
@ -1087,83 +1108,59 @@ function agents_get_group_agents(
|
|||
).')';
|
||||
}
|
||||
|
||||
if ($search === true) {
|
||||
// No added search. Show both disabled and non-disabled.
|
||||
} else if (is_array($search)) {
|
||||
if (is_array($search) === true) {
|
||||
if (!$search['all_agents']) {
|
||||
$filter['disabled'] = 0;
|
||||
if (isset($search['disabled'])) {
|
||||
if (isset($search['disabled']) === true) {
|
||||
$filter['disabled'] = (int) $search['disabled'];
|
||||
|
||||
unset($search['disabled']);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($search['string'])) {
|
||||
if (isset($search['string']) === true) {
|
||||
$string = io_safe_input($search['string']);
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$filter[] = "(nombre COLLATE utf8_general_ci LIKE '%$string%' OR direccion LIKE '%$string%')";
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$filter[] = "(UPPER(nombre) LIKE UPPER('%$string%') OR direccion LIKE upper('%$string%'))";
|
||||
break;
|
||||
}
|
||||
|
||||
$filter[] = "(nombre COLLATE utf8_general_ci LIKE '%$string%' OR direccion LIKE '%$string%')";
|
||||
unset($search['string']);
|
||||
}
|
||||
|
||||
if (isset($search['name'])) {
|
||||
if (isset($search['name']) === true) {
|
||||
$name = io_safe_input($search['name']);
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$filter[] = "nombre COLLATE utf8_general_ci LIKE '$name'";
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$filter[] = "UPPER(nombre) LIKE UPPER('$name')";
|
||||
break;
|
||||
}
|
||||
|
||||
$filter[] = "nombre COLLATE utf8_general_ci LIKE '$name'";
|
||||
unset($search['name']);
|
||||
}
|
||||
|
||||
if (isset($search['alias'])) {
|
||||
if (isset($search['alias']) === true) {
|
||||
$name = io_safe_input($search['alias']);
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$filter[] = "alias COLLATE utf8_general_ci LIKE '$name'";
|
||||
break;
|
||||
|
||||
case 'oracle':
|
||||
$filter[] = "UPPER(alias) LIKE UPPER('$name')";
|
||||
break;
|
||||
}
|
||||
|
||||
$filter[] = "alias COLLATE utf8_general_ci LIKE '$name'";
|
||||
unset($search['alias']);
|
||||
}
|
||||
|
||||
if (isset($search['id_os'])) {
|
||||
if (isset($search['aliasRegex']) === true) {
|
||||
$name = io_safe_input($search['aliasRegex']);
|
||||
$filter[] = sprintf(
|
||||
'alias COLLATE utf8_general_ci REGEXP "%s"',
|
||||
$name
|
||||
);
|
||||
unset($search['aliasRegex']);
|
||||
}
|
||||
|
||||
if (isset($search['id_os']) === true) {
|
||||
$filter['id_os'] = $search['id_os'];
|
||||
}
|
||||
|
||||
if (isset($search['status'])) {
|
||||
if (isset($search['status']) === true) {
|
||||
switch ($search['status']) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$filter[] = '(
|
||||
critical_count = 0
|
||||
AND warning_count = 0
|
||||
AND unknown_count = 0
|
||||
AND unknown_count = 0
|
||||
AND normal_count > 0)';
|
||||
break;
|
||||
|
||||
case AGENT_STATUS_WARNING:
|
||||
$filter[] = '(
|
||||
critical_count = 0
|
||||
critical_count = 0
|
||||
AND warning_count > 0
|
||||
AND total_count > 0)';
|
||||
break;
|
||||
|
@ -1174,8 +1171,8 @@ function agents_get_group_agents(
|
|||
|
||||
case AGENT_STATUS_UNKNOWN:
|
||||
$filter[] = '(
|
||||
critical_count = 0
|
||||
AND warning_count = 0
|
||||
critical_count = 0
|
||||
AND warning_count = 0
|
||||
AND unknown_count > 0)';
|
||||
break;
|
||||
|
||||
|
@ -1193,6 +1190,10 @@ function agents_get_group_agents(
|
|||
total_count = 0
|
||||
OR total_count = notinit_count)';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not posible.
|
||||
break;
|
||||
}
|
||||
|
||||
unset($search['status']);
|
||||
|
@ -1208,7 +1209,7 @@ function agents_get_group_agents(
|
|||
$filter['id_tmetaconsole_setup'] = $search['id_server'];
|
||||
|
||||
if ($filter['id_tmetaconsole_setup'] == 0) {
|
||||
// All nodes
|
||||
// All nodes.
|
||||
unset($filter['id_tmetaconsole_setup']);
|
||||
}
|
||||
|
||||
|
@ -1216,12 +1217,12 @@ function agents_get_group_agents(
|
|||
}
|
||||
|
||||
if (!$add_alert_bulk_op) {
|
||||
// Add the rest of the filter from the search array
|
||||
// Add the rest of the filter from the search array.
|
||||
foreach ($search as $key => $value) {
|
||||
$filter[] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if ($filter !== true) {
|
||||
$filter['disabled'] = 0;
|
||||
}
|
||||
|
||||
|
@ -3601,3 +3602,25 @@ function agents_get_sap_agents($id_agent)
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return time at which last status change of a module occured.
|
||||
*
|
||||
* @param integer $id_agent.
|
||||
* @return string timestamp.
|
||||
*/
|
||||
function agents_get_last_status_change($id_agent)
|
||||
{
|
||||
$sql = sprintf(
|
||||
'SELECT *
|
||||
FROM tagente_estado
|
||||
WHERE id_agente = %d
|
||||
ORDER BY last_status_change DESC',
|
||||
$id_agent
|
||||
);
|
||||
|
||||
$row = db_get_row_sql($sql);
|
||||
|
||||
return $row['last_status_change'];
|
||||
}
|
||||
|
|
|
@ -1868,6 +1868,12 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// Delete only if the centralised mode is disabled.
|
||||
if (is_central_policies_on_node()) {
|
||||
returnError('centralized');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($agent_by_alias) {
|
||||
$idsAgents = agents_get_agent_id_by_alias(io_safe_input($id));
|
||||
} else {
|
||||
|
|
|
@ -554,7 +554,7 @@ function cron_list_table()
|
|||
$data[2] .= '<br>- '.__('Template').': ';
|
||||
$data[2] .= '<a href="'.ui_get_full_url('index.php?sec=reporting&sec2=enterprise/godmode/reporting/reporting_builder.template&action=edit&id_template='.$args[0]).'">';
|
||||
$data[2] .= $template['name'].'</a>';
|
||||
$data[2] .= '<br>- '.__('Agents').': '.$agents_id.'</a>';
|
||||
$data[2] .= '<br>- '.__('Agents').': '.ui_print_truncate_text($agents_id, 120).'</a>';
|
||||
$data[2] .= '<br>- '.__('Report per agent').': '.$report_per_agent.'</a>';
|
||||
$data[2] .= '<br>- '.__('Report name').': '.$report_name.'</a>';
|
||||
$data[2] .= '<br>- '.__('Email').": <a href='mailto:".$email."'>".$email.'</a>';
|
||||
|
|
|
@ -1083,6 +1083,19 @@ function events_get_all(
|
|||
$tag_without = base64_decode($filter['tag_without']);
|
||||
$tags = json_decode($tag_without, true);
|
||||
if (is_array($tags) && !in_array('0', $tags)) {
|
||||
if (!$user_is_admin) {
|
||||
$user_tags = array_flip(tags_get_tags_for_module_search());
|
||||
if ($user_tags != null) {
|
||||
foreach ($tags as $key_tag => $id_tag) {
|
||||
// User cannot filter with those tags.
|
||||
if (!array_search($id_tag, $user_tags)) {
|
||||
unset($tags[$key_tag]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($tags as $id_tag) {
|
||||
if (!isset($tags_names[$id_tag])) {
|
||||
$tags_names[$id_tag] = tags_get_name($id_tag);
|
||||
|
@ -4797,7 +4810,7 @@ function events_page_comments($event, $ajax=false)
|
|||
__('Add comment'),
|
||||
'comment_button',
|
||||
false,
|
||||
'event_comment();',
|
||||
'event_comment(\''.base64_encode(json_encode($event)).'\');',
|
||||
'class="sub next"',
|
||||
true
|
||||
);
|
||||
|
|
|
@ -1720,6 +1720,10 @@ function graphic_combined_module(
|
|||
$params['threshold_data'] = $threshold_data;
|
||||
}
|
||||
|
||||
if ($params['vconsole'] === true) {
|
||||
$water_mark = false;
|
||||
}
|
||||
|
||||
$output = area_graph(
|
||||
$agent_module_id,
|
||||
$array_data,
|
||||
|
@ -1861,6 +1865,7 @@ function graphic_combined_module(
|
|||
$height = 50;
|
||||
} else {
|
||||
$height = ($height / $number_elements);
|
||||
$water_mark = false;
|
||||
}
|
||||
|
||||
$color = color_graph_array();
|
||||
|
@ -1983,18 +1988,25 @@ function graphic_combined_module(
|
|||
|
||||
$color = color_graph_array();
|
||||
|
||||
if (!$params['vconsole']) {
|
||||
if ($params['vconsole'] === false) {
|
||||
$width = 200;
|
||||
$height = 200;
|
||||
} else {
|
||||
$width = ($width / $number_elements);
|
||||
$height = ($height / $number_elements);
|
||||
$ratio = ((200 * ( $height / (200 * $number_elements) )) / (200 * ( $width / (200 * $number_elements))));
|
||||
|
||||
$new_width = ( 200 * ( $width / (200 * $number_elements) ) );
|
||||
$new_height = ( 200 * ( $height / (200 * $number_elements) / $ratio ) );
|
||||
|
||||
if ($height > $width) {
|
||||
$new_height = (200 * ($height / (200 * $number_elements)));
|
||||
$new_width = (200 * ($width / (200 * $number_elements)) / $ratio);
|
||||
}
|
||||
}
|
||||
|
||||
$output = stacked_gauge(
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
$new_width,
|
||||
$new_height,
|
||||
$color,
|
||||
$module_name_list,
|
||||
ui_get_full_url(
|
||||
|
@ -2015,10 +2027,10 @@ function graphic_combined_module(
|
|||
$label = '';
|
||||
foreach ($module_list as $module_item) {
|
||||
$automatic_custom_graph_meta = false;
|
||||
if ($config['metaconsole']) {
|
||||
if (is_metaconsole() === true) {
|
||||
// Automatic custom graph from the report
|
||||
// template in metaconsole.
|
||||
if (is_array($module_list[$i])) {
|
||||
if (is_array($module_list[$i]) === true) {
|
||||
$server = metaconsole_get_connection_by_id(
|
||||
$module_item['server']
|
||||
);
|
||||
|
@ -2027,7 +2039,7 @@ function graphic_combined_module(
|
|||
}
|
||||
}
|
||||
|
||||
if ($automatic_custom_graph_meta) {
|
||||
if ($automatic_custom_graph_meta === true) {
|
||||
$module = $module_item['module'];
|
||||
} else {
|
||||
$module = $module_item;
|
||||
|
@ -2035,8 +2047,7 @@ function graphic_combined_module(
|
|||
|
||||
$module_data = modules_get_agentmodule($module);
|
||||
$query_last_value = sprintf(
|
||||
'
|
||||
SELECT datos
|
||||
'SELECT datos
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp < %d
|
||||
|
@ -2050,8 +2061,8 @@ function graphic_combined_module(
|
|||
modules_get_agentmodule_agent_name($module)
|
||||
);
|
||||
|
||||
if (!empty($params_combined['labels'])
|
||||
&& isset($params_combined['labels'][$module])
|
||||
if (empty($params_combined['labels']) === false
|
||||
&& isset($params_combined['labels'][$module]) === true
|
||||
) {
|
||||
$label = $params_combined['labels'][$module];
|
||||
} else {
|
||||
|
@ -2061,15 +2072,30 @@ function graphic_combined_module(
|
|||
'id_agente',
|
||||
$module_data['id_agente']
|
||||
);
|
||||
$label = $alias.' - '.$module_data['nombre'];
|
||||
if ($params['vconsole'] === true) {
|
||||
if ($width < 250 || $height < 250) {
|
||||
$label = \ui_print_truncate_text($module_data['nombre'], 3, false);
|
||||
} else {
|
||||
$label = $module_data['nombre'];
|
||||
}
|
||||
} else {
|
||||
$label = $alias.' - '.$module_data['nombre'];
|
||||
}
|
||||
}
|
||||
|
||||
$temp[$label]['g'] = round($temp_data, 4);
|
||||
if ($params_combined['stacked'] == CUSTOM_GRAPH_VBARS) {
|
||||
$temp[] = [
|
||||
'tick' => $label,
|
||||
'data' => (int) round($temp_data, 4),
|
||||
];
|
||||
} else {
|
||||
$temp[$label]['g'] = round($temp_data, 4);
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
if (is_metaconsole() === true) {
|
||||
// Automatic custom graph from the report
|
||||
// template in metaconsole.
|
||||
if (is_array($module_list[0])) {
|
||||
if (is_array($module_list[0]) === true) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
@ -2079,12 +2105,14 @@ function graphic_combined_module(
|
|||
|
||||
$graph_values = $temp;
|
||||
|
||||
if (!$params['vconsole']) {
|
||||
$width = 1024;
|
||||
$height = 500;
|
||||
}
|
||||
|
||||
if ($params_combined['stacked'] == CUSTOM_GRAPH_HBARS) {
|
||||
if ($params['vconsole'] === false) {
|
||||
$width = 1024;
|
||||
$height = 500;
|
||||
} else {
|
||||
$water_mark = false;
|
||||
}
|
||||
|
||||
$output = hbar_graph(
|
||||
$graph_values,
|
||||
$width,
|
||||
|
@ -2112,32 +2140,27 @@ function graphic_combined_module(
|
|||
}
|
||||
|
||||
if ($params_combined['stacked'] == CUSTOM_GRAPH_VBARS) {
|
||||
$output = vbar_graph(
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$module_name_list,
|
||||
$long_index,
|
||||
ui_get_full_url(
|
||||
'images/image_problem_area_small.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$fixed_font_size,
|
||||
'',
|
||||
$ttl,
|
||||
$homeurl,
|
||||
$background_color,
|
||||
true,
|
||||
false,
|
||||
'#c1c1c1'
|
||||
);
|
||||
$options = [];
|
||||
$sizeLabelTickWidth = 85;
|
||||
if ($params['vconsole'] === true) {
|
||||
$water_mark = false;
|
||||
if (isset($width) === true) {
|
||||
$sizeLabelTickWidth = 30;
|
||||
}
|
||||
} else {
|
||||
$options['grid']['hoverable'] = true;
|
||||
}
|
||||
|
||||
$options['generals']['rotate'] = true;
|
||||
$options['generals']['forceTicks'] = true;
|
||||
$options['x']['labelWidth'] = $sizeLabelTickWidth;
|
||||
$options['generals']['arrayColors'] = $color;
|
||||
$options['grid']['backgroundColor'] = 'transparent';
|
||||
$options['grid']['backgroundColor'] = $background_color;
|
||||
$options['y']['color'] = $background_color;
|
||||
$options['x']['color'] = $background_color;
|
||||
|
||||
$output = vbar_graph($graph_values, $options, $ttl);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2176,6 +2199,7 @@ function graphic_combined_module(
|
|||
$datelimit,
|
||||
$params['date']
|
||||
);
|
||||
|
||||
$temp_data = db_get_value_sql($query_last_value);
|
||||
|
||||
if ($temp_data) {
|
||||
|
@ -2223,9 +2247,11 @@ function graphic_combined_module(
|
|||
|
||||
$graph_values = $temp;
|
||||
|
||||
if (!$params['vconsole']) {
|
||||
if ($params['vconsole'] === false) {
|
||||
$width = $width;
|
||||
$height = 500;
|
||||
} else {
|
||||
$water_mark = false;
|
||||
}
|
||||
|
||||
$color = color_graph_array();
|
||||
|
@ -2358,100 +2384,62 @@ function combined_graph_summatory_average(
|
|||
|
||||
|
||||
/**
|
||||
* Print a graph with access data of agents
|
||||
* Print a graph with access data of agents.
|
||||
*
|
||||
* @param integer $id_agent Agent ID.
|
||||
* @param integer $width Pie graph width.
|
||||
* @param integer $height Pie graph height.
|
||||
* @param integer $period Time period.
|
||||
* @param boolean $return Return.
|
||||
* @param boolean $tree View tree.
|
||||
* @param integer $id_agent Agent Id.
|
||||
* @param integer $period Timestamp period graph.
|
||||
* @param boolean|null $return Type return.
|
||||
*
|
||||
* @return string Return or echo the result flag.
|
||||
* @return string
|
||||
*/
|
||||
function graphic_agentaccess(
|
||||
$id_agent,
|
||||
$width,
|
||||
$height,
|
||||
$period=0,
|
||||
$return=false,
|
||||
$tree=false
|
||||
int $id_agent,
|
||||
int $period=0,
|
||||
?bool $return=false
|
||||
) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
// Dates.
|
||||
$date = get_system_time();
|
||||
$datelimit = ($date - $period);
|
||||
$data_array = [];
|
||||
$interval = agents_get_interval($id_agent);
|
||||
$interval = 3600;
|
||||
|
||||
$data = db_get_all_rows_sql(
|
||||
sprintf(
|
||||
'SELECT utimestamp, count(*) as data
|
||||
FROM tagent_access
|
||||
WHERE id_agent = %d
|
||||
AND utimestamp > %d
|
||||
AND utimestamp < %d
|
||||
GROUP BY ROUND(utimestamp/%d)',
|
||||
$id_agent,
|
||||
$datelimit,
|
||||
$date,
|
||||
$interval
|
||||
)
|
||||
// Query.
|
||||
$sql = sprintf(
|
||||
'SELECT utimestamp, count(*) as data
|
||||
FROM tagent_access
|
||||
WHERE id_agent = %d
|
||||
AND utimestamp >= %d
|
||||
AND utimestamp <= %d
|
||||
GROUP BY TRUNCATE(utimestamp/%d,0)',
|
||||
$id_agent,
|
||||
$datelimit,
|
||||
$date,
|
||||
$interval
|
||||
);
|
||||
|
||||
if (isset($data) && is_array($data)) {
|
||||
$data = db_get_all_rows_sql($sql);
|
||||
|
||||
// Array data.
|
||||
$data_array = [];
|
||||
if (isset($data) === true && is_array($data) === true) {
|
||||
foreach ($data as $key => $value) {
|
||||
$data_array['Agent access']['data'][$key][0] = ($value['utimestamp'] * 1000);
|
||||
$data_array['Agent access']['data'][$key][1] = $value['data'];
|
||||
}
|
||||
|
||||
$data_array['Agent access']['color'] = 'green';
|
||||
} else {
|
||||
if ($return) {
|
||||
return graph_nodata_image($width, $height);
|
||||
} else {
|
||||
echo graph_nodata_image($width, $height);
|
||||
$time = (date('H:m', $value['utimestamp']));
|
||||
$data_array[] = [
|
||||
'tick' => $time,
|
||||
'data' => (int) $value['data'],
|
||||
'color' => '#82b92f',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['fixed_graph'] == false) {
|
||||
$water_mark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
'url' => ui_get_full_url(
|
||||
'images/logo_vertical_water.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
];
|
||||
}
|
||||
$options = [];
|
||||
$options['grid']['hoverable'] = true;
|
||||
|
||||
$params = [
|
||||
'agent_module_id' => false,
|
||||
'period' => $period,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'unit' => $unit,
|
||||
'only_image' => $only_image,
|
||||
'homeurl' => $homeurl,
|
||||
'menu' => true,
|
||||
'backgroundColor' => 'transparent',
|
||||
'type_graph' => 'area',
|
||||
'font' => $config['fontpath'],
|
||||
'font_size' => $config['font_size'],
|
||||
'array_data_create' => $data_array,
|
||||
'show_overview' => false,
|
||||
'show_export_csv' => false,
|
||||
'vconsole' => true,
|
||||
'show_legend' => false,
|
||||
'grid_color' => 'grey',
|
||||
];
|
||||
|
||||
if ($return) {
|
||||
return grafico_modulo_sparse($params);
|
||||
if ($return === true) {
|
||||
return vbar_graph($data_array, $options, 1);
|
||||
} else {
|
||||
echo grafico_modulo_sparse($params);
|
||||
echo vbar_graph($data_array, $options, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3667,6 +3655,7 @@ function graph_custom_sql_graph(
|
|||
$data = [];
|
||||
|
||||
$count = 0;
|
||||
$flagOther = false;
|
||||
foreach ($data_result as $data_item) {
|
||||
$count++;
|
||||
$value = 0;
|
||||
|
@ -3688,7 +3677,13 @@ function graph_custom_sql_graph(
|
|||
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar':
|
||||
// vertical bar
|
||||
// Vertical bar.
|
||||
$data[] = [
|
||||
'tick' => $label.'_'.$count,
|
||||
'data' => $value,
|
||||
];
|
||||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
// horizontal bar
|
||||
$data[$label.'_'.$count]['g'] = $value;
|
||||
|
@ -3702,7 +3697,19 @@ function graph_custom_sql_graph(
|
|||
} else {
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar':
|
||||
// vertical bar
|
||||
// Vertical bar.
|
||||
if ($flagOther === false) {
|
||||
$data[] = [
|
||||
'tick' => __('Other'),
|
||||
'data' => $value,
|
||||
];
|
||||
|
||||
$flagOther = true;
|
||||
}
|
||||
|
||||
$data[(count($data) - 1)]['data'] += $value;
|
||||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
// horizontal bar
|
||||
if (!isset($data[__('Other')]['g'])) {
|
||||
|
@ -3733,28 +3740,32 @@ function graph_custom_sql_graph(
|
|||
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar':
|
||||
// vertical bar
|
||||
return vbar_graph(
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
[],
|
||||
[],
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
'',
|
||||
$ttl,
|
||||
$homeurl,
|
||||
'white',
|
||||
true,
|
||||
false,
|
||||
'#c1c1c1'
|
||||
);
|
||||
// Vertical bar.
|
||||
$color = color_graph_array();
|
||||
|
||||
$options = [];
|
||||
$options['generals']['rotate'] = true;
|
||||
$options['generals']['forceTicks'] = true;
|
||||
$options['generals']['arrayColors'] = $color;
|
||||
$options['x']['labelWidth'] = 75;
|
||||
if ($ttl === 2) {
|
||||
$options['backgroundColor'] = 'transparent';
|
||||
$options['grid']['backgroundColor'] = 'transparent';
|
||||
$options['y']['color'] = 'transparent';
|
||||
$options['x']['color'] = 'transparent';
|
||||
$options['generals']['pdf']['width'] = $width;
|
||||
$options['generals']['pdf']['height'] = $height;
|
||||
|
||||
$output .= '<img style="margin-left:20px;" src="data:image/jpg;base64,';
|
||||
$output .= vbar_graph($data, $options, $ttl);
|
||||
$output .= '" />';
|
||||
} else {
|
||||
$options['grid']['hoverable'] = true;
|
||||
$output = '<div style="width:100%; height:'.$height.'px">';
|
||||
$output .= vbar_graph($data, $options, $ttl);
|
||||
$output .= '</div>';
|
||||
}
|
||||
return $output;
|
||||
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
|
@ -3809,8 +3820,18 @@ function graph_custom_sql_graph(
|
|||
* @param string homeurl
|
||||
* @param bool return or echo the result
|
||||
*/
|
||||
function graph_graphic_agentevents($id_agent, $width, $height, $period=0, $homeurl, $return=false, $from_agent_view=false, $widgets=false)
|
||||
{
|
||||
function graph_graphic_agentevents(
|
||||
$id_agent,
|
||||
$width,
|
||||
$height,
|
||||
$period=0,
|
||||
$homeurl,
|
||||
$return=false,
|
||||
$from_agent_view=false,
|
||||
$widgets=false,
|
||||
$not_interactive=0,
|
||||
$server_id=''
|
||||
) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -3885,7 +3906,26 @@ function graph_graphic_agentevents($id_agent, $width, $height, $period=0, $homeu
|
|||
];
|
||||
|
||||
// Draw slicebar graph
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date, 0, 1, $widgets);
|
||||
$out = flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
$width,
|
||||
$height,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$id_agent,
|
||||
$full_legend_date,
|
||||
$not_interactive,
|
||||
1,
|
||||
$widgets,
|
||||
$server_id
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
@ -3905,8 +3945,17 @@ function graph_graphic_agentevents($id_agent, $width, $height, $period=0, $homeu
|
|||
* @param string homeurl
|
||||
* @param bool return or echo the result
|
||||
*/
|
||||
function graph_graphic_moduleevents($id_agent, $id_module, $width, $height, $period=0, $homeurl, $return=false, $ttl=1)
|
||||
{
|
||||
function graph_graphic_moduleevents(
|
||||
$id_agent,
|
||||
$id_module,
|
||||
$width,
|
||||
$height,
|
||||
$period=0,
|
||||
$homeurl='',
|
||||
$return=false,
|
||||
$ttl=1,
|
||||
$widthForTicks=false
|
||||
) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -3995,7 +4044,7 @@ function graph_graphic_moduleevents($id_agent, $id_module, $width, $height, $per
|
|||
[],
|
||||
true,
|
||||
$ttl,
|
||||
true
|
||||
$widthForTicks
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
|
@ -4851,8 +4900,13 @@ function graphic_module_events($id_module, $width, $height, $period=0, $homeurl=
|
|||
}
|
||||
|
||||
|
||||
function graph_nodata_image($width=300, $height=110, $type='area', $text='')
|
||||
{
|
||||
function graph_nodata_image(
|
||||
$width=300,
|
||||
$height=110,
|
||||
$type='area',
|
||||
$text='',
|
||||
$percent=false
|
||||
) {
|
||||
$image = ui_get_full_url(
|
||||
'images/image_problem_area.png',
|
||||
false,
|
||||
|
@ -4860,14 +4914,20 @@ function graph_nodata_image($width=300, $height=110, $type='area', $text='')
|
|||
false
|
||||
);
|
||||
|
||||
// if ($text == '') {
|
||||
// $text = __('No data to show');
|
||||
// }
|
||||
$text_div = '<div class="nodata_text" style="text-align:center; padding: 30px 0; display:block; font-size:9.5pt;">'.$text.'</div>';
|
||||
$style = 'text-align:center; padding: 30px 0; display:block; font-size:9.5pt;';
|
||||
$text_div = '<div class="nodata_text" style="'.$style.'">';
|
||||
$text_div .= $text;
|
||||
$text_div .= '</div>';
|
||||
|
||||
$image_div = $text_div.'<div class="nodata_container" style="background-position: top; width:40%;height:40%;background-size: contain;background-image: url(\''.$image.'\');"><div></div></div>';
|
||||
$style = 'background-size: contain;background-image: url(\''.$image.'\');';
|
||||
$image_div = '<div class="nodata_container" style="'.$style.'"></div>';
|
||||
|
||||
$div = '<div style="width:'.$width.'px; height:'.$height.'px; background-color: white; margin: 0 auto;">'.$image_div.'</div>';
|
||||
if ($percent === true) {
|
||||
$div = $image_div;
|
||||
} else {
|
||||
$style = 'width:'.$width.'px; height:'.$height.'px; background-color: white; margin: 0 auto;';
|
||||
$div = '<div style="'.$style.'">'.$image_div.'</div>';
|
||||
}
|
||||
|
||||
return $div;
|
||||
}
|
||||
|
|
|
@ -1270,8 +1270,21 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*',
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlength, $disabled, $script, $attributes, $return=false, $password=false, $function='', $autocomplete='off')
|
||||
{
|
||||
function html_print_input_text_extended(
|
||||
$name,
|
||||
$value,
|
||||
$id,
|
||||
$alt,
|
||||
$size,
|
||||
$maxlength,
|
||||
$disabled,
|
||||
$script,
|
||||
$attributes,
|
||||
$return=false,
|
||||
$password=false,
|
||||
$function='',
|
||||
$autocomplete='off'
|
||||
) {
|
||||
static $idcounter = 0;
|
||||
|
||||
if ($maxlength == 0) {
|
||||
|
@ -1288,6 +1301,7 @@ function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlen
|
|||
|
||||
$valid_attrs = [
|
||||
'accept',
|
||||
'autofocus',
|
||||
'disabled',
|
||||
'maxlength',
|
||||
'name',
|
||||
|
@ -1345,7 +1359,7 @@ function html_print_input_text_extended($name, $value, $id, $alt, $size, $maxlen
|
|||
$output .= 'alt="'.$alt.'" ';
|
||||
}
|
||||
|
||||
// Attributes specified by function call
|
||||
// Attributes specified by function call.
|
||||
$attrs = [
|
||||
'name' => 'unnamed',
|
||||
'value' => '',
|
||||
|
@ -1523,8 +1537,21 @@ function html_print_input_password(
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255, $return=false, $disabled=false, $required=false, $function='', $class='', $onChange='', $autocomplete='')
|
||||
{
|
||||
function html_print_input_text(
|
||||
$name,
|
||||
$value,
|
||||
$alt='',
|
||||
$size=50,
|
||||
$maxlength=255,
|
||||
$return=false,
|
||||
$disabled=false,
|
||||
$required=false,
|
||||
$function='',
|
||||
$class='',
|
||||
$onChange='',
|
||||
$autocomplete='',
|
||||
$autofocus=false
|
||||
) {
|
||||
if ($maxlength == 0) {
|
||||
$maxlength = 255;
|
||||
}
|
||||
|
@ -1552,7 +1579,24 @@ function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255,
|
|||
$attr['autocomplete'] = $autocomplete;
|
||||
}
|
||||
|
||||
return html_print_input_text_extended($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, false, $function);
|
||||
if ($autofocus === true) {
|
||||
$attr['autofocus'] = $autofocus;
|
||||
}
|
||||
|
||||
return html_print_input_text_extended(
|
||||
$name,
|
||||
$value,
|
||||
'text-'.$name,
|
||||
$alt,
|
||||
$size,
|
||||
$maxlength,
|
||||
$disabled,
|
||||
'',
|
||||
$attr,
|
||||
$return,
|
||||
false,
|
||||
$function
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1687,6 +1731,7 @@ function html_print_input_number(array $settings):string
|
|||
'autocomplete',
|
||||
'min',
|
||||
'max',
|
||||
'step',
|
||||
];
|
||||
|
||||
$output = '';
|
||||
|
@ -3466,7 +3511,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
((isset($data['function']) === true) ? $data['function'] : ''),
|
||||
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||
((isset($data['onChange']) === true) ? $data['onChange'] : ''),
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : '')
|
||||
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : ''),
|
||||
((isset($data['autofocus']) === true) ? $data['autofocus'] : false)
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -3727,6 +3773,16 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
$params['add_none_module'] = $data['module_none'];
|
||||
}
|
||||
|
||||
if (isset($data['size']) === true) {
|
||||
$params['size'] = $data['size'];
|
||||
}
|
||||
|
||||
if (isset($data['from_wux']) === true
|
||||
&& $data['from_wux'] === true
|
||||
) {
|
||||
$params['from_wux'] = 1;
|
||||
}
|
||||
|
||||
$params['use_hidden_input_idagent'] = true;
|
||||
$params['hidden_input_idagent_id'] = 'hidden-'.$data['name_agent_hidden'];
|
||||
if (is_metaconsole()) {
|
||||
|
@ -3766,6 +3822,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
$string_filter = 'AND id_tipo_modulo IN (17,23,3,10,33,36)';
|
||||
}
|
||||
|
||||
if ($data['from_wux'] === true) {
|
||||
$string_filter = ' AND id_tipo_modulo = 25 ';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_agente_modulo, nombre
|
||||
FROM tagente_modulo
|
||||
|
|
|
@ -437,7 +437,8 @@ function menu_print_menu(&$menu)
|
|||
$visible = false;
|
||||
}
|
||||
|
||||
$output .= '<ul id="subicon_'.$id.'" class="submenu'.($visible ? '' : ' invisible').'">';
|
||||
// $output .= '<ul id="subicon_'.$id.'" class="submenu'.($visible ? '' : ' invisible').'">';
|
||||
$output .= '<ul id="subicon_'.$id.'" class="submenu">';
|
||||
$output .= $submenu_output;
|
||||
$output .= '</ul>';
|
||||
}
|
||||
|
@ -521,8 +522,6 @@ function menu_add_extras(&$menu)
|
|||
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_item_editor']['text'] = __('Graph template items');
|
||||
$menu_extra['reporting']['sub']['enterprise/godmode/reporting/graph_template_wizard']['text'] = __('Graph template wizard');
|
||||
|
||||
$menu_extra['reporting']['sub']['enterprise/dashboard/dashboard_replicate']['text'] = __('Copy dashboard');
|
||||
|
||||
if ($config['activate_gis']) {
|
||||
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
|
||||
}
|
||||
|
|
|
@ -829,7 +829,7 @@ function reporting_make_reporting_data(
|
|||
break;
|
||||
|
||||
case 'module_histogram_graph':
|
||||
$report['contents'][] = reporting_enterprise_module_histogram_graph(
|
||||
$report['contents'][] = reporting_module_histogram_graph(
|
||||
$report,
|
||||
$content,
|
||||
$pdf
|
||||
|
@ -2880,19 +2880,19 @@ function reporting_group_report($report, $content)
|
|||
|
||||
$return['data'] = [];
|
||||
|
||||
$events = events_get_agent(
|
||||
false,
|
||||
$content['period'],
|
||||
$report['datetime'],
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
$content['id_group'],
|
||||
true
|
||||
);
|
||||
$id_group = groups_safe_acl($config['id_user'], $content['id_group'], 'ER');
|
||||
|
||||
if (empty($id_group)) {
|
||||
$events = [];
|
||||
} else {
|
||||
$sql_where = sprintf(' AND id_grupo IN (%s) AND estado<>1 ', implode(',', $id_group));
|
||||
$events = events_get_events_grouped(
|
||||
$sql_where,
|
||||
0,
|
||||
1000,
|
||||
is_metaconsole()
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($events)) {
|
||||
$events = [];
|
||||
|
@ -5140,7 +5140,7 @@ function reporting_sql($report, $content)
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text();
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
if ($config['metaconsole'] && !empty($content['server_name'])) {
|
||||
$id_meta = metaconsole_get_id_server(
|
||||
$content['server_name']
|
||||
);
|
||||
|
@ -5212,7 +5212,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']) {
|
||||
if ($config['metaconsole'] && !empty($content['server_name'])) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
@ -5664,22 +5664,32 @@ function reporting_advanced_sla(
|
|||
// Infer availability range based on the critical thresholds.
|
||||
$agentmodule_info = modules_get_agentmodule($id_agent_module);
|
||||
|
||||
// // Check if module type is string.
|
||||
$is_string_module = modules_is_string($agentmodule_info['id_agente_modulo']);
|
||||
|
||||
// Take in mind: the "inverse" critical threshold.
|
||||
$min_value = $agentmodule_info['min_critical'];
|
||||
$max_value = $agentmodule_info['max_critical'];
|
||||
$inverse_interval = ($agentmodule_info['critical_inverse'] == 0) ? 1 : 0;
|
||||
|
||||
if ((!isset($min_value)) || ($min_value == 0)) {
|
||||
$min_value = null;
|
||||
if (!$is_string_module) {
|
||||
$min_value = $agentmodule_info['min_critical'];
|
||||
$max_value = $agentmodule_info['max_critical'];
|
||||
} else {
|
||||
$max_value = io_safe_output($agentmodule_info['str_critical']);
|
||||
}
|
||||
|
||||
if ((!isset($max_value)) || ($max_value == 0)) {
|
||||
$max_value = null;
|
||||
}
|
||||
if (!$is_string_module) {
|
||||
if ((!isset($min_value)) || ($min_value == 0)) {
|
||||
$min_value = null;
|
||||
}
|
||||
|
||||
if ((!(isset($max_value))) && (!(isset($min_value)))) {
|
||||
$max_value = null;
|
||||
$min_value = null;
|
||||
if ((!isset($max_value)) || ($max_value == 0)) {
|
||||
$max_value = null;
|
||||
}
|
||||
|
||||
if ((!(isset($max_value))) && (!(isset($min_value)))) {
|
||||
$max_value = null;
|
||||
$min_value = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!isset($min_value)) && (!isset($max_value))) {
|
||||
|
@ -6141,14 +6151,31 @@ function reporting_advanced_sla(
|
|||
if ((isset($current_data['datos']))
|
||||
&& ($current_data['datos'] !== false)
|
||||
) {
|
||||
// Check values if module is sring type.
|
||||
if ($is_string_module) {
|
||||
if (empty($max_value)) {
|
||||
$match = preg_match('/^'.$max_value.'$/', $current_data['datos']);
|
||||
} else {
|
||||
$match = preg_match('/'.$max_value.'/', $current_data['datos']);
|
||||
}
|
||||
|
||||
// Take notice of $inverse_interval value,
|
||||
if ($inverse_interval == 0) {
|
||||
$sla_check_value = $match;
|
||||
} else {
|
||||
$sla_check_value = !$match;
|
||||
}
|
||||
} else {
|
||||
$sla_check_value = sla_check_value(
|
||||
$current_data['datos'],
|
||||
$min_value,
|
||||
$max_value,
|
||||
$inverse_interval
|
||||
);
|
||||
}
|
||||
|
||||
// Not unknown nor not init values.
|
||||
if (sla_check_value(
|
||||
$current_data['datos'],
|
||||
$min_value,
|
||||
$max_value,
|
||||
$inverse_interval
|
||||
)
|
||||
) {
|
||||
if ($sla_check_value) {
|
||||
$ok_checks++;
|
||||
$time_in_ok += $time_interval;
|
||||
} else {
|
||||
|
@ -11629,7 +11656,7 @@ function reporting_get_stats_servers()
|
|||
$output .= 'parameters["page"] = "include/ajax/events";';
|
||||
$output .= 'parameters["total_events"] = 1;';
|
||||
|
||||
$output .= '$.ajax({type: "GET",url: "/pandora_console/ajax.php",data: parameters,';
|
||||
$output .= '$.ajax({type: "GET",url: "'.ui_get_full_url('ajax.php', false, false, false).'",data: parameters,';
|
||||
$output .= 'success: function(data) {';
|
||||
$output .= '$("#total_events").text(data);';
|
||||
$output .= '}';
|
||||
|
@ -12319,3 +12346,327 @@ function reporting_nt_top_n_report($period, $content, $pdf)
|
|||
);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Will display an hourly analysis of the selected period.
|
||||
*
|
||||
* @param array $report Info report.
|
||||
* @param array $content Info contents.
|
||||
* @param boolean $pdf If pdf.
|
||||
*
|
||||
* @return html
|
||||
*/
|
||||
function reporting_module_histogram_graph($report, $content, $pdf=0)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$metaconsole_on = is_metaconsole();
|
||||
|
||||
$return = [];
|
||||
|
||||
$urlImage = ui_get_full_url(false, true, false, false);
|
||||
|
||||
$return['type'] = 'module_histogram_graph';
|
||||
|
||||
$ttl = 1;
|
||||
if ($pdf) {
|
||||
$ttl = 2;
|
||||
}
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Module Histogram Graph');
|
||||
}
|
||||
|
||||
$server_name = $content['server_name'];
|
||||
// Metaconsole connection.
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
if (!metaconsole_load_external_db($connection)) {
|
||||
ui_print_error_message('Error connecting to '.$server_name);
|
||||
}
|
||||
}
|
||||
|
||||
$module_name = io_safe_output(
|
||||
modules_get_agentmodule_name(
|
||||
$content['id_agent_module']
|
||||
)
|
||||
);
|
||||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_alias(
|
||||
$content['id_agent_module']
|
||||
)
|
||||
);
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['landscape'] = $content['landscape'];
|
||||
$return['pagebreak'] = $content['pagebreak'];
|
||||
$return['subtitle'] = $agent_name.' - '.$module_name;
|
||||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text(
|
||||
$report,
|
||||
$content
|
||||
);
|
||||
|
||||
if (modules_is_disable_agent($content['id_agent_module'])
|
||||
|| modules_is_not_init($content['id_agent_module'])
|
||||
) {
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$uncompress_module = db_uncompress_module_data(
|
||||
$content['id_agent_module'],
|
||||
($report['datetime'] - $content['period']),
|
||||
$report['datetime']
|
||||
);
|
||||
|
||||
// Select Warning and critical values.
|
||||
$agentmodule_info = modules_get_agentmodule($content['id_agent_module']);
|
||||
$min_value_critical = ($agentmodule_info['min_critical'] == 0) ? null : $agentmodule_info['min_critical'];
|
||||
|
||||
// Check if module type is string.
|
||||
$modules_is_string = modules_is_string($agentmodule_info['id_agente_modulo']);
|
||||
|
||||
if ($modules_is_string === false) {
|
||||
if ($agentmodule_info['max_critical'] == 0) {
|
||||
$max_value_critical = null;
|
||||
} else {
|
||||
$max_value_critical = $agentmodule_info['max_critical'];
|
||||
}
|
||||
} else {
|
||||
if ($agentmodule_info['str_critical'] == '') {
|
||||
$max_value_critical = null;
|
||||
} else {
|
||||
$max_value_critical = $agentmodule_info['str_critical'];
|
||||
}
|
||||
}
|
||||
|
||||
$inverse_critical = $agentmodule_info['critical_inverse'];
|
||||
|
||||
$min_value_warning = ($agentmodule_info['min_warning'] == 0) ? null : $agentmodule_info['min_warning'];
|
||||
|
||||
if ($modules_is_string === false) {
|
||||
if ($agentmodule_info['max_warning'] == 0) {
|
||||
$max_value_warning = null;
|
||||
} else {
|
||||
$max_value_warning = $agentmodule_info['max_warning'];
|
||||
}
|
||||
} else {
|
||||
if ($agentmodule_info['str_warning'] == '') {
|
||||
$max_value_warning = null;
|
||||
} else {
|
||||
$max_value_warning = $agentmodule_info['str_warning'];
|
||||
}
|
||||
}
|
||||
|
||||
$inverse_warning = $agentmodule_info['warning_inverse'];
|
||||
|
||||
// Initialize vars.
|
||||
$tstart = 0;
|
||||
$tend = 0;
|
||||
$tacum = 0;
|
||||
$tacum_data = 0;
|
||||
|
||||
$array_graph = [];
|
||||
|
||||
$data_not_init = 0;
|
||||
$data_unknown = 0;
|
||||
$data_critical = 0;
|
||||
$data_warning = 0;
|
||||
$data_ok = 0;
|
||||
$data_total = 0;
|
||||
|
||||
$time_not_init = 0;
|
||||
$time_unknown = 0;
|
||||
$time_critical = 0;
|
||||
$time_warning = 0;
|
||||
$time_ok = 0;
|
||||
|
||||
$legend = [];
|
||||
foreach ($uncompress_module as $data) {
|
||||
foreach ($data['data'] as $key => $value) {
|
||||
if ($tacum == 0) {
|
||||
// Initialize the accumulators.
|
||||
$tacum = $value['utimestamp'];
|
||||
$tacum_data = $value['datos'];
|
||||
} else {
|
||||
// Utimestand end and final.
|
||||
$tstart = $tacum;
|
||||
$tend = $value['utimestamp'];
|
||||
|
||||
// Module type isn't string.
|
||||
$sla_check_value_critical = sla_check_value(
|
||||
$tacum_data,
|
||||
$min_value_critical,
|
||||
$max_value_critical,
|
||||
$inverse_critical
|
||||
);
|
||||
$sla_check_value_warning = sla_check_value(
|
||||
$tacum_data,
|
||||
$min_value_warning,
|
||||
$max_value_warning,
|
||||
$inverse_warning
|
||||
);
|
||||
|
||||
// Module type is string.
|
||||
$string_check_value_critical = preg_match('/'.$max_value_critical.'/', $tacum_data);
|
||||
$string_check_value_warning = preg_match('/'.$max_value_warning.'/', $tacum_data);
|
||||
|
||||
if ($inverse_critical) {
|
||||
$string_check_value_critical = !preg_match('/'.$max_value_critical.'/', $tacum_data);
|
||||
}
|
||||
|
||||
if ($string_check_value_warning) {
|
||||
$string_check_value_warning = !preg_match('/'.$max_value_warning.'/', $tacum_data);
|
||||
}
|
||||
|
||||
// Contruct array period and data.
|
||||
if ($tacum_data === false) {
|
||||
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_NOT_INIT;
|
||||
// NOT INIT.
|
||||
$time_not_init = ($time_not_init + ($tend - $tstart));
|
||||
$data_not_init ++;
|
||||
} else if ($tacum_data === null) {
|
||||
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_UNKNOWN;
|
||||
// UNKNOWN.
|
||||
$time_unknown = ($time_unknown + ($tend - $tstart));
|
||||
$data_unknown ++;
|
||||
} else if (( (isset($min_value_critical) || isset($max_value_critical)) && ($modules_is_string === false) && ($sla_check_value_critical == true) )
|
||||
|| ( isset($max_value_critical) && ($modules_is_string === true) && $string_check_value_critical )
|
||||
) {
|
||||
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_CRITICAL_BAD;
|
||||
// CRITICAL.
|
||||
$time_critical = ($time_critical + ($tend - $tstart));
|
||||
$data_critical ++;
|
||||
} else if (( (isset($min_value_warning) || isset($max_value_warning)) && ($modules_is_string === false) && ($sla_check_value_warning == true) )
|
||||
|| ( isset($max_value_warning) && ($modules_is_string === true) && $sla_check_value_warning )
|
||||
) {
|
||||
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_WARNING;
|
||||
// WARNING.
|
||||
$time_warning = ($time_warning + ($tend - $tstart));
|
||||
$data_warning ++;
|
||||
} else {
|
||||
$array_graph[$data_total]['data'] = AGENT_MODULE_STATUS_NORMAL;
|
||||
// OK.
|
||||
$time_ok = ($time_ok + ($tend - $tstart));
|
||||
$data_ok ++;
|
||||
}
|
||||
|
||||
$array_graph[$data_total]['utimestamp'] = ($tend - $tstart);
|
||||
$array_graph[$data_total]['real_data'] = $tacum_data;
|
||||
|
||||
// Reassign accumulators.
|
||||
$tacum = $value['utimestamp'];
|
||||
$tacum_data = $value['datos'];
|
||||
$data_total++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = [];
|
||||
$i = 0;
|
||||
foreach ($array_graph as $key => $value) {
|
||||
if ($data_init == -1) {
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
} else {
|
||||
if ($data_init == $value['data']) {
|
||||
$acum = ($acum + $value['utimestamp']);
|
||||
if ($modules_is_string === false) {
|
||||
$sum = ($sum + $value['real_data']);
|
||||
} else {
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
} else {
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($array_result) == 0) {
|
||||
$array_result = $array_graph;
|
||||
} else {
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
}
|
||||
|
||||
$time_total = ($time_not_init + $time_unknown + $time_critical + $time_warning + $time_ok);
|
||||
// Slice graphs calculation.
|
||||
$return['agent'] = modules_get_agentmodule_agent_alias(
|
||||
$content['id_agent_module']
|
||||
);
|
||||
$return['module'] = modules_get_agentmodule_name(
|
||||
$content['id_agent_module']
|
||||
);
|
||||
$return['max_critical'] = $max_value_critical;
|
||||
$return['min_critical'] = $min_value_critical;
|
||||
$return['critical_inverse'] = $inverse_critical;
|
||||
$return['max_warning'] = $max_value_warning;
|
||||
$return['min_warning'] = $min_value_warning;
|
||||
$return['warning_inverse'] = $inverse_warning;
|
||||
$return['data_not_init'] = $data_not_init;
|
||||
$return['data_unknown'] = $data_unknown;
|
||||
$return['data_critical'] = $data_critical;
|
||||
$return['data_warning'] = $data_warning;
|
||||
$return['data_ok'] = $data_ok;
|
||||
$return['data_total'] = $data_total;
|
||||
$return['time_not_init'] = $time_not_init;
|
||||
$return['time_unknown'] = $time_unknown;
|
||||
$return['time_critical'] = $time_critical;
|
||||
$return['time_warning'] = $time_warning;
|
||||
$return['time_ok'] = $time_ok;
|
||||
$return['percent_ok'] = (($data_ok * 100) / $data_total);
|
||||
|
||||
$colors = [
|
||||
AGENT_MODULE_STATUS_NORMAL => COL_NORMAL,
|
||||
AGENT_MODULE_STATUS_WARNING => COL_WARNING,
|
||||
AGENT_MODULE_STATUS_CRITICAL_BAD => COL_CRITICAL,
|
||||
AGENT_MODULE_STATUS_UNKNOWN => COL_UNKNOWN,
|
||||
AGENT_MODULE_STATUS_NOT_INIT => COL_NOTINIT,
|
||||
];
|
||||
|
||||
$width_graph = 100;
|
||||
$height_graph = 80;
|
||||
$return['chart'] = flot_slicesbar_graph(
|
||||
$array_result,
|
||||
$time_total,
|
||||
$width_graph,
|
||||
$height_graph,
|
||||
$legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
[],
|
||||
true,
|
||||
$ttl,
|
||||
$content['sizeForTicks'],
|
||||
true
|
||||
);
|
||||
|
||||
if ($metaconsole_on) {
|
||||
// Restore db connection.
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
|
|
@ -1920,11 +1920,7 @@ function reporting_html_group_report($table, $item, $pdf=0)
|
|||
<td colspan='3' class='cellBold cellCenter cellAlert cellBorder1 cellBig'>".$item['data']['group_stats']['monitor_alerts_fired']."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan='6' class='cellBold cellCenter'>".__('Last %s', human_time_description_raw($item['date']['period']))."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='cellBold cellCenter'>".__('Events')."</td>
|
||||
<td class='cellBold cellCenter'>".__('Events (not validated)')."</td>
|
||||
<td colspan='6' class='cellBold cellCenter cellWhite cellBorder1 cellBig'>".$item['data']['count_events'].'</td>
|
||||
</tr></tbody>
|
||||
</table>';
|
||||
|
@ -3476,17 +3472,30 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|
|||
if (empty($item['data'][$k_chart]['failover']) === true) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '100%';
|
||||
$table1->autosize = 1;
|
||||
$table1->styleTable = 'overflow: wrap; table-layout: fixed;';
|
||||
$table1->data = [];
|
||||
$table1->size = [];
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '5%';
|
||||
$table1->size[3] = '5%';
|
||||
$table1->size[2] = '10%';
|
||||
|
||||
$table1->style[0] = 'overflow-wrap: break-word';
|
||||
|
||||
// Align percentage and checks resume.
|
||||
$table1->align[2] = 'center';
|
||||
$table1->data[0][0] = $chart['agent'].'<br />'.$chart['module'];
|
||||
$table1->data[0][1] = $chart['chart'];
|
||||
$table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span>';
|
||||
$table1->data[0][3] = "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
|
||||
$table1->data[0][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span><br/>';
|
||||
|
||||
// Pdf sizes to avoid excesive overflow.
|
||||
if ($pdf !== 0) {
|
||||
$table1->size[0] = '15%';
|
||||
$table1->size[1] = '70%';
|
||||
$table1->size[2] = '15%';
|
||||
}
|
||||
|
||||
$table1->data[0][2] .= "<span style = 'font-size: ".$font_mini.";'>".$checks_resume.'</span>';
|
||||
|
||||
$tables_chart .= html_print_table(
|
||||
$table1,
|
||||
|
|
|
@ -325,6 +325,14 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
|
|||
$row['data'] = $last_data_str;
|
||||
$table->data['last_data'] = $row;
|
||||
|
||||
// Last status change.
|
||||
$last_status_change = db_get_value('last_status_change', 'tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']);
|
||||
$row = [];
|
||||
$row['title'] = __('Last status change');
|
||||
$time_elapsed = ($last_status_change > 0) ? human_time_comparation($last_status_change) : __('N/A');
|
||||
$row['data'] = $time_elapsed;
|
||||
$table->data['tags'] = $row;
|
||||
|
||||
// End of table
|
||||
html_print_table($table);
|
||||
|
||||
|
@ -761,13 +769,28 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
|
|||
|
||||
if ($config['agentaccess']) {
|
||||
$access_graph = '<div style="width:100%; height:130px;">';
|
||||
$access_graph .= graphic_agentaccess($id_agente, 380, 120, SECONDS_1DAY, true, true);
|
||||
$access_graph .= graphic_agentaccess(
|
||||
$id_agente,
|
||||
SECONDS_1DAY,
|
||||
true
|
||||
);
|
||||
$access_graph .= '</div>';
|
||||
ui_toggle($access_graph, __('Agent access rate (24h)'));
|
||||
}
|
||||
|
||||
$events_graph = '<div style="margin-left:10px; width:100%;">';
|
||||
$events_graph .= graph_graphic_agentevents($id_agente, 375, 45, SECONDS_1DAY, '', true, false, true);
|
||||
$events_graph = '<div style="width: 100%; height: 90px; display: flex; flex-direction: row; justify-content: center;">';
|
||||
$events_graph .= graph_graphic_agentevents(
|
||||
$id_agente,
|
||||
'385px;',
|
||||
45,
|
||||
SECONDS_1DAY,
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
550,
|
||||
1,
|
||||
$server_id
|
||||
);
|
||||
$events_graph .= '</div><br>';
|
||||
|
||||
ui_toggle($events_graph, __('Events (24h)'));
|
||||
|
|
|
@ -1451,12 +1451,17 @@ function ui_print_help_icon(
|
|||
*
|
||||
* @return boolean True if the file was added. False if the file doesn't exist.
|
||||
*/
|
||||
function ui_require_css_file($name, $path='include/styles/')
|
||||
function ui_require_css_file($name, $path='include/styles/', $echo_tag=false)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$filename = $path.$name.'.css';
|
||||
|
||||
if ($echo_tag === true) {
|
||||
echo '<link type="text/css" rel="stylesheet" href="'.ui_get_full_url($filename, false, false, false).'">';
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! isset($config['css'])) {
|
||||
$config['css'] = [];
|
||||
}
|
||||
|
@ -1678,7 +1683,7 @@ function ui_process_page_head($string, $bitfield)
|
|||
|| $_GET['sec2'] == 'operation/agentes/group_view'
|
||||
|| $_GET['sec2'] == 'operation/events/events'
|
||||
|| $_GET['sec2'] == 'operation/snmpconsole/snmp_view'
|
||||
|| $_GET['sec2'] == 'enterprise/dashboard/main_dashboard'
|
||||
|| $_GET['sec2'] == 'operation/dashboard/dashboard'
|
||||
) {
|
||||
$query = ui_get_url_refresh(false, false);
|
||||
|
||||
|
@ -2654,6 +2659,7 @@ function ui_get_status_images_path()
|
|||
* @param array $options Options to set image attributes: I.E.: style.
|
||||
* @param string $path Path of the image, if not provided use the status path.
|
||||
* @param boolean $image_with_css Don't use an image. Draw an image with css styles.
|
||||
* @param string $extra_text Text that is displayed after title (i.e. time elapsed since last status change of module).
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
|
@ -2663,7 +2669,8 @@ function ui_print_status_image(
|
|||
$return=false,
|
||||
$options=false,
|
||||
$path=false,
|
||||
$image_with_css=false
|
||||
$image_with_css=false,
|
||||
$extra_info=''
|
||||
) {
|
||||
if ($path === false) {
|
||||
$imagepath_array = ui_get_status_images_path();
|
||||
|
@ -2680,7 +2687,7 @@ function ui_print_status_image(
|
|||
|
||||
if ($image_with_css === true) {
|
||||
$shape_status = get_shape_status_set($type);
|
||||
return ui_print_status_sets($type, $title, $return, $shape_status);
|
||||
return ui_print_status_sets($type, $title, $return, $shape_status, $extra_info);
|
||||
} else {
|
||||
if ($options === false) {
|
||||
$options = [];
|
||||
|
@ -2768,10 +2775,11 @@ function get_shape_status_set($type)
|
|||
/**
|
||||
* Prints an image representing a status.
|
||||
*
|
||||
* @param string $status Module status.
|
||||
* @param string $title Title.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param array $options Options to set image attributes: I.E.: style.
|
||||
* @param string $status Module status.
|
||||
* @param string $title Title.
|
||||
* @param boolean $return Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param array $options Options to set image attributes: I.E.: style.
|
||||
* @param string $extra_info Text that is displayed after title (i.e. time elapsed since last status change of module).
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
|
@ -2779,7 +2787,8 @@ function ui_print_status_sets(
|
|||
$status,
|
||||
$title='',
|
||||
$return=false,
|
||||
$options=false
|
||||
$options=false,
|
||||
$extra_info=''
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -2798,8 +2807,8 @@ function ui_print_status_sets(
|
|||
}
|
||||
|
||||
if ($title != '') {
|
||||
$options['title'] = $title;
|
||||
$options['data-title'] = $title;
|
||||
$options['title'] = empty($extra_info) ? $title : $title.'
'.$extra_info;
|
||||
$options['data-title'] = empty($extra_info) ? $title : $title.'<br>'.$extra_info;
|
||||
$options['data-use_title_for_force_title'] = 1;
|
||||
if (isset($options['class'])) {
|
||||
$options['class'] .= ' forced_title';
|
||||
|
@ -4813,9 +4822,7 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
inputs.push ("force_local_modules=1");
|
||||
}
|
||||
|
||||
if ('.((int) $get_order_json).') {
|
||||
inputs.push ("get_order_json=1");
|
||||
}
|
||||
inputs.push ("get_order_json=1");
|
||||
|
||||
if ('.((int) $get_only_string_modules).') {
|
||||
inputs.push ("get_only_string_modules=1");
|
||||
|
@ -4850,6 +4857,14 @@ function ui_print_agent_autocomplete_input($parameters)
|
|||
url: action="'.$javascript_ajax_page.'",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (Array.isArray(data) === true) {
|
||||
data.sort(function(a, b) {
|
||||
var textA = a.nombre.toUpperCase();
|
||||
var textB = b.nombre.toUpperCase();
|
||||
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
||||
});
|
||||
}
|
||||
|
||||
if ('.((int) $add_none_module).') {
|
||||
$("#'.$selectbox_id.'")
|
||||
.append($("<option></option>")
|
||||
|
|
|
@ -1025,11 +1025,13 @@ function visual_map_print_item(
|
|||
$params_combined
|
||||
).'</div>';
|
||||
} else {
|
||||
$img = graphic_combined_module(
|
||||
$img = '<div style="width:'.$width.'px; height:'.$height.'px;">';
|
||||
$img .= graphic_combined_module(
|
||||
false,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
$img .= '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1223,7 +1225,16 @@ function visual_map_print_item(
|
|||
'alpha' => CHART_DEFAULT_ALPHA,
|
||||
];
|
||||
|
||||
$module_data = get_bars_module_data($id_module);
|
||||
$module_data = get_bars_module_data(
|
||||
$id_module,
|
||||
($layoutData['type_graph'] !== 'horizontal')
|
||||
);
|
||||
$options = [];
|
||||
$options['generals']['rotate'] = true;
|
||||
$options['generals']['forceTicks'] = true;
|
||||
$options['generals']['arrayColors'] = $color;
|
||||
$options['x']['labelWidth'] = 60;
|
||||
|
||||
$water_mark = [
|
||||
'file' => '/var/www/html/pandora_console/images/logo_vertical_water.png',
|
||||
'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png',
|
||||
|
@ -1252,27 +1263,9 @@ function visual_map_print_item(
|
|||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
} else {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.vbar_graph(
|
||||
$module_data,
|
||||
400,
|
||||
400,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
ui_get_full_url('images/image_problem_area.png', false, false, false),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
6,
|
||||
'',
|
||||
0,
|
||||
$config['homeurl'],
|
||||
$layoutData['image'],
|
||||
true,
|
||||
false,
|
||||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">';
|
||||
$img .= vbar_graph($module_data, $options, 1);
|
||||
$img .= '</div>';
|
||||
}
|
||||
} else if ($layoutData['label_position'] == 'right') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
|
@ -1296,27 +1289,9 @@ function visual_map_print_item(
|
|||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
} else {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.vbar_graph(
|
||||
$module_data,
|
||||
400,
|
||||
400,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
ui_get_full_url('images/image_problem_area.png', false, false, false),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
6,
|
||||
'',
|
||||
0,
|
||||
$config['homeurl'],
|
||||
$layoutData['image'],
|
||||
true,
|
||||
false,
|
||||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">';
|
||||
$img .= vbar_graph($module_data, $options, 1);
|
||||
$img .= '</div>';
|
||||
}
|
||||
} else {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
|
@ -1340,27 +1315,7 @@ function visual_map_print_item(
|
|||
$layoutData['border_color']
|
||||
);
|
||||
} else {
|
||||
$img = vbar_graph(
|
||||
$module_data,
|
||||
400,
|
||||
400,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
ui_get_full_url('images/image_problem_area.png', false, false, false),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
6,
|
||||
'',
|
||||
0,
|
||||
$config['homeurl'],
|
||||
$layoutData['image'],
|
||||
true,
|
||||
false,
|
||||
$layoutData['border_color']
|
||||
);
|
||||
$img = vbar_graph($module_data, $options, 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1386,27 +1341,9 @@ function visual_map_print_item(
|
|||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
} else {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.vbar_graph(
|
||||
$module_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
ui_get_full_url('images/image_problem_area.png', false, false, false),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
6,
|
||||
'',
|
||||
0,
|
||||
$config['homeurl'],
|
||||
$layoutData['image'],
|
||||
true,
|
||||
false,
|
||||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">';
|
||||
$img .= vbar_graph($module_data, $options, 1);
|
||||
$img .= '</div>';
|
||||
}
|
||||
} else if ($layoutData['label_position'] == 'right') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
|
@ -1430,27 +1367,9 @@ function visual_map_print_item(
|
|||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
} else {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.vbar_graph(
|
||||
$module_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
ui_get_full_url('images/image_problem_area.png', false, false, false),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
6,
|
||||
'',
|
||||
0,
|
||||
$config['homeurl'],
|
||||
$layoutData['image'],
|
||||
true,
|
||||
false,
|
||||
$layoutData['border_color']
|
||||
).'</div>';
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">';
|
||||
$img .= vbar_graph($module_data, $options, 1);
|
||||
$img .= '</div>';
|
||||
}
|
||||
} else {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
|
@ -1474,27 +1393,9 @@ function visual_map_print_item(
|
|||
$layoutData['border_color']
|
||||
);
|
||||
} else {
|
||||
$img = vbar_graph(
|
||||
$module_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
[],
|
||||
[],
|
||||
ui_get_full_url('images/image_problem_area.png', false, false, false),
|
||||
'',
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
6,
|
||||
'',
|
||||
0,
|
||||
$config['homeurl'],
|
||||
$layoutData['image'],
|
||||
true,
|
||||
false,
|
||||
$layoutData['border_color']
|
||||
);
|
||||
$img = '<div style="width:'.$width.'px; height:'.$height.'px;">';
|
||||
$img .= vbar_graph($module_data, $options, 1);
|
||||
$img .= '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2443,7 +2344,7 @@ function get_if_module_is_image($id_module)
|
|||
}
|
||||
|
||||
|
||||
function get_bars_module_data($id_module)
|
||||
function get_bars_module_data($id_module, $vBars=false)
|
||||
{
|
||||
// This charts is only serialize graphs.
|
||||
// In other string show image no data to show.
|
||||
|
@ -2472,9 +2373,19 @@ function get_bars_module_data($id_module)
|
|||
return false;
|
||||
}
|
||||
|
||||
foreach ($values as $val) {
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[$data[0]] = ['g' => $data[1]];
|
||||
if ($vBars === false) {
|
||||
foreach ($values as $val) {
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[$data[0]] = ['g' => $data[1]];
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $val) {
|
||||
$data = explode(',', $val);
|
||||
$values_to_return[] = [
|
||||
'tick' => $data[0],
|
||||
'data' => $data[1],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $values_to_return;
|
||||
|
|
|
@ -149,75 +149,404 @@ function progressbar(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw vertical bars graph.
|
||||
*
|
||||
* @param array $data Data chart.
|
||||
* @param array $params Params draw chart.
|
||||
* @param integer $ttl Pdf option.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function vbar_graph(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$no_data_image,
|
||||
$xaxisname='',
|
||||
$yaxisname='',
|
||||
$water_mark='',
|
||||
$font='',
|
||||
$font_size='',
|
||||
$unit='',
|
||||
$ttl=1,
|
||||
$homeurl='',
|
||||
$backgroundColor='white',
|
||||
$from_ux=false,
|
||||
$from_wux=false,
|
||||
$tick_color='white',
|
||||
$base64=false
|
||||
array $data,
|
||||
array $options,
|
||||
int $ttl=1
|
||||
) {
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
global $config;
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return graph_nodata_image($width, $height, 'vbar');
|
||||
// INFO IN: https://github.com/flot/flot/blob/master/API.md.
|
||||
// Xaxes chart Title.
|
||||
if (isset($options['x']['title']['title']) === false) {
|
||||
$options['x']['title']['title'] = '';
|
||||
}
|
||||
|
||||
if ($ttl == 2) {
|
||||
$params = [
|
||||
'chart_data' => $chart_data,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'color' => $color,
|
||||
'legend' => $legend,
|
||||
'long_index' => $long_index,
|
||||
'homeurl' => $homeurl,
|
||||
'unit' => $unit,
|
||||
'water_mark_url' => $water_mark_url,
|
||||
'homedir' => $homedir,
|
||||
'font' => $font,
|
||||
'font_size' => $font_size,
|
||||
'from_ux' => $from_ux,
|
||||
'from_wux' => $from_wux,
|
||||
'backgroundColor' => $backgroundColor,
|
||||
'tick_color' => $tick_color,
|
||||
'return_img_base_64' => $base64,
|
||||
if (isset($options['x']['title']['fontSize']) === false) {
|
||||
$options['x']['title']['fontSize'] = ((int) $config['font_size'] + 2);
|
||||
}
|
||||
|
||||
if (isset($options['x']['title']['fontFamily']) === false) {
|
||||
$options['x']['title']['fontFamily'] = preg_replace(
|
||||
'/.ttf/',
|
||||
'Font, Arial',
|
||||
$config['fontpath']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($options['x']['title']['padding']) === false) {
|
||||
$options['x']['title']['padding'] = 10;
|
||||
}
|
||||
|
||||
// Xaxes font ticks.
|
||||
if (isset($options['x']['font']['size']) === false) {
|
||||
$options['x']['font']['size'] = ((int) $config['font_size'] + 2);
|
||||
}
|
||||
|
||||
if (isset($options['x']['font']['lineHeight']) === false) {
|
||||
$options['x']['font']['lineHeight'] = ((int) $config['font_size'] + 2);
|
||||
}
|
||||
|
||||
if (isset($options['x']['font']['style']) === false) {
|
||||
$options['x']['font']['style'] = 'normal';
|
||||
}
|
||||
|
||||
if (isset($options['x']['font']['weight']) === false) {
|
||||
$options['x']['font']['weight'] = 'normal';
|
||||
}
|
||||
|
||||
if (isset($options['x']['font']['family']) === false) {
|
||||
$options['x']['font']['family'] = preg_replace(
|
||||
'/.ttf/',
|
||||
'Font',
|
||||
$config['fontpath']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($options['x']['font']['variant']) === false) {
|
||||
$options['x']['font']['variant'] = 'small-caps';
|
||||
}
|
||||
|
||||
if (isset($options['x']['font']['color']) === false) {
|
||||
$options['x']['font']['color'] = '#545454';
|
||||
}
|
||||
|
||||
// Show ticks.
|
||||
if (isset($options['x']['show']) === false) {
|
||||
$options['x']['show'] = true;
|
||||
}
|
||||
|
||||
// Type position bottom or top or left or right.
|
||||
if (isset($options['x']['position']) === false) {
|
||||
$options['x']['position'] = 'bottom';
|
||||
}
|
||||
|
||||
// Grid color axes x.
|
||||
if (isset($options['x']['color']) === false) {
|
||||
$options['x']['color'] = '#ffffff';
|
||||
}
|
||||
|
||||
if (isset($options['x']['labelWidth']) === false) {
|
||||
$options['x']['labelWidth'] = null;
|
||||
}
|
||||
|
||||
if (isset($options['x']['labelHeight']) === false) {
|
||||
$options['x']['labelHeight'] = null;
|
||||
}
|
||||
|
||||
// Yaxes chart Title.
|
||||
if (isset($options['y']['title']['title']) === false) {
|
||||
$options['y']['title']['title'] = '';
|
||||
}
|
||||
|
||||
if (isset($options['y']['title']['fontSize']) === false) {
|
||||
$options['y']['title']['fontSize'] = ((int) $config['font_size'] + 2);
|
||||
}
|
||||
|
||||
if (isset($options['y']['title']['fontFamily']) === false) {
|
||||
$options['y']['title']['fontFamily'] = preg_replace(
|
||||
'/.ttf/',
|
||||
'Font, Arial',
|
||||
$config['fontpath']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($options['y']['title']['padding']) === false) {
|
||||
$options['y']['title']['padding'] = 10;
|
||||
}
|
||||
|
||||
// Yaxes font ticks.
|
||||
if (isset($options['y']['font']['size']) === false) {
|
||||
$options['y']['font']['size'] = ((int) $config['font_size'] + 2);
|
||||
}
|
||||
|
||||
if (isset($options['y']['font']['lineHeight']) === false) {
|
||||
$options['y']['font']['lineHeight'] = ((int) $config['font_size'] + 2);
|
||||
}
|
||||
|
||||
if (isset($options['y']['font']['style']) === false) {
|
||||
$options['y']['font']['style'] = 'normal';
|
||||
}
|
||||
|
||||
if (isset($options['y']['font']['weight']) === false) {
|
||||
$options['y']['font']['weight'] = 'normal';
|
||||
}
|
||||
|
||||
if (isset($options['y']['font']['family']) === false) {
|
||||
$options['y']['font']['family'] = preg_replace(
|
||||
'/.ttf/',
|
||||
'Font',
|
||||
$config['fontpath']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($options['y']['font']['variant']) === false) {
|
||||
$options['y']['font']['variant'] = 'small-caps';
|
||||
}
|
||||
|
||||
if (isset($options['y']['font']['color']) === false) {
|
||||
$options['y']['font']['color'] = '#545454';
|
||||
}
|
||||
|
||||
// Show ticks.
|
||||
if (isset($options['y']['show']) === false) {
|
||||
$options['y']['show'] = true;
|
||||
}
|
||||
|
||||
// Type position bottom or top or left or right.
|
||||
if (isset($options['y']['position']) === false) {
|
||||
$options['y']['position'] = 'left';
|
||||
}
|
||||
|
||||
// Grid color axes y.
|
||||
if (isset($options['y']['color']) === false) {
|
||||
$options['y']['color'] = '#ffffff';
|
||||
}
|
||||
|
||||
if (isset($options['y']['labelWidth']) === false) {
|
||||
$options['y']['labelWidth'] = null;
|
||||
}
|
||||
|
||||
if (isset($options['y']['labelHeight']) === false) {
|
||||
$options['y']['labelHeight'] = null;
|
||||
}
|
||||
|
||||
// Bars options.
|
||||
// left, right or center.
|
||||
if (isset($options['bars']['align']) === false) {
|
||||
$options['bars']['align'] = 'center';
|
||||
}
|
||||
|
||||
if (isset($options['bars']['barWidth']) === false) {
|
||||
$options['bars']['barWidth'] = 0.8;
|
||||
}
|
||||
|
||||
if (isset($options['bars']['horizontal']) === false) {
|
||||
$options['bars']['horizontal'] = false;
|
||||
}
|
||||
|
||||
// Grid Options.
|
||||
if (isset($options['grid']['show']) === false) {
|
||||
$options['grid']['show'] = true;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['aboveData']) === false) {
|
||||
$options['grid']['aboveData'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['color']) === false) {
|
||||
$options['grid']['color'] = '#ffffff';
|
||||
}
|
||||
|
||||
if (isset($options['grid']['backgroundColor']) === false) {
|
||||
$options['grid']['backgroundColor'] = [
|
||||
'colors' => [
|
||||
'#ffffff',
|
||||
'#ffffff',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
if (isset($options['grid']['margin']) === false) {
|
||||
$options['grid']['margin'] = 0;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['labelMargin']) === false) {
|
||||
$options['grid']['labelMargin'] = 5;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['axisMargin']) === false) {
|
||||
$options['grid']['axisMargin'] = 5;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['markings']) === false) {
|
||||
$options['grid']['markings'] = [];
|
||||
}
|
||||
|
||||
if (isset($options['grid']['borderWidth']) === false) {
|
||||
$options['grid']['borderWidth'] = 0;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['borderColor']) === false) {
|
||||
$options['grid']['borderColor'] = '#ffffff';
|
||||
}
|
||||
|
||||
if (isset($options['grid']['minBorderMargin']) === false) {
|
||||
$options['grid']['minBorderMargin'] = 5;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['clickable']) === false) {
|
||||
$options['grid']['clickable'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['hoverable']) === false) {
|
||||
$options['grid']['hoverable'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['autoHighlight']) === false) {
|
||||
$options['grid']['autoHighlight'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['grid']['mouseActiveRadius']) === false) {
|
||||
$options['grid']['mouseActiveRadius'] = false;
|
||||
}
|
||||
|
||||
// Series bars.
|
||||
if (isset($options['seriesBars']['show']) === false) {
|
||||
$options['seriesBars']['show'] = true;
|
||||
}
|
||||
|
||||
if (isset($options['seriesBars']['lineWidth']) === false) {
|
||||
$options['seriesBars']['lineWidth'] = 0.3;
|
||||
}
|
||||
|
||||
if (isset($options['seriesBars']['fill']) === false) {
|
||||
$options['seriesBars']['fill'] = true;
|
||||
}
|
||||
|
||||
if (isset($options['seriesBars']['fillColor']) === false) {
|
||||
$options['seriesBars']['fillColor'] = [
|
||||
'colors' => [
|
||||
[ 'opacity' => 0.9 ],
|
||||
[ 'opacity' => 0.9 ],
|
||||
],
|
||||
];
|
||||
};
|
||||
|
||||
// Generals options.
|
||||
if (isset($options['generals']['unit']) === false) {
|
||||
$options['generals']['unit'] = '';
|
||||
}
|
||||
|
||||
if (isset($options['generals']['divisor']) === false) {
|
||||
$options['generals']['divisor'] = 1000;
|
||||
}
|
||||
|
||||
if (isset($options['generals']['forceTicks']) === false) {
|
||||
$options['generals']['forceTicks'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['generals']['arrayColors']) === false) {
|
||||
$options['generals']['arrayColors'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['generals']['rotate']) === false) {
|
||||
$options['generals']['rotate'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['generals']['pdf']['width']) === false) {
|
||||
$options['generals']['pdf']['width'] = false;
|
||||
}
|
||||
|
||||
if (isset($options['generals']['pdf']['height']) === false) {
|
||||
$options['generals']['pdf']['height'] = false;
|
||||
}
|
||||
|
||||
$params = [
|
||||
'data' => $data,
|
||||
'x' => [
|
||||
'title' => [
|
||||
'title' => $options['x']['title']['title'],
|
||||
'fontSize' => $options['x']['title']['fontSize'],
|
||||
'fontFamily' => $options['x']['title']['fontFamily'],
|
||||
'padding' => $options['x']['title']['padding'],
|
||||
],
|
||||
'font' => [
|
||||
'size' => $options['x']['font']['size'],
|
||||
'lineHeight' => $options['x']['font']['lineHeight'],
|
||||
'style' => $options['x']['font']['style'],
|
||||
'weight' => $options['x']['font']['weight'],
|
||||
'family' => $options['x']['font']['family'],
|
||||
'variant' => $options['x']['font']['variant'],
|
||||
'color' => $options['x']['font']['color'],
|
||||
],
|
||||
'show' => $options['x']['show'],
|
||||
'position' => $options['x']['position'],
|
||||
'color' => $options['x']['color'],
|
||||
'labelWidth' => $options['x']['labelWidth'],
|
||||
'labelHeight' => $options['x']['labelHeight'],
|
||||
],
|
||||
'y' => [
|
||||
'title' => [
|
||||
'title' => $options['y']['title']['title'],
|
||||
'fontSize' => $options['y']['title']['fontSize'],
|
||||
'fontFamily' => $options['y']['title']['fontFamily'],
|
||||
'padding' => $options['y']['title']['padding'],
|
||||
],
|
||||
'font' => [
|
||||
'size' => $options['y']['font']['size'],
|
||||
'lineHeight' => $options['y']['font']['lineHeight'],
|
||||
'style' => $options['y']['font']['style'],
|
||||
'weight' => $options['y']['font']['weight'],
|
||||
'family' => $options['y']['font']['family'],
|
||||
'variant' => $options['y']['font']['variant'],
|
||||
'color' => $options['y']['font']['color'],
|
||||
],
|
||||
'show' => $options['y']['show'],
|
||||
'position' => $options['y']['position'],
|
||||
'color' => $options['y']['color'],
|
||||
'labelWidth' => $options['y']['labelWidth'],
|
||||
'labelHeight' => $options['y']['labelHeight'],
|
||||
],
|
||||
'bars' => [
|
||||
'align' => $options['bars']['align'],
|
||||
'barWidth' => $options['bars']['barWidth'],
|
||||
'horizontal' => $options['bars']['horizontal'],
|
||||
],
|
||||
'grid' => [
|
||||
'show' => $options['grid']['show'],
|
||||
'aboveData' => $options['grid']['aboveData'],
|
||||
'color' => $options['grid']['color'],
|
||||
'backgroundColor' => $options['grid']['backgroundColor'],
|
||||
'margin' => $options['grid']['margin'],
|
||||
'labelMargin' => $options['grid']['labelMargin'],
|
||||
'axisMargin' => $options['grid']['axisMargin'],
|
||||
'markings' => $options['grid']['markings'],
|
||||
'borderWidth' => $options['grid']['borderWidth'],
|
||||
'borderColor' => $options['grid']['borderColor'],
|
||||
'minBorderMargin' => $options['grid']['minBorderMargin'],
|
||||
'clickable' => $options['grid']['clickable'],
|
||||
'hoverable' => $options['grid']['hoverable'],
|
||||
'autoHighlight' => $options['grid']['autoHighlight'],
|
||||
'mouseActiveRadius' => $options['grid']['mouseActiveRadius'],
|
||||
],
|
||||
'seriesBars' => [
|
||||
'show' => $options['seriesBars']['show'],
|
||||
'lineWidth' => $options['seriesBars']['lineWidth'],
|
||||
'fill' => $options['seriesBars']['fill'],
|
||||
'fillColor' => $options['seriesBars']['fillColor'],
|
||||
],
|
||||
'generals' => [
|
||||
'unit' => $options['generals']['unit'],
|
||||
'divisor' => $options['generals']['divisor'],
|
||||
'forceTicks' => $options['generals']['forceTicks'],
|
||||
'arrayColors' => $options['generals']['arrayColors'],
|
||||
'rotate' => $options['generals']['rotate'],
|
||||
],
|
||||
];
|
||||
|
||||
if (empty($params['data']) === true) {
|
||||
return graph_nodata_image(0, 0, 'vbar', '', true);
|
||||
}
|
||||
|
||||
if ((int) $ttl === 2) {
|
||||
$params['backgroundColor'] = $options['grid']['backgroundColor'];
|
||||
$params['return_img_base_64'] = true;
|
||||
$params['generals']['pdf']['width'] = $options['generals']['pdf']['width'];
|
||||
$params['generals']['pdf']['height'] = $options['generals']['pdf']['height'];
|
||||
return generator_chart_to_pdf('vbar', $params);
|
||||
}
|
||||
|
||||
return flot_vcolumn_chart(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
$homedir,
|
||||
$font,
|
||||
$font_size,
|
||||
$from_ux,
|
||||
$from_wux,
|
||||
$backgroundColor,
|
||||
$tick_color
|
||||
);
|
||||
return flot_vcolumn_chart($params);
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,7 +566,9 @@ function area_graph(
|
|||
|
||||
include_once 'functions_flot.php';
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
if ($water_mark !== false) {
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
}
|
||||
|
||||
return flot_area_graph(
|
||||
$agent_module_id,
|
||||
|
@ -274,7 +605,9 @@ function stacked_bullet_chart(
|
|||
) {
|
||||
include_once 'functions_d3.php';
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
if ($water_mark !== false) {
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
}
|
||||
|
||||
if (empty($chart_data)) {
|
||||
return '<img src="'.$no_data_image.'" />';
|
||||
|
@ -350,7 +683,9 @@ function hbar_graph(
|
|||
$val_max=null,
|
||||
$base64=false
|
||||
) {
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
if ($water_mark !== false) {
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
}
|
||||
|
||||
if ($chart_data === false || empty($chart_data) === true) {
|
||||
return graph_nodata_image($width, $height, 'hbar');
|
||||
|
@ -402,16 +737,18 @@ function pie_graph(
|
|||
$colors='',
|
||||
$hide_labels=false
|
||||
) {
|
||||
if (empty($chart_data)) {
|
||||
if (empty($chart_data) === true) {
|
||||
return graph_nodata_image($width, $height, 'pie');
|
||||
}
|
||||
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
if ($water_mark !== false) {
|
||||
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
|
||||
}
|
||||
|
||||
// This library allows only 8 colors
|
||||
// This library allows only 8 colors.
|
||||
$max_values = 9;
|
||||
|
||||
// Remove the html_entities
|
||||
// Remove the html_entities.
|
||||
$temp = [];
|
||||
foreach ($chart_data as $key => $value) {
|
||||
$temp[io_safe_output($key)] = $value;
|
||||
|
|
|
@ -507,23 +507,45 @@ $.fn.HUseTooltip = function() {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.VUseTooltip = function() {
|
||||
$(this).bind("plothover", function(event, pos, item) {
|
||||
if (item) {
|
||||
if (
|
||||
previousLabel != item.series.label ||
|
||||
previousPoint != item.seriesIndex
|
||||
previousPoint != item.dataIndex
|
||||
) {
|
||||
previousPoint = item.seriesIndex;
|
||||
previousPoint = item.dataIndex;
|
||||
previousLabel = item.series.label;
|
||||
|
||||
$("#tooltip").remove();
|
||||
|
||||
// var x = item.datapoint[0];
|
||||
var x = item.datapoint[0];
|
||||
|
||||
var y = item.datapoint[1];
|
||||
if (typeof y != "string") {
|
||||
y = number_format(y, false, "", 2, 1000);
|
||||
}
|
||||
|
||||
var color = item.series.color;
|
||||
showTooltip(pos.pageX, pos.pageY, color, "<strong>" + y + "</strong>");
|
||||
|
||||
//console.log(item.series.xaxis.ticks[x].label);
|
||||
|
||||
/*
|
||||
"<strong>" +
|
||||
item.series.label +
|
||||
"</strong><br>" +
|
||||
item.series.xaxis.ticks[x].label +
|
||||
" : <strong>" +
|
||||
y +
|
||||
"</strong>"
|
||||
*/
|
||||
|
||||
showTooltip(
|
||||
item.pageX,
|
||||
item.pageY,
|
||||
color,
|
||||
"<strong>" + item.series.label + " : " + y + "</strong>"
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("#tooltip").remove();
|
||||
|
@ -552,223 +574,143 @@ function showTooltip(x, y, color, contents) {
|
|||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function pandoraFlotVBars(
|
||||
graph_id,
|
||||
values,
|
||||
labels,
|
||||
labels_long,
|
||||
legend,
|
||||
colors,
|
||||
maxvalue,
|
||||
water_mark,
|
||||
separator,
|
||||
separator2,
|
||||
font,
|
||||
font_size,
|
||||
from_ux,
|
||||
from_wux,
|
||||
background_color,
|
||||
tick_color
|
||||
) {
|
||||
values = values.split(separator2);
|
||||
legend = legend.split(separator);
|
||||
font = font
|
||||
.split("/")
|
||||
.pop()
|
||||
.split(".")
|
||||
.shift();
|
||||
labels_long = labels_long.length > 0 ? labels_long.split(separator) : 0;
|
||||
colors = colors.length > 0 ? colors.split(separator) : [];
|
||||
function pandoraFlotVBars(settings) {
|
||||
settings = JSON.parse(atob(settings));
|
||||
|
||||
var colors_data =
|
||||
colors.length > 0
|
||||
? colors
|
||||
: ["#FFA631", "#e63c52", "#f3b200", "#5BB6E5", "#F2919D", "#82b92e"];
|
||||
var datas = new Array();
|
||||
var unit = settings.generals.unit;
|
||||
var divisor = settings.generals.divisor;
|
||||
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
var serie = values[i].split(separator);
|
||||
|
||||
var aux = new Array();
|
||||
for (var j = 0; j < serie.length; j++) {
|
||||
var aux2 = parseFloat(serie[j]);
|
||||
aux.push([aux2, j]);
|
||||
if (from_ux) {
|
||||
datas.push({
|
||||
data: [[j, aux2]],
|
||||
color: colors_data[j]
|
||||
});
|
||||
} else {
|
||||
datas.push({
|
||||
data: [[j, aux2]],
|
||||
color: colors_data[0]
|
||||
});
|
||||
var datas = [];
|
||||
var ticks = [];
|
||||
var labels = [];
|
||||
settings.data.forEach(function(element, index) {
|
||||
var color = element.color;
|
||||
if (settings.generals.arrayColors) {
|
||||
if (settings.generals.arrayColors[index] != undefined) {
|
||||
color = settings.generals.arrayColors[index].color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var labels_total = new Array();
|
||||
labels = labels.split(separator);
|
||||
i = 0;
|
||||
for (i = 0; i < labels.length; i++) {
|
||||
labels_total.push([i, labels[i]]);
|
||||
datas.push({
|
||||
label: element.tick,
|
||||
color: color,
|
||||
data: [[index, element.data]]
|
||||
});
|
||||
|
||||
if (settings.generals.forceTicks === true) {
|
||||
ticks.push([index, element.tick]);
|
||||
} else {
|
||||
ticks.push([element.tick]);
|
||||
}
|
||||
|
||||
labels.push([index, element.tick]);
|
||||
});
|
||||
|
||||
var formatterTicks = "";
|
||||
if (settings.generals.forceTicks === true) {
|
||||
formatterTicks = "";
|
||||
} else {
|
||||
var ticksformatter = ticks;
|
||||
ticks = null;
|
||||
formatterTicks = function(v) {
|
||||
return ticksformatter[Math.round(v)];
|
||||
};
|
||||
}
|
||||
|
||||
var options = {
|
||||
series: {
|
||||
bars: {
|
||||
show: true,
|
||||
lineWidth: 1,
|
||||
fill: 1,
|
||||
align: "center",
|
||||
barWidth: 1
|
||||
show: settings.seriesBars.show,
|
||||
lineWidth: settings.seriesBars.lineWidth,
|
||||
fill: settings.seriesBars.fill,
|
||||
fillColor: settings.seriesBars.fillColor
|
||||
}
|
||||
},
|
||||
bars: {
|
||||
align: settings.bars.align,
|
||||
barWidth: settings.bars.barWidth,
|
||||
horizontal: settings.bars.horizontal
|
||||
},
|
||||
xaxis: {
|
||||
color: tick_color,
|
||||
axisLabel: settings.x.title.title,
|
||||
axisLabelUseCanvas: true,
|
||||
axisLabelFontSizePixels: font_size,
|
||||
axisLabelFontFamily: font + "Font",
|
||||
axisLabelPadding: 0,
|
||||
ticks: xFormatter,
|
||||
labelWidth: 130,
|
||||
labelHeight: 50
|
||||
axisLabelFontSizePixels: settings.x.title.fontSize,
|
||||
axisLabelFontFamily: settings.x.title.fontFamily,
|
||||
axisLabelPadding: settings.x.title.padding,
|
||||
font: {
|
||||
size: settings.x.font.size,
|
||||
lineHeight: settings.x.font.lineHeight,
|
||||
style: settings.x.font.style,
|
||||
weight: settings.x.font.weight,
|
||||
family: settings.x.font.family,
|
||||
variant: settings.x.font.variant,
|
||||
color: settings.x.font.color
|
||||
},
|
||||
show: settings.x.show,
|
||||
position: settings.x.position,
|
||||
color: settings.x.color,
|
||||
ticks: ticks,
|
||||
tickFormatter: formatterTicks,
|
||||
labelWidth: settings.x.labelWidth,
|
||||
labelHeight: settings.x.labelHeight
|
||||
},
|
||||
yaxis: {
|
||||
color: tick_color,
|
||||
axisLabel: settings.y.title.title,
|
||||
axisLabelUseCanvas: true,
|
||||
axisLabelFontSizePixels: font_size,
|
||||
axisLabelFontFamily: font + "Font",
|
||||
axisLabelPadding: 100,
|
||||
autoscaleMargin: 0.02,
|
||||
axisLabelFontSizePixels: settings.y.title.fontSize,
|
||||
axisLabelFontFamily: settings.y.title.fontFamily,
|
||||
axisLabelPadding: settings.y.title.padding,
|
||||
font: {
|
||||
size: settings.y.font.size,
|
||||
lineHeight: settings.y.font.lineHeight,
|
||||
style: settings.y.font.style,
|
||||
weight: settings.y.font.weight,
|
||||
family: settings.y.font.family,
|
||||
variant: settings.y.font.variant,
|
||||
color: settings.y.font.color
|
||||
},
|
||||
show: settings.y.show,
|
||||
position: settings.y.position,
|
||||
color: settings.y.color,
|
||||
tickFormatter: function(v) {
|
||||
var label = parseFloat(v);
|
||||
var text = label.toLocaleString();
|
||||
if (label >= 1000000) text = text.substring(0, 4) + "M";
|
||||
else if (label >= 100000) text = text.substring(0, 3) + "K";
|
||||
else if (label >= 1000) text = text.substring(0, 2) + "K";
|
||||
var formatted = v;
|
||||
if (typeof formatted != "string") {
|
||||
formatted = number_format(v, false, unit, 2, divisor);
|
||||
}
|
||||
|
||||
return (
|
||||
'<div style="font-size:' +
|
||||
font_size +
|
||||
'pt !important;">' +
|
||||
text +
|
||||
"</div>"
|
||||
);
|
||||
}
|
||||
return formatted;
|
||||
},
|
||||
labelWidth: settings.y.labelWidth,
|
||||
labelHeight: settings.y.labelHeight,
|
||||
reserveSpace: true
|
||||
},
|
||||
legend: {
|
||||
noColumns: 100,
|
||||
labelBoxBorderColor: "",
|
||||
margin: 100,
|
||||
container: true,
|
||||
sorted: false
|
||||
// TODO: settings.
|
||||
show: false
|
||||
},
|
||||
grid: {
|
||||
hoverable: true,
|
||||
borderWidth: 1,
|
||||
tickColor: tick_color,
|
||||
borderColor: "#C1C1C1",
|
||||
backgroundColor: { colors: [background_color, background_color] }
|
||||
show: settings.grid.show,
|
||||
aboveData: settings.grid.aboveData,
|
||||
color: settings.grid.color,
|
||||
backgroundColor: settings.grid.backgroundColor,
|
||||
margin: settings.grid.margin,
|
||||
labelMargin: settings.grid.labelMargin,
|
||||
axisMargin: settings.grid.axisMargin,
|
||||
markings: settings.grid.markings,
|
||||
borderWidth: settings.grid.borderWidth,
|
||||
borderColor: settings.grid.borderColor,
|
||||
minBorderMargin: settings.grid.minBorderMargin,
|
||||
clickable: settings.grid.clickable,
|
||||
hoverable: settings.grid.hoverable,
|
||||
autoHighlight: settings.grid.autoHighlight,
|
||||
mouseActiveRadius: settings.grid.mouseActiveRadius
|
||||
}
|
||||
};
|
||||
|
||||
if (from_wux) {
|
||||
options.series.bars.barWidth = 0.5;
|
||||
options.grid.aboveData = true;
|
||||
options.grid.borderWidth = 0;
|
||||
options.grid.markings = [
|
||||
{ xaxis: { from: -0.25, to: -0.25 }, color: "#000" },
|
||||
{ yaxis: { from: 0, to: 0 }, color: "#000" }
|
||||
];
|
||||
options.grid.markingsLineWidth = 0.3;
|
||||
$.plot($("#" + settings.graphId), datas, options);
|
||||
|
||||
options.xaxis.tickLength = 0;
|
||||
options.yaxis.tickLength = 0;
|
||||
}
|
||||
|
||||
if (
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent
|
||||
)
|
||||
)
|
||||
options.xaxis.labelWidth = 100;
|
||||
|
||||
var plot = $.plot($("#" + graph_id), datas, options);
|
||||
$("#" + graph_id).VUseTooltip();
|
||||
$("#" + graph_id).css("margin-left", "auto");
|
||||
$("#" + graph_id).css("margin-right", "auto");
|
||||
|
||||
if (
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent
|
||||
)
|
||||
)
|
||||
$("#" + graph_id + " .xAxis .tickLabel")
|
||||
.find("div")
|
||||
.css("top", "+0px")
|
||||
.css("left", "-20px");
|
||||
// Format functions
|
||||
function xFormatter() {
|
||||
var format = new Array();
|
||||
for (i = 0; i < labels_total.length; i++) {
|
||||
var label = labels_total[i][1];
|
||||
var shortLabel = reduceText(label, 28);
|
||||
if (
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent
|
||||
)
|
||||
)
|
||||
shortLabel = reduceText(label, 18);
|
||||
var title = "";
|
||||
if (label !== shortLabel) {
|
||||
title = label;
|
||||
label = shortLabel;
|
||||
}
|
||||
|
||||
format.push([
|
||||
i,
|
||||
'<div class="' +
|
||||
font +
|
||||
'" title="' +
|
||||
title +
|
||||
'" style="word-break: normal; overflow:hidden; transform: rotate(-45deg); position:relative; top:+30px; left:0px; max-width: 100px;font-size:' +
|
||||
font_size +
|
||||
'pt !important;">' +
|
||||
label +
|
||||
"</div>"
|
||||
]);
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
/*
|
||||
function yFormatter(v) {
|
||||
return (
|
||||
'<div class="' +
|
||||
font +
|
||||
'" style="font-size:' +
|
||||
font_size +
|
||||
'pt !important;">' +
|
||||
v +
|
||||
"</div>"
|
||||
);
|
||||
}
|
||||
|
||||
function lFormatter(v, axis) {
|
||||
return (
|
||||
'<div style="font-size:' + font_size + 'pt !important;">' + v + "</div>"
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
if (water_mark) {
|
||||
set_watermark(
|
||||
graph_id,
|
||||
plot,
|
||||
$("#watermark_image_" + graph_id).attr("src")
|
||||
);
|
||||
}
|
||||
// Hover in bars graph.
|
||||
$("#" + settings.graphId).VUseTooltip();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
@ -786,7 +728,8 @@ function pandoraFlotSlicebar(
|
|||
full_legend,
|
||||
not_interactive,
|
||||
show_date,
|
||||
datelimit
|
||||
datelimit,
|
||||
server_id
|
||||
) {
|
||||
values = values.split(separator2);
|
||||
legend = legend.split(separator);
|
||||
|
@ -934,7 +877,9 @@ function pandoraFlotSlicebar(
|
|||
date_from: newdate,
|
||||
time_from: from + ":00",
|
||||
status: "-1",
|
||||
group_rep: "1"
|
||||
group_rep: "1",
|
||||
from_event_graph: 1,
|
||||
id_server_meta: server_id
|
||||
};
|
||||
|
||||
if (full_legend != "") {
|
||||
|
@ -965,6 +910,11 @@ function pandoraFlotSlicebar(
|
|||
|
||||
// Format functions
|
||||
function xFormatter(v) {
|
||||
var ct = new Date();
|
||||
var currentTime = ct.getTime();
|
||||
|
||||
var diffDates = (currentTime - 1000 * datelimit) / 1000;
|
||||
|
||||
var d = new Date(1000 * (v + datelimit));
|
||||
var monthNames = [
|
||||
"Jan",
|
||||
|
@ -981,17 +931,27 @@ function pandoraFlotSlicebar(
|
|||
"Dec"
|
||||
];
|
||||
|
||||
var date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
monthNames[d.getMonth()] +
|
||||
"<br>" +
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes();
|
||||
var date_format = "";
|
||||
if (diffDates > 86500) {
|
||||
date_format =
|
||||
(d.getDate() < 10 ? "0" : "") +
|
||||
d.getDate() +
|
||||
" " +
|
||||
monthNames[d.getMonth()] +
|
||||
"<br>" +
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes();
|
||||
} else {
|
||||
date_format =
|
||||
(d.getHours() < 10 ? "0" : "") +
|
||||
d.getHours() +
|
||||
":" +
|
||||
(d.getMinutes() < 10 ? "0" : "") +
|
||||
d.getMinutes();
|
||||
}
|
||||
return date_format;
|
||||
}
|
||||
}
|
||||
|
@ -1027,13 +987,12 @@ function pandoraFlotArea(
|
|||
var type = parseInt(params.stacked);
|
||||
var show_legend = params.show_legend;
|
||||
var image_treshold = params.image_treshold;
|
||||
var short_data = params.short_data;
|
||||
var short_data = params.short_data != "" ? params.short_data : 3;
|
||||
var grid_color = params.grid_color;
|
||||
var background_color = params.backgroundColor;
|
||||
var legend_color = params.legend_color;
|
||||
var update_legend = {};
|
||||
var force_integer = 0;
|
||||
// var title = params.title;
|
||||
var divisor = params.divisor;
|
||||
|
||||
if (typeof divisor === "undefined") {
|
||||
|
@ -2085,23 +2044,6 @@ function pandoraFlotArea(
|
|||
|
||||
var plot = $.plot($("#" + graph_id), datas, options);
|
||||
|
||||
// Re-calculate the graph height with the legend height
|
||||
if (dashboard) {
|
||||
var $acum = 0;
|
||||
if (dashboard) $acum = 35;
|
||||
var hDiff =
|
||||
$("#" + graph_id).height() - $("#legend_" + graph_id).height() - $acum;
|
||||
if (
|
||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||
navigator.userAgent
|
||||
)
|
||||
) {
|
||||
// not defined.???
|
||||
} else {
|
||||
$("#" + graph_id).css("height", hDiff);
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust the overview plot to the width and position of the main plot
|
||||
adjust_left_width_canvas(graph_id, "overview_" + graph_id);
|
||||
update_left_width_canvas(graph_id);
|
||||
|
@ -3055,6 +2997,7 @@ function check_adaptions(graph_id) {
|
|||
|
||||
function number_format(number, force_integer, unit, short_data, divisor) {
|
||||
divisor = typeof divisor !== "undefined" ? divisor : 1000;
|
||||
var decimals = 2;
|
||||
|
||||
if (unit == "KB") {
|
||||
return number + unit;
|
||||
|
|
|
@ -305,7 +305,7 @@ function d3_gauges(
|
|||
$output = include_javascript_d3(true);
|
||||
|
||||
foreach ($chart_data as $module) {
|
||||
$output .= "<div id='".$module['gauge']."' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
|
||||
$output .= "<div class='gauge_d3_class' id='".$module['gauge']."' style='float:left; overflow: hidden; margin-left: 10px;'></div>";
|
||||
}
|
||||
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
|
@ -317,8 +317,13 @@ function d3_gauges(
|
|||
}
|
||||
|
||||
|
||||
function ux_console_phases_donut($phases, $id, $return=false)
|
||||
{
|
||||
function ux_console_phases_donut(
|
||||
$phases,
|
||||
$id,
|
||||
$width=800,
|
||||
$height=500,
|
||||
$return=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
foreach ($phases as $i => $phase) {
|
||||
|
@ -341,10 +346,10 @@ function ux_console_phases_donut($phases, $id, $return=false)
|
|||
}
|
||||
</style>';
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
print_phases_donut('".$recipient_name_to_js."', ".$phases.');
|
||||
print_phases_donut('".$recipient_name_to_js."', ".$phases.', '.$width.', '.$height.');
|
||||
</script>';
|
||||
|
||||
if (!$return) {
|
||||
if ($return === false) {
|
||||
echo $output;
|
||||
}
|
||||
|
||||
|
@ -479,79 +484,78 @@ function d3_donut_graph($id, $width, $height, $module_data, $resume_color)
|
|||
}
|
||||
|
||||
|
||||
function print_clock_analogic_1($time_format, $timezone, $clock_animation, $width, $height, $id_element, $color)
|
||||
{
|
||||
function print_clock_analogic_1(
|
||||
$time_format,
|
||||
$timezone,
|
||||
$clock_animation,
|
||||
$width,
|
||||
$height,
|
||||
$id_element,
|
||||
$color,
|
||||
$title=true
|
||||
) {
|
||||
global $config;
|
||||
$output .= '<style type="text/css">
|
||||
body {
|
||||
background: #fff;
|
||||
}
|
||||
#rim {
|
||||
fill: none;
|
||||
stroke: #999;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
svg{
|
||||
stroke: #000;
|
||||
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
}
|
||||
.second-hand{
|
||||
stroke-width:3;
|
||||
|
||||
#rim {
|
||||
fill: none;
|
||||
stroke: #999;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.second-hand{
|
||||
stroke-width:3;
|
||||
.minute-hand{
|
||||
stroke-width:8;
|
||||
stroke-linecap:round;
|
||||
}
|
||||
|
||||
}
|
||||
.hour-hand{
|
||||
stroke-width:12;
|
||||
stroke-linecap:round;
|
||||
}
|
||||
|
||||
.minute-hand{
|
||||
stroke-width:8;
|
||||
stroke-linecap:round;
|
||||
}
|
||||
.hands-cover{
|
||||
stroke-width:3;
|
||||
fill:#fff;
|
||||
}
|
||||
|
||||
.hour-hand{
|
||||
stroke-width:12;
|
||||
stroke-linecap:round;
|
||||
}
|
||||
.second-tick{
|
||||
stroke-width:3;
|
||||
fill:#000;
|
||||
}
|
||||
|
||||
.hands-cover{
|
||||
stroke-width:3;
|
||||
fill:#fff;
|
||||
}
|
||||
.hour-tick{
|
||||
stroke-width:8; //same as the miute hand
|
||||
}
|
||||
|
||||
.second-tick{
|
||||
stroke-width:3;
|
||||
fill:#000;
|
||||
}
|
||||
.second-label{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.hour-tick{
|
||||
stroke-width:8; //same as the miute hand
|
||||
}
|
||||
.hour-label{
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>';
|
||||
|
||||
.second-label{
|
||||
font-size: 12px;
|
||||
}
|
||||
$tz = $timezone;
|
||||
$timestamp = time();
|
||||
$dt = new DateTime('now', new DateTimeZone($tz));
|
||||
// first argument "must" be a string.
|
||||
$dt->setTimestamp($timestamp);
|
||||
// adjust the object to correct timestamp.
|
||||
$dateTimeZoneOption = new DateTimeZone(date_default_timezone_get());
|
||||
$dateTimeZonePandora = new DateTimeZone($timezone);
|
||||
|
||||
.hour-label{
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
</style>';
|
||||
$dateTimeOption = new DateTime('now', $dateTimeZoneOption);
|
||||
$dateTimePandora = new DateTime('now', $dateTimeZonePandora);
|
||||
|
||||
$tz = $timezone;
|
||||
$timestamp = time();
|
||||
$dt = new DateTime('now', new DateTimeZone($tz));
|
||||
// first argument "must" be a string
|
||||
$dt->setTimestamp($timestamp);
|
||||
// adjust the object to correct timestamp
|
||||
$dateTimeZoneOption = new DateTimeZone(date_default_timezone_get());
|
||||
$dateTimeZonePandora = new DateTimeZone($timezone);
|
||||
$timeOffset = $dateTimeZonePandora->getOffset($dateTimeOption);
|
||||
|
||||
$dateTimeOption = new DateTime('now', $dateTimeZoneOption);
|
||||
$dateTimePandora = new DateTime('now', $dateTimeZonePandora);
|
||||
|
||||
$timeOffset = $dateTimeZonePandora->getOffset($dateTimeOption);
|
||||
|
||||
$output .= include_javascript_d3(true);
|
||||
$output .= include_javascript_d3(true);
|
||||
|
||||
if ($width == 0) {
|
||||
$date_width = 200;
|
||||
|
@ -559,24 +563,25 @@ function print_clock_analogic_1($time_format, $timezone, $clock_animation, $widt
|
|||
$date_width = $width;
|
||||
}
|
||||
|
||||
$output .= '<div style="width:'.$date_width.'px;text-align:center;font-style:italic;font-size:12pt;color:'.$color.'">';
|
||||
if ($title === true) {
|
||||
$output .= '<div style="width:'.$date_width.'px;text-align:center;font-style:italic;font-size:12pt;color:'.$color.'">';
|
||||
|
||||
if ($time_format == 'timedate') {
|
||||
$output .= $dt->format('d / m / Y').' - ';
|
||||
if ($time_format == 'timedate') {
|
||||
$output .= $dt->format('d / m / Y').' - ';
|
||||
}
|
||||
|
||||
$output .= $dt->format('a').'</div>';
|
||||
|
||||
$timezone_short = explode('/', $timezone);
|
||||
$timezone_short_end = end($timezone_short);
|
||||
$output .= '<div style="width:'.$date_width.'px;text-align:center;font-style:italic;font-size:12pt;color:'.$color.'">'.$timezone_short_end.'</div>';
|
||||
}
|
||||
|
||||
$output .= $dt->format('a').'</div>';
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
printClockAnalogic1('".$time_format."', '".$timeOffset."', '".$clock_animation."','".$width."','".$height."','".$id_element."','".$color."');
|
||||
</script>";
|
||||
|
||||
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||
printClockAnalogic1('".$time_format."', '".$timeOffset."', '".$clock_animation."','".$width."','".$height."','".$id_element."','".$color."');
|
||||
</script>";
|
||||
|
||||
$timezone_short = explode('/', $timezone);
|
||||
$timezone_short_end = end($timezone_short);
|
||||
|
||||
$output .= '<div style="width:'.$date_width.'px;text-align:center;font-style:italic;font-size:12pt;color:'.$color.'">'.$timezone_short_end.'</div>';
|
||||
|
||||
return $output;
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
|
|