diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 93e86403fe..6478256f61 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 6.0dev-150721 +Version: 6.0dev-150722 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 141dd96ccf..38482c62ef 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -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 diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 6903598b11..0a90b4550e 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -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 => { diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d5874429a2..fe518f358a 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -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} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 507a52d8aa..028db9da5a 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -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} diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6270c7b796..64f9e028d9 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{150721} +{150722} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 4bfbe295cc..715c2095db 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -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; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 87f7b84f5b..5be01e2ad6 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -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 diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 451cff6c8f..251c7d1ec8 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 6.0dev-150721 +Version: 6.0dev-150722 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index f45d044eb2..a1cca395d8 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -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 diff --git a/pandora_console/extras/pandora_diag.php b/pandora_console/extras/pandora_diag.php index 6f634c6250..540cf27f0f 100644 --- a/pandora_console/extras/pandora_diag.php +++ b/pandora_console/extras/pandora_diag.php @@ -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"); diff --git a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql index ca5325b41a..60c4782f7c 100755 --- a/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.1_to_6.0.mysql.sql @@ -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` diff --git a/pandora_console/general/firts_task/custom_graphs.php b/pandora_console/general/firts_task/custom_graphs.php index 32af1d1320..2d63aa4382 100644 --- a/pandora_console/general/firts_task/custom_graphs.php +++ b/pandora_console/general/firts_task/custom_graphs.php @@ -32,7 +32,7 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no cu

-
+
diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 062113f434..cedc5b6f81 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -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 (); diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index b4b5d89912..891bd51024 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -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) { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4ce2547778..bfa7ad4e0b 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -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. diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 2f7b21fd04..e1fe90ea27 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -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; diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 54752b9e69..40f7f8ec3e 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -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; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 18df82fac3..4304c89420 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -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; } diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 19efca7c0c..10b40a9155 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -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 (); diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index 397f405988..b231d889f1 100755 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -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(); diff --git a/pandora_console/install.php b/pandora_console/install.php index d8392a0302..203f997264 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -63,7 +63,7 @@
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); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index f636e386c8..7fdd02501a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 6.0dev -%define release 150721 +%define release 150722 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index d52ed6da19..d074d5f30f 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 6.0dev -%define release 150721 +%define release 150722 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 973a07db04..c7276537c8 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -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'"); diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index ad4b5b3873..78b9e8962a 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -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);