Merge branch 'pandora_5.1' into feature/ticket#2179-recontask-view-acl

This commit is contained in:
Arturo Gonzalez Diaz 2015-07-23 16:28:22 +02:00
commit d3bb628ea2
35 changed files with 371 additions and 286 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 5.1SP3-150720
Version: 5.1SP3-150723
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="5.1SP3-150720"
pandora_version="5.1SP3-150723"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '5.1SP3';
use constant AGENT_BUILD => '150720';
use constant AGENT_BUILD => '150723';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 5.1SP3
%define release 150720
%define release 150723
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 5.1SP3
%define release 150720
%define release 150723
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150720}
{150723}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("5.1SP3(Build 150720)")
#define PANDORA_VERSION ("5.1SP3(Build 150723)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(5.1SP3(Build 150720))"
VALUE "ProductVersion", "(5.1SP3(Build 150723))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 5.1SP3-150720
Version: 5.1SP3-150723
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="5.1SP3-150720"
pandora_version="5.1SP3-150723"
package_pear=0
package_pandora=1

View File

@ -123,7 +123,10 @@ switch ($config["dbtype"]) {
case "mysql":
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_version'", "DB Schema Version");
WHERE `token` = 'db_scheme_first_version'", "DB Schema Version (first installed)");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_version'", "DB Schema Version (actual)");
render_info_data ("SELECT `value`
FROM tconfig
WHERE `token` = 'db_scheme_build'", "DB Schema Build");

View File

@ -31,7 +31,8 @@ $create = (string)get_parameter('create', 0);
if ($id) {
$permission = events_check_event_filter_group ($id);
if (!$permission) { // User doesn't have permissions to see this filter
if (!$permission) {
// User doesn't have permissions to see this filter
require ("general/noaccess.php");
return;
@ -303,7 +304,8 @@ $table->data[18][1] = html_print_button(__('Remove'), 'remove_whithout', $remove
$table->data[19][0] = '<b>' . __('Alert events') . '</b>';
$table->data[19][1] = html_print_select(
array('-1' => __('All'),
array(
'-1' => __('All'),
'0' => __('Filter alert events'),
'1' => __('Only alert events')),
"filter_only_alert", $filter_only_alert, '', '', '', true);

View File

@ -492,7 +492,7 @@ $table->data[$row][1] = html_print_input_text ('custom_graph_widht',
$row++;
$table->data[$row][0] = __('Display proc modules in binary format (OK/FAIL)');
$table->data[$row][0] = __('Display data of proc modules in other format');
$table->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('render_proc', 1, '',
$config["render_proc"], true) .
@ -502,6 +502,13 @@ $table->data[$row][1] .= __('No') . '&nbsp;' .
$config["render_proc"], true);
$row++;
$table->data[$row][0] = __('Display text proc modules have state is ok');
$table->data[$row][1] = html_print_input_text ('render_proc_ok', $config["render_proc_ok"], '', 25, 25, true);
$row++;
$table->data[$row][0] = __('Display text when proc modules have state critical');
$table->data[$row][1] = html_print_input_text ('render_proc_fail', $config["render_proc_fail"], '', 25, 25, true);
$row++;
echo '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150720';
$build_version = 'PC150723';
$pandora_version = 'v5.1SP3';
// Do not overwrite default timezone set if defined.

View File

@ -269,6 +269,7 @@ define ('EVENT_CRIT_MAJOR', 6);
define ('EVENT_CRIT_CRITICAL', 4);
define ('EVENT_CRIT_WARNING_OR_CRITICAL', 34);
define ('EVENT_CRIT_NOT_NORMAL', 20);
define ('EVENT_CRIT_OR_NORMAL', 21);
/* Id Module (more use in component)*/
define ('MODULE_DATA', 1);
@ -286,6 +287,7 @@ define ('MODULE_PREDICTION_NETFLOW', 4);
/* SNMP CONSTANTS */
define('SNMP_DIR_MIBS', "attachment/mibs");
define('SNMP_TRAP_TYPE_NONE', -1);
define('SNMP_TRAP_TYPE_COLD_START', 0);
define('SNMP_TRAP_TYPE_WARM_START', 1);
@ -383,7 +385,6 @@ define("COLLECTION_CORRECT", 1);
define("COLLECTION_ERROR_LOST_DIRECTORY", 2);
define("COLLECTION_UNSAVED", 3);
/* PAGINATION */
define("PAGINATION_BLOCKS_LIMIT", 15);
?>

View File

@ -1057,6 +1057,7 @@ function get_priorities ($priority_param = false) {
$priorities[EVENT_CRIT_CRITICAL] = __('Critical');
$priorities[EVENT_CRIT_WARNING_OR_CRITICAL] = __('Warning').'/'.__('Critical');
$priorities[EVENT_CRIT_NOT_NORMAL] = __('Not normal');
$priorities[EVENT_CRIT_OR_NORMAL] = __('Critical') . '/' . __('Normal');
foreach ($priorities as $key => $priority) {
$priorities[$key] = ui_print_truncate_text($priority, GENERIC_SIZE_TEXT, false, true, false);

View File

@ -454,8 +454,12 @@ function config_update_config () {
$error_update[] = __('Show the group name instead the group icon.');
if (!config_update_value ('custom_graph_widht', get_parameter('custom_graph_widht')))
$error_update[] = __('Default line thickness for the Custom Graph.');
if (!config_update_value ('render_proc', (int) get_parameter('render_proc', 0)))
$error_update[] = __('Display proc modules in binary format (OK/FAIL)');
if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false)))
$error_update[] = __('Display data of proc modules in other format');
if (!config_update_value ('render_proc_ok', (string) get_parameter('render_proc_ok', __('Ok') )))
$error_update[] = __('Display text proc modules have state is ok');
if (!config_update_value ('render_proc_fail', (string) get_parameter('render_proc_fail', __('Fail') )))
$error_update[] = __('Display text when proc modules have state critical');
$interval_values = get_parameter ('interval_values');
@ -1208,6 +1212,13 @@ function config_process_config () {
config_update_value ('render_proc', 0);
}
if (!isset($config["render_proc_ok"])) {
config_update_value ('render_proc_ok', __('Ok') );
}
if (!isset($config["render_proc_fail"])) {
config_update_value ('render_proc_fail', __('Fail') );
}
if (!isset($config['command_snapshot'])) {
config_update_value ('command_snapshot', 1);
}

View File

@ -23,6 +23,15 @@ include_once($config['homedir'] . "/include/functions_agents.php");
include_once($config['homedir'] . '/include/functions_users.php');
include_once($config['homedir'] . '/include/functions_tags.php');
function modules_is_not_init($id_agent_module) {
$row = db_get_row('tagente_estado', 'id_agente_modulo', $id_agent_module);
if ($row['estado'] == AGENT_MODULE_STATUS_NO_DATA)
return true;
else
return false;
}
function modules_is_disable_agent($id_agent_module) {
$sql = "
SELECT disabled
@ -1715,7 +1724,8 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
case 21:
case 31:
if ( $config["render_proc"] ) {
$sql = sprintf ("SELECT IF(datos >= 1, 'OK', 'FAIL') as data, utimestamp
$sql = sprintf ("SELECT IF(datos >= 1, '" . $config["render_proc_ok"] .
"', '" . $config["render_proc_fail"] . "') as data, utimestamp
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d AND utimestamp <= %d

View File

@ -598,6 +598,8 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
global $config;
if (empty($id_agent_module))
return false;
@ -616,8 +618,11 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
}
// Calculate the SLA for large time without hours
if ($timeFrom == $timeTo) {
// Get interval data
$sql = sprintf ('SELECT *
FROM tagente_datos
@ -669,7 +674,8 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
}
// Calculate planned downtime dates
$downtime_dates = reporting_get_planned_downtimes_intervals($id_agent_module, $datelimit, $date);
$downtime_dates = reporting_get_planned_downtimes_intervals(
$id_agent_module, $datelimit, $date);
// Get previous data
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
@ -707,12 +713,27 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
}
$previous_utimestamp = $first_data['utimestamp'];
if ((($max_value > $min_value AND ($first_data['datos'] > $max_value OR $first_data['datos'] < $min_value))) OR
($max_value <= $min_value AND $first_data['datos'] < $min_value)) {
if (
(
(
$max_value > $min_value AND (
$first_data['datos'] > $max_value OR
$first_data['datos'] < $min_value
)
)
) OR
(
$max_value <= $min_value AND
$first_data['datos'] < $min_value
)
) {
$previous_status = 1;
foreach ($downtime_dates as $date_dt) {
if (($date_dt['date_from'] <= $previous_utimestamp) AND ($date_dt['date_to'] >= $previous_utimestamp)) {
if (($date_dt['date_from'] <= $previous_utimestamp) AND
($date_dt['date_to'] >= $previous_utimestamp)) {
$previous_status = 0;
}
}
@ -768,13 +789,14 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
$timeTo);
}
else {
// Extract the data each day
$sla = 0;
$i = 0;
for ($interval = 0; $interval <= $period; $interval = $interval + SECONDS_1DAY) {
$datelimit = $date - $interval;
for ($interval = SECONDS_1DAY; $interval <= $period; $interval = $interval + SECONDS_1DAY) {
$sla_day = reporting_get_agentmodule_sla(
$id_agent_module,
@ -786,9 +808,13 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0,
$timeFrom, $timeTo);
// Avoid to add the period of module not init
if ($sla_day !== false) {
$sla += $sla_day;
$i++;
}
}
$sla = $sla / $i;
@ -4369,7 +4395,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
}
if (modules_is_disable_agent($sla['id_agent_module'])) {
if (modules_is_disable_agent($sla['id_agent_module']) ||
modules_is_not_init($item['id_agent_module'])) {
if (($config ['metaconsole'] == 1) && defined('METACONSOLE')) {
//Restore db connection
@ -5671,7 +5698,6 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
metaconsole_restore_db();
}
continue;
}
@ -5682,67 +5708,79 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
if ($content['show_graph']) {
$text = $row['ip_address'] = agents_get_address(
$text = $row['availability_item'] = agents_get_address(
modules_get_agentmodule_agent($item['id_agent_module']));
if (empty($text)) {
$text = $row['availability_item'] = __('No Address');
}
}
else {
$text = $row['module'] = modules_get_agentmodule_name(
$text = $row['availability_item'] = modules_get_agentmodule_name(
$item['id_agent_module']);
}
$row['agent'] = modules_get_agentmodule_agent_name(
$item['id_agent_module']);
$text = $row['agent'] . " (" . $text . ")";
$monitor_value = reporting_get_agentmodule_sla(
$sla_value = reporting_get_agentmodule_sla(
$item['id_agent_module'],
$content['period'],
1,
false,
0.50,
1.50,
$report["datetime"],
null,
$content['time_from'],
$content['time_to']);
$count_checks = modules_get_count_datas(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
$report["datetime"]);
if ($monitor_value === false) {
if ($sla_value === false) {
$row['checks'] = __('Unknown');
$row['failed'] = __('Unknown');
$row['fail'] = __('Unknown');
$row['poling_time'] = __('Unknown');
$row['time_unavaliable'] = __('Unknown');
$row['ok'] = __('Unknown');
$percent_ok = 0;
}
else {
$count_checks = modules_get_count_datas(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
$report["datetime"]);
$count_fails = modules_get_count_data_with_value(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
$report["datetime"],
0);
$percent_ok = format_numeric($sla_value, 2);
$percent_fail = (100 - $percent_ok);
$percent_ok = (($count_checks - $count_fails) * 100) / $count_checks;
$percent_fail = 100 - $percent_ok;
$row['checks'] = format_numeric($count_checks, 0);
$row['ok'] = $percent_ok . " %";
$row['fail'] = $percent_fail . " %";
$row['failed'] =
format_numeric($percent_fail * $count_checks / 100, 0);
$row['ok'] = format_numeric($percent_ok, 2) . " %";
$row['fail'] = format_numeric($percent_fail, 2) . " %";
$row['checks'] = format_numeric($count_checks, 2);
$row['failed'] = format_numeric($count_fails ,2);
$row['poling_time'] = human_time_description_raw(
($count_checks - $count_fails) * modules_get_interval($item['id_agent_module']),
$row['poling_time'] =
human_time_description_raw(
($percent_ok * $count_checks / 100) * modules_get_interval($item['id_agent_module']),
true);
$row['time_unavaliable'] = "-";
if ($count_fails > 0) {
$row['time_unavaliable'] = human_time_description_raw(
$count_fails * modules_get_interval($item['id_agent_module']),
if ($percent_fail > 0) {
$row['time_unavaliable'] =
human_time_description_raw(
($percent_fail * $count_checks / 100) * modules_get_interval($item['id_agent_module']),
true);
}
}
$data[] = $row;
$avg = (($avg * $count) + $monitor_value) / ($count + 1);
$avg = (($avg * $count) + $percent_ok) / ($count + 1);
if (is_null($min)) {
$min = $percent_ok;
$min_text = $text;
@ -5764,6 +5802,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
@ -5992,7 +6031,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
}
if (modules_is_disable_agent($row['id_agent_module'])) {
if (modules_is_disable_agent($row['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])) {
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
@ -6193,7 +6233,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
}
if (modules_is_disable_agent($g['id_agent_module'])) {
if (modules_is_disable_agent($g['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])) {
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '5.1SP3';
$build = '150720';
$build = '150723';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -106,7 +106,8 @@ class Visualmap {
$ui->contentAddHtml($rendered_map);
$ui->contentAddHtml("<script type=\"text/javascript\">
function ajax_load_map() {
$('#rendered_visual_map').html('<div style=\"text-align: center\"> " . __('Loading...') . "<br /><img src=\"images/ajax-loader.gif\" /></div>');
$('#rendered_visual_map').html('<div style=\"text-align: center\"> " .
__('Loading...') . "<br /><img src=\"images/ajax-loader.gif\" /></div>');
var map_max_width = window.innerWidth * 0.90;
var map_max_height = (window.innerHeight - 47) * 0.90;

View File

@ -607,9 +607,9 @@ foreach ($modules as $module) {
case 21:
case 31:
if ($module["datos"]>=1)
$salida ='OK';
$salida = $config["render_proc_ok"];
else
$salida = 'FAIL';
$salida = $config["render_proc_fail"];
break;
default:
$salida = format_numeric($module["datos"]);

View File

@ -1211,9 +1211,9 @@ foreach ($result as $row) {
case 21:
case 31:
if ( $row["datos"] >= 1 )
$salida ='OK';
$salida = $config["render_proc_ok"];
else
$salida = 'FAIL';
$salida = $config["render_proc_fail"];
break;
default:
$salida = format_numeric($row["datos"]);

View File

@ -92,6 +92,11 @@ if ($severity != -1) {
AND (criticity = " . EVENT_CRIT_WARNING . " OR
criticity = " . EVENT_CRIT_CRITICAL . ")";
break;
case EVENT_CRIT_OR_NORMAL:
$sql_post .= "
AND (criticity = " . EVENT_CRIT_NORMAL . " OR
criticity = " . EVENT_CRIT_CRITICAL . ")";
break;
case EVENT_CRIT_NOT_NORMAL:
$sql_post .= " AND criticity != " . EVENT_CRIT_NORMAL;
break;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 5.1SP3
%define release 150720
%define release 150723
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 5.1SP3
%define release 150720
%define release 150723
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -37,8 +37,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('days_compact','0'),
('graph_res','5'),
('step_compact','1'),
('db_scheme_first_version', '5.1dev'),
('db_scheme_version','5.1SP3'),
('db_scheme_build','PD150720'),
('db_scheme_build','PD150723'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 5.1SP3-150720
Version: 5.1SP3-150723
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="5.1SP3-150720"
pandora_version="5.1SP3-150723"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "5.1SP3";
my $pandora_build = "150720";
my $pandora_build = "150723";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -162,6 +162,7 @@ sub data_consumer ($$) {
$AgentSem->down ();
delete ($Agents{$agent_name});
$AgentSem->up ();
return;
}
# Try to parse the XML 2 times, with a delay between tries of 2 seconds
@ -192,6 +193,7 @@ sub data_consumer ($$) {
$AgentSem->down ();
delete ($Agents{$agent_name});
$AgentSem->up ();
return;
}
unlink ($file_name);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 5.1SP3
%define release 150720
%define release 150723
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 5.1SP3
%define release 150720
%define release 150723
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "5.1SP3 PS150720";
my $version = "5.1SP3 PS150723";
# Pandora server configuration
my %conf;

View File

@ -34,7 +34,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "5.1SP3 PS150720";
my $version = "5.1SP3 PS150723";
# save program name for logging
my $progname = basename($0);