Merge remote-tracking branch 'origin/develop' into 2737-Optimización-de-tags-dev

Conflicts:
	pandora_console/godmode/massive/massive_delete_modules.php
	pandora_console/operation/agentes/ver_agente.php
This commit is contained in:
fermin831 2018-10-10 19:39:27 +02:00
commit 2693bbe209
83 changed files with 1081 additions and 582 deletions
pandora_agents
pandora_console
pandora_server
tests/enterprise_base

@ -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-180927
Version: 7.0NG.727-181010
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-180927"
pandora_version="7.0NG.727-181010"
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 => '180927';
use constant AGENT_BUILD => '181010';
# 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 180927
%define release 181010
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 180927
%define release 181010
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.727"
PI_BUILD="180927"
PI_BUILD="181010"
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
{180927}
{181010}
ViewReadme
{Yes}

@ -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 180927)")
#define PANDORA_VERSION ("7.0NG.727(Build 181010)")
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 180927))"
VALUE "ProductVersion", "(7.0NG.727(Build 181010))"
VALUE "FileVersion", "1.0.0.0"
END
END

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.727-180927
Version: 7.0NG.727-181010
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-180927"
pandora_version="7.0NG.727-181010"
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:&nbsp;';
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,231 @@ 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
AND tatm.times_fired = 1
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
AND tatm.times_fired = 1
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, '&hellip;', 'color:#FFF');
}
$head = $modelGroups;
array_unshift($head, '&nbsp;');
//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, '&hellip;', '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, '&hellip;', '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, '&hellip;', '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 +272,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();
});

@ -0,0 +1,12 @@
START TRANSACTION;
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbuser` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbpass` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbhost` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbport` text;
ALTER TABLE tmetaconsole_setup ADD COLUMN `meta_dbname` text;
COMMIT;

