mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'develop' into ent-11495-nuevo-tipo-de-informe-service-level-detailed
This commit is contained in:
commit
3a00ba0fd6
@ -234,6 +234,21 @@ module_description Number of cron task files
|
|||||||
module_unit files
|
module_unit files
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
# This module /var/log/syslog file, under the module name "syslog"
|
||||||
|
# And search for "ssh" string into it, sending only that information.
|
||||||
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Search for ssh string into /var/log/syslog file
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/syslog
|
||||||
|
module_pattern ssh
|
||||||
|
module_end
|
||||||
|
|
||||||
|
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||||
|
#module_begin
|
||||||
|
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||||
|
#module_absoluteinterval 7d
|
||||||
|
#module_end
|
||||||
|
|
||||||
# Plugin example
|
# Plugin example
|
||||||
|
|
||||||
@ -241,11 +256,6 @@ module_end
|
|||||||
|
|
||||||
module_plugin pandora_df
|
module_plugin pandora_df
|
||||||
|
|
||||||
# This parses /var/log/syslog file, under the module name "syslog"
|
|
||||||
# And search for "ssh" string into it, sending only that information.
|
|
||||||
|
|
||||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
|
||||||
|
|
||||||
# Get disk space free in MB
|
# Get disk space free in MB
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name disk_root_free
|
#module_name disk_root_free
|
||||||
@ -270,7 +280,6 @@ module_plugin grep_log /var/log/syslog Syslog ssh
|
|||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
|
|
||||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users process ip route
|
||||||
|
|
||||||
# Example of preconditions
|
# Example of preconditions
|
||||||
@ -303,4 +312,13 @@ module_plugin grep_log /var/log/syslog Syslog ssh
|
|||||||
|
|
||||||
# This plugin runs several security checks in a Linux system
|
# This plugin runs several security checks in a Linux system
|
||||||
|
|
||||||
#module_plugin pandora_security_check
|
#module_plugin pandora_security_check
|
||||||
|
|
||||||
|
# Extraction module example
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -1,6 +1,6 @@
|
|||||||
# Base config file for Pandora FMS Windows Agent
|
# Base config file for Pandora FMS Windows Agent
|
||||||
# (c) 2006-2023 Pandora FMS
|
# (c) 2006-2023 Pandora FMS
|
||||||
# Version 7.0NG.774
|
# Version 7.0NG.774
|
||||||
# This program is Free Software, you can redistribute it and/or modify it
|
# This program is Free Software, you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||||
# Foundation; either version 2 of the Licence or any later version
|
# Foundation; either version 2 of the Licence or any later version
|
||||||
@ -147,22 +147,23 @@ module_max_critical 20
|
|||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Log events
|
# Log events
|
||||||
|
|
||||||
|
# Get logs from System source.
|
||||||
module_begin
|
module_begin
|
||||||
module_name System Events (TermService)
|
module_name System Events (TermService)
|
||||||
module_type async_string
|
|
||||||
module_logevent
|
|
||||||
module_description Log Events coming from Terminal Service
|
module_description Log Events coming from Terminal Service
|
||||||
|
module_type log
|
||||||
|
module_logevent
|
||||||
module_source System
|
module_source System
|
||||||
module_application TermService
|
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
# Get logs from Security source.
|
||||||
module_begin
|
module_begin
|
||||||
module_name Security Events (Invalid Login)
|
module_name Security Events
|
||||||
module_type async_string
|
module_description Security log events
|
||||||
module_description Security log events for invalid login attempt
|
module_type log
|
||||||
module_logevent
|
module_logevent
|
||||||
module_source Security
|
module_source Security
|
||||||
module_eventcode 529
|
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Check if Dhcp service is enabled
|
# Check if Dhcp service is enabled
|
||||||
@ -219,6 +220,12 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
|||||||
# module_description Free space on drive D: (%)
|
# module_description Free space on drive D: (%)
|
||||||
# module_end
|
# module_end
|
||||||
|
|
||||||
|
# Hardening plugin for security compliance analysis.
|
||||||
|
# module_begin
|
||||||
|
# module_plugin "%PROGRAMFILES%\Pandora_Agent\util\pandora_hardening.exe -t 150"
|
||||||
|
# module_absoluteinterval 7d
|
||||||
|
# module_end
|
||||||
|
|
||||||
# Sample of Windows inventory module (ONLY ENTERPRISE)!
|
# Sample of Windows inventory module (ONLY ENTERPRISE)!
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name Inventory
|
#module_name Inventory
|
||||||
@ -344,4 +351,13 @@ module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df.vbs"
|
|||||||
#module_condition (3,8) cmd.exe /c echo range >> c:\log.txt
|
#module_condition (3,8) cmd.exe /c echo range >> c:\log.txt
|
||||||
#module_exec echo 5
|
#module_exec echo 5
|
||||||
#module_description Postcondition test module
|
#module_description Postcondition test module
|
||||||
|
#module_end
|
||||||
|
|
||||||
|
# Example of collector module
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
#module_end
|
#module_end
|
@ -157,12 +157,32 @@ module_exec last | head -1
|
|||||||
module_description Last Login
|
module_description Last Login
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Plugin example
|
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||||
|
#module_begin
|
||||||
|
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||||
|
#module_absoluteinterval 7d
|
||||||
|
#module_end
|
||||||
|
|
||||||
# This parses /var/log/syslog file, under the module name "syslog"
|
# This module parses /var/log/syslog file, under the module name "syslog"
|
||||||
# And search for "ssh" string into it, sending only that information.
|
# And search for "ssh" string into it, sending only that information.
|
||||||
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Search for ssh string into /var/log/syslog file
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/syslog
|
||||||
|
module_pattern ssh
|
||||||
|
module_end
|
||||||
|
|
||||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
# Plugin example
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||||
|
|
||||||
|
# Extraction module example
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -372,13 +372,32 @@ module_end
|
|||||||
#module_description XGrid
|
#module_description XGrid
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
|
#Hardening plugin for security compliance analysis. Enable to use it.
|
||||||
|
#module_begin
|
||||||
|
#module_plugin /usr/share/pandora_agent/plugins/pandora_hardening -t 150
|
||||||
|
#module_absoluteinterval 7d
|
||||||
|
#module_end
|
||||||
|
|
||||||
|
# This module parses /var/log/syslog file, under the module name "syslog"
|
||||||
|
# And search for "ssh" string into it, sending only that information.
|
||||||
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Log collection modules
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/syslog
|
||||||
|
module_pattern ssh
|
||||||
|
module_end
|
||||||
|
|
||||||
# Plugin example
|
# Plugin example
|
||||||
|
|
||||||
# This parses /var/log/syslog file, under the module name "syslog"
|
|
||||||
# And search for "ssh" string into it, sending only that information.
|
|
||||||
|
|
||||||
#module_plugin grep_log /var/log/syslog Syslog ssh
|
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
|
|
||||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||||
|
|
||||||
|
# Extraction module example
|
||||||
|
#module_begin
|
||||||
|
#module_name Collector
|
||||||
|
#module_description Logs extraction module
|
||||||
|
#module_type log
|
||||||
|
#module_regexp /var/log/logfile.log
|
||||||
|
#module_pattern .*
|
||||||
|
#module_end
|
@ -271,11 +271,17 @@ module_plugin pandora_netusage
|
|||||||
module_plugin autodiscover --default
|
module_plugin autodiscover --default
|
||||||
|
|
||||||
# Plugin for inventory on the agent.
|
# Plugin for inventory on the agent.
|
||||||
#module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
# module_plugin inventory 1 cpu ram video nic hd cdrom software init_services filesystem users route
|
||||||
|
|
||||||
# Log collection modules. This will collect log files for forensic analysis and store everything
|
# Log collection modules. This will collect log files for forensic analysis and store everything
|
||||||
# This is for LOG monitoring. Different than log monitoring.
|
# This is for LOG monitoring. Different than log monitoring.
|
||||||
#module_plugin grep_log_module /var/log/messages Syslog \.\*
|
module_begin
|
||||||
|
module_name Syslog
|
||||||
|
module_description Log collection modules
|
||||||
|
module_type log
|
||||||
|
module_regexp /var/log/messages
|
||||||
|
module_pattern .*
|
||||||
|
module_end
|
||||||
|
|
||||||
# Another samples of monitoring modules
|
# Another samples of monitoring modules
|
||||||
|
|
||||||
@ -317,9 +323,9 @@ module_plugin autodiscover --default
|
|||||||
#module_absoluteinterval 7d
|
#module_absoluteinterval 7d
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
# Logs extraction
|
# Extraction module example
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name Syslog
|
#module_name Collector
|
||||||
#module_description Logs extraction module
|
#module_description Logs extraction module
|
||||||
#module_type log
|
#module_type log
|
||||||
#module_regexp /var/log/logfile.log
|
#module_regexp /var/log/logfile.log
|
||||||
|
@ -179,6 +179,22 @@ module_description Total number of TCP connections active
|
|||||||
module_group Networking
|
module_group Networking
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
# Get logs from System source.
|
||||||
|
module_begin
|
||||||
|
module_name Eventlog_System
|
||||||
|
module_type log
|
||||||
|
module_logevent
|
||||||
|
module_source System
|
||||||
|
module_end
|
||||||
|
|
||||||
|
# Get logs from Security source.
|
||||||
|
module_begin
|
||||||
|
module_name Eventlog_Security
|
||||||
|
module_type log
|
||||||
|
module_logevent
|
||||||
|
module_source Security
|
||||||
|
module_end
|
||||||
|
|
||||||
# Example plugin to retrieve drive usage
|
# Example plugin to retrieve drive usage
|
||||||
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
module_plugin cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\df_percent_used.vbs"
|
||||||
|
|
||||||
@ -273,22 +289,6 @@ module_plugin "%PROGRAMFILES%\Pandora_Agent\util\autodiscover.exe" --default
|
|||||||
#module_type generic_data_string
|
#module_type generic_data_string
|
||||||
#module_end
|
#module_end
|
||||||
|
|
||||||
# Get logs from System source. Need enterprise version.
|
|
||||||
#module_begin
|
|
||||||
#module_name Eventlog_System
|
|
||||||
#module_type log
|
|
||||||
#module_logevent
|
|
||||||
#module_source System
|
|
||||||
#module_end
|
|
||||||
|
|
||||||
# Get logs from Security source. Need enterprise version.
|
|
||||||
#module_begin
|
|
||||||
#module_name Eventlog_Security
|
|
||||||
#module_type log
|
|
||||||
#module_logevent
|
|
||||||
#module_source Security
|
|
||||||
#module_end
|
|
||||||
|
|
||||||
# Get logs from Application source. Need enterprise version.
|
# Get logs from Application source. Need enterprise version.
|
||||||
#module_begin
|
#module_begin
|
||||||
#module_name Eventlog_Application
|
#module_name Eventlog_Application
|
||||||
|
@ -31,7 +31,7 @@ function view_logfile($file_name, $toggle=false)
|
|||||||
} else {
|
} else {
|
||||||
$file_size = filesize($file_name);
|
$file_size = filesize($file_name);
|
||||||
|
|
||||||
if ($memory_limit < $file_size) {
|
if ($memory_limit < $file_size && $memory_limit !== '-1') {
|
||||||
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
$code .= '<pre><h2>'.$file_name.' ('.__('File is too large than PHP memory allocated in the system.').')</h2>';
|
||||||
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
$code .= '<h2>'.__('The preview file is imposible.').'</h2>';
|
||||||
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
} else if ($file_size > ($config['max_log_size'] * 1000)) {
|
||||||
@ -117,6 +117,7 @@ function pandoralogs_extension_main()
|
|||||||
view_logfile($config['homedir'].'/log/console.log', true);
|
view_logfile($config['homedir'].'/log/console.log', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view_logfile('/var/log/php-fpm/www-error.log', true);
|
||||||
view_logfile($logs_directory.'/pandora_server.log', true);
|
view_logfile($logs_directory.'/pandora_server.log', true);
|
||||||
view_logfile($logs_directory.'/pandora_server.error', true);
|
view_logfile($logs_directory.'/pandora_server.error', true);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
pandorafms.vmware=9959cc3e5cc6bfcfadd6d05b56d4a11b
|
pandorafms.vmware=248788e0fb2cd4e11623e4a52ee7d05b
|
||||||
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
pandorafms.mysql=fadb4750d18285c0eca34f47c6aa3cfe
|
||||||
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
pandorafms.mssql=1cc215409741d19080269ffba112810e
|
||||||
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
pandorafms.oracle=2d9320a514d1e48a0b2804e1653c31c6
|
||||||
|
@ -3,13 +3,21 @@ START TRANSACTION;
|
|||||||
ALTER TABLE `tevento`
|
ALTER TABLE `tevento`
|
||||||
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
|
ADD COLUMN `event_custom_id` TEXT NULL AFTER `module_status`;
|
||||||
|
|
||||||
-- Telegram and vonage default alerts
|
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tmetaconsole_agent' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
|
||||||
UPDATE talert_actions
|
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tmetaconsole_agent` DROP COLUMN `transactional_agent`', 'SELECT ""');
|
||||||
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
prepare stmt from @sqlstmt;
|
||||||
WHERE id=9;
|
execute stmt;
|
||||||
UPDATE talert_actions
|
|
||||||
SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_'
|
SET @exist = (SELECT count(*) FROM information_schema.columns WHERE TABLE_NAME='tagente' AND COLUMN_NAME='transactional_agent' AND table_schema = DATABASE());
|
||||||
WHERE id=11;
|
SET @sqlstmt = IF (@exist>0, 'ALTER TABLE `tagente` DROP COLUMN `transactional_agent`', 'SELECT ""');
|
||||||
|
prepare stmt from @sqlstmt;
|
||||||
|
execute stmt;
|
||||||
|
|
||||||
|
ALTER TABLE `tdashboard`
|
||||||
|
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
||||||
|
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
||||||
|
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
|
||||||
|
|
||||||
-- Delete table tagent_access
|
-- Delete table tagent_access
|
||||||
DROP TABLE IF EXISTS tagent_access;
|
DROP TABLE IF EXISTS tagent_access;
|
||||||
|
|
||||||
@ -18,10 +26,8 @@ ALTER TABLE `tevent_rule` DROP COLUMN `operator_user_comment`;
|
|||||||
|
|
||||||
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
ALTER TABLE treport_content ADD check_unknowns_graph tinyint DEFAULT 0 NULL;
|
||||||
|
|
||||||
ALTER TABLE `tevent_filter`
|
ALTER TABLE `tevent_filter` ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
||||||
ADD COLUMN `regex` TEXT NULL AFTER `private_filter_user`;
|
|
||||||
-- Update macros for plugin oracle
|
-- Update macros for plugin oracle
|
||||||
|
|
||||||
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
UPDATE `tdiscovery_apps` SET `version` = '1.1' WHERE `short_name` = 'pandorafms.oracle';
|
||||||
|
|
||||||
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
SET @id_app := (SELECT `id_app` FROM `tdiscovery_apps` WHERE `short_name` = 'pandorafms.oracle');
|
||||||
@ -35,11 +41,6 @@ UPDATE `trecon_task` SET `setup_complete` = 1 WHERE `id_app` = @id_app;
|
|||||||
-- Update lts updates
|
-- Update lts updates
|
||||||
UPDATE tconfig SET value='1' WHERE token='lts_updates';
|
UPDATE tconfig SET value='1' WHERE token='lts_updates';
|
||||||
|
|
||||||
ALTER TABLE `tdashboard`
|
|
||||||
ADD COLUMN `date_range` TINYINT NOT NULL DEFAULT 0 AFTER `cells_slideshow`,
|
|
||||||
ADD COLUMN `date_from` INT NOT NULL DEFAULT 0 AFTER `date_range`,
|
|
||||||
ADD COLUMN `date_to` INT NOT NULL DEFAULT 0 AFTER `date_from`;
|
|
||||||
|
|
||||||
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
|
SELECT @generic_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_data";
|
||||||
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
|
SELECT @generic_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "generic_proc";
|
||||||
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
|
SELECT @async_data := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_data";
|
||||||
@ -47,4 +48,10 @@ SELECT @async_proc := `id_tipo` FROM `ttipo_modulo` WHERE `nombre` = "async_proc
|
|||||||
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
|
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_data WHERE `tagente_modulo`.`id_tipo_modulo` = @async_data;
|
||||||
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
|
UPDATE `tagente_modulo` INNER JOIN `tservice` ON `tagente_modulo`.`custom_integer_1` = `tservice`.`id` SET `tagente_modulo`.`id_tipo_modulo` = @generic_proc WHERE `tagente_modulo`.`id_tipo_modulo` = @async_proc;
|
||||||
|
|
||||||
|
-- Telegram and vonage default alerts
|
||||||
|
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=9;
|
||||||
|
UPDATE talert_actions SET field2='[PANDORA] Alert FIRED on _agent_ / _module_ / _timestamp_ / _data_' WHERE id=11;
|
||||||
|
|
||||||
|
UPDATE `tdiscovery_apps` SET `version` = '1.2' WHERE `short_name` = 'pandorafms.vmware';
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -111,7 +111,8 @@ if ($delete) {
|
|||||||
$alerts_agent_modules = [];
|
$alerts_agent_modules = [];
|
||||||
foreach ($agent_alerts['simple'] as $agent_alert) {
|
foreach ($agent_alerts['simple'] as $agent_alert) {
|
||||||
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
|
if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) {
|
||||||
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
|
// $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module($agent_alert['id_agent_module'], true, false, 'id'));
|
||||||
|
$alerts_agent_modules[] = $agent_alert['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ if ($delete) {
|
|||||||
$agent_module_actions = [];
|
$agent_module_actions = [];
|
||||||
|
|
||||||
foreach ($alerts_agent_modules as $alert_agent_module) {
|
foreach ($alerts_agent_modules as $alert_agent_module) {
|
||||||
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module['id'], ['id', 'id_alert_action']);
|
$agent_module_actions = alerts_get_alert_agent_module_actions($alert_agent_module, ['id', 'id_alert_action']);
|
||||||
|
|
||||||
foreach ($agent_module_actions as $agent_module_action) {
|
foreach ($agent_module_actions as $agent_module_action) {
|
||||||
foreach ($actions as $action) {
|
foreach ($actions as $action) {
|
||||||
|
@ -478,8 +478,8 @@ if ($access_console_node === true) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sub2['godmode/setup/setup§ion=ehorus']['text'] = __('Pandora RC');
|
$sub2['godmode/setup/setup§ion=pandorarc']['text'] = __('Pandora RC');
|
||||||
$sub2['godmode/setup/setup§ion=ehorus']['refr'] = 0;
|
$sub2['godmode/setup/setup§ion=pandorarc']['refr'] = 0;
|
||||||
|
|
||||||
$sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM');
|
$sub2['godmode/setup/setup§ion=ITSM']['text'] = __('ITSM');
|
||||||
$sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0;
|
$sub2['godmode/setup/setup§ion=ITSM']['refr'] = 0;
|
||||||
|
@ -539,6 +539,7 @@ foreach ($layoutDatas as $layoutData) {
|
|||||||
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
|
$table->data[($i + 1)][5] .= html_print_checkbox('multiple_delete_items', $idLayoutData, false, true);
|
||||||
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
|
$table->data[($i + 1)][5] .= '<a href="'.$url_delete.'"onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']).'</a>';
|
||||||
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
|
$table->data[($i + 1)][5] .= html_print_input_hidden('updated_'.$idLayoutData, '0', true);
|
||||||
|
$table->data[($i + 1)][5] .= html_print_input_hidden('rowtype_'.$idLayoutData, $layoutData['type'], true);
|
||||||
|
|
||||||
// Second row
|
// Second row
|
||||||
$table->data[($i + 2)]['icon'] = '';
|
$table->data[($i + 2)]['icon'] = '';
|
||||||
@ -789,14 +790,6 @@ if ($x > ini_get('max_input_vars')) {
|
|||||||
|
|
||||||
$pure = get_parameter('pure', 0);
|
$pure = get_parameter('pure', 0);
|
||||||
|
|
||||||
if (is_metaconsole() === false) {
|
|
||||||
echo '<form id="vc_elem_form" method="post" action="index.php?sec=network&sec2=godmode/reporting/visual_console_builder&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'].'">';
|
|
||||||
html_print_input_hidden('action', 'update');
|
|
||||||
} else {
|
|
||||||
echo "<form id='vc_elem_form' method='post' action='index.php?operation=edit_visualmap&sec=screen&sec2=screens/screens&action=visualmap&pure=0&tab=list_elements&id_visual_console=".$idVisualConsole."'>";
|
|
||||||
html_print_input_hidden('action2', 'update');
|
|
||||||
}
|
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
// Form for multiple delete.
|
// Form for multiple delete.
|
||||||
@ -806,15 +799,14 @@ if (is_metaconsole() === false) {
|
|||||||
$url_multiple_delete = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'];
|
$url_multiple_delete = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&tab='.$activeTab.'&id_visual_console='.$visualConsole['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
$buttons = html_print_submit_button(
|
$buttons = html_print_submit_button(
|
||||||
__('Update'),
|
__('Update'),
|
||||||
'go',
|
'go',
|
||||||
false,
|
false,
|
||||||
[
|
[
|
||||||
'icon' => 'next',
|
'icon' => 'next',
|
||||||
'form' => 'vc_elem_form',
|
'form' => 'vc_elem_form',
|
||||||
|
'onclick' => 'submit_update_json()',
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -976,4 +968,76 @@ ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/');
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submit_update_json() {
|
||||||
|
var array_update = [];
|
||||||
|
$('input[id^=hidden-updated_]').each(function(){
|
||||||
|
var id = $(this).attr('id').split('_')[1];
|
||||||
|
|
||||||
|
var label = $('#hidden-label_'+id).val();
|
||||||
|
var image = $('#image_'+id).val();
|
||||||
|
var width = $('#text-width_'+id).val();
|
||||||
|
var height = $('#text-height_'+id).val();
|
||||||
|
var pos_x = $('#text-left_'+id).val();
|
||||||
|
var pos_y = $('#text-top_'+id).val();
|
||||||
|
var parent = $('#parent_'+id).val();
|
||||||
|
var agent = $('#hidden-agent_'+id).val();
|
||||||
|
var module = $('#module_'+id).val();
|
||||||
|
var period = $('#hidden-period_'+id).val();
|
||||||
|
var map_linked = $('#map_linked_'+id).val();
|
||||||
|
var id_server = $('#id_server_id_'+id).val();
|
||||||
|
var rowtype = $('rowtype_'+id).val();
|
||||||
|
var custom_graph = $('#custom_graph_'+id).val();
|
||||||
|
|
||||||
|
array_update.push({
|
||||||
|
'id': id,
|
||||||
|
'label': label,
|
||||||
|
'image': image,
|
||||||
|
'width': width,
|
||||||
|
'height': height,
|
||||||
|
'pos_x': pos_x,
|
||||||
|
'pos_y': pos_y,
|
||||||
|
'parent': parent,
|
||||||
|
'agent': agent,
|
||||||
|
'module': module,
|
||||||
|
'period': period,
|
||||||
|
'map_linked': map_linked,
|
||||||
|
'rowtype': rowtype,
|
||||||
|
'custom_graph': custom_graph,
|
||||||
|
'id_server': id_server,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var background_width = $('#text-width').val();
|
||||||
|
var background_height = $('#text-height').val();
|
||||||
|
|
||||||
|
if (background_height > 0 && background_width > 0){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
data: {
|
||||||
|
page: "godmode/reporting/visual_console_builder",
|
||||||
|
action: "update_json",
|
||||||
|
tab: "list_elements",
|
||||||
|
array_update: JSON.stringify(array_update),
|
||||||
|
id_visual_console: "<?php echo (is_metaconsole() === true) ? $idVisualConsole : $visualConsole['id']; ?>",
|
||||||
|
background: $('#background').val(),
|
||||||
|
background_width: $('#text-width').val(),
|
||||||
|
background_height: $('#text-height').val(),
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
complete: function (data) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
confirmDialog({
|
||||||
|
title: "<?php echo __('Error.'); ?>",
|
||||||
|
message: "<?php echo __('The width and height property is required and should greater than 0'); ?>",
|
||||||
|
strOKButton: "<?php echo __('Close'); ?>",
|
||||||
|
hideCancelButton: true,
|
||||||
|
size: 300,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -78,6 +78,7 @@ $action = get_parameterBetweenListValues(
|
|||||||
'update',
|
'update',
|
||||||
'delete',
|
'delete',
|
||||||
'multiple_delete',
|
'multiple_delete',
|
||||||
|
'update_json',
|
||||||
],
|
],
|
||||||
'new'
|
'new'
|
||||||
);
|
);
|
||||||
@ -526,6 +527,110 @@ switch ($activeTab) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'update_json':
|
||||||
|
// Update background.
|
||||||
|
$background = get_parameter('background');
|
||||||
|
$width = get_parameter('background_width');
|
||||||
|
$height = get_parameter('background_height');
|
||||||
|
|
||||||
|
if ($width == 0 && $height == 0) {
|
||||||
|
$sizeBackground = getimagesize(
|
||||||
|
$config['homedir'].'/images/console/background/'.$background
|
||||||
|
);
|
||||||
|
$width = $sizeBackground[0];
|
||||||
|
$height = $sizeBackground[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
db_process_sql_update(
|
||||||
|
'tlayout',
|
||||||
|
[
|
||||||
|
'background' => $background,
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
],
|
||||||
|
['id' => $idVisualConsole]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Return the updated visual console.
|
||||||
|
$visualConsole = db_get_row_filter(
|
||||||
|
'tlayout',
|
||||||
|
['id' => $idVisualConsole]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Update elements in visual map.
|
||||||
|
$idsElements = db_get_all_rows_filter(
|
||||||
|
'tlayout_data',
|
||||||
|
['id_layout' => $idVisualConsole],
|
||||||
|
[
|
||||||
|
'id',
|
||||||
|
'type',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$array_update = json_decode(io_safe_output(get_parameter('array_update')), true);
|
||||||
|
|
||||||
|
if (count($array_update)) {
|
||||||
|
foreach ($array_update as $row) {
|
||||||
|
$id = $row['id'];
|
||||||
|
$values = [];
|
||||||
|
$values['label'] = $row['label'];
|
||||||
|
$values['image'] = $row['image'];
|
||||||
|
$values['width'] = $row['width'];
|
||||||
|
$values['height'] = $row['height'];
|
||||||
|
$values['pos_x'] = $row['pos_x'];
|
||||||
|
$values['pos_y'] = $row['pos_y'];
|
||||||
|
|
||||||
|
switch ($row['rowtype']) {
|
||||||
|
case NETWORK_LINK:
|
||||||
|
case LINE_ITEM:
|
||||||
|
continue 2;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SIMPLE_VALUE_MAX:
|
||||||
|
case SIMPLE_VALUE_MIN:
|
||||||
|
case SIMPLE_VALUE_AVG:
|
||||||
|
$values['period'] = $row['period'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MODULE_GRAPH:
|
||||||
|
$values['period'] = $row['period'];
|
||||||
|
unset($values['image']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GROUP_ITEM:
|
||||||
|
$values['id_group'] = $row['group'];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CIRCULAR_PROGRESS_BAR:
|
||||||
|
case CIRCULAR_INTERIOR_PROGRESS_BAR:
|
||||||
|
case PERCENTILE_BUBBLE:
|
||||||
|
case PERCENTILE_BAR:
|
||||||
|
unset($values['height']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('METACONSOLE')) {
|
||||||
|
$values['id_metaconsole'] = $row['id_server'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['id_agent'] = $row['agent'];
|
||||||
|
$values['id_agente_modulo'] = $row['module'];
|
||||||
|
$values['id_custom_graph'] = $row['custom_graph'];
|
||||||
|
$values['parent_item'] = $row['parent'];
|
||||||
|
$values['id_layout_linked'] = $row['map_linked'];
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
enterprise_visual_map_update_action_from_list_elements($row['rowtype'], $values, $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
db_process_sql_update('tlayout_data', $values, ['id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
$id_element = get_parameter('id_element');
|
$id_element = get_parameter('id_element');
|
||||||
$result = db_process_sql_delete('tlayout_data', ['id' => $id_element]);
|
$result = db_process_sql_delete('tlayout_data', ['id' => $id_element]);
|
||||||
|
@ -184,7 +184,7 @@ $buttons['ITSM'] = [
|
|||||||
|
|
||||||
$buttons['ehorus'] = [
|
$buttons['ehorus'] = [
|
||||||
'active' => false,
|
'active' => false,
|
||||||
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=ehorus').'">'.html_print_image(
|
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=pandorarc').'">'.html_print_image(
|
||||||
'images/RC.png',
|
'images/RC.png',
|
||||||
true,
|
true,
|
||||||
[
|
[
|
||||||
@ -297,7 +297,7 @@ switch ($section) {
|
|||||||
$help_header = 'setup_flow_tab';
|
$help_header = 'setup_flow_tab';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ehorus':
|
case 'pandorarc':
|
||||||
$buttons['ehorus']['active'] = true;
|
$buttons['ehorus']['active'] = true;
|
||||||
$subpage = __('Pandora RC');
|
$subpage = __('Pandora RC');
|
||||||
$help_header = 'setup_ehorus_tab';
|
$help_header = 'setup_ehorus_tab';
|
||||||
@ -442,7 +442,7 @@ switch ($section) {
|
|||||||
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
|
include_once $config['homedir'].'/godmode/setup/setup_visuals.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ehorus':
|
case 'pandorarc':
|
||||||
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
include_once $config['homedir'].'/godmode/setup/setup_ehorus.php';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
BIN
pandora_console/images/widgets/service_level.png
Normal file
BIN
pandora_console/images/widgets/service_level.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -459,17 +459,17 @@ function cron_task_start_gotty(bool $restart_mode=true)
|
|||||||
|
|
||||||
// Check prev process running and kill it (only if port changed in setup params).
|
// Check prev process running and kill it (only if port changed in setup params).
|
||||||
if (empty($config['restart_gotty_next_cron_port']) === false) {
|
if (empty($config['restart_gotty_next_cron_port']) === false) {
|
||||||
config_update_value('restart_gotty_next_cron_port', '');
|
$prevProcessRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."' | grep -v 'pgrep'");
|
||||||
|
|
||||||
$prevProcessRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
|
|
||||||
|
|
||||||
if (empty($prevProcessRunning) === false) {
|
if (empty($prevProcessRunning) === false) {
|
||||||
shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
|
shell_exec("pkill -f 'pandora_gotty.*-p ".$config['restart_gotty_next_cron_port']."'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config_update_value('restart_gotty_next_cron_port', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if gotty is running on the configured port.
|
// Check if gotty is running on the configured port.
|
||||||
$processRunning = shell_exec("pgrep -f 'pandora_gotty.*-p ".$config['gotty_port']."'");
|
$processRunning = shell_exec("pgrep -af 'pandora_gotty.*-p ".$config['gotty_port']."' | grep -v 'pgrep'");
|
||||||
|
|
||||||
$start_proc = true;
|
$start_proc = true;
|
||||||
|
|
||||||
|
@ -466,6 +466,10 @@ class Widget
|
|||||||
$className .= '\HeatmapWidget';
|
$className .= '\HeatmapWidget';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'service_level':
|
||||||
|
$className .= '\ServiceLevelWidget';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'security_hardening':
|
case 'security_hardening':
|
||||||
if (\enterprise_installed() === false) {
|
if (\enterprise_installed() === false) {
|
||||||
$not_installed = true;
|
$not_installed = true;
|
||||||
|
672
pandora_console/include/lib/Dashboard/Widgets/service_level.php
Normal file
672
pandora_console/include/lib/Dashboard/Widgets/service_level.php
Normal file
@ -0,0 +1,672 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Widget Service Level Pandora FMS Console
|
||||||
|
*
|
||||||
|
* @category Console Class
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Widget Service Level
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2023 Pandora FMS
|
||||||
|
* Please see https://pandorafms.com/community/ for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PandoraFMS\Dashboard;
|
||||||
|
use PandoraFMS\Agent;
|
||||||
|
use PandoraFMS\Module;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service Level Widgets
|
||||||
|
*/
|
||||||
|
class ServiceLevelWidget extends Widget
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name widget.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title widget.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page widget;
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $page;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class name widget.
|
||||||
|
*
|
||||||
|
* @var [type]
|
||||||
|
*/
|
||||||
|
protected $className;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Values options for each widget.
|
||||||
|
*
|
||||||
|
* @var [type]
|
||||||
|
*/
|
||||||
|
protected $values;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration required.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $configurationRequired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error load widget.
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
protected $loadError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Width.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Heigth.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $height;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grid Width.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $gridWidth;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct.
|
||||||
|
*
|
||||||
|
* @param integer $cellId Cell ID.
|
||||||
|
* @param integer $dashboardId Dashboard ID.
|
||||||
|
* @param integer $widgetId Widget ID.
|
||||||
|
* @param integer|null $width New width.
|
||||||
|
* @param integer|null $height New height.
|
||||||
|
* @param integer|null $gridWidth Grid width.
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
int $cellId,
|
||||||
|
int $dashboardId=0,
|
||||||
|
int $widgetId=0,
|
||||||
|
?int $width=0,
|
||||||
|
?int $height=0,
|
||||||
|
?int $gridWidth=0
|
||||||
|
) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
include_once $config['homedir'].'/include/functions_agents.php';
|
||||||
|
include_once $config['homedir'].'/include/functions_modules.php';
|
||||||
|
|
||||||
|
// WARNING: Do not edit. This chunk must be in the constructor.
|
||||||
|
parent::__construct(
|
||||||
|
$cellId,
|
||||||
|
$dashboardId,
|
||||||
|
$widgetId
|
||||||
|
);
|
||||||
|
// Width.
|
||||||
|
$this->width = $width;
|
||||||
|
|
||||||
|
// Height.
|
||||||
|
$this->height = $height;
|
||||||
|
|
||||||
|
// Grid Width.
|
||||||
|
$this->gridWidth = $gridWidth;
|
||||||
|
|
||||||
|
// Options.
|
||||||
|
$this->values = $this->decoders($this->getOptionsWidget());
|
||||||
|
|
||||||
|
// Positions.
|
||||||
|
$this->position = $this->getPositionWidget();
|
||||||
|
|
||||||
|
// Page.
|
||||||
|
$this->page = basename(__FILE__);
|
||||||
|
|
||||||
|
// ClassName.
|
||||||
|
$class = new \ReflectionClass($this);
|
||||||
|
$this->className = $class->getShortName();
|
||||||
|
|
||||||
|
// Title.
|
||||||
|
$this->title = __('Service Level Detail');
|
||||||
|
|
||||||
|
// Name.
|
||||||
|
if (empty($this->name) === true) {
|
||||||
|
$this->name = 'service_level';
|
||||||
|
}
|
||||||
|
|
||||||
|
// This forces at least a first configuration.
|
||||||
|
$this->configurationRequired = false;
|
||||||
|
if (isset($this->values['mModules']) === false) {
|
||||||
|
$this->configurationRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->overflow_scrollbars = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decoders hack for retrocompability.
|
||||||
|
*
|
||||||
|
* @param array $decoder Values.
|
||||||
|
*
|
||||||
|
* @return array Returns the values with the correct key.
|
||||||
|
*/
|
||||||
|
public function decoders(array $decoder): array
|
||||||
|
{
|
||||||
|
$values = [];
|
||||||
|
// Retrieve global - common inputs.
|
||||||
|
$values = parent::decoders($decoder);
|
||||||
|
|
||||||
|
if (isset($decoder['interval']) === true) {
|
||||||
|
$values['interval'] = $decoder['interval'];
|
||||||
|
} else {
|
||||||
|
$values['interval'] = '28800';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['show_agents']) === true) {
|
||||||
|
$values['show_agents'] = $decoder['show_agents'];
|
||||||
|
} else {
|
||||||
|
$values['show_agents'] = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mTypeShow']) === true) {
|
||||||
|
$values['mTypeShow'] = $decoder['mTypeShow'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mGroup']) === true) {
|
||||||
|
$values['mGroup'] = $decoder['mGroup'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mRecursion']) === true) {
|
||||||
|
$values['mRecursion'] = $decoder['mRecursion'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mModuleGroup']) === true) {
|
||||||
|
$values['mModuleGroup'] = $decoder['mModuleGroup'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mAgents']) === true) {
|
||||||
|
$values['mAgents'] = $decoder['mAgents'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mShowCommonModules']) === true) {
|
||||||
|
$values['mShowCommonModules'] = $decoder['mShowCommonModules'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['mModules']) === true) {
|
||||||
|
$values['mModules'] = $decoder['mModules'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates inputs for form (specific).
|
||||||
|
*
|
||||||
|
* @return array Of inputs.
|
||||||
|
*
|
||||||
|
* @throws Exception On error.
|
||||||
|
*/
|
||||||
|
public function getFormInputs(): array
|
||||||
|
{
|
||||||
|
$values = $this->values;
|
||||||
|
|
||||||
|
// Retrieve global - common inputs.
|
||||||
|
$inputs = parent::getFormInputs();
|
||||||
|
|
||||||
|
// Interval.
|
||||||
|
$fields = [
|
||||||
|
'604800' => __('1 week'),
|
||||||
|
'172800' => __('48 hours'),
|
||||||
|
'86400' => __('24 hours'),
|
||||||
|
'43200' => __('12 hours'),
|
||||||
|
'28800' => __('8 hours'),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Interval'),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select',
|
||||||
|
'fields' => $fields,
|
||||||
|
'name' => 'interval-'.$this->cellId,
|
||||||
|
'selected' => $values['interval'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Show agent.
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Show agents'),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'switch',
|
||||||
|
'name' => 'show_agents-'.$this->cellId,
|
||||||
|
'value' => $values['show_agents'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$return_all_group = false;
|
||||||
|
|
||||||
|
if (users_can_manage_group_all('RM') || $this->values['mGroup'] == 0) {
|
||||||
|
$return_all_group = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mgroup = '';
|
||||||
|
if (isset($this->values['mGroup']) === false) {
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT id_group FROM tdashboard WHERE id = %d',
|
||||||
|
$this->dashboardId
|
||||||
|
);
|
||||||
|
|
||||||
|
$group_dahsboard = db_get_value_sql($sql);
|
||||||
|
if ($group_dahsboard > 0) {
|
||||||
|
$mgroup = $group_dahsboard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$this->values['mAgents'] = $this->getIdCacheAgent($this->values['mAgents']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inputs[] = [
|
||||||
|
'class' => 'flex flex-row',
|
||||||
|
'id' => 'select_multiple_modules_filtered',
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select_multiple_modules_filtered',
|
||||||
|
'uniqId' => $this->cellId,
|
||||||
|
'mGroup' => (isset($this->values['mGroup']) === true) ? $this->values['mGroup'] : $mgroup,
|
||||||
|
'mRecursion' => (isset($this->values['mRecursion']) === true) ? $this->values['mRecursion'] : '',
|
||||||
|
'mModuleGroup' => (isset($this->values['mModuleGroup']) === true) ? $this->values['mModuleGroup'] : '',
|
||||||
|
'mAgents' => (isset($this->values['mAgents']) === true) ? $this->values['mAgents'] : '',
|
||||||
|
'mShowCommonModules' => (isset($this->values['mShowCommonModules']) === true) ? $this->values['mShowCommonModules'] : '',
|
||||||
|
'mModules' => (isset($this->values['mModules']) === true) ? $this->values['mModules'] : '',
|
||||||
|
'mShowSelectedOtherGroups' => true,
|
||||||
|
'mReturnAllGroup' => $return_all_group,
|
||||||
|
'mMetaFields' => ((bool) is_metaconsole()),
|
||||||
|
'commonModulesSwitch' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
return $inputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Post for widget.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPost():array
|
||||||
|
{
|
||||||
|
// Retrieve global - common inputs.
|
||||||
|
$values = parent::getPost();
|
||||||
|
|
||||||
|
$values['interval'] = \get_parameter('interval-'.$this->cellId, '28800');
|
||||||
|
|
||||||
|
$values['show_agents'] = \get_parameter('show_agents-'.$this->cellId, '0');
|
||||||
|
|
||||||
|
$values['mTypeShow'] = \get_parameter(
|
||||||
|
'filtered-type-show-'.$this->cellId
|
||||||
|
);
|
||||||
|
|
||||||
|
$values['mGroup'] = \get_parameter(
|
||||||
|
'filtered-module-group-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mRecursion'] = \get_parameter_switch(
|
||||||
|
'filtered-module-recursion-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mModuleGroup'] = \get_parameter(
|
||||||
|
'filtered-module-module-group-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mAgents'] = \get_parameter(
|
||||||
|
'filtered-module-agents-'.$this->cellId
|
||||||
|
);
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$values['mAgents'] = $this->getRealIdAgentNode($values['mAgents']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values['mShowCommonModules'] = \get_parameter(
|
||||||
|
'filtered-module-show-common-modules-'.$this->cellId
|
||||||
|
);
|
||||||
|
$values['mModules'] = explode(
|
||||||
|
',',
|
||||||
|
\get_parameter(
|
||||||
|
'filtered-module-modules-'.$this->cellId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw widget.
|
||||||
|
*
|
||||||
|
* @return string;
|
||||||
|
*/
|
||||||
|
public function load()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$output = '';
|
||||||
|
if (check_acl($config['id_user'], 0, 'AR') === 0) {
|
||||||
|
$output .= '<div class="container-center">';
|
||||||
|
$output .= ui_print_error_message(
|
||||||
|
__('You don\'t have access'),
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
$output .= '</div>';
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
$interval_range = [];
|
||||||
|
$current_timestamp = time();
|
||||||
|
$interval_range['start'] = ($current_timestamp - $this->values['interval']);
|
||||||
|
$interval_range['end'] = $current_timestamp;
|
||||||
|
|
||||||
|
$reduceAllModules = array_reduce(
|
||||||
|
$this->values['mModules'],
|
||||||
|
function ($carry, $item) {
|
||||||
|
if ($item === null) {
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() === true) {
|
||||||
|
$item = explode('|', $item);
|
||||||
|
$serverId = $item[0];
|
||||||
|
$fullname = $item[1];
|
||||||
|
if ($this->values['mShowCommonModules'] !== 'on') {
|
||||||
|
$item = explode(' » ', $fullname);
|
||||||
|
$name = $item[1];
|
||||||
|
$carry['modules_selected'][$serverId][$name] = null;
|
||||||
|
$carry['modules'][$name] = null;
|
||||||
|
} else {
|
||||||
|
$carry['modules'][$fullname] = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$carry['modules'][$item] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $carry;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$allModules = $reduceAllModules['modules'];
|
||||||
|
$visualData = [];
|
||||||
|
// Extract info agents selected.
|
||||||
|
$target_agents = explode(',', $this->values['mAgents']);
|
||||||
|
foreach ($target_agents as $agent_id) {
|
||||||
|
try {
|
||||||
|
if (is_metaconsole() === true && str_contains($agent_id, '|') === true) {
|
||||||
|
$server_agent = explode('|', $agent_id);
|
||||||
|
} else {
|
||||||
|
$id_agente = $agent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
if (isset($server_agent) === true) {
|
||||||
|
$id_agente = $server_agent[1];
|
||||||
|
$tserver = $server_agent[0];
|
||||||
|
} else {
|
||||||
|
$tmeta_agent = db_get_row_filter(
|
||||||
|
'tmetaconsole_agent',
|
||||||
|
[ 'id_agente' => $id_agente ]
|
||||||
|
);
|
||||||
|
$id_agente = $tmeta_agent['id_tagente'];
|
||||||
|
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (metaconsole_connect(null, $tserver) !== NOERR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$agent = new Agent((int) $id_agente);
|
||||||
|
$visualData[$agent_id]['agent_status'] = $agent->lastStatus();
|
||||||
|
$visualData[$agent_id]['agent_name'] = $agent->name();
|
||||||
|
$visualData[$agent_id]['agent_alias'] = $agent->alias();
|
||||||
|
$visualData[$agent_id]['modules'] = [];
|
||||||
|
if (empty($allModules) === false) {
|
||||||
|
if (is_metaconsole() === true && $this->values['mShowCommonModules'] !== 'on') {
|
||||||
|
if (isset($reduceAllModules['modules_selected'][$tserver]) === true) {
|
||||||
|
$modules = $agent->searchModules(
|
||||||
|
['nombre' => array_keys($reduceAllModules['modules_selected'][$tserver])]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$modules = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$modules = $agent->searchModules(
|
||||||
|
['nombre' => array_keys($allModules)]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$visualData[$agent_id]['modules'] = $allModules;
|
||||||
|
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
metaconsole_restore_db();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
if ($module === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_module_array = $module->toArray();
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()] = [];
|
||||||
|
$last_status = $module->getStatus()->toArray();
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = $last_status['last_status_change'];
|
||||||
|
|
||||||
|
// Mean Time Between Failure.
|
||||||
|
// Mean Time To Solution.
|
||||||
|
// Availability.
|
||||||
|
if ((bool) is_metaconsole() === true) {
|
||||||
|
$module_id = $tserver.'|'.$data_module_array['id_agente_modulo'];
|
||||||
|
} else {
|
||||||
|
$module_id = $data_module_array['id_agente_modulo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$module_data = service_level_module_data($interval_range['start'], $interval_range['end'], $module_id);
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['mtrs'] = ($module_data['mtrs'] !== false) ? human_milliseconds_to_string(($module_data['mtrs'] * 100), 'short') : '-';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['mtbf'] = ($module_data['mtbf'] !== false) ? human_milliseconds_to_string(($module_data['mtbf'] * 100), 'short') : '-';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['availability'] = ($module_data['availability'] !== false) ? $module_data['availability'] : '100';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['critical_events'] = ($module_data['critical_events'] !== false) ? $module_data['critical_events'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['warning_events'] = ($module_data['warning_events'] !== false) ? $module_data['warning_events'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['last_status_change'] = ($module_data['last_status_change'] !== false) ? $module_data['last_status_change'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['agent_alias'] = ($module_data['agent_alias'] !== false) ? $module_data['agent_alias'] : '';
|
||||||
|
$visualData[$agent_id]['modules'][$module->name()]['module_name'] = ($module_data['module_name'] !== false) ? $module_data['module_name'] : '';
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
echo 'Error: ['.$agent_id.']'.$e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = new \stdClass();
|
||||||
|
|
||||||
|
$table->width = '100%';
|
||||||
|
$table->class = 'databox filters filter-table-adv';
|
||||||
|
|
||||||
|
$table->head = [];
|
||||||
|
$show_agents = $this->values['show_agents'];
|
||||||
|
if ($show_agents === 'on') {
|
||||||
|
$table->head[0] = __('Agent / Modules');
|
||||||
|
} else {
|
||||||
|
$table->head[0] = __('Modules');
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->head[1] = __('% Av.');
|
||||||
|
$table->head[2] = __('MTBF');
|
||||||
|
$table->head[3] = __('MTRS');
|
||||||
|
$table->head[4] = __('Crit. Events').ui_print_help_tip(__('Counted only critical events generated automatic by the module'), true);
|
||||||
|
$table->head[5] = __('Warn. Events').ui_print_help_tip(__('Counted only warning events generated automatic by the module'), true);
|
||||||
|
$table->head[6] = __('Last change');
|
||||||
|
$table->data = [];
|
||||||
|
$table->cellstyle = [];
|
||||||
|
$row = 0;
|
||||||
|
foreach ($visualData as $agent_id => $data) {
|
||||||
|
foreach ($data['modules'] as $module_name => $module_data) {
|
||||||
|
if (isset($module_data) === true) {
|
||||||
|
if ($show_agents === 'on') {
|
||||||
|
$table->data[$row][0] = $module_data['agent_alias'].' / '.$module_data['module_name'];
|
||||||
|
$table->cellstyle[$row][0] = 'text-align:left';
|
||||||
|
} else {
|
||||||
|
$table->data[$row][0] = $module_data['module_name'];
|
||||||
|
$table->cellstyle[$row][0] = 'text-align:left';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table->data[$row][1] = $module_data['availability'].'%';
|
||||||
|
$table->data[$row][2] = $module_data['mtbf'];
|
||||||
|
$table->data[$row][3] = $module_data['mtrs'];
|
||||||
|
$table->data[$row][4] = $module_data['critical_events'];
|
||||||
|
$table->data[$row][5] = $module_data['warning_events'];
|
||||||
|
$table->data[$row][6] = date(TIME_FORMAT, $module_data['last_status_change']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$height = (count($table->data) * 32);
|
||||||
|
$style = 'min-width:400px; min-height:'.$height.'px;';
|
||||||
|
$output = '<div class="container-top" style="'.$style.'">';
|
||||||
|
$output .= html_print_table($table, true);
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get description.
|
||||||
|
*
|
||||||
|
* @return string.
|
||||||
|
*/
|
||||||
|
public static function getDescription()
|
||||||
|
{
|
||||||
|
return __('Service Level Detail');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Name.
|
||||||
|
*
|
||||||
|
* @return string.
|
||||||
|
*/
|
||||||
|
public static function getName()
|
||||||
|
{
|
||||||
|
return 'service_level';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get size Modal Configuration.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSizeModalConfiguration(): array
|
||||||
|
{
|
||||||
|
$size = [
|
||||||
|
'width' => 800,
|
||||||
|
'height' => 270,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array with the real id agent and server.
|
||||||
|
*
|
||||||
|
* @param string $id_agents_cache String with the agents cache id.
|
||||||
|
*
|
||||||
|
* @return string $agents_servers with the real id agent and server.
|
||||||
|
*/
|
||||||
|
public function getRealIdAgentNode($id_agents_cache)
|
||||||
|
{
|
||||||
|
$agents_servers = [];
|
||||||
|
$target_agents = explode(',', $id_agents_cache);
|
||||||
|
foreach ($target_agents as $agent_id) {
|
||||||
|
$id_agente = $agent_id;
|
||||||
|
$tmeta_agent = db_get_row_filter(
|
||||||
|
'tmetaconsole_agent',
|
||||||
|
['id_agente' => $id_agente]
|
||||||
|
);
|
||||||
|
|
||||||
|
$id_agente = $tmeta_agent['id_tagente'];
|
||||||
|
$tserver = $tmeta_agent['id_tmetaconsole_setup'];
|
||||||
|
$agents_servers[] = $tserver.'|'.$id_agente;
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(',', $agents_servers);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return string with the cache id agent in metaconsole.
|
||||||
|
*
|
||||||
|
* @param string $id_agents String with the agents and server id.
|
||||||
|
*
|
||||||
|
* @return string $cache_id_agents with the cache id agent.
|
||||||
|
*/
|
||||||
|
public function getIdCacheAgent($id_agents)
|
||||||
|
{
|
||||||
|
$target_agents = explode(',', $id_agents);
|
||||||
|
$cache_id_agents = [];
|
||||||
|
foreach ($target_agents as $agent_id) {
|
||||||
|
if (str_contains($agent_id, '|') === false) {
|
||||||
|
$cache_id_agents[] = $agent_id;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$server_agent = explode('|', $agent_id);
|
||||||
|
$tmeta_agent = db_get_row_filter(
|
||||||
|
'tmetaconsole_agent',
|
||||||
|
[
|
||||||
|
'id_tagente' => $server_agent[1],
|
||||||
|
'id_tmetaconsole_setup' => $server_agent[0],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$cache_id_agents[] = $tmeta_agent['id_agente'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode(',', $cache_id_agents);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -284,6 +284,11 @@ li#div-textarea label {
|
|||||||
display: initial;
|
display: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-widget .container-top {
|
||||||
|
height: 100%;
|
||||||
|
width: 99%;
|
||||||
|
}
|
||||||
|
|
||||||
.widget-groups-status {
|
.widget-groups-status {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -784,6 +784,11 @@ form ul.form_flex {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content-widget .container-top {
|
||||||
|
height: 100%;
|
||||||
|
width: 99%;
|
||||||
|
}
|
||||||
|
|
||||||
.container-layout {
|
.container-layout {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
border: 3px dashed #fff;
|
border: 3px dashed #fff;
|
||||||
|
@ -1205,57 +1205,6 @@ if (is_ajax() === true) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($get_agents_in_group) {
|
|
||||||
$id = (int) get_parameter('id', 0);
|
|
||||||
$group = (int) get_parameter('group', -1);
|
|
||||||
|
|
||||||
$return = [];
|
|
||||||
$return['correct'] = false;
|
|
||||||
|
|
||||||
if ($group != -1) {
|
|
||||||
$where_id_agente = ' 1=1 ';
|
|
||||||
|
|
||||||
$agents_in_networkmap = db_get_all_rows_filter(
|
|
||||||
'titem',
|
|
||||||
[
|
|
||||||
'id_map' => $id,
|
|
||||||
'deleted' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if ($agents_in_networkmap !== false) {
|
|
||||||
$ids = [];
|
|
||||||
foreach ($agents_in_networkmap as $agent) {
|
|
||||||
if ($agent['type'] == 0) {
|
|
||||||
$ids[] = $agent['source_data'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$where_id_agente = ' id_agente NOT IN ('.implode(',', $ids).')';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$sql = 'SELECT id_agente, alias
|
|
||||||
FROM tagente
|
|
||||||
WHERE id_grupo = '.$group.' AND '.$where_id_agente.'
|
|
||||||
ORDER BY alias ASC';
|
|
||||||
|
|
||||||
$agents = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
if ($agents !== false) {
|
|
||||||
$return['agents'] = [];
|
|
||||||
foreach ($agents as $agent) {
|
|
||||||
$return['agents'][$agent['id_agente']] = $agent['alias'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$return['correct'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($return);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_agent_info) {
|
if ($get_agent_info) {
|
||||||
$id_agent = (int) get_parameter('id_agent');
|
$id_agent = (int) get_parameter('id_agent');
|
||||||
|
|
||||||
|
@ -2730,7 +2730,7 @@ SET @short_name = 'pandorafms.vmware';
|
|||||||
SET @name = 'VMware';
|
SET @name = 'VMware';
|
||||||
SET @section = 'app';
|
SET @section = 'app';
|
||||||
SET @description = 'Monitor ESXi hosts, datastores and VMs from a specific datacenter';
|
SET @description = 'Monitor ESXi hosts, datastores and VMs from a specific datacenter';
|
||||||
SET @version = '1.1';
|
SET @version = '1.2';
|
||||||
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
|
INSERT IGNORE INTO `tdiscovery_apps` (`id_app`, `short_name`, `name`, `section`, `description`, `version`) VALUES ('', @short_name, @name, @section, @description, @version);
|
||||||
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
|
SELECT @id_app := `id_app` FROM `tdiscovery_apps` WHERE `short_name` = @short_name;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user