Merge remote-tracking branch 'origin/develop' into ent-3653-finalizacion-de-paradas-planificadas-al-dia-siguiente-de-su-comienzo
This commit is contained in:
commit
db716d6b1e
|
@ -1,20 +1,27 @@
|
|||
FROM centos:centos7
|
||||
FROM centos:centos8
|
||||
MAINTAINER Pandora FMS Team <info@pandorafms.com>
|
||||
|
||||
# Add Pandora FMS agent installer
|
||||
ADD unix /tmp/pandora_agent/unix
|
||||
ADD unix /opt/pandora/pandora_agent/unix
|
||||
|
||||
RUN export LC_ALL=C
|
||||
|
||||
RUN dnf install -y dnf-plugins-core; dnf config-manager --set-enabled PowerTools
|
||||
|
||||
# Install dependencies
|
||||
RUN yum -y install \
|
||||
RUN dnf -y install \
|
||||
epel-release \
|
||||
unzip \
|
||||
perl \
|
||||
python3 \
|
||||
sed \
|
||||
"perl(Sys::Syslog)"
|
||||
perl-YAML-Tiny \
|
||||
"perl(Sys::Syslog)" \
|
||||
&& dnf clean all
|
||||
|
||||
|
||||
# Install Pandora FMS agent
|
||||
RUN cd /tmp/pandora_agent/unix \
|
||||
RUN cd /opt/pandora/pandora_agent/unix \
|
||||
&& chmod +x pandora_agent_installer \
|
||||
&& ./pandora_agent_installer --install
|
||||
|
||||
|
@ -41,8 +48,7 @@ if [ $TIMEZONE != "" ]; then\n \
|
|||
\tln -sfn /usr/share/zoneinfo/$TIMEZONE /etc/localtime\n \
|
||||
fi\n \
|
||||
/etc/init.d/pandora_agent_daemon start\n \
|
||||
rm -f $0\n \
|
||||
tail -f /var/log/pandora/pandora_agent.log' \
|
||||
tail -F /var/log/pandora/pandora_agent.log' \
|
||||
>> /entrypoint.sh && \
|
||||
chmod +x /entrypoint.sh
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.749-201007
|
||||
Version: 7.0NG.749-201013
|
||||
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.749-201007"
|
||||
pandora_version="7.0NG.749-201013"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -55,7 +55,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.749';
|
||||
use constant AGENT_BUILD => '201007';
|
||||
use constant AGENT_BUILD => '201013';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.749"
|
||||
PI_BUILD="201007"
|
||||
PI_BUILD="201013"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{201007}
|
||||
{201013}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.749(Build 201007)")
|
||||
#define PANDORA_VERSION ("7.0NG.749(Build 201013)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.749(Build 201007))"
|
||||
VALUE "ProductVersion", "(7.0NG.749(Build 201013))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.749-201007
|
||||
Version: 7.0NG.749-201013
|
||||
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.749-201007"
|
||||
pandora_version="7.0NG.749-201013"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -548,7 +548,24 @@ $table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'.html_print_select(
|
|||
$table->data[0][1] .= ' '.__('Module').' '.html_print_select($modules, 'cascade_protection_module', $cascade_protection_module, '', '', 0, true);
|
||||
|
||||
$table->data[1][0] = __('Group');
|
||||
$table->data[1][1] = html_print_select_groups(false, 'AR', false, 'group', $group, '', __('No change'), -1, true, false, true, '', false, 'width: 150px;');
|
||||
$table->data[1][1] = '<div class="w290px inline">';
|
||||
$table->data[1][1] .= html_print_select_groups(
|
||||
false,
|
||||
'AR',
|
||||
false,
|
||||
'group',
|
||||
$group,
|
||||
'',
|
||||
__('No change'),
|
||||
-1,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width: 150px;'
|
||||
);
|
||||
$table->data[1][1] .= '</div>';
|
||||
|
||||
$table->data[2][0] = __('Interval');
|
||||
|
||||
|
|
|
@ -59,18 +59,10 @@ global $config;
|
|||
check_login();
|
||||
|
||||
if (is_ajax()) {
|
||||
enterprise_include_once('include/functions_cron.php');
|
||||
|
||||
$test_address = get_parameter('test_address', '');
|
||||
|
||||
$res = enterprise_hook(
|
||||
'send_email_attachment',
|
||||
[
|
||||
$test_address,
|
||||
__('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'),
|
||||
__('Testing Pandora FMS email'),
|
||||
null,
|
||||
]
|
||||
$res = send_test_email(
|
||||
$test_address
|
||||
);
|
||||
|
||||
echo $res;
|
||||
|
@ -479,7 +471,6 @@ function show_email_test(id) {
|
|||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
height: 175,
|
||||
width: 450,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
|
@ -497,7 +488,11 @@ function perform_email_test () {
|
|||
data: "page=godmode/setup/setup_general&test_address="+test_address,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$('#email_test_sent_message').show();
|
||||
if (parseInt(data) === 1) {
|
||||
$('#email_test_sent_message').show();
|
||||
} else {
|
||||
$('#email_test_failure_message').show();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
$('#email_test_failure_message').show();
|
||||
|
|
|
@ -2105,6 +2105,14 @@ class ConsoleSupervisor
|
|||
|
||||
$fontpath = io_safe_output($config['fontpath']);
|
||||
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$fontpath = $config['homedir'].'\include\fonts\\'.$fontpath;
|
||||
} else {
|
||||
$home = str_replace('\\', '/', $config['homedir']);
|
||||
$fontpath = $home.'/include/fonts/'.$fontpath;
|
||||
}
|
||||
|
||||
if (($fontpath == '')
|
||||
|| (file_exists($fontpath) === false)
|
||||
) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC201007';
|
||||
$build_version = 'PC201013';
|
||||
$pandora_version = 'v7.0NG.749';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -5740,3 +5740,60 @@ function get_data_multiplier($unit)
|
|||
|
||||
return $multiplier;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send test email to check email setups.
|
||||
*
|
||||
* @param string $to Target email account.
|
||||
*
|
||||
* @return integer Status of the email send task.
|
||||
*/
|
||||
function send_test_email(
|
||||
string $to
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$result = false;
|
||||
try {
|
||||
$transport = new Swift_SmtpTransport(
|
||||
$config['email_smtpServer'],
|
||||
$config['email_smtpPort']
|
||||
);
|
||||
|
||||
$transport->setUsername($config['email_username']);
|
||||
$transport->setPassword($config['email_password']);
|
||||
|
||||
if ($config['email_encryption']) {
|
||||
$transport->setEncryption($config['email_encryption']);
|
||||
}
|
||||
|
||||
$mailer = new Swift_Mailer($transport);
|
||||
|
||||
$message = new Swift_Message(io_safe_output(__('Testing Pandora FMS email')));
|
||||
|
||||
$message->setFrom(
|
||||
[
|
||||
$config['email_from_dir'] => io_safe_output(
|
||||
$config['email_from_name']
|
||||
),
|
||||
]
|
||||
);
|
||||
|
||||
$to = trim($to);
|
||||
$message->setTo([$to => $to]);
|
||||
$message->setBody(
|
||||
__('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'),
|
||||
'text/html'
|
||||
);
|
||||
|
||||
ini_restore('sendmail_from');
|
||||
|
||||
$result = $mailer->send($message);
|
||||
} catch (Exception $e) {
|
||||
error_log($e->getMessage());
|
||||
db_pandora_audit('Cron jobs mail', $e->getMessage());
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -2830,3 +2830,83 @@ function alerts_ui_update_or_create_actions($update=true)
|
|||
$update ? __('Could not be updated') : __('Could not be created')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve all agent_modules with configured alerts filtered by group.
|
||||
*
|
||||
* @param integer|null $id_grupo Filter by group.
|
||||
* @param boolean $recursion Filter by group recursive.
|
||||
*
|
||||
* @return array With agent module ids.
|
||||
*/
|
||||
function alerts_get_agent_modules(
|
||||
?int $id_grupo,
|
||||
bool $recursion=false
|
||||
) : array {
|
||||
if ($id_grupo === null) {
|
||||
$agent_modules = db_get_all_rows_sql(
|
||||
'SELECT distinct(atm.id_agent_module)
|
||||
FROM talert_template_modules atm
|
||||
INNER JOIN tagente_modulo am
|
||||
ON am.id_agente_modulo = atm.id_agent_module
|
||||
WHERE atm.disabled = 0'
|
||||
);
|
||||
} else if ($recursion !== true) {
|
||||
$sql = sprintf(
|
||||
'SELECT distinct(atm.id_agent_module)
|
||||
FROM talert_template_modules atm
|
||||
INNER JOIN tagente_modulo am
|
||||
ON am.id_agente_modulo = atm.id_agent_module
|
||||
INNER JOIN tagente ta
|
||||
ON am.id_agente = ta.id_agente
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
WHERE atm.disabled = 0
|
||||
AND (tasg.id_group = %d
|
||||
OR ta.id_grupo = %d)
|
||||
',
|
||||
$id_grupo,
|
||||
$id_grupo
|
||||
);
|
||||
$agent_modules = db_get_all_rows_sql($sql);
|
||||
} else {
|
||||
$groups = groups_get_children($id_grupo, true);
|
||||
if (empty($groups) === false) {
|
||||
$groups = array_reduce(
|
||||
$groups,
|
||||
function ($carry, $item) {
|
||||
$carry[] = $item['id_grupo'];
|
||||
return $carry;
|
||||
},
|
||||
[$id_grupo]
|
||||
);
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT distinct(atm.id_agent_module)
|
||||
FROM talert_template_modules atm
|
||||
INNER JOIN tagente_modulo am
|
||||
ON am.id_agente_modulo = atm.id_agent_module
|
||||
INNER JOIN tagente ta
|
||||
ON am.id_agente = ta.id_agente
|
||||
LEFT JOIN tagent_secondary_group tasg
|
||||
ON tasg.id_agent = ta.id_agente
|
||||
WHERE atm.disabled = 0
|
||||
AND (tasg.id_group IN (%s)
|
||||
OR ta.id_grupo IN (%s))
|
||||
',
|
||||
implode(',', $groups),
|
||||
implode(',', $groups)
|
||||
);
|
||||
}
|
||||
|
||||
$agent_modules = db_get_all_rows_sql($sql);
|
||||
}
|
||||
|
||||
if ($agent_modules === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $agent_modules;
|
||||
|
||||
}
|
||||
|
|
|
@ -1217,8 +1217,14 @@ function config_update_config()
|
|||
$error_update[] = __('Default zoom graphs');
|
||||
}
|
||||
|
||||
if (!config_update_value('graph_image_height', (int) get_parameter('graph_image_height', 280))) {
|
||||
$error_update[] = __('Default height of the chart image');
|
||||
if (!config_update_value(
|
||||
'graph_image_height',
|
||||
(int) get_parameter('graph_image_height', 130)
|
||||
)
|
||||
) {
|
||||
$error_update[] = __(
|
||||
'Default height of the chart image'
|
||||
);
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
@ -1324,7 +1330,7 @@ function config_update_config()
|
|||
$error_update[] = __('HTML font size for SLA (em)');
|
||||
}
|
||||
|
||||
if (!config_update_value('global_font_size_report', get_parameter('global_font_size_report', 14))) {
|
||||
if (!config_update_value('global_font_size_report', get_parameter('global_font_size_report', 10))) {
|
||||
$error_update[] = __('PDF font size (px)');
|
||||
}
|
||||
|
||||
|
@ -1987,7 +1993,7 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['font_size'])) {
|
||||
config_update_value('font_size', 6);
|
||||
config_update_value('font_size', 8);
|
||||
}
|
||||
|
||||
if (!isset($config['limit_parameters_massive'])) {
|
||||
|
@ -2057,17 +2063,9 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['fontpath'])) {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
// Windows.
|
||||
$fontpath = $config['homedir'].'\include\fonts\smallfont.ttf';
|
||||
} else {
|
||||
$home = str_replace('\\', '/', $config['homedir']);
|
||||
$fontpath = $home.'/include/fonts/smallfont.ttf';
|
||||
}
|
||||
|
||||
config_update_value(
|
||||
'fontpath',
|
||||
$fontpath
|
||||
'opensans.ttf'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2864,7 +2862,7 @@ function config_process_config()
|
|||
}
|
||||
|
||||
if (!isset($config['graph_image_height'])) {
|
||||
config_update_value('graph_image_height', 280);
|
||||
config_update_value('graph_image_height', 130);
|
||||
}
|
||||
|
||||
if (!isset($config['zoom_graph'])) {
|
||||
|
@ -2919,17 +2917,20 @@ function config_process_config()
|
|||
config_update_value('custom_report_info', 1);
|
||||
}
|
||||
|
||||
// Juanma (06/05/2014) New feature: Custom front page for reports.
|
||||
if (!isset($config['custom_report_front'])) {
|
||||
config_update_value('custom_report_front', 0);
|
||||
}
|
||||
|
||||
if (!isset($config['global_font_size_report'])) {
|
||||
config_update_value('global_font_size_report', 10);
|
||||
}
|
||||
|
||||
if (!isset($config['font_size_item_report'])) {
|
||||
config_update_value('font_size_item_report', 2);
|
||||
}
|
||||
|
||||
if (!isset($config['custom_report_front_font'])) {
|
||||
config_update_value('custom_report_front_font', 'FreeSans.ttf');
|
||||
config_update_value('custom_report_front_font', 'opensans.ttf');
|
||||
}
|
||||
|
||||
if (!isset($config['custom_report_front_logo'])) {
|
||||
|
|
|
@ -512,8 +512,6 @@ function db_get_row_filter($table, $filter, $fields=false, $where_join='AND', $h
|
|||
*
|
||||
* @return mixed The selected field of the first row in a select statement.
|
||||
*/
|
||||
|
||||
|
||||
function db_get_sql($sql, $field=0, $search_history_db=false)
|
||||
{
|
||||
$result = db_get_all_rows_sql($sql, $search_history_db);
|
||||
|
@ -567,25 +565,34 @@ function db_get_all_rows_sql($sql, $search_history_db=false, $cache=true, $dbcon
|
|||
/**
|
||||
* Returns the time the module is in unknown status (by events)
|
||||
*
|
||||
* @param integer $id_agente_modulo module to check
|
||||
* @param integer $tstart begin of search
|
||||
* @param integer $tend end of search
|
||||
* @param integer $id_agente_modulo Module to check.
|
||||
* @param boolean $tstart Begin of search.
|
||||
* @param boolean $tend End of search.
|
||||
* @param boolean $historydb HistoryDb.
|
||||
* @param integer $fix_to_range Range.
|
||||
*
|
||||
* @return array Return array or false.
|
||||
*/
|
||||
function db_get_module_ranges_unknown($id_agente_modulo, $tstart=false, $tend=false, $historydb=false, $fix_to_range=0)
|
||||
{
|
||||
function db_get_module_ranges_unknown(
|
||||
$id_agente_modulo,
|
||||
$tstart=false,
|
||||
$tend=false,
|
||||
$historydb=false,
|
||||
$fix_to_range=0
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if (!isset($id_agente_modulo)) {
|
||||
if (isset($id_agente_modulo) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isset($tstart)) || ($tstart === false)) {
|
||||
// Return data from the begining
|
||||
if ((isset($tstart) === false) || ($tstart === false)) {
|
||||
// Return data from the begining.
|
||||
$tstart = 0;
|
||||
}
|
||||
|
||||
if ((!isset($tend)) || ($tend === false)) {
|
||||
// Return data until now
|
||||
if ((isset($tend) === false) || ($tend === false)) {
|
||||
// Return data until now.
|
||||
$tend = time();
|
||||
}
|
||||
|
||||
|
@ -593,24 +600,49 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart=false, $tend=fa
|
|||
return false;
|
||||
}
|
||||
|
||||
// Retrieve going unknown events in range
|
||||
$query = 'SELECT * FROM tevento WHERE id_agentmodule = '.$id_agente_modulo." AND event_type like 'going_%' "." AND utimestamp >= $tstart AND utimestamp <= $tend ".' ORDER BY utimestamp ASC';
|
||||
// Retrieve going unknown events in range.
|
||||
$query = sprintf(
|
||||
'SELECT *
|
||||
FROM tevento
|
||||
WHERE id_agentmodule = %d
|
||||
AND event_type like "going_%%"
|
||||
AND utimestamp >= %d
|
||||
AND utimestamp <= %d
|
||||
ORDER BY utimestamp ASC
|
||||
',
|
||||
$id_agente_modulo,
|
||||
$tstart,
|
||||
$tend
|
||||
);
|
||||
$events = db_get_all_rows_sql($query, $historydb);
|
||||
|
||||
$query = 'SELECT * FROM tevento WHERE id_agentmodule = '.$id_agente_modulo." AND event_type like 'going_%' "." AND utimestamp < $tstart ".' ORDER BY utimestamp DESC LIMIT 1;';
|
||||
$query = sprintf(
|
||||
'SELECT *
|
||||
FROM tevento
|
||||
WHERE id_agentmodule = %d
|
||||
AND event_type like "going_%%"
|
||||
AND utimestamp < %d
|
||||
ORDER BY utimestamp DESC
|
||||
LIMIT 1
|
||||
',
|
||||
$id_agente_modulo,
|
||||
$tstart
|
||||
);
|
||||
$previous_event = db_get_all_rows_sql($query, $historydb);
|
||||
|
||||
if ($previous_event !== false) {
|
||||
$last_status = $previous_event[0]['event_type'] == 'going_unknown' ? 1 : 0;
|
||||
$last_status = ($previous_event[0]['event_type'] == 'going_unknown') ? 1 : 0;
|
||||
} else {
|
||||
$last_status = 0;
|
||||
}
|
||||
|
||||
if ((! is_array($events)) && (! is_array($previous_event))) {
|
||||
if ((is_array($events) === false)
|
||||
&& (is_array($previous_event) === false)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! is_array($events)) {
|
||||
if (is_array($events) === false) {
|
||||
if ($previous_event[0]['event_type'] == 'going_unknown') {
|
||||
return [
|
||||
[
|
||||
|
@ -622,7 +654,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart=false, $tend=fa
|
|||
|
||||
$return = [];
|
||||
$i = 0;
|
||||
if (is_array($events)) {
|
||||
if (is_array($events) === true) {
|
||||
foreach ($events as $event) {
|
||||
switch ($event['event_type']) {
|
||||
case 'going_up_critical':
|
||||
|
@ -647,11 +679,14 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart=false, $tend=fa
|
|||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Nothing.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($return[0])) {
|
||||
if (isset($return[0]) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -662,10 +697,10 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart=false, $tend=fa
|
|||
/**
|
||||
* Uncompresses and returns the data of a given id_agent_module
|
||||
*
|
||||
* @param integer $id_agente_modulo id_agente_modulo
|
||||
* @param utimestamp $tstart Begin of the catch
|
||||
* @param utimestamp $tend End of the catch
|
||||
* @param integer $interval Size of slice (default-> module_interval)
|
||||
* @param integer $id_agente_modulo Id_agente_modulo.
|
||||
* @param utimestamp $tstart Begin of the catch.
|
||||
* @param utimestamp $tend End of the catch.
|
||||
* @param integer $slice_size Size of slice(default-> module_interval).
|
||||
*
|
||||
* @return hash with the data uncompressed in blocks of module_interval
|
||||
* false in case of empty result
|
||||
|
@ -683,16 +718,20 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart=false, $tend=fa
|
|||
* datos
|
||||
* utimestamp
|
||||
*/
|
||||
function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false, $slice_size=false)
|
||||
{
|
||||
function db_uncompress_module_data(
|
||||
$id_agente_modulo,
|
||||
$tstart=false,
|
||||
$tend=false,
|
||||
$slice_size=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
if (!isset($id_agente_modulo)) {
|
||||
if (isset($id_agente_modulo) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((!isset($tend)) || ($tend === false)) {
|
||||
// Return data until now
|
||||
if ((isset($tend) === false) || ($tend === false)) {
|
||||
// Return data until now.
|
||||
$tend = time();
|
||||
}
|
||||
|
||||
|
@ -705,7 +744,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
|
||||
$module = modules_get_agentmodule($id_agente_modulo);
|
||||
if ($module === false) {
|
||||
// module not exists
|
||||
// Module not exists.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -727,27 +766,34 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
|
||||
$result = modules_get_first_date($id_agente_modulo, $tstart);
|
||||
$first_utimestamp = $result['first_utimestamp'];
|
||||
$search_historydb = $result['search_historydb'];
|
||||
$search_historydb = (isset($result['search_historydb']) === true) ? $result['search_historydb'] : false;
|
||||
|
||||
if ($first_utimestamp === false) {
|
||||
$first_data['utimestamp'] = $tstart;
|
||||
$first_data['datos'] = false;
|
||||
} else {
|
||||
$query = "SELECT datos,utimestamp FROM $table ";
|
||||
$query .= " WHERE id_agente_modulo=$id_agente_modulo ";
|
||||
$query .= ' AND utimestamp = '.$first_utimestamp;
|
||||
$query = sprintf(
|
||||
'SELECT datos,utimestamp
|
||||
FROM %s
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp = %d
|
||||
',
|
||||
$table,
|
||||
$id_agente_modulo,
|
||||
$first_utimestamp
|
||||
);
|
||||
|
||||
$data = db_get_all_rows_sql($query, $search_historydb);
|
||||
|
||||
if ($data === false) {
|
||||
// first utimestamp not found in active database
|
||||
// SEARCH HISTORY DB
|
||||
// First utimestamp not found in active database
|
||||
// SEARCH HISTORY DB.
|
||||
$search_historydb = true;
|
||||
$data = db_get_all_rows_sql($query, $search_historydb);
|
||||
}
|
||||
|
||||
if ($data === false) {
|
||||
// Not init
|
||||
// Not init.
|
||||
$first_data['utimestamp'] = $tstart;
|
||||
$first_data['datos'] = false;
|
||||
} else {
|
||||
|
@ -756,20 +802,31 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
}
|
||||
}
|
||||
|
||||
$query = " SELECT utimestamp, datos FROM $table ";
|
||||
$query .= " WHERE id_agente_modulo=$id_agente_modulo AND utimestamp >= $tstart AND utimestamp <= $tend";
|
||||
$query .= ' ORDER BY utimestamp ASC';
|
||||
// Retrieve all data from module in given range
|
||||
$query = sprintf(
|
||||
'SELECT utimestamp, datos
|
||||
FROM %s
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp >= %d
|
||||
AND utimestamp <= %d
|
||||
ORDER BY utimestamp ASC
|
||||
',
|
||||
$table,
|
||||
$id_agente_modulo,
|
||||
$tstart,
|
||||
$tend
|
||||
);
|
||||
|
||||
// Retrieve all data from module in given range.
|
||||
$raw_data = db_get_all_rows_sql($query, $search_historydb);
|
||||
|
||||
$module_interval = modules_get_interval($id_agente_modulo);
|
||||
|
||||
if (($raw_data === false) && ( $first_utimestamp === false )) {
|
||||
// No data
|
||||
// No data.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Retrieve going unknown events in range
|
||||
// Retrieve going unknown events in range.
|
||||
$unknown_events = db_get_module_ranges_unknown(
|
||||
$id_agente_modulo,
|
||||
$tstart,
|
||||
|
@ -778,16 +835,21 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
1
|
||||
);
|
||||
|
||||
// if time to is missing in last event force time to outside range time
|
||||
if ($unknown_events && !isset($unknown_events[(count($unknown_events) - 1)]['time_to'])) {
|
||||
// If time to is missing in last event force time to outside range time.
|
||||
if ($unknown_events
|
||||
&& isset($unknown_events[(count($unknown_events) - 1)]['time_to']) === false
|
||||
) {
|
||||
$unknown_events[(count($unknown_events) - 1)]['time_to'] = $tend;
|
||||
}
|
||||
|
||||
// if time to is missing in first event force time to outside range time
|
||||
// If time to is missing in first event force time to outside range time.
|
||||
if ($first_data['datos'] === false && !$flag_async) {
|
||||
$last_inserted_value = false;
|
||||
} else if (($unknown_events && !isset($unknown_events[0]['time_from']) && !$flag_async)
|
||||
|| ($first_utimestamp < $tstart - (SECONDS_1DAY + 2 * $module_interval) && !$flag_async)
|
||||
} else if (($unknown_events
|
||||
&& isset($unknown_events[0]['time_from']) === false
|
||||
&& $flag_async === false)
|
||||
|| ($first_utimestamp < $tstart - (SECONDS_1DAY + 2 * $module_interval)
|
||||
&& $flag_async === false)
|
||||
) {
|
||||
$last_inserted_value = $first_data['datos'];
|
||||
$unknown_events[0]['time_from'] = $tstart;
|
||||
|
@ -795,24 +857,24 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
$last_inserted_value = $first_data['datos'];
|
||||
}
|
||||
|
||||
// Retrieve module_interval to build the template
|
||||
// Retrieve module_interval to build the template.
|
||||
if ($slice_size === false) {
|
||||
$slice_size = $module_interval;
|
||||
}
|
||||
|
||||
$return = [];
|
||||
|
||||
// Point current_timestamp to begin of the set and initialize flags
|
||||
// Point current_timestamp to begin of the set and initialize flags.
|
||||
$current_timestamp = $tstart;
|
||||
$last_timestamp = $first_data['utimestamp'];
|
||||
$last_value = $first_data['datos'];
|
||||
|
||||
// reverse array data optimization
|
||||
if (is_array($raw_data)) {
|
||||
// Reverse array data optimization.
|
||||
if (is_array($raw_data) === true) {
|
||||
$raw_data = array_reverse($raw_data);
|
||||
}
|
||||
|
||||
// Build template
|
||||
// Build template.
|
||||
$pool_id = 0;
|
||||
$now = time();
|
||||
|
||||
|
@ -822,7 +884,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
$current_unknown = null;
|
||||
}
|
||||
|
||||
if (is_array($raw_data)) {
|
||||
if (is_array($raw_data) === true) {
|
||||
$current_raw_data = array_pop($raw_data);
|
||||
} else {
|
||||
$current_raw_data = null;
|
||||
|
@ -838,33 +900,34 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
) {
|
||||
$tmp_data['utimestamp'] = $current_timestamp;
|
||||
|
||||
// check not init
|
||||
// Check not init.
|
||||
$tmp_data['datos'] = $last_value === false ? false : null;
|
||||
|
||||
// async not unknown
|
||||
// Async not unknown.
|
||||
if ($flag_async && $tmp_data['datos'] === null) {
|
||||
$tmp_data['datos'] = $last_inserted_value;
|
||||
}
|
||||
|
||||
// debug purpose
|
||||
// $tmp_data["obs"] = "unknown extra";
|
||||
// Debug purpose.
|
||||
// $tmp_data["obs"] = "unknown extra";.
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
}
|
||||
|
||||
// insert raw data
|
||||
// Insert raw data.
|
||||
while (($current_raw_data != null) &&
|
||||
( ($current_timestamp_end > $current_raw_data['utimestamp']) &&
|
||||
($current_timestamp <= $current_raw_data['utimestamp']) ) ) {
|
||||
// Add real data detected
|
||||
// Add real data detected.
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
// insert first slice data
|
||||
// Insert first slice data.
|
||||
$tmp_data['utimestamp'] = $current_timestamp;
|
||||
$tmp_data['datos'] = $last_inserted_value;
|
||||
// debug purpose
|
||||
// $tmp_data["obs"] = "virtual data (raw)";
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "virtual data (raw)";.
|
||||
$tmp_data['type'] = ($current_timestamp == $tstart || ($current_timestamp == $tend) ? 0 : 1);
|
||||
// virtual data
|
||||
// Add order to avoid usort missorder in same utimestamp data cells
|
||||
// Virtual data.
|
||||
// Add order to avoid usort missorder
|
||||
// in same utimestamp data cells.
|
||||
$tmp_data['order'] = 1;
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
}
|
||||
|
@ -872,10 +935,10 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
$tmp_data['utimestamp'] = $current_raw_data['utimestamp'];
|
||||
$tmp_data['datos'] = $current_raw_data['datos'];
|
||||
$tmp_data['type'] = 0;
|
||||
// real data
|
||||
// debug purpose
|
||||
// Real data.
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "real data";
|
||||
// Add order to avoid usort missorder in same utimestamp data cells
|
||||
// Add order to avoid usort missorder in same utimestamp data cells.
|
||||
$tmp_data['order'] = 2;
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
|
||||
|
@ -888,7 +951,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
}
|
||||
}
|
||||
|
||||
// unknown
|
||||
// Unknown.
|
||||
$data_slices = $return[$pool_id]['data'];
|
||||
if (!$flag_async) {
|
||||
while (($current_unknown != null) &&
|
||||
|
@ -899,23 +962,25 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
&& ( $current_timestamp_end >= $current_unknown['time_from'] )
|
||||
) {
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
// insert first slice data
|
||||
// Insert first slice data.
|
||||
$tmp_data['utimestamp'] = $current_timestamp;
|
||||
$tmp_data['datos'] = $last_inserted_value;
|
||||
// debug purpose
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "virtual data (e)";
|
||||
// Add order to avoid usort missorder in same utimestamp data cells
|
||||
// Add order to avoid usort missorder
|
||||
// in same utimestamp data cells.
|
||||
$tmp_data['order'] = 1;
|
||||
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
}
|
||||
|
||||
// Add unknown state detected
|
||||
// Add unknown state detected.
|
||||
$tmp_data['utimestamp'] = $current_unknown['time_from'];
|
||||
$tmp_data['datos'] = null;
|
||||
// debug purpose
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "event data unknown from";
|
||||
// Add order to avoid usort missorder in same utimestamp data cells
|
||||
// Add order to avoid usort missorder
|
||||
// in same utimestamp data cells.
|
||||
$tmp_data['order'] = 2;
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
$current_unknown['time_from'] = null;
|
||||
|
@ -923,19 +988,21 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
&& ($current_timestamp_end > $current_unknown['time_to'] )
|
||||
) {
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
// add first slice data always
|
||||
// insert first slice data
|
||||
// Add first slice data always
|
||||
// Insert first slice data.
|
||||
$tmp_data['utimestamp'] = $current_timestamp;
|
||||
$tmp_data['datos'] = $last_inserted_value;
|
||||
// debug purpose
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "virtual data (event_to)";
|
||||
// Add order to avoid usort missorder in same utimestamp data cells
|
||||
// Add order to avoid usort missorder
|
||||
// in same utimestamp data cells.
|
||||
$tmp_data['order'] = 1;
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
}
|
||||
|
||||
$tmp_data['utimestamp'] = $current_unknown['time_to'];
|
||||
// Add order to avoid usort missorder in same utimestamp data cells
|
||||
// Add order to avoid usort missorder
|
||||
// in same utimestamp data cells.
|
||||
$tmp_data['order'] = 2;
|
||||
$i = count($data_slices);
|
||||
while ($i >= 0) {
|
||||
|
@ -947,8 +1014,8 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
$i--;
|
||||
}
|
||||
|
||||
// debug purpose
|
||||
// $tmp_data["obs"] = "event data unknown to";
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "event data unknown to";.
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
if ($unknown_events) {
|
||||
$current_unknown = array_shift($unknown_events);
|
||||
|
@ -963,15 +1030,15 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
|
||||
$return[$pool_id]['utimestamp'] = $current_timestamp;
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
// insert first slice data
|
||||
// Insert first slice data.
|
||||
$tmp_data['utimestamp'] = $current_timestamp;
|
||||
$tmp_data['datos'] = $last_inserted_value;
|
||||
// debug purpose
|
||||
// $tmp_data["obs"] = "virtual data (empty)";
|
||||
// Debug purpose
|
||||
// $tmp_data["obs"] = "virtual data (empty)";.
|
||||
array_push($return[$pool_id]['data'], $tmp_data);
|
||||
}
|
||||
|
||||
// sort current slice
|
||||
// Sort current slice.
|
||||
if (count($return[$pool_id]['data']) > 1) {
|
||||
usort(
|
||||
$return[$pool_id]['data'],
|
||||
|
@ -985,16 +1052,16 @@ function db_uncompress_module_data($id_agente_modulo, $tstart=false, $tend=false
|
|||
);
|
||||
}
|
||||
|
||||
// put the last slice data like first element of next slice
|
||||
// Put the last slice data like first element of next slice.
|
||||
$last_inserted_value = end($return[$pool_id]['data']);
|
||||
$last_inserted_value = $last_inserted_value['datos'];
|
||||
|
||||
// increment
|
||||
// Increment.
|
||||
$pool_id++;
|
||||
$current_timestamp = $current_timestamp_end;
|
||||
}
|
||||
|
||||
// slice to the end.
|
||||
// Slice to the end.
|
||||
if ($pool_id == 1) {
|
||||
$end_array = [];
|
||||
$end_array['data'][0]['utimestamp'] = $tend;
|
||||
|
|
|
@ -707,7 +707,9 @@ function events_get_all(
|
|||
}
|
||||
|
||||
$count = false;
|
||||
if (!is_array($fields) && $fields == 'count') {
|
||||
if (is_array($fields) === false && $fields === 'count'
|
||||
|| (is_array($fields) === true && $fields[0] === 'count')
|
||||
) {
|
||||
$fields = ['te.*'];
|
||||
$count = true;
|
||||
} else if (!is_array($fields)) {
|
||||
|
@ -877,9 +879,10 @@ function events_get_all(
|
|||
$groups
|
||||
);
|
||||
|
||||
if (!$propagate) {
|
||||
if (!$propagate && isset($groups)) {
|
||||
$sql_filters[] = sprintf(
|
||||
' AND (te.id_grupo = %d OR tasg.id_group = %d)',
|
||||
$groups,
|
||||
$groups
|
||||
);
|
||||
} else {
|
||||
|
@ -1063,6 +1066,7 @@ function events_get_all(
|
|||
}
|
||||
}
|
||||
|
||||
$_tmp = '';
|
||||
foreach ($tags as $id_tag) {
|
||||
if (!isset($tags_names[$id_tag])) {
|
||||
$tags_names[$id_tag] = tags_get_name($id_tag);
|
||||
|
@ -1304,6 +1308,7 @@ function events_get_all(
|
|||
|
||||
$tgrupo_join = 'LEFT';
|
||||
$tgrupo_join_filters = [];
|
||||
|
||||
if (isset($groups)
|
||||
&& (is_array($groups)
|
||||
|| $groups > 0)
|
||||
|
@ -1311,17 +1316,21 @@ function events_get_all(
|
|||
$tgrupo_join = 'INNER';
|
||||
if (is_array($groups)) {
|
||||
$tgrupo_join_filters[] = sprintf(
|
||||
' AND (tg.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
' (te.id_grupo = tg.id_grupo AND tg.id_grupo IN (%s))
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group IN (%s))',
|
||||
join(', ', $groups),
|
||||
join(', ', $groups)
|
||||
);
|
||||
} else {
|
||||
$tgrupo_join_filters[] = sprintf(
|
||||
' AND (tg.id_grupo = %s OR tasg.id_group = %s)',
|
||||
' (te.id_grupo = tg.id_grupo AND tg.id_grupo = %s)
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group = %s)',
|
||||
$groups,
|
||||
$groups
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$tgrupo_join_filters[] = ' te.id_grupo = tg.id_grupo';
|
||||
}
|
||||
|
||||
$server_join = '';
|
||||
|
@ -1376,8 +1385,7 @@ function events_get_all(
|
|||
%s
|
||||
%s
|
||||
%s JOIN tgrupo tg
|
||||
ON te.id_grupo = tg.id_grupo
|
||||
%s
|
||||
ON %s
|
||||
%s
|
||||
WHERE 1=1
|
||||
%s
|
||||
|
@ -1567,7 +1575,9 @@ function events_get_events_no_grouped(
|
|||
|
||||
$table = events_get_events_table($meta, $history);
|
||||
|
||||
$sql = 'SELECT * FROM '.$table.' te WHERE 1=1 '.$sql_post;
|
||||
$sql = 'SELECT * FROM '.$table.' te ';
|
||||
$sql .= events_get_secondary_groups_left_join($table);
|
||||
$sql .= $sql_post;
|
||||
|
||||
$events = db_get_all_rows_sql($sql, $history_db);
|
||||
|
||||
|
@ -1942,7 +1952,7 @@ function events_change_status(
|
|||
*
|
||||
* @param mixed $id_event Event ID or array of events.
|
||||
* @param string $new_owner Id_user of the new owner. If is false, the current
|
||||
* owner will be setted.
|
||||
* owner will be set, if empty, will be cleaned.
|
||||
* @param boolean $force Flag to force the change or not (not force is
|
||||
* change only when it hasn't owner).
|
||||
* @param boolean $meta Metaconsole mode flag.
|
||||
|
@ -1982,11 +1992,10 @@ function events_change_owner(
|
|||
return false;
|
||||
}
|
||||
|
||||
// If no new_owner is provided, the current user will be the owner
|
||||
// * #2250: Comment this lines because if possible selected None owner.
|
||||
// if (empty($new_owner)) {
|
||||
// $new_owner = $config['id_user'];
|
||||
// }
|
||||
if ($new_owner === false) {
|
||||
$new_owner = $config['id_user'];
|
||||
}
|
||||
|
||||
// Only generate comment when is forced (sometimes is owner changes when
|
||||
// comment).
|
||||
if ($force) {
|
||||
|
@ -1995,7 +2004,9 @@ function events_change_owner(
|
|||
'',
|
||||
'Change owner to '.$new_owner,
|
||||
$meta,
|
||||
$history
|
||||
$history,
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2051,13 +2062,14 @@ function events_get_events_table($meta, $history)
|
|||
/**
|
||||
* Comment events in a transresponse
|
||||
*
|
||||
* @param mixed $id_event Event ID or array of events.
|
||||
* @param string $comment Comment to be registered.
|
||||
* @param string $action Action performed with comment. By default just add
|
||||
* a comment.
|
||||
* @param boolean $meta Flag of metaconsole mode.
|
||||
* @param boolean $history Flag of history mode.
|
||||
* @param boolean $similars Similars.
|
||||
* @param mixed $id_event Event ID or array of events.
|
||||
* @param string $comment Comment to be registered.
|
||||
* @param string $action Action performed with comment. By default just add
|
||||
* a comment.
|
||||
* @param boolean $meta Flag of metaconsole mode.
|
||||
* @param boolean $history Flag of history mode.
|
||||
* @param boolean $similars Similars.
|
||||
* @param boolean $update_owner Update owner.
|
||||
*
|
||||
* @return boolean Whether or not it was successful
|
||||
*/
|
||||
|
@ -2067,7 +2079,8 @@ function events_comment(
|
|||
$action='Added comment',
|
||||
$meta=false,
|
||||
$history=false,
|
||||
$similars=true
|
||||
$similars=true,
|
||||
$update_owner=true
|
||||
) {
|
||||
global $config;
|
||||
|
||||
|
@ -2095,8 +2108,10 @@ function events_comment(
|
|||
return false;
|
||||
}
|
||||
|
||||
// If the event hasn't owner, assign the user as owner.
|
||||
events_change_owner($id_event);
|
||||
if ($update_owner) {
|
||||
// If the event hasn't owner, assign the user as owner.
|
||||
events_change_owner($id_event);
|
||||
}
|
||||
|
||||
// Get the current event comments.
|
||||
$first_event = $id_event;
|
||||
|
@ -2975,9 +2990,13 @@ function events_get_agent(
|
|||
|
||||
if ($events_group) {
|
||||
$sql_where .= sprintf(
|
||||
' AND id_grupo IN (%s) AND utimestamp > %d
|
||||
AND utimestamp <= %d ',
|
||||
implode(',', $id_group),
|
||||
' INNER JOIN tgrupo tg
|
||||
ON (te.id_grupo = tg.id_grupo AND tg.id_grupo = %s)
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group = %s)
|
||||
WHERE utimestamp > %d
|
||||
AND utimestamp <= %d ',
|
||||
join(',', $id_group),
|
||||
join(',', $id_group),
|
||||
$datelimit,
|
||||
$date
|
||||
);
|
||||
|
@ -5013,20 +5032,26 @@ function events_get_count_events_by_agent(
|
|||
$tevento = 'tevento';
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_agente,
|
||||
(SELECT t2.alias
|
||||
FROM %s t2
|
||||
WHERE t2.id_agente = t3.id_agente) AS agent_name,
|
||||
COUNT(*) AS count
|
||||
FROM %s t3
|
||||
'SELECT
|
||||
ta.id_agente,
|
||||
ta.alias as agent_name,
|
||||
count(*) as count
|
||||
FROM %s te
|
||||
%s
|
||||
INNER JOIN %s ta
|
||||
ON te.id_agente = ta.id_agente
|
||||
INNER JOIN tgrupo tg
|
||||
ON (te.id_grupo = tg.id_grupo AND tg.id_grupo IN (%s))
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group IN (%s))
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
AND id_grupo IN (%s)
|
||||
GROUP BY id_agente',
|
||||
$tagente,
|
||||
GROUP BY ta.id_agente',
|
||||
$tevento,
|
||||
events_get_secondary_groups_left_join($tevento),
|
||||
$tagente,
|
||||
implode(',', $id_group),
|
||||
implode(',', $id_group),
|
||||
$datelimit,
|
||||
$date,
|
||||
implode(',', $id_group),
|
||||
$sql_where
|
||||
);
|
||||
|
||||
|
@ -5077,8 +5102,10 @@ function events_get_count_events_validated_by_user(
|
|||
$dbmeta=false
|
||||
) {
|
||||
global $config;
|
||||
$tevento = 'tevento';
|
||||
|
||||
// Group.
|
||||
$sql_filter = ' AND 1=1 ';
|
||||
$tgroup_join = '';
|
||||
if (isset($filter['id_group'])) {
|
||||
$id_group = groups_safe_acl($config['id_user'], $filter['id_group'], 'AR');
|
||||
|
||||
|
@ -5087,7 +5114,15 @@ function events_get_count_events_validated_by_user(
|
|||
return false;
|
||||
}
|
||||
|
||||
$sql_filter .= sprintf(' AND id_grupo IN (%s) ', implode(',', $id_group));
|
||||
$tgroup_join = sprintf(
|
||||
'%s
|
||||
INNER JOIN tgrupo tg
|
||||
ON (te.id_grupo = tg.id_grupo AND tg.id_grupo IN (%s))
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group IN (%s))',
|
||||
events_get_secondary_groups_left_join($tevento),
|
||||
implode(',', $id_group),
|
||||
implode(',', $id_group)
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($filter['id_agent'])) {
|
||||
|
@ -5186,24 +5221,29 @@ function events_get_count_events_validated_by_user(
|
|||
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
|
||||
}
|
||||
|
||||
$tevento = 'tevento';
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT id_usuario,
|
||||
(SELECT t2.fullname
|
||||
FROM tusuario t2
|
||||
WHERE t2.id_user = t3.id_usuario) AS user_name,
|
||||
COUNT(*) AS count
|
||||
FROM %s t3
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
%s %s
|
||||
GROUP BY id_usuario',
|
||||
'SELECT
|
||||
te.id_usuario,
|
||||
tu.fullname as user_name,
|
||||
count(*) as count
|
||||
FROM %s te
|
||||
%s
|
||||
LEFT JOIN tusuario tu
|
||||
ON te.owner_user = tu.id_user
|
||||
WHERE
|
||||
te.utimestamp > %d AND te.utimestamp <= %d
|
||||
AND te.estado = %d
|
||||
%s
|
||||
GROUP BY te.id_usuario',
|
||||
$tevento,
|
||||
$tgroup_join,
|
||||
$datelimit,
|
||||
$date,
|
||||
EVENT_VALIDATE,
|
||||
$sql_filter,
|
||||
$sql_where
|
||||
);
|
||||
|
||||
$rows = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($rows == false) {
|
||||
|
@ -5214,7 +5254,7 @@ function events_get_count_events_validated_by_user(
|
|||
foreach ($rows as $row) {
|
||||
$user_name = $row['user_name'];
|
||||
if (empty($row['user_name'])) {
|
||||
$user_name = __('Unknown');
|
||||
$user_name = __('Validated but not assigned');
|
||||
}
|
||||
|
||||
$return[$user_name] = $row['count'];
|
||||
|
@ -5252,7 +5292,10 @@ function events_get_count_events_by_criticity(
|
|||
) {
|
||||
global $config;
|
||||
|
||||
$sql_filter = ' AND 1=1 ';
|
||||
$tevento = 'tevento';
|
||||
|
||||
$sql_filter = '';
|
||||
$tgroup_join = '';
|
||||
if (isset($filter['id_group'])) {
|
||||
$id_group = groups_safe_acl($config['id_user'], $filter['id_group'], 'AR');
|
||||
|
||||
|
@ -5261,7 +5304,15 @@ function events_get_count_events_by_criticity(
|
|||
return false;
|
||||
}
|
||||
|
||||
$sql_filter .= sprintf(' AND id_grupo IN (%s) ', implode(',', $id_group));
|
||||
$tgroup_join = sprintf(
|
||||
'%s
|
||||
INNER JOIN tgrupo tg
|
||||
ON (te.id_grupo = tg.id_grupo AND tg.id_grupo IN (%s))
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group IN (%s))',
|
||||
events_get_secondary_groups_left_join($tevento),
|
||||
implode(',', $id_group),
|
||||
implode(',', $id_group)
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($filter['id_agent'])) {
|
||||
|
@ -5361,16 +5412,19 @@ function events_get_count_events_by_criticity(
|
|||
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
|
||||
}
|
||||
|
||||
$tevento = 'tevento';
|
||||
|
||||
$sql = sprintf(
|
||||
'SELECT criticity,
|
||||
COUNT(*) AS count
|
||||
FROM %s
|
||||
WHERE utimestamp > %d AND utimestamp <= %d
|
||||
%s %s
|
||||
GROUP BY criticity',
|
||||
'SELECT
|
||||
te.criticity,
|
||||
count(*) as count
|
||||
FROM %s te
|
||||
%s
|
||||
WHERE
|
||||
te.utimestamp > %d AND te.utimestamp <= %d
|
||||
%s
|
||||
%s
|
||||
GROUP BY te.id_usuario',
|
||||
$tevento,
|
||||
$tgroup_join,
|
||||
$datelimit,
|
||||
$date,
|
||||
$sql_filter,
|
||||
|
@ -5419,23 +5473,26 @@ function events_get_count_events_validated(
|
|||
$dbmeta=false
|
||||
) {
|
||||
global $config;
|
||||
$tevento = 'tevento';
|
||||
|
||||
// Group.
|
||||
$sql_filter = ' 1=1 ';
|
||||
$sql_filter = '';
|
||||
$tgroup_join = '';
|
||||
if (isset($filter['id_group'])) {
|
||||
$id_group = groups_safe_acl(
|
||||
$config['id_user'],
|
||||
$filter['id_group'],
|
||||
'AR'
|
||||
);
|
||||
$id_group = groups_safe_acl($config['id_user'], $filter['id_group'], 'AR');
|
||||
|
||||
if (empty($id_group)) {
|
||||
// An empty array means the user doesn't have access.
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql_filter .= sprintf(
|
||||
' AND id_grupo IN (%s) ',
|
||||
$tgroup_join = sprintf(
|
||||
'%s
|
||||
INNER JOIN tgrupo tg
|
||||
ON (te.id_grupo = tg.id_grupo AND tg.id_grupo IN (%s))
|
||||
OR (tg.id_grupo = tasg.id_group AND tasg.id_group IN (%s))',
|
||||
events_get_secondary_groups_left_join($tevento),
|
||||
implode(',', $id_group),
|
||||
implode(',', $id_group)
|
||||
);
|
||||
}
|
||||
|
@ -5566,9 +5623,24 @@ function events_get_count_events_validated(
|
|||
$sql_where .= ' AND (evento LIKE "%'.io_safe_input($filter_event_filter_search).'%" OR id_evento LIKE "%'.io_safe_input($filter_event_filter_search).'%")';
|
||||
}
|
||||
|
||||
$tevento = 'tevento';
|
||||
|
||||
$sql = sprintf('SELECT estado, COUNT(*) AS count FROM %s WHERE %s %s GROUP BY estado', $tevento, $sql_filter, $sql_where);
|
||||
$sql = sprintf(
|
||||
'SELECT
|
||||
te.estado,
|
||||
count(*) as count
|
||||
FROM %s te
|
||||
%s
|
||||
WHERE
|
||||
te.utimestamp > %d AND te.utimestamp <= %d
|
||||
%s
|
||||
%s
|
||||
GROUP BY te.id_usuario',
|
||||
$tevento,
|
||||
$tgroup_join,
|
||||
$datelimit,
|
||||
$date,
|
||||
$sql_filter,
|
||||
$sql_where
|
||||
);
|
||||
|
||||
$rows = db_get_all_rows_sql($sql);
|
||||
|
||||
|
|
|
@ -3710,15 +3710,22 @@ function grafico_eventos_usuario($width, $height)
|
|||
|
||||
|
||||
/**
|
||||
* Print a custom SQL-defined graph
|
||||
* Undocumented function
|
||||
*
|
||||
* @param integer ID of report content, used to get SQL code to get information for graph
|
||||
* @param integer height graph height
|
||||
* @param integer width graph width
|
||||
* @param integer Graph type 1 vbar, 2 hbar, 3 pie
|
||||
* @param array $content ID of report content
|
||||
* used to get SQL code to get information for graph.
|
||||
* @param integer $width Graph width.
|
||||
* @param integer $height Graph height.
|
||||
* @param string $type Graph type 1 vbar, 2 hbar, 3 pie.
|
||||
* @param boolean $only_image Only image.
|
||||
* @param string $homeurl Url.
|
||||
* @param integer $ttl Ttl.
|
||||
* @param integer $max_num_elements Max elements.
|
||||
*
|
||||
* @return string Graph.
|
||||
*/
|
||||
function graph_custom_sql_graph(
|
||||
$id,
|
||||
$content,
|
||||
$width,
|
||||
$height,
|
||||
$type='sql_graph_vbar',
|
||||
|
@ -3731,26 +3738,41 @@ function graph_custom_sql_graph(
|
|||
|
||||
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() && $content['server_name'] !== '0') {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
metaconsole_connect($connection);
|
||||
}
|
||||
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $id);
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $content['id_rc']);
|
||||
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
|
||||
$report_content = db_get_row(
|
||||
'treport_content_template',
|
||||
'id_rc',
|
||||
$content['id_rc']
|
||||
);
|
||||
}
|
||||
|
||||
if ($report_content == false || $report_content == '') {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
$report_content = db_get_row('treport_content', 'id_rc', $id);
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row('treport_content_template', 'id_rc', $id);
|
||||
if (is_metaconsole() && $content['server_name'] !== '0') {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$report_content = db_get_row(
|
||||
'treport_content',
|
||||
'id_rc',
|
||||
$content['id_rc']
|
||||
);
|
||||
if ($report_content == false || $report_content == '') {
|
||||
$report_content = db_get_row(
|
||||
'treport_content_template',
|
||||
'id_rc',
|
||||
$content['id_rc']
|
||||
);
|
||||
}
|
||||
|
||||
if ((is_metaconsole() & $content['server_name']) !== '0') {
|
||||
$server = metaconsole_get_connection_names();
|
||||
$connection = metaconsole_get_connection($server);
|
||||
metaconsole_connect($connection);
|
||||
|
@ -3758,7 +3780,9 @@ function graph_custom_sql_graph(
|
|||
}
|
||||
|
||||
if ($id != null) {
|
||||
$historical_db = db_get_value_sql('SELECT historical_db from treport_content where id_rc ='.$id);
|
||||
$historical_db = db_get_value_sql(
|
||||
'SELECT historical_db from treport_content where id_rc ='.$content['id_rc']
|
||||
);
|
||||
} else {
|
||||
$historical_db = $content['historical_db'];
|
||||
}
|
||||
|
@ -3766,13 +3790,17 @@ function graph_custom_sql_graph(
|
|||
if ($report_content['external_source'] != '') {
|
||||
$sql = io_safe_output($report_content['external_source']);
|
||||
} else {
|
||||
$sql = db_get_row('treport_custom_sql', 'id', $report_content['treport_custom_sql_id']);
|
||||
$sql = db_get_row(
|
||||
'treport_custom_sql',
|
||||
'id',
|
||||
$report_content['treport_custom_sql_id']
|
||||
);
|
||||
$sql = io_safe_output($sql['sql']);
|
||||
}
|
||||
|
||||
$data_result = db_get_all_rows_sql($sql, $historical_db);
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if ((is_metaconsole() & $content['server_name']) !== '0') {
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
}
|
||||
|
||||
|
@ -3787,24 +3815,32 @@ function graph_custom_sql_graph(
|
|||
foreach ($data_result as $data_item) {
|
||||
$count++;
|
||||
$value = 0;
|
||||
if (!empty($data_item['value'])) {
|
||||
if (empty($data_item['value']) === false) {
|
||||
$value = $data_item['value'];
|
||||
}
|
||||
|
||||
if ($count <= $max_num_elements) {
|
||||
$label = __('Data');
|
||||
if (!empty($data_item['label'])) {
|
||||
if (empty($data_item['label']) === false) {
|
||||
$label = io_safe_output($data_item['label']);
|
||||
if (strlen($label) > $SQL_GRAPH_MAX_LABEL_SIZE) {
|
||||
$first_label = $label;
|
||||
$label = substr($first_label, 0, floor($SQL_GRAPH_MAX_LABEL_SIZE / 2));
|
||||
$label = substr(
|
||||
$first_label,
|
||||
0,
|
||||
floor($SQL_GRAPH_MAX_LABEL_SIZE / 2)
|
||||
);
|
||||
$label .= '...';
|
||||
$label .= substr($first_label, floor(-$SQL_GRAPH_MAX_LABEL_SIZE / 2));
|
||||
$label .= substr(
|
||||
$first_label,
|
||||
floor(-$SQL_GRAPH_MAX_LABEL_SIZE / 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar':
|
||||
default:
|
||||
// Vertical bar.
|
||||
$data[] = [
|
||||
'tick' => $label.'_'.$count,
|
||||
|
@ -3813,18 +3849,19 @@ function graph_custom_sql_graph(
|
|||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
// horizontal bar
|
||||
// Horizontal bar.
|
||||
$data[$label.'_'.$count]['g'] = $value;
|
||||
break;
|
||||
|
||||
case 'sql_graph_pie':
|
||||
// Pie
|
||||
// Pie.
|
||||
$data[$label.'_'.$count] = $value;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar':
|
||||
default:
|
||||
// Vertical bar.
|
||||
if ($flagOther === false) {
|
||||
$data[] = [
|
||||
|
@ -3839,8 +3876,8 @@ function graph_custom_sql_graph(
|
|||
break;
|
||||
|
||||
case 'sql_graph_hbar':
|
||||
// horizontal bar
|
||||
if (!isset($data[__('Other')]['g'])) {
|
||||
// Horizontal bar.
|
||||
if (isset($data[__('Other')]['g']) === false) {
|
||||
$data[__('Other')]['g'] = 0;
|
||||
}
|
||||
|
||||
|
@ -3848,8 +3885,8 @@ function graph_custom_sql_graph(
|
|||
break;
|
||||
|
||||
case 'sql_graph_pie':
|
||||
// Pie
|
||||
if (!isset($data[__('Other')])) {
|
||||
// Pie.
|
||||
if (isset($data[__('Other')]) === false) {
|
||||
$data[__('Other')] = 0;
|
||||
}
|
||||
|
||||
|
@ -3862,12 +3899,18 @@ function graph_custom_sql_graph(
|
|||
if ($config['fixed_graph'] == false) {
|
||||
$water_mark = [
|
||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||
'url' => ui_get_full_url('images/logo_vertical_water.png', false, false, false),
|
||||
'url' => ui_get_full_url(
|
||||
'images/logo_vertical_water.png',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar':
|
||||
default:
|
||||
// Vertical bar.
|
||||
$color = color_graph_array();
|
||||
|
||||
|
@ -3897,7 +3940,7 @@ function graph_custom_sql_graph(
|
|||
|
||||
break;
|
||||
case 'sql_graph_hbar':
|
||||
// horizontal bar
|
||||
// Horizontal bar.
|
||||
return hbar_graph(
|
||||
$data,
|
||||
$width,
|
||||
|
@ -3920,7 +3963,7 @@ function graph_custom_sql_graph(
|
|||
|
||||
break;
|
||||
case 'sql_graph_pie':
|
||||
// Pie
|
||||
// Pie.
|
||||
return pie_graph(
|
||||
$data,
|
||||
$width,
|
||||
|
|
|
@ -514,6 +514,11 @@ function html_print_select_groups(
|
|||
}
|
||||
}
|
||||
|
||||
if (empty($nothing) === false) {
|
||||
$fields[$nothing_value] = $nothing;
|
||||
$include_groups[$nothing_value] = $nothing;
|
||||
}
|
||||
|
||||
if (is_array($delete_groups) === true) {
|
||||
$json_exclusions = json_encode($delete_groups);
|
||||
}
|
||||
|
|
|
@ -3780,6 +3780,7 @@ function agents_get_network_interfaces_array(
|
|||
'height' => $config['graph_image_height'],
|
||||
'landscape' => $content['landscape'],
|
||||
'return_img_base_64' => true,
|
||||
'backgroundColor' => 'transparent',
|
||||
'graph_render' => $content['graph_render'],
|
||||
];
|
||||
|
||||
|
@ -3909,30 +3910,10 @@ function reporting_alert_report_group($report, $content)
|
|||
$return['description'] = $content['description'];
|
||||
$return['date'] = reporting_get_date_text($report, $content);
|
||||
|
||||
if ($content['id_group'] == 0) {
|
||||
$agent_modules = db_get_all_rows_sql(
|
||||
'
|
||||
SELECT distinct(id_agent_module)
|
||||
FROM talert_template_modules
|
||||
WHERE disabled = 0
|
||||
AND id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo)'
|
||||
);
|
||||
} else {
|
||||
$agent_modules = db_get_all_rows_sql(
|
||||
'
|
||||
SELECT distinct(id_agent_module)
|
||||
FROM talert_template_modules
|
||||
WHERE disabled = 0
|
||||
AND id_agent_module IN (
|
||||
SELECT id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE id_agente IN (
|
||||
SELECT id_agente
|
||||
FROM tagente WHERE id_grupo = '.$content['id_group'].'))'
|
||||
);
|
||||
}
|
||||
$agent_modules = alerts_get_agent_modules(
|
||||
$content['id_group'],
|
||||
$content['recursion']
|
||||
);
|
||||
|
||||
if (empty($alerts)) {
|
||||
$alerts = [];
|
||||
|
@ -4387,6 +4368,18 @@ function reporting_alert_report_module($report, $content)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sql graph.
|
||||
*
|
||||
* @param array $report Info report.
|
||||
* @param array $content Content.
|
||||
* @param string $type Type.
|
||||
* @param integer $force_width_chart Width.
|
||||
* @param integer $force_height_chart Height.
|
||||
* @param string $type_sql_graph Type.
|
||||
*
|
||||
* @return array Return array.
|
||||
*/
|
||||
function reporting_sql_graph(
|
||||
$report,
|
||||
$content,
|
||||
|
@ -4399,6 +4392,7 @@ function reporting_sql_graph(
|
|||
|
||||
switch ($type_sql_graph) {
|
||||
case 'sql_graph_hbar':
|
||||
default:
|
||||
$return['type'] = 'sql_graph_hbar';
|
||||
break;
|
||||
|
||||
|
@ -4411,9 +4405,10 @@ function reporting_sql_graph(
|
|||
break;
|
||||
}
|
||||
|
||||
if (empty($content['name'])) {
|
||||
if (empty($content['name']) === true) {
|
||||
switch ($type_sql_graph) {
|
||||
case 'sql_graph_vbar':
|
||||
default:
|
||||
$content['name'] = __('SQL Graph Vertical Bars');
|
||||
break;
|
||||
|
||||
|
@ -4428,13 +4423,20 @@ function reporting_sql_graph(
|
|||
}
|
||||
|
||||
// Get chart.
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl);
|
||||
reporting_set_conf_charts(
|
||||
$width,
|
||||
$height,
|
||||
$only_image,
|
||||
$type,
|
||||
$content,
|
||||
$ttl
|
||||
);
|
||||
|
||||
if (!empty($force_width_chart)) {
|
||||
if (empty($force_width_chart) === false) {
|
||||
$width = $force_width_chart;
|
||||
}
|
||||
|
||||
if (!empty($force_height_chart)) {
|
||||
if (empty($force_height_chart) === false) {
|
||||
$height = $force_height_chart;
|
||||
}
|
||||
|
||||
|
@ -4450,7 +4452,7 @@ function reporting_sql_graph(
|
|||
WHERE id_graph = '.$content['id_gs']
|
||||
);
|
||||
|
||||
if (isset($module_source) && is_array($module_source)) {
|
||||
if (isset($module_source) === true && is_array($module_source) === true) {
|
||||
$modules = [];
|
||||
foreach ($module_source as $key => $value) {
|
||||
$modules[$key] = $value['id_agent_module'];
|
||||
|
@ -4460,8 +4462,9 @@ function reporting_sql_graph(
|
|||
switch ($type) {
|
||||
case 'dinamic':
|
||||
case 'static':
|
||||
default:
|
||||
$return['chart'] = graph_custom_sql_graph(
|
||||
$content['id_rc'],
|
||||
$content,
|
||||
$width,
|
||||
$height,
|
||||
$content['type'],
|
||||
|
@ -8257,6 +8260,7 @@ function reporting_custom_graph(
|
|||
'height' => $config['graph_image_height'],
|
||||
'landscape' => $content['landscape'],
|
||||
'return_img_base_64' => true,
|
||||
'backgroundColor' => 'transparent',
|
||||
];
|
||||
|
||||
$params_combined = [
|
||||
|
@ -8593,6 +8597,7 @@ function reporting_set_conf_charts(
|
|||
) {
|
||||
switch ($type) {
|
||||
case 'dinamic':
|
||||
default:
|
||||
$only_image = false;
|
||||
$width = 900;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
|
||||
|
@ -8602,25 +8607,17 @@ function reporting_set_conf_charts(
|
|||
case 'static':
|
||||
$ttl = 2;
|
||||
$only_image = true;
|
||||
$height = 360;
|
||||
$height = isset($content['style']['dyn_height']) ? $content['style']['dyn_height'] : 230;
|
||||
$width = 780;
|
||||
break;
|
||||
|
||||
case 'data':
|
||||
// Nothing.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
// MAYBE MOVE THE NEXT FUNCTIONS TO A FILE NAMED AS FUNCTION_REPORTING.UTILS.PHP //
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Get a detailed report of summarized events per agent
|
||||
*
|
||||
|
|
|
@ -2788,7 +2788,7 @@ function reporting_html_graph($table, $item)
|
|||
{
|
||||
$table->colspan['chart']['cell'] = 3;
|
||||
$table->cellstyle['chart']['cell'] = 'text-align: center;';
|
||||
$table->data['chart']['cell'] = $item['chart'].'<br><br><br><br>';
|
||||
$table->data['chart']['cell'] = $item['chart'];
|
||||
}
|
||||
|
||||
|
||||
|
@ -3435,12 +3435,12 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table_row[] = '--';
|
||||
} else {
|
||||
$table_row[] = $row['agent'];
|
||||
$item = $row['availability_item'];
|
||||
$item_name = $row['availability_item'];
|
||||
if ((bool) $row['compare'] === true) {
|
||||
$item .= ' ('.__('24 x 7').')';
|
||||
$item_name .= ' ('.__('24 x 7').')';
|
||||
}
|
||||
|
||||
$table_row[] = $item;
|
||||
$table_row[] = $item_name;
|
||||
}
|
||||
|
||||
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
|
||||
|
@ -3568,12 +3568,12 @@ function reporting_html_availability($table, $item, $pdf=0)
|
|||
$table_row2[] = '--';
|
||||
} else {
|
||||
$table_row2[] = $row['agent'];
|
||||
$item = $row['availability_item'];
|
||||
$item_name = $row['availability_item'];
|
||||
if ((bool) $row['compare'] === true) {
|
||||
$item .= ' ('.__('24 x 7').')';
|
||||
$item_name .= ' ('.__('24 x 7').')';
|
||||
}
|
||||
|
||||
$table_row2[] = $item;
|
||||
$table_row2[] = $item_name;
|
||||
}
|
||||
|
||||
if ($item['fields']['total_checks']) {
|
||||
|
|
|
@ -528,7 +528,7 @@ $.fn.VUseTooltip = function() {
|
|||
previousLabel = item.series.label;
|
||||
$("#tooltip").remove();
|
||||
|
||||
var x = item.datapoint[0];
|
||||
//var x = item.datapoint[0];
|
||||
|
||||
var y = item.datapoint[1];
|
||||
if (typeof y != "string") {
|
||||
|
@ -2428,63 +2428,27 @@ function pandoraFlotArea(
|
|||
unit
|
||||
);
|
||||
} else {
|
||||
var min_y_array;
|
||||
var min_y = 0;
|
||||
var min_bigger = "";
|
||||
var max_y_array;
|
||||
var max_y = 0;
|
||||
var max_bigger = "";
|
||||
var avg_y_array;
|
||||
var avg_y = 0;
|
||||
var avg_bigger = "";
|
||||
|
||||
$.each(update_legend, function(index, value) {
|
||||
if (!value[x]) {
|
||||
x = x + 1;
|
||||
if (typeof value[x] !== "undefined") {
|
||||
data_legend[index] =
|
||||
" Min: " +
|
||||
number_format(value[x].min, 0, unit, short_data, divisor) +
|
||||
" Max: " +
|
||||
number_format(value[x].max, 0, unit, short_data, divisor) +
|
||||
" Avg: " +
|
||||
number_format(value[x].avg, 0, unit, short_data, divisor);
|
||||
}
|
||||
if (typeof value[x].min !== "undefined" && value[x].min) {
|
||||
min_y_array = format_unit_yaxes(value[x].min);
|
||||
min_y = min_y_array["y"];
|
||||
min_bigger = min_y_array["unit"];
|
||||
} else {
|
||||
min_y = 0;
|
||||
min_bigger = "";
|
||||
}
|
||||
|
||||
if (typeof value[x].max !== "undefined" && value[x].max) {
|
||||
max_y_array = format_unit_yaxes(value[x].max);
|
||||
max_y = max_y_array["y"];
|
||||
max_bigger = max_y_array["unit"];
|
||||
} else {
|
||||
max_y = 0;
|
||||
max_bigger = "";
|
||||
}
|
||||
|
||||
if (typeof value[x].avg !== "undefined" && value[x].avg) {
|
||||
avg_y_array = format_unit_yaxes(value[x].avg);
|
||||
avg_y = avg_y_array["y"];
|
||||
avg_bigger = avg_y_array["unit"];
|
||||
} else {
|
||||
avg_y = 0;
|
||||
avg_bigger = "";
|
||||
}
|
||||
|
||||
data_legend[index] =
|
||||
" Min: " +
|
||||
number_format(value[x].min, 0, unit, short_data, divisor) +
|
||||
" Max: " +
|
||||
number_format(value[x].max, 0, unit, short_data, divisor) +
|
||||
" Avg: " +
|
||||
number_format(value[x].avg, 0, unit, short_data, divisor);
|
||||
});
|
||||
|
||||
label_aux =
|
||||
legend[series.label].split(": Min")[0] +
|
||||
": " +
|
||||
data_legend[series.label];
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
.html(label_aux);
|
||||
if (typeof data_legend[series.label] !== "undefined") {
|
||||
label_aux =
|
||||
legend[series.label].split(": Min")[0] +
|
||||
": " +
|
||||
data_legend[series.label];
|
||||
$("#legend_" + graph_id + " .legendLabel")
|
||||
.eq(i)
|
||||
.html(label_aux);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2700,7 +2664,15 @@ function pandoraFlotArea(
|
|||
}
|
||||
|
||||
function lFormatter(v) {
|
||||
return '<span style="color:' + legend_color + '">' + legend[v] + "</span>";
|
||||
var style =
|
||||
"color:" +
|
||||
legend_color +
|
||||
"; font-family:" +
|
||||
font +
|
||||
"Font; font-size:" +
|
||||
(parseInt(font_size) + 2) +
|
||||
"px;";
|
||||
return '<span style="' + style + '">' + legend[v] + "</span>";
|
||||
}
|
||||
|
||||
$("#overview_" + graph_id).css("display", "none");
|
||||
|
|
|
@ -376,10 +376,22 @@ function menu_graph(
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
// Prints a FLOT pie chart
|
||||
/**
|
||||
* Pie chart.
|
||||
*
|
||||
* @param array $values Values.
|
||||
* @param array $labels Labels.
|
||||
* @param integer $width Width.
|
||||
* @param integer $height Height.
|
||||
* @param boolean $water_mark Water mark.
|
||||
* @param string $font Font.
|
||||
* @param integer $font_size Font Size.
|
||||
* @param string $legend_position Psition Legend.
|
||||
* @param string $colors Array Colors.
|
||||
* @param boolean $hide_labels Hide labels.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function flot_pie_chart(
|
||||
$values,
|
||||
$labels,
|
||||
|
@ -392,9 +404,9 @@ function flot_pie_chart(
|
|||
$colors='',
|
||||
$hide_labels=false
|
||||
) {
|
||||
// include_javascript_dependencies_flot_graph();
|
||||
$series = sizeof($values);
|
||||
if (($series != sizeof($labels)) || ($series == 0)) {
|
||||
$series = count($values);
|
||||
|
||||
if (($series !== count($labels)) || ($series === 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -407,11 +419,11 @@ function flot_pie_chart(
|
|||
|
||||
case 'right':
|
||||
default:
|
||||
// TODO FOR TOP OR LEFT OR RIGHT
|
||||
// TODO FOR TOP OR LEFT OR RIGHT.
|
||||
break;
|
||||
}
|
||||
|
||||
$return = "<div id='$graph_id' class='graph' style='width: ".$width.'px; height: '.$height."px;'></div>";
|
||||
$return = "<div id='".$graph_id."' class='graph' style='width: ".$width.'px; height: '.$height."px;'></div>";
|
||||
|
||||
if ($water_mark != '') {
|
||||
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
|
||||
|
@ -424,15 +436,24 @@ function flot_pie_chart(
|
|||
|
||||
$labels = implode($separator, $labels);
|
||||
$values = implode($separator, $values);
|
||||
if (!empty($colors)) {
|
||||
if (empty($colors) === false) {
|
||||
$colors = implode($separator, $colors);
|
||||
}
|
||||
|
||||
// include_javascript_dependencies_flot_graph();
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "pandoraFlotPie('$graph_id', '$values', '$labels',
|
||||
'$series', '$width', $font_size, $water_mark, '$separator',
|
||||
'$legend_position', '$height', '$colors', ".json_encode($hide_labels).')';
|
||||
$return .= "pandoraFlotPie(
|
||||
'$graph_id',
|
||||
'$values',
|
||||
'$labels',
|
||||
'$series',
|
||||
'$width',
|
||||
$font_size,
|
||||
$water_mark,
|
||||
'$separator',
|
||||
'$legend_position',
|
||||
'$height',
|
||||
'$colors',
|
||||
".json_encode($hide_labels).')';
|
||||
$return .= '</script>';
|
||||
|
||||
return $return;
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
<?php
|
||||
/**
|
||||
* Event entity class.
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage OpenSource
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Begin.
|
||||
namespace PandoraFMS;
|
||||
|
||||
global $config;
|
||||
require_once $config['homedir'].'/include/functions_events.php';
|
||||
|
||||
/**
|
||||
* PandoraFMS Group entity.
|
||||
*/
|
||||
class Event extends Entity
|
||||
{
|
||||
|
||||
/**
|
||||
* List of available ajax methods.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $ajaxMethods = [];
|
||||
|
||||
|
||||
/**
|
||||
* Builds a PandoraFMS\Group object from a group id.
|
||||
*
|
||||
* @param integer $id_group Group Id.
|
||||
*/
|
||||
public function __construct(?int $id_group=null)
|
||||
{
|
||||
$table = 'tevento';
|
||||
if ((bool) \is_metaconsole() === true) {
|
||||
$table = 'tmetaconsole_event';
|
||||
}
|
||||
|
||||
if ($id_group === 0) {
|
||||
parent::__construct($table);
|
||||
} else if (is_numeric($id_group) === true) {
|
||||
parent::__construct($table, ['id_grupo' => $id_group]);
|
||||
} else {
|
||||
// Empty skel.
|
||||
parent::__construct($table);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves all events matching given filters.
|
||||
*
|
||||
* @param array $fields Fields to retrieve.
|
||||
* @param array $filter Filter.
|
||||
* @param integer $offset Offset.
|
||||
* @param integer $limit Limit.
|
||||
* @param string $order Order (asc or desc).
|
||||
* @param string $sort_field Sort field.
|
||||
* @param boolean $history Search history.
|
||||
* @param boolean $return_sql Return sql or execute it.
|
||||
* @param string $having Having.
|
||||
*
|
||||
* @return array|string|falsse Found events or SQL query or error.
|
||||
*/
|
||||
public static function search(
|
||||
array $fields,
|
||||
array $filter,
|
||||
?int $offset=null,
|
||||
?int $limit=null,
|
||||
?string $order=null,
|
||||
?string $sort_field=null,
|
||||
bool $history=false,
|
||||
bool $return_sql=false,
|
||||
string $having=''
|
||||
):array {
|
||||
return \events_get_all(
|
||||
$fields,
|
||||
$filter,
|
||||
$offset,
|
||||
$limit,
|
||||
$order,
|
||||
$sort_field,
|
||||
$history,
|
||||
$return_sql,
|
||||
$having
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves current group definition to database.
|
||||
*
|
||||
* @return mixed Affected rows of false in case of error.
|
||||
* @throws \Exception On error.
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['centralized_management']) === true
|
||||
&& $config['centralized_management'] > 0
|
||||
) {
|
||||
throw new \Exception(
|
||||
get_class($this).' error, cannot be modified while centralized management environment.'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->id_evento === null) {
|
||||
// New.
|
||||
return db_process_sql_insert(
|
||||
'tgrupo',
|
||||
$this->fields
|
||||
);
|
||||
} else if ($this->fields['id_evento'] > 0) {
|
||||
// Update.
|
||||
return db_process_sql_update(
|
||||
'tgrupo',
|
||||
$this->fields,
|
||||
['id_evento' => $this->fields['id_evento']]
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return error message to target.
|
||||
*
|
||||
* @param string $msg Error message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function error(string $msg)
|
||||
{
|
||||
echo json_encode(['error' => $msg]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies target method is allowed to be called using AJAX call.
|
||||
*
|
||||
* @param string $method Method to be invoked via AJAX.
|
||||
*
|
||||
* @return boolean Available (true), or not (false).
|
||||
*/
|
||||
public static function ajaxMethod(string $method):bool
|
||||
{
|
||||
return in_array($method, self::$ajaxMethods) === true;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -170,8 +170,8 @@ class Group extends Entity
|
|||
private static function prepareGroups(array $groups):array
|
||||
{
|
||||
$return = [];
|
||||
$groups = \groups_get_groups_tree_recursive($groups);
|
||||
foreach ($groups as $k => $v) {
|
||||
$tree_groups = \groups_get_groups_tree_recursive($groups);
|
||||
foreach ($tree_groups as $k => $v) {
|
||||
$return[] = [
|
||||
'id' => $k,
|
||||
'text' => \io_safe_output(
|
||||
|
@ -187,8 +187,29 @@ class Group extends Entity
|
|||
];
|
||||
}
|
||||
|
||||
return $return;
|
||||
$unassigned = [];
|
||||
$processed = array_keys($tree_groups);
|
||||
foreach ($groups as $k => $v) {
|
||||
if (in_array($k, $processed) === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$unassigned[] = [
|
||||
'id' => $k,
|
||||
'text' => \io_safe_output(
|
||||
\ui_print_truncate_text(
|
||||
$v,
|
||||
GENERIC_SIZE_TEXT,
|
||||
false,
|
||||
true,
|
||||
false
|
||||
)
|
||||
),
|
||||
'level' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
return array_merge($unassigned, $return);
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,18 +312,25 @@ class Group extends Entity
|
|||
]
|
||||
);
|
||||
|
||||
$exclusions = json_decode(\io_safe_output($exclusions));
|
||||
$exclusions = json_decode(\io_safe_output($exclusions), true);
|
||||
if (empty($exclusions) === false) {
|
||||
foreach ($exclusions as $ex) {
|
||||
unset($groups[$ex]);
|
||||
}
|
||||
}
|
||||
|
||||
$inclusions = json_decode(\io_safe_output($inclusions));
|
||||
$inclusions = json_decode(\io_safe_output($inclusions), true);
|
||||
if (empty($inclusions) === false) {
|
||||
foreach ($inclusions as $g) {
|
||||
if (empty($groups[$g]) === true) {
|
||||
$groups[$g] = \groups_get_name($g);
|
||||
foreach ($inclusions as $k => $g) {
|
||||
if (empty($groups[$k]) === true) {
|
||||
if (is_numeric($g) === true) {
|
||||
$groups[$k] = \groups_get_name($k);
|
||||
}
|
||||
|
||||
if (empty($groups[$k]) === true) {
|
||||
// Group does not exist, direct value assigned.
|
||||
$groups[$k] = $g;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -413,6 +413,15 @@ select:-internal-list-box {
|
|||
src: url("../fonts/unicode.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "opensansFont";
|
||||
src: url("../../fonts/opensans.woff2") format("woff2");
|
||||
}
|
||||
|
||||
.opensansfont {
|
||||
font-family: opensansFont, sans-serif;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "roboto";
|
||||
src: url("../../fonts/roboto.woff2") format("woff2");
|
||||
|
@ -1424,90 +1433,6 @@ div#agent_wizard_subtabs {
|
|||
line-height: 18pt;
|
||||
}
|
||||
|
||||
/*
|
||||
span.users {
|
||||
background: url(../../images/group.png) no-repeat;
|
||||
}
|
||||
span.agents {
|
||||
background: url(../../images/bricks.png) no-repeat;
|
||||
}
|
||||
span.data {
|
||||
background: url(../../images/data.png) no-repeat;
|
||||
}
|
||||
span.alerts {
|
||||
background: url(../../images/bell.png) no-repeat;
|
||||
}
|
||||
span.time {
|
||||
background: url(../../images/hourglass.png) no-repeat;
|
||||
}
|
||||
span.net {
|
||||
background: url(../../images/network.png) no-repeat;
|
||||
}
|
||||
span.master {
|
||||
background: url(../../images/master.png) no-repeat;
|
||||
}
|
||||
span.wmi {
|
||||
background: url(../../images/wmi.png) no-repeat;
|
||||
}
|
||||
span.prediction {
|
||||
background: url(../../images/chart_bar.png) no-repeat;
|
||||
}
|
||||
span.plugin {
|
||||
background: url(../../images/plugin.png) no-repeat;
|
||||
}
|
||||
span.export {
|
||||
background: url(../../images/database_refresh.png) no-repeat;
|
||||
}
|
||||
span.snmp {
|
||||
background: url(../../images/snmp.png) no-repeat;
|
||||
}
|
||||
span.binary {
|
||||
background: url(../../images/binary.png) no-repeat;
|
||||
}
|
||||
span.recon {
|
||||
background: url(../../images/recon.png) no-repeat;
|
||||
}
|
||||
span.rmess {
|
||||
background: url(../../images/email_open.png) no-repeat;
|
||||
}
|
||||
span.nrmess {
|
||||
background: url(../../images/email.png) no-repeat;
|
||||
}
|
||||
span.recon_server {
|
||||
background: url(../../images/recon.png) no-repeat;
|
||||
}
|
||||
span.wmi_server {
|
||||
background: url(../../images/wmi.png) no-repeat;
|
||||
}
|
||||
span.export_server {
|
||||
background: url(../../images/server_export.png) no-repeat;
|
||||
}
|
||||
span.inventory_server {
|
||||
background: url(../../images/page_white_text.png) no-repeat;
|
||||
}
|
||||
span.web_server {
|
||||
background: url(../../images/world.png) no-repeat;
|
||||
}
|
||||
*/
|
||||
|
||||
/* This kind of span do not have any sense, should be replaced on PHP code
|
||||
by a real img in code. They are not useful because insert too much margin around
|
||||
(for example, not valid to use in the table of server view */
|
||||
/*span.users, span.agents, span.data, span.alerts, span.time, span.net,
|
||||
span.master, span.snmp, span.binary, span.recon, span.wmi, span.prediction,
|
||||
span.plugin, span.plugin, span.export, span.recon_server, span.wmi_server,
|
||||
span.export_server, span.inventory_server, span.web_server {
|
||||
margin-left: 4px;
|
||||
margin-top: 10px;
|
||||
padding: 4px 8px 12px 30px;
|
||||
display: block;
|
||||
}
|
||||
span.rmess, span.nrmess {
|
||||
margin-left: 14px;
|
||||
padding: 1px 0px 10px 30px;
|
||||
display: block;
|
||||
}*/
|
||||
|
||||
/* New styles for data box */
|
||||
/*
|
||||
* ---------------------------------------------------------------------
|
||||
|
@ -1603,24 +1528,6 @@ table.databox {
|
|||
color: #333;
|
||||
}
|
||||
|
||||
/* For use in Netflow */
|
||||
/*
|
||||
table.databox_grid {
|
||||
margin: 25px;
|
||||
}
|
||||
|
||||
table.databox_grid > th {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.databox_grid > td {
|
||||
padding: 6px;
|
||||
margin: 4px;
|
||||
border-bottom: 1px solid #acacac;
|
||||
border-right: 1px solid #acacac;
|
||||
}
|
||||
*/
|
||||
|
||||
/* events */
|
||||
table.alternate tr:nth-child(odd) td {
|
||||
background-color: #ffffff;
|
||||
|
@ -1636,50 +1543,6 @@ table.rounded_cells td {
|
|||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/*#head_l {
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#head_r {
|
||||
float: right;
|
||||
text-align: right;
|
||||
margin-right: 10px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
#head_m {
|
||||
position: absolute;
|
||||
padding-top: 6px;
|
||||
padding-left: 12em;
|
||||
}*/
|
||||
/*span#logo_text1 {
|
||||
font: bolder 3em Arial, Sans-serif;
|
||||
letter-spacing: -2px;
|
||||
color: #eee;
|
||||
}
|
||||
span#logo_text2 {
|
||||
font: 3em Arial, Sans-serif;
|
||||
letter-spacing: -2px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
div#logo_text3 {
|
||||
text-align: right;
|
||||
font: 2em Arial, Sans-serif;
|
||||
letter-spacing: 6px;
|
||||
color: #aaa;
|
||||
font-weight: bold;
|
||||
margin-top: 0px;
|
||||
margin-left: 4px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.bb0 {
|
||||
border-bottom: 0px;
|
||||
}
|
||||
.bt0 {
|
||||
border-top: 0px;
|
||||
}*/
|
||||
.action-buttons {
|
||||
text-align: right;
|
||||
}
|
||||
|
@ -1722,7 +1585,6 @@ input.config,
|
|||
input.filter,
|
||||
input.cancel,
|
||||
input.default,
|
||||
input.filter,
|
||||
input.pdf,
|
||||
input.spinn {
|
||||
padding-right: 30px;
|
||||
|
@ -1861,19 +1723,6 @@ div#main_pure {
|
|||
.ui-draggable {
|
||||
cursor: move;
|
||||
}
|
||||
/*#layout_trash_drop {
|
||||
float: right;
|
||||
width: 300px;
|
||||
height: 180px;
|
||||
background: #fff url("../../images/trash.png") no-repeat bottom left;
|
||||
}
|
||||
#layout_trash_drop div {
|
||||
display: block;
|
||||
}
|
||||
#layout_editor_drop {
|
||||
float: left;
|
||||
width: 300px;
|
||||
}*/
|
||||
|
||||
/* IE 7 Hack */
|
||||
#editor {
|
||||
|
@ -1923,12 +1772,6 @@ select#template,
|
|||
select#action {
|
||||
width: 250px;
|
||||
}
|
||||
/*#label-checkbox-matches_value,
|
||||
#label-checkbox-copy_modules,
|
||||
#label-checkbox-copy_alerts {
|
||||
display: inline;
|
||||
font-weight: normal;
|
||||
}*/
|
||||
|
||||
/* Modules */
|
||||
table#simple {
|
||||
|
@ -6176,3 +6019,12 @@ form#form-filter-interfaces ul li.select-interfaces {
|
|||
li .select2 {
|
||||
max-width: 400px !important;
|
||||
}
|
||||
|
||||
div.graph td.legendLabel {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
div.graph div.legend div,
|
||||
div.graph div.legend table {
|
||||
top: 25px !important;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ thead.header_tr tr th.th_first {
|
|||
}
|
||||
|
||||
thead.header_tr tr th.th_description {
|
||||
background-color: #fafafa;
|
||||
background-color: #ffffff;
|
||||
color: #1c1c1c;
|
||||
text-align: justify;
|
||||
}
|
||||
|
@ -126,7 +126,6 @@ div.mpdf_toc_level_1 {
|
|||
margin-left: 2em;
|
||||
text-indent: -2em;
|
||||
padding-right: 1em;
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
span.mpdf_toc_t_level_1 {
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.749';
|
||||
$build = '201007';
|
||||
$build = '201013';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -105,7 +105,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('show_vc', 1),
|
||||
('inventory_changes_blacklist', '1,2,20,21'),
|
||||
('custom_report_front', 0),
|
||||
('custom_report_front_font', 'FreeSans.ttf'),
|
||||
('custom_report_front_font', 'opensans.ttf'),
|
||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.749-201007
|
||||
Version: 7.0NG.749-201013
|
||||
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.749-201007"
|
||||
pandora_version="7.0NG.749-201013"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -590,7 +590,7 @@ sub main() {
|
|||
my $include_api = 'include/api.php';
|
||||
# If public_url is empty in database
|
||||
if ( $console_api_url eq '' ) {
|
||||
$Config{"console_api_url"} = 'http://localhost/pandora_console/' . $include_api;
|
||||
$Config{"console_api_url"} = 'http://127.0.0.1/pandora_console/' . $include_api;
|
||||
logger(\%Config, "Assuming default path for API url: " . $Config{"console_api_url"}, 3);
|
||||
} else {
|
||||
$Config{"console_api_url"} = $console_api_url . $include_api;
|
||||
|
|
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.749";
|
||||
my $pandora_build = "201007";
|
||||
my $pandora_build = "201013";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -1880,29 +1880,17 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if ($status == $new_status) {
|
||||
# If the status is equal to the previous status reset the counters.
|
||||
$ff_normal = 0;
|
||||
$ff_critical = 0;
|
||||
$ff_warning = 0;
|
||||
} else {
|
||||
# Sequential critical and normal status are needed
|
||||
# if don't, reset counters.
|
||||
if ($last_known_status == 1 && $new_status != 1) {
|
||||
$ff_critical = 0;
|
||||
} elsif ($last_known_status == 0 && $new_status != 0) {
|
||||
$ff_normal = 0;
|
||||
}
|
||||
# Increase counters.
|
||||
$ff_critical++ if ($new_status == 1);
|
||||
$ff_warning++ if ($new_status == 2);
|
||||
$ff_normal++ if ($new_status == 0);
|
||||
|
||||
# Increase counters.
|
||||
$ff_critical++ if ($new_status == 1);
|
||||
$ff_warning++ if ($new_status == 2);
|
||||
$ff_normal++ if ($new_status == 0);
|
||||
}
|
||||
|
||||
if ( ($new_status == 0 && $ff_normal >= $min_ff_event)
|
||||
|| ($new_status == 1 && $ff_critical >= $min_ff_event)
|
||||
|| ($new_status == 2 && $ff_warning >= $min_ff_event)) {
|
||||
# Generate event for 'going_normal' only if status is previously different from
|
||||
# Normal.
|
||||
if ( ($new_status != $status && ($new_status == 0 && $ff_normal > $min_ff_event))
|
||||
|| ($new_status == 1 && $ff_critical > $min_ff_event)
|
||||
|| ($new_status == 2 && $ff_warning > $min_ff_event)
|
||||
) {
|
||||
# Change status generate event.
|
||||
generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $known_status, $dbh);
|
||||
$status = $new_status;
|
||||
|
@ -1918,11 +1906,19 @@ sub pandora_process_module ($$$$$$$$$;$) {
|
|||
safe_mode($pa_config, $agent, $module, $new_status, $known_status, $dbh);
|
||||
}
|
||||
|
||||
# Reset counters because change status.
|
||||
# After launch an event, counters are reset.
|
||||
$ff_normal = 0;
|
||||
$ff_critical = 0;
|
||||
$ff_warning = 0;
|
||||
|
||||
} else {
|
||||
if($new_status == 0 && $ff_normal > $min_ff_event) {
|
||||
# Reached normal FF but status have not changed, reset counters.
|
||||
$ff_normal = 0;
|
||||
$ff_critical = 0;
|
||||
$ff_warning = 0;
|
||||
}
|
||||
|
||||
# Active ff interval
|
||||
if ($module->{'module_ff_interval'} != 0) {
|
||||
$current_interval = $module->{'module_ff_interval'};
|
||||
|
|
|
@ -26,6 +26,7 @@ eval "use POSIX::strftime::GNU;1" if ($^O =~ /win/i);
|
|||
use POSIX qw(strftime setsid floor);
|
||||
use MIME::Base64;
|
||||
use JSON qw(decode_json encode_json);
|
||||
use PerlIO::encoding;
|
||||
|
||||
use base 'Exporter';
|
||||
|
||||
|
@ -33,7 +34,7 @@ our @ISA = qw(Exporter);
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.749";
|
||||
my $pandora_build = "201007";
|
||||
my $pandora_build = "201013";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.749
|
||||
%define release 201007
|
||||
%define release 201013
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.749"
|
||||
PI_BUILD="201007"
|
||||
PI_BUILD="201013"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -35,7 +35,7 @@ use PandoraFMS::Config;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.749 PS201007";
|
||||
my $version = "7.0NG.749 PS201013";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.749 PS201007";
|
||||
my $version = "7.0NG.749 PS201013";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue