Merge branch 'develop' into feature/#1978-REESCRITURA_DEL_MOTOR_DE_INFORMES

This commit is contained in:
mdtrooper 2015-05-18 10:46:27 +02:00
commit 34b3557e9e
30 changed files with 70 additions and 56 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.0dev-150506
Version: 6.0dev-150518
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="6.0dev-150506"
pandora_version="6.0dev-150518"
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 => '6.0dev';
use constant AGENT_BUILD => '150506';
use constant AGENT_BUILD => '150518';
# 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 6.0dev
%define release 150506
%define release 150518
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150506
%define release 150518
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -21,7 +21,7 @@ my $freemem=`cat /proc/meminfo | grep 'MemFree' | awk '{ print \$2 } '`;
my $cached=`cat /proc/meminfo | grep '^Cached:' | awk '{ print \$2 } '`;
my $cachedswap=`cat /proc/meminfo | grep '^SwapCached:' | awk '{ print \$2 }'`;
my $available=$freemem+$cached+$cachedwap;
my $available_percent = floor(($available / $STOTAL)*100);
my $available_percent = floor(($available / $TOTAL)*100);
print "<module>\n";

View File

@ -19,7 +19,7 @@
server_ip $ServerIP$
server_path /var/spool/pandora/data_in
temporal "C:\Program Files\pandora_agent\temp"
temporal "C:\%ProgramFiles%\pandora_agent\temp"
#include "C:\Archivos de programa\pandora_agent\pandora_agent_alt.conf"
#broker_agent name_agent

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150506}
{150518}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150506)")
#define PANDORA_VERSION ("6.0dev(Build 150518)")
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", "(6.0dev(Build 150506))"
VALUE "ProductVersion", "(6.0dev(Build 150518))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150506
Version: 6.0dev-150518
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="6.0dev-150506"
pandora_version="6.0dev-150518"
package_pear=0
package_pandora=1

View File

