Merge branch 'develop' into feature/ticket#2179-recontask-view-acl-Pandora6.0

This commit is contained in:
Arturo Gonzalez Diaz 2015-07-23 16:06:20 +02:00
commit addd36a681
34 changed files with 150 additions and 142 deletions

View File

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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150721}
{150722}
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 150721)")
#define PANDORA_VERSION ("6.0dev(Build 150722)")
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 150721))"
VALUE "ProductVersion", "(6.0dev(Build 150722))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150721
Version: 6.0dev-150722
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-150721"
pandora_version="6.0dev-150722"
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

@ -63,6 +63,8 @@ UPDATE `talert_commands` SET `fields_descriptions` = '[\"Destination addres
-- Table `tconfig`
-- ---------------------------------------------------------------------
INSERT INTO `tconfig` (`token`, `value`) VALUES ('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}');
UPDATE tconfig SET value = 'v6.0dev' WHERE token = 'db_scheme_version';
-- ---------------------------------------------------------------------
-- Table `tnetwork_map`

View File

@ -32,7 +32,7 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no cu
<p id="description_task"> <?php echo __("Graphs are designed to show the data collected by Pandora FMS in a temporary scale defined by the user.
Pandora FMS Graphs display data in real time. They are generated every time the operator requires any of them and display the up-to-date state.
There are two types of graphs: The agent's automated graphs and the graphs the user customizes by using one or more modules to do so."); ?></p>
<form action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask_form&create" method="post">
<form action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Custom Graph'); ?>" />
</form>
</div>

View File

@ -495,6 +495,7 @@ if ($paginate_module) {
ui_pagination($total_modules, $url);
}
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
$table->head = array ();

View File

@ -1746,29 +1746,41 @@ class Tree {
}
public function getData() {
if (! defined('METACONSOLE')) {
switch ($this->type) {
case 'os':
$this->getDataOS();
break;
case 'group':
$this->getDataGroup();
break;
case 'module_group':
$this->getDataModuleGroup();
break;
case 'module':
$this->getDataModules();
break;
case 'tag':
$this->getDataTag();
break;
case 'agent':
$this->getDataAgent();
break;
default:
$this->getDataExtended();
if ($this->strictACL) {
switch ($this->type) {
case 'group':
case 'tag':
$this->getDataStrict();
break;
case 'agent':
$this->getDataAgent();
break;
}
}
else{
switch ($this->type) {
case 'os':
$this->getDataOS();
break;
case 'group':
$this->getDataGroup();
break;
case 'module_group':
$this->getDataModuleGroup();
break;
case 'module':
$this->getDataModules();
break;
case 'tag':
$this->getDataTag();
break;
case 'agent':
$this->getDataAgent();
break;
default:
$this->getDataExtended();
}
}
}
else if ($this->strictACL) {

View File

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

View File

@ -798,31 +798,39 @@ function html_print_extended_select_for_time ($name, $selected = '',
* @return string HTML code if return parameter is true.
*/
function html_print_extended_select_for_cron ($hour = '*', $minute = '*', $mday = '*', $month = '*', $wday = '*', $return = false) {
# Hours
for ($i = 0; $i < 24; $i++) {
$hours[$i] = $i;
}
# Minutes
for ($i = 0; $i < 60; $i+=5) {
$minutes[$i] = $i;
}
# Month days
for ($i = 0; $i < 31; $i++) {
$mdays[$i] = $i;
}
# Months
for ($i = 0; $i < 12; $i++) {
$months[$i] = date('F', mktime (0, 0, 0, $i, 1));
}
# Days of the week
$wdays = array(__('Sunday'), __('Monday'), __('Tuesday'), __('Wednesday'), __('Thursday'), __('Friday'), __('Saturday'));
$wdays = array(
__('Sunday'),
__('Monday'),
__('Tuesday'),
__('Wednesday'),
__('Thursday'),
__('Friday'),
__('Saturday'));
# Print selectors
$table = new stdClass();
$table->id = 'cron';
$table->width = '100%';
$table->class = 'databox data';
@ -831,7 +839,7 @@ function html_print_extended_select_for_cron ($hour = '*', $minute = '*', $mday
$table->head[2] = __('Month day');
$table->head[3] = __('Month');
$table->head[4] = __('Week day');
$table->data[0][0] = html_print_select ($hours, 'hour', $hour, '', __('Any'), '*', true, false, false);
$table->data[0][1] = html_print_select ($minutes, 'minute', $minute, '', __('Any'), '*', true, false, false);
$table->data[0][2] = html_print_select ($mdays, 'mday', $mday, '', __('Any'), '*', true, false, false);
@ -1012,7 +1020,10 @@ function html_print_div ($options, $return = false) {
*
* @return string HTML code if return parameter is true.
*/
function html_print_input_password ($name, $value, $alt = '', $size = 50, $maxlength = 255, $return = false, $disabled = false) {
function html_print_input_password ($name, $value, $alt = '',
$size = 50, $maxlength = 255, $return = false, $disabled = false,
$required = false) {
if ($maxlength == 0)
$maxlength = 255;

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
@ -2147,65 +2156,10 @@ function modules_get_count_datas($id_agent_module, $date_init, $date_end) {
$diff = $date_end - $date_init;
return ($diff / $interval);
}
function modules_get_count_data_with_value($id_agent_module, $date_init,
$date_end, $value) {
global $config;
if (!is_numeric($date_init)) {
$date_init = strtotime($date_init);
}
if (!is_numeric($date_end)) {
$date_end = strtotime($date_end);
}
$sql = "SELECT *
FROM tagente_datos
WHERE
id_agente_modulo = " . (int)$id_agent_module . "
AND (utimestamp >= " . $date_init . " AND utimestamp <= " . $date_end . ")";
$data = db_get_all_rows_sql($sql, $config['history_db_enabled']);
if (empty($data)) {
$data = array();
}
$interval = modules_get_interval($id_agent_module);
$total_time_with_value = 0;
$on_value_detected = false;
$timestamp_with_value = null;
foreach ($data as $row) {
if ($row['datos'] == $value) {
if (!$on_value_detected) {
$timestamp_with_value = $row['utimestamp'];
$on_value_detected = true;
}
}
else {
if ($on_value_detected) {
$total_time_with_value
+= $row['utimestamp'] - $timestamp_with_value;
$on_value_detected = false;
}
}
}
if ($on_value_detected && !empty($data)) {
$total_time_with_value
+= $date_end - $timestamp_with_value;
}
return $total_time_with_value / $interval;
}
function modules_get_first_contact_date($id_agent_module) {
global $config;

View File

@ -626,7 +626,8 @@ function reporting_SLA($report, $content, $type = 'dinamic',
}
}
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 ($metaconsole_on) {
//Restore db connection
metaconsole_restore_db();
@ -3673,7 +3674,10 @@ function reporting_availability($report, $content) {
}
}
if (modules_is_disable_agent($item['id_agent_module'])) {
if (modules_is_disable_agent($item['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])) {
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
@ -3700,18 +3704,29 @@ function reporting_availability($report, $content) {
$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 . ")";
$sla_value = reporting_get_agentmodule_sla(
$item['id_agent_module'],
$content['period'],
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 (empty($count_checks)) {
if ($sla_value === false) {
$row['checks'] = __('Unknown');
$row['failed'] = __('Unknown');
$row['fail'] = __('Unknown');
@ -3722,27 +3737,29 @@ function reporting_availability($report, $content) {
$percent_ok = 0;
}
else {
$count_fails = modules_get_count_data_with_value(
$item['id_agent_module'],
$report["datetime"] - $content['period'],
$report["datetime"],
0);
$percent_ok = (($count_checks - $count_fails) * 100) / $count_checks;
$percent_fail = 100 - $percent_ok;
$percent_ok = format_numeric($sla_value, 2);
$percent_fail = (100 - $percent_ok);
$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['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['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;
@ -3770,6 +3787,7 @@ function reporting_availability($report, $content) {
}
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
@ -3905,7 +3923,14 @@ function reporting_general($report, $content) {
}
}
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'])) {
if (is_metaconsole()) {
//Restore db connection
metaconsole_restore_db();
}
continue;
}

View File

@ -487,6 +487,7 @@ function snmp_browser_print_oid ($oid = array(), $custom_action = '',
function snmp_browser_print_container ($return = false, $width = '100%', $height = '500px', $display = '') {
// Target selection
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->size = array ();
@ -506,10 +507,11 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
'2c' => 'v. 2c',
'3' => 'v. 3'),
'snmp_browser_version', '', 'checkSNMPVersion();', '', '', true, false, false, '');
$table->data[0][4] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true);
// SNMP v3 options
$table3 = new stdClass();
$table3->width = '100%';
$table3->valign[0] = '';
@ -533,6 +535,7 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
'authNoPriv' => __('Auth and not privacy method'), 'authPriv' => __('Auth and privacy method')), 'snmp3_browser_security_level', '', '', '', '', true);
// Search tools
$table2 = new stdClass();
$table2->width = '100%';
$table2->class = 'databox filters';
$table2->size = array ();

View File

@ -161,14 +161,8 @@ switch($graph_type) {
$data_values[$name][] = $val;
}
if (($c % $step) == 0) {
$data_keys[] = $i;
}
else {
$data_keys[] = "";
}
$c++;
$data_keys[] = $i;
}
$fine_colors = array();

View File

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

View File

@ -132,7 +132,7 @@ if (!defined('METACONSOLE')) {
}
}
else {
if ($ag_group != "0" && check_acl ($config["id_user"], $id_ag_group, "AR")) {
$sql_conditions_group = sprintf (" AND tagente.id_grupo IN (%s) ", $ag_group);
}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150721
%define release 150722
# 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 150721
%define release 150722
%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', '6.0dev'),
('db_scheme_version','6.0dev'),
('db_scheme_build','PD150721'),
('db_scheme_build','PD150722'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150721
Version: 6.0dev-150722
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-150721"
pandora_version="6.0dev-150722"
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 = "150721";
my $pandora_build = "150722";
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 6.0dev
%define release 150721
%define release 150722
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150721
%define release 150722
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 PS150721";
my $version = "6.0dev PS150722";
# Pandora server configuration
my %conf;
@ -639,7 +639,7 @@ sub pandora_load_config ($) {
$conf->{'claim_back_snmp_modules'} = '1' unless defined ($conf->{'claim_back_snmp_modules'});
# Read additional tokens from the DB
my $dbh = db_connect ('mysql', $conf->{'dbname'}, $conf->{'dbhost'}, $conf->{'dbport'}, $conf->{'dbuser'}, $conf->{'dbpass'});
my $dbh = db_connect ($conf->{'dbengine'}, $conf->{'dbname'}, $conf->{'dbhost'}, $conf->{'dbport'}, $conf->{'dbuser'}, $conf->{'dbpass'});
$conf->{'_event_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'event_purge'");
$conf->{'_trap_purge'} = get_db_value ($dbh, "SELECT value FROM tconfig WHERE token = 'trap_purge'");

View File

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