diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e6553ada2f..d2e886052d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.769-230313 +Version: 7.0NG.769-230323 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index cadc4a6fd2..122b06ac79 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230313" +pandora_version="7.0NG.769-230323" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index f828e1a7ae..ef17f8a8f4 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.769'; -use constant AGENT_BUILD => '230313'; +use constant AGENT_BUILD => '230323'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -3749,6 +3749,7 @@ sub module_plugin ($) { # Do not save the output if there was an error if ($? != 0) { + log_message ('error', "plugin execution '". $command ."' exited with error code " . $?); return (); } diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 4ff8cf8848..af7e2e2596 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230313 +%define release 230323 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 6705e0ee72..7a3adae918 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.769 -%define release 230313 +%define release 230323 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 06c37d34cd..97c4765dbd 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.769" -PI_BUILD="230313" +PI_BUILD="230323" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/autodiscover b/pandora_agents/unix/plugins/autodiscover index 03b2c3d76d..01b9bd3d96 100644 --- a/pandora_agents/unix/plugins/autodiscover +++ b/pandora_agents/unix/plugins/autodiscover @@ -6,21 +6,22 @@ # # (c) A. Kevin Rojas # +# Edited in 2023 by Alejandro Sánchez +# # TO DO LIST: # - Enable child services detection (Windows) # - Make CPU/Memory usage available for child services (Windows) # ################################################### - try: from sys import argv from sys import stderr from sys import exit + import psutil from subprocess import Popen from subprocess import PIPE from subprocess import DEVNULL from subprocess import getstatusoutput - import psutil except ModuleNotFoundError as err: print("{} error: {}. Exiting...".format(argv[0], err), file=stderr) exit(1) @@ -28,99 +29,100 @@ except ModuleNotFoundError as err: module_list = [] VERSION = "1.2" +def win_service(servicelist, option=False, memcpu=False): -######################################################################################### -# Powershell class -######################################################################################### -class PSCheck: - @staticmethod - def check_service(servicename, option=False, memcpu=False): - """Check services with powershell by parsing their DisplayName. Returns a dict\ - list with the name of the service and a boolean with its status.\n - Requires service name (case insensitive).""" - pscall = Popen(["powershell", "Get-Service", "-Name", "'*"+ str(servicename) + "*'", - "|", "Select-Object", "-ExpandProperty", "Name"], - stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True) - result = pscall.communicate() - result = str(result[0]).strip().split("\n") - procname = '' - if result != '': - output = [] - for element in result: - if element != '': - # Get process name - procname = PSCheck.get_serviceprocess(element) - # Get process status - parstatus = PSCheck.getstatus(element) - if memcpu and parstatus == 1: - usage = get_memcpu(str(procname), str(element)) - output += usage - # Generate module with name and status - parent = service_module(str(element), parstatus) - output += parent - if option: - children = PSCheck.getchildren(element, memcpu) - if isinstance(children, list) and len(children) > 1: - for child in children: - output += child - else: - output += children - else: - next - - if output and element and procname: - return ({"name" : element, "process" : procname, "modules": output}) + modules_default = [] + modules_percentage=[] + ## take all services + services=psutil.win_service_iter() + for service in services: + if service.name() in servicelist: + serv=service.as_dict() + if serv['status']=='running': + value=1 else: - return (None) + value=0 - @staticmethod - def getchildren(servicename, memcpu=False): - """Gets Dependent services of a given Windows service""" - pschild = Popen(["powershell", "Get-Service", "-Name '" + str(servicename) + - "' -DS", "|", "Select-Object", "-ExpandProperty", "Name"], - stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True) - children = pschild.communicate()[0].strip() - kids = [] - for child in (children.split("\n") if children != "" else []): - status = PSCheck.getstatus(child) - kids += service_module(str(child), status, "Service " + str(servicename) + " - Status") - if status: - if memcpu: - kidsusage = get_memcpu(str(child)) - for usage in kidsusage: - kids += usage + ## create module for each service + parent = build_module("Service " + str(serv['name']) + " - Status", value,"generic_proc") + modules_default +=parent + + # memory and cpu percentage + if memcpu: + ## process + srv_pid = service.pid() + process = psutil.Process(srv_pid) + proc_name = process.name() + ##cpu + value_cpu=process.cpu_percent(interval=0.5) + parent = build_module("Service " + str(proc_name) + " - CPU usage", value_cpu,"generic_data") + parent[0].update([("unit","%"),("module_parent",str(serv['name']))]) + modules_percentage +=parent + ##mem + value_mem=process.memory_percent() + parent = build_module("Service " + str(proc_name) + " - Memory usage", value_mem,"generic_data") + parent[0].update([("unit","%"),("module_parent",str(serv['name']))]) + modules_percentage +=parent + + + for module in modules_default: + print_module(module, 1) + if memcpu: + for module in modules_percentage: + print_module(module, 1) + +def lnx_service(services_list, memcpu=False): + """Creates modules for Linux servers""" + modules = [] + sysctl = getstatusoutput("command -v systemctl")[0] + servic = getstatusoutput("command -v service")[0] + for srvc in services_list: + status = None + if sysctl == 0: + ### Systemd available + syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE, + stdin=DEVNULL, universal_newlines=True) + result = syscall.communicate() + srvstatus = result[0].strip().lower().split("\n") + if srvstatus[0] == "loadstate=not-found": + next + else: + if srvstatus[1] == "activestate=active": + modules += build_module("Service " + srvc + " - Status", 1, "generic_proc") + status = 1 + elif srvstatus[1] == "activestate=inactive": + modules += build_module("Service " +srvc+ " - Status", 0, "generic_proc") + status = 0 + elif sysctl != 0 and servic == 0: + ### Systemd not available, switch to service command + syscall = Popen(["service", srvc, "status"], stdout=PIPE, + stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True) + result = syscall.communicate()[0].lower() + if "is running" in result: + modules += build_module("Service " + srvc + " - Status", 1, "generic_proc") + status = 1 + elif "is stopped" in result: + modules += build_module("Service " +srvc+ " - Status", 0, "generic_proc") + status = 0 else: next - return kids - - @staticmethod - def getstatus(servicename): - """Gets the status of a given Windows service""" - running = Popen(["powershell", "Get-Service", "-Name '" + str(servicename) + - "' |", "Select-Object", "-ExpandProperty", "Status"], - stdout=PIPE, stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True) - status = running.communicate()[0].strip() - return int(status == "Running") - - @staticmethod - def get_serviceprocess(servicename): - """Gets name of the process of the service""" - service = psutil.win_service_get(servicename) - srv_pid = service.pid() - process = psutil.Process(srv_pid) - proc_name = process.name() - return proc_name + else: + print("No systemd or service commands available. Exiting...", file=stderr) + exit() + if status: + module_list.append(srvc) + if memcpu: + modules += get_memcpu(srvc, None) + + for m in modules: + print_module(m, 1) -######################################################################################### -# Services creation -######################################################################################### - -def service_module(name, value, parent=None): +def build_module(name, value, module_type, parent=None): #print ("service_module BEGIN "+str(now(0,1))) module = [{ - "name" : "Service "+ name + " - Status", - "type" : "generic_proc", + "name" : name , + "type" : module_type, "value" : value, "module_parent" : parent, }] @@ -167,74 +169,6 @@ def proc_percentbyname(procname): ############# 03/03/2020 next #print ("proc_percentbyname END "+str(now(0,1))) return [sum(memory),sum(cpu)] - -def win_service(servicelist, option=False, memcpu=False): - """Creates modules for Windows servers.""" - modules = [] - for srvc in servicelist: - if srvc and len(srvc) > 2: - output = PSCheck.check_service(srvc, option, memcpu) - if output is not None and output["modules"]: - modules += PSCheck.check_service(srvc.strip(), option, memcpu)["modules"] - module_list.append(srvc) - #winprocess = output["name"] - #if memcpu == True: - # modules += get_memcpu(winprocess) ## Only available for parent service ATM. - else: - next - else: - next - for module in modules: - print_module(module, 1) - - -def lnx_service(services_list, memcpu=False): - """Creates modules for Linux servers""" - modules = [] - sysctl = getstatusoutput("command -v systemctl")[0] - servic = getstatusoutput("command -v service")[0] - for srvc in services_list: - status = None - if sysctl == 0: - ### Systemd available - syscall = Popen(["systemctl", "show", "-pLoadState", "-pActiveState", srvc], stdout=PIPE, - stdin=DEVNULL, universal_newlines=True) - result = syscall.communicate() - srvstatus = result[0].strip().lower().split("\n") - if srvstatus[0] == "loadstate=not-found": - next - else: - if srvstatus[1] == "activestate=active": - modules += service_module(srvc, 1) - status = 1 - elif srvstatus[1] == "activestate=inactive": - modules += service_module(srvc, 0) - status = 0 - elif sysctl != 0 and servic == 0: - ### Systemd not available, switch to service command - syscall = Popen(["service", srvc, "status"], stdout=PIPE, - stdin=DEVNULL, stderr=DEVNULL, universal_newlines=True) - result = syscall.communicate()[0].lower() - if "is running" in result: - modules += service_module(srvc, 1) - status = 1 - elif "is stopped" in result: - modules += service_module(srvc, 0) - status = 0 - else: - next - else: - print("No systemd or service commands available. Exiting...", file=stderr) - exit() - if status: - module_list.append(srvc) - if memcpu: - modules += get_memcpu(srvc, None) - - for m in modules: - print_module(m, 1) - - ######################################################################################### # print_module function ######################################################################################### @@ -356,6 +290,7 @@ def main(): service_list = ["MySQL", "postgresql", "pgsql", "oracle", "MSSQL", "IISADMIN", "apache", "nginx", "W3svc", "NTDS", "Netlogon", "DNS", "MSExchangeADTopology", "MSExchangeServiceHost", "MSExchangeSA", "MSExchangeTransport"] + discover(OS, service_list) elif psutil.LINUX: OS = "Linux" diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 60ebc7abad..9f9bbb30f2 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230313} +{230323} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index e7aeba8540..1a59e872aa 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.769 Build 230313") +#define PANDORA_VERSION ("7.0NG.769 Build 230323") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 394e2e2be5..bb8562378a 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.769(Build 230313))" + VALUE "ProductVersion", "(7.0NG.769(Build 230323))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 020733306e..b766df0562 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.769-230313 +Version: 7.0NG.769-230323 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 5a23822ad2..7425ed46b6 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.769-230313" +pandora_version="7.0NG.769-230323" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/files_repo.php b/pandora_console/extensions/files_repo.php index 656c3377c7..26e21750bb 100644 --- a/pandora_console/extensions/files_repo.php +++ b/pandora_console/extensions/files_repo.php @@ -240,7 +240,28 @@ function pandora_files_repo_operation() } // Header. - ui_print_page_header(__('Files repository'), 'images/extensions.png', false, '', false, $onheader); + ui_print_standard_header( + __('Files repository'), + 'images/extensions.png', + false, + '', + false, + $onheader, + [ + [ + 'link' => '', + 'label' => __('Admin tools'), + ], + [ + 'link' => '', + 'label' => __('Extension manager'), + ], + [ + 'link' => '', + 'label' => __('Files repository'), + ], + ] + ); $full_extensions_dir = $config['homedir'].'/'.EXTENSIONS_DIR.'/'; include_once $full_extensions_dir.'files_repo/functions_files_repo.php'; diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php index 9182380a95..21e41cb63a 100644 --- a/pandora_console/extensions/quick_shell.php +++ b/pandora_console/extensions/quick_shell.php @@ -140,25 +140,26 @@ function quickShell() ui_print_error_message(__('WebService engine has not been started, please check documentation.')); $wiz->printForm( [ - 'form' => [ + 'form' => [ 'method' => 'POST', 'action' => '#', - ], - 'inputs' => [ - [ - 'class' => 'w100p', - 'arguments' => [ - 'name' => 'submit', - 'label' => __('Retry'), - 'type' => 'submit', - 'attributes' => ['icon' => 'next'], - 'return' => true, - ], - ], + 'id' => 'retry_form', ], ] ); + html_print_action_buttons( + html_print_submit_button( + __('Retry'), + 'submit', + false, + [ + 'icon' => 'next', + 'form' => 'retry_form', + ], + true + ) + ); return; } @@ -168,6 +169,7 @@ function quickShell() 'action' => '#', 'class' => 'wizard', 'method' => 'post', + 'id' => 'connect_form', ], 'inputs' => [ [ @@ -198,19 +200,24 @@ function quickShell() 'script' => "p=22; if(this.value == 'telnet') { p=23; } $('#text-port').val(p);", ], ], - [ - 'arguments' => [ - 'type' => 'submit', - 'label' => __('Connect'), - 'attributes' => ['icon' => 'cog'], - ], - ], ], ], false, true ); + html_print_action_buttons( + html_print_submit_button( + __('Connect'), + 'submit', + false, + [ + 'icon' => 'cog', + 'form' => 'connect_form', + ], + true + ) + ); return; } @@ -434,84 +441,95 @@ function quickShellSettings() } // Form. Using old style. - echo '
'; + echo '
'; echo ''.__('Quickshell').''; $t = new StdClass(); $t->data = []; $t->width = '100%'; - $t->class = 'databox filters'; + $t->class = 'filter-table-adv'; $t->data = []; $t->style = []; - $t->style[0] = 'font-weight: bold; width: 40%;'; + $t->style[0] = 'width: 50%;'; - $t->data[0][0] = __('Gotty path'); - $t->data[0][1] = html_print_input_text( - 'gotty', - $config['gotty'], - '', - 30, - 100, - true + $t->data[0][] = html_print_label_input_block( + __('Gotty path'), + html_print_input_text( + 'gotty', + $config['gotty'], + '', + 30, + 100, + true + ) ); - $t->data[1][0] = __('Gotty host'); - $t->data[1][1] = html_print_input_text( - 'gotty_host', - $config['gotty_host'], - '', - 30, - 100, - true + $t->data[0][] = html_print_label_input_block( + __('Gotty host'), + html_print_input_text( + 'gotty_host', + $config['gotty_host'], + '', + 30, + 100, + true + ) ); - $t->data[2][0] = __('Gotty ssh port'); - $t->data[2][1] = html_print_input_text( - 'gotty_ssh_port', - $config['gotty_ssh_port'], - '', - 30, - 100, - true + $t->data[1][] = html_print_label_input_block( + __('Gotty ssh port'), + html_print_input_text( + 'gotty_ssh_port', + $config['gotty_ssh_port'], + '', + 30, + 100, + true + ) ); - $t->data[3][0] = __('Gotty telnet port'); - $t->data[3][1] = html_print_input_text( - 'gotty_telnet_port', - $config['gotty_telnet_port'], - '', - 30, - 100, - true + $t->data[1][] = html_print_label_input_block( + __('Gotty telnet port'), + html_print_input_text( + 'gotty_telnet_port', + $config['gotty_telnet_port'], + '', + 30, + 100, + true + ) ); - $hidden = new StdClass(); + $hidden = new stdClass(); $hidden->data = []; $hidden->width = '100%'; - $hidden->class = 'databox filters'; + $hidden->class = 'filter-table-adv'; $hidden->data = []; - $hidden->style[0] = 'font-weight: bold;width: 40%;'; + $hidden->style[0] = 'width: 50%;'; - $hidden->data[0][0] = __('Gotty user'); - $hidden->data[0][1] = html_print_input_text( - 'gotty_user', - $config['gotty_user'], - '', - 30, - 100, - true + $hidden->data[0][] = html_print_label_input_block( + __('Gotty user'), + html_print_input_text( + 'gotty_user', + $config['gotty_user'], + '', + 30, + 100, + true + ) ); - $hidden->data[1][0] = __('Gotty password'); - $hidden->data[1][1] = html_print_input_password( - 'gotty_pass', - io_output_password($config['gotty_pass']), - '', - 30, - 100, - true + $hidden->data[0][] = html_print_label_input_block( + __('Gotty password'), + html_print_input_password( + 'gotty_pass', + io_output_password($config['gotty_pass']), + '', + 30, + 100, + true + ) ); - $hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true); html_print_table($t); diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql index 76f0a84c4e..eaef394fcc 100644 --- a/pandora_console/extras/mr/62.sql +++ b/pandora_console/extras/mr/62.sql @@ -1,5 +1,14 @@ START TRANSACTION; +ALTER TABLE `tdatabase` ADD COLUMN `ssh_status` TINYINT UNSIGNED DEFAULT 0; +ALTER TABLE `tdatabase` ADD COLUMN `db_status` TINYINT UNSIGNED DEFAULT 0; +ALTER TABLE `tdatabase` ADD COLUMN `replication_status` TINYINT UNSIGNED DEFAULT 0; +ALTER TABLE `tdatabase` ADD COLUMN `replication_delay` BIGINT DEFAULT 0; +ALTER TABLE `tdatabase` ADD COLUMN `master` TINYINT UNSIGNED DEFAULT 0; +ALTER TABLE `tdatabase` ADD COLUMN `utimestamp` BIGINT DEFAULT 0; +ALTER TABLE `tdatabase` ADD COLUMN `mysql_version` VARCHAR(10) DEFAULT ''; +ALTER TABLE `tdatabase` ADD COLUMN `pandora_version` VARCHAR(10) DEFAULT ''; + UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1; UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2; UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3; @@ -155,4 +164,17 @@ INSERT INTO `twelcome_tip_file` (`twelcome_tip_file`, `filename`, `path`) VALUES (20, 'zoom_en_graficas.png', 'images/tips/'), (22, 'politica_de_pass.png', 'images/tips/'); +ALTER TABLE `tusuario` ADD COLUMN `show_tips_startup` TINYINT UNSIGNED NOT NULL DEFAULT 1; + +CREATE TABLE IF NOT EXISTS `tfavmenu_user` ( + `id` INT NOT NULL AUTO_INCREMENT, + `id_user` VARCHAR(255) NOT NULL, + `id_element` TEXT, + `url` TEXT NOT NULL, + `label` VARCHAR(255) NOT NULL, + `section` VARCHAR(255) NOT NULL, +PRIMARY KEY (`id`)); + +INSERT INTO `tconfig` (`token`, `value`) VALUES ('legacy_database_ha', 1); + COMMIT; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 40f6c3a382..b0cbc0cec5 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -407,7 +407,6 @@ echo sprintf('
', $menuTypeClass); // User. - // $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png'; $headerUser = []; $headerUser[] = html_print_image( 'images/edit_user@header.svg', diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index 8517b1c46c..0c89430122 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -27,10 +27,27 @@ require_once __DIR__.'/../include/functions_ui.php'; require_once __DIR__.'/../include/functions.php'; require_once __DIR__.'/../include/functions_html.php'; +echo ''; if ($config['visual_animation']) { + // form#login_form, div.login_data { echo ' + + + + + + + + + diff --git a/pandora_console/images/star_fav_menu.png b/pandora_console/images/star_fav_menu.png new file mode 100644 index 0000000000..5d1521f202 Binary files /dev/null and b/pandora_console/images/star_fav_menu.png differ diff --git a/pandora_console/images/status_dot.svg b/pandora_console/images/status_dot.svg new file mode 100644 index 0000000000..3e9c8b2ead --- /dev/null +++ b/pandora_console/images/status_dot.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pandora_console/images/world@svg.svg b/pandora_console/images/world@svg.svg new file mode 100644 index 0000000000..c71297eda4 --- /dev/null +++ b/pandora_console/images/world@svg.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / web@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/include/ajax/double_auth.ajax.php b/pandora_console/include/ajax/double_auth.ajax.php index 3a995ce43a..54856a26c3 100644 --- a/pandora_console/include/ajax/double_auth.ajax.php +++ b/pandora_console/include/ajax/double_auth.ajax.php @@ -216,11 +216,8 @@ if ($get_double_auth_info_page) { $html .= '

'; $html .= '
'; $html .= '
'; - $html .= '
'; + $html .= '
'; $html .= html_print_button(__('Download the app'), 'google_authenticator_download', false, '', '', true); - $html .= '
'; - $html .= '
'; - $html .= '
'; $html .= html_print_button(__('Continue'), 'continue_to_generate', false, '', '', true); $html .= '
'; @@ -311,11 +308,11 @@ if ($get_double_auth_generation_page) { $html .= '
'; $html .= __('QR').':
'; $html .= '
'; - $html .= '
'; + $html .= '
'; $html .= html_print_button(__('Refresh code'), 'continue_to_generate', false, '', '', true); - $html .= ' '; $html .= html_print_button(__('Continue'), 'continue_to_validate', false, '', '', true); $html .= '
'; + $html .= '
'; ob_clean(); ?> @@ -453,7 +450,7 @@ if ($get_double_auth_validation_page) { $html .= html_print_input_text('code', '', '', 50, $secret_lenght, true); $html .= '
'; $html .= '

'; - $html .= '
'; + $html .= '
'; $html .= html_print_button(__('Validate code'), 'continue_to_validate', false, '', '', true); $html .= html_print_image('images/spinner.gif', true); $html .= '
'; diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 70d6cba47e..45ee2efd9c 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -91,9 +91,8 @@ $node_id = (int) get_parameter('node_id', 0); if ($get_comments === true) { $event = get_parameter('event', false); - $event_rep = (int) get_parameter('event_rep', 0); - $event_rep = get_parameter_post('event')['event_rep']; - $group_rep = get_parameter_post('event')['group_rep']; + $event_rep = (int) get_parameter_post('event')['event_rep']; + $group_rep = (int) get_parameter_post('event')['group_rep']; if ($event === false) { return __('Failed to retrieve comments'); @@ -126,7 +125,7 @@ if ($get_comments === true) { } else if ($group_rep === EVENT_GROUP_REP_EXTRAIDS) { $whereGrouped = sprintf( '`id_extra` = "%s"', - $event['id_extra'] + io_safe_output($event['id_extra']) ); } else { $whereGrouped = sprintf('`id_evento` = %d', $event['id_evento']); diff --git a/pandora_console/include/ajax/fav_menu.ajax.php b/pandora_console/include/ajax/fav_menu.ajax.php new file mode 100644 index 0000000000..0b837ec9b3 --- /dev/null +++ b/pandora_console/include/ajax/fav_menu.ajax.php @@ -0,0 +1,82 @@ + $url, + 'id_user' => $config['id_user'], + ], + ['*'] +); +$res = false; +$action = ''; +if ($exist !== false) { + $res = db_process_sql_delete( + 'tfavmenu_user', + [ + 'url' => $url, + 'id_user' => $config['id_user'], + ] + ); + $action = 'delete'; +} else { + $res = db_process_sql_insert( + 'tfavmenu_user', + [ + 'id_element' => $id_element, + 'url' => $url, + 'label' => $label, + 'section' => $section, + 'id_user' => $id_user, + ] + ); + $action = 'create'; +} + +if ($res !== false) { + echo json_encode(['success' => true, 'action' => $action]); +} else { + echo json_encode(['success' => false, 'action' => $action]); +} diff --git a/pandora_console/include/ajax/map_enterprise.ajax.php b/pandora_console/include/ajax/map_enterprise.ajax.php index a0178457f5..4c5738f29a 100644 --- a/pandora_console/include/ajax/map_enterprise.ajax.php +++ b/pandora_console/include/ajax/map_enterprise.ajax.php @@ -25,6 +25,8 @@ if ((bool) is_metaconsole() === true) { if ($networkmap) { $networkmap_id = get_parameter('networkmap_id', 0); + $dashboard = get_parameter('dashboard', 0); + $size = get_parameter('size', []); $x_offset = get_parameter('x_offset', 0); $y_offset = get_parameter('y_offset', 0); $zoom_dash = get_parameter('zoom_dash', 0.5); @@ -62,6 +64,15 @@ if ($networkmap) { global $id_networkmap; $id_networkmap = $networkmap['id']; $tab = 'radial_dynamic'; + if (empty($size) === false) { + if ($size['width'] > $size['height']) { + $width = $size['height']; + $height = ($size['height'] - 10); + } else { + $width = $size['width']; + $height = ($size['width'] + 50); + } + } include_once 'operation/agentes/networkmap.dinamic.php'; } else { diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index bd356894ad..30b84be44f 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1573,7 +1573,7 @@ if (check_login()) { $value['thresholds'] ); - $resultData = ''; + $resultData = ''; if ($vdata !== null && $vdata !== '' && $vdata !== false) { if (isset($formatData) === true && (bool) $formatData === true @@ -1750,7 +1750,9 @@ if (check_login()) { INNER JOIN tagente ON tagente_modulo.id_agente = tagente.id_agente INNER JOIN tagente_estado - ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo' + ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + WHERE %s', + $where ); $recordsTotal = db_get_value_sql($sql_count); @@ -1795,6 +1797,32 @@ if (check_login()) { } } + if (in_array(0, $servers_ids) === true) { + $sql = sprintf( + 'SELECT + tagente_modulo.nombre, + tagente.alias, + tagente.id_agente, + tagente_estado.last_status_change, + tagente_estado.estado + FROM tagente_modulo + INNER JOIN tagente + ON tagente_modulo.id_agente = tagente.id_agente + INNER JOIN tagente_estado + ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + WHERE %s', + $where + ); + + $res_sql = db_get_all_rows_sql($sql); + + foreach ($res_sql as $row_sql) { + $row_sql['server_name'] = __('Metaconsole'); + $row_sql['server_url'] = $config['homeurl']; + array_push($data, $row_sql); + } + } + // Drop temporary table if exist. db_process_sql('DROP TEMPORARY TABLE IF EXISTS temp_modules_status;'); @@ -1852,7 +1880,9 @@ if (check_login()) { $sql_count = sprintf( 'SELECT COUNT(*) AS "total" - FROM temp_modules_status' + FROM temp_modules_status + WHERE %s', + $where ); $recordsTotal = db_get_value_sql($sql_count); @@ -2044,6 +2074,14 @@ if (check_login()) { if ($monitor_filters === false) { echo 'error'; } else { + db_process_sql_delete( + 'tfavmenu_user', + [ + 'id_element' => $id, + 'section' => 'Modules', + 'id_user' => $config['id_user'], + ] + ); echo 'ok'; } } diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 7bc4785011..2e9ec50479 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -27,8 +27,6 @@ */ // Begin. -require_once 'config.php'; - require_once __DIR__.'/config.php'; require_once __DIR__.'/functions.php'; require_once __DIR__.'/functions_db.php'; @@ -87,7 +85,7 @@ if (check_login(false) === false) {

Access is not granted

-