mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge remote-tracking branch 'origin' into ent-12019-api-2-0
This commit is contained in:
commit
df1d2675ed
@ -1,9 +1,9 @@
|
|||||||
bin_PROGRAMS = PandoraAgent
|
bin_PROGRAMS = PandoraAgent
|
||||||
if DEBUG
|
if DEBUG
|
||||||
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
|
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
|
||||||
PandoraAgent_CXXFLAGS=-g -O0
|
PandoraAgent_CXXFLAGS=-g -O0
|
||||||
else
|
else
|
||||||
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
|
PandoraAgent_SOURCES = misc/cron.cc misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_exec_powershell.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
|
||||||
PandoraAgent_CXXFLAGS=-O2
|
PandoraAgent_CXXFLAGS=-O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -236,6 +236,8 @@ Module_Kind
|
|||||||
Pandora_Module::parseModuleKindFromString (string kind) {
|
Pandora_Module::parseModuleKindFromString (string kind) {
|
||||||
if (kind == module_exec_str) {
|
if (kind == module_exec_str) {
|
||||||
return MODULE_EXEC;
|
return MODULE_EXEC;
|
||||||
|
} else if (kind == module_exec_powershell_str) {
|
||||||
|
return MODULE_EXEC_POWERSHELL;
|
||||||
} else if (kind == module_proc_str) {
|
} else if (kind == module_proc_str) {
|
||||||
return MODULE_PROC;
|
return MODULE_PROC;
|
||||||
} else if (kind == module_service_str) {
|
} else if (kind == module_service_str) {
|
||||||
|
@ -94,7 +94,8 @@ namespace Pandora_Modules {
|
|||||||
MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */
|
MODULE_REGEXP, /**< The module searches a file for matches of a regular expression */
|
||||||
MODULE_PLUGIN, /**< Plugin */
|
MODULE_PLUGIN, /**< Plugin */
|
||||||
MODULE_PING, /**< Ping module */
|
MODULE_PING, /**< Ping module */
|
||||||
MODULE_SNMPGET /**< SNMP get module */
|
MODULE_SNMPGET, /**< SNMP get module */
|
||||||
|
MODULE_EXEC_POWERSHELL /**< The module run a custom powershell command */
|
||||||
} Module_Kind;
|
} Module_Kind;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,6 +128,7 @@ namespace Pandora_Modules {
|
|||||||
const string module_plugin_str = "module_plugin";
|
const string module_plugin_str = "module_plugin";
|
||||||
const string module_ping_str = "module_ping";
|
const string module_ping_str = "module_ping";
|
||||||
const string module_snmpget_str = "module_snmpget";
|
const string module_snmpget_str = "module_snmpget";
|
||||||
|
const string module_exec_powershell_str = "module_exec_powershell";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pandora module super-class exception.
|
* Pandora module super-class exception.
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
/* Pandora exec module. These modules exec a powershell command.
|
||||||
|
|
||||||
|
Copyright (c) 2006-2023 Pandora FMS.
|
||||||
|
|
||||||
|
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; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pandora_module_exec_powershell.h"
|
||||||
|
#include "../pandora_strutils.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
#define EXEC_OK 0
|
||||||
|
#define EXEC_ERR -1
|
||||||
|
#define BUFSIZE 4096
|
||||||
|
|
||||||
|
using namespace Pandora;
|
||||||
|
using namespace Pandora_Strutils;
|
||||||
|
using namespace Pandora_Modules;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Pandora_Module_Exec_Powershell object.
|
||||||
|
*
|
||||||
|
* @param name Module name
|
||||||
|
* @param exec Command to be executed.
|
||||||
|
*/
|
||||||
|
Pandora_Module_Exec_Powershell::Pandora_Module_Exec_Powershell(string name, string exec)
|
||||||
|
: Pandora_Module (name) {
|
||||||
|
|
||||||
|
string escaped_exec;
|
||||||
|
|
||||||
|
for (char c : exec) {
|
||||||
|
if (c == '"' || c == '\\') {
|
||||||
|
escaped_exec += '\\';
|
||||||
|
}
|
||||||
|
escaped_exec += c;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->module_exec = "powershell -C \"" + escaped_exec + "\"";
|
||||||
|
|
||||||
|
this->setKind (module_exec_powershell_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Pandora_Module_Exec_Powershell::run() {
|
||||||
|
string output_result;
|
||||||
|
|
||||||
|
this->has_output = false;
|
||||||
|
|
||||||
|
FILE* pipe = popen(this->module_exec.c_str(), "r");
|
||||||
|
if (!pipe) {
|
||||||
|
pandoraLog ("Error while executing command.", GetLastError ());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[BUFSIZE];
|
||||||
|
while (fgets(buffer, BUFSIZE, pipe) != NULL) {
|
||||||
|
output_result += buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = pclose(pipe);
|
||||||
|
|
||||||
|
if (result == EXEC_ERR) {
|
||||||
|
pandoraLog ("Error while closing command process.", GetLastError ());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != EXEC_OK) {
|
||||||
|
pandoraLog ("Error invalid powershell command.", GetLastError ());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->has_output = true;
|
||||||
|
this->setOutput (output_result);
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/* Pandora exec module. These modules exec a powershell command
|
||||||
|
|
||||||
|
Copyright (c) 2006-2023 Pandora FMS.
|
||||||
|
|
||||||
|
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; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PANDORA_MODULE_EXEC_POWERWSHELL_H__
|
||||||
|
#define __PANDORA_MODULE_EXEC_POWERWSHELL_H__
|
||||||
|
|
||||||
|
#include "pandora_module.h"
|
||||||
|
|
||||||
|
namespace Pandora_Modules {
|
||||||
|
/**
|
||||||
|
* Module to execute a powershell command.
|
||||||
|
*
|
||||||
|
* Any custom order that want to be executed can be put in
|
||||||
|
* the <code>util</code> directory into the Pandora agent path.
|
||||||
|
*/
|
||||||
|
class Pandora_Module_Exec_Powershell : public Pandora_Module {
|
||||||
|
|
||||||
|
private:
|
||||||
|
string module_exec;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Pandora_Module_Exec_Powershell (string name, string exec);
|
||||||
|
void run ();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -22,6 +22,7 @@
|
|||||||
#include "pandora_module_factory.h"
|
#include "pandora_module_factory.h"
|
||||||
#include "pandora_module.h"
|
#include "pandora_module.h"
|
||||||
#include "pandora_module_exec.h"
|
#include "pandora_module_exec.h"
|
||||||
|
#include "pandora_module_exec_powershell.h"
|
||||||
#include "pandora_module_proc.h"
|
#include "pandora_module_proc.h"
|
||||||
#include "pandora_module_service.h"
|
#include "pandora_module_service.h"
|
||||||
#include "pandora_module_freedisk.h"
|
#include "pandora_module_freedisk.h"
|
||||||
@ -129,6 +130,7 @@ using namespace Pandora_Strutils;
|
|||||||
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
|
#define TOKEN_ALERT_TEMPLATE ("module_alert_template")
|
||||||
#define TOKEN_USER_SESSION ("module_user_session ")
|
#define TOKEN_USER_SESSION ("module_user_session ")
|
||||||
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
|
#define TOKEN_WAIT_TIMEOUT ("module_wait_timeout ")
|
||||||
|
#define TOKEN_EXEC_POWERSHELL ("module_exec_powershell ")
|
||||||
|
|
||||||
string
|
string
|
||||||
parseLine (string line, string token) {
|
parseLine (string line, string token) {
|
||||||
@ -158,7 +160,7 @@ Pandora_Module *
|
|||||||
Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
||||||
list<string> tokens;
|
list<string> tokens;
|
||||||
list<string>::iterator iter;
|
list<string>::iterator iter;
|
||||||
string module_name, module_type, module_exec;
|
string module_name, module_type, module_exec, module_exec_powershell;
|
||||||
string module_min, module_max, module_description;
|
string module_min, module_max, module_description;
|
||||||
string module_interval, module_absoluteinterval;
|
string module_interval, module_absoluteinterval;
|
||||||
string module_proc, module_service;
|
string module_proc, module_service;
|
||||||
@ -268,6 +270,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||||||
module_user_session = "";
|
module_user_session = "";
|
||||||
macro = "";
|
macro = "";
|
||||||
module_wait_timeout = "";
|
module_wait_timeout = "";
|
||||||
|
module_exec_powershell = "";
|
||||||
|
|
||||||
stringtok (tokens, definition, "\n");
|
stringtok (tokens, definition, "\n");
|
||||||
|
|
||||||
@ -302,6 +305,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||||||
if (module_exec == "") {
|
if (module_exec == "") {
|
||||||
module_exec = parseLine (line, TOKEN_EXEC);
|
module_exec = parseLine (line, TOKEN_EXEC);
|
||||||
}
|
}
|
||||||
|
if (module_exec_powershell == "") {
|
||||||
|
module_exec_powershell = parseLine (line, TOKEN_EXEC_POWERSHELL);
|
||||||
|
}
|
||||||
if (module_wait_timeout == "") {
|
if (module_wait_timeout == "") {
|
||||||
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
|
module_wait_timeout = parseLine (line, TOKEN_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
@ -626,6 +632,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (module_exec_powershell != "") {
|
||||||
|
pos_macro = module_exec_powershell.find(macro_name);
|
||||||
|
if (pos_macro != string::npos){
|
||||||
|
module_exec_powershell.replace(pos_macro, macro_name.size(), macro_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (module_proc != "") {
|
if (module_proc != "") {
|
||||||
pos_macro = module_proc.find(macro_name);
|
pos_macro = module_proc.find(macro_name);
|
||||||
if (pos_macro != string::npos){
|
if (pos_macro != string::npos){
|
||||||
@ -1155,6 +1168,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
|
|||||||
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
|
module->setWaitTimeout (atoi (module_wait_timeout.c_str ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (module_exec_powershell != "") {
|
||||||
|
module = new Pandora_Module_Exec_Powershell (module_name, module_exec_powershell);
|
||||||
|
|
||||||
} else if (module_proc != "") {
|
} else if (module_proc != "") {
|
||||||
module = new Pandora_Module_Proc (module_name,
|
module = new Pandora_Module_Proc (module_name,
|
||||||
module_proc);
|
module_proc);
|
||||||
|
@ -48,7 +48,7 @@ Pandora_Module_Freedisk_Percent::Pandora_Module_Freedisk_Percent (string name, s
|
|||||||
|
|
||||||
void
|
void
|
||||||
Pandora_Module_Freedisk_Percent::run () {
|
Pandora_Module_Freedisk_Percent::run () {
|
||||||
long res;
|
double res;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Pandora_Module::run ();
|
Pandora_Module::run ();
|
||||||
@ -59,7 +59,7 @@ Pandora_Module_Freedisk_Percent::run () {
|
|||||||
try {
|
try {
|
||||||
res = Pandora_Wmi::getDiskFreeSpacePercent (this->disk_id);
|
res = Pandora_Wmi::getDiskFreeSpacePercent (this->disk_id);
|
||||||
|
|
||||||
this->setOutput (longtostr (res));
|
this->setOutput(std::to_string(res));
|
||||||
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
|
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
|
||||||
this->has_output = false;
|
this->has_output = false;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "pandora_module_factory.h"
|
#include "pandora_module_factory.h"
|
||||||
#include "pandora_module_list.h"
|
#include "pandora_module_list.h"
|
||||||
#include "pandora_module_exec.h"
|
#include "pandora_module_exec.h"
|
||||||
|
#include "pandora_module_exec_powershell.h"
|
||||||
#include "pandora_module_proc.h"
|
#include "pandora_module_proc.h"
|
||||||
#include "pandora_module_service.h"
|
#include "pandora_module_service.h"
|
||||||
#include "pandora_module_freedisk.h"
|
#include "pandora_module_freedisk.h"
|
||||||
@ -235,6 +236,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
|
|||||||
Pandora_Module_Plugin *module_plugin;
|
Pandora_Module_Plugin *module_plugin;
|
||||||
Pandora_Module_Ping *module_ping;
|
Pandora_Module_Ping *module_ping;
|
||||||
Pandora_Module_SNMPGet *module_snmpget;
|
Pandora_Module_SNMPGet *module_snmpget;
|
||||||
|
Pandora_Module_Exec_Powershell *module_exec_powershell;
|
||||||
|
|
||||||
module = Pandora_Module_Factory::getModuleFromDefinition (definition);
|
module = Pandora_Module_Factory::getModuleFromDefinition (definition);
|
||||||
|
|
||||||
@ -244,6 +246,11 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
|
|||||||
module_exec = (Pandora_Module_Exec *) module;
|
module_exec = (Pandora_Module_Exec *) module;
|
||||||
modules->push_back (module_exec);
|
modules->push_back (module_exec);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MODULE_EXEC_POWERSHELL:
|
||||||
|
module_exec_powershell = (Pandora_Module_Exec_Powershell *) module;
|
||||||
|
modules->push_back (module_exec_powershell);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MODULE_PROC:
|
case MODULE_PROC:
|
||||||
module_proc = (Pandora_Module_Proc *) module;
|
module_proc = (Pandora_Module_Proc *) module;
|
||||||
|
@ -188,7 +188,7 @@ Pandora_Wmi::getDiskFreeSpace (string disk_id) {
|
|||||||
* @exception Pandora_Wmi_Exception Throwd if an error occured when reading
|
* @exception Pandora_Wmi_Exception Throwd if an error occured when reading
|
||||||
* from WMI database.
|
* from WMI database.
|
||||||
*/
|
*/
|
||||||
unsigned long
|
double
|
||||||
Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
|
Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
|
||||||
CDhInitialize init;
|
CDhInitialize init;
|
||||||
CDispPtr wmi_svc, quickfixes;
|
CDispPtr wmi_svc, quickfixes;
|
||||||
@ -213,7 +213,7 @@ Pandora_Wmi::getDiskFreeSpacePercent (string disk_id) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (unsigned long) (free_space * 100 / size);
|
return (free_space * 100 / size);
|
||||||
} NEXT_THROW (quickfix);
|
} NEXT_THROW (quickfix);
|
||||||
} catch (string errstr) {
|
} catch (string errstr) {
|
||||||
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());
|
pandoraLog ("getDiskFreeSpace error. %s", errstr.c_str ());
|
||||||
|
@ -44,7 +44,7 @@ namespace Pandora_Wmi {
|
|||||||
int isProcessRunning (string process_name);
|
int isProcessRunning (string process_name);
|
||||||
int isServiceRunning (string service_name);
|
int isServiceRunning (string service_name);
|
||||||
unsigned long getDiskFreeSpace (string disk_id);
|
unsigned long getDiskFreeSpace (string disk_id);
|
||||||
unsigned long getDiskFreeSpacePercent (string disk_id);
|
double getDiskFreeSpacePercent (string disk_id);
|
||||||
int getCpuUsagePercentage (int cpu_id);
|
int getCpuUsagePercentage (int cpu_id);
|
||||||
long getFreememory ();
|
long getFreememory ();
|
||||||
long getFreememoryPercent ();
|
long getFreememoryPercent ();
|
||||||
|
@ -285,20 +285,25 @@ if (enterprise_installed()) {
|
|||||||
$data = [];
|
$data = [];
|
||||||
$data[0] = html_print_label_input_block(
|
$data[0] = html_print_label_input_block(
|
||||||
'<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>',
|
'<div id="server_to_exec_label" class="labels invisible">'.__('Server to execute command').'</div>',
|
||||||
'<div id="server_to_exec_value" class="invisible" >'.html_print_select(
|
'<div id="server_to_exec_value" class="w100p margin-top-10 invisible" >'.html_print_select(
|
||||||
$servers_to_exec,
|
$servers_to_exec,
|
||||||
'server_to_exec',
|
'server_to_exec',
|
||||||
$event_response['server_to_exec'],
|
$event_response['server_to_exec'],
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
true
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
'w100p',
|
||||||
|
false,
|
||||||
|
'width: 100%'
|
||||||
).'</div>'
|
).'</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$data[1] = html_print_label_input_block(
|
$data[1] = html_print_label_input_block(
|
||||||
'<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'),
|
'<div id="command_timeout_label" class="labels invisible">'.__('Command timeout (s)'),
|
||||||
'<div id="command_timeout_value" class="invisible">'.html_print_input_text(
|
'<div id="command_timeout_value" class=" w100p margin-top-10 invisible">'.html_print_input_text(
|
||||||
'command_timeout',
|
'command_timeout',
|
||||||
$event_response['command_timeout'],
|
$event_response['command_timeout'],
|
||||||
'',
|
'',
|
||||||
@ -358,18 +363,18 @@ $('#type').change(function() {
|
|||||||
$('#new_window option[value="0"]')
|
$('#new_window option[value="0"]')
|
||||||
.prop('selected', true);
|
.prop('selected', true);
|
||||||
$('#new_window').attr('disabled','disabled');
|
$('#new_window').attr('disabled','disabled');
|
||||||
$('#server_to_exec_label').css('display','');
|
$('#server_to_exec_label').show();
|
||||||
$('#server_to_exec_value').css('display','');
|
$('#server_to_exec_value').show();
|
||||||
$('#command_timeout_label').css('display','');
|
$('#command_timeout_label').show();
|
||||||
$('#command_timeout_value').css('display','');
|
$('#command_timeout_value').show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'url':
|
case 'url':
|
||||||
$('#new_window').removeAttr('disabled');
|
$('#new_window').removeAttr('disabled');
|
||||||
$('#server_to_exec_label').css('display','none');
|
$('#server_to_exec_label').hide();
|
||||||
$('#server_to_exec_value').css('display','none');
|
$('#server_to_exec_value').hide();
|
||||||
$('#command_timeout_label').css('display','none');
|
$('#command_timeout_label').hide();
|
||||||
$('#command_timeout_value').css('display','none');
|
$('#command_timeout_value').hide();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1058,7 +1058,11 @@ switch ($action) {
|
|||||||
$resolution = $item['top_n'];
|
$resolution = $item['top_n'];
|
||||||
// Interval resolution.
|
// Interval resolution.
|
||||||
$max_values = $item['top_n_value'];
|
$max_values = $item['top_n_value'];
|
||||||
// Max values.
|
$es = json_decode($item['external_source'], true);
|
||||||
|
$top_n_type = $es['top_n_type'];
|
||||||
|
$display_graph = $es['display_graph'];
|
||||||
|
$display_summary = $es['display_summary'];
|
||||||
|
$display_data_table = $es['display_data_table'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'permissions_report':
|
case 'permissions_report':
|
||||||
@ -1703,6 +1707,75 @@ if (is_metaconsole() === true) {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_top_n_type" class="datos">
|
||||||
|
<td class="bolder"><?php echo __('Type'); ?></td>
|
||||||
|
<td >
|
||||||
|
<?php
|
||||||
|
$types = [
|
||||||
|
0 => __('Show aggregate by destination port'),
|
||||||
|
1 => __('Show InBound/Outbound traffic per SrcIP/DestIP'),
|
||||||
|
];
|
||||||
|
html_print_select(
|
||||||
|
$types,
|
||||||
|
'top_n_type',
|
||||||
|
$top_n_type,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_display_graph" class="datos">
|
||||||
|
<td class="bolder">
|
||||||
|
<?php
|
||||||
|
echo __('Display graph');
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td >
|
||||||
|
<?php
|
||||||
|
html_print_checkbox_switch(
|
||||||
|
'display_graph',
|
||||||
|
1,
|
||||||
|
($display_graph ?? true)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_display_summary_table" class="datos">
|
||||||
|
<td class="bolder">
|
||||||
|
<?php
|
||||||
|
echo __('Display summary table');
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td >
|
||||||
|
<?php
|
||||||
|
html_print_checkbox_switch(
|
||||||
|
'display_summary',
|
||||||
|
1,
|
||||||
|
($display_summary ?? true)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_display_data_table" class="datos">
|
||||||
|
<td class="bolder">
|
||||||
|
<?php
|
||||||
|
echo __('Display data table');
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td >
|
||||||
|
<?php
|
||||||
|
html_print_checkbox_switch(
|
||||||
|
'display_data_table',
|
||||||
|
1,
|
||||||
|
($display_data_table ?? true)
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="row_period_service_level" class="datos">
|
<tr id="row_period_service_level" class="datos">
|
||||||
<td class="bolder">
|
<td class="bolder">
|
||||||
<?php
|
<?php
|
||||||
@ -7420,6 +7493,10 @@ function chooseType() {
|
|||||||
$("#row_alert_templates").hide();
|
$("#row_alert_templates").hide();
|
||||||
$("#row_alert_actions").hide();
|
$("#row_alert_actions").hide();
|
||||||
$("#row_servers").hide();
|
$("#row_servers").hide();
|
||||||
|
$("#row_top_n_type").hide();
|
||||||
|
$("#row_display_graph").hide();
|
||||||
|
$("#row_display_summary_table").hide();
|
||||||
|
$("#row_display_data_table").hide();
|
||||||
$("#row_servers_all_opt").hide();
|
$("#row_servers_all_opt").hide();
|
||||||
$("#row_servers_all").hide();
|
$("#row_servers_all").hide();
|
||||||
$("#row_multiple_servers").hide();
|
$("#row_multiple_servers").hide();
|
||||||
@ -8374,6 +8451,10 @@ function chooseType() {
|
|||||||
$("#row_max_values").show();
|
$("#row_max_values").show();
|
||||||
$("#row_resolution").show();
|
$("#row_resolution").show();
|
||||||
$("#row_servers").show();
|
$("#row_servers").show();
|
||||||
|
$("#row_top_n_type").show();
|
||||||
|
$("#row_display_graph").show();
|
||||||
|
$("#row_display_summary_table").show();
|
||||||
|
$("#row_display_data_table").show();
|
||||||
$("#row_historical_db_check").hide();
|
$("#row_historical_db_check").hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1878,6 +1878,13 @@ switch ($action) {
|
|||||||
$values['top_n_value'] = get_parameter(
|
$values['top_n_value'] = get_parameter(
|
||||||
'max_values'
|
'max_values'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$es['top_n_type'] = get_parameter('top_n_type', '');
|
||||||
|
$es['display_graph'] = get_parameter('display_graph', '');
|
||||||
|
$es['display_summary'] = get_parameter('display_summary', '');
|
||||||
|
$es['display_data_table'] = get_parameter('display_data_table', '');
|
||||||
|
$values['external_source'] = json_encode($es);
|
||||||
|
|
||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2962,6 +2969,12 @@ switch ($action) {
|
|||||||
$values['top_n_value'] = get_parameter(
|
$values['top_n_value'] = get_parameter(
|
||||||
'max_values'
|
'max_values'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$es['top_n_type'] = get_parameter('top_n_type', '');
|
||||||
|
$es['display_graph'] = get_parameter('display_graph', '');
|
||||||
|
$es['display_summary'] = get_parameter('display_summary', '');
|
||||||
|
$es['display_data_table'] = get_parameter('display_data_table', '');
|
||||||
|
$values['external_source'] = json_encode($es);
|
||||||
$good_format = true;
|
$good_format = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1875,6 +1875,8 @@ if (check_login()) {
|
|||||||
|
|
||||||
$table_id = get_parameter('table_id', '');
|
$table_id = get_parameter('table_id', '');
|
||||||
$search = get_parameter('search', '');
|
$search = get_parameter('search', '');
|
||||||
|
$search_agent = get_parameter('search_agent', '');
|
||||||
|
$groupId = (int) get_parameter('groupId', 0);
|
||||||
$module_name = get_parameter('module_name', '');
|
$module_name = get_parameter('module_name', '');
|
||||||
$status = get_parameter('status', '');
|
$status = get_parameter('status', '');
|
||||||
$start = get_parameter('start', 0);
|
$start = get_parameter('start', 0);
|
||||||
@ -1886,13 +1888,36 @@ if (check_login()) {
|
|||||||
$nodes = get_parameter('nodes', 0);
|
$nodes = get_parameter('nodes', 0);
|
||||||
$disabled_modules = (bool) get_parameter('disabled_modules', false);
|
$disabled_modules = (bool) get_parameter('disabled_modules', false);
|
||||||
|
|
||||||
|
$groups_array = [];
|
||||||
|
if ($groupId === 0) {
|
||||||
|
if (users_can_manage_group_all('AR') === false) {
|
||||||
|
$groups_array = users_get_groups(false, 'AR', false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$groups_array = [$groupId];
|
||||||
|
}
|
||||||
|
|
||||||
$where = '1=1';
|
$where = '1=1';
|
||||||
$recordsTotal = 0;
|
$recordsTotal = 0;
|
||||||
|
|
||||||
|
if (empty($groups_array) === false) {
|
||||||
|
$where .= sprintf(
|
||||||
|
' AND (tagente.id_grupo IN (%s)
|
||||||
|
OR tagent_secondary_group.id_group IN(%s))',
|
||||||
|
implode(',', $groups_array),
|
||||||
|
implode(',', $groups_array)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($search) === false) {
|
if (empty($search) === false) {
|
||||||
$where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"';
|
$where .= ' AND tagente_modulo.nombre LIKE "%%'.$search.'%%"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($search_agent) === false) {
|
||||||
|
$where .= ' AND tagente.alias LIKE "%%'.$search_agent.'%%"';
|
||||||
|
}
|
||||||
|
|
||||||
if (str_contains($status, '6') === true) {
|
if (str_contains($status, '6') === true) {
|
||||||
$expl = explode(',', $status);
|
$expl = explode(',', $status);
|
||||||
$exist = array_search('6', $expl);
|
$exist = array_search('6', $expl);
|
||||||
@ -1979,6 +2004,8 @@ if (check_login()) {
|
|||||||
ON tagente_modulo.id_agente = tagente.id_agente
|
ON tagente_modulo.id_agente = tagente.id_agente
|
||||||
INNER JOIN tagente_estado
|
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
|
||||||
|
LEFT JOIN tagent_secondary_group
|
||||||
|
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||||
WHERE %s
|
WHERE %s
|
||||||
ORDER BY %s
|
ORDER BY %s
|
||||||
LIMIT %d, %d',
|
LIMIT %d, %d',
|
||||||
@ -1996,6 +2023,8 @@ if (check_login()) {
|
|||||||
ON tagente_modulo.id_agente = tagente.id_agente
|
ON tagente_modulo.id_agente = tagente.id_agente
|
||||||
INNER JOIN tagente_estado
|
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
|
||||||
|
LEFT JOIN tagent_secondary_group
|
||||||
|
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||||
WHERE %s',
|
WHERE %s',
|
||||||
$where
|
$where
|
||||||
);
|
);
|
||||||
@ -2023,6 +2052,8 @@ if (check_login()) {
|
|||||||
ON tagente_modulo.id_agente = tagente.id_agente
|
ON tagente_modulo.id_agente = tagente.id_agente
|
||||||
INNER JOIN tagente_estado
|
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
|
||||||
|
LEFT JOIN tagent_secondary_group
|
||||||
|
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||||
WHERE %s',
|
WHERE %s',
|
||||||
$where
|
$where
|
||||||
);
|
);
|
||||||
@ -2055,6 +2086,8 @@ if (check_login()) {
|
|||||||
ON tagente_modulo.id_agente = tagente.id_agente
|
ON tagente_modulo.id_agente = tagente.id_agente
|
||||||
INNER JOIN tagente_estado
|
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
|
||||||
|
LEFT JOIN tagent_secondary_group
|
||||||
|
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||||
WHERE %s',
|
WHERE %s',
|
||||||
$where
|
$where
|
||||||
);
|
);
|
||||||
|
@ -6477,10 +6477,10 @@ function event_print_graph(
|
|||||||
$color[] = '#82b92f';
|
$color[] = '#82b92f';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$interval_length = 0;
|
||||||
|
|
||||||
if ($num_intervals > 0) {
|
if ($num_intervals > 0) {
|
||||||
$interval_length = (int) ($period / $num_intervals);
|
$interval_length = (int) ($period / $num_intervals);
|
||||||
} else {
|
|
||||||
$interval_length = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$intervals = [];
|
$intervals = [];
|
||||||
|
@ -155,6 +155,8 @@ function menu_print_menu(&$menu)
|
|||||||
}
|
}
|
||||||
} else if ($sec2 === 'godmode/users/configure_user') {
|
} else if ($sec2 === 'godmode/users/configure_user') {
|
||||||
$sec2 = 'godmode/users/user_list';
|
$sec2 = 'godmode/users/user_list';
|
||||||
|
} else if ($sec2 === 'godmode/modules/manage_inventory_modules_form') {
|
||||||
|
$sec2 = 'godmode/modules/manage_inventory_modules';
|
||||||
} else if ($sec2 === 'godmode/groups/configure_group') {
|
} else if ($sec2 === 'godmode/groups/configure_group') {
|
||||||
$sec2 = 'godmode/groups/group_list';
|
$sec2 = 'godmode/groups/group_list';
|
||||||
} else if ($sec2 === 'godmode/users/configure_profile') {
|
} else if ($sec2 === 'godmode/users/configure_profile') {
|
||||||
|
@ -330,10 +330,11 @@ function netflow_data_table($data, $start_date, $end_date, $aggregate, $pdf=fals
|
|||||||
*
|
*
|
||||||
* @param array $data Netflow data.
|
* @param array $data Netflow data.
|
||||||
* @param integer $total_bytes Total bytes count to calculate percent data.
|
* @param integer $total_bytes Total bytes count to calculate percent data.
|
||||||
|
* @param boolean $show_extended Display extended table.
|
||||||
*
|
*
|
||||||
* @return string HTML data table.
|
* @return string HTML data table.
|
||||||
*/
|
*/
|
||||||
function netflow_top_n_table(array $data, int $total_bytes)
|
function netflow_top_n_table(array $data, int $total_bytes, bool $show_extended=false)
|
||||||
{
|
{
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
@ -344,31 +345,44 @@ function netflow_top_n_table(array $data, int $total_bytes)
|
|||||||
$table->data = [];
|
$table->data = [];
|
||||||
|
|
||||||
$table->head = [];
|
$table->head = [];
|
||||||
|
if ($show_extended === false) {
|
||||||
$table->head[0] = '<b>'.__('Source IP').'</b>';
|
$table->head[0] = '<b>'.__('Source IP').'</b>';
|
||||||
$table->head[1] = '<b>'.__('Destination IP').'</b>';
|
$table->head[1] = '<b>'.__('Destination IP').'</b>';
|
||||||
$table->head[2] = '<b>'.__('Bytes').'</b>';
|
$table->head[2] = '<b>'.__('Bytes').'</b>';
|
||||||
$table->head[3] = '<b>'.__('% Traffic').'</b>';
|
$table->head[3] = '<b>'.__('Packets').'</b>';
|
||||||
$table->head[4] = '<b>'.__('Avg. Throughput').'</b>';
|
$table->head[4] = '<b>'.__('% Traffic').'</b>';
|
||||||
|
$table->head[5] = '<b>'.__('Avg. Throughput').'</b>';
|
||||||
$table->style[0] = 'padding: 4px';
|
$table->style[0] = 'padding: 4px';
|
||||||
|
} else {
|
||||||
|
$table->head[0] = '<b>'.__('Source IP').'</b>';
|
||||||
|
$table->head[1] = '<b>'.__('Destination IP').'</b>';
|
||||||
|
$table->head[2] = '<b>'.__('Ingress bytes').'</b>';
|
||||||
|
$table->head[3] = '<b>'.__('Egress bytes').'</b>';
|
||||||
|
$table->head[4] = '<b>'.__('Ingress packets').'</b>';
|
||||||
|
$table->head[5] = '<b>'.__('Egress packets').'</b>';
|
||||||
|
$table->head[6] = '<b>'.__('% Traffic').'</b>';
|
||||||
|
$table->head[7] = '<b>'.__('Avg. Throughput').'</b>';
|
||||||
|
$table->style[0] = 'padding: 4px';
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
foreach ($data as $value) {
|
foreach ($data as $value) {
|
||||||
$table->data[$i][0] = $value['ip_src'];
|
$table->data[$i][0] = $value['ip_src'];
|
||||||
$table->data[$i][1] = $value['ip_dst'];
|
$table->data[$i][1] = $value['ip_dst'];
|
||||||
|
|
||||||
|
if ($show_extended === true) {
|
||||||
|
$table->data[$i][2] = network_format_bytes($value['ibytes']);
|
||||||
|
$table->data[$i][3] = network_format_bytes($value['obytes']);
|
||||||
|
$table->data[$i][4] = (empty($value['ipackages']) === true) ? 0 : $value['ipackages'];
|
||||||
|
$table->data[$i][5] = (empty($value['opackages']) === true) ? 0 : $value['opackages'];
|
||||||
|
$table->data[$i][6] = $value['traffic'].' %';
|
||||||
|
} else {
|
||||||
$table->data[$i][2] = network_format_bytes($value['bytes']);
|
$table->data[$i][2] = network_format_bytes($value['bytes']);
|
||||||
|
$table->data[$i][3] = (empty($value['ipackages']) === true) ? 0 : $value['ipackages'];
|
||||||
$traffic = '-';
|
$table->data[$i][4] = $value['traffic'].' %';
|
||||||
|
|
||||||
if ($total_bytes > 0) {
|
|
||||||
$traffic = sprintf(
|
|
||||||
'%.2f',
|
|
||||||
(($value['bytes'] / $total_bytes) * 100)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[$i][3] = $traffic.' %';
|
|
||||||
|
|
||||||
$units = [
|
$units = [
|
||||||
'bps',
|
'bps',
|
||||||
'Kbps',
|
'Kbps',
|
||||||
@ -382,7 +396,11 @@ function netflow_top_n_table(array $data, int $total_bytes)
|
|||||||
|
|
||||||
$value['bps'] /= pow(1024, $pow);
|
$value['bps'] /= pow(1024, $pow);
|
||||||
|
|
||||||
$table->data[$i][4] = round($value['bps'], 2).' '.$units[$pow];
|
if ($show_extended === true) {
|
||||||
|
$table->data[$i][7] = round($value['bps'], 2).' '.$units[$pow];
|
||||||
|
} else {
|
||||||
|
$table->data[$i][5] = round($value['bps'], 2).' '.$units[$pow];
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -481,7 +499,9 @@ function netflow_get_top_N(
|
|||||||
string $end_date,
|
string $end_date,
|
||||||
array $filter,
|
array $filter,
|
||||||
int $max,
|
int $max,
|
||||||
string $connection_name=''
|
string $connection_name='',
|
||||||
|
bool $extended_info=false,
|
||||||
|
int $total_bytes=0
|
||||||
) {
|
) {
|
||||||
global $nfdump_date_format;
|
global $nfdump_date_format;
|
||||||
|
|
||||||
@ -496,7 +516,8 @@ function netflow_get_top_N(
|
|||||||
return json_decode($data, true);
|
return json_decode($data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = '-o "fmt:%sap,%dap,%ibyt,%bps" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
$opts = ($extended_info === true) ? 'fmt:%sap,%dap,%ibyt,%obyt,%ipkt,%opkt,%bps' : 'fmt:%sap,%dap,%ibyt,%ipkt,%bps';
|
||||||
|
$options = '-o "'.$opts.'" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
|
||||||
|
|
||||||
$command = netflow_get_command($options, $filter, $start_date, $end_date);
|
$command = netflow_get_command($options, $filter, $start_date, $end_date);
|
||||||
|
|
||||||
@ -516,8 +537,29 @@ function netflow_get_top_N(
|
|||||||
|
|
||||||
$values[$i]['ip_src'] = $parsed_line[0];
|
$values[$i]['ip_src'] = $parsed_line[0];
|
||||||
$values[$i]['ip_dst'] = $parsed_line[1];
|
$values[$i]['ip_dst'] = $parsed_line[1];
|
||||||
|
|
||||||
|
$traffic = '-';
|
||||||
|
if ($total_bytes > 0) {
|
||||||
|
$conn_bytes = $parsed_line[2];
|
||||||
|
|
||||||
|
$traffic = sprintf(
|
||||||
|
'%.2f',
|
||||||
|
(($conn_bytes / $total_bytes) * 100)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values[$i]['traffic'] = $traffic;
|
||||||
|
|
||||||
|
if ($extended_info === true) {
|
||||||
|
$values[$i]['ibytes'] = $parsed_line[2];
|
||||||
|
$values[$i]['obytes'] = $parsed_line[3];
|
||||||
|
$values[$i]['ipackets'] = $parsed_line[4];
|
||||||
|
$values[$i]['opackets'] = $parsed_line[5];
|
||||||
|
$values[$i]['bps'] = $parsed_line[6];
|
||||||
|
} else {
|
||||||
$values[$i]['bytes'] = $parsed_line[2];
|
$values[$i]['bytes'] = $parsed_line[2];
|
||||||
$values[$i]['bps'] = $parsed_line[3];
|
$values[$i]['bps'] = $parsed_line[3];
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1341,7 +1383,11 @@ function netflow_draw_item(
|
|||||||
$output='HTML',
|
$output='HTML',
|
||||||
$address_resolution=false,
|
$address_resolution=false,
|
||||||
$width_content=false,
|
$width_content=false,
|
||||||
$height_content=false
|
$height_content=false,
|
||||||
|
$extended=false,
|
||||||
|
$show_graph=true,
|
||||||
|
$show_summary=true,
|
||||||
|
$show_table=true
|
||||||
) {
|
) {
|
||||||
$aggregate = $filter['aggregate'];
|
$aggregate = $filter['aggregate'];
|
||||||
$interval = ($end_date - $start_date);
|
$interval = ($end_date - $start_date);
|
||||||
@ -1496,7 +1542,9 @@ function netflow_draw_item(
|
|||||||
$end_date,
|
$end_date,
|
||||||
$filter,
|
$filter,
|
||||||
$max_aggregates,
|
$max_aggregates,
|
||||||
$connection_name
|
$connection_name,
|
||||||
|
$extended,
|
||||||
|
$data_summary['totalbytes']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (empty($data_top_n) === true) {
|
if (empty($data_top_n) === true) {
|
||||||
@ -1505,16 +1553,76 @@ function netflow_draw_item(
|
|||||||
|
|
||||||
if ($output === 'HTML' || $output === 'PDF') {
|
if ($output === 'HTML' || $output === 'PDF') {
|
||||||
$html = '<table class="w100p">';
|
$html = '<table class="w100p">';
|
||||||
|
if ($show_graph === true) {
|
||||||
|
$labels = array_map(
|
||||||
|
function ($conn) {
|
||||||
|
return __('% Traffic').' '.$conn['ip_src'].' - '.$conn['ip_dst'];
|
||||||
|
},
|
||||||
|
$data_top_n
|
||||||
|
);
|
||||||
|
|
||||||
|
$pie_data = array_map(
|
||||||
|
function ($conn) {
|
||||||
|
return $conn['traffic'];
|
||||||
|
},
|
||||||
|
$data_top_n
|
||||||
|
);
|
||||||
|
|
||||||
|
$graph_output = pie_graph(
|
||||||
|
$pie_data,
|
||||||
|
[
|
||||||
|
'width' => 200,
|
||||||
|
'height' => 200,
|
||||||
|
'ttl' => ($output === 'PDF') ? 2 : 1,
|
||||||
|
'dataLabel' => ['display' => 'auto'],
|
||||||
|
'layout' => [
|
||||||
|
'padding' => [
|
||||||
|
'top' => 15,
|
||||||
|
'bottom' => 15,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'legend' => [
|
||||||
|
'display' => true,
|
||||||
|
'position' => 'right',
|
||||||
|
'align' => 'center',
|
||||||
|
],
|
||||||
|
'labels' => $labels,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$html .= '<tr>';
|
||||||
|
$html .= "<td class='w500p padding-bottom-25px'>";
|
||||||
|
|
||||||
|
if ($output === 'PDF') {
|
||||||
|
$html .= '<img src="data:image/png;base64,'.$graph_output.'" />';
|
||||||
|
} else {
|
||||||
|
$html .= $graph_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= '</td>';
|
||||||
|
$html .= '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($show_summary === true) {
|
||||||
$html .= '<tr>';
|
$html .= '<tr>';
|
||||||
$html .= "<td class='w50p'>";
|
$html .= "<td class='w50p'>";
|
||||||
$html .= netflow_summary_table($data_summary);
|
$html .= netflow_summary_table($data_summary);
|
||||||
$html .= '</td>';
|
$html .= '</td>';
|
||||||
$html .= '</tr>';
|
$html .= '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($show_table === true) {
|
||||||
$html .= '<tr>';
|
$html .= '<tr>';
|
||||||
$html .= "<td class='w100p'>";
|
$html .= "<td class='w100p'>";
|
||||||
$html .= netflow_top_n_table($data_top_n, $data_summary['totalbytes']);
|
$html .= netflow_top_n_table(
|
||||||
|
$data_top_n,
|
||||||
|
$data_summary['totalbytes'],
|
||||||
|
$extended
|
||||||
|
);
|
||||||
$html .= '</td>';
|
$html .= '</td>';
|
||||||
$html .= '</tr>';
|
$html .= '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
$html .= '</table>';
|
$html .= '</table>';
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
@ -1638,7 +1746,8 @@ function netflow_get_item_data(
|
|||||||
string $type_netflow,
|
string $type_netflow,
|
||||||
array $filter,
|
array $filter,
|
||||||
int $max_aggregates,
|
int $max_aggregates,
|
||||||
string $connection_name
|
string $connection_name,
|
||||||
|
bool $extended=false
|
||||||
) {
|
) {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
@ -1656,7 +1765,9 @@ function netflow_get_item_data(
|
|||||||
$end_date,
|
$end_date,
|
||||||
$filter,
|
$filter,
|
||||||
$max_aggregates,
|
$max_aggregates,
|
||||||
$connection_name
|
$connection_name,
|
||||||
|
$extended,
|
||||||
|
$data_summary['totalbytes']
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
|
@ -6981,6 +6981,20 @@ function reporting_netflow(
|
|||||||
$filter['aggregate'] = 'dstport';
|
$filter['aggregate'] = 'dstport';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$es = json_decode($content['external_source'], true);
|
||||||
|
|
||||||
|
$extended = false;
|
||||||
|
$show_graph = false;
|
||||||
|
$show_summary = false;
|
||||||
|
$show_table = false;
|
||||||
|
|
||||||
|
if (empty($es) === false) {
|
||||||
|
$extended = ((int) $es['top_n_type'] === 1);
|
||||||
|
$show_graph = ((int) $es['display_graph'] === 1);
|
||||||
|
$show_summary = ((int) $es['display_summary'] === 1);
|
||||||
|
$show_table = ((int) $es['display_data_table'] === 1);
|
||||||
|
}
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'dinamic':
|
case 'dinamic':
|
||||||
case 'static':
|
case 'static':
|
||||||
@ -6992,7 +7006,14 @@ function reporting_netflow(
|
|||||||
$filter,
|
$filter,
|
||||||
$content['top_n_value'],
|
$content['top_n_value'],
|
||||||
$content['server_name'],
|
$content['server_name'],
|
||||||
(($pdf === true) ? 'PDF' : 'HTML')
|
(($pdf === true) ? 'PDF' : 'HTML'),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$extended,
|
||||||
|
$show_graph,
|
||||||
|
$show_summary,
|
||||||
|
$show_table
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -7015,11 +7036,15 @@ function reporting_netflow(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($extended === true) {
|
||||||
|
$return['subtitle'] = __('InBound/Outbound traffic per SrcIP/DestIP');
|
||||||
|
} else {
|
||||||
$return['subtitle'] = netflow_generate_subtitle_report(
|
$return['subtitle'] = netflow_generate_subtitle_report(
|
||||||
$filter['aggregate'],
|
$filter['aggregate'],
|
||||||
$content['top_n'],
|
$content['top_n'],
|
||||||
$type_netflow
|
$type_netflow
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return reporting_check_structure_content($return);
|
return reporting_check_structure_content($return);
|
||||||
}
|
}
|
||||||
|
@ -4257,15 +4257,15 @@ function ui_print_datatable(array $parameters)
|
|||||||
// * END JAVASCRIPT.
|
// * END JAVASCRIPT.
|
||||||
$info_msg_arr = [];
|
$info_msg_arr = [];
|
||||||
$info_msg_arr['message'] = $emptyTable;
|
$info_msg_arr['message'] = $emptyTable;
|
||||||
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-msg-info-'.$table_id;
|
$info_msg_arr['div_class'] = 'info_box_container invisible_important datatable-info-massage datatable-msg-info-'.$table_id;
|
||||||
|
|
||||||
$info_msg_arr_filter = [];
|
$info_msg_arr_filter = [];
|
||||||
$info_msg_arr_filter['message'] = __('Please apply a filter to display the data.');
|
$info_msg_arr_filter['message'] = __('Please apply a filter to display the data.');
|
||||||
$info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-msg-info-filter-'.$table_id;
|
$info_msg_arr_filter['div_class'] = 'info_box_container invisible_important datatable-info-massage datatable-msg-info-filter-'.$table_id;
|
||||||
|
|
||||||
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
|
$spinner = '<div id="'.$table_id.'-spinner" class="invisible spinner-fixed"><span></span><span></span><span></span><span></span></div>';
|
||||||
|
|
||||||
$info_msg = '<div>'.ui_print_info_message($info_msg_arr, '', true).'</div>';
|
$info_msg = '<div class="datatable-container-info-massage">'.ui_print_info_message($info_msg_arr, '', true).'</div>';
|
||||||
|
|
||||||
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';
|
$info_msg_filter = '<div>'.ui_print_info_message($info_msg_arr_filter, true).'</div>';
|
||||||
|
|
||||||
|
@ -66,6 +66,11 @@ if (typeof dt.pagination_options !== "undefined") {
|
|||||||
lengthMenu = dt.pagination_options;
|
lengthMenu = dt.pagination_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dt.pagination_options_order === "true") {
|
||||||
|
lengthMenu[0] = lengthMenu[0].sort((a, b) => a - b);
|
||||||
|
lengthMenu[1] = lengthMenu[1].sort((a, b) => a - b);
|
||||||
|
}
|
||||||
|
|
||||||
var ordering = true;
|
var ordering = true;
|
||||||
if (typeof dt.ordering !== "undefined" && dt.ordering === false) {
|
if (typeof dt.ordering !== "undefined" && dt.ordering === false) {
|
||||||
ordering = dt.ordering;
|
ordering = dt.ordering;
|
||||||
|
@ -200,6 +200,14 @@ class ModulesByStatus extends Widget
|
|||||||
// Retrieve global - common inputs.
|
// Retrieve global - common inputs.
|
||||||
$values = parent::decoders($decoder);
|
$values = parent::decoders($decoder);
|
||||||
|
|
||||||
|
if (isset($decoder['groupId']) === true) {
|
||||||
|
$values['groupId'] = $decoder['groupId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($decoder['search_agent']) === true) {
|
||||||
|
$values['search_agent'] = $decoder['search_agent'];
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($decoder['search']) === true) {
|
if (isset($decoder['search']) === true) {
|
||||||
$values['search'] = $decoder['search'];
|
$values['search'] = $decoder['search'];
|
||||||
}
|
}
|
||||||
@ -240,9 +248,39 @@ class ModulesByStatus extends Widget
|
|||||||
// Retrieve global - common inputs.
|
// Retrieve global - common inputs.
|
||||||
$inputs = parent::getFormInputs();
|
$inputs = parent::getFormInputs();
|
||||||
|
|
||||||
|
$return_all_group = false;
|
||||||
|
if (users_can_manage_group_all('RM') || $values['groupId'] == 0) {
|
||||||
|
$return_all_group = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Groups.
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Group'),
|
||||||
|
'arguments' => [
|
||||||
|
'type' => 'select_groups',
|
||||||
|
'name' => 'groupId',
|
||||||
|
'returnAllGroup' => $return_all_group,
|
||||||
|
'privilege' => 'AR',
|
||||||
|
'selected' => $values['groupId'],
|
||||||
|
'return' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Search Agent.
|
||||||
|
$inputs[] = [
|
||||||
|
'label' => __('Search agent').ui_print_help_tip(__('Search filter by Agent name field content'), true),
|
||||||
|
'arguments' => [
|
||||||
|
'name' => 'search_agent',
|
||||||
|
'type' => 'text',
|
||||||
|
'value' => $values['search_agent'],
|
||||||
|
'return' => true,
|
||||||
|
'size' => 0,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
// Search.
|
// Search.
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'label' => __('Free search').ui_print_help_tip(__('Search filter by Module name field content'), true),
|
'label' => __('Search module').ui_print_help_tip(__('Search filter by Module name field content'), true),
|
||||||
'arguments' => [
|
'arguments' => [
|
||||||
'name' => 'search',
|
'name' => 'search',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
@ -373,7 +411,9 @@ class ModulesByStatus extends Widget
|
|||||||
// Retrieve global - common inputs.
|
// Retrieve global - common inputs.
|
||||||
$values = parent::getPost();
|
$values = parent::getPost();
|
||||||
|
|
||||||
|
$values['groupId'] = \get_parameter('groupId', 0);
|
||||||
$values['search'] = \get_parameter('search', '');
|
$values['search'] = \get_parameter('search', '');
|
||||||
|
$values['search_agent'] = \get_parameter('search_agent', '');
|
||||||
$values['status'] = \get_parameter('status', '');
|
$values['status'] = \get_parameter('status', '');
|
||||||
$values['limit'] = \get_parameter('limit', '');
|
$values['limit'] = \get_parameter('limit', '');
|
||||||
$values['nodes'] = \get_parameter('nodes', '');
|
$values['nodes'] = \get_parameter('nodes', '');
|
||||||
@ -386,46 +426,10 @@ class ModulesByStatus extends Widget
|
|||||||
/**
|
/**
|
||||||
* Draw widget.
|
* Draw widget.
|
||||||
*
|
*
|
||||||
* @return string;
|
* @return void Html output;
|
||||||
*/
|
*/
|
||||||
public function load()
|
public function load()
|
||||||
{
|
{
|
||||||
$this->size = parent::getSize();
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
$output = '';
|
|
||||||
|
|
||||||
if (is_metaconsole() === true) {
|
|
||||||
$modules = [];
|
|
||||||
|
|
||||||
$servers_ids = array_column(metaconsole_get_servers(), 'id');
|
|
||||||
|
|
||||||
foreach ($servers_ids as $server_id) {
|
|
||||||
try {
|
|
||||||
$node = new Node((int) $server_id);
|
|
||||||
|
|
||||||
$node->connect();
|
|
||||||
$modules_tmp = $this->getInfoModules(
|
|
||||||
$this->values['search'],
|
|
||||||
$this->values['status'],
|
|
||||||
$this->values['nodes']
|
|
||||||
);
|
|
||||||
$modules[$node->id()] = $modules_tmp[0];
|
|
||||||
$node->disconnect();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
// Unexistent modules.
|
|
||||||
$node->disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$modules = $this->getInfoModules(
|
|
||||||
$this->values['search'],
|
|
||||||
$this->values['status']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($modules !== false && empty($modules) === false) {
|
|
||||||
// Datatables list.
|
// Datatables list.
|
||||||
try {
|
try {
|
||||||
$info_columns = $this->columns();
|
$info_columns = $this->columns();
|
||||||
@ -447,7 +451,9 @@ class ModulesByStatus extends Widget
|
|||||||
'ajax_data' => [
|
'ajax_data' => [
|
||||||
'get_data_ModulesByStatus' => 1,
|
'get_data_ModulesByStatus' => 1,
|
||||||
'table_id' => $tableId,
|
'table_id' => $tableId,
|
||||||
|
'search_agent' => $this->values['search_agent'],
|
||||||
'search' => $this->values['search'],
|
'search' => $this->values['search'],
|
||||||
|
'groupId' => $this->values['groupId'],
|
||||||
'status' => $this->values['status'],
|
'status' => $this->values['status'],
|
||||||
'nodes' => $this->values['nodes'],
|
'nodes' => $this->values['nodes'],
|
||||||
'disabled_modules' => $this->values['disabled_modules'],
|
'disabled_modules' => $this->values['disabled_modules'],
|
||||||
@ -487,84 +493,6 @@ class ModulesByStatus extends Widget
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$output = '';
|
|
||||||
$output .= '<div class="container-center">';
|
|
||||||
$output .= \ui_print_info_message(
|
|
||||||
__('Not found modules'),
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$output .= '</div>';
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get info modules.
|
|
||||||
*
|
|
||||||
* @param string $search Free search.
|
|
||||||
* @param string $status Modules status.
|
|
||||||
*
|
|
||||||
* @return array Data.
|
|
||||||
*/
|
|
||||||
private function getInfoModules(string $search, string $status): array
|
|
||||||
{
|
|
||||||
if (empty($search) === false) {
|
|
||||||
$where = 'tagente_modulo.nombre LIKE "%%'.$search.'%%" AND ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($status, '6') === true) {
|
|
||||||
$expl = explode(',', $status);
|
|
||||||
$exist = array_search('6', $expl);
|
|
||||||
if (isset($exist) === true) {
|
|
||||||
unset($expl[$exist]);
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($expl, '1', '2', '3', '4', '5');
|
|
||||||
|
|
||||||
$status = implode(',', $expl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($status, '5') === true) {
|
|
||||||
$expl = explode(',', $status);
|
|
||||||
$exist = array_search('5', $expl);
|
|
||||||
if (isset($exist) === true) {
|
|
||||||
unset($expl[$exist]);
|
|
||||||
}
|
|
||||||
|
|
||||||
array_push($expl, '4', '5');
|
|
||||||
|
|
||||||
$status = implode(',', $expl);
|
|
||||||
}
|
|
||||||
|
|
||||||
$where .= sprintf(
|
|
||||||
'tagente_estado.estado IN (%s)
|
|
||||||
AND tagente_modulo.delete_pending = 0',
|
|
||||||
$status
|
|
||||||
);
|
|
||||||
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT
|
|
||||||
COUNT(*) AS "modules"
|
|
||||||
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
|
|
||||||
);
|
|
||||||
|
|
||||||
$modules = db_get_all_rows_sql($sql);
|
|
||||||
|
|
||||||
if ($modules === false) {
|
|
||||||
$modules = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $modules;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -591,7 +519,10 @@ class ModulesByStatus extends Widget
|
|||||||
'nombre',
|
'nombre',
|
||||||
'alias',
|
'alias',
|
||||||
'server_name',
|
'server_name',
|
||||||
'last_status_change',
|
[
|
||||||
|
'text' => 'last_status_change',
|
||||||
|
'class' => '',
|
||||||
|
],
|
||||||
'estado',
|
'estado',
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
@ -605,7 +536,10 @@ class ModulesByStatus extends Widget
|
|||||||
$columns = [
|
$columns = [
|
||||||
'nombre',
|
'nombre',
|
||||||
'alias',
|
'alias',
|
||||||
'last_status_change',
|
[
|
||||||
|
'text' => 'last_status_change',
|
||||||
|
'class' => '',
|
||||||
|
],
|
||||||
'estado',
|
'estado',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -654,12 +588,12 @@ class ModulesByStatus extends Widget
|
|||||||
$height_counter = (((int) count($nodes_fields)) * 20);
|
$height_counter = (((int) count($nodes_fields)) * 20);
|
||||||
|
|
||||||
$size = [
|
$size = [
|
||||||
'width' => 450,
|
'width' => 470,
|
||||||
'height' => (520 + $height_counter),
|
'height' => (520 + $height_counter),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$size = [
|
$size = [
|
||||||
'width' => 450,
|
'width' => 470,
|
||||||
'height' => 480,
|
'height' => 480,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -224,6 +224,7 @@ class GeneralTacticalView
|
|||||||
$zone_location = $date_zone->getLocation();
|
$zone_location = $date_zone->getLocation();
|
||||||
$latitude = $zone_location['latitude'];
|
$latitude = $zone_location['latitude'];
|
||||||
|
|
||||||
|
if ($name !== '') {
|
||||||
$emojiOptions = [
|
$emojiOptions = [
|
||||||
'have_good_day' => __('Have a good day %s ✌', $name),
|
'have_good_day' => __('Have a good day %s ✌', $name),
|
||||||
'welcome_back' => __('Welcome back! %s 👋', $name),
|
'welcome_back' => __('Welcome back! %s 👋', $name),
|
||||||
@ -236,6 +237,20 @@ class GeneralTacticalView
|
|||||||
'happy_autumn' => __('Happy autumn, %s 🍂', $name),
|
'happy_autumn' => __('Happy autumn, %s 🍂', $name),
|
||||||
'happy_spring' => __('Happy spring, %s 🌻', $name),
|
'happy_spring' => __('Happy spring, %s 🌻', $name),
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
$emojiOptions = [
|
||||||
|
'have_good_day' => __('Have a good day ✌'),
|
||||||
|
'welcome_back' => __('Welcome back! 👋'),
|
||||||
|
'merry_christmas' => __('Welcome back! 🎅'),
|
||||||
|
'good_morning' => __('Good morning! ☕'),
|
||||||
|
'good_evening' => __('Good evening 🌇'),
|
||||||
|
'good_night' => __('Good night 🌕'),
|
||||||
|
'happy_summer' => __('Happy summer 🌞'),
|
||||||
|
'happy_winter' => __('Happy winter ⛄'),
|
||||||
|
'happy_autumn' => __('Happy autumn 🍂'),
|
||||||
|
'happy_spring' => __('Happy spring 🌻'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
// Welcome back.
|
// Welcome back.
|
||||||
$user_last_connect = $user['last_connect'];
|
$user_last_connect = $user['last_connect'];
|
||||||
|
@ -977,3 +977,19 @@ input.resize_button {
|
|||||||
.event-cardboard-widget td {
|
.event-cardboard-widget td {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.datatable-container-info-massage:not(:has(.invisible_important)) {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info_box_information.datatable-info-massage.info_box_container
|
||||||
|
.info_box.info.textodialogo {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
@ -505,10 +505,10 @@ div.multi-response-buttons {
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
td:has(div#server_to_exec_label),
|
/*td:has(div#server_to_exec_label),
|
||||||
td:has(div#server_to_exec_value) {
|
td:has(div#server_to_exec_value) {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
table#save_filter_form,
|
table#save_filter_form,
|
||||||
table#load_filter_form {
|
table#load_filter_form {
|
||||||
|
@ -1040,6 +1040,10 @@ select:-internal-list-box {
|
|||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.padding-bottom-25px {
|
||||||
|
padding-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
.padding-right-2 {
|
.padding-right-2 {
|
||||||
padding-right: 2em;
|
padding-right: 2em;
|
||||||
}
|
}
|
||||||
@ -12892,6 +12896,34 @@ tr.shown td.details-control {
|
|||||||
background-color: #81b92e3b !important;
|
background-color: #81b92e3b !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1190px) and (max-width: 1290px) {
|
||||||
|
#api_qrcode_display {
|
||||||
|
left: 580px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1143px) and (max-width: 1189px) {
|
||||||
|
#api_qrcode_display {
|
||||||
|
left: 528px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 860px) and (max-width: 1142px) {
|
||||||
|
#api_qrcode_display {
|
||||||
|
left: 356px;
|
||||||
|
top: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-title-font {
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#qr_code_agent_view > img {
|
||||||
|
width: 250px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.ui-dialog .tips_header.ui-dialog-titlebar {
|
.ui-dialog .tips_header.ui-dialog-titlebar {
|
||||||
height: fit-content !important;
|
height: fit-content !important;
|
||||||
}
|
}
|
||||||
|
@ -536,6 +536,7 @@ echo '</div>';
|
|||||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
ui_require_css_file('cluetip', 'include/styles/js/');
|
||||||
ui_require_jquery_file('cluetip');
|
ui_require_jquery_file('cluetip');
|
||||||
|
|
||||||
|
if (isset($id_agente)) {
|
||||||
$system_higher = false;
|
$system_higher = false;
|
||||||
$modules_agent = db_get_all_rows_sql(sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente = %s', $id_agente));
|
$modules_agent = db_get_all_rows_sql(sprintf('SELECT id_agente FROM tagente_modulo WHERE id_agente = %s', $id_agente));
|
||||||
if (is_array($modules_agent)) {
|
if (is_array($modules_agent)) {
|
||||||
@ -549,6 +550,7 @@ if (is_array($modules_agent)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
|
echo '<div id="system_higher" class="invisible_important agent_details_agent_data flex_important"><img src="images/alert-yellow@svg.svg" width="10%" class="mrgn_right_20px">'.__('Your system has a much higher rate of modules per agent than recommended (200 modules per agent). This implies performance problems in the system, please consider reducing the number of modules in this agent.').'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -1253,6 +1253,15 @@ if (is_ajax() === true) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = array_values(
|
||||||
|
array_filter(
|
||||||
|
($data ?? []),
|
||||||
|
function ($item) {
|
||||||
|
return (bool) (array) $item;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$count = count($data);
|
||||||
// RecordsTotal && recordsfiltered resultados totales.
|
// RecordsTotal && recordsfiltered resultados totales.
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
@ -2826,7 +2835,7 @@ try {
|
|||||||
'extra_html' => $active_filters_div.$graph_div,
|
'extra_html' => $active_filters_div.$graph_div,
|
||||||
'pagination_options' => [
|
'pagination_options' => [
|
||||||
[
|
[
|
||||||
$config['block_size'],
|
(int) $config['block_size'],
|
||||||
10,
|
10,
|
||||||
25,
|
25,
|
||||||
100,
|
100,
|
||||||
@ -2834,7 +2843,7 @@ try {
|
|||||||
500,
|
500,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
$config['block_size'],
|
(int) $config['block_size'],
|
||||||
10,
|
10,
|
||||||
25,
|
25,
|
||||||
100,
|
100,
|
||||||
@ -2842,6 +2851,7 @@ try {
|
|||||||
500,
|
500,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'pagination_options_order' => 'true',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => 'timestamp',
|
'field' => 'timestamp',
|
||||||
'direction' => 'desc',
|
'direction' => 'desc',
|
||||||
|
@ -417,6 +417,17 @@ sub ha_database_connect_pandora($) {
|
|||||||
|
|
||||||
# Select a new master database.
|
# Select a new master database.
|
||||||
my ($dbh, $utimestamp, $max_utimestamp) = (undef, undef, -1);
|
my ($dbh, $utimestamp, $max_utimestamp) = (undef, undef, -1);
|
||||||
|
|
||||||
|
my @disabled_nodes = get_disabled_nodes($conf);
|
||||||
|
|
||||||
|
# If there are disabled nodes ignore them from the HA_DB_Hosts.
|
||||||
|
if(scalar @disabled_nodes ne 0){
|
||||||
|
@HA_DB_Hosts = grep { my $item = $_; !grep { $_ eq $item } @disabled_nodes } @HA_DB_Hosts;
|
||||||
|
|
||||||
|
my $data = join(",", @disabled_nodes);
|
||||||
|
log_message($conf, 'LOG', "Ignoring disabled hosts: " . $data);
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $ha_dbhost (@HA_DB_Hosts) {
|
foreach my $ha_dbhost (@HA_DB_Hosts) {
|
||||||
|
|
||||||
# Retry each database ha_connect_retries times.
|
# Retry each database ha_connect_retries times.
|
||||||
@ -507,6 +518,36 @@ sub ha_restart_pandora($) {
|
|||||||
`$config->{'pandora_service_cmd'} $control_command 2>/dev/null`;
|
`$config->{'pandora_service_cmd'} $control_command 2>/dev/null`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Get ip of the disabled nodes.
|
||||||
|
###############################################################################
|
||||||
|
sub get_disabled_nodes($) {
|
||||||
|
my ($conf) = @_;
|
||||||
|
|
||||||
|
my $dbh = db_connect('mysql',
|
||||||
|
$conf->{'dbname'},
|
||||||
|
$conf->{'dbhost'},
|
||||||
|
$conf->{'dbport'},
|
||||||
|
$conf->{'ha_dbuser'},
|
||||||
|
$conf->{'ha_dbpass'});
|
||||||
|
|
||||||
|
my $disabled_nodes = get_db_value($dbh, "SELECT value FROM tconfig WHERE token = 'ha_disabled_nodes'");
|
||||||
|
|
||||||
|
if(!defined($disabled_nodes) || $disabled_nodes eq ""){
|
||||||
|
$disabled_nodes = ',';
|
||||||
|
}
|
||||||
|
|
||||||
|
my @disabled_nodes = split(',', $disabled_nodes);
|
||||||
|
|
||||||
|
if(scalar @disabled_nodes ne 0){
|
||||||
|
$disabled_nodes = join(",", @disabled_nodes);
|
||||||
|
@disabled_nodes = get_db_rows($dbh, "SELECT host FROM tdatabase WHERE id IN ($disabled_nodes)");
|
||||||
|
@disabled_nodes = map { $_->{host} } @disabled_nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @disabled_nodes;
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Main (Pacemaker)
|
# Main (Pacemaker)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user