@ -20,24 +20,43 @@ $graph = $_POST['graph'];
$graph_title = $_POST['graph_title'];
$refresh = $_POST['refresh'];
$os = strtolower(PHP_OS);
if (substr($os, 0, 3) === 'win') {
$os = 'windows';
}
switch($graph) {
case 'cpu_load':
$data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'");
if ( $os == 'windows')
$data = exec('wmic cpu get loadpercentage|find /I /V "Loadpercentage" | findstr /r "[0-9]" ');
else
$data = exec("top -bn 2 -d 0.01 | grep '^Cpu' | tail -n 1 | awk '{ print $2+$4+$6 }'");
break;
case 'pending_packets':
$data = exec("ls /var/spool/pandora/data_in/*.data | wc -l");
break;
case 'disk_io_wait':
$data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'");
if ( $os == 'windows')
$data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'");
else
$data = exec("vmstat 1 3 | tail -1 | awk '{ print $16 }'");
break;
case 'mysql_load':
$data = exec("ps aux | grep mysqld | grep -v safe | grep -v grep | awk '{ print $3 }'");
if ( $os == 'windows')
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(mysqld)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
else
$data = exec("ps aux | grep mysqld | grep -v safe | grep -v grep | awk '{ print $3 }'");
break;
case 'apache_load':
$data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
if ( $os == 'windows')
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(httpd)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
else
$data = exec("ps aux | grep apache2 | grep -v safe | grep -v grep | awk '{ sum+=$3 } END { print sum }'");
break;
case 'server_load':
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
if ( $os == 'windows')
$data = exec('(FOR /F "skip=2 tokens=2 delims=\," %P IN (\'typeperf "\\Process(pandora_server)\\% processor time" -sc 1\') DO @echo %P)|find /V /I "..."');
else
$data = exec("ps aux | grep pandora_server | grep -v grep | awk '{ print $3 }'");
break;
case 'snmp_interface':
$snmp_address = $_POST['snmp_address'];

View File

@ -994,7 +994,7 @@ if ($update_module || $create_module) {
// Make changes in the conf file if necessary
enterprise_include_once('include/functions_config_agents.php');
if (!policies_is_module_in_policy($id_agent_module)) {
if (!enterprise_hook('policies_is_module_in_policy', array($id_agent_module))) {
enterprise_hook('config_agents_write_module_in_conf',
array($id_agente, io_safe_output($old_configuration_data),
io_safe_output($configuration_data), $disabled));

View File

@ -442,18 +442,6 @@ if ($list_modules) {
break;
}
break;
case 'data':
switch ($sort) {
case 'up':
$selectDataUp = $selected;
$order = array('field' => 'tagente_estado.datos', 'order' => 'ASC');
break;
case 'down':
$selectDataDown = $selected;
$order = array('field' => 'tagente_estado.datos', 'order' => 'DESC');
break;
}
break;
case 'last_contact':
switch ($sort) {
case 'up':
@ -703,9 +691,7 @@ if ($list_modules) {
'<a href="' . $url . '&sort_field=status&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectStatusUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=status&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectStatusDown, "alt" => "down")) . '</a>';
$table->head[6] = __('Warn');
$table->head[7] = __('Data') . ' ' .
'<a href="' . $url . '&sort_field=data&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectDataUp, "alt" => "up")) . '</a>' .
'<a href="' . $url . '&sort_field=data&amp;sort=down&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_down.png", true, array("style" => $selectDataDown, "alt" => "down")) . '</a>';
$table->head[7] = __('Data');
$table->head[8] = __('Graph');
$table->head[9] = __('Last contact') . ' ' .
'<a href="' . $url . '&sort_field=last_contact&amp;sort=up&refr=&filter_monitors=1&status_filter_monitor=' .$status_filter_monitor.' &status_text_monitor='. $status_text_monitor.'&status_module_group= '.$status_module_group.'">' . html_print_image("images/sort_up.png", true, array("style" => $selectLastContactUp, "alt" => "up")) . '</a>' .

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150506';
$build_version = 'PC150518';
$pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined.

View File

@ -119,7 +119,7 @@ function config_update_config () {
case 'general':
if (!config_update_value ('language', (string) get_parameter ('language')))
$error_update[] = __('Language code for Pandora');
if (!config_update_value ('remote_config', (string) get_parameter ('remote_config')))
if (!config_update_value ('remote_config', io_safe_input((string) get_parameter ('remote_config'))))
$error_update[] = __('Remote config directory');
if (!config_update_value ('loginhash_pwd', io_input_password((string) get_parameter ('loginhash_pwd'))))
$error_update[] = __('Auto login (hash) password');
@ -130,7 +130,7 @@ function config_update_config () {
$error_update[] = __('Automatic check for updates');
if (!config_update_value ('https', (bool) get_parameter ('https')))
$error_update[] = __('Enforce https');
if (!config_update_value ('attachment_store', (string) get_parameter ('attachment_store')))
if (!config_update_value ('attachment_store', io_safe_input((string) get_parameter ('attachment_store'))))
$error_update[] = __('Attachment store');
if (!config_update_value ('list_ACL_IPs_for_API', (string) get_parameter('list_ACL_IPs_for_API')))
$error_update[] = __('IP list with API access');
@ -413,7 +413,7 @@ function config_update_config () {
$error_update[] = __('Show QR code header');
if (!config_update_value ('status_images_set', (string) get_parameter ('status_images_set')))
$error_update[] = __('Status icon set');
if (!config_update_value ('fontpath', (string) get_parameter ('fontpath')))
if (!config_update_value ('fontpath', io_safe_input((string) get_parameter ('fontpath'))))
$error_update[] = __('Font path');
if (!config_update_value ('font_size', get_parameter('font_size')))
$error_update[] = __('Font size');
@ -451,7 +451,7 @@ function config_update_config () {
$error_update[] = __('Fixed menu');
if (!config_update_value ('paginate_module', get_parameter('paginate_module')))
$error_update[] = __('Paginate module');
if (!config_update_value ('graphviz_bin_dir', get_parameter('graphviz_bin_dir')))
if (!config_update_value ('graphviz_bin_dir', io_safe_input(get_parameter('graphviz_bin_dir'))))
$error_update[] = __('Custom graphviz directory');
if (!config_update_value ('networkmap_max_width', get_parameter('networkmap_max_width')))
$error_update[] = __('Networkmap max width');
@ -461,7 +461,7 @@ function config_update_config () {
$error_update[] = __('Show the group name instead the group icon.');
if (!config_update_value ('custom_graph_widht', (int) get_parameter('custom_graph_widht', 1)))
$error_update[] = __('Default line thickness for the Custom Graph.');
if (!config_update_value ('render_proc', (int) get_parameter('render_proc', 0)))
if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false)))
$error_update[] = __('Render data of module type is proc.');
@ -625,7 +625,7 @@ function config_update_config () {
enterprise_include_once('include/functions_policies.php');
$enterprise = enterprise_include_once ('include/functions_skins.php');
if ($enterprise !== ENTERPRISE_NOT_HOOK) {
$config['relative_path'] = get_parameter('relative_path', $config['relative_path']);
$config['relative_path'] = get_parameter('relative_path', io_safe_input($config['relative_path']));
}
}
@ -653,7 +653,7 @@ function config_process_config () {
if (isset ($config['homeurl']) && (strlen($config['homeurl']) > 0)) {
if ($config['homeurl'][0] != '/') {
$config['homeurl'] = '/'.$config['homeurl'];
$config['homeurl'] = '/'.io_safe_input($config['homeurl']);
}
}
@ -862,21 +862,21 @@ function config_process_config () {
// dir.
if (!isset ($config['attachment_store'])) {
config_update_value('attachment_store',
$config['homedir'] . '/attachment');
io_safe_input($config['homedir']) . '/attachment');
}
else {
//Fixed when the user moves the pandora console to another dir
//after the first uses.
if (!is_dir($config['attachment_store'])) {
config_update_value('attachment_store',
$config['homedir'] . '/attachment');
io_safe_input($config['homedir']) . '/attachment');
}
}
if (!isset ($config['fontpath'])) {
config_update_value('fontpath',
$config['homedir'] . '/include/fonts/smallfont.ttf');
io_safe_input($config['homedir']) . '/include/fonts/smallfont.ttf');
}
if (!isset ($config['style'])) {
@ -1468,6 +1468,7 @@ function config_check () {
$PHPmemory_limit = config_return_in_bytes(ini_get('memory_limit'));
$PHPmax_execution_time = ini_get('max_execution_time');
$PHPsafe_mode = ini_get('safe_mode');
$PHPdisable_functions = ini_get('disable_functions');
if ($PHPsafe_mode === '1') {
set_pandora_error_for_header(
@ -1502,6 +1503,12 @@ function config_check () {
sprintf(__('Recommended value is: %s'), sprintf(__('%s or greater'), '500M')) . '<br><br>' . __('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
sprintf(__("Not recommended '%s' value in PHP configuration"), 'memory_limit'));
}
if (preg_match("/system/", $PHPdisable_functions) or preg_match("/exec/", $PHPdisable_functions)) {
set_pandora_error_for_header(
__("Variable disable_functions containts functions system() or exec(), in PHP configuration file (php.ini)"). '<br /><br />' .
__('Please, change it on your PHP configuration file (php.ini) or contact with administrator (Dont forget restart apache process after changes)'), __("Problems with disable functions in PHP.INI"));
}
}
function config_return_in_bytes($val) {

View File

@ -800,6 +800,7 @@ function visual_map_print_item($mode = "read", $layoutData,
break;
case STATIC_GRAPH:
case GROUP_ITEM:
echo "<div style='width:150px'>";
if ($layoutData['image'] != null) {
@ -861,6 +862,7 @@ function visual_map_print_item($mode = "read", $layoutData,
echo '<br />';
}
echo io_safe_output($text);
echo "</div>";
break;
case PERCENTILE_BAR:

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '6.0dev';
$build = '150506';
$build = '150518';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150506
%define release 150518
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150506
%define release 150518
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','6.0dev'),
('db_scheme_build','PD150506'),
('db_scheme_build','PD150518'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150506
Version: 6.0dev-150518
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="6.0dev-150506"
pandora_version="6.0dev-150518"
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 = "6.0dev";
my $pandora_build = "150506";
my $pandora_build = "150518";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -270,7 +270,7 @@ sub get_agent_from_name ($$) {
return undef if (! defined ($name) || $name eq '');
return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', $name);
return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', safe_input($name));
}
##########################################################################

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150506
%define release 150518
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150506
%define release 150518
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "6.0dev PS150506";
my $version = "6.0dev PS150518";
# Pandora server configuration
my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "6.0dev PS150506";
my $version = "6.0dev PS150518";
# save program name for logging
my $progname = basename($0);