@ -341,13 +341,18 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
`id` int(10) NOT NULL auto_increment primary key,
`server_name` text default '',
`server_url` text default '',
`dbuser` text default '',
`dbpass` text default '',
`dbhost` text default '',
`dbport` text default '',
`dbname` text default '',
`server_name` text,
`server_url` text,
`dbuser` text,
`dbpass` text,
`dbhost` text,
`dbport` text,
`dbname` text,
`meta_dbuser` text,
`meta_dbpass` text,
`meta_dbhost` text,
`meta_dbport` text,
`meta_dbname` text,
`auth_token` text default '',
`id_group` int(10) unsigned NOT NULL default 0,
`api_password` text NOT NULL,
@ -1279,6 +1284,7 @@ ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL default 0;
-- ---------------------------------------------------------------------
ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
ALTER TABLE tlayout ADD `is_favourite` int(1) NOT NULL DEFAULT 0;
ALTER TABLE tlayout MODIFY `name` varchar(600) NOT NULL;
UPDATE tlayout SET is_favourite = 1 WHERE name REGEXP '^&#40;' OR name REGEXP '^\\[';
@ -1294,6 +1300,7 @@ ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0
ALTER TABLE tlayout_data ADD COLUMN `clock_animation` varchar(60) NOT NULL default "analogic_1";
ALTER TABLE tlayout_data ADD COLUMN `time_format` varchar(60) NOT NULL default "time";
ALTER TABLE tlayout_data ADD COLUMN `timezone` varchar(60) NOT NULL default "Europe/Madrid";
ALTER TABLE tlayout_data ADD COLUMN `show_last_value` tinyint(1) UNSIGNED NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tagent_custom_fields`

@ -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);

@ -755,7 +755,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();
@ -855,11 +855,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
@ -914,8 +924,9 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated'));
$unsafe_alias = io_safe_output($alias);
db_pandora_audit("Agent management",
"Updated agent $alias", false, false, $info);
"Updated agent $unsafe_alias", false, false, $info);
}
}
@ -1416,7 +1427,7 @@ if ($update_module) {
$edit_module = true;
db_pandora_audit("Agent management",
"Fail to try update module '$name' for agent " . $agent["alias"]);
"Fail to try update module '".io_safe_output($name)."' for agent " . io_safe_output($agent["alias"]));
}
else {
if ($prediction_module == 3) {
@ -1434,7 +1445,7 @@ if ($update_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
"Updated module '".io_safe_output($name)."' for agent ". io_safe_output($agent["alias"]), false, false, io_json_mb_encode($values));
}
}
@ -1575,7 +1586,7 @@ if ($create_module) {
$edit_module = true;
$moduletype = $id_module;
db_pandora_audit("Agent management",
"Fail to try added module '$name' for agent ".$agent["alias"]);
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]));
}
else {
if ($prediction_module == 3) {
@ -1593,7 +1604,7 @@ if ($create_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent["alias"]), false, true, io_json_mb_encode($values));
}
}
@ -1708,12 +1719,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"]);
"Deleted module '".io_safe_output($module_data["nombre"])."' for agent ".io_safe_output($agent["alias"]));
}
}
// MODULE DUPLICATION
@ -1743,11 +1760,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
if ($result) {
db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
"Duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]) . " with the new id for clon " . $result);
}
else {
db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . io_safe_output($agent["alias"]));
}
}
@ -1931,11 +1948,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",
@ -1965,11 +1982,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",

@ -43,6 +43,7 @@ echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters
echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
echo __('Search') . ' ' .
html_print_input_text ('search_string', $search_string, '', 15, 255, true);
html_print_input_hidden ('search', 1);
echo "</td>";
echo "<td class='datos' style='width:10%'>";
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');

@ -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);

@ -71,7 +71,7 @@ push_table_simple ($data, 'plugin_1');
$data = array ();
$data[0] = 'macro_desc';
$data[0] .= ui_print_help_tip ('macro_help', true);
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 255, true);
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 1024, true);
$table_simple->colspan['macro_field'][1] = 3;
$table_simple->rowstyle['macro_field'] = 'display:none';
@ -93,10 +93,10 @@ if (!empty($macros)) {
$m_hide = $m['hide'];
if ($m_hide) {
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 255, true);
$data[1] = html_print_input_password($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
}
else {
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 255, true,
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true,
$disabledBecauseInPolicy, false, '', $classdisabledBecauseInPolicy);
}
$table_simple->colspan['macro'.$m['macro']][1] = 3;

@ -219,7 +219,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] .= '&nbsp;&nbsp;<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&section=fields&amp;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);
});

@ -48,7 +48,7 @@ if ($create_profiles) {
// If the profile doesnt exist, we create it
if ($profile_data === false) {
db_pandora_audit("User management",
"Added profile for user ".io_safe_input($user));
"Added profile for user ".io_safe_output($user));
$return = profile_create_user_profile ($user, $profile, $group);
if ($return !== false) {
$n_added ++;

@ -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;
@ -82,8 +84,13 @@ function process_manage_delete ($module_name, $id_agents, $module_status = 'all'
$filter_for_module_deletion, true);
}
else {
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
'tagente_modulo.nombre IN ("' . implode('","',$module_name) . '")', true);
if ($status_module != -1) {
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
sprintf('tagente_modulo.nombre IN ("%s") AND tagente_modulo.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',
'tagente_modulo.nombre IN ("' . implode('","',$module_name) . '")', true);
}
}
if (($module_status == 'unknown') && ($module_name[0] == "0") && (is_array($module_name)) && (count($module_name) == 1)) {

@ -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
@ -422,7 +433,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;

@ -34,7 +34,7 @@ push_table_row ($data, 'plugin_1');
$data = array ();
$data[0] = 'macro_desc';
$data[0] .= ui_print_help_tip ('macro_help', true);
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 255, true);
$data[1] = html_print_input_text ('macro_name', 'macro_value', '', 100, 1024, true);
$table->colspan['macro_field'][1] = 3;
$table->rowstyle['macro_field'] = 'display:none';
@ -51,9 +51,9 @@ if (!empty($macros)) {
$data[0] .= ui_print_help_tip ($m['help'], true);
}
if ($m['hide'] == 1) {
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 15, 60, true);
$data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true);
} else {
$data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 15, 60, true);
$data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 100, 1024, true);
}
$table->colspan['macro'.$m['macro']][1] = 3;
$table->rowclass['macro'.$m['macro']] = 'macro_field';

@ -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

@ -870,6 +870,7 @@ function readFields() {
values['time_format'] = $("select[name=time_format]").val();
values['timezone'] = $("select[name=timezone]").val();
values['clock_animation'] = $("select[name=clock_animation]").val();
values['show_last_value'] = $("select[name=last_value]").val();
if (is_metaconsole()) {
values['metaconsole'] = 1;
@ -1380,7 +1381,6 @@ function loadFieldsFromDB(item) {
}
});
parameter = Array();
parameter.push ({name: "page",
value: "include/ajax/visual_console_builder.ajax"});
@ -1459,26 +1459,26 @@ function loadFieldsFromDB(item) {
$("select[name=type_graph]").val(val);
}
if (key == 'label_position') {
if($("#hidden-metaconsole").val() == 1){
$('#labelposup'+" img").attr('src','../../images/label_up.png');
$('#labelposdown'+" img").attr('src','../../images/label_down.png');
$('#labelposleft'+" img").attr('src','../../images/label_left.png');
$('#labelposright'+" img").attr('src','../../images/label_right.png');
$('.labelpos').attr('sel','no');
$('#labelpos'+val+" img").attr('src','../../images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
$('#labelpos'+val).attr('sel','yes');
}
else{
$('#labelposup'+" img").attr('src','images/label_up.png');
$('#labelposdown'+" img").attr('src','images/label_down.png');
$('#labelposleft'+" img").attr('src','images/label_left.png');
$('#labelposright'+" img").attr('src','images/label_right.png');
$('.labelpos').attr('sel','no');
$('#labelpos'+val+" img").attr('src','images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
$('#labelpos'+val).attr('sel','yes');
}
if (key == 'label_position') {
if($("#hidden-metaconsole").val() == 1){
$('#labelposup'+" img").attr('src','../../images/label_up.png');
$('#labelposdown'+" img").attr('src','../../images/label_down.png');
$('#labelposleft'+" img").attr('src','../../images/label_left.png');
$('#labelposright'+" img").attr('src','../../images/label_right.png');
$('.labelpos').attr('sel','no');
$('#labelpos'+val+" img").attr('src','../../images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
$('#labelpos'+val).attr('sel','yes');
}
else{
$('#labelposup'+" img").attr('src','images/label_up.png');
$('#labelposdown'+" img").attr('src','images/label_down.png');
$('#labelposleft'+" img").attr('src','images/label_left.png');
$('#labelposright'+" img").attr('src','images/label_right.png');
$('.labelpos').attr('sel','no');
$('#labelpos'+val+" img").attr('src','images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
$('#labelpos'+val).attr('sel','yes');
}
}
if (key == 'image') {
//Load image preview
@ -1590,6 +1590,10 @@ function loadFieldsFromDB(item) {
.css('background-color', val);
}
if (key == 'show_last_value') {
$("select[name=last_value]").val(val);
}
if (key == 'clock_animation')
$("select[name=clock_animation]").val(val);
if (key == 'time_format')
@ -1852,6 +1856,9 @@ function hiddenFields(item) {
$("#percentile_bar_row_2").css('display', 'none');
$("#percentile_bar_row_2." + item).css('display', '');
$("#show_last_value_row").css('display', 'none');
$("#show_last_value_row." + item).css('display', '');
$("#percentile_item_row_3").css('display', 'none');
$("#percentile_item_row_3." + item).css('display', '');

@ -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'),
@ -405,7 +405,7 @@ if ($update_user) {
}
db_pandora_audit("User management", "Updated user ".io_safe_input($id),
db_pandora_audit("User management", "Updated user ".io_safe_output($id),
false, false, $info);
ui_print_result_message ($res1,
@ -463,7 +463,7 @@ if ($add_profile) {
$tags = implode(',', $tags);
db_pandora_audit("User management",
"Added profile for user ".io_safe_input($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
"Added profile for user ".io_safe_output($id2), false, false, 'Profile: ' . $profile2 . ' Group: ' . $group2 . ' Tags: ' . $tags);
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
ui_print_result_message ($return,
__('Profile added successfully'),
@ -479,7 +479,7 @@ if ($delete_profile) {
$perfil = db_get_row('tperfil', 'id_perfil', $id_perfil);
db_pandora_audit("User management",
"Deleted profile for user ".io_safe_input($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
"Deleted profile for user ".io_safe_output($id2), false, false, 'The profile with id ' . $id_perfil . ' in the group ' . $perfilUser['id_grupo']);
$return = profile_delete_user_profile ($id2, $id_up);
ui_print_result_message ($return,

Binary file not shown.

After

(image error) Size: 440 B

@ -164,6 +164,8 @@ $clock_animation = get_parameter('clock_animation', 'analogic_1');
$time_format = get_parameter('time_format', 'time');
$timezone = get_parameter('timezone', 'Europe/Madrid');
$show_last_value = get_parameter('show_last_value', null);
switch ($action) {
case 'get_font':
$return = array();
@ -785,6 +787,9 @@ switch ($action) {
if ($height !== null) {
$values['height'] = $height;
}
if ($show_last_value !== null) {
$values['show_last_value'] = $show_last_value;
}
break;
case 'simple_value':
if ($action == 'update') {
@ -1280,6 +1285,7 @@ switch ($action) {
$values['image'] = $image;
$values['width'] = $width;
$values['height'] = $height;
$values['show_last_value'] = $show_last_value;
break;
case 'group_item':
$values['type'] = GROUP_ITEM;

@ -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;

@ -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.

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC180927';
$build_version = 'PC181010';
$pandora_version = 'v7.0NG.727';
// Do not overwrite default timezone set if defined.

@ -336,32 +336,39 @@ function agents_get_agents ($filter = false, $fields = false,
if (isset($filter['status'])) {
switch ($filter['status']) {
case AGENT_STATUS_NORMAL:
$status_sql =
"normal_count = total_count
AND notinit_count <> total_count";
$status_sql = "(
critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0)";
break;
case AGENT_STATUS_WARNING:
$status_sql =
"critical_count = 0 AND warning_count > 0";
$status_sql = "(
critical_count = 0
AND warning_count > 0
AND total_count > 0)";
break;
case AGENT_STATUS_CRITICAL:
$status_sql =
"critical_count > 0";
$status_sql = "critical_count > 0";
break;
case AGENT_STATUS_UNKNOWN:
$status_sql =
"critical_count = 0 AND warning_count = 0
AND unknown_count > 0";
$status_sql = "(
critical_count = 0
AND warning_count = 0
AND unknown_count > 0)";
break;
case AGENT_STATUS_NOT_NORMAL:
$status_sql =
"(
normal_count <> total_count
AND
(normal_count + notinit_count) <> total_count)";
$status_sql = "(
critical_count > 0
OR warning_count > 0
OR unknown_count > 0
OR total_count = 0
OR total_count = notinit_count)";
break;
case AGENT_STATUS_NOT_INIT:
$status_sql = "notinit_count = total_count";
$status_sql = "(
total_count = 0
OR total_count = notinit_count)";
break;
}
unset($filter['status']);
@ -915,23 +922,39 @@ function agents_get_group_agents (
if (isset($search['status'])) {
switch ($search['status']) {
case AGENT_STATUS_NORMAL:
$filter[] = "normal_count = total_count";
$filter[] = "(
critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0)";
break;
case AGENT_STATUS_WARNING:
$filter[] = "(critical_count = 0 AND warning_count > 0)";
$filter[] = "(
critical_count = 0
AND warning_count > 0
AND total_count > 0)";
break;
case AGENT_STATUS_CRITICAL:
$filter[] = "critical_count > 0";
break;
case AGENT_STATUS_UNKNOWN:
$filter[] = "(critical_count = 0 AND warning_count = 0 AND unknown_count > 0)";
$filter[] = "(
critical_count = 0
AND warning_count = 0
AND unknown_count > 0)";
break;
case AGENT_STATUS_NOT_NORMAL:
$filter[] = "normal_count <> total_count
AND critical_count = 0 AND warning_count = 0";
$filter[] = "(
critical_count > 0
OR warning_count > 0
OR unknown_count > 0
OR total_count = 0
OR total_count = notinit_count)";
break;
case AGENT_STATUS_NOT_INIT:
$filter[] = "notinit_count = total_count";
$filter[] = "(
total_count = 0
OR total_count = notinit_count)";
break;
}
unset($search['status']);
@ -2732,7 +2755,7 @@ function agents_get_status_clause($state, $show_not_init = true) {
)";
case AGENT_STATUS_NOT_INIT:
return $show_not_init
? "(ta.total_count = ta.notinit_count)"
? "(ta.total_count = ta.notinit_count OR ta.total_count = 0)"
: "1=0";
case AGENT_STATUS_NORMAL:
return "(

@ -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 ();

@ -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
@ -1547,10 +1620,6 @@ function api_set_delete_agent($id, $thrash1, $thrast2, $thrash3) {
function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
global $config;
if (defined ('METACONSOLE')) {
return;
}
// Error if user cannot read agents.
if (!check_acl($config['id_user'], 0, "AR")) {
returnError('forbidden', $returnType);
@ -1599,13 +1668,25 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
// Initialization of array
$result_agents = array();
// Filter by state
$sql = "SELECT id_agente, alias, direccion, comentarios,
if (defined ('METACONSOLE')) {
$sql = "SELECT id_agente, alias, direccion, comentarios,
tconfig_os.name, url_address, nombre
FROM tconfig_os, tagente
FROM tconfig_os, tmetaconsole_agent
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE tagente.id_os = tconfig_os.id_os
ON tmetaconsole_agent.id_agente = tagent_secondary_group.id_agent
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
AND disabled = 0 $where AND $groups";
}
else{
$sql = "SELECT id_agente, alias, direccion, comentarios,
tconfig_os.name, url_address, nombre
FROM tconfig_os, tagente
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE tagente.id_os = tconfig_os.id_os
AND disabled = 0 $where AND $groups";
}
$all_agents = db_get_all_rows_sql($sql);
@ -1674,6 +1755,18 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
$result_agents = $all_agents;
}
if (empty($returnType)) {
$returnType = "string";
}
if (empty($separator)) {
$separator = ";";
}
foreach ($result_agents as $key => $value) {
$result_agents[$key]['status'] = agents_get_status($result_agents[$key]['id_agente'], true);
}
if (count($result_agents) > 0 and $result_agents !== false) {
$data = array('type' => 'array', 'data' => $result_agents);
returnData($returnType, $data, $separator);
@ -7007,10 +7100,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";

@ -2457,7 +2457,7 @@ function grafico_incidente_prioridad () {
}
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark,
__('Other'), '', '',
$config['fontpath'], $config['font_size']);
}
@ -2498,7 +2498,7 @@ function graph_incidents_status () {
}
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark,
__('Other'), '', '',
$config['fontpath'], $config['font_size']);
}
@ -2554,7 +2554,7 @@ function graphic_incident_group () {
}
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark,
__('Other'), '', '',
$config['fontpath'], $config['font_size']);
}
@ -2609,7 +2609,7 @@ function graphic_incident_user () {
}
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark,
__('Other'), '', '',
$config['fontpath'], $config['font_size']);
}
@ -2663,7 +2663,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']);
}

@ -439,9 +439,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{
@ -2685,8 +2685,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) {

@ -6277,6 +6277,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'];

@ -823,10 +823,26 @@ 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);
if (defined('METACONSOLE')) {
$server = db_get_row ('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) {
// Get agent data from node
$agente = db_get_row ('tagente', 'id_agente', $alert['id_agent']);
metaconsole_restore_db ();
}
} else {
// 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 +950,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, '[&hellip;]', '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 +4068,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'];

@ -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&amp;id_agente=" . $layoutData['id_agent']);
"estado", "operation/agentes/ver_agente&amp;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&amp;id_agente=" . $layoutData['id_agent']);
"estado", "operation/agentes/ver_agente&amp;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&amp;id_agente=" . $layoutData['id_agent']);
"estado", "operation/agentes/ver_agente&amp;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&amp;id_agente='.$layoutData['id_agent']);
"estado", 'operation/agentes/ver_agente&amp;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&amp;id_agente='.$layoutData["id_agent"].'&amp;tab=data');
"estado", 'operation/agentes/ver_agente&amp;id_agente='.$layoutData["id_agent"].'&amp;tab=data', null, null, null, $isExternalLink);
}
}
}
@ -1775,16 +1775,25 @@ function visual_map_print_item($mode = "read", $layoutData,
$value = format_for_graph($value, 2);
}
if (!empty($unit_text))
$value .= " " . $unit_text;
// Hide value on boolean modules
if (!modules_is_boolean($layoutData['id_agente_modulo'])) {
$img_style_title .=
" <br>" . __("Last value: ")
. remove_right_zeros(number_format($value, $config['graph_precision'])).$unit_text;
if ($layoutData['show_last_value'] != 2) {
if ((!modules_is_boolean($layoutData['id_agente_modulo'])) ||
(modules_is_boolean($layoutData['id_agente_modulo']) && $layoutData['show_last_value'] != 0)){
if (is_numeric($value)) {
$img_style_title .=
" <br>" . __("Last value: ")
. remove_right_zeros(number_format($value, $config['graph_precision']));
} else {
$img_style_title .=
" <br>" . __("Last value: ")
. $value;
}
}
}
if (!empty($unit_text))
$img_style_title .= " " . $unit_text;
if ($layoutData['id_metaconsole'] != 0) {
//Restore db connection
metaconsole_restore_db();
@ -1792,7 +1801,7 @@ function visual_map_print_item($mode = "read", $layoutData,
}
if(get_parameter('action') == 'edit'){
$img_style_title = '';
$img_style_title = '';
}
}

@ -590,6 +590,15 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
<td align="left" style="">' .
html_print_checkbox('show_on_top', 1, '', true) . '</td>';
$show_last_value = array('0' => __('Hide last value on boolean modules'), '1' => __('Enabled'), '2' => __('Disabled'));
$form_items['show_last_value_row'] = array();
$form_items['show_last_value_row']['items'] = array('static_graph');
$form_items['show_last_value_row']['html'] =
'<td align="left" style="">' . __('Show last value') . '</td>
<td align="left">' .
html_print_select($show_last_value, 'last_value', 0, '', '', '', true) .
'</td>';
$form_items['module_graph_size_row'] = array();
$form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');
$form_items['module_graph_size_row']['html'] = '<td align="left">' . __('Size') . '</td>

@ -2240,7 +2240,6 @@ function pandoraFlotArea( graph_id, values, legend,
}
function yFormatter(v, axis) {
axis.datamin = 0;
if (short_data) {
var formatted = number_format(v, force_integer, "", short_data);
}

@ -4726,3 +4726,41 @@ a.up_arrow {
tr:last-child > td > a.down_arrow, tr:first-child > td > a.up_arrow {
visibility: hidden;
}
.group_modules_status_box>tbody>tr>td{
border-bottom: 1px solid #E2E2E2;
border-collapse: collapse;
border-spacing:0;
width: 10%;
height: 20px;
}
.group_modules_status_div{
color: #FFF;
width: 100%;
height: 100%;
text-align: left;
display: block;
vertical-align: middle;
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 = '180927';
$build = '181010';
$banner = "v$version Build $build";
error_reporting(0);

@ -85,22 +85,39 @@ if (is_ajax ()) {
switch ($status_agents) {
case AGENT_STATUS_NORMAL:
$filter[] = "(normal_count = total_count)";
$filter[] = "(
critical_count = 0
AND warning_count = 0
AND unknown_count = 0
AND normal_count > 0)";
break;
case AGENT_STATUS_WARNING:
$filter[] = "(critical_count = 0 AND warning_count > 0)";
$filter[] = "(
critical_count = 0
AND warning_count > 0
AND total_count > 0)";
break;
case AGENT_STATUS_CRITICAL:
$filter[] = "(critical_count > 0)";
break;
case AGENT_STATUS_UNKNOWN:
$filter[] = "(critical_count = 0 AND warning_count = 0 AND unknown_count > 0)";
$filter[] = "(
critical_count = 0
AND warning_count = 0
AND unknown_count > 0)";
break;
case AGENT_STATUS_NOT_NORMAL:
$filter[] = "(normal_count <> total_count)";
$filter[] = "(
critical_count > 0
OR warning_count > 0
OR unknown_count > 0
OR total_count = 0
OR total_count = notinit_count)";
break;
case AGENT_STATUS_NOT_INIT:
$filter[] = "(notinit_count = total_count)";
$filter[] = "(
total_count = 0
OR total_count = notinit_count)";
break;
}
$filter['order'] = "alias ASC";

@ -40,11 +40,13 @@ $params = array (
// Events query params
"search" => io_safe_input($search),
"event_type" => $event_type,
"severity" => $severity,
"status" => $status,
"id_group" => $id_group,
"recursion" => $recursion,
"refr" => (int)get_parameter("refr", 0),
"id_agent" => $id_agent,
"id_agent_module" => $id_agent_module,
"pagination" => $pagination,
"group_rep" => $group_rep,
@ -156,12 +158,13 @@ else {
$table->align[$i] = 'left';
$i++;
if (in_array('server_name', $show_fields)) {
foreach ($show_fields as $k_s => $fields) {
if ($fields == 'server_name') {
$table->head[$i] = __('Server');
$table->align[$i] = 'left';
$i++;
}
if (in_array('estado', $show_fields)) {
if ($fields == 'estado') {
$table->head[$i] = __('Status') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'status')),
'sort'
@ -169,7 +172,7 @@ else {
$table->align[$i] = 'left';
$i++;
}
if (in_array('id_evento', $show_fields)) {
if ($fields == 'id_evento') {
$table->head[$i] = __('Event ID') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'event_id')),
'sort'
@ -178,7 +181,7 @@ else {
$i++;
}
if (in_array('evento', $show_fields)) {
if ($fields == 'evento') {
$table->head[$i] = __('Event Name') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'event_name')),
'sort'
@ -187,7 +190,7 @@ else {
$table->style[$i] = 'min-width: 200px; max-width: 350px; word-break: break-all;';
$i++;
}
if (in_array('id_agente', $show_fields)) {
if ($fields == 'id_agente') {
$table->head[$i] = __('Agent name') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'agent_id')),
'sort'
@ -196,7 +199,7 @@ else {
$table->style[$i] = 'max-width: 350px; word-break: break-all;';
$i++;
}
if (in_array('timestamp', $show_fields)) {
if ($fields == 'timestamp') {
$table->head[$i] = __('Timestamp') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'timestamp')),
'sort'
@ -205,7 +208,7 @@ else {
$i++;
}
if (in_array('id_usuario', $show_fields)) {
if ($fields == 'id_usuario') {
$table->head[$i] = __('User') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'user_id')),
'sort'
@ -214,7 +217,7 @@ else {
$i++;
}
if (in_array('owner_user', $show_fields)) {
if ($fields == 'owner_user') {
$table->head[$i] = __('Owner') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'owner')),
'sort'
@ -223,7 +226,7 @@ else {
$i++;
}
if (in_array('id_grupo', $show_fields)) {
if ($fields == 'id_grupo') {
$table->head[$i] = __('Group') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'group_id')),
'sort'
@ -232,7 +235,7 @@ else {
$i++;
}
if (in_array('event_type', $show_fields)) {
if ($fields == 'event_type') {
$table->head[$i] = __('Event Type') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'event_type')),
'sort'
@ -242,7 +245,7 @@ else {
$table->style[$i] = 'min-width: 85px;';
$i++;
}
if (in_array('id_agentmodule', $show_fields)) {
if ($fields == 'id_agentmodule') {
$table->head[$i] = __('Module Name') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'module_name')),
'sort'
@ -251,7 +254,7 @@ else {
$i++;
}
if (in_array('id_alert_am', $show_fields)) {
if ($fields == 'id_alert_am') {
$table->head[$i] = __('Alert') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'alert_id')),
'sort'
@ -261,7 +264,7 @@ else {
$i++;
}
if (in_array('criticity', $show_fields)) {
if ($fields == 'criticity') {
$table->head[$i] = __('Severity') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'criticity')),
'sort'
@ -270,7 +273,7 @@ else {
$i++;
}
if (in_array('user_comment', $show_fields)) {
if ($fields == 'user_comment') {
$table->head[$i] = __('Comment') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'comment')),
'sort'
@ -279,7 +282,7 @@ else {
$i++;
}
if (in_array('tags', $show_fields)) {
if ($fields == 'tags') {
$table->head[$i] = __('Tags') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'tags')),
'sort'
@ -288,7 +291,7 @@ else {
$i++;
}
if (in_array('source', $show_fields)) {
if ($fields == 'source') {
$table->head[$i] = __('Source') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'source')),
'sort'
@ -296,7 +299,7 @@ else {
$i++;
}
if (in_array('id_extra', $show_fields)) {
if ($fields == 'id_extra') {
$table->head[$i] = __('Extra ID') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'extra_id')),
'sort'
@ -305,7 +308,7 @@ else {
$i++;
}
if (in_array('ack_utimestamp', $show_fields)) {
if ($fields == 'ack_utimestamp') {
$table->head[$i] = __('ACK Timestamp') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'ack_utimestamp')),
'sort'
@ -314,13 +317,13 @@ else {
$i++;
}
if (in_array('instructions', $show_fields)) {
if ($fields == 'instructions') {
$table->head[$i] = __('Instructions');
$table->align[$i] = 'left';
$i++;
}
if (in_array('data', $show_fields)) {
if ($fields == 'data') {
$table->head[$i] = __('Data') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'data')),
'sort'
@ -329,7 +332,7 @@ else {
$i++;
}
if (in_array('module_status', $show_fields)) {
if ($fields == 'module_status') {
$table->head[$i] = __('Module Status') . html_print_sort_arrows(
array_merge($params, array('sort_field' => 'module_status')),
'sort'
@ -337,6 +340,7 @@ else {
$i++;
}
}
if ($i != 0 && $allow_action) {
$table->head[$i] = __('Action');
$table->align[$i] = 'left';
@ -447,35 +451,6 @@ else {
$i++;
if (in_array('server_name',$show_fields)) {
if ($meta) {
if (can_user_access_node ()) {
$data[$i] = "<a href='" . $event["server_url"] . "/index.php?sec=estado&sec2=operation/agentes/group_view" . $event['server_url_hash'] . "'>" . $event["server_name"] . "</a>";
}
else {
$data[$i] = $event["server_name"];
}
}
else {
$data[$i] = db_get_value('name','tserver');
}
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('estado',$show_fields)) {
$data[$i] = html_print_image ($img_st, true,
array ("class" => "image_status",
"title" => $title_st,
"id" => 'status_img_'.$event["id_evento"]));
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
$i++;
}
if (in_array('id_evento',$show_fields)) {
$data[$i] = $event["id_evento"];
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
switch ($event["criticity"]) {
default:
case 0:
@ -500,8 +475,37 @@ else {
$img_sev = "images/status_sets/default/severity_major.png";
break;
}
foreach ($show_fields as $k_s => $fields) {
if ($fields == 'server_name') {
if ($meta) {
if (can_user_access_node ()) {
$data[$i] = "<a href='" . $event["server_url"] . "/index.php?sec=estado&sec2=operation/agentes/group_view" . $event['server_url_hash'] . "'>" . $event["server_name"] . "</a>";
}
else {
$data[$i] = $event["server_name"];
}
}
else {
$data[$i] = db_get_value('name','tserver');
}
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if ($fields == 'estado') {
$data[$i] = html_print_image ($img_st, true,
array ("class" => "image_status",
"title" => $title_st,
"id" => 'status_img_'.$event["id_evento"]));
$table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;';
$i++;
}
if ($fields == 'id_evento') {
$data[$i] = $event["id_evento"];
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('evento', $show_fields)) {
if ($fields == 'evento') {
// Event description
$data[$i] = '<span title="' . strip_tags(io_safe_output($event["evento"])) . '" class="f9">';
if($allow_action) {
@ -516,7 +520,7 @@ else {
$i++;
}
if (in_array('id_agente', $show_fields)) {
if ($fields == 'id_agente') {
$data[$i] = '<span class="'.$myclass.'">';
if ($event["id_agente"] > 0) {
@ -549,7 +553,7 @@ else {
$i++;
}
if (in_array('timestamp', $show_fields)) {
if ($fields == 'timestamp') {
//Time
$data[$i] = '<span class="'.$myclass.'">';
if ($group_rep == 1) {
@ -563,7 +567,7 @@ else {
$i++;
}
if (in_array('id_usuario',$show_fields)) {
if ($fields == 'id_usuario') {
$user_name = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']);
if(empty($user_name)) {
$user_name = $event['id_usuario'];
@ -573,7 +577,7 @@ else {
$i++;
}
if (in_array('owner_user',$show_fields)) {
if ($fields == 'owner_user') {
$owner_name = db_get_value('fullname', 'tusuario', 'id_user', $event['owner_user']);
if(empty($owner_name)) {
$owner_name = $event['owner_user'];
@ -583,7 +587,7 @@ else {
$i++;
}
if (in_array('id_grupo',$show_fields)) {
if ($fields == 'id_grupo') {
if ($meta) {
$data[$i] = $event['group_name'];
}
@ -599,13 +603,13 @@ else {
$i++;
}
if (in_array('event_type',$show_fields)) {
if ($fields == 'event_type') {
$data[$i] = events_print_type_description($event["event_type"], true);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('id_agentmodule',$show_fields)) {
if ($fields == 'id_agentmodule') {
if ($meta) {
$module_link = '<a href="'.$event["server_url"].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $event["id_agente"] . $event["server_url_hash"] . '">';
if (can_user_access_node ()) {
@ -624,7 +628,7 @@ else {
$i++;
}
if (in_array('id_alert_am',$show_fields)) {
if ($fields == 'id_alert_am') {
if($meta) {
$data[$i] = $event["alert_template_name"];
}
@ -647,13 +651,13 @@ else {
$i++;
}
if (in_array('criticity',$show_fields)) {
if ($fields == 'criticity') {
$data[$i] = get_priority_name ($event["criticity"]);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('user_comment',$show_fields)) {
if ($fields == 'user_comment') {
$safe_event_user_comment = strip_tags(io_safe_output($event["user_comment"]));
$line_breaks = array("\r\n", "\n", "\r");
$safe_event_user_comment = str_replace($line_breaks, '<br>', $safe_event_user_comment);
@ -684,25 +688,25 @@ else {
$i++;
}
if (in_array('tags',$show_fields)) {
if ($fields == 'tags') {
$data[$i] = tags_get_tags_formatted($event['tags']);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('source',$show_fields)) {
if ($fields == 'source') {
$data[$i] = $event["source"];
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('id_extra',$show_fields)) {
if ($fields == 'id_extra') {
$data[$i] = $event["id_extra"];
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('ack_utimestamp',$show_fields)) {
if ($fields == 'ack_utimestamp') {
if ($event["ack_utimestamp"] == 0) {
$data[$i] = '';
}
@ -713,7 +717,7 @@ else {
$i++;
}
if (in_array('instructions',$show_fields)) {
if ($fields == 'instructions') {
switch($event['event_type']) {
case 'going_unknown':
if(!empty($event["unknown_instructions"])) {
@ -751,7 +755,7 @@ else {
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('data',$show_fields)) {
if ($fields == 'data') {
$data[$i] = $event["data"];
if($data[$i] %1 == 0)
$data[$i]= number_format($data[$i], 0);
@ -760,11 +764,12 @@ else {
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
if (in_array('module_status',$show_fields)) {
if ($fields == 'module_status') {
$data[$i] = modules_get_modules_status ($event["module_status"]);
$table->cellclass[count($table->data)][$i] = $myclass;
$i++;
}
}
if ($i != 0 && $allow_action) {
//Actions

@ -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&amp;sec2=operation/messages/message_list&show_sent=1&amp;delete_message=1&amp;id='.$message_id.'">';
echo '<form id="delete_message" method="post" action="index.php?sec=message_list&amp;sec2=operation/messages/message_list&show_sent=1&amp;delete_message=1&amp;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&amp;new_msg=1&amp;reply=1">';
echo '<form id="reply_message" method="post" action="index.php?sec=message_list&sec2=operation/messages/message_edit&amp;new_msg=1&amp;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 "&nbsp";
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 180927
%define release 181010
# 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 180927
%define release 181010
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

@ -1351,7 +1351,7 @@ CREATE TABLE IF NOT EXISTS `treport_custom_sql` (
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`name` varchar(600) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0,
@ -1399,6 +1399,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
`clock_animation` varchar(60) NOT NULL default "analogic_1",
`time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
@ -2411,14 +2412,19 @@ CREATE TABLE IF NOT EXISTS `ttrap_custom_values` (
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tmetaconsole_setup` (
`id` int(10) NOT NULL auto_increment primary key,
`server_name` text default '',
`server_url` text default '',
`dbuser` text default '',
`dbpass` text default '',
`dbhost` text default '',
`dbport` text default '',
`dbname` text default '',
`auth_token` text default '',
`server_name` text,
`server_url` text,
`dbuser` text,
`dbpass` text,
`dbhost` text,
`dbport` text,
`dbname` text,
`meta_dbuser` text,
`meta_dbpass` text,
`meta_dbhost` text,
`meta_dbport` text,
`meta_dbname` text,
`auth_token` text,
`id_group` int(10) unsigned NOT NULL default 0,
`api_password` text NOT NULL,
`disabled` tinyint(1) unsigned NOT NULL default '0',

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.727-180927
Version: 7.0NG.727-181010
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-180927"
pandora_version="7.0NG.727-181010"
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 = "180927";
my $pandora_build = "181010";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

@ -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 = "180927";
my $pandora_build = "181010";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -1164,6 +1164,10 @@ sub parse_arguments {
my $key = trim($args[$i]);
$key =~ s/^-//;
if ($key =~ /^\s*global_alerts/){
push (@{$data{global_alerts}}, trim($args[$i+1]));
next;
}
$data{$key} = trim($args[$i+1]);
}

@ -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 180927
%define release 181010
Summary: Pandora FMS Server
Name: %{name}

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.727
%define release 180927
%define release 181010
Summary: Pandora FMS Server
Name: %{name}

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.727"
PI_BUILD="180927"
PI_BUILD="181010"
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 PS180927";
my $version = "7.0NG.727 PS181010";
# 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 PS180927";
my $version = "7.0NG.727 PS181010";
# 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";
}

@ -2,7 +2,7 @@ FROM pandorafms/pandorafms-base
MAINTAINER Pandora FMS Team <info@pandorafms.com>
# Pandora FMS Server dependencies
RUN yum install -y fping perl-Test-WWW-Selenium perl-Crypt-ECB perl-Net-OpenSSH
RUN yum install -y fping perl-Test-WWW-Selenium perl-Crypt-Blowfish perl-Crypt-ECB perl-Net-OpenSSH
RUN ln -s /usr/bin/braa /usr/local/bin/braa