mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge branch 'develop' into 2670-Nuevo-widget-dashboard-system-group-status
Conflicts: pandora_console/include/styles/pandora.css
This commit is contained in:
commit
62548c7f94
@ -87,6 +87,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.727
|
||||
Version: 7.0NG.727-181001
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.727"
|
||||
pandora_version="7.0NG.727-181001"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
@ -117,6 +117,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -130,6 +130,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
@ -89,6 +89,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -136,6 +136,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
# proxy_mode 1
|
||||
|
||||
|
@ -41,9 +41,9 @@ udp_server_auth_address 0.0.0.0
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
#group Servers
|
||||
|
||||
# Group password (if defined).
|
||||
#group_password
|
||||
|
||||
# Group password (if defined).
|
||||
#group_password
|
||||
|
||||
# Autotime: Enforce to server to ignore timestamp coming from this
|
||||
# agent, used when agents has no timer or it's inestable. 1 to enable
|
||||
@ -102,6 +102,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
remote_config 0
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# Number of threads to execute modules in parallel
|
||||
#agent_threads 1
|
||||
|
||||
|
@ -98,6 +98,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
@ -92,6 +92,9 @@ transfer_mode tentacle
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
#remote_config 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# If set to 1 start Drone Agent's Proxy Mode
|
||||
#proxy_mode 1
|
||||
|
||||
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.727';
|
||||
use constant AGENT_BUILD => '180913';
|
||||
use constant AGENT_BUILD => '181001';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
@ -186,6 +186,7 @@ my %DefaultConf = (
|
||||
'xml_buffer' => 0,
|
||||
'custom_id' => '',
|
||||
'url_address' => '',
|
||||
'standby' => 0,
|
||||
);
|
||||
my %Conf = %DefaultConf;
|
||||
|
||||
@ -1333,6 +1334,41 @@ sub check_collections () {
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Sleep function
|
||||
################################################################################
|
||||
sub sleep_agent {
|
||||
my ($main_agent, $iter_base_time) = @_;
|
||||
|
||||
# Sleep if main agent
|
||||
if ($main_agent != 0) {
|
||||
foreach my $broker_pid (@BrokerPid) {
|
||||
waitpid ($broker_pid, 0);
|
||||
}
|
||||
|
||||
# Cron mode
|
||||
exit (0) if ($Conf{'cron_mode'} == 1);
|
||||
|
||||
$iter_base_time += $Conf{'intensive_interval'};
|
||||
my $now = time();
|
||||
|
||||
my $interval_remain = $iter_base_time - $now;
|
||||
|
||||
if ($interval_remain >= 0) {
|
||||
sleep ($interval_remain);
|
||||
} else {
|
||||
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||
$iter_base_time = $now; # use current time as base time
|
||||
}
|
||||
}
|
||||
# Finish if broker agent
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
|
||||
return $iter_base_time;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Return the MD5 checksum of the given string as a hex string.
|
||||
# Pseudocode from: http://en.wikipedia.org/wiki/MD5#Pseudocode
|
||||
@ -2959,6 +2995,12 @@ while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
# Do not report to server if standby mode is enabled
|
||||
if ($Conf{'standby'} eq '1' && $Conf{'debug'} ne '1') {
|
||||
$iter_base_time = sleep_agent($main_agent, $iter_base_time);
|
||||
next;
|
||||
}
|
||||
|
||||
my $address;
|
||||
|
||||
if(defined($Conf{'address'})) {
|
||||
@ -3161,31 +3203,8 @@ while (1) {
|
||||
$SIG{'INT'} = \&udp_server_signal;
|
||||
}
|
||||
|
||||
# Sleep if main agent
|
||||
if ($main_agent != 0) {
|
||||
foreach my $broker_pid (@BrokerPid) {
|
||||
waitpid ($broker_pid, 0);
|
||||
}
|
||||
|
||||
# Cron mode
|
||||
last if ($Conf{'cron_mode'} == 1);
|
||||
|
||||
$iter_base_time += $Conf{'intensive_interval'};
|
||||
my $now = time();
|
||||
|
||||
my $interval_remain = $iter_base_time - $now;
|
||||
|
||||
if ($interval_remain >= 0) {
|
||||
sleep ($interval_remain);
|
||||
} else {
|
||||
# don't sleep if iteraion took more than "intensive_interval" seconds
|
||||
$iter_base_time = $now; # use current time as base time
|
||||
}
|
||||
}
|
||||
# Finish if broker agent
|
||||
else {
|
||||
exit (0);
|
||||
}
|
||||
# Sleep agent function
|
||||
$iter_base_time = sleep_agent($main_agent, $iter_base_time);
|
||||
}
|
||||
|
||||
__END__
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.727
|
||||
%define release 1
|
||||
%define release 181001
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
|
||||
Requires: fileutils textutils unzip
|
||||
Requires: util-linux procps grep
|
||||
Requires: /sbin/ip /bin/awk
|
||||
Requires: perl perl(Sys::Syslog)
|
||||
Requires: perl perl(Sys::Syslog) perl(IO::Compress::Zip)
|
||||
# Required by plugins
|
||||
#Requires: sh-utils sed passwd net-tools rpm
|
||||
AutoReq: 0
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.727
|
||||
%define release 1
|
||||
%define release 181001
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -10,7 +10,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.727"
|
||||
PI_BUILD="180913"
|
||||
PI_BUILD="181001"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -82,6 +82,9 @@ server_port 41121
|
||||
# Debug mode renames XML in the temp folder and continues running
|
||||
# debug 1
|
||||
|
||||
# Default 0, set to 1 to avoid module executions and report to server
|
||||
# standby 1
|
||||
|
||||
# XML encoding (ISO-8859-1 by default). Most windows servers experience problems when you set to UTF-8. Other special codepages may be specified here.
|
||||
#encoding ISO-8859-1
|
||||
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||
{}
|
||||
|
||||
Version
|
||||
{180913}
|
||||
{181001}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
|
||||
{No}
|
||||
|
||||
Windows,Executable
|
||||
{<%AppName%>-Setup<%Ext%>}
|
||||
{<%AppName%>-<%Version%>-Setup<%Ext%>}
|
||||
|
||||
Windows,FileDescription
|
||||
{<%AppName%> <%Version%> Setup}
|
||||
|
@ -32,7 +32,7 @@ using namespace Pandora;
|
||||
*/
|
||||
Pandora_Data::Pandora_Data (string value) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = pandora_data_unknown_source;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time) {
|
||||
*/
|
||||
Pandora_Data::Pandora_Data (string value, string data_origin) {
|
||||
this->value = value;
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = data_origin;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ Pandora_Data::Pandora_Data (string value, SYSTEMTIME *system_time, string data_o
|
||||
*/
|
||||
Pandora_Data::Pandora_Data () {
|
||||
this->value = "";
|
||||
GetSystemTime (&(this->timestamp));
|
||||
GetLocalTime (&(this->timestamp));
|
||||
this->data_origin = "";
|
||||
}
|
||||
|
||||
|
@ -67,16 +67,16 @@ Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source
|
||||
|
||||
// Set the type filter
|
||||
int type_number = -1;
|
||||
if (upper_type.compare("ERROR") == 0) {
|
||||
type_number = EVENTLOG_ERROR_TYPE;
|
||||
if (upper_type.compare("CRITICAL") == 0) {
|
||||
type_number = WINEVENT_LEVEL_CRITICAL;
|
||||
} else if (upper_type.compare("ERROR") == 0) {
|
||||
type_number = WINEVENT_LEVEL_ERROR;
|
||||
} else if (upper_type.compare("WARNING") == 0) {
|
||||
type_number = EVENTLOG_WARNING_TYPE;
|
||||
} else if (upper_type.compare("INFORMATION") == 0) {
|
||||
type_number = EVENTLOG_INFORMATION_TYPE;
|
||||
} else if (upper_type.compare("AUDIT SUCCESS") == 0) {
|
||||
type_number = EVENTLOG_AUDIT_SUCCESS;
|
||||
} else if (upper_type.compare("AUDIT FAILURE") == 0) {
|
||||
type_number = EVENTLOG_AUDIT_FAILURE;
|
||||
type_number = WINEVENT_LEVEL_WARNING;
|
||||
} else if (upper_type.compare("INFO") == 0) {
|
||||
type_number = WINEVENT_LEVEL_INFO;
|
||||
} else if (upper_type.compare("VERBOSE") == 0) {
|
||||
type_number = WINEVENT_LEVEL_VERBOSE;
|
||||
}
|
||||
// Append type to log query
|
||||
if (type_number != -1) {
|
||||
|
@ -29,6 +29,13 @@
|
||||
// Log event read buffer size
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
// WINEVENT consts
|
||||
#define WINEVENT_LEVEL_CRITICAL 1
|
||||
#define WINEVENT_LEVEL_ERROR 2
|
||||
#define WINEVENT_LEVEL_WARNING 3
|
||||
#define WINEVENT_LEVEL_INFO 4
|
||||
#define WINEVENT_LEVEL_VERBOSE 5
|
||||
|
||||
// Types for pointers to Wevtapi.dll functions
|
||||
typedef EVT_HANDLE WINAPI (*EvtQueryT) (EVT_HANDLE Session, LPCWSTR Path, LPCWSTR Query, DWORD Flags);
|
||||
typedef WINBOOL WINAPI (*EvtNextT) (EVT_HANDLE ResultSet, DWORD EventArraySize, EVT_HANDLE* EventArray, DWORD Timeout, DWORD Flags, PDWORD Returned);
|
||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.727(Build 180913)")
|
||||
#define PANDORA_VERSION ("7.0NG.727(Build 181001)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
@ -1869,7 +1869,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
||||
|
||||
server_addr = conf->getValue ("server_ip");
|
||||
|
||||
if (this->broker_modules != NULL) {
|
||||
if (this->broker_modules != NULL && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
this->broker_modules->goFirst ();
|
||||
|
||||
while (! this->broker_modules->isLast ()) {
|
||||
@ -1937,7 +1937,7 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
||||
}
|
||||
}
|
||||
|
||||
if (data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) {
|
||||
if ((data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
@ -1997,7 +1997,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
||||
|
||||
execution_number++;
|
||||
|
||||
if (this->modules != NULL) {
|
||||
if (this->modules != NULL && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
this->modules->goFirst ();
|
||||
|
||||
while (! this->modules->isLast ()) {
|
||||
@ -2057,7 +2057,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
||||
}
|
||||
}
|
||||
|
||||
if (forced_run == 1 || data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) {
|
||||
if ((forced_run == 1 || data_flag == 1 || this->timestamp + this->interval_sec <= this->run_time) && !(conf->getValue ("standby") == "1" && !getPandoraDebug())) {
|
||||
|
||||
// Send the XML
|
||||
if (!server_addr.empty ()) {
|
||||
|
@ -11,7 +11,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.727(Build 180913))"
|
||||
VALUE "ProductVersion", "(7.0NG.727(Build 181001))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-console
|
||||
Version: 7.0NG.727
|
||||
Version: 7.0NG.727-181001
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.727"
|
||||
pandora_version="7.0NG.727-181001"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
@ -1,2 +1,3 @@
|
||||
Order deny,allow
|
||||
Deny from All
|
||||
Allow from localhost
|
@ -17,103 +17,21 @@
|
||||
|
||||
global $config;
|
||||
|
||||
if (is_ajax ()) {
|
||||
check_login ();
|
||||
|
||||
require_once('include/functions_agents.php');
|
||||
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
$module_group = (int)get_parameter('module_group');
|
||||
$id_agent_group = (int)get_parameter('id_agent_group');
|
||||
|
||||
$data = false;
|
||||
if ($get_info_alert_module_group) {
|
||||
$agents = agents_get_group_agents($id_agent_group);
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
if ($module_group == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$data = true;
|
||||
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
|
||||
$agent = db_get_row('tagente', 'id_agente', $module['id_agente']);
|
||||
echo '<strong>' . __('Agent').': </strong>';
|
||||
echo io_safe_output($agent['nombre']) . '<br />';
|
||||
echo '<strong>' . __('Module') . ': </strong>';
|
||||
echo io_safe_output($module['nombre']) . '<br />';
|
||||
$template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']);
|
||||
echo '<strong>' . __('Alert template') . ': </strong>';
|
||||
echo io_safe_output($template['name']) . '<br />';
|
||||
|
||||
// This prevent from templates without predefined actions
|
||||
if (empty($template['id_alert_action']))
|
||||
$template_id_alert_action = "''";
|
||||
else
|
||||
$template_id_alert_action = $template['id_alert_action'];
|
||||
|
||||
// True if the alert only has the default template action
|
||||
$default_action = false;
|
||||
// Try to get actions for the current alert
|
||||
$sql = 'SELECT t2.name
|
||||
FROM talert_template_module_actions t1
|
||||
INNER JOIN talert_actions t2
|
||||
INNER JOIN talert_template_modules t3
|
||||
ON t3.id = t1.id_alert_template_module
|
||||
AND t1.id_alert_action = t2.id
|
||||
WHERE (t3.id_alert_template = ' . $template['id'] . ' AND
|
||||
t3.id_agent_module = ' . $module['id_agente_modulo'] . ');';
|
||||
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
|
||||
// If this alert doesn't have actions try to get default action from template
|
||||
if ($actions === false) {
|
||||
$sql = 'SELECT name
|
||||
FROM talert_actions
|
||||
WHERE (id = ' . $template_id_alert_action . ');';
|
||||
|
||||
$default_action = true;
|
||||
|
||||
$actions = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
if ($actions === false) {
|
||||
$actions = array();
|
||||
}
|
||||
|
||||
echo '<strong>' . __('Actions') . ': </strong>' . '<br />';
|
||||
echo '<ul style="margin-top: 0px; margin-left: 30px;">';
|
||||
foreach ($actions as $action) {
|
||||
echo '<li style="list-style: disc;">';
|
||||
if ($default_action)
|
||||
echo 'Default: ';
|
||||
echo $action['name'] . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
if ($alert != end($alerts)) {
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$data) {
|
||||
echo '<i>These module/s have no alerts or alert/s are not fired</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<i>No available data</i>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo '<i>No available data</i>';
|
||||
}
|
||||
}
|
||||
check_login ();
|
||||
|
||||
/**
|
||||
* Translate the array texts using gettext
|
||||
*/
|
||||
function translate(&$item, $key) {
|
||||
$item = __($item);
|
||||
if (is_ajax ()) {
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
|
||||
if ($get_info_alert_module_group) {
|
||||
$send_tooltip = json_decode(io_safe_output(get_parameter('send_tooltip')), true);
|
||||
echo "<ul class='tooltip_counters'><h3>" . __('Counters Module') . "</h3>";
|
||||
echo "<li><div style='background-color: " . COL_ALERTFIRED . ";'></div>" . __('Alerts_Fired') . ": " . $send_tooltip['alerts_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_CRITICAL . ";'></div>" . __('Critical') . ": " . $send_tooltip['critical_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_WARNING . ";'></div>" . __('warning') . ": " . $send_tooltip['warning_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_UNKNOWN . ";'></div>" . __('Unknown') . ": " . $send_tooltip['unknown_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_NORMAL . ";'></div>" . __('OK') . ": " . $send_tooltip['normal_module_count'] . "</li>";
|
||||
echo "<li><div style='background-color: " . COL_MAINTENANCE . ";'></div>" . __('Not_init') . ": " . $send_tooltip['notInit_module_count'] . "</li></ul>";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,169 +39,229 @@ function translate(&$item, $key) {
|
||||
* execute the code.
|
||||
*/
|
||||
function mainModuleGroups() {
|
||||
global $config; //the useful global var of Pandora Console, it has many data can you use
|
||||
|
||||
require_once ('include/functions_reporting.php');
|
||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||
require_once($config['homedir'] . "/include/functions_users.php");
|
||||
|
||||
//The big query
|
||||
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
|
||||
FROM tagente_estado
|
||||
WHERE id_agente IN
|
||||
(SELECT id_agente
|
||||
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE (ta.id_grupo = %d OR tasg.id_group = %d) AND disabled IS FALSE
|
||||
)
|
||||
AND id_agente_modulo IN
|
||||
(SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
|
||||
GROUP BY estado";
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/functions_groupview.php");
|
||||
|
||||
$tree_group = new TreeGroup("group", "group");
|
||||
$tree_group->setPropagateCounters(false);
|
||||
$tree_group->setDisplayAllGroups(true);
|
||||
$tree_group->setFilter( array(
|
||||
'searchAgent' => '',
|
||||
'statusAgent' => AGENT_STATUS_ALL,
|
||||
'searchModule' => '',
|
||||
'statusModule' => -1,
|
||||
'groupID' => 0,
|
||||
'tagID' => 0,
|
||||
'show_not_init_agents' => 1,
|
||||
'show_not_init_modules' => 1
|
||||
));
|
||||
$info = $tree_group->getArray();
|
||||
$info = groupview_plain_groups($info);
|
||||
$counter = count($info);
|
||||
$offset = get_parameter('offset', 0);
|
||||
$groups_view = $is_not_paginated
|
||||
? $info
|
||||
: array_slice($info, $offset, $config['block_size']);
|
||||
$agents_counters = array_reduce($groups_view, function($carry, $item){
|
||||
$carry[$item['id']] = $item;
|
||||
return $carry;
|
||||
}, array());
|
||||
|
||||
$ids_array = array_keys($agents_counters);
|
||||
|
||||
$ids_group = implode(',', $ids_array);
|
||||
|
||||
$condition_critical = modules_get_state_condition(AGENT_MODULE_STATUS_CRITICAL_ALERT);
|
||||
$condition_warning = modules_get_state_condition(AGENT_MODULE_STATUS_WARNING_ALERT);
|
||||
$condition_unknown = modules_get_state_condition(AGENT_MODULE_STATUS_UNKNOWN);
|
||||
$condition_not_init = modules_get_state_condition(AGENT_MODULE_STATUS_NO_DATA);
|
||||
$condition_normal = modules_get_state_condition(AGENT_MODULE_STATUS_NORMAL);
|
||||
|
||||
$array_for_defect = array();
|
||||
$array_module_group = array();
|
||||
$array_data = array();
|
||||
|
||||
$sql = "SELECT id_mg, `name` FROM tmodule_group";
|
||||
$array_mod= db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($array_mod as $key => $value) {
|
||||
$array_module_group[$value['id_mg']] = $value['name'];
|
||||
}
|
||||
$array_module_group[0] = 'Nothing';
|
||||
foreach ($agents_counters as $key => $value) {
|
||||
$array_for_defect[$key]['gm'] = $array_module_group;
|
||||
$array_for_defect[$key]['data']['name'] = $value['name'];
|
||||
$array_for_defect[$key]['data']['parent'] = $value['parent'];
|
||||
$array_for_defect[$key]['data']['icon'] = $value['icon'];
|
||||
}
|
||||
|
||||
$sql =
|
||||
"SELECT SUM(IF(tae.alert_fired <> 0, 1, 0)) AS alerts_module_count,
|
||||
SUM(IF($condition_warning, 1, 0)) AS warning_module_count,
|
||||
SUM(IF($condition_unknown, 1, 0)) AS unknown_module_count,
|
||||
SUM(IF($condition_not_init, 1, 0)) AS notInit_module_count,
|
||||
SUM(IF($condition_critical, 1, 0)) AS critical_module_count,
|
||||
SUM(IF($condition_normal, 1, 0)) AS normal_module_count,
|
||||
COUNT(tae.id_agente_modulo) AS total_count,
|
||||
tmg.id_mg,
|
||||
tmg.name as n,
|
||||
tg.id_grupo
|
||||
FROM (
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
ta.id_grupo AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND ta.id_grupo IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo
|
||||
UNION ALL
|
||||
SELECT tam.id_agente_modulo,
|
||||
tam.id_module_group,
|
||||
tasg.id_group AS g,
|
||||
tae.estado,
|
||||
SUM(IF(tatm.last_fired <> 0, 1, 0)) AS alert_fired
|
||||
FROM tagente_modulo tam
|
||||
LEFT JOIN talert_template_modules tatm
|
||||
ON tatm.id_agent_module = tam.id_agente_modulo
|
||||
LEFT JOIN tagente_estado tae
|
||||
ON tae.id_agente_modulo = tam.id_agente_modulo
|
||||
INNER JOIN tagente ta
|
||||
ON ta.id_agente = tam.id_agente
|
||||
INNER JOIN tagent_secondary_group tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE ta.disabled = 0
|
||||
AND tam.disabled = 0
|
||||
AND tam.delete_pending = 0
|
||||
AND tasg.id_group IN ($ids_group)
|
||||
GROUP BY tam.id_agente_modulo, tasg.id_group
|
||||
) AS tae
|
||||
RIGHT JOIN tgrupo tg
|
||||
ON tg.id_grupo = tae.g
|
||||
INNER JOIN (
|
||||
SELECT * FROM tmodule_group
|
||||
UNION ALL
|
||||
SELECT 0 AS 'id_mg', 'Nothing' AS 'name'
|
||||
) AS tmg
|
||||
ON tae.id_module_group = tmg.id_mg
|
||||
GROUP BY tae.g, tmg.id_mg";
|
||||
|
||||
$array_data_prev = db_get_all_rows_sql($sql);
|
||||
|
||||
foreach ($array_data_prev as $key => $value) {
|
||||
$array_data[$value['id_grupo']][$value['id_mg']] = $value;
|
||||
}
|
||||
|
||||
ui_print_page_header (__("Combined table of agent group and module group"), "images/module_group.png", false, "", false, '');
|
||||
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=>
|
||||
__("This table shows in columns the modules group and in rows agents group. The cell shows all modules") )
|
||||
);
|
||||
|
||||
|
||||
$agentGroups = users_get_groups ($config['id_user'], "AR", false);
|
||||
$modelGroups = users_get_all_model_groups();
|
||||
|
||||
if (!empty($agentGroups) && !empty($modelGroups)) {
|
||||
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
|
||||
|
||||
$table = null;
|
||||
$table->headstyle[] = "width: 20%";
|
||||
foreach ($modelGroups as $i => $n) {
|
||||
$table->headstyle[] = "min-width: 60px;max-width: 5%;text-align:center;";
|
||||
$modelGroups[$i] = ui_print_truncate_text($n, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
}
|
||||
|
||||
$head = $modelGroups;
|
||||
array_unshift($head, ' ');
|
||||
|
||||
//Metaobject use in html_print_table
|
||||
$table->align[0] = 'left'; //Align to left the first column.
|
||||
$table->style[0] = 'color: #ffffff; '.
|
||||
'background-color: #373737; font-weight: bolder; padding-right: 10px; width:20%; ';
|
||||
$table->head = $head;
|
||||
$table->width = '100%';
|
||||
|
||||
//The content of table
|
||||
$tableData = array();
|
||||
|
||||
//Create rows and cells
|
||||
foreach ($agentGroups as $idAgentGroup => $name) {
|
||||
$fired = false;
|
||||
$row = array();
|
||||
|
||||
array_push($row, ui_print_truncate_text($name, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF'));
|
||||
|
||||
foreach ($modelGroups as $idModelGroup => $modelGroup) {
|
||||
$fired = false;
|
||||
$query = sprintf($sql, $idAgentGroup, $idAgentGroup, $idModelGroup);
|
||||
|
||||
$rowsDB = db_get_all_rows_sql ($query);
|
||||
|
||||
$agents = agents_get_group_agents($idAgentGroup);
|
||||
|
||||
if (!empty($agents)) {
|
||||
$alerts = agents_get_alerts_simple(array_keys($agents));
|
||||
|
||||
foreach ($alerts as $alert) {
|
||||
$module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
|
||||
if ($idModelGroup == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$fired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$states = array();
|
||||
if ($rowsDB !== false) {
|
||||
foreach ($rowsDB as $rowDB) {
|
||||
$states[$rowDB['estado']] = $rowDB['count'];
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($states as $idState => $state) {
|
||||
$count += $state;
|
||||
}
|
||||
|
||||
$color = 'transparent'; //Defaut color for cell
|
||||
$font_color = '#000000'; //Default font color for cell
|
||||
if ($count == 0) {
|
||||
$color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules.
|
||||
$alinkStart = '';
|
||||
$alinkEnd = '';
|
||||
}
|
||||
else {
|
||||
|
||||
if ($fired) {
|
||||
$color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}
|
||||
else if (array_key_exists(1, $states)) {
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
$font_color = '#ffffff';
|
||||
}
|
||||
elseif (array_key_exists(2, $states)) {
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif (array_key_exists(3, $states)) {
|
||||
$color = '#B2B2B2 '; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
}
|
||||
elseif (array_key_exists(0, $states)) {
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif (array_key_exists(5, $states)) {
|
||||
$color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
|
||||
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' .
|
||||
$idModelGroup . '&id_agent_group=' . $idAgentGroup . '"href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' .
|
||||
$idAgentGroup . '&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
|
||||
$alinkEnd = '</a>';
|
||||
}
|
||||
|
||||
array_push($row,
|
||||
'<div
|
||||
style="background: ' . $color . ';
|
||||
height: 20px;min-width: 60px;max-width:5%;overflow:hidden;
|
||||
margin-left: auto; margin-right: auto;
|
||||
text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;">
|
||||
' . $alinkStart . $count . $alinkEnd . '</div>');
|
||||
}
|
||||
array_push($tableData,$row);
|
||||
}
|
||||
$table->data = $tableData;
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='legend_basic' style='width: 98.6%'>";
|
||||
|
||||
echo "<table >";
|
||||
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>" . __('Legend') . "</b></td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_ALERTFIRED . ";'></div></td><td>" . __("Orange cell when the module group and agent have at least one alarm fired.") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_CRITICAL . ";'></div></td><td>" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module group and agent have all modules in OK status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_MAINTENANCE . ";'></div></td><td>" .__("Blue cell when the module group and agent have all modules in not init status.") . "</td></tr>";
|
||||
echo "</table>";
|
||||
if(count($array_for_defect) > 0){
|
||||
$table = new StdClass();
|
||||
$table->style[0] = 'color: #ffffff; background-color: #373737; font-weight: bolder; padding-right: 10px; min-width: 230px;';
|
||||
$table->width = '100%';
|
||||
|
||||
$head[0] = __('Groups');
|
||||
$headstyle[0] = "width: 20%; font-weight: bolder;";
|
||||
foreach ($array_module_group as $key => $value) {
|
||||
$headstyle[] = "min-width: 60px;max-width: 5%;text-align:center; color: #ffffff; background-color: #373737; font-weight: bolder;";
|
||||
$head[] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($array_for_defect as $key => $value) {
|
||||
$deep = groups_get_group_deep($key);
|
||||
$data[$i][0] = $deep . ui_print_truncate_text($value['data']['name'], GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF');
|
||||
$j = 1;
|
||||
if(isset($array_data[$key])){
|
||||
foreach ($value['gm'] as $k => $v) {
|
||||
if(isset($array_data[$key][$k])){
|
||||
$send_tooltip = json_encode($array_data[$key][$k]);
|
||||
$rel = "ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&send_tooltip=" . $send_tooltip;
|
||||
$url = "index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=" . $key . "&modulegroup=" . $k;
|
||||
|
||||
if ($array_data[$key][$k]['alerts_module_count'] != 0) {
|
||||
$color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}
|
||||
else if ($array_data[$key][$k]['critical_module_count'] != 0) {
|
||||
$color = '#FC4444'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['warning_module_count'] != 0) {
|
||||
$color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['unknown_module_count'] != 0) {
|
||||
$color = '#B2B2B2 '; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['normal_module_count'] != 0) {
|
||||
$color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules.
|
||||
}
|
||||
elseif ($array_data[$key][$k]['notInit_module_count'] != 0) {
|
||||
$color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value.
|
||||
}
|
||||
|
||||
$data[$i][$j] ="<div style='background:$color; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= "<a class='info_cell' rel='$rel' href='$url' style='color:white;font-size: 18px;'>";
|
||||
$data[$i][$j] .= $array_data[$key][$k]['total_count'];
|
||||
$data[$i][$j] .= "</a></div>";
|
||||
}
|
||||
else{
|
||||
$data[$i][$j] ="<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= 0;
|
||||
$data[$i][$j] .= "</div>";
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
else{
|
||||
foreach ($value['gm'] as $k => $v) {
|
||||
$data[$i][$j] ="<div style='background:white; height: 20px;min-width: 60px;max-width:5%;overflow:hidden; margin-left: auto; margin-right: auto; text-align: center; padding: 5px;padding-bottom:10px;font-size: 18px;line-height:25px;'>";
|
||||
$data[$i][$j] .= 0;
|
||||
$data[$i][$j] .= "</div>";
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$table->head = $head;
|
||||
$table->headstyle = $headstyle;
|
||||
$table->data = $data;
|
||||
|
||||
ui_pagination($counter);
|
||||
|
||||
echo "<div style='width:100%; overflow-x:auto;'>";
|
||||
html_print_table($table);
|
||||
echo "</div>";
|
||||
|
||||
ui_pagination($counter);
|
||||
|
||||
echo "<div class='legend_basic' style='width: 98.6%'>";
|
||||
echo "<table >";
|
||||
echo "<tr><td colspan='2' style='padding-bottom: 10px;'><b>" . __('Legend') . "</b></td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_ALERTFIRED . ";'></div></td><td>" . __("Orange cell when the module group and agent have at least one alarm fired.") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_CRITICAL . ";'></div></td><td>" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module group and agent have all modules in OK status") . "</td></tr>";
|
||||
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_MAINTENANCE . ";'></div></td><td>" .__("Blue cell when the module group and agent have all modules in not init status.") . "</td></tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined groups or module groups')."</div>";
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") ));
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups or module groups') ));
|
||||
}
|
||||
|
||||
|
||||
ui_require_css_file('cluetip');
|
||||
ui_require_jquery_file('cluetip');
|
||||
?>
|
||||
@ -292,7 +270,8 @@ function mainModuleGroups() {
|
||||
$("a.info_cell").cluetip ({
|
||||
arrows: true,
|
||||
attribute: 'rel',
|
||||
cluetipClass: 'default'
|
||||
cluetipClass: 'default',
|
||||
width: '200px'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -28,6 +28,11 @@
|
||||
return formattedTime;
|
||||
}
|
||||
},
|
||||
yaxis: {
|
||||
tickFormatter: function (value, axis) {
|
||||
return shortNumber(value);
|
||||
}
|
||||
},
|
||||
series: {
|
||||
lines: {
|
||||
lineWidth: 2,
|
||||
@ -158,6 +163,22 @@
|
||||
});
|
||||
}
|
||||
|
||||
function shortNumber (number) {
|
||||
if (Math.round(number) != number) return number;
|
||||
number = Number.parseInt(number);
|
||||
if (Number.isNaN(number)) return number;
|
||||
|
||||
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
|
||||
var pos = 0;
|
||||
|
||||
while (number >= 1000 || number <= -1000) {
|
||||
pos++;
|
||||
number = number / 1000;
|
||||
}
|
||||
|
||||
return number + " " + shorts[pos];
|
||||
}
|
||||
|
||||
$('#graph').change(function() {
|
||||
$('form#realgraph').submit();
|
||||
});
|
||||
|
@ -24,4 +24,26 @@ ALTER TABLE `tlayout_template_data` ADD COLUMN `linked_layout_node_id` INT(10) N
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `tpolicy_modules_inventory` ADD COLUMN `custom_fields` MEDIUMBLOB NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
COMMIT;
|
@ -1175,13 +1175,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 19);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 20);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '726');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '727');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
@ -1769,8 +1769,32 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_method` varchar(25) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_privacy_pass` varchar(255) NOT NULL default '';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_security_level` varchar(25) NOT NULL default '';
|
||||
|
@ -479,6 +479,7 @@ $table->data[3][1] .= __('Autodisable mode') . ' ' .
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[4][0] = __('Status');
|
||||
$table->data[4][1] = __('Disabled') . ' ' .
|
||||
ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true) . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[4][1] .= __('Enabled') . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
@ -760,7 +760,7 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$old_interval = db_get_value('intervalo', 'tagente', 'id_agente', $id_agente);
|
||||
$old_values = db_get_row('tagente', 'id_agente', $id_agente);
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
if ($fields === false) $fields = array();
|
||||
@ -860,11 +860,21 @@ if ($update_agent) { // if modified some agent paramenter
|
||||
// Update the agent from the metaconsole cache
|
||||
enterprise_include_once('include/functions_agents.php');
|
||||
enterprise_hook ('agent_update_from_cache', array($id_agente, $values,$server_name));
|
||||
|
||||
if ($old_interval != $intervalo) {
|
||||
enterprise_hook('config_agents_update_config_interval', array($id_agente, $intervalo));
|
||||
|
||||
# Update the configuration files
|
||||
if ($old_values['intervalo'] != $intervalo) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agente, 'interval', $intervalo)
|
||||
);
|
||||
}
|
||||
|
||||
if ($old_values['disabled'] != $disabled) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agente, 'standby', $disabled ? "1" : "0")
|
||||
);
|
||||
}
|
||||
|
||||
if($tpolicy_group_old){
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
|
||||
@ -1713,12 +1723,18 @@ if ($delete_module) { // DELETE agent module !
|
||||
ui_print_error_message(__('There was a problem deleting the module'));
|
||||
}
|
||||
else {
|
||||
ui_print_success_message(__('Module deleted succesfully'));
|
||||
|
||||
echo '<script type="text/javascript">
|
||||
location="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'";
|
||||
alert("'.__('Module deleted succesfully').'");
|
||||
</script>';
|
||||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
db_pandora_audit("Agent management",
|
||||
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// MODULE DUPLICATION
|
||||
@ -1936,11 +1952,11 @@ switch ($tab) {
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 220,
|
||||
height: 240,
|
||||
width: 600,
|
||||
title: 'Changing the module name of a satellite agent',
|
||||
open: function(){
|
||||
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be <br> altered manually. Unless you are absolutely certain of <br> the process, do not alter these names.</p>');
|
||||
$('#dialog').html('<br><table><tr><td><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;"></td><td><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;margin-left:40px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br>The names of the modules of a satellite should not be altered manually. Unless you are absolutely certain of the process, do not alter these names.</p></td></tr></table>');
|
||||
},
|
||||
buttons: [{
|
||||
text: "Ok",
|
||||
@ -1970,11 +1986,11 @@ switch ($tab) {
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 280,
|
||||
width: 670,
|
||||
height: 240,
|
||||
width: 650,
|
||||
title: 'Changing snmp module name',
|
||||
open: function(){
|
||||
$('#dialog').html('<br><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features <br> associated with this module, such as network maps, <br> interface graphs or other network modules, may no longer <br> work. If you are not completely sure of the process, please <br> do not change the name of the module. </p>');
|
||||
$('#dialog').html('<br><table><tr><td><img src="images/icono-warning-triangulo.png" style="float:left;margin-left:25px;margin-top:30px;"></td><td><p style="float:right;font-style:nunito;font-size:11pt;margin-right:50px;margin-left:40px;"><span style="font-weight:bold;font-size:12pt;">Warning</span> <br> If you change the name of this module, various features associated with this module, such as network maps, interface graphs or other network modules, may no longer work. If you are not completely sure of the process, please do not change the name of the module. </p></td></tr></table>');
|
||||
},
|
||||
buttons: [{
|
||||
text: "Ok",
|
||||
|
@ -160,7 +160,7 @@ else{
|
||||
|
||||
$table_simple->data[0][0] = __('Name');
|
||||
$table_simple->data[0][1] = html_print_input_text_extended ('name',
|
||||
io_safe_input(html_entity_decode($name)), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
io_safe_input(html_entity_decode($name, ENT_QUOTES, "UTF-8")), 'text-name', '', 45, 100, $disabledBecauseInPolicy, '', $largeClassDisabledBecauseInPolicy, true);
|
||||
//$table_simple->data[0][1] = html_print_input_text ('name',
|
||||
// io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
|
||||
|
||||
|
@ -218,7 +218,7 @@ $(document).ready (function () {
|
||||
$("#value", $value).append ("<em><?php echo __('Empty') ?></em>");
|
||||
}
|
||||
else {
|
||||
$("#value", $value).append (data);
|
||||
$("#value", $value).append (parseInt(data));
|
||||
}
|
||||
$loading.hide ();
|
||||
$value.show ();
|
||||
|
@ -705,18 +705,26 @@ foreach ($simple_alerts as $alert) {
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||
if ($alert['disabled']) {
|
||||
$data[4] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
|
||||
}
|
||||
else {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
||||
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[4] .= '</form>';
|
||||
|
||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
||||
|
||||
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
||||
$data[4] .= html_print_input_hidden ('upd_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
|
||||
$data[4] .= '</form>';
|
||||
|
||||
}
|
||||
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
|
@ -47,6 +47,7 @@ $add_action = (bool) get_parameter ('add_action');
|
||||
$update_action = (bool) get_parameter ('update_action');
|
||||
$delete_action = (bool) get_parameter ('delete_action');
|
||||
$delete_alert = (bool) get_parameter ('delete_alert');
|
||||
$update_alert = (bool) get_parameter ('update_alert'); ////
|
||||
$disable_alert = (bool) get_parameter ('disable_alert');
|
||||
$enable_alert = (bool) get_parameter ('enable_alert');
|
||||
$standbyon_alert = (bool) get_parameter ('standbyon_alert');
|
||||
@ -67,10 +68,32 @@ $standby = get_parameter('standby','');
|
||||
$pure = get_parameter('pure', 0);
|
||||
$messageAction = '';
|
||||
|
||||
if ($update_alert) {
|
||||
|
||||
$id_alert_agent_module = (int) get_parameter ('id_alert_update');
|
||||
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
$values_upd = array();
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_agent_module'] = $id_agent_module;
|
||||
|
||||
if (!empty($id_alert_template))
|
||||
$values_upd['id_alert_template'] = $id_alert_template;
|
||||
|
||||
$id = alerts_update_alert_agent_module ($id_alert_agent_module, $values_upd);
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully updated'), __('Could not be updated'), '', true);
|
||||
|
||||
}
|
||||
|
||||
if ($create_alert) {
|
||||
$id_alert_template = (int) get_parameter ('template');
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
|
||||
if (db_get_value_sql("SELECT COUNT(id)
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module = " . $id_agent_module . "
|
||||
@ -81,7 +104,7 @@ if ($create_alert) {
|
||||
}
|
||||
else {
|
||||
$id = alerts_create_alert_agent_module ($id_agent_module, $id_alert_template);
|
||||
|
||||
|
||||
$alert_template_name = db_get_value ("name",
|
||||
"talert_templates","id", $id_alert_template);
|
||||
$module_name = db_get_value ("nombre",
|
||||
@ -116,6 +139,7 @@ if ($create_alert) {
|
||||
$values['module_action_threshold'] =
|
||||
(int)get_parameter ('module_action_threshold');
|
||||
|
||||
|
||||
alerts_add_alert_agent_module_action ($id, $action_select, $values);
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ foreach ($fields_available as $key=>$available) {
|
||||
}
|
||||
|
||||
$table->data[0][0] = '<b>' . __('Fields available').'</b>';
|
||||
$table->data[1][0] = html_print_select ($fields_available, 'fields_available[]', true, '', '', '', true, true, false, '', false, 'width: 300px');
|
||||
$table->data[1][0] = html_print_select ($fields_available, 'fields_available[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
$table->data[1][1] = '<a href="javascript:">' .
|
||||
html_print_image('images/darrowright.png', true,
|
||||
array('id' => 'right', 'title' => __('Add fields to select'))) .
|
||||
@ -201,7 +201,7 @@ $table->data[1][1] .= '<br><br><br><br><a href="javascript:">' .
|
||||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>' . __('Fields selected') . '</b>';
|
||||
$table->data[1][2] = html_print_select($result_selected,
|
||||
'fields_selected[]', true, '', '', '', true, true, false, '', false, 'width: 300px');
|
||||
'fields_selected[]', true, '', '', 0, true, true, false, '', false, 'width: 300px');
|
||||
|
||||
echo '<form id="custom_events" method="post" action="index.php?sec=geventos&sec2=godmode/events/events§ion=fields&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
@ -223,6 +223,7 @@ $(document).ready (function () {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_selected[]']").append($("<option></option>").html(field_name).attr("value", id_field));
|
||||
$("#fields_available").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -234,11 +235,13 @@ $(document).ready (function () {
|
||||
id_field = $(value).attr('value');
|
||||
$("select[name='fields_available[]']").append($("<option></option>").val(id_field).html('<i>' + field_name + '</i>'));
|
||||
$("#fields_selected").find("option[value='" + id_field + "']").remove();
|
||||
$("#fields_available").find("option[value='0']").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#submit-upd_button").click(function () {
|
||||
$("#fields_selected").find("option[value='0']").remove();
|
||||
$('#fields_selected option').map(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
@ -215,20 +215,57 @@ if (! check_acl($config['id_user'], 0, "PM")) {
|
||||
return;
|
||||
}
|
||||
|
||||
$sec = defined('METACONSOLE') ? 'advanced' : 'gagente';
|
||||
$url_tree = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=tree";
|
||||
$url_groups = "index.php?sec=$sec&sec2=godmode/groups/group_list&tab=groups";
|
||||
$buttons['tree'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_tree'>" .
|
||||
html_print_image(
|
||||
"images/gm_massive_operations.png",
|
||||
true,
|
||||
array (
|
||||
"title" => __('Tree Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$buttons['groups'] = array(
|
||||
'active' => false,
|
||||
'text' => "<a href='$url_groups'>" .
|
||||
html_print_image(
|
||||
"images/group.png",
|
||||
true,
|
||||
array(
|
||||
"title" => __('Group view')
|
||||
)
|
||||
) . "</a>"
|
||||
);
|
||||
|
||||
$tab = (string)get_parameter('tab', 'groups');
|
||||
|
||||
// Marks correct tab
|
||||
switch ($tab) {
|
||||
case 'tree':
|
||||
$buttons['tree']['active'] = true;
|
||||
break;
|
||||
case 'groups':
|
||||
default:
|
||||
$buttons['groups']['active'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
agents_meta_print_header();
|
||||
$sec = 'advanced';
|
||||
echo '<div class="notify">';
|
||||
echo __("Edit or delete groups can cause problems with synchronization");
|
||||
echo '</div>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ui_print_page_header (
|
||||
__("Groups defined in %s", get_product_name()),
|
||||
"images/group.png", false, "", true, ""
|
||||
"images/group.png", false, "", true, $buttons
|
||||
);
|
||||
$sec = 'gagente';
|
||||
}
|
||||
|
||||
$create_group = (bool) get_parameter ('create_group');
|
||||
@ -365,148 +402,158 @@ if (($delete_group) && (check_acl($config['id_user'], 0, "PM"))) {
|
||||
}
|
||||
}
|
||||
|
||||
$acl='';
|
||||
$search_name = '';
|
||||
$offset = (int)get_parameter('offset', 0);
|
||||
$search = (string)get_parameter('search', '');
|
||||
$block_size = $config['block_size'];
|
||||
if($tab == 'tree'){
|
||||
echo html_print_image('images/spinner.gif', true,
|
||||
array('class' => "loading_tree",
|
||||
'style' => 'display: none;'));
|
||||
echo "<div id='tree-controller-recipient'></div>";
|
||||
|
||||
if(!empty($search)){
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
}
|
||||
else{
|
||||
$acl='';
|
||||
$search_name = '';
|
||||
$offset = (int)get_parameter('offset', 0);
|
||||
$search = (string)get_parameter('search', '');
|
||||
$block_size = $config['block_size'];
|
||||
|
||||
if (!users_can_manage_group_all("AR")){
|
||||
$user_groups_acl = users_get_groups(false, "AR");
|
||||
$groups_acl = implode(",", $user_groups_ACL);
|
||||
if(empty($groups_acl)) return ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
if(!empty($search)){
|
||||
$search_name = "AND t.nombre LIKE '%$search%'";
|
||||
}
|
||||
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
}
|
||||
if (!users_can_manage_group_all("AR")){
|
||||
$user_groups_acl = users_get_groups(false, "AR");
|
||||
$groups_acl = implode(",", $user_groups_ACL);
|
||||
if(empty($groups_acl)) return ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters' width='100%' style='font-weight: bold;'>";
|
||||
$form .= "<tr><td>" . __('Search') . ' ';
|
||||
$form .= html_print_input_text ("search", $search, '', 100, 100, true);
|
||||
$form .= "</td><td>";
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= "<td></tr>";
|
||||
$form .= "</table>";
|
||||
$form .= "</form>";
|
||||
$acl = "AND t.id_grupo IN ($groups_acl)";
|
||||
}
|
||||
|
||||
echo $form;
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= "<table class='databox filters' width='100%' style='font-weight: bold;'>";
|
||||
$form .= "<tr><td>" . __('Search') . ' ';
|
||||
$form .= html_print_input_text ("search", $search, '', 100, 100, true);
|
||||
$form .= "</td><td>";
|
||||
$form .= "<input name='find' type='submit' class='sub search' value='".__('Search')."'>";
|
||||
$form .= "<td></tr>";
|
||||
$form .= "</table>";
|
||||
$form .= "</form>";
|
||||
|
||||
$groups_sql =
|
||||
"SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
echo $form;
|
||||
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
if (!empty($groups)) {
|
||||
//Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
$groups_sql =
|
||||
"SELECT t.*,
|
||||
p.nombre AS parent_name,
|
||||
IF(t.parent=p.id_grupo, 1, 0) AS has_child
|
||||
FROM tgrupo t
|
||||
LEFT JOIN tgrupo p
|
||||
ON t.parent=p.id_grupo
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
ORDER BY nombre
|
||||
LIMIT $offset, $block_size
|
||||
";
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Parent');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'right';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '10%';
|
||||
$table->data = array ();
|
||||
$groups = db_get_all_rows_sql($groups_sql);
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = "index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group=".$group['id_grupo'];
|
||||
$url_delete = "index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group=" . $group['id_grupo'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>" . $group['nombre'] . "</a>";
|
||||
$table->data[$key][2] = html_print_image(
|
||||
"images/groups_small/" . $group['icon'] . ".png",
|
||||
true,
|
||||
array(
|
||||
"style" => '',
|
||||
"class" => "bot",
|
||||
"alt" => $group['nombre'],
|
||||
"title" => $group['nombre'],
|
||||
false, false, false, true
|
||||
)
|
||||
);
|
||||
if (!empty($groups)) {
|
||||
//Count all groups for pagination only saw user and filters
|
||||
$groups_sql_count = "SELECT count(*)
|
||||
FROM tgrupo t
|
||||
WHERE 1=1
|
||||
$acl
|
||||
$search_name
|
||||
";
|
||||
$groups_count = db_get_value_sql($groups_sql_count);
|
||||
|
||||
//reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->data[$key][6] = "<a href='$url'>" .
|
||||
html_print_image(
|
||||
"images/config.png",
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = "databox data";
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Name');
|
||||
$table->head[2] = __('Icon');
|
||||
$table->head[3] = __('Alerts');
|
||||
$table->head[4] = __('Parent');
|
||||
$table->head[5] = __('Description');
|
||||
$table->head[6] = __('Actions');
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'left';
|
||||
$table->align[2] = 'left';
|
||||
$table->align[6] = 'left';
|
||||
$table->size[0] = '3%';
|
||||
$table->size[5] = '30%';
|
||||
$table->size[6] = '5%';
|
||||
$table->data = array ();
|
||||
|
||||
foreach ($groups as $key => $group) {
|
||||
$url = "index.php?sec=gagente&sec2=godmode/groups/configure_group&id_group=".$group['id_grupo'];
|
||||
$url_delete = "index.php?sec=gagente&sec2=godmode/groups/group_list&delete_group=1&id_group=" . $group['id_grupo'];
|
||||
$table->data[$key][0] = $group['id_grupo'];
|
||||
$table->data[$key][1] = "<a href='$url'>" . $group['nombre'] . "</a>";
|
||||
$table->data[$key][2] = html_print_image(
|
||||
"images/groups_small/" . $group['icon'] . ".png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Edit'),
|
||||
"title" => __('Edit'),
|
||||
"border" => '0'
|
||||
"style" => '',
|
||||
"class" => "bot",
|
||||
"alt" => $group['nombre'],
|
||||
"title" => $group['nombre'],
|
||||
false, false, false, true
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
);
|
||||
|
||||
//reporting_get_group_stats
|
||||
$table->data[$key][3] = $group['disabled'] ? __('Disabled') : __('Enabled');
|
||||
$table->data[$key][4] = $group['parent_name'];
|
||||
$table->data[$key][5] = $group['description'];
|
||||
$table->data[$key][6] = "<a href='$url'>" .
|
||||
html_print_image(
|
||||
"images/config.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Edit'),
|
||||
"title" => __('Edit'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= ' ' .
|
||||
'<a href="'. $url_delete. '" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' .
|
||||
html_print_image(
|
||||
"images/cross.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Delete'),
|
||||
"title" => __('Delete'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
$confirm_message = __('Are you sure?');
|
||||
if ($group['has_child']) {
|
||||
$confirm_message = __('The child groups will be updated to use the parent id of the deleted group') . ". " . $confirm_message;
|
||||
}
|
||||
|
||||
$table->data[$key][6] .= ' ' .
|
||||
'<a href="'. $url_delete. '" onClick="if (!confirm(\' '.$confirm_message.'\')) return false;">' .
|
||||
html_print_image(
|
||||
"images/cross.png",
|
||||
true,
|
||||
array(
|
||||
"alt" => __('Delete'),
|
||||
"title" => __('Delete'),
|
||||
"border" => '0'
|
||||
)
|
||||
) .
|
||||
"</a>";
|
||||
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', false
|
||||
);
|
||||
html_print_table ($table);
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', true
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', false
|
||||
);
|
||||
html_print_table ($table);
|
||||
echo ui_pagination(
|
||||
$groups_count, false,
|
||||
$offset, $block_size,
|
||||
true, 'offset', true
|
||||
);
|
||||
}
|
||||
else {
|
||||
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined groups') ) );
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], 0, "PM")) {
|
||||
@ -517,5 +564,101 @@ if (check_acl($config['id_user'], 0, "PM")) {
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
ui_require_javascript_file("TreeController", "include/javascript/tree/");
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
$tab = "group_edition";
|
||||
|
||||
?>
|
||||
|
||||
<?php if (!is_metaconsole()){ ?>
|
||||
<script type="text/javascript" src="include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php }else{ ?>
|
||||
<script type="text/javascript" src="../../include/javascript/fixed-bottom-box.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
<script type="text/javascript">
|
||||
var treeController = TreeController.getController();
|
||||
|
||||
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
|
||||
treeController.recipient.empty();
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
parameters['page'] = "include/ajax/tree.ajax";
|
||||
parameters['getChildren'] = 1;
|
||||
parameters['type'] = "<?php echo $tab; ?>";
|
||||
parameters['filter'] = {};
|
||||
parameters['filter']['searchGroup'] = '';
|
||||
parameters['filter']['searchAgent'] = '';
|
||||
parameters['filter']['statusAgent'] = '';
|
||||
parameters['filter']['searchModule'] = '';
|
||||
parameters['filter']['statusModule'] = '';
|
||||
parameters['filter']['groupID'] = '';
|
||||
parameters['filter']['tagID'] = '';
|
||||
parameters['filter']['searchHirearchy'] = 1;
|
||||
parameters['filter']['show_not_init_agents'] = 1;
|
||||
parameters['filter']['show_not_init_modules'] = 1;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: parameters,
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$(".loading_tree").hide();
|
||||
|
||||
treeController.init({
|
||||
recipient: $("div#tree-controller-recipient"),
|
||||
//detailRecipient: $.fixedBottomBox({ width: 400, height: window.innerHeight * 0.9 }),
|
||||
page: parameters['page'],
|
||||
emptyMessage: "<?php echo __('No data found'); ?>",
|
||||
foundMessage: "<?php echo __('Found groups'); ?>",
|
||||
tree: data.tree,
|
||||
baseURL: "<?php echo ui_get_full_url(false, false, false, is_metaconsole()); ?>",
|
||||
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
filter: parameters['filter'],
|
||||
counterTitles: {
|
||||
total: {
|
||||
agents: "<?php echo __('Total agents'); ?>",
|
||||
modules: "<?php echo __('Total modules'); ?>",
|
||||
none: "<?php echo __('Total'); ?>"
|
||||
},
|
||||
alerts: {
|
||||
agents: "<?php echo __('Fired alerts'); ?>",
|
||||
modules: "<?php echo __('Fired alerts'); ?>",
|
||||
none: "<?php echo __('Fired alerts'); ?>"
|
||||
},
|
||||
critical: {
|
||||
agents: "<?php echo __('Critical agents'); ?>",
|
||||
modules: "<?php echo __('Critical modules'); ?>",
|
||||
none: "<?php echo __('Critical'); ?>"
|
||||
},
|
||||
warning: {
|
||||
agents: "<?php echo __('Warning agents'); ?>",
|
||||
modules: "<?php echo __('Warning modules'); ?>",
|
||||
none: "<?php echo __('Warning'); ?>"
|
||||
},
|
||||
unknown: {
|
||||
agents: "<?php echo __('Unknown agents'); ?>",
|
||||
modules: "<?php echo __('Unknown modules'); ?>",
|
||||
none: "<?php echo __('Unknown'); ?>"
|
||||
},
|
||||
not_init: {
|
||||
agents: "<?php echo __('Not init agents'); ?>",
|
||||
modules: "<?php echo __('Not init modules'); ?>",
|
||||
none: "<?php echo __('Not init'); ?>"
|
||||
},
|
||||
ok: {
|
||||
agents: "<?php echo __('Normal agents'); ?>",
|
||||
modules: "<?php echo __('Normal modules'); ?>",
|
||||
none: "<?php echo __('Normal'); ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
</script>
|
||||
|
@ -52,6 +52,8 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
||||
|
||||
global $config;
|
||||
|
||||
$status_module = (int) get_parameter ('status_module');
|
||||
|
||||
if (empty ($module_name)) {
|
||||
ui_print_error_message(__('No module selected'));
|
||||
return false;
|
||||
@ -212,8 +214,10 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
|
||||
}
|
||||
}
|
||||
else {
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||
sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
||||
if ($status_module != -1) // If module status filter has been applied
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s") AND id_agente_modulo IN (SELECT id_agente_modulo FROM tagente_estado where estado = %s OR utimestamp=0 )', implode('","',$module_name), $status_module), true);
|
||||
else
|
||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo', sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ require_once ('include/functions_modules.php');
|
||||
require_once ('include/functions_servers.php');
|
||||
require_once ('include/functions_gis.php');
|
||||
require_once ('include/functions_users.php');
|
||||
enterprise_include_once('include/functions_config_agents.php');
|
||||
|
||||
if (is_ajax ()) {
|
||||
$get_n_conf_files = (bool) get_parameter ('get_n_conf_files');
|
||||
@ -136,8 +137,11 @@ if ($update_agents) {
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if (!empty($values)) {
|
||||
$group_old = false;
|
||||
if($values['id_grupo']){
|
||||
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
|
||||
$disabled_old = false;
|
||||
if($values['id_grupo'] || isset($values['disabled'])){
|
||||
$values_old = db_get_row_filter('tagente', array('id_agente' => $id_agent), array('id_grupo', 'disabled'));
|
||||
if ($values_old['id_grupo']) $group_old = $values_old['id_grupo'];
|
||||
if (isset($values['disabled'])) $disabled_old = $values_old['disabled'];
|
||||
}
|
||||
|
||||
$result = db_process_sql_update ('tagente',
|
||||
@ -149,7 +153,14 @@ if ($update_agents) {
|
||||
// Force an update of the agent cache.
|
||||
$result_metaconsole = agent_update_from_cache($id_agent,$values,$server_name);
|
||||
}
|
||||
|
||||
|
||||
if ($disabled_old !== false && $disabled_old != $values['disabled']) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agent, 'standby', $values['disabled'])
|
||||
);
|
||||
}
|
||||
|
||||
if($group_old || $result){
|
||||
if ($group_old && $group_old != null) {
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
@ -421,7 +432,9 @@ $table->data[1][1] .= __('Autodisable mode').' '.html_print_radio_button_extende
|
||||
// Status (Disabled / Enabled)
|
||||
$table->data[2][0] = __('Status');
|
||||
$table->data[2][1] = __('No change').' '.html_print_radio_button_extended ("disabled", -1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Disabled').' '.html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Disabled') . ' ' .
|
||||
ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true) . ' ' .
|
||||
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
$table->data[2][1] .= __('Active').' '.html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||
|
||||
// Remote configuration
|
||||
|
@ -47,17 +47,21 @@ $update = (bool) get_parameter_post ('update');
|
||||
if ($update) {
|
||||
$agents_ = '';
|
||||
if ($selection_mode == 'modules') {
|
||||
|
||||
$agents_ = array();
|
||||
|
||||
$force = get_parameter('force_type', false);
|
||||
|
||||
if ($agents_select == false) {
|
||||
$agents_select = array();
|
||||
$agents_ = array();
|
||||
}
|
||||
|
||||
foreach ($agents_select as $agent_name) {
|
||||
$agents_[] = agents_get_agent_id($agent_name);
|
||||
}
|
||||
|
||||
$modules_ = $module_name;
|
||||
|
||||
}
|
||||
else if ($selection_mode == 'agents') {
|
||||
$force = get_parameter('force_group', false);
|
||||
@ -75,6 +79,7 @@ if ($update) {
|
||||
// If the option to select all of one group or module type is checked
|
||||
if ($force) {
|
||||
if ($force == 'type') {
|
||||
|
||||
$type_condition = '';
|
||||
if ($module_type != 0)
|
||||
$type_condition = "AND tam.id_tipo_modulo = $module_type";
|
||||
@ -141,12 +146,11 @@ if ($update) {
|
||||
else {
|
||||
// Standard procedure
|
||||
foreach ($agents_ as $agent_) {
|
||||
|
||||
|
||||
if ($modules_ == false)
|
||||
$modules_ = array();
|
||||
|
||||
foreach ($modules_ as $module_) {
|
||||
|
||||
$result = process_manage_edit ($module_, $agent_, $modules_selection_mode);
|
||||
$count++;
|
||||
$success += (int)$result;
|
||||
@ -331,6 +335,7 @@ $table->data['form_modules_2'][2] .= html_print_select (
|
||||
'all' => __('Show all agents')),
|
||||
'agents_selection_mode',
|
||||
'common', false, '', '', true);
|
||||
|
||||
$table->data['form_modules_2'][3] = html_print_select (array(), 'agents[]',
|
||||
$agents_select, false, __('None'), 0, true, true, false);
|
||||
|
||||
@ -1540,12 +1545,14 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
$update_tags = get_parameter('id_tag', false);
|
||||
|
||||
if (array_search(0, $agents_select) !== false) {
|
||||
|
||||
//Apply at All agents.
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
$filter_modules,
|
||||
array ('id_agente_modulo'));
|
||||
}
|
||||
else {
|
||||
|
||||
if ($module_name == "0") {
|
||||
//Any module
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
@ -1559,7 +1566,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
array ('id_agente_modulo'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($modules === false)
|
||||
return false;
|
||||
|
||||
@ -1575,16 +1583,16 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
||||
}
|
||||
$modules = $modules_to_delete;
|
||||
}
|
||||
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
||||
$result = modules_update_agent_module(
|
||||
$module['id_agente_modulo'], $values, true, $update_tags);
|
||||
|
||||
if (is_error($result)) {
|
||||
|
||||
|
||||
if (is_error($result))
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2075,9 +2075,9 @@ else {
|
||||
$buttons = null;
|
||||
$buttons = array(
|
||||
'main' => array('active' => true,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new&pure=' .$pure.'">' .
|
||||
html_print_image("images/op_reporting.png", true, array ("title" => __('Main data'))) .'</a>'));
|
||||
$textReportName = '';
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure=' .$pure.'">' .
|
||||
html_print_image("images/report_list.png", true, array ("title" => __('Reports list'))) .'</a>'));
|
||||
$textReportName = __('Create Custom Report');
|
||||
}
|
||||
|
||||
// Page header for metaconsole
|
||||
|
@ -1543,8 +1543,16 @@ function loadFieldsFromDB(item) {
|
||||
$("select[name=parent]").val(val);
|
||||
if (key == 'linked_layout_status_type')
|
||||
$("select[name=linked_map_status_calculation_type]").val(val).change();
|
||||
if (key == 'id_layout_linked')
|
||||
$("select[name=map_linked]").val(val).change();
|
||||
if (key == 'id_layout_linked') {
|
||||
if (data['linked_layout_node_id'] == null) {
|
||||
$("select[name=map_linked]").val(val).change();
|
||||
}
|
||||
else {
|
||||
var $option = $("select[name=map_linked] > option[data-node-id=" + data['linked_layout_node_id'] + "][value=" + val + "]");
|
||||
if ($option.length === 0) $option = $("select[name=map_linked] > option[value=" + val + "]");
|
||||
$option.prop("selected", true).parent().change();
|
||||
}
|
||||
}
|
||||
if (key == 'linked_layout_node_id')
|
||||
$("input[name=linked_map_node_id]").val(val);
|
||||
if (key == 'id_layout_linked_weight')
|
||||
|
@ -97,7 +97,15 @@ if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) {
|
||||
$field2 = get_parameter ("_field2_", "");
|
||||
$field3 = get_parameter ("_field3_", "");
|
||||
$field4 = get_parameter ("_field4_", "");
|
||||
|
||||
$snmp_version = get_parameter_post ("snmp_version");
|
||||
$snmp3_auth_user = get_parameter_post ("snmp_auth_user");
|
||||
$snmp3_auth_pass = get_parameter_post ("snmp_auth_pass");
|
||||
$snmp3_privacy_method = get_parameter_post ("snmp_privacy_method");
|
||||
$snmp3_privacy_pass = get_parameter_post ("snmp_privacy_pass");
|
||||
$snmp3_auth_method = get_parameter_post ("snmp_auth_method");
|
||||
$snmp3_security_level = get_parameter_post ("snmp_security_level");
|
||||
|
||||
|
||||
if ($mode == "network_sweep")
|
||||
$id_recon_script = 0;
|
||||
else
|
||||
@ -154,8 +162,30 @@ if (isset($_GET["update"])) {
|
||||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version
|
||||
);
|
||||
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level
|
||||
);
|
||||
if($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c'){
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => ''
|
||||
);
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$where = array('id_rt' => $id);
|
||||
|
||||
@ -217,13 +247,37 @@ if (isset($_GET["create"])) {
|
||||
'macros' => $macros,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'snmp_enabled' => $snmp_enabled,
|
||||
'vlan_enabled' => $vlan_enabled
|
||||
'vlan_enabled' => $vlan_enabled,
|
||||
'snmp_version' => $snmp_version
|
||||
);
|
||||
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => $snmp3_auth_user,
|
||||
'snmp_auth_pass' => $snmp3_auth_pass,
|
||||
'snmp_privacy_method' => $snmp3_privacy_method,
|
||||
'snmp_privacy_pass' => $snmp3_privacy_pass,
|
||||
'snmp_auth_method' => $snmp3_auth_method,
|
||||
'snmp_security_level' => $snmp3_security_level
|
||||
);
|
||||
if($values['snmp_version'] == '1' || $values['snmp_version'] == '2' || $values['snmp_version'] == '2c'){
|
||||
$values_v3 = array(
|
||||
'snmp_auth_user' => '',
|
||||
'snmp_auth_pass' => '',
|
||||
'snmp_privacy_method' => '',
|
||||
'snmp_privacy_pass' => '',
|
||||
'snmp_auth_method' => '',
|
||||
'snmp_security_level' => ''
|
||||
);
|
||||
}
|
||||
if ($values['snmp_version'] == '3'){
|
||||
$values['vlan_enabled'] = 0;
|
||||
}
|
||||
|
||||
$values = array_merge($values, $values_v3);
|
||||
|
||||
$name = io_safe_output($name);
|
||||
$name = trim($name, ' ');
|
||||
$name = io_safe_input($name);
|
||||
|
||||
$reason = "";
|
||||
|
||||
if ($name != "") {
|
||||
@ -293,7 +347,7 @@ else {
|
||||
$color=1;
|
||||
if ($result !== false) {
|
||||
$table = new StdClass();
|
||||
$table->head = array (__('Name'), __('Network'), __('Mode'), __('Group'), __('Incident'), __('OS'), __('Interval'), __('Ports'), __('Action'));
|
||||
$table->head = array (__('Name'), __('Network'), __('Mode'), __('Group'), __('SNMP Version'), __('Incident'), __('OS'), __('Interval'), __('Ports'), __('Action'));
|
||||
$table->align = array ("left","left","left","left","left","left","left","left");
|
||||
$table->width = "100%";
|
||||
$table->cellpadding = 4;
|
||||
@ -336,48 +390,64 @@ if ($result !== false) {
|
||||
$data[3] = "-";
|
||||
}
|
||||
|
||||
//SNMP VERSION
|
||||
if ($row["snmp_version"] == '1'){
|
||||
$data[4] = "v. 1";
|
||||
}
|
||||
elseif($row["snmp_version"] == '2'){
|
||||
$data[4] = "v. 2";
|
||||
}
|
||||
elseif($row["snmp_version"] == '2c'){
|
||||
$data[4] = "v. 2c";
|
||||
}
|
||||
elseif($row["snmp_version"] == '3'){
|
||||
$data[4] = "v. 3";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// INCIDENT
|
||||
$data[4] = (($row["create_incident"] == 1) ? __('Yes') : __('No'));
|
||||
$data[5] = (($row["create_incident"] == 1) ? __('Yes') : __('No'));
|
||||
|
||||
// OS
|
||||
if ($row["id_recon_script"] == 0) {
|
||||
$data[5] =(($row["id_os"] > 0) ? ui_print_os_icon ($row["id_os"], false, true) : __('Any'));
|
||||
$data[6] =(($row["id_os"] > 0) ? ui_print_os_icon ($row["id_os"], false, true) : __('Any'));
|
||||
}
|
||||
else {
|
||||
$data[5] = "-";
|
||||
$data[6] = "-";
|
||||
}
|
||||
// INTERVAL
|
||||
if ($row["interval_sweep"]==0)
|
||||
$data[6] = __("Manual");
|
||||
$data[7] = __("Manual");
|
||||
else
|
||||
$data[6] =human_time_description_raw($row["interval_sweep"]);
|
||||
$data[7] =human_time_description_raw($row["interval_sweep"]);
|
||||
|
||||
// PORTS
|
||||
if ($row["id_recon_script"] == 0) {
|
||||
$data[7] = substr($row["recon_ports"],0,15);
|
||||
$data[8] = substr($row["recon_ports"],0,15);
|
||||
}
|
||||
else {
|
||||
$data[7] = "-";
|
||||
$data[8] = "-";
|
||||
}
|
||||
|
||||
// ACTION
|
||||
$task_group = $row["id_group"];
|
||||
|
||||
if (in_array($task_group, $user_groups_w)){
|
||||
$data[8] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">' . html_print_image("images/eye.png", true) . '</a>';
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||
$data[9] = '<a href="index.php?sec=estado&sec2=operation/servers/recon_view">' . html_print_image("images/eye.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&delete='.$row["id_rt"].'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||
if($mode_name != 'IPAM Recon'){
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&update='.$row["id_rt"].'">' .html_print_image("images/config.png", true) . '</a>';
|
||||
} else {
|
||||
$sql_ipam = 'select id from tipam_network where id_recon_task =' . $row["id_rt"];
|
||||
$id_recon_ipam = db_get_sql($sql_ipam);
|
||||
$data[8] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=' . $id_recon_ipam . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=godmode/extensions&sec2=enterprise/extensions/ipam&action=edit&id=' . $id_recon_ipam . '">' . html_print_image("images/config.png", true) . '</a>';
|
||||
}
|
||||
if($row["disabled"] == 0) {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/lightbulb.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=1">' .html_print_image("images/lightbulb.png", true) . '</a>';
|
||||
}
|
||||
else {
|
||||
$data[8] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/lightbulb_off.png", true) . '</a>';
|
||||
$data[9] .= '<a href="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&id='.$row["id_rt"].'&disabled=0">' .html_print_image("images/lightbulb_off.png", true) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,13 @@ if (isset($_GET["update"]) || (isset($_GET["upd"]))) {
|
||||
$id_os = $row["id_os"];
|
||||
$recon_ports = $row["recon_ports"];
|
||||
$snmp_community = $row["snmp_community"];
|
||||
$snmp_version = $row["snmp_version"];
|
||||
$snmp3_auth_user = $row["snmp_auth_user"];
|
||||
$snmp3_auth_pass = $row["snmp_auth_pass"];
|
||||
$snmp3_privacy_method = $row["snmp_privacy_method"];
|
||||
$snmp3_privacy_pass = $row["snmp_privacy_pass"];
|
||||
$snmp3_auth_method = $row["snmp_auth_method"];
|
||||
$snmp3_security_level = $row["snmp_security_level"];
|
||||
$id_recon_script = $row["id_recon_script"];
|
||||
$field1 = $row["field1"];
|
||||
$field2 = $row["field2"];
|
||||
@ -156,6 +163,13 @@ elseif (isset($_GET["create"]) || isset($_GET["crt"])) {
|
||||
$id_group = 0;
|
||||
$create_incident = 1;
|
||||
$snmp_community = "public";
|
||||
$snmp3_auth_user = '';
|
||||
$snmp3_auth_pass = '';
|
||||
$snmp_version = 1;
|
||||
$snmp3_privacy_method = '';
|
||||
$snmp3_privacy_pass = '';
|
||||
$snmp3_auth_method = '';
|
||||
$snmp3_security_level = '';
|
||||
$id_network_profile = 0;
|
||||
$id_os = -1; // Any
|
||||
$recon_ports = ""; // Any
|
||||
@ -212,6 +226,13 @@ $table->rowclass[20] = "network_sweep";
|
||||
$table->rowclass[21] = "network_sweep";
|
||||
$table->rowclass[22] = "network_sweep";
|
||||
$table->rowclass[23] = "network_sweep";
|
||||
$table->rowclass[24] = "network_sweep";
|
||||
$table->rowclass[25] = "network_sweep recon_v3";
|
||||
$table->rowclass[26] = "network_sweep recon_v3";
|
||||
$table->rowclass[27] = "network_sweep recon_v3";
|
||||
$table->rowclass[28] = "network_sweep recon_v3";
|
||||
$table->rowclass[29] = "network_sweep recon_v3";
|
||||
$table->rowclass[30] = "network_sweep recon_v3";
|
||||
|
||||
$table->rowclass[6] = "recon_script";
|
||||
$table->rowclass[13] = "recon_script";
|
||||
@ -327,6 +348,34 @@ $table->data[12][0] = "<b>".__('SNMP Default community');
|
||||
$table->data[12][0] .= ui_print_help_tip (__('You can specify several values, separated by commas, for example: public,mysecret,1234'), true);
|
||||
$table->data[12][1] = html_print_input_text ('snmp_community', $snmp_community, '', 35, 0, true);
|
||||
|
||||
//SNMP version
|
||||
|
||||
$snmp_versions['1'] = 'v. 1';
|
||||
$snmp_versions['2'] = 'v. 2';
|
||||
$snmp_versions['2c'] = 'v. 2c';
|
||||
$snmp_versions['3'] = 'v. 3';
|
||||
$table->data[24][0] ="<b>". _('SNMP version');
|
||||
$table->data[24][1] = html_print_select ($snmp_versions, 'snmp_version', $snmp_version, '', '', 0, true);
|
||||
|
||||
$table->data[25][0] ="<b>".__('Auth user');
|
||||
$table->data[25][1] = html_print_input_text ('snmp_auth_user', $snmp3_auth_user, '', 15, 60, true, '',
|
||||
false, '', '');
|
||||
$table->data[26][0] ="<b>". __('Auth password') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$table->data[26][1] = html_print_input_password ('snmp_auth_pass', $snmp3_auth_pass, '', 15, 60, true, '',
|
||||
false, '');
|
||||
$table->data[26][1] .= html_print_input_hidden_extended('active_snmp_v3', 0, 'active_snmp_v3_mmen', true);
|
||||
|
||||
$table->data[27][0] ="<b>". __('Privacy method');
|
||||
$table->data[27][1] = html_print_select(array('DES' => __('DES'), 'AES' => __('AES')), 'snmp_privacy_method', $snmp3_privacy_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[28][0] ="<b>". __('Privacy pass') . ui_print_help_tip(__("The pass length must be eight character minimum."), true);
|
||||
$table->data[28][1] = html_print_input_password ('snmp_privacy_pass', $snmp3_privacy_pass, '', 15, 60, true, '',
|
||||
false, '');
|
||||
$table->data[29][0] ="<b>". __('Auth method');
|
||||
$table->data[29][1] = html_print_select(array('MD5' => __('MD5'), 'SHA' => __('SHA')), 'snmp_auth_method', $snmp3_auth_method, '', '', '', true, false, false, '', '');
|
||||
$table->data[30][0] ="<b>". __('Security level');
|
||||
$table->data[30][1] = html_print_select(array('noAuthNoPriv' => __('Not auth and not privacy method'),
|
||||
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp_security_level', $snmp3_security_level, '', '', '', true, false, false, '', '');
|
||||
|
||||
// Explanation
|
||||
$explanation = db_get_value('description', 'trecon_script', 'id_recon_script', $id_recon_script);
|
||||
|
||||
@ -461,9 +510,24 @@ $('select#id_recon_script').change(function() {
|
||||
get_explanation_recon_script($(this).val());
|
||||
});
|
||||
|
||||
$('select#snmp_version').change(function () {
|
||||
if (this.value == "3") {
|
||||
$(".recon_v3").show();
|
||||
$("input[name=active_snmp_v3]").val(1);
|
||||
$("input[name=snmp_community]").attr("disabled", true);
|
||||
$("input[name=vlan_enabled]").removeAttr("checked");
|
||||
$("input[name=vlan_enabled]").attr("disabled", true);
|
||||
}
|
||||
else {
|
||||
$(".recon_v3").hide();
|
||||
$("input[name=active_snmp_v3]").val(0);
|
||||
$("input[name=snmp_community]").removeAttr('disabled');
|
||||
$("input[name=vlan_enabled]").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
$('select#mode').change(function() {
|
||||
var type = $(this).val();
|
||||
|
||||
if (type == 'recon_script') {
|
||||
$(".recon_script").show();
|
||||
$(".network_sweep").hide();
|
||||
@ -474,6 +538,7 @@ $('select#mode').change(function() {
|
||||
$(".recon_script").hide();
|
||||
$(".network_sweep").show();
|
||||
$('.macro_field').remove();
|
||||
$('select#snmp_version').trigger('change');
|
||||
}
|
||||
}).change();
|
||||
|
||||
@ -543,5 +608,5 @@ function get_explanation_recon_script (id) {
|
||||
});
|
||||
taskManager.addTask(xhr);
|
||||
}
|
||||
/* ]]> */
|
||||
|
||||
</script>
|
||||
|
@ -253,7 +253,7 @@ if ($create_user) {
|
||||
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Created user ".io_safe_input($id), false, false, $info);
|
||||
"Created user ".io_safe_output($id), false, false, $info);
|
||||
|
||||
ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
|
@ -43,6 +43,7 @@ if (is_ajax ()) {
|
||||
require_once($config['homedir'] . "/include/class/TreeModule.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeTag.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeGroup.class.php");
|
||||
require_once($config['homedir'] . "/include/class/TreeGroupEdition.class.php");
|
||||
enterprise_include_once("include/class/TreePolicies.class.php");
|
||||
enterprise_include_once("include/class/TreeGroupMeta.class.php");
|
||||
require_once($config['homedir'] . "/include/functions_reporting.php");
|
||||
@ -104,6 +105,9 @@ if (is_ajax ()) {
|
||||
if (!class_exists('TreePolicies')) break;
|
||||
$tree = new TreePolicies($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
case 'group_edition':
|
||||
$tree = new TreeGroupEdition($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
break;
|
||||
default:
|
||||
// FIXME. No error handler
|
||||
return;
|
||||
|
@ -101,7 +101,7 @@ $height = get_parameter('height', null);
|
||||
$parent = get_parameter('parent', null);
|
||||
$map_linked = get_parameter('map_linked', null);
|
||||
$linked_map_node_id = get_parameter('linked_map_node_id', null);
|
||||
$linked_map_status_calculation_type = get_parameter('linked_map_status_calculation_type', 'default');
|
||||
$linked_map_status_calculation_type = get_parameter('linked_map_status_calculation_type', null);
|
||||
|
||||
$map_linked_weight = get_parameter('map_linked_weight', null);
|
||||
if ($map_linked_weight !== null) {
|
||||
@ -615,8 +615,8 @@ switch ($action) {
|
||||
$values['id_agent'] = $id_agent;
|
||||
}
|
||||
|
||||
if ($linked_map_node_id) {
|
||||
$values['linked_layout_node_id'] = $linked_map_node_id;
|
||||
if ($linked_map_node_id !== null) {
|
||||
$values['linked_layout_node_id'] = (int) $linked_map_node_id;
|
||||
}
|
||||
}
|
||||
else if ($id_agent == 0) {
|
||||
|
@ -269,6 +269,56 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
||||
else {
|
||||
delete_user_pass_ldap ($login);
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
if($config['ldap_advanced_config']){
|
||||
$i = 0;
|
||||
|
||||
$ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true);
|
||||
foreach ($ldap_adv_perms as $ldap_adv_perm) {
|
||||
$attributes = $ldap_adv_perm['groups_ldap'];
|
||||
|
||||
foreach ($attributes as $attr) {
|
||||
$attr = explode('=', $attr, 2);
|
||||
foreach ($sr[$attr[0]] as $s_attr) {
|
||||
if(preg_match('/' . $attr[1] . '/', $s_attr)){
|
||||
$permissions[$i]["profile"] = $ldap_adv_perm['profile'];
|
||||
$permissions[$i]["groups"] = $ldap_adv_perm['group'];
|
||||
$permissions[$i]["tags"] = implode(",",$ldap_adv_perm['tags']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$permissions[0]["profile"] = $config['default_remote_profile'];
|
||||
$permissions[0]["groups"][] = $config['default_remote_group'];
|
||||
$permissions[0]["tags"] = $config['default_assign_tags'];
|
||||
}
|
||||
if(empty($permissions)) {
|
||||
$config["auth_error"] = __("User not found in database or incorrect password");
|
||||
return false;
|
||||
|
||||
} else {
|
||||
// check permissions
|
||||
$result = check_permission_ad ($login, $pass, false,
|
||||
$permissions, defined('METACONSOLE'));
|
||||
|
||||
if ($return === "error_permissions") {
|
||||
$config["auth_error"] =
|
||||
__("Problems with configuration permissions. Please contact with Administrator");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if ($return === "permissions_changed") {
|
||||
$config["auth_error"] =
|
||||
__("Your permissions have changed. Please, login again.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $login;
|
||||
|
@ -93,12 +93,12 @@ class Tree {
|
||||
if (empty($this->filter['searchModule'])) {
|
||||
return "";
|
||||
}
|
||||
return " AND tam.nombre LIKE '%".$this->filter['searchModule']."%' ";
|
||||
return " AND tam.nombre LIKE '%%".$this->filter['searchModule']."%%' ";
|
||||
}
|
||||
|
||||
protected function getAgentSearchFilter() {
|
||||
if (empty($this->filter['searchAgent'])) return "";
|
||||
return " AND LOWER(ta.alias) LIKE LOWER('%".$this->filter['searchAgent']."%')";
|
||||
return " AND LOWER(ta.alias) LIKE LOWER('%%".$this->filter['searchAgent']."%%')";
|
||||
}
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ class Tree {
|
||||
|
||||
protected function getGroupSearchFilter() {
|
||||
if (empty($this->filter['searchGroup'])) return "";
|
||||
return " AND tg.nombre LIKE '%" . $this->filter['searchGroup'] . "%'";
|
||||
return " AND tg.nombre LIKE '%%" . $this->filter['searchGroup'] . "%%'";
|
||||
}
|
||||
|
||||
static function cmpSortNames($a, $b) {
|
||||
|
@ -20,6 +20,7 @@ require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
class TreeGroup extends Tree {
|
||||
|
||||
protected $propagateCounters = true;
|
||||
protected $displayAllGroups = false;
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
|
||||
@ -44,6 +45,10 @@ class TreeGroup extends Tree {
|
||||
$this->propagateCounters = (bool)$value;
|
||||
}
|
||||
|
||||
public function setDisplayAllGroups($value) {
|
||||
$this->displayAllGroups = (bool)$value;
|
||||
}
|
||||
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
@ -132,12 +137,13 @@ class TreeGroup extends Tree {
|
||||
return !$group['have_parent'];
|
||||
});
|
||||
// Propagate child counters to her parents
|
||||
|
||||
if ($this->propagateCounters) {
|
||||
TreeGroup::processCounters($groups);
|
||||
// Filter groups and eliminates the reference to empty groups
|
||||
$groups = TreeGroup::deleteEmptyGroups($groups);
|
||||
$groups = $this->deleteEmptyGroups($groups);
|
||||
} else {
|
||||
$groups = TreeGroup::deleteEmptyGroupsNotPropagate($groups);
|
||||
$groups = $this->deleteEmptyGroupsNotPropagate($groups);
|
||||
}
|
||||
|
||||
usort($groups, array("Tree", "cmpSortNames"));
|
||||
@ -345,7 +351,8 @@ class TreeGroup extends Tree {
|
||||
*
|
||||
* @return new_groups A new groups structure without empty groups
|
||||
*/
|
||||
protected static function deleteEmptyGroups ($groups) {
|
||||
protected function deleteEmptyGroups ($groups) {
|
||||
if($this->displayAllGroups) return $groups;
|
||||
$new_groups = array();
|
||||
foreach ($groups as $group) {
|
||||
// If a group is empty, do not add to new_groups.
|
||||
@ -354,7 +361,7 @@ class TreeGroup extends Tree {
|
||||
}
|
||||
// Tray to remove the children groups
|
||||
if (!empty($group['children'])) {
|
||||
$children = TreeGroup::deleteEmptyGroups ($group['children']);
|
||||
$children = $this->deleteEmptyGroups ($group['children']);
|
||||
if (empty($children)) unset($group['children']);
|
||||
else $group['children'] = $children;
|
||||
}
|
||||
@ -363,12 +370,13 @@ class TreeGroup extends Tree {
|
||||
return $new_groups;
|
||||
}
|
||||
|
||||
protected static function deleteEmptyGroupsNotPropagate ($groups) {
|
||||
protected function deleteEmptyGroupsNotPropagate ($groups) {
|
||||
if($this->displayAllGroups) return $groups;
|
||||
$new_groups = array();
|
||||
foreach ($groups as $group) {
|
||||
// Tray to remove the children groups
|
||||
if (!empty($group['children'])) {
|
||||
$children = TreeGroup::deleteEmptyGroupsNotPropagate ($group['children']);
|
||||
$children = $this->deleteEmptyGroupsNotPropagate ($group['children']);
|
||||
if (empty($children)) {
|
||||
unset($group['children']);
|
||||
// If a group is empty, do not add to new_groups.
|
||||
|
108
pandora_console/include/class/TreeGroupEdition.class.php
Normal file
108
pandora_console/include/class/TreeGroupEdition.class.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
//Pandora FMS- http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once($config['homedir']."/include/class/Tree.class.php");
|
||||
|
||||
class TreeGroupEdition extends TreeGroup {
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') {
|
||||
global $config;
|
||||
|
||||
parent::__construct($type, $rootType, $id, $rootID, $serverID, $childrenMethod, $access);
|
||||
}
|
||||
protected function getData() {
|
||||
if ($this->id == -1) {
|
||||
$this->getFirstLevel();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getProcessedGroups () {
|
||||
$processed_groups = array();
|
||||
// Index and process the groups
|
||||
$groups = $this->getGroupCounters();
|
||||
|
||||
// If user have not permissions in parent, set parent node to 0 (all)
|
||||
// Avoid to do foreach for admins
|
||||
if (!users_can_manage_group_all("AR")) {
|
||||
foreach ($groups as $id => $group) {
|
||||
if (!isset($this->userGroups[$groups[$id]['parent']])) {
|
||||
$groups[$id]['parent'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Build the group hierarchy
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['parent']) && ($groups[$id]['parent'] != 0)) {
|
||||
$parent = $groups[$id]['parent'];
|
||||
// Parent exists
|
||||
if (!isset($groups[$parent]['children'])) {
|
||||
$groups[$parent]['children'] = array();
|
||||
}
|
||||
// Store a reference to the group into the parent
|
||||
$groups[$parent]['children'][] = &$groups[$id];
|
||||
// This group was introduced into a parent
|
||||
$groups[$id]['have_parent'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the children groups
|
||||
foreach ($groups as $id => $group) {
|
||||
if (isset($groups[$id]['children'])) {
|
||||
usort($groups[$id]['children'], array("Tree", "cmpSortNames"));
|
||||
}
|
||||
}
|
||||
//Filter groups and eliminates the reference to children groups out of her parent
|
||||
$groups = array_filter($groups, function ($group) {
|
||||
return !$group['have_parent'];
|
||||
});
|
||||
|
||||
usort($groups, array("Tree", "cmpSortNames"));
|
||||
return $groups;
|
||||
}
|
||||
|
||||
|
||||
protected function getGroupCounters() {
|
||||
$messages = array(
|
||||
'confirm' => __('Confirm'),
|
||||
'cancel' => __('Cancel'),
|
||||
'messg' => __('Are you sure?')
|
||||
);
|
||||
$sql = "SELECT id_grupo AS gid,
|
||||
nombre as name, parent, icon
|
||||
FROM tgrupo
|
||||
";
|
||||
|
||||
$stats = db_get_all_rows_sql($sql);
|
||||
$group_stats = array();
|
||||
foreach ($stats as $group) {
|
||||
$group_stats[$group['gid']]['name'] = $group['name'];
|
||||
$group_stats[$group['gid']]['parent'] = $group['parent'];
|
||||
$group_stats[$group['gid']]['icon'] = $group['icon'];
|
||||
$group_stats[$group['gid']]['id'] = $group['gid'];
|
||||
$group_stats[$group['gid']]['type'] = 'group';
|
||||
|
||||
$group_stats[$group['gid']] = $this->getProcessedItem($group_stats[$group['gid']]);
|
||||
$group_stats[$group['gid']]['delete']['messages'] = $messages;
|
||||
$group_stats[$group['gid']]['edit'] = 1;
|
||||
$group_stats[$group['gid']]['alerts'] = '';
|
||||
}
|
||||
|
||||
return $group_stats;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -22,7 +22,7 @@
|
||||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180913';
|
||||
$build_version = 'PC181001';
|
||||
$pandora_version = 'v7.0NG.727';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -915,7 +915,7 @@ function agents_get_group_agents (
|
||||
if (isset($search['status'])) {
|
||||
switch ($search['status']) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$filter[] = "normal_count = total_count";
|
||||
$filter[] = "(normal_count = total_count AND notinit_count <> total_count)";
|
||||
break;
|
||||
case AGENT_STATUS_WARNING:
|
||||
$filter[] = "(critical_count = 0 AND warning_count > 0)";
|
||||
@ -2025,11 +2025,17 @@ function agents_get_agentmodule_group ($id_module) {
|
||||
* This function gets the group for a given agent
|
||||
*
|
||||
* @param int The agent id
|
||||
* @param bool True to use the metaconsole tables
|
||||
*
|
||||
* @return int The group id
|
||||
*/
|
||||
function agents_get_agent_group ($id_agent) {
|
||||
return (int) db_get_value ('id_grupo', "tagente", 'id_agente', (int) $id_agent);
|
||||
function agents_get_agent_group ($id_agent, $force_meta = false) {
|
||||
return (int) db_get_value (
|
||||
'id_grupo',
|
||||
$force_meta ? "tmetaconsole_agent" : "tagente",
|
||||
'id_agente',
|
||||
(int) $id_agent
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2680,20 +2686,21 @@ function agents_generate_name ($alias, $address = '') {
|
||||
*
|
||||
* @param int $id_agent
|
||||
* @param int $id_group. By default it will search for it in dtabase
|
||||
* @param bool True to use the metaconsole tables
|
||||
*
|
||||
* @return Array with the main and secondary groups
|
||||
*/
|
||||
function agents_get_all_groups_agent ($id_agent, $group = false) {
|
||||
function agents_get_all_groups_agent ($id_agent, $group = false, $force_meta = false) {
|
||||
// Cache the agent id groups
|
||||
static $cache = array();
|
||||
if (isset($cache[$id_agent])) return $cache[$id_agent];
|
||||
// Get the group if is not defined
|
||||
if ($group === false) $group = agents_get_agent_group($id_agent);
|
||||
if ($group === false) $group = agents_get_agent_group($id_agent, $force_meta);
|
||||
|
||||
// If cannot retrieve the group, it means that agent does not exist
|
||||
if (!$group) return array();
|
||||
|
||||
$secondary_groups = enterprise_hook('agents_get_secondary_groups', array($id_agent));
|
||||
$secondary_groups = enterprise_hook('agents_get_secondary_groups', array($id_agent, $force_meta));
|
||||
|
||||
// Return only an array with the group in open version
|
||||
if ($secondary_groups == ENTERPRISE_NOT_HOOK) return array($group);
|
||||
|
@ -1019,14 +1019,16 @@ function alerts_create_alert_agent_module ($id_agent_module, $id_alert_template,
|
||||
* @return mixed Affected rows or false if something goes wrong.
|
||||
*/
|
||||
function alerts_update_alert_agent_module ($id_alert_agent_module, $values) {
|
||||
if (empty ($id_agent_module))
|
||||
|
||||
if (empty ($id_alert_agent_module))
|
||||
return false;
|
||||
|
||||
if (! is_array ($values))
|
||||
return false;
|
||||
|
||||
|
||||
return (@db_process_sql_update ('talert_template_modules',
|
||||
$values,
|
||||
array ('id' => $id_alert_template))) !== false;
|
||||
array ('id' => $id_alert_agent_module))) !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1311,13 +1313,25 @@ function alerts_delete_alert_agent_module_action ($id_alert_agent_module_action)
|
||||
*
|
||||
* @return mixed Actions associated or false if something goes wrong.
|
||||
*/
|
||||
function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false) {
|
||||
function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false, $server_id = -1) {
|
||||
if (empty ($id_alert_agent_module))
|
||||
return false;
|
||||
|
||||
$actions = db_get_all_rows_filter ('talert_template_module_actions',
|
||||
array ('id_alert_template_module' => $id_alert_agent_module),
|
||||
$fields);
|
||||
|
||||
if (defined('METACONSOLE')) {
|
||||
$server = db_get_row ('tmetaconsole_setup', 'id', $server_id);
|
||||
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
$actions = db_get_all_rows_filter ('talert_template_module_actions',
|
||||
array ('id_alert_template_module' => $id_alert_agent_module),
|
||||
$fields);
|
||||
|
||||
metaconsole_restore_db ();
|
||||
}
|
||||
} else {
|
||||
$actions = db_get_all_rows_filter ('talert_template_module_actions',
|
||||
array ('id_alert_template_module' => $id_alert_agent_module),
|
||||
$fields);
|
||||
}
|
||||
|
||||
if ($actions === false)
|
||||
return array ();
|
||||
@ -1638,23 +1652,13 @@ function get_agent_alert_fired ($id_agent, $id_alert, $period, $date = 0) {
|
||||
*
|
||||
* @return array An array with all the events happened.
|
||||
*/
|
||||
function get_module_alert_fired ($id_agent_module, $id_alert, $period, $date = 0) {
|
||||
function get_module_alert_fired ($id_agent_module, $id_alert) {
|
||||
|
||||
if (!is_numeric ($date)) {
|
||||
$date = time_w_fixed_tz($date);
|
||||
}
|
||||
if (empty ($date)) {
|
||||
$date = get_system_time();
|
||||
}
|
||||
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$sql = sprintf ('SELECT timestamp
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tevento
|
||||
WHERE id_agentmodule = %d AND utimestamp > %d
|
||||
AND utimestamp <= %d
|
||||
WHERE id_agentmodule = %d
|
||||
AND id_alert_am = %d
|
||||
ORDER BY timestamp DESC', $id_agent_module, $datelimit, $date, $id_alert);
|
||||
ORDER BY timestamp DESC', $id_agent_module, $id_alert);
|
||||
|
||||
return db_get_all_rows_sql ($sql);
|
||||
}
|
||||
|
@ -1175,11 +1175,14 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$values_old = db_get_row_filter('tagente',
|
||||
array('id_agente' => $id_agent),
|
||||
array('id_grupo', 'disabled')
|
||||
);
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = ".$values_old['id_grupo']);
|
||||
|
||||
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agent);
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = ".$group_old);
|
||||
|
||||
|
||||
$return = db_process_sql_update('tagente',
|
||||
array('alias' => $alias,
|
||||
'direccion' => $ip,
|
||||
@ -1200,8 +1203,16 @@ function api_set_update_agent($id_agent, $thrash2, $other, $thrash3) {
|
||||
// register ip for this agent in 'taddress'
|
||||
agents_add_address ($id_agent, $ip);
|
||||
}
|
||||
|
||||
|
||||
if($return){
|
||||
// Update config file
|
||||
if (isset($disabled) && $values_old['disabled'] != $disabled) {
|
||||
enterprise_hook(
|
||||
'config_agents_update_config_token',
|
||||
array($id_agent, 'standby', $disabled)
|
||||
);
|
||||
}
|
||||
|
||||
if($tpolicy_group_old){
|
||||
foreach ($tpolicy_group_old as $key => $value) {
|
||||
$tpolicy_agents_old= db_get_sql("SELECT * FROM tpolicy_agents
|
||||
@ -1391,6 +1402,68 @@ function api_set_new_agent($thrash1, $thrash2, $other, $thrash3) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_set_create_os($thrash1, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "AW")) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
|
||||
$values['name'] = $other['data'][0];
|
||||
$values['description'] = $other['data'][1];
|
||||
|
||||
if (($other['data'][2] !== 0) && ($other['data'][2] != '')) {
|
||||
$values['icon_name'] = $other['data'][2];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$resultOrId = false;
|
||||
if ($other['data'][0] != '') {
|
||||
$resultOrId = db_process_sql_insert('tconfig_os', $values);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function api_set_update_os($id_os, $thrash2, $other, $thrash3) {
|
||||
global $config;
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_acl($config['id_user'], 0, "AW")) {
|
||||
returnError('forbidden', 'string');
|
||||
return;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$values['name'] = $other['data'][0];
|
||||
$values['description'] = $other['data'][1];
|
||||
|
||||
if (($other['data'][2] !== 0) && ($other['data'][2] != '')) {
|
||||
$values['icon_name'] = $other['data'][2];;
|
||||
}
|
||||
$result = false;
|
||||
|
||||
|
||||
if ($other['data'][0] != '') {
|
||||
|
||||
$result = db_process_sql_update('tconfig_os', $values, array('id_os' => $id_os));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Creates a custom field
|
||||
@ -7007,10 +7080,11 @@ function otherParameter2Filter($other, $return_as_array = false) {
|
||||
|
||||
$idAgent = null;
|
||||
if (isset($other['data'][2]) && $other['data'][2] != '') {
|
||||
$idAgent = agents_get_agent_id($other['data'][2]);
|
||||
$idAgents = agents_get_agent_id_by_alias($other['data'][2]);
|
||||
|
||||
if (!empty($idAgent)) {
|
||||
$filter['id_agente'] = $idAgent;
|
||||
|
||||
$filter[] = "id_agente IN (" . explode(",", $idAgents) .")";
|
||||
}
|
||||
else {
|
||||
$filter['sql'] = "1=0";
|
||||
|
@ -513,6 +513,8 @@ function grafico_modulo_sparse_data(
|
||||
}
|
||||
$period_time_interval = $period_time_interval - $params['time_interval'];
|
||||
}
|
||||
//drag the last value to paint the graph correctly
|
||||
$acum_array_data[]= array( 0 => $start_period, 1 => $acum_array_data[$i-1][1]);
|
||||
$array_data['sum1']['data'] = $acum_array_data;
|
||||
}
|
||||
|
||||
@ -3034,7 +3036,7 @@ function grafico_incidente_prioridad () {
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
__('Other'), '', $water_mark,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
||||
@ -3075,7 +3077,7 @@ function graph_incidents_status () {
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
__('Other'), '', $water_mark,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
||||
@ -3131,7 +3133,7 @@ function graphic_incident_group () {
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
__('Other'), '', $water_mark,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
||||
@ -3186,7 +3188,7 @@ function graphic_incident_user () {
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
__('Other'), '', $water_mark,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
||||
@ -3240,7 +3242,7 @@ function graphic_incident_source($width = 320, $height = 200) {
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||
__('Other'), '', $water_mark,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,13 @@ else{
|
||||
/**
|
||||
* Prints the print_r with < pre > tags
|
||||
*/
|
||||
function html_debug_print ($var, $file = '') {
|
||||
function html_debug_print ($var, $file = '', $oneline = false) {
|
||||
$more_info = '';
|
||||
if (is_string($var)) {
|
||||
$more_info = 'size: ' . strlen($var);
|
||||
}
|
||||
elseif (is_bool($var)) {
|
||||
$more_info = 'val: ' .
|
||||
$more_info = 'val: ' .
|
||||
($var ? 'true' : 'false');
|
||||
}
|
||||
elseif (is_null($var)) {
|
||||
@ -62,10 +62,13 @@ function html_debug_print ($var, $file = '') {
|
||||
elseif (is_array($var)) {
|
||||
$more_info = count($var);
|
||||
}
|
||||
|
||||
|
||||
if ($file === true)
|
||||
$file = '/tmp/logDebug';
|
||||
|
||||
|
||||
if($oneline && is_string($var))
|
||||
$var = preg_replace("/[\t|\n| ]+/", " ", $var);
|
||||
|
||||
if (strlen($file) > 0) {
|
||||
$f = fopen($file, "a");
|
||||
ob_start();
|
||||
@ -85,8 +88,13 @@ function html_debug_print ($var, $file = '') {
|
||||
}
|
||||
|
||||
// Alias for "html_debug_print"
|
||||
function html_debug ($var, $file = '') {
|
||||
html_debug_print ($var, $file);
|
||||
function html_debug ($var, $file = '', $oneline = false) {
|
||||
html_debug_print ($var, $file, $oneline);
|
||||
}
|
||||
|
||||
// Alias for "html_debug_print"
|
||||
function hd ($var, $file = '', $oneline = false) {
|
||||
html_debug_print ($var, $file, $oneline);
|
||||
}
|
||||
|
||||
function html_f2str($function, $params) {
|
||||
|
@ -441,9 +441,9 @@ function modules_update_agent_module ($id, $values,
|
||||
}
|
||||
|
||||
$result = @db_process_sql_update ('tagente_modulo', $values, $where);
|
||||
|
||||
|
||||
if ($result == false) {
|
||||
if ($result_disable == ERR_GENERIC ){
|
||||
if ($result_disable === ERR_GENERIC ){
|
||||
return ERR_DB;
|
||||
}
|
||||
else{
|
||||
@ -2687,8 +2687,14 @@ function get_module_realtime_link_graph ($module) {
|
||||
* with some user action through the console
|
||||
* @param int New status
|
||||
* @param int Agent module to force new status
|
||||
* @param int Agent id to force state recalculations
|
||||
*/
|
||||
function force_set_module_status ($status, $id_agent_module) {
|
||||
function force_set_module_status ($status, $id_agent_module, $id_agent) {
|
||||
// Force recalculate counters
|
||||
db_process_sql_update('tagente',
|
||||
array('update_module_count' => 1),
|
||||
array('id_agente' => $id_agent)
|
||||
);
|
||||
return db_process_sql_update( 'tagente_estado',
|
||||
array(
|
||||
'estado' => $status,
|
||||
|
@ -29,10 +29,6 @@ require_once($config['homedir'] . "/include/functions_modules.php");
|
||||
require_once($config['homedir'] . "/include/functions_groups.php");
|
||||
ui_require_css_file ('cluetip');
|
||||
|
||||
/**
|
||||
* Definitions
|
||||
*/
|
||||
define('DEFAULT_NETWORKMAP_CENTER_LOGO', 'images/networkmap/bola_pandora_network_maps.png');
|
||||
|
||||
// Check if a node descends from a given node
|
||||
function networkmap_is_descendant ($node, $ascendant, $parents) {
|
||||
|
@ -1552,7 +1552,7 @@ function reporting_event_report_group($report, $content,
|
||||
function reporting_event_report_module($report, $content,
|
||||
$type = 'dinamic', $force_width_chart = null,
|
||||
$force_height_chart = null, $pdf=0) {
|
||||
|
||||
|
||||
global $config;
|
||||
|
||||
if($pdf){
|
||||
@ -1563,20 +1563,29 @@ function reporting_event_report_module($report, $content,
|
||||
}
|
||||
|
||||
$return['type'] = 'event_report_module';
|
||||
|
||||
|
||||
if (empty($content['name'])) {
|
||||
$content['name'] = __('Event Report Module');
|
||||
}
|
||||
|
||||
|
||||
$id_server = false;
|
||||
if(is_metaconsole()){
|
||||
$id_server = metaconsole_get_id_server($content["server_name"]);
|
||||
metaconsole_connect(null, $id_server);
|
||||
}
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']) .
|
||||
" - " .
|
||||
io_safe_output(
|
||||
modules_get_agentmodule_name($content['id_agent_module']));
|
||||
$return['subtitle'] = agents_get_alias($content['id_agent']) . " - " .
|
||||
io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
|
||||
|
||||
if(is_metaconsole()){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$return["description"] = $content["description"];
|
||||
$return["date"] = reporting_get_date_text($report, $content);
|
||||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
|
||||
$event_filter = $content['style'];
|
||||
$return['show_summary_group'] = $event_filter['show_summary_group'];
|
||||
//filter
|
||||
@ -1585,22 +1594,18 @@ function reporting_event_report_module($report, $content,
|
||||
$filter_event_type = json_decode($event_filter['filter_event_type'],true);
|
||||
$filter_event_status = json_decode($event_filter['filter_event_status'],true);
|
||||
$filter_event_filter_search = $event_filter['event_filter_search'];
|
||||
|
||||
|
||||
//graphs
|
||||
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
|
||||
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
|
||||
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
|
||||
|
||||
$id_server = false;
|
||||
if(is_metaconsole()){
|
||||
$id_server = metaconsole_get_id_server($content["server_name"]);
|
||||
}
|
||||
|
||||
//data events
|
||||
$data = reporting_get_module_detailed_event (
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"],
|
||||
$show_summary_group, $filter_event_severity, $filter_event_type,
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"],
|
||||
$show_summary_group, $filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search, $force_width_chart,
|
||||
$event_graph_by_user_validator, $event_graph_by_criticity,
|
||||
$event_graph_by_user_validator, $event_graph_by_criticity,
|
||||
$event_graph_validated_vs_unvalidated, $ttl, $id_server);
|
||||
|
||||
if (empty($data)) {
|
||||
@ -1608,7 +1613,7 @@ function reporting_event_report_module($report, $content,
|
||||
}
|
||||
else {
|
||||
$return['data'] = array_reverse($data);
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
metaconsole_restore_db();
|
||||
@ -1621,7 +1626,7 @@ function reporting_event_report_module($report, $content,
|
||||
else{
|
||||
$return['total_events'] = 0;
|
||||
}
|
||||
|
||||
|
||||
return reporting_check_structure_content($return);
|
||||
}
|
||||
|
||||
@ -2865,14 +2870,27 @@ function reporting_alert_get_fired($id_agent_module, $id_alert_template_module,
|
||||
$id_alert_template_module,
|
||||
$period,
|
||||
$datetime);
|
||||
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$empty = '----------------------------';
|
||||
if (empty($firedTimes)) {
|
||||
$firedTimes = array();
|
||||
$firedTimes[0]['timestamp'] = null;
|
||||
$firedTimes[0]['timestamp'] = $empty;
|
||||
}
|
||||
|
||||
foreach ($firedTimes as $fireTime) {
|
||||
if($fireTime['utimestamp'] > $datelimit && $fireTime['utimestamp'] <= $datetime)
|
||||
$fired[] = $fireTime['timestamp'];
|
||||
else
|
||||
$fired[] = $empty;
|
||||
}
|
||||
|
||||
return $fired;
|
||||
@ -2955,6 +2973,16 @@ function reporting_alert_report_group($report, $content) {
|
||||
|
||||
foreach ($alerts as $template => $actions) {
|
||||
|
||||
$datetime = (int) $report["datetime"];
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
$period = (int) $content["period"];
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$data_action = array();
|
||||
$data_action['actions'] = array();
|
||||
|
||||
@ -2963,7 +2991,7 @@ function reporting_alert_report_group($report, $content) {
|
||||
foreach ($actions["custom"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -2976,7 +3004,7 @@ function reporting_alert_report_group($report, $content) {
|
||||
foreach ($actions["default"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -2989,7 +3017,7 @@ function reporting_alert_report_group($report, $content) {
|
||||
foreach ($actions["unavailable"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3009,10 +3037,7 @@ function reporting_alert_report_group($report, $content) {
|
||||
(int) $report["datetime"]);
|
||||
$module_actions["actions"] = $data_action;
|
||||
|
||||
if ($module_actions["template_fired"][0] !== null)
|
||||
$data_row['alerts'][$ntemplates] = $module_actions;
|
||||
else
|
||||
$data_row = null;
|
||||
$ntemplates++;
|
||||
}
|
||||
|
||||
@ -3075,6 +3100,16 @@ function reporting_alert_report_agent($report, $content) {
|
||||
|
||||
foreach ($alerts as $template => $actions) {
|
||||
|
||||
$datetime = (int) $report["datetime"];
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
$period = (int) $content["period"];
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$data_action = array();
|
||||
$data_action['actions'] = array();
|
||||
|
||||
@ -3083,7 +3118,7 @@ function reporting_alert_report_agent($report, $content) {
|
||||
foreach ($actions["custom"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3096,7 +3131,7 @@ function reporting_alert_report_agent($report, $content) {
|
||||
foreach ($actions["default"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3109,7 +3144,7 @@ function reporting_alert_report_agent($report, $content) {
|
||||
foreach ($actions["unavailable"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3129,10 +3164,7 @@ function reporting_alert_report_agent($report, $content) {
|
||||
(int) $report["datetime"]);
|
||||
$module_actions["actions"] = $data_action;
|
||||
|
||||
if ($module_actions["template_fired"][0] !== null)
|
||||
$data_row['alerts'][$ntemplates] = $module_actions;
|
||||
else
|
||||
$data_row = null;
|
||||
$ntemplates++;
|
||||
}
|
||||
|
||||
@ -3191,13 +3223,18 @@ function reporting_alert_report_module($report, $content) {
|
||||
// Alerts over $id_agent_module
|
||||
$alerts = alerts_get_effective_alert_actions($content['id_agent_module']);
|
||||
|
||||
if ($alerts === false){
|
||||
return;
|
||||
}
|
||||
|
||||
$ntemplates = 0;
|
||||
|
||||
foreach ($alerts as $template => $actions) {
|
||||
$datetime = (int) $report["datetime"];
|
||||
if (!is_numeric ($datetime)) {
|
||||
$datetime = time_w_fixed_tz($datetime);
|
||||
}
|
||||
if (empty ($datetime)) {
|
||||
$datetime = get_system_time();
|
||||
}
|
||||
$period = (int) $content["period"];
|
||||
$datelimit = $datetime - $period;
|
||||
|
||||
$data_action = array();
|
||||
$data_action['actions'] = array();
|
||||
@ -3207,7 +3244,7 @@ function reporting_alert_report_module($report, $content) {
|
||||
foreach ($actions["custom"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3220,7 +3257,7 @@ function reporting_alert_report_module($report, $content) {
|
||||
foreach ($actions["default"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3233,7 +3270,7 @@ function reporting_alert_report_module($report, $content) {
|
||||
foreach ($actions["unavailable"] as $action) {
|
||||
$data_action[$naction]["name"] = $action["name"];
|
||||
$fired = $action["fired"];
|
||||
if ($fired == 0){
|
||||
if ($fired == 0 || ($fired <= $datelimit || $fired > $datetime)){
|
||||
$data_action[$naction]['fired'] = '----------------------------';
|
||||
}
|
||||
else {
|
||||
@ -3253,10 +3290,7 @@ function reporting_alert_report_module($report, $content) {
|
||||
(int) $report["datetime"]);
|
||||
$module_actions["actions"] = $data_action;
|
||||
|
||||
if ($module_actions["template_fired"][0] !== null)
|
||||
$data_row['alerts'][$ntemplates] = $module_actions;
|
||||
else
|
||||
$data_row = null;
|
||||
$ntemplates++;
|
||||
}
|
||||
|
||||
@ -3816,114 +3850,114 @@ function reporting_value($report, $content, $type,$pdf) {
|
||||
'type_graph' => $config['type_module_charts'],
|
||||
'time_interval' => $content['lapse'],
|
||||
'server_id' => $id_meta,
|
||||
'height' => $config['graph_image_height']
|
||||
'height' => $config['graph_image_height'],
|
||||
'fullscale' => true
|
||||
);
|
||||
|
||||
switch ($type) {
|
||||
case 'max':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Maximum").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'max_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Maximum").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module'], true);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if ($i>$time_begin['utimestamp']) {
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
} else {
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
$value .= '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
$formated_value = $value;
|
||||
}
|
||||
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'max_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Maximum").'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_max(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
}
|
||||
else{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
$value .= '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$formated_value = $value;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
case 'min':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_min(
|
||||
@ -4034,111 +4068,111 @@ function reporting_value($report, $content, $type,$pdf) {
|
||||
|
||||
break;
|
||||
case 'avg':
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
if($content['lapse_calc'] == 0){
|
||||
$value = reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
if (!$config['simple_module_value']) {
|
||||
$formated_value = $value;
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
else{
|
||||
$value = '
|
||||
<table border="0" style="margin:0 auto;text-align:center;">
|
||||
<tr>
|
||||
<td width="400px;" height="20%;">';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Average").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
}
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'avg_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;background-color:#eee;border: solid lightgray 1px;">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Agent").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Module").'
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Average").'
|
||||
</th>
|
||||
<tr>
|
||||
<td style="padding:5px;">
|
||||
'.$agent_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.$module_name.'
|
||||
</td>
|
||||
<td style="padding:5px;">
|
||||
'.format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.'
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
}
|
||||
else{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
</td>
|
||||
<td rowspan="2" width="150px">
|
||||
</td>
|
||||
<td rowspan="2">';
|
||||
if($content['visual_format'] == 2 || $content['visual_format'] == 3){
|
||||
$params['force_interval'] = 'avg_only';
|
||||
$value .= grafico_modulo_sparse($params);
|
||||
}
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>';
|
||||
|
||||
if($content['visual_format'] == 1 || $content['visual_format'] == 3){
|
||||
|
||||
$value .= '
|
||||
<table style="width:90%;margin:0 auto;margin-top:30px;background-color:#eee;border: solid lightgray 1px;">
|
||||
<tr>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Lapse").'
|
||||
</th>
|
||||
<th style="padding:5px;background-color:#82b92e;">
|
||||
'.__("Average").'
|
||||
</th>
|
||||
</tr>
|
||||
<tr>';
|
||||
$time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']);
|
||||
$date_reference = getdate();
|
||||
|
||||
for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) {
|
||||
|
||||
$value .= '<tr><td style="padding:5px;">'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).'</td><td>';
|
||||
|
||||
if($i>$time_begin['utimestamp']){
|
||||
$value .= format_for_graph(reporting_get_agentmodule_data_average(
|
||||
$content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'</td></tr>';
|
||||
}
|
||||
else{
|
||||
$value .= 'N/A</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$value .='</table>';
|
||||
}
|
||||
|
||||
$value .= '
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
$formated_value = $value;
|
||||
|
||||
$formated_value = $value;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'sum':
|
||||
$value = reporting_get_agentmodule_data_sum(
|
||||
@ -6246,6 +6280,11 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
|
||||
else {
|
||||
$content['name'] = __('Simple graph');
|
||||
}
|
||||
} else {
|
||||
if ($type_report == "custom_graph") {
|
||||
$graphs = db_get_all_rows_field_filter ("tgraph", "id_graph", $content['id_gs']);
|
||||
$id_graph = $content['id_gs'];
|
||||
}
|
||||
}
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
|
@ -1960,6 +1960,12 @@ function reporting_html_alert_report($table, $item, $pdf = 0) {
|
||||
$table1->data = array ();
|
||||
$table1->rowspan = array();
|
||||
$table1->valign = array();
|
||||
|
||||
if ($item['data'] == null) {
|
||||
$table->data['alerts']['cell'] = ui_print_empty_data ( __('No alerts defined') , '', true) ;
|
||||
return true;
|
||||
}
|
||||
|
||||
$table1->head['agent'] = __('Agent');
|
||||
$table1->head['module'] = __('Module');
|
||||
$table1->head['template'] = __('Template');
|
||||
|
@ -823,10 +823,6 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
||||
else
|
||||
return array ("", "", "", "", "", "", "");
|
||||
}
|
||||
|
||||
// Get agent id
|
||||
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
|
||||
$agente = db_get_row ('tagente', 'id_agente', $id_agent);
|
||||
$template = alerts_get_alert_template ($alert['id_alert_template']);
|
||||
$description = io_safe_output($template['name']);
|
||||
|
||||
@ -934,7 +930,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
||||
ui_print_truncate_text (io_safe_output($description), 'description', false, true, true, '[…]', 'font-size: 7.1pt') .
|
||||
$disabledHtmlEnd;
|
||||
|
||||
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false);
|
||||
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $alert['server_data']['id']);
|
||||
|
||||
if (!empty($actions)) {
|
||||
$actionText = '<div><ul class="action_list">';
|
||||
@ -4052,7 +4048,7 @@ function ui_get_logo_to_center_networkmap () {
|
||||
global $config;
|
||||
|
||||
if ((!enterprise_installed()) || empty($config['custom_network_center_logo'])) {
|
||||
return DEFAULT_NETWORKMAP_CENTER_LOGO;
|
||||
return 'images/networkmap/bola_pandora_network_maps.png';
|
||||
}
|
||||
|
||||
return 'enterprise/images/custom_general_logos/' . $config['custom_support_logo'];
|
||||
|
@ -418,10 +418,13 @@ function users_get_first_group ($id_user = false, $privilege = "AR", $all_group
|
||||
* @param int Agent id.
|
||||
* @param string Access mode to be checked. Default AR (Agent reading)
|
||||
* @param string User id. Current user by default
|
||||
* @param bool True to use the metaconsole tables
|
||||
*
|
||||
* @return bool Access to that agent (false not, true yes)
|
||||
*/
|
||||
function users_access_to_agent ($id_agent, $mode = "AR", $id_user = false) {
|
||||
function users_access_to_agent (
|
||||
$id_agent, $mode = "AR", $id_user = false, $force_meta = false
|
||||
) {
|
||||
if (empty ($id_agent))
|
||||
return false;
|
||||
|
||||
@ -432,7 +435,7 @@ function users_access_to_agent ($id_agent, $mode = "AR", $id_user = false) {
|
||||
|
||||
return (bool) check_acl_one_of_groups (
|
||||
$id_user,
|
||||
agents_get_all_groups_agent((int)$id_agent),
|
||||
agents_get_all_groups_agent((int)$id_agent, false, $force_meta),
|
||||
$mode);
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layoutData['id_metaconsole'],
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layoutData['id_agent']);
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layoutData['id_agent'], null, null, null, $isExternalLink);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -499,7 +499,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layoutData['id_metaconsole'],
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layoutData['id_agent']);
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layoutData['id_agent'], null, null, null, $isExternalLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -662,7 +662,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layoutData['id_metaconsole'],
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layoutData['id_agent']);
|
||||
"estado", "operation/agentes/ver_agente&id_agente=" . $layoutData['id_agent'], null, null, null, $isExternalLink);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -724,7 +724,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layoutData['id_metaconsole'],
|
||||
"estado", 'operation/agentes/ver_agente&id_agente='.$layoutData['id_agent']);
|
||||
"estado", 'operation/agentes/ver_agente&id_agente='.$layoutData['id_agent'], null, null, null, $isExternalLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -779,7 +779,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
else {
|
||||
$url = ui_meta_get_url_console_child(
|
||||
$layoutData['id_metaconsole'],
|
||||
"estado", 'operation/agentes/ver_agente&id_agente='.$layoutData["id_agent"].'&tab=data');
|
||||
"estado", 'operation/agentes/ver_agente&id_agente='.$layoutData["id_agent"].'&tab=data', null, null, null, $isExternalLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$visual_maps = db_get_all_rows_filter("tlayout", "id != " . (int) $visualConsole_id, array("id", "name"));
|
||||
|
||||
$form_items_advance['map_linked_row']['html'] = '<td align="left">'
|
||||
. __('Linked map')
|
||||
. __('Linked visual console')
|
||||
. '</td>'
|
||||
. '<td align="left">';
|
||||
|
||||
@ -727,7 +727,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
return $arr;
|
||||
}, array());
|
||||
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select_from_sql(
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select(
|
||||
array(), 'map_linked', 0, 'onLinkedMapChange(event)', __('None'), 0, true
|
||||
);
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_input_hidden(
|
||||
@ -773,7 +773,11 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
$form_items_advance['map_linked_row']['html'] .= ob_get_clean();
|
||||
}
|
||||
else {
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select_from_sql(
|
||||
$visual_maps = array_reduce($visual_maps, function ($all, $item) {
|
||||
$all[$item["id"]] = $item["name"];
|
||||
return $all;
|
||||
}, array());
|
||||
$form_items_advance['map_linked_row']['html'] .= html_print_select(
|
||||
$visual_maps, 'map_linked', 0, 'onLinkedMapChange(event)', __('None'), 0, true
|
||||
);
|
||||
}
|
||||
@ -790,7 +794,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
$form_items_advance['linked_map_status_calculation_row']['html'] = '<td align="left">'.
|
||||
__('Type of the status calculation of the linked map') . '</td>'
|
||||
__('Type of the status calculation of the linked visual console') . '</td>'
|
||||
. '<td align="left">'
|
||||
. html_print_select(
|
||||
$status_type_select_items,
|
||||
@ -803,6 +807,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
false,
|
||||
false
|
||||
)
|
||||
. ui_print_help_icon("linked_map_status_calc", true)
|
||||
. '</td>';
|
||||
|
||||
$form_items_advance['map_linked_weight'] = array();
|
||||
@ -811,13 +816,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
||||
'percentile_item', 'module_graph', 'simple_value',
|
||||
'icon', 'label', 'datos', 'donut_graph');
|
||||
$form_items_advance['map_linked_weight']['html'] = '<td align="left">'
|
||||
. __('Linked map weight') . '</td>'
|
||||
. __('Linked visual console weight') . '</td>'
|
||||
. '<td align="left">'
|
||||
. html_print_input_text(
|
||||
'map_linked_weight', 80, '', 5, 5, true, false, false, "", "type_number percentage"
|
||||
)
|
||||
. '<span>%</span>'
|
||||
. ui_print_help_icon("linked_map_weight", true)
|
||||
. '</td>';
|
||||
|
||||
$form_items_advance['linked_map_status_service_critical_row'] = array();
|
||||
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Ways to calculate the status of the linked visual console</h1>
|
||||
|
||||
<h3>By Default</h3>
|
||||
<p>
|
||||
It calculates the status based on the status of all elements, as an agent would do.
|
||||
</p>
|
||||
|
||||
<h3>By weight</h3>
|
||||
<p>
|
||||
It calculates the status of the elements that have a visual console, a module or an agent assigned in relation to a percentage of elements configured by the user. This percentage is the one that has to exceed the number of elements of a non-normal status with respect to the number of elements taken into account in the calculation for that status to change.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example, given an element with a percentage of 50% and a visual console linked with 5 elements:
|
||||
</p>
|
||||
<ul>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>normal</i> -> Status <i>normal</i>.</li>
|
||||
<li>2 <i>critical</i>, 2 <i>warning</i> y 1 <i>normal</i> -> Status <i>normal</i>.</li>
|
||||
<li>1 <i>critical</i>, 3 <i>warning</i> y 1 <i>normal</i> -> Status <i>warning</i>.</li>
|
||||
<li>3 <i>critical</i>, 1 <i>warning</i> y 1 <i>normal</i> -> Status <i>critical.</i></li>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>unknown</i> -> Status <i>unknown</i>.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
If several statuses exceed the weight, the priority is the same as in the rest of the status calculation (<i>critical</i> > <i>warning</i> > <i>unknown</i>). If there are no elements to perform the calculation, the status becomes <i>unknown</i>.
|
||||
</p>
|
||||
|
||||
<h3>By critical elements</h3>
|
||||
<p>
|
||||
It calculates the status using the elements in <i>critical</i> status and the percentages of the thresholds defined by the user. If the number of elements in <i>critical</i> status with respect to the number of elements taken into account in the calculation exceeds the percentage assigned as <i>warning</i>, the status becomes <i>warning</i>. The same applies to the percentage assigned as <i>critical</i>, which also has preference.
|
||||
</p>
|
56
pandora_console/include/help/en/help_log_viewer.php
Normal file
56
pandora_console/include/help/en/help_log_viewer.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Include/help/en
|
||||
*/
|
||||
?>
|
||||
<h1>Modelos de captura de datos</h1>
|
||||
<p>
|
||||
Se pueden realizar graficas extrayendo información
|
||||
de los logs, clasificando la información en base a modelos de captura de datos.
|
||||
</p>
|
||||
<p>
|
||||
Estos modelos de captura de datos son básicamente expresiones regulares e
|
||||
identificadores, que nos permitirán analizar los orígenes de datos y mostrarlos como un gráfico.
|
||||
</p>
|
||||
<p>
|
||||
Podemos seleccionar el modelo de captura.
|
||||
El modelo por defecto, Apache log model, ofrece la posibilidad de parsear logs de Apache
|
||||
en formato estándar (access_log), pudiendo extraer gráficas comparativas de tiempo de respuesta,
|
||||
agrupando por página visitada y código de respuesta.
|
||||
</p>
|
||||
<p>
|
||||
Al pulsar en el botón de editar editaremos el modelo de captura seleccionado.
|
||||
Con el botón de crear agregaremos un nuevo modelo de captura.
|
||||
En el formulario que aparece, podremos elegir:
|
||||
</p>
|
||||
<p><h4>Título</h4>
|
||||
Un nombre para el modelo de captura
|
||||
</p>
|
||||
<p><h4>Expresión regular</h4>
|
||||
Cada campo a extraer se identifica con la subexpresión entre los paréntesis (expresión a capturar).
|
||||
</p>
|
||||
<p><h4>Los campos</h4>
|
||||
En el orden en que los hemos capturado con la expresión regular.
|
||||
Los resultados se agruparán por la concatenación de los campos clave, que son aquellos
|
||||
cuyo nombre no esté entre guiones bajos:
|
||||
</p>
|
||||
<p>clave, _valor_</p>
|
||||
<p><em>Observación:</em> Si no especificamos un campo valor, será automáticamente el conteo de apariciones
|
||||
que coinciden con la expresión regular.</p>
|
||||
|
||||
<p><em>Observación 2:</em> Si especificamos una columna valor podremos elegir entre representar el valor acumulado
|
||||
(comportamiento por defecto) o marcar el checkbox para representar el promedio.</p>
|
||||
|
||||
<h3>Ejemplo</h3>
|
||||
<p>Si quisiéramos extraer entradas de un log con el siguiente formato:</p>
|
||||
<p><b>Sep 19 12:05:01 nova systemd: Starting Session 6132 of user root.</b></p>
|
||||
|
||||
<p>Para contar el número de veces que se ha iniciado sesión, agrupando por usuario, usaremos la expresion regular:<p>
|
||||
<p><b>Starting Session \d+ of user (.*?)\.</b></p>
|
||||
|
||||
<p>y de campo:</p>
|
||||
<p><b>username</b></p>
|
||||
|
||||
<p>Este modelo de captura nos devolverá una grafica con el número de inicios de sesión por usuario
|
||||
en el intervalo de tiempo que seleccionemos.</p>
|
||||
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Include/help/es
|
||||
*/
|
||||
?>
|
||||
<h1>Formas de calcular el estado de la consola visual enlazada</h1>
|
||||
|
||||
<h3>Por defecto</h3>
|
||||
<p>
|
||||
Calcula el estado a partir del estado de todos los elementos, como lo haría un agente.
|
||||
</p>
|
||||
|
||||
<h3>Por peso</h3>
|
||||
<p>
|
||||
Calcula el estado de los elementos que tienen asignados una consola visual, un módulo o un agente en relación a un porcentaje de elementos configurado por el usuario. Este porcentaje es el que tiene que superar el número de elementos de un estado no normal respecto al número de elementos tenidos en cuenta en el cálculo para que el ese estado cambie.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Por ejemplo, dado un elemento con un porcentaje del 50% y una consola visual enlazada con 5 elementos:
|
||||
</p>
|
||||
<ul>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>normal</i> -> Estado <i>normal</i>.</li>
|
||||
<li>2 <i>critical</i>, 2 <i>warning</i> y 1 <i>normal</i> -> Estado <i>normal</i>.</li>
|
||||
<li>1 <i>critical</i>, 3 <i>warning</i> y 1 <i>normal</i> -> Estado <i>warning</i>.</li>
|
||||
<li>3 <i>critical</i>, 1 <i>warning</i> y 1 <i>normal</i> -> Estado <i>critical.</i></li>
|
||||
<li>1 <i>critical</i>, 1 <i>warning</i> y 3 <i>unknown</i> -> Estado <i>unknown</i>.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Si varios estados superan el peso, la prioridad es igual que en el resto de cálculo de estados (<i>critical</i> > <i>warning</i> > <i>unknown</i>). Si no hay elementos para realizar el cálculo, el estado pasa a ser <i>unknown</i>.
|
||||
</p>
|
||||
|
||||
<h3>Por elementos críticos</h3>
|
||||
<p>
|
||||
Calcula el estado usando los elementos en estado <i>critical</i> y los porcentajes de los umbrales definidos por el usuario. Si el número de los elementos en estado <i>critical</i> respecto al número de elementos tenidos en cuenta en el cálculo supera el porcentaje asignado como <i>warning</i>, el estado pasa a ser <i>warning</i>. Lo mismo para el porcentaje asignado como <i>critical</i>, que además tiene preferencia.
|
||||
</p>
|
56
pandora_console/include/help/es/help_log_viewer.php
Normal file
56
pandora_console/include/help/es/help_log_viewer.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Include/help/en
|
||||
*/
|
||||
?>
|
||||
<h1>Visualización y búsqueda avanzadas</h1>
|
||||
<p>
|
||||
Se pueden realizar graficas extrayendo información
|
||||
de los logs, clasificando la información en base a modelos de captura de datos.
|
||||
</p>
|
||||
<p>
|
||||
Estos modelos de captura de datos son básicamente expresiones regulares e
|
||||
identificadores, que nos permitirán analizar los orígenes de datos y mostrarlos como un gráfico.
|
||||
</p>
|
||||
<p>
|
||||
Podemos seleccionar el modelo de captura.
|
||||
El modelo por defecto, Apache log model, ofrece la posibilidad de parsear logs de Apache
|
||||
en formato estándar (access_log), pudiendo extraer gráficas comparativas de tiempo de respuesta,
|
||||
agrupando por página visitada y código de respuesta.
|
||||
</p>
|
||||
<p>
|
||||
Al pulsar en el botón de editar editaremos el modelo de captura seleccionado.
|
||||
Con el botón de crear agregaremos un nuevo modelo de captura.
|
||||
En el formulario que aparece, podremos elegir:
|
||||
</p>
|
||||
<p><h4>Título</h4>
|
||||
Un nombre para el modelo de captura
|
||||
</p>
|
||||
<p><h4>Expresión regular</h4>
|
||||
Cada campo a extraer se identifica con la subexpresión entre los paréntesis (expresión a capturar).
|
||||
</p>
|
||||
<p><h4>Los campos</h4>
|
||||
En el orden en que los hemos capturado con la expresión regular.
|
||||
Los resultados se agruparán por la concatenación de los campos clave, que son aquellos
|
||||
cuyo nombre no esté entre guiones bajos:
|
||||
</p>
|
||||
<p>clave, _valor_</p>
|
||||
<p><em>Observación:</em> Si no especificamos un campo valor, será automáticamente el conteo de apariciones
|
||||
que coinciden con la expresión regular.</p>
|
||||
|
||||
<p><em>Observación 2:</em> Si especificamos una columna valor podremos elegir entre representar el valor acumulado
|
||||
(comportamiento por defecto) o marcar el checkbox para representar el promedio.</p>
|
||||
|
||||
<h3>Ejemplo</h3>
|
||||
<p>Si quisiéramos extraer entradas de un log con el siguiente formato:</p>
|
||||
<p><b>Sep 19 12:05:01 nova systemd: Starting Session 6132 of user root.</b></p>
|
||||
|
||||
<p>Para contar el número de veces que se ha iniciado sesión, agrupando por usuario, usaremos la expresion regular:<p>
|
||||
<p><b>Starting Session \d+ of user (.*?)\.</b></p>
|
||||
|
||||
<p>y de campo:</p>
|
||||
<p><b>username</b></p>
|
||||
|
||||
<p>Este modelo de captura nos devolverá una grafica con el número de inicios de sesión por usuario
|
||||
en el intervalo de tiempo que seleccionemos.</p>
|
||||
|
55
pandora_console/include/help/ja/help_log_viewer.php
Normal file
55
pandora_console/include/help/ja/help_log_viewer.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Include/help/en
|
||||
*/
|
||||
?>
|
||||
<h1>Visualización y búsqueda avanzadas</h1>
|
||||
<p>
|
||||
Se pueden realizar graficas extrayendo información
|
||||
de los logs, clasificando la información en base a modelos de captura de datos.
|
||||
</p>
|
||||
<p>
|
||||
Estos modelos de captura de datos son básicamente expresiones regulares e
|
||||
identificadores, que nos permitirán analizar los orígenes de datos y mostrarlos como un gráfico.
|
||||
</p>
|
||||
<p>
|
||||
Podemos seleccionar el modelo de captura.
|
||||
El modelo por defecto, Apache log model, ofrece la posibilidad de parsear logs de Apache
|
||||
en formato estándar (access_log), pudiendo extraer gráficas comparativas de tiempo de respuesta,
|
||||
agrupando por página visitada y código de respuesta.
|
||||
</p>
|
||||
<p>
|
||||
Al pulsar en el botón de editar editaremos el modelo de captura seleccionado.
|
||||
Con el botón de crear agregaremos un nuevo modelo de captura.
|
||||
En el formulario que aparece, podremos elegir:
|
||||
</p>
|
||||
<p><h4>Título</h4>
|
||||
Un nombre para el modelo de captura
|
||||
</p>
|
||||
<p><h4>Expresión regular</h4>
|
||||
Cada campo a extraer se identifica con la subexpresión entre los paréntesis (expresión a capturar).
|
||||
</p>
|
||||
<p><h4>Los campos</h4>
|
||||
En el orden en que los hemos capturado con la expresión regular.
|
||||
Los resultados se agruparán por la concatenación de los campos clave, que son aquellos
|
||||
cuyo nombre no esté entre guiones bajos:
|
||||
</p>
|
||||
<p>clave, _valor_</p>
|
||||
<p><em>Observación:</em> Si no especificamos un campo valor, será automáticamente el conteo de apariciones
|
||||
que coinciden con la expresión regular.</p>
|
||||
|
||||
<p><em>Observación 2:</em> Si especificamos una columna valor podremos elegir entre representar el valor acumulado
|
||||
(comportamiento por defecto) o marcar el checkbox para representar el promedio.</p>
|
||||
|
||||
<h3>Ejemplo</h3>
|
||||
<p>Si quisiéramos extraer entradas de un log con el siguiente formato:</p>
|
||||
<p><b>Sep 19 12:05:01 nova systemd: Starting Session 6132 of user root.</b></p>
|
||||
|
||||
<p>Para contar el número de veces que se ha iniciado sesión, agrupando por usuario, usaremos la expresion regular:<p>
|
||||
<p><b>Starting Session \d+ of user (.*?)\.</b></p>
|
||||
|
||||
<p>y de campo:</p>
|
||||
<p><b>username</b></p>
|
||||
|
||||
<p>Este modelo de captura nos devolverá una grafica con el número de inicios de sesión por usuario
|
||||
en el intervalo de tiempo que seleccionemos.</p>
|
@ -529,7 +529,7 @@ function module_changed_by_multiple_modules (event, id_module, selected) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
s = js_html_entity_decode(val);
|
||||
$('#agents')
|
||||
.append ($('<option></option>').html (s).attr ("value", val));
|
||||
.append ($('<option></option>').html (s).attr ("value", i));
|
||||
$('#agents').fadeIn ('normal');
|
||||
});
|
||||
|
||||
@ -1585,6 +1585,10 @@ function display_confirm_dialog (message, ok_text, cancel_text, ok_function) {
|
||||
clean_function();
|
||||
}
|
||||
|
||||
var buttons_obj = {};
|
||||
buttons_obj[cancel_text] = clean_function;
|
||||
buttons_obj[ok_text] = ok_function_clean;
|
||||
|
||||
// Display the dialog
|
||||
$("body").append('<div id="pandora_confirm_dialog_text"><h3>' + message + '</h3></div>');
|
||||
$("#pandora_confirm_dialog_text").dialog({
|
||||
@ -1598,10 +1602,7 @@ function display_confirm_dialog (message, ok_text, cancel_text, ok_function) {
|
||||
},
|
||||
closeOnEscape: true,
|
||||
modal: true,
|
||||
buttons: {
|
||||
Cancel: clean_function,
|
||||
"Confirm": ok_function_clean
|
||||
}
|
||||
buttons: buttons_obj
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ var TreeController = {
|
||||
}
|
||||
|
||||
container.append($group);
|
||||
|
||||
|
||||
_.each(elements, function(element) {
|
||||
element.jqObject = _processNode($group, element);
|
||||
});
|
||||
@ -279,14 +279,13 @@ var TreeController = {
|
||||
|
||||
// Load leaf
|
||||
function _processNode (container, element) {
|
||||
|
||||
// type, [id], [serverID], callback
|
||||
function _getTreeDetailData (type, id, serverID, callback) {
|
||||
var lastParam = arguments[arguments.length - 1];
|
||||
var callback;
|
||||
if (typeof lastParam === 'function')
|
||||
callback = lastParam;
|
||||
|
||||
|
||||
var serverID;
|
||||
if (arguments.length >= 4)
|
||||
serverID = arguments[2];
|
||||
@ -296,23 +295,23 @@ var TreeController = {
|
||||
var type;
|
||||
if (arguments.length >= 2)
|
||||
type = arguments[0];
|
||||
|
||||
|
||||
if (typeof type === 'undefined')
|
||||
throw new TypeError('Type required');
|
||||
if (typeof callback === 'undefined')
|
||||
throw new TypeError('Callback required');
|
||||
|
||||
|
||||
var postData = {
|
||||
page: controller.ajaxPage,
|
||||
getDetail: 1,
|
||||
type: type
|
||||
}
|
||||
|
||||
|
||||
if (typeof id !== 'undefined')
|
||||
postData.id = id;
|
||||
if (typeof serverID !== 'undefined')
|
||||
postData.serverID = serverID;
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: 'POST',
|
||||
@ -346,6 +345,36 @@ var TreeController = {
|
||||
$content.append(element.iconHTML + " ");
|
||||
}
|
||||
$content.append(element.name);
|
||||
|
||||
if(typeof element.edit != 'undefined'){
|
||||
var url_edit = controller.baseURL + "index.php?sec=gagente&sec2=godmode/groups/configure_group&tab=tree&id_group=" + element.id;
|
||||
var $updateicon = $('<img src="' + (controller.baseURL.length > 0 ? controller.baseURL : '')+ 'images/config.png" style="width:18px; vertical-align: middle;"/>')
|
||||
var $updatebtn = $('<a href = "' + url_edit + '"></a>')
|
||||
.append($updateicon);
|
||||
$content.append($updatebtn);
|
||||
}
|
||||
|
||||
if(typeof element.delete != 'undefined'){
|
||||
var url_delete = controller.baseURL + "index.php?sec=gagente&sec2=godmode/groups/group_list&tab=tree&delete_group=1&id_group=" + element.id;
|
||||
var $deleteBtn = $('<a><img src="' + (controller.baseURL.length > 0 ? controller.baseURL : '') +'images/cross.png" style="width:18px; vertical-align: middle; cursor: pointer;"/></a>');
|
||||
$deleteBtn.click(function (event){
|
||||
var ok_function = function(){
|
||||
window.location.replace(url_delete);
|
||||
};
|
||||
display_confirm_dialog(
|
||||
element.delete.messages.messg,
|
||||
element.delete.messages.confirm,
|
||||
element.delete.messages.cancel,
|
||||
ok_function
|
||||
)
|
||||
});
|
||||
$content.append($deleteBtn);
|
||||
}
|
||||
|
||||
if(typeof element.alerts != 'undefined'){
|
||||
$content.append(element.alerts);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'agent':
|
||||
// Is quiet
|
||||
@ -583,95 +612,99 @@ var TreeController = {
|
||||
if (typeof(public_user) === 'undefined') public_user = 0;
|
||||
|
||||
if (typeof element.searchChildren != 'undefined' && element.searchChildren) {
|
||||
$node
|
||||
.removeClass("leaf-empty")
|
||||
.addClass("leaf-closed");
|
||||
if(element.rootType == "group_edition"
|
||||
&& typeof element.children == 'undefined'){
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
else{
|
||||
$node
|
||||
.removeClass("leaf-empty")
|
||||
.addClass("leaf-closed");
|
||||
$leafIcon.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$leafIcon.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!$node.hasClass("leaf-loading") && !$node.hasClass("children-loaded") && !$node.hasClass("leaf-empty")) {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.removeClass("leaf-error")
|
||||
.addClass("leaf-loading");
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: controller.ajaxPage,
|
||||
getChildren: 1,
|
||||
id: element.id,
|
||||
type: element.type,
|
||||
rootID: element.rootID,
|
||||
serverID: element.serverID,
|
||||
rootType: element.rootType,
|
||||
filter: controller.filter,
|
||||
hash: public_hash,
|
||||
id_user: public_user
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$node.removeClass("leaf-loading");
|
||||
$node.addClass("children-loaded");
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
var $group = $node.children("ul.tree-group");
|
||||
|
||||
if ((typeof data.tree != 'undefined' && data.tree.length > 0) || $group.length > 0) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
if ($group.length <= 0) {
|
||||
$group = $("<ul></ul>");
|
||||
$group
|
||||
.addClass("tree-group")
|
||||
.hide();
|
||||
$node.append($group);
|
||||
}
|
||||
|
||||
_.each(data.tree, function(element) {
|
||||
element.jqObject = _processNode($group, element);
|
||||
});
|
||||
|
||||
$group.slideDown();
|
||||
|
||||
$node.data('children', $group);
|
||||
|
||||
// Add again the hover event to the 'force_callback' elements
|
||||
forced_title_callback();
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (! $node.hasClass("leaf-empty")) {
|
||||
if ($node.hasClass("leaf-open")) {
|
||||
$node
|
||||
.removeClass("leaf-open")
|
||||
.addClass("leaf-closed")
|
||||
.data('children')
|
||||
.slideUp();
|
||||
}
|
||||
else {
|
||||
if (!$node.hasClass("leaf-loading") && !$node.hasClass("children-loaded") && !$node.hasClass("leaf-empty")) {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.addClass("leaf-open")
|
||||
.data('children')
|
||||
.slideDown();
|
||||
.removeClass("leaf-error")
|
||||
.addClass("leaf-loading");
|
||||
|
||||
$.ajax({
|
||||
url: controller.ajaxURL,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
page: controller.ajaxPage,
|
||||
getChildren: 1,
|
||||
id: element.id,
|
||||
type: element.type,
|
||||
rootID: element.rootID,
|
||||
serverID: element.serverID,
|
||||
rootType: element.rootType,
|
||||
filter: controller.filter,
|
||||
hash: public_hash,
|
||||
id_user: public_user
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$node.removeClass("leaf-loading");
|
||||
$node.addClass("children-loaded");
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
var $group = $node.children("ul.tree-group");
|
||||
if ((typeof data.tree != 'undefined' && data.tree.length > 0) || $group.length > 0) {
|
||||
$node.addClass("leaf-open");
|
||||
|
||||
if ($group.length <= 0) {
|
||||
$group = $("<ul></ul>");
|
||||
$group
|
||||
.addClass("tree-group")
|
||||
.hide();
|
||||
$node.append($group);
|
||||
}
|
||||
|
||||
_.each(data.tree, function(element) {
|
||||
element.jqObject = _processNode($group, element);
|
||||
});
|
||||
|
||||
$group.slideDown();
|
||||
|
||||
$node.data('children', $group);
|
||||
|
||||
// Add again the hover event to the 'force_callback' elements
|
||||
forced_title_callback();
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-empty");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
$node.addClass("leaf-error");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
else if (! $node.hasClass("leaf-empty")) {
|
||||
if ($node.hasClass("leaf-open")) {
|
||||
$node
|
||||
.removeClass("leaf-open")
|
||||
.addClass("leaf-closed")
|
||||
.data('children')
|
||||
.slideUp();
|
||||
}
|
||||
else {
|
||||
$node
|
||||
.removeClass("leaf-closed")
|
||||
.addClass("leaf-open")
|
||||
.data('children')
|
||||
.slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return $node;
|
||||
|
@ -817,7 +817,7 @@ body .ui-tooltip {
|
||||
}
|
||||
.ui-widget-content {
|
||||
border: 1px solid #aaaaaa;
|
||||
background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
|
||||
background: #e8e8e8 url(images/ui-bg_flat_75_e8e8e8_40x100.png) 50% 50% repeat-x;
|
||||
color: #222222;
|
||||
}
|
||||
.ui-widget-content a {
|
||||
|
@ -3709,6 +3709,57 @@ div.simple_value > a > span.text p
|
||||
color:white;
|
||||
}
|
||||
|
||||
.modaldeletebutton{
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
cursor:pointer;
|
||||
text-align:center;
|
||||
margin-left:45px;
|
||||
float:left;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
margin-bottom:30px;
|
||||
border-radius: 3px;width:90px;height:30px;background-color:white;border: 1px solid #FA5858;
|
||||
}
|
||||
|
||||
.modaldeletebuttontext{
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
color:#FA5858;font-family:Nunito;font-size:10pt;position:relative;top:6px;
|
||||
}
|
||||
|
||||
.modaldeletebutton:hover .modaldeletebuttontext {
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
color:white;
|
||||
}
|
||||
|
||||
.modaldeletebutton:hover {
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
transition-timing-function: ease-out;
|
||||
-webkit-transition-property: background-color, color;
|
||||
-webkit-transition-duration: 1s;
|
||||
-o-transition-property: background-color, color;
|
||||
-o-transition-duration: 1s;
|
||||
background-color:#FA5858;
|
||||
}
|
||||
|
||||
.modalgobutton{
|
||||
transition-property: background-color, color;
|
||||
transition-duration: 1s;
|
||||
@ -4691,5 +4742,25 @@ tr:last-child > td > a.down_arrow, tr:first-child > td > a.up_arrow {
|
||||
text-align: left;
|
||||
display: block;
|
||||
vertical-align: middle;
|
||||
line-height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.tooltip_counters h3{
|
||||
font-size: 12pt;
|
||||
padding-bottom: 10px !important;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tooltip_counters li{
|
||||
font-size: 8pt;
|
||||
margin: 2px;
|
||||
margin-left: 5px;
|
||||
|
||||
}
|
||||
.tooltip_counters li div{
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 3px;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
@ -359,7 +359,7 @@ if (! isset ($config['id_user'])) {
|
||||
|
||||
if ($blocked) {
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Password expired", "Password expired: ".$nick, $nick);
|
||||
db_pandora_audit("Password expired", "Password expired: ".io_safe_output($nick), io_safe_output($nick));
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
@ -382,7 +382,7 @@ if (! isset ($config['id_user'])) {
|
||||
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Password expired",
|
||||
"Password expired: " . $nick, $nick);
|
||||
"Password expired: " . io_safe_output($nick), $nick);
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
@ -539,20 +539,20 @@ if (! isset ($config['id_user'])) {
|
||||
if ((!is_user_admin($nick) || $config['enable_pass_policy_admin']) && file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
$blocked = login_check_blocked($nick);
|
||||
}
|
||||
|
||||
$nick_usable = io_safe_output($nick);
|
||||
if (!$blocked) {
|
||||
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
|
||||
login_check_failed($nick); //Checks failed attempts
|
||||
}
|
||||
$login_failed = true;
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick);
|
||||
db_pandora_audit("Logon Failed", "Invalid login: ".$nick_usable, $nick_usable);
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
else {
|
||||
require_once ('general/login_page.php');
|
||||
db_pandora_audit("Logon Failed", "Invalid login: ".$nick, $nick);
|
||||
db_pandora_audit("Logon Failed", "Invalid login: ".$nick_usable, $nick_usable);
|
||||
while (@ob_end_flush ());
|
||||
exit ("</html>");
|
||||
}
|
||||
|
@ -71,7 +71,7 @@
|
||||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.727';
|
||||
$build = '180913';
|
||||
$build = '181001';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
@ -36,7 +36,6 @@ $agentId = (int)get_parameter('id_agente');
|
||||
$id_agente = $agentId;
|
||||
$agent_name = agents_get_name($id_agente);
|
||||
$agent_alias = agents_get_alias($id_agente);
|
||||
$agentData = gis_get_data_last_position_agent($id_agente);
|
||||
|
||||
//Avoid the agents with characters that fails the div.
|
||||
$agent_name_original = $agent_name;
|
||||
@ -83,35 +82,22 @@ switch ($config["dbtype"]) {
|
||||
gis_activate_ajax_refresh(null, $timestampLastOperation);
|
||||
gis_activate_select_control();
|
||||
|
||||
if ($agentData === false) {
|
||||
ui_print_info_message (
|
||||
__("There is no GIS data for this agent, so it's positioned in default position of map.") );
|
||||
}
|
||||
|
||||
$dataLastPosition = gis_get_data_last_position_agent($agentId);
|
||||
if ($dataLastPosition !== false) {
|
||||
echo "<b>" . __("Last position in ") .
|
||||
$dataLastPosition['start_timestamp'] . ":</b> " .
|
||||
$dataLastPosition['stored_longitude'] . ", " . $dataLastPosition['stored_latitude'] . ", " . $dataLastPosition['stored_altitude'];
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
echo "<form class='' action='index.php?" . $url . "' method='POST'>";
|
||||
echo "<table width=100% class='databox filters'>";
|
||||
echo "<tr><td>" . __("Period to show data as path") . ": ";
|
||||
echo "<tr><td>" . __("Period to show data as path");
|
||||
echo "<td>";
|
||||
html_print_extended_select_for_time ('period', $period, '', '', '0', 10);
|
||||
echo "<td>";
|
||||
html_print_submit_button(__('Refresh path'), 'refresh', false, 'class = "sub upd" style="margin-top:0px"');
|
||||
echo "</table></form>";
|
||||
|
||||
echo "<h4>" . __("Positional data from the last") . " " . human_time_description_raw ($period) ."</h4>";
|
||||
/* Get the total number of Elements for the pagination */
|
||||
$sqlCount = sprintf ("SELECT COUNT(*)
|
||||
FROM tgis_data_history
|
||||
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
|
||||
ORDER BY end_timestamp DESC", $agentId, get_system_time () - $period);
|
||||
$countData = db_get_value_sql($sqlCount);
|
||||
|
||||
$countData = (int) db_get_value_sql($sqlCount);
|
||||
|
||||
/* Get the elements to present in this page */
|
||||
switch ($config["dbtype"]) {
|
||||
@ -141,9 +127,7 @@ switch ($config["dbtype"]) {
|
||||
|
||||
$result = db_get_all_rows_sql ($sql, true);
|
||||
|
||||
|
||||
if ($result === false) {
|
||||
|
||||
$sql2 = sprintf ("
|
||||
SELECT current_longitude AS longitude, current_latitude AS latitude, current_altitude AS altitude,
|
||||
start_timestamp, description, number_of_packages, manual_placement
|
||||
@ -163,10 +147,11 @@ if ($result === false) {
|
||||
}
|
||||
|
||||
if ($result !== false) {
|
||||
if(!$countData){
|
||||
$countData = 1;
|
||||
}
|
||||
ui_pagination ($countData, false) ;
|
||||
echo "<h4>" . __("Positional data from the last") . " " . human_time_description_raw($period) ."</h4>";
|
||||
|
||||
if ($countData > 0) ui_pagination($countData, false);
|
||||
|
||||
$table = new StdClass();
|
||||
$table->data = array();
|
||||
foreach ($result as $key => $row) {
|
||||
$distance = 0;
|
||||
@ -187,9 +172,13 @@ if ($result !== false) {
|
||||
$rowdata = array(
|
||||
$row['longitude'],
|
||||
$row['latitude'],
|
||||
$row['altitude'],
|
||||
$row['start_timestamp'],
|
||||
$row['end_timestamp'],
|
||||
(int) $row['altitude'] . " m",
|
||||
is_numeric($row['start_timestamp'])
|
||||
? date($config["date_format"], $row['start_timestamp'])
|
||||
: date_w_fixed_tz($row['start_timestamp']),
|
||||
is_numeric($row['end_timestamp'])
|
||||
? date($config["date_format"], $row['end_timestamp'])
|
||||
: date_w_fixed_tz($row['end_timestamp']),
|
||||
$row['description'],
|
||||
sprintf(__('%s Km'), $distance),
|
||||
$row['number_of_packages'],
|
||||
@ -206,13 +195,12 @@ if ($result !== false) {
|
||||
__('Distance'),
|
||||
__("# of Packages"),
|
||||
__("Manual placement"));
|
||||
$table->class = 'position_data_table';
|
||||
$table->class = 'databox data';
|
||||
$table->id = $agent_name.'_position_data_table';
|
||||
$table->title = $agent_alias . " " . __("positional data");
|
||||
$table->titlestyle = "background-color:#799E48;";
|
||||
html_print_table($table); unset($table);
|
||||
$table->width = '100%';
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
|
||||
ui_pagination ($countData, false) ;
|
||||
echo "<h3>" . __('Total') . ' ' . $countData . ' ' . __('Data') . "</h3>";
|
||||
if ($countData > 0) ui_pagination($countData, false);
|
||||
}
|
||||
?>
|
||||
|
@ -207,7 +207,7 @@ if (is_ajax ()) {
|
||||
$groups = users_get_groups ($config["id_user"], "AW", false);
|
||||
$group_id_list = ($groups ? join(",",array_keys($groups)):"0");
|
||||
|
||||
$sql = 'SELECT DISTINCT(t1.alias) as name
|
||||
$sql = 'SELECT DISTINCT(t1.nombre) as name, t1.alias
|
||||
FROM tagente t1, tagente_modulo t2
|
||||
WHERE t1.id_agente = t2.id_agente
|
||||
AND t1.id_grupo IN (' . $group_id_list .')
|
||||
@ -254,10 +254,9 @@ if (is_ajax ()) {
|
||||
if ($nameAgents == false)
|
||||
$nameAgents = array();
|
||||
|
||||
foreach ($nameAgents as $nameAgent) {
|
||||
$names[] = io_safe_output($nameAgent['name']);
|
||||
}
|
||||
|
||||
foreach ($nameAgents as $nameAgent)
|
||||
$names[$nameAgent['name']] = io_safe_output($nameAgent['alias']);
|
||||
|
||||
echo json_encode($names);
|
||||
return;
|
||||
}
|
||||
|
@ -108,6 +108,9 @@ $layers = gis_get_layers($idMap);
|
||||
|
||||
// Render map
|
||||
|
||||
$has_management_acl = check_acl($config["id_user"], $map['group_id'], "MW")
|
||||
|| check_acl ($config["id_user"], $map['group_id'], "MM");
|
||||
|
||||
$buttons = array();
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
@ -119,22 +122,14 @@ else {
|
||||
html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . "</a>";
|
||||
}
|
||||
|
||||
if (check_acl ($config["id_user"], $map['group_id'], "MW") || check_acl ($config["id_user"], $map['group_id'], "MM")) {
|
||||
$buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
|
||||
$buttons['setup']['godmode'] = 1;
|
||||
|
||||
|
||||
if ($has_management_acl) {
|
||||
$hash = md5($config["dbpass"] . $idMap . $config["id_user"]);
|
||||
|
||||
$buttons['public_link']['text'] = '<a href="' .
|
||||
ui_get_full_url('operation/gis_maps/public_console.php?hash=' .$hash .
|
||||
'&map_id=' . $idMap . '&id_user=' . $config["id_user"]) . '" target="_blank">'.
|
||||
html_print_image ("images/camera_mc.png", true, array ("title" => __('Show link to public Visual Console'))).'</a>';
|
||||
}
|
||||
|
||||
$buttonsString = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3">' .
|
||||
html_print_image("images/bricks.png", true, array("class" => "top", "border" => '0')) . ' Agent - test_gis1</a></li></ul></div><div id="menu_tab"><ul class="mn"><li class="nomn"><a href="index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente=3">' . html_print_image("images/setup.png", true, array("class" => "top", "title" => "Manage", "border" => "0", "width" => "16", "title" => "Manage")) . ' </a></li><li class="nomn_high"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3">' . html_print_image("images/monitor.png", true, array("class" => "top", "title" => "Main", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3&tab=data">' . html_print_image("images/lightbulb.png", true, array("class" => "top", "title" => "Data", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=3&tab=alert">' . html_print_image("images/bell.png", true, array("class" => "top", "title" => "Alerts", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=3">' . html_print_image("images/images.png", true, array("class" => "top", "title" => "S.L.A.", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=2">' . html_print_image("images/agents_group.png", true, array("class" => "top", "title" => "Group", "border" => "0")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=inventory&id_agente=3">' . html_print_image("images/page_white_text.png", true, array("class" => "top", "title" => "Inventory", "border" => "0", "width" => "16")) . ' </a></li><li class="nomn"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=gis&id_agente=3">' . html_print_image("images/world.png", array("class" => "top", "title" => "GIS data", "border" => "0")) . ' </a>';
|
||||
|
||||
$times = array(
|
||||
5 => __('5 seconds'),
|
||||
10 => __('10 seconds'),
|
||||
@ -144,19 +139,31 @@ $times = array(
|
||||
SECONDS_5MINUTES => __('5 minutes'),
|
||||
SECONDS_10MINUTES => __('10 minutes'),
|
||||
SECONDS_1HOUR => __('1 hour'),
|
||||
SECONDS_2HOUR => __('2 hours'));
|
||||
SECONDS_2HOUR => __('2 hours')
|
||||
);
|
||||
|
||||
$buttons[]['text'] = ' ' . __('Refresh: ') . html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false) . " ";
|
||||
$buttons[]['text'] = "<div style='margin-top: 6px;'>"
|
||||
.__('Refresh') . ": "
|
||||
. html_print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false)
|
||||
. "</div>";
|
||||
|
||||
$status = array(
|
||||
'all' => __('All'),
|
||||
'all' => __('None'),
|
||||
'bad' => __('Critical'),
|
||||
'warning' => __('Warning'),
|
||||
'ok' => __('Ok'),
|
||||
'default' => __('Other'));
|
||||
'default' => __('Other')
|
||||
);
|
||||
|
||||
$buttons[]['text'] = ' ' . __('Show agents by state: ') .
|
||||
html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false) . " ";
|
||||
$buttons[]['text'] = "<div style='margin-top: 6px;'>"
|
||||
. __('Filter by status') . ": "
|
||||
. html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false)
|
||||
. "</div>";
|
||||
|
||||
if ($has_management_acl) {
|
||||
$buttons['setup']['text'] = '<a href="index.php?sec=godgismaps&sec2=godmode/gis_maps/configure_gis_map&action=edit_map&map_id='. $idMap.'">'.html_print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
|
||||
$buttons['setup']['godmode'] = 1;
|
||||
}
|
||||
|
||||
ui_print_page_header(__('Map') . " » " . __('Map') . " " . $map['map_name'],
|
||||
"images/op_gis.png", false, "", false, $buttons);
|
||||
|
@ -194,6 +194,7 @@ elseif (isset ($_GET["insert_form"])) {
|
||||
$titulo = ui_print_truncate_text(events_get_description ($event), 'description', false, true, false);
|
||||
$id_grupo = events_get_group ($event);
|
||||
$origen = "Pandora FMS Event";
|
||||
$id_agent = db_get_value("id_agente","tevento","id_evento",$event);
|
||||
unset ($event);
|
||||
}
|
||||
$prioridad = 0;
|
||||
|
@ -103,22 +103,22 @@ if ($read_message) {
|
||||
//Start the message much like an e-mail reply
|
||||
$new_msg = "\n\n\nOn ".date ($config["date_format"], $message["timestamp"]).' '.$user_name.' '.__('wrote').":\n\n".$message["mensaje"];
|
||||
|
||||
echo '<form method="post" action="index.php?sec=message_list&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id.'">';
|
||||
echo '<form id="delete_message" method="post" action="index.php?sec=message_list&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id.'">';
|
||||
html_print_table($table);
|
||||
echo "<div style=' text-align: right; width:" . $table->width . "'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
echo '<form method="post" action="index.php?sec=message_list&sec2=operation/messages/message_edit&new_msg=1&reply=1">';
|
||||
echo '<form id="reply_message" method="post" action="index.php?sec=message_list&sec2=operation/messages/message_edit&new_msg=1&reply=1">';
|
||||
html_print_input_hidden ("dst_user", $message["id_usuario_origen"]);
|
||||
html_print_input_hidden ("subject", $new_subj);
|
||||
html_print_input_hidden ("message", $new_msg);
|
||||
html_print_input_hidden ("orig_user", $message["id_usuario_destino"]);
|
||||
echo "<div style='text-align: right; width:" . $table->width . "'>";
|
||||
html_print_submit_button (__('Reply'), 'reply', false, 'class="sub next"');
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
echo "<div class= 'action-buttons' style=' width:" . $table->width . "'>";
|
||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'form="delete_message" class="sub delete"');
|
||||
echo " ";
|
||||
html_print_submit_button (__('Reply'), 'reply', false, 'form="reply_message" class="sub next"');
|
||||
echo "</div>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ else {
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->align = array ();
|
||||
$table->headstyle = array ();
|
||||
for ($i=0; $i < 9; $i++) {
|
||||
$table->headstyle[$i] = 'text-align: left;';
|
||||
}
|
||||
|
||||
$table->head[0] = __('Force');
|
||||
$table->align[0] = "left";
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.727
|
||||
%define release 1
|
||||
%define release 181001
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.727
|
||||
%define release 1
|
||||
%define release 181001
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
@ -775,6 +775,13 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
|
||||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`snmp_enabled` tinyint(1) unsigned default '0',
|
||||
`vlan_enabled` tinyint(1) unsigned default '0',
|
||||
`snmp_version` varchar(5) NOT NULL default '1',
|
||||
`snmp_auth_user` varchar(255) NOT NULL default '',
|
||||
`snmp_auth_pass` varchar(255) NOT NULL default '',
|
||||
`snmp_auth_method` varchar(25) NOT NULL default '',
|
||||
`snmp_privacy_method` varchar(25) NOT NULL default '',
|
||||
`snmp_privacy_pass` varchar(255) NOT NULL default '',
|
||||
`snmp_security_level` varchar(25) NOT NULL default '',
|
||||
PRIMARY KEY (`id_rt`),
|
||||
KEY `recon_task_daemon` (`id_recon_server`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@ -2365,6 +2372,7 @@ CREATE TABLE IF NOT EXISTS `tpolicy_modules_inventory` (
|
||||
`username` varchar(100) default '',
|
||||
`password` varchar(100) default '',
|
||||
`pending_delete` tinyint(1) default '0',
|
||||
`custom_fields` MEDIUMBLOB NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_policy`) REFERENCES tpolicies(`id`)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||
@ -3330,3 +3338,15 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
|
||||
PRIMARY KEY(`id`),
|
||||
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlog_graph_models`
|
||||
-- ---------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tlog_graph_models` (
|
||||
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`title` TEXT NOT NULL,
|
||||
`regexp` TEXT NOT NULL,
|
||||
`fields` TEXT NOT NULL,
|
||||
`average` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
@ -109,7 +109,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 19),
|
||||
('MR', 20),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '727'),
|
||||
@ -1260,3 +1260,10 @@ INSERT INTO `tprofile_view` (`id_profile`, `sec`, `sec2`, `sec3`) VALUES (5, '*'
|
||||
-- Dumping data for table `tcontainer`
|
||||
--
|
||||
INSERT INTO `tcontainer` SET `name` = 'Default graph container';
|
||||
|
||||
--
|
||||
-- Dumping data for table `tlog_graph_models`
|
||||
--
|
||||
INSERT INTO tlog_graph_models VALUES (1, 'Apache log model',
|
||||
'^.*?\s+.*".*?\s(\/.*?)\?.*1.1"\s+(.*?)\s+(.*?)\s+',
|
||||
'pagina, html_err_code, _tiempo_', 1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
package: pandorafms-server
|
||||
Version: 7.0NG.727
|
||||
Version: 7.0NG.727-181001
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
@ -14,7 +14,7 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.727"
|
||||
pandora_version="7.0NG.727-181001"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.727";
|
||||
my $pandora_build = "180913";
|
||||
my $pandora_build = "181001";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
@ -158,7 +158,7 @@ require Exporter;
|
||||
our @ISA = ("Exporter");
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
|
||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||
our @EXPORT = qw(
|
||||
our @EXPORT = qw(
|
||||
pandora_add_agent_address
|
||||
pandora_audit
|
||||
pandora_create_agent
|
||||
@ -234,6 +234,7 @@ our @EXPORT = qw(
|
||||
pandora_self_monitoring
|
||||
pandora_process_policy_queue
|
||||
subst_alert_macros
|
||||
locate_agent
|
||||
get_agent
|
||||
get_agent_from_alias
|
||||
get_agent_from_addr
|
||||
@ -259,6 +260,32 @@ our $EventStormProtection :shared = 0;
|
||||
# Current master server
|
||||
my $Master :shared = 0;
|
||||
|
||||
##########################################################################
|
||||
# Return the agent given the agent name or alias or address.
|
||||
##########################################################################
|
||||
sub locate_agent {
|
||||
my ($pa_config, $dbh, $field) = @_;
|
||||
|
||||
if (is_metaconsole($pa_config)) {
|
||||
# Locate agent first in tmetaconsole_agent
|
||||
return undef if (! defined ($field) || $field eq '');
|
||||
|
||||
my $rs = enterprise_hook('get_metaconsole_agent_from_alias', [$dbh, $field]);
|
||||
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
|
||||
|
||||
$rs = enterprise_hook('get_metaconsole_agent_from_addr', [$dbh, $field]);
|
||||
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
|
||||
|
||||
$rs = enterprise_hook('get_metaconsole_agent_from_name', [$dbh, $field]);
|
||||
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
|
||||
|
||||
} else {
|
||||
return get_agent($dbh, $field);
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Return the agent given the agent name or alias or address.
|
||||
@ -1887,7 +1914,7 @@ sub pandora_planned_downtime_unset_quiet_elements($$$) {
|
||||
########################################################################
|
||||
=head2 C<< pandora_planned_downtime_quiet_once_stop (I<$pa_config>, I<$dbh>) >>
|
||||
|
||||
Start the planned downtime, the once type.
|
||||
Stop the planned downtime, the once type.
|
||||
|
||||
=cut
|
||||
########################################################################
|
||||
@ -1895,7 +1922,7 @@ sub pandora_planned_downtime_quiet_once_stop($$) {
|
||||
my ($pa_config, $dbh) = @_;
|
||||
my $utimestamp = time();
|
||||
|
||||
# Stop pending downtimes
|
||||
# Stop executed downtimes
|
||||
my @downtimes = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime
|
||||
WHERE type_downtime = ?
|
||||
@ -1996,8 +2023,8 @@ sub pandora_planned_downtime_monthly_start($$) {
|
||||
AND type_execution <> ' . $RDBMS_QUOTE_STRING . 'once' . $RDBMS_QUOTE_STRING . '
|
||||
AND ((periodically_day_from = ? AND periodically_time_from <= ?) OR (periodically_day_from < ?))
|
||||
AND ((periodically_day_to = ? AND periodically_time_to >= ?) OR (periodically_day_to > ?))',
|
||||
'monthly', 'number_day_month',
|
||||
$time, $number_day_month,
|
||||
'monthly',
|
||||
$number_day_month, $time, $number_day_month,
|
||||
$number_day_month, $time, $number_day_month);
|
||||
|
||||
foreach my $downtime (@downtimes) {
|
||||
@ -2034,7 +2061,7 @@ sub pandora_planned_downtime_monthly_start($$) {
|
||||
########################################################################
|
||||
=head2 C<< pandora_planned_downtime_monthly_stop (I<$pa_config>, I<$dbh>) >>
|
||||
|
||||
Start the planned downtime, the montly type.
|
||||
Stop the planned downtime, the monthly type.
|
||||
|
||||
=cut
|
||||
########################################################################
|
||||
@ -2065,7 +2092,7 @@ sub pandora_planned_downtime_monthly_stop($$) {
|
||||
$number_day_month = 31;
|
||||
}
|
||||
|
||||
# Start pending downtimes
|
||||
# Stop executed downtimes
|
||||
my @downtimes = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime
|
||||
WHERE type_periodicity = ?
|
||||
@ -2111,7 +2138,7 @@ sub pandora_planned_downtime_monthly_stop($$) {
|
||||
########################################################################
|
||||
=head2 C<< pandora_planned_downtime_weekly_start (I<$pa_config>, I<$dbh>) >>
|
||||
|
||||
Start the planned downtime, the montly type.
|
||||
Start the planned downtime, the weekly type.
|
||||
|
||||
=cut
|
||||
########################################################################
|
||||
@ -2220,7 +2247,7 @@ sub pandora_planned_downtime_weekly_start($$) {
|
||||
########################################################################
|
||||
=head2 C<< pandora_planned_downtime_weekly_stop (I<$pa_config>, I<$dbh>) >>
|
||||
|
||||
Stop the planned downtime, the montly type.
|
||||
Stop the planned downtime, the weekly type.
|
||||
|
||||
=cut
|
||||
########################################################################
|
||||
@ -2236,7 +2263,7 @@ sub pandora_planned_downtime_weekly_stop($$) {
|
||||
my $found = 0;
|
||||
my $stop_downtime = 0;
|
||||
|
||||
# Start pending downtimes
|
||||
# Stop executed downtimes
|
||||
my @downtimes = get_db_rows($dbh, 'SELECT *
|
||||
FROM tplanned_downtime
|
||||
WHERE type_periodicity = ?
|
||||
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
||||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.727";
|
||||
my $pandora_build = "180913";
|
||||
my $pandora_build = "181001";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
@ -96,6 +96,9 @@ sub new {
|
||||
# Working SNMP community for each device.
|
||||
community_cache => {},
|
||||
|
||||
# Cache of deviced discovered.
|
||||
dicovered_cache => {},
|
||||
|
||||
# Connections between devices.
|
||||
connections => {},
|
||||
|
||||
@ -147,8 +150,15 @@ sub new {
|
||||
recon_timing_template => 3,
|
||||
recon_ports => '',
|
||||
resolve_names => 0,
|
||||
snmp_auth_user => '',
|
||||
snmp_auth_pass => '',
|
||||
snmp_auth_method => '',
|
||||
snmp_checks => 2,
|
||||
snmp_privacy_method => '',
|
||||
snmp_privacy_pass => '',
|
||||
snmp_security_level => '',
|
||||
snmp_timeout => 2,
|
||||
snmp_version => 1,
|
||||
subnets => [],
|
||||
@_,
|
||||
|
||||
@ -157,8 +167,66 @@ sub new {
|
||||
# Perform some sanity checks.
|
||||
die("No subnet was specified.") unless defined($self->{'subnets'});
|
||||
|
||||
# Disable SNMP scans if no community was given.
|
||||
$self->{'snmp_enabled'} = 0 if (scalar(@{$self->{'communities'}}) == 0);
|
||||
# Check SNMP params id SNMP is enabled
|
||||
if ($self->{'snmp_enabled'}) {
|
||||
# Check SNMP version
|
||||
if ($self->{'snmp_version'} ne '1' && $self->{'snmp_version'} ne '2'
|
||||
&& $self->{'snmp_version'} ne '2c' && $self->{'snmp_version'} ne '3'
|
||||
) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "SNMP version " . $self->{'snmp_version'} . " not supported (only 1, 2, 2c and 3).", 5);
|
||||
}
|
||||
|
||||
# Check the version 3 parameters
|
||||
if ($self->{'snmp_version'} eq '3') {
|
||||
# Fixed some vars
|
||||
$self->{'communities'} = [];
|
||||
|
||||
# SNMP v3 checks
|
||||
if (
|
||||
$self->{'snmp_security_level'} ne 'noAuthNoPriv' &&
|
||||
$self->{'snmp_security_level'} ne 'authNoPriv' &&
|
||||
$self->{'snmp_security_level'} ne 'authPriv'
|
||||
) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "Invalid SNMP security level " . $self->{'snmp_security_level'} . ".", 5);
|
||||
}
|
||||
if ($self->{'snmp_privacy_method'} ne 'DES' && $self->{'snmp_privacy_method'} ne 'AES') {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "Invalid SNMP privacy method " . $self->{'snmp_privacy_method'} . ".", 5);
|
||||
}
|
||||
if ($self->{'snmp_auth_method'} ne 'MD5' && $self->{'snmp_auth_method'} ne 'SHA') {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "Invalid SNMP authentication method " . $self->{'snmp_auth_method'} . ".", 5);
|
||||
}
|
||||
} else {
|
||||
# Fixed some vars
|
||||
$self->{'snmp_auth_user'} = '';
|
||||
$self->{'snmp_auth_pass'} = '';
|
||||
$self->{'snmp_auth_method'} = '';
|
||||
$self->{'snmp_privacy_method'} = '';
|
||||
$self->{'snmp_privacy_pass'} = '';
|
||||
$self->{'snmp_security_level'} = '';
|
||||
|
||||
# Disable SNMP scans if no community was given.
|
||||
if (scalar(@{$self->{'communities'}}) == 0) {
|
||||
$self->{'snmp_enabled'} = 0;
|
||||
$self->call('message', "There is not any SNMP community configured.", 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Remove all snmp related values if disabled
|
||||
if (!$self->{'snmp_enabled'}) {
|
||||
$self->{'communities'} = [];
|
||||
$self->{'snmp_auth_user'} = '';
|
||||
$self->{'snmp_auth_pass'} = '';
|
||||
$self->{'snmp_auth_method'} = '';
|
||||
$self->{'snmp_privacy_method'} = '';
|
||||
$self->{'snmp_privacy_pass'} = '';
|
||||
$self->{'snmp_security_level'} = '';
|
||||
}
|
||||
|
||||
return bless($self, $class);
|
||||
}
|
||||
@ -199,7 +267,7 @@ sub aft_connectivity($$) {
|
||||
my ($self, $switch) = @_;
|
||||
my (%mac_temp, @aft_temp);
|
||||
|
||||
return unless defined($self->get_community($switch));
|
||||
return unless ($self->is_snmp_discovered($switch));
|
||||
|
||||
$self->enable_vlan_cache();
|
||||
|
||||
@ -397,8 +465,7 @@ sub find_ifaces($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# Does it respond to SNMP?
|
||||
my $community = $self->get_community($device);
|
||||
return unless defined($community);
|
||||
return unless ($self->is_snmp_discovered($device));
|
||||
|
||||
my @output = $self->snmp_get_value_array($device, $PandoraFMS::Recon::Base::IFINDEX);
|
||||
foreach my $if_index (@output) {
|
||||
@ -476,11 +543,13 @@ sub get_device($$) {
|
||||
sub get_community($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
return '' if ($self->{'snmp_version'} eq "3");
|
||||
|
||||
if (defined($self->{'community_cache'}->{$device})) {
|
||||
return $self->{'community_cache'}->{$device};
|
||||
}
|
||||
|
||||
return undef;
|
||||
return '';
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
@ -787,6 +856,9 @@ sub get_visited_devices($) {
|
||||
sub get_vlans($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# Disabled in verison 3
|
||||
return () if ($self->{'snmp_version'} eq "3");
|
||||
|
||||
# Is the VLAN cache disabled?
|
||||
return () unless ($self->{'__vlan_cache_enabled__'} == 1);
|
||||
|
||||
@ -945,6 +1017,17 @@ sub is_visited($$) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Returns 1 if the given device has responded successfully to a snmp request
|
||||
# Returns 0 otherwise.
|
||||
########################################################################################
|
||||
sub is_snmp_discovered($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# Check if device is into discovered cache
|
||||
return (defined($self->{'discovered_cache'}->{$device})) ? 1 : 0;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Mark the given devices as connected to each other on the given interfaces.
|
||||
########################################################################################
|
||||
@ -999,23 +1082,46 @@ sub mark_visited($$) {
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Looks for a working SNMP community for the given device. Returns 1 if one is
|
||||
# found, 0 otherwise. Updates the SNMP community cache.
|
||||
# Mark the given device as snmp discovered.
|
||||
########################################################################################
|
||||
sub mark_discovered($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
$self->{'discovered_cache'}->{$device} = 1;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Validate the configuration for the given device.
|
||||
# Returns 1 if successfull snmp contact, 0 otherwise.
|
||||
# Updates the SNMP community cache on v1, v2 and v2c.
|
||||
########################################################################################
|
||||
sub snmp_responds($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
# We already have a working SNMP community for this device.
|
||||
return 1 if (defined($self->get_community($device)));
|
||||
return 1 if($self->is_snmp_discovered($device));
|
||||
|
||||
return ($self->{'snmp_version'} eq "3")
|
||||
? $self->snmp_responds_v3($device)
|
||||
: $self->snmp_responds_v122c($device);
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Looks for a working SNMP community for the given device. Returns 1 if one is
|
||||
# found, 0 otherwise. Updates the SNMP community cache.
|
||||
########################################################################################
|
||||
sub snmp_responds_v122c($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
foreach my $community (@{$self->{'communities'}}) {
|
||||
|
||||
# Clean blanks.
|
||||
$community =~ s/\s+//g;
|
||||
|
||||
`snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community $device .0 2>/dev/null`;
|
||||
my $command = $self->snmp_get_command($device, ".0", $community);
|
||||
`$command`;
|
||||
if ($? == 0) {
|
||||
$self->set_community($device, $community);
|
||||
$self->mark_discovered($device);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1023,6 +1129,25 @@ sub snmp_responds($$) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
########################################################################################
|
||||
# Validate the SNMP v3 configuration for a device.
|
||||
# Returns 1 if successfull snmp contact, 0 otherwise.
|
||||
########################################################################################
|
||||
sub snmp_responds_v3($$) {
|
||||
my ($self, $device) = @_;
|
||||
|
||||
my $command = $self->snmp_get_command($device, ".0");
|
||||
`$command`;
|
||||
|
||||
if ($? == 0) {
|
||||
$self->mark_discovered($device);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Parse the local ARP cache.
|
||||
##############################################################################
|
||||
@ -1309,8 +1434,8 @@ sub snmp_get($$$) {
|
||||
my ($self, $device, $oid) = @_;
|
||||
my @output;
|
||||
|
||||
return () unless defined $self->is_snmp_discovered($device);
|
||||
my $community = $self->get_community($device);
|
||||
return () unless defined ($community);
|
||||
|
||||
# Check the SNMP query cache first.
|
||||
if (defined($self->{'snmp_cache'}->{"${device}_${oid}"})) {
|
||||
@ -1320,13 +1445,15 @@ sub snmp_get($$$) {
|
||||
# Check VLANS.
|
||||
my @vlans = $self->get_vlans($device);
|
||||
if (scalar(@vlans) == 0) {
|
||||
@output = `snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community $device $oid 2>/dev/null`;
|
||||
my $command = $self->snmp_get_command($device, $oid, $community);
|
||||
@output = `$command`;
|
||||
}
|
||||
else {
|
||||
# Handle duplicate lines.
|
||||
my %output_hash;
|
||||
foreach my $vlan (@vlans) {
|
||||
foreach my $line (`snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community\@$vlan $device $oid 2>/dev/null`) {
|
||||
my $command = $self->snmp_get_command($device, $oid, $community, $vlan);
|
||||
foreach my $line (`$vlan`) {
|
||||
$output_hash{$line} = 1;
|
||||
}
|
||||
}
|
||||
@ -1339,6 +1466,30 @@ sub snmp_get($$$) {
|
||||
return @output;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Get the snmpwalk command seing version 1, 2, 2c or 3.
|
||||
########################################################################################
|
||||
sub snmp_get_command {
|
||||
my ($self, $device, $oid, $community, $vlan) = @_;
|
||||
$vlan = defined($vlan) ? "\@" . $vlan : '';
|
||||
|
||||
my $command = "snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
||||
if ($self->{'snmp_version'} eq "3") {
|
||||
$command .= " -l$self->{'snmp_security_level'} ";
|
||||
if ($self->{'snmp_security_level'} ne "noAuthNoPriv") {
|
||||
$command .= " -u$self->{'snmp_auth_user'} -a$self->{'snmp_auth_method'} -A$self->{'snmp_auth_pass'} ";
|
||||
}
|
||||
if ($self->{'snmp_security_level'} eq "authPriv") {
|
||||
$command .= " -x$self->{'snmp_privacy_method'} -X$self->{'snmp_privacy_pass'} ";
|
||||
}
|
||||
} else {
|
||||
$command .= " -c$community$vlan ";
|
||||
}
|
||||
|
||||
return "$command $device $oid 2>/dev/null";
|
||||
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
# Performs an SNMP WALK and returns the value of the given OID. Returns undef
|
||||
# on error.
|
||||
|
@ -173,7 +173,16 @@ sub data_consumer ($$) {
|
||||
pa_config => $pa_config,
|
||||
recon_ports => $task->{'recon_ports'},
|
||||
resolve_names => $task->{'resolve_names'},
|
||||
snmp_auth_user => $task->{'snmp_auth_user'},
|
||||
snmp_auth_pass => $task->{'snmp_auth_pass'},
|
||||
snmp_auth_method => $task->{'snmp_auth_method'},
|
||||
snmp_checks => $task->{'snmp_checks'},
|
||||
snmp_enabled => $task->{'snmp_enabled'},
|
||||
snmp_privacy_method => $task->{'snmp_privacy_method'},
|
||||
snmp_privacy_pass => $task->{'snmp_privacy_pass'},
|
||||
snmp_security_level => $task->{'snmp_security_level'},
|
||||
snmp_timeout => $task->{'snmp_timeout'},
|
||||
snmp_version => $task->{'snmp_version'},
|
||||
subnets => \@subnets,
|
||||
task_id => $task->{'id_rt'},
|
||||
vlan_cache_enabled => $task->{'vlan_enabled'},
|
||||
@ -310,10 +319,17 @@ sub PandoraFMS::Recon::Base::create_network_profile_modules($$$) {
|
||||
$self->call('message', "Network component ID " . $np_component->{'id_nc'} . " not found.", 5);
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
# Use snmp_community from network task instead the component snmp_community
|
||||
$component->{'snmp_community'} = safe_output($self->get_community($device));
|
||||
|
||||
$component->{'tcp_send'} = $self->{'snmp_version'};
|
||||
$component->{'custom_string_1'} = $self->{'snmp_privacy_method'};
|
||||
$component->{'custom_string_2'} = $self->{'snmp_privacy_pass'};
|
||||
$component->{'custom_string_3'} = $self->{'snmp_security_level'};
|
||||
$component->{'plugin_parameter'} = $self->{'snmp_auth_method'};
|
||||
$component->{'plugin_user'} = $self->{'snmp_auth_user'};
|
||||
$component->{'plugin_pass'} = $self->{'snmp_auth_pass'};
|
||||
|
||||
pandora_create_module_from_network_component($self->{'pa_config'}, $component, $agent_id, $self->{'dbh'});
|
||||
}
|
||||
}
|
||||
@ -466,8 +482,8 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
}
|
||||
|
||||
# Add interfaces to the agent if it responds to SNMP.
|
||||
return $agent_id unless ($self->is_snmp_discovered($device));
|
||||
my $community = $self->get_community($device);
|
||||
return $agent_id unless defined($community);
|
||||
|
||||
my @output = $self->snmp_get_value_array($device, $PandoraFMS::Recon::Base::IFINDEX);
|
||||
foreach my $if_index (@output) {
|
||||
@ -506,7 +522,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
'descripcion' => $if_desc,
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOPERSTATUS.$if_index"
|
||||
);
|
||||
@ -516,6 +538,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
'descripcion' => $if_desc,
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
@ -531,7 +561,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifInOctets.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCINOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
@ -539,6 +575,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
@ -553,7 +596,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFINOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
@ -561,6 +610,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
@ -577,7 +633,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
'descripcion' => 'The total number of octets received on the interface, including framing characters. This object is a 64-bit version of ifOutOctets.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFHCOUTOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
@ -585,6 +647,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
@ -599,7 +669,13 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
'descripcion' => 'The total number of octets received on the interface, including framing characters.',
|
||||
'id_agente' => $agent_id,
|
||||
'ip_target' => $device,
|
||||
'tcp_send' => 1,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
'snmp_community' => $community,
|
||||
'snmp_oid' => "$PandoraFMS::Recon::Base::IFOUTOCTECTS.$if_index");
|
||||
pandora_create_module_from_hash ($self->{'pa_config'}, \%module, $self->{'dbh'});
|
||||
@ -607,6 +683,14 @@ sub PandoraFMS::Recon::Base::create_agent($$) {
|
||||
my %module = (
|
||||
'ip_target' => $device,
|
||||
'snmp_community' => $community,
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'tcp_send' => $self->{'snmp_version'},
|
||||
'custom_string_1' => $self->{'snmp_privacy_method'},
|
||||
'custom_string_2' => $self->{'snmp_privacy_pass'},
|
||||
'custom_string_3' => $self->{'snmp_security_level'},
|
||||
'plugin_parameter' => $self->{'snmp_auth_method'},
|
||||
'plugin_user' => $self->{'snmp_auth_user'},
|
||||
'plugin_pass' => $self->{'snmp_auth_pass'},
|
||||
);
|
||||
pandora_update_module_from_hash ($self->{'pa_config'}, \%module, 'id_agente_modulo', $module_id, $self->{'dbh'});
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use Socket qw(inet_ntoa inet_aton);
|
||||
use Sys::Syslog;
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use LWP::UserAgent;
|
||||
use threads;
|
||||
|
||||
# New in 3.2. Used to sendmail internally, without external scripts
|
||||
# use Module::Loaded;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.727
|
||||
%define release 1
|
||||
%define release 181001
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.727
|
||||
%define release 1
|
||||
%define release 181001
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
@ -9,7 +9,7 @@
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.727"
|
||||
PI_BUILD="180913"
|
||||
PI_BUILD="181001"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
||||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.727 PS180913";
|
||||
my $version = "7.0NG.727 PS181001";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.727 PS180913";
|
||||
my $version = "7.0NG.727 PS181001";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
@ -136,6 +136,7 @@ sub help_screen{
|
||||
help_screen_line('--delete_cluster_agent', '<id_agent> <id_cluster>', 'Deleting cluster agent');
|
||||
help_screen_line('--delete_cluster_item', '<id_item>', 'Deleting cluster item');
|
||||
help_screen_line('--get_cluster_status', '<id_cluster>', 'Getting cluster status');
|
||||
help_screen_line('--set_disabled_and_standby', '<id_agent> <id_node> <value>', 'Overwrite and disable and standby status');
|
||||
print "\nMODULES:\n\n" unless $param ne '';
|
||||
help_screen_line('--create_data_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <definition_file> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>]", 'Add data server module to agent');
|
||||
help_screen_line('--create_web_module', "<module_name> <module_type> <agent_name> [<description> <module_group> \n\t <min> <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max> \n\t <history_data> <retries> <requests> <agent_browser_id> <auth_server> <auth_realm> <definition_file>\n\t <proxy_url> <proxy_auth_login> <proxy_auth_password> <warning_str> <critical_str>\n\t <unknown_events> <ff_threshold> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical> <ff_timeout> <warning_inverse> <critical_inverse>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>].\n\t The valid data types are web_data, web_proc, web_content_data or web_content_string", 'Add web server module to agent');
|
||||
@ -6125,6 +6126,10 @@ sub pandora_manage_main ($$$) {
|
||||
param_check($ltotal, 1, 0);
|
||||
cli_migration_agent();
|
||||
}
|
||||
elsif ($param eq '--set_disabled_and_standby') {
|
||||
param_check($ltotal, 3, 1);
|
||||
cli_set_disabled_and_standby();
|
||||
}
|
||||
else {
|
||||
print_log "[ERROR] Invalid option '$param'.\n\n";
|
||||
$param = '';
|
||||
@ -6709,4 +6714,23 @@ sub cli_get_cluster_status() {
|
||||
else{
|
||||
print "\n0\n";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Set an agent disabled and with standby.
|
||||
# Related option: --set_disabled_and_standby
|
||||
##############################################################################
|
||||
|
||||
sub cli_set_disabled_and_standby() {
|
||||
my ($id, $id_node, $value) = @ARGV[2..4];
|
||||
$id_node = 0 unless defined($id_node);
|
||||
$value = 1 unless defined($value); #Set to disabled by default
|
||||
|
||||
# Call the API.
|
||||
my $result = api_call(
|
||||
$conf, 'set', 'disabled_and_standby', $id, $id_node, $value
|
||||
);
|
||||
|
||||
my $exit_code = (defined($result) && "$result" eq "1") ? "1" : "0";
|
||||
print "\n$exit_code\n";
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user