Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop

This commit is contained in:
Sancho Lerena 2014-10-14 18:03:07 +02:00
commit dea7cd84b1
79 changed files with 1528 additions and 623 deletions

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, AIX version
# Version 5.1SP1RC1, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, FreeBSD Version
# Version 5.1SP1RC1, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, HP-UX Version
# Version 5.1SP1RC1, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, GNU/Linux
# Version 5.1SP1RC1, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, GNU/Linux
# Version 5.1SP1RC1, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, Solaris Version
# Version 5.1SP1RC1, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 5.1SP1
# Version 5.1SP1RC1
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 5.1SP1, AIX version
# Version 5.1SP1RC1, AIX version
# General Parameters
# ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 5.1SP1
# Version 5.1SP1RC1
# FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 5.1SP1, HPUX Version
# Version 5.1SP1RC1, HPUX Version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1
# Version 5.1SP1RC1
# Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1
# Version 5.1SP1RC1
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1
# Version 5.1SP1RC1
# Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents
# Version 5.1SP1, Solaris version
# Version 5.1SP1RC1, Solaris version
# General Parameters
# ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, AIX version
# Version 5.1SP1RC1, AIX version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 5.1SP1-141007
Version: 5.1SP1RC1-141014
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.1SP1-141007"
pandora_version="5.1SP1RC1-141014"
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

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, GNU/Linux
# Version 5.1SP1RC1, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, FreeBSD Version
# Version 5.1SP1RC1, FreeBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, HP-UX Version
# Version 5.1SP1RC1, HP-UX Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, GNU/Linux
# Version 5.1SP1RC1, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, GNU/Linux
# Version 5.1SP1RC1, GNU/Linux
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, NetBSD Version
# Version 5.1SP1RC1, NetBSD Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents
# Version 5.1SP1, Solaris Version
# Version 5.1SP1RC1, Solaris Version
# Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads
my $ThreadSem = undef;
use constant AGENT_VERSION => '5.1SP1';
use constant AGENT_BUILD => '141007';
use constant AGENT_VERSION => '5.1SP1RC1';
use constant AGENT_BUILD => '141014';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 5.1SP1
%define release 141007
%define version 5.1SP1RC1
%define release 141014
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent
#
%define name pandorafms_agent_unix
%define version 5.1SP1
%define release 141007
%define version 5.1SP1RC1
%define release 141014
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent
# (c) 2006-2014 Artica Soluciones Tecnologicas
# Version 5.1SP1
# Version 5.1SP1RC1
# This program is Free Software, you can redistribute it and/or modify it
# under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes}
AppName
{Pandora FMS Windows Agent v5.1SP1}
{Pandora FMS Windows Agent v5.1SP1RC1}
ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{141007}
{141014}
ViewReadme
{Yes}

View File

@ -1464,6 +1464,7 @@ Pandora_Module::evaluateConditions () {
}
WaitForSingleObject(pi.hProcess, this->module_timeout);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
}
}
}

View File

@ -640,6 +640,7 @@ Pandora_Module_Logevent::getEventDescriptionXPATH (PEVENTLOGRECORD pevlr) {
description = strUnicodeToAnsi (pwsMessage);
// Cleanup
free(pwsMessage);
free(pRenderedValues);
EvtCloseF(hProviderMetadata);
EvtCloseF(hContext);

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("5.1SP1(Build 141007)")
#define PANDORA_VERSION ("5.1SP1RC1(Build 141014)")
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.1SP1(Build 141007))"
VALUE "ProductVersion", "(5.1SP1RC1(Build 141014))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 5.1SP1-141007
Version: 5.1SP1RC1-141014
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.1SP1-141007"
pandora_version="5.1SP1RC1-141014"
package_pear=0
package_pandora=1

View File

@ -105,7 +105,16 @@ if (!empty($macros)) {
?>
<script type="text/javascript">
function changePluginSelect() {
if (flag_load_plugin_component) {
flag_load_plugin_component = false;
return;
}
load_plugin_description($("#id_plugin").val());
load_plugin_macros_fields('simple-macro');
forced_title_callback();
}
</script>

View File

@ -164,7 +164,7 @@ if ($create_downtime || $update_downtime) {
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))) {
ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end time must be higher than the start time'));
}
else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from >= $periodically_day_to) {
else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from > $periodically_day_to) {
ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end day must be higher than the start day'));
}
else {
@ -442,7 +442,7 @@ $table->data[5][1] = "
</table>
</div>";
echo '<form method="POST" action="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.editor">';
echo '<form method="POST" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor">';
if ($id_downtime > 0) {
echo "<table width=100% border=0 cellpadding=4 >";
@ -502,7 +502,7 @@ if ($id_downtime > 0) {
$disabled_add_button = true;
}
echo "<form method=post action='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
html_print_select_groups(false, "AW", true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'width:180px');
@ -510,7 +510,7 @@ if ($id_downtime > 0) {
html_print_submit_button (__('Filter by group'), '', false, 'class="sub next"',false);
echo "</form>";
echo "<form method=post action='index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
echo html_print_select ($data, "id_agents[]", '', '', '', 0, false, true, true, '', false, 'width: 180px;');
echo '<h4>' . __('Available modules:') .
@ -593,7 +593,7 @@ if ($id_downtime > 0) {
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Delete'))) . "</a>";
}
$data[5] .= '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.editor'.
$data[5] .= '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor'.
'&amp;id_agent=' . $downtime["id_agente"] .
'&amp;delete_downtime_agent=1' .
'&amp;id_downtime_agent=' . $downtime["id"] .

View File

@ -27,6 +27,21 @@ if (! check_acl ($config['id_user'], 0, "AW")) {
require_once ('include/functions_users.php');
require_once ('include/functions_events.php');
require_once ('include/functions_planned_downtimes.php');
$malformed_downtimes = planned_downtimes_get_malformed();
$malformed_downtimes_exist = !empty($malformed_downtimes) ? true : false;
$migrate_malformed = (bool) get_parameter("migrate_malformed");
if ($migrate_malformed) {
$migration_result = planned_downtimes_migrate_malformed_downtimes();
if ($migration_result['status'] == false) {
ui_print_error_message(__('An error occurred while migrating the malformed planned downtimes') . ". "
. __('Please run the migration again or contact with the administrator'));
echo "<br>";
}
}
// Header
ui_print_page_header(
@ -272,8 +287,9 @@ $table = new StdClass();
$table->class = 'databox';
//Start Overview of existing planned downtime
$table->width = '98%';
$table->data = array ();
$table->head = array ();
$table->cellstyle = array();
$table->data = array();
$table->head = array();
$table->head[0] = __('Name #Ag.');
$table->head[1] = __('Description');
$table->head[2] = __('Group');
@ -285,7 +301,6 @@ $table->head[7] = __('Stop downtime');
$table->head[8] = __('Edit');
$table->head[9] = __('Delete');
$table->align[2] = "center";
//$table->align[5] = "center";
$table->align[6] = "center";
$table->align[7] = "center";
$table->align[8] = "center";
@ -478,7 +493,7 @@ else {
if ($downtime["executed"] == 0) {
$data[8] = '<a
href="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.editor&amp;edit_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor&amp;edit_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '</a>';
$data[9] = '<a id="delete_downtime" href="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.list&amp;'.
'delete_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
@ -489,6 +504,16 @@ else {
$data[9]= "N/A";
}
if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) {
$next_row_num = count($table->data);
$table->cellstyle[$next_row_num][0] = 'color: red';
$table->cellstyle[$next_row_num][1] = 'color: red';
$table->cellstyle[$next_row_num][3] = 'color: red';
$table->cellstyle[$next_row_num][4] = 'color: red';
$table->cellstyle[$next_row_num][5] = 'color: red';
}
array_push ($table->data, $data);
}
html_print_table ($table);
@ -500,7 +525,7 @@ echo '<div style="display: inline;">';
html_print_button(__('Export to CSV'), 'csv_export', false, "location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'", 'class="sub next"');
echo '</div>';
echo '&nbsp;';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
html_print_submit_button (__('Create'), 'create', false, 'class="sub next"');
echo '</form>';
echo '</div>';
@ -522,6 +547,12 @@ $(document).ready (function () {
e.preventDefault();
}
});
if (<?php echo json_encode($malformed_downtimes_exist) ?> && <?php echo json_encode($migrate_malformed == false) ?>) {
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes') . '.\n' . __('Do you want to migrate automatically the malformed items?'); ?>")) {
window.location.href = "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
}
}
});
</script>

View File

@ -18,78 +18,19 @@
// Load global vars
global $config;
require_once ($config['homedir'] . '/include/functions_graph.php');
require_once($config['homedir'] . '/include/functions_agents.php');
require_once($config['homedir'] . '/include/functions_modules.php');
check_login();
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database information'), "images/gm_db.png", false, "", true);
check_login ();
if (! check_acl ($config['id_user'], 0, "DM")) {
db_pandora_audit("ACL Violation",
"Trying to access Database Management Info");
require ("general/noaccess.php");
return;
}
// Todo for a good DB maintenance
/*
- Delete too on datos_string and and datos_inc tables
- A function to "compress" data, and interpolate big chunks of data (1 month - 60000 registers)
onto a small chunk of interpolated data (1 month - 600 registers)
- A more powerful selection (by Agent, by Module, etc).
*/
require_once ($config['homedir'] . '/include/functions_graph.php');
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database information'), "images/gm_db.png", false, "", true);
echo '<h4>'.__('Module data received').'</h4>';
echo grafico_db_agentes_purge(0, 600, 400);
echo '<div id="db_info_graph">';
echo '<table border=0 width="98%">';
echo '<tr><td>';
echo '<h4>'.__('Modules per agent').'</h4>';
echo graph_db_agentes_modulos(600, 250);
echo '</td></tr><tr><td><br /></tr></td>';
echo '<tr><td>';
echo '<h4>'.__('Packets per agent').'</h4>';
echo grafico_db_agentes_paquetes(700, 300);
echo '</table>';
echo '<a href="#" onClick="toggleDiv(\'db_info_data\'); toggleDiv(\'db_info_graph\'); return false;"><b>'.__('Press here to get database information as text').'</b>&nbsp;' . html_print_image("images/down.png", true, array("alt" => "down", "title" => "down")) . '</a></div>';
echo '<div id="db_info_data" style="display:none">';
//Merged from db_info_data.php because the queries are the same, so the cache
//will kick in.
$table->data = array ();
$table->head = array ();
$table->head[0] = __('Agent name');
$table->head[1] = __('Assigned modules');
$table->head[2] = __('Total data');
$agents = agents_get_group_agents (0);
$count = agents_get_modules_data_count (array_keys ($agents));
unset ($count["total"]); //Not interested in total
asort ($count, SORT_NUMERIC);
foreach ($count as $agent_id => $value) {
$data = array ();
//First row is a link to the agent
$data[0] = '<strong><a href="index.php?sec=gagente&sec2=operation/agentes/ver_agente&id_agente='.$agent_id.'">'.$agents[$agent_id].'</a></strong>';
//Second row is a number of modules for the agent
$data[1] = modules_get_agent_modules_count ($agent_id);
//Then the number of data packets for the agent
$data[2] = $value;
array_unshift ($table->data, $data);
}
html_print_table ($table);
echo '<a href="#" onClick="toggleDiv(\'db_info_graph\'); toggleDiv(\'db_info_data\'); return false;">'.__('Press here to get database information as a graph').'</a></div>';
?>
?>

View File

@ -1,124 +0,0 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 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.
// Load global vars
global $config;
check_login();
if (! check_acl ($config["id_user"], 0, "DM")) {
db_pandora_audit("ACL Violation",
"Trying to access Database cure section");
require ("general/noaccess.php");
return;
}
ui_print_page_header (__('Database maintenance').' &raquo; '.__('Database sanity tool'), "images/gm_db.png", false, "", true);
$sanity = get_parameter ("sanity", 0);
if ($sanity == 1) {
// Create tagente estado when missing
echo "<h2>".__('Checking tagente_estado table')."</h2>";
$rows = db_get_all_rows_in_table('tagente_modulo');
if ($rows === false) {
$rows = array();
}
foreach ($rows as $row) {
$id_agente_modulo = $row['id_agente_modulo'];
$id_agente = $row["id_agente"];
// check if exist in tagente_estado and create if not
$sql = "SELECT COUNT(*) FROM tagente_estado
WHERE id_agente_modulo = $id_agente_modulo";
$total = db_get_sql ($sql);
if ($total == 0) {
$sql = "INSERT INTO tagente_estado (id_agente_modulo, datos, timestamp, estado, id_agente, last_try, utimestamp, current_interval, running_by, last_execution_try) VALUE ($id_agente_modulo, 0, '01-01-1970 00:00:00', 0, 100, $id_agente, '01-01-1970 00:00:00', 0, 0, 0)";
echo "Inserting module $id_agente_modulo in state table <br>";
db_process_sql ($sql);
}
}
ui_print_message(__('Check tagente_estado table: Done'));
echo "<h3>".__('Checking database consistency')."</h2>";
$rows = db_get_all_rows_in_table('tagente_estado');
if ($rows === false) {
$rows = array();
}
foreach ($rows as $row) {
$id_agente_modulo = $row['id_agente_modulo'];
# check if exist in tagente_estado and create if not
$rows = db_get_all_rows_sql("SELECT COUNT(*) AS count FROM tagente_modulo WHERE id_agente_modulo = $id_agente_modulo");
if ($rows !== false) {
$row = reset($rows);
$count = $row['count'];
if ($count == 0) {
echo "Deleting non-existing module $id_agente_modulo in state table <br>";
db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agente_modulo));
}
}
}
ui_print_message(__('Check database consistency: Done'));
}
elseif ($sanity == 2) {
echo "<h3>".__('Deleting non-init data')."</h2>";
$rows = db_get_all_rows_filter("tagente_estado", array("utimestamp" => 0));
if ($rows === false) {
$rows = array();
}
foreach ($rows as $row) {
echo "Deleting non init module " . $row['id_agente_modulo'] ." <br>";
modules_delete_agent_module($row['id_agente_modulo']);
}
echo "Deleting bad module (id 0)<br>";
$bad_modules = db_get_all_rows_filter('tagente_modulo', array('id_modulo' => 0));
foreach($bad_modules as $bm) {
modules_delete_agent_module ($bm['id_agente_modulo']);
}
}
echo "<br>";
echo "<div style='width:98%'>";
echo __('Pandora FMS Sanity tool is used to remove bad database structure data, created modules with missing status, or modules that cannot be initialized (and don\'t report any valid data) but retry each its own interval to get data. This kind of bad modules could degrade performance of Pandora FMS. This database sanity tool is also implemented in the <b>pandora_db.pl</b> that you should be running each day or week. This console sanity DONT compact your database, only delete bad structured data.');
echo "<br><br>";
echo "<b><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity&sanity=1'>";
echo html_print_image('images/status_away.png', true) . "&nbsp;&nbsp;";
echo __('Sanitize my database now');
echo "</a></b>";
echo "<br><br>";
echo "<b><a href='index.php?sec=gdbman&sec2=godmode/db/db_sanity&sanity=2'>";
echo html_print_image('images/status_away.png', true) . "&nbsp;&nbsp;";
echo __('Delete non-initialized modules now');
echo "</a></b>";
echo "</div>";
?>

View File

@ -247,7 +247,6 @@ if (check_acl ($config['id_user'], 0, "DM")) {
$sub["godmode/db/db_refine"]["text"] = __('Database debug');
$sub["godmode/db/db_audit"]["text"] = __('Database audit');
$sub["godmode/db/db_event"]["text"] = __('Database event');
$sub["godmode/db/db_sanity"]["text"] = __('Database sanity');
$menu_godmode["gdbman"]["sub"] = $sub;
}

View File

@ -209,6 +209,37 @@ elseif ($disable_user !== false) { //disable_user
}
}
$filter_group = (int)get_parameter('filter_group', 0);
$filter_search = get_parameter('filter_search', '');
$search = (bool)get_parameter('search', false);
if (($filter_group == 0) && ($filter_search == '')) {
$search = false;
}
$table = null;
$table->width = '99%';
$table->class = "databox";
$table->rowclass[0] = '';
$table->data[0][0] = '<b>' . __('Group') . '</b>';
$table->data[0][1] = html_print_select_groups(false, "AR", true,
'filter_group', $filter_group, '', '', 0, true);
$table->data[0][2] = '<b>' . __('Search') . '</b>' .
ui_print_help_tip(__('Search by username, fullname or email'), true);
$table->data[0][3] = html_print_input_text('filter_search',
$filter_search, __('Search by username, fullname or email'), 30, 90, true);
$table->data[0][4] = html_print_submit_button(__('Search'), 'search',
false, array('class' => 'sub search'), true);
$form_filter = "<form method='post'>";
$form_filter .= html_print_table($table, true);
$form_filter .= "</form>";
ui_toggle($form_filter, __('Users control filter'), __('Toggle filter(s)'), !$search);
$table = null;
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = '99%';
@ -252,10 +283,53 @@ $table->valign[4] = 'top';
$table->valign[5] = 'top';
$table->valign[6] = 'top';
$info1 = array ();
$info1 = get_users ($order);
//Filter the users
if ($search) {
foreach ($info1 as $iterator => $user_info) {
$found = false;
if (!empty($filter_search)) {
if (preg_match("/.*" . $filter_search . ".*/", $user_info['fullname']) != 0) {
$found = true;
}
if (preg_match("/.*" . $filter_search . ".*/", $user_info['id_user']) != 0) {
$found = true;
}
if (preg_match("/.*" . $filter_search . ".*/", $user_info['email']) != 0) {
$found = true;
}
}
if ($filter_group != 0) {
$groups = users_get_groups($user_info['id_user'], 'AR',
$user_info['is_admin']);
$id_groups = array_keys($groups);
if (array_search($filter_group, $id_groups) !== false) {
$found = true;
}
}
if (!$found) {
unset($info1[$iterator]);
}
}
}
//~
//~ $filter_group
//~ $filter_search
//~
$info = array();
$own_info = get_user_info ($config['id_user']);
$own_groups = users_get_groups ($config['id_user'], 'AR', $own_info['is_admin']);

View File

@ -22,8 +22,8 @@
/**
* Pandora build version and version
*/
$build_version = 'PC141007';
$pandora_version = 'v5.1SP1';
$build_version = 'PC141014';
$pandora_version = 'v5.1SP1RC1';
// Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get();

View File

@ -377,7 +377,10 @@ define("CUSTOM_GRAPH_LINE", 2);
define("CUSTOM_GRAPH_STACKED_LINE", 3);
/* COLLECTIONS */
define("COLLECTION_CORRECT", 0);
define("COLLECTION_PENDING_APPLY", 1);
define("COLLECTION_PENDING_APPLY", 0);
define("COLLECTION_CORRECT", 1);
define("COLLECTION_ERROR_LOST_DIRECTORY", 2);
/* PAGINATION */
define("PAGINATION_BLOCKS_LIMIT", 15);
?>

View File

@ -378,6 +378,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
'group_parent',
'disabled',
'custom_id',
'group_description',
'group_contact',
'group_other',
'agent_id',
'agent_name',
@ -677,7 +680,10 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType)
$returnVar = array();
$groups = db_get_all_rows_sql('SELECT id_grupo as group_id, nombre as group_name, parent as group_parent, disabled, custom_id FROM tgrupo');
$groups = db_get_all_rows_sql('SELECT id_grupo as group_id, ' .
'nombre as group_name, parent as group_parent, disabled, custom_id, ' .
'description as group_description, contact as group_contact, ' .
'other as group_other FROM tgrupo');
if ($groups === false) $groups = array();
$groups = str_replace('\n', $returnReplace, $groups);

View File

@ -102,9 +102,12 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
foreach ($chart_array as $item) {
if ($series_suffix != '') {
$item['sum'] = $item['sum' . $series_suffix];
$item['min'] = $item['min' . $series_suffix];
$item['max'] = $item['max' . $series_suffix];
if (isset($item['sum' . $series_suffix]))
$item['sum'] = $item['sum' . $series_suffix];
if (isset($item['min' . $series_suffix]))
$item['min'] = $item['min' . $series_suffix];
if (isset($item['max' . $series_suffix]))
$item['max'] = $item['max' . $series_suffix];
}
//Get stats for normal graph
@ -1746,60 +1749,205 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
if ($id_agent < 1) {
$id_agent = -1;
$query = "";
}
else {
$modules = agents_get_modules ($id_agent);
$query = sprintf (" AND id_agente_modulo IN (%s)", implode (",", array_keys ($modules)));
$modules = agents_get_modules($id_agent);
$module_ids = array_keys($modules);
if (!empty($module_ids)) {
$module_ids_str = implode(",", $module_ids);
if (empty($module_ids_str))
$module_ids_str = "0";
}
else {
$module_ids_str = "0";
}
$query = sprintf (" AND id_agente_modulo IN (%s)", $module_ids_str);
}
// All data (now)
$time["all"] = get_system_time ();
$time_now = time();
// 1 day ago
$time["1day"] = $time["all"] - SECONDS_1DAY;
$time_1day = $time_now - SECONDS_1DAY;
// 1 week ago
$time["1week"] = $time["all"] - SECONDS_1WEEK;
$time_1week = $time_now - SECONDS_1WEEK;
// 1 month ago
$time["1month"] = $time["all"] - SECONDS_1MONTH;
$time_1month = $time_now - SECONDS_1MONTH;
// Three months ago
$time["3month"] = $time["all"] - SECONDS_3MONTHS;
$time_3months = $time_now - SECONDS_3MONTHS;
$data[__("Today")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1day"], $query), 0, true);
$data["1 ".__("Week")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1week"], $query), 0, true);
$data["1 ".__("Month")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["1month"], $query), 0, true);
$data["3 ".__("Months")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE utimestamp > %d %s", $time["3month"], $query), 0, true);
$data[__("Older")] = db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos WHERE 1=1 %s", $query));
$data[__("Today")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1day"], $query), 0, true);
$data["1 ".__("Week")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1week"], $query), 0, true);
$data["1 ".__("Month")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["1month"], $query), 0, true);
$data["3 ".__("Months")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE utimestamp > %d %s", $time["3month"], $query), 0, true);
$data[__("Older")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_string WHERE 1=1 %s", $query), 0, true);
$data[__("Today")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1day"], $query), 0, true);
$data["1 ".__("Week")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1week"], $query), 0, true);
$data["1 ".__("Month")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["1month"], $query), 0, true);
$data["3 ".__("Months")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE utimestamp > %d %s", $time["3month"], $query), 0, true);
$data[__("Older")] += db_get_sql (sprintf ("SELECT COUNT(*) FROM tagente_datos_log4x WHERE 1=1 %s", $query), 0, true);
$data[__("Older")] = $data[__("Older")] - $data["3 ".__("Months")];
if ($data[__("Today")] == 0 && $data["1 ".__("Week")] == 0 &&
$data["1 ".__("Month")] == 0 && $data["3 ".__("Months")] == 0 && $data[__("Older")] == 0) {
$query_error = false;
// Data from 1 day ago
$sql_1day = sprintf("SELECT COUNT(*)
+ (SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp >= %d %s)
+ (SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp >= %d %s)
FROM tagente_datos
WHERE utimestamp > %d %s",
$time_1day, $query,
$time_1day, $query,
$time_1day, $query);
$num_1day = db_get_sql($sql_1day);
if ($num_1day !== false) {
// Data from 1 week ago
$sql_1week = sprintf("SELECT COUNT(*)
+ (SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp >= %d %s)
+ (SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp >= %d %s)
FROM tagente_datos
WHERE utimestamp >= %d %s",
$time_1week, $query,
$time_1week, $query,
$time_1week, $query);
$num_1week = db_get_sql($sql_1week);
if ($num_1week !== false) {
// Data from 1 month ago
$sql_1month = sprintf("SELECT COUNT(*)
+ (SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp >= %d %s)
+ (SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp >= %d %s)
FROM tagente_datos
WHERE utimestamp >= %d %s",
$time_1month, $query,
$time_1month, $query,
$time_1month, $query);
$num_1month = db_get_sql($sql_1month);
if ($num_1month !== false) {
// Data from 3 months ago
$sql_3months = sprintf("SELECT COUNT(*)
+ (SELECT COUNT(*)
FROM tagente_datos_string
WHERE utimestamp >= %d %s)
+ (SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE utimestamp >= %d %s)
FROM tagente_datos
WHERE utimestamp >= %d %s",
$time_3months, $query,
$time_3months, $query,
$time_3months, $query);
$num_3months = db_get_sql($sql_3months);
if ($num_3months !== false) {
// All data
$sql_all = sprintf("SELECT COUNT(*)
+ (SELECT COUNT(*)
FROM tagente_datos_string
WHERE 1=1 %s)
+ (SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE 1=1 %s)
FROM tagente_datos
WHERE 1=1 %s",
$query, $query, $query);
$num_all = db_get_sql($sql_all);
if ($num_all !== false) {
$num_older = $num_all - $num_3months;
if ($config['history_db_enabled'] == 1) {
// All data in common and history database
$sql_all_w_history = sprintf("SELECT COUNT(*)
+ (SELECT COUNT(*)
FROM tagente_datos_string
WHERE 1=1 %s)
+ (SELECT COUNT(*)
FROM tagente_datos_log4x
WHERE 1=1 %s)
FROM tagente_datos
WHERE 1=1 %s",
$query, $query, $query);
$num_all_w_history = db_get_sql($sql_all_w_history, 0, true);
if ($num_all_w_history !== false) {
$num_history = $num_all_w_history - $num_all;
} else {
$query_error = true;
}
}
} else {
$query_error = true;
}
} else {
$query_error = true;
}
} else {
$query_error = true;
}
} else {
$query_error = true;
}
} else {
$query_error = true;
}
// Error
if ($query_error || $num_older < 0 || ($config['history_db_enabled'] == 1 && $num_history < 0)
|| (empty($num_1day) && empty($num_1week) && empty($num_1month)
&& empty($num_3months) && empty($num_all)
&& ($config['history_db_enabled'] == 1 && empty($num_all_w_history)))) {
return html_print_image('images/image_problem.png', true);
}
// Data indexes
$str_1day = __("Today");
$str_1week = "1 ".__("Week");
$str_1month = "1 ".__("Month");
$str_3months = "3 ".__("Months");
$str_older = "> 3 ".__("Months");
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
// Filling the data array
$data = array();
if (!empty($num_1day))
$data[$str_1day] = $num_1day;
if (!empty($num_1week))
$data[$str_1week] = $num_1week;
if (!empty($num_1month))
$data[$str_1month] = $num_1month;
if (!empty($num_3months))
$data[$str_3months] = $num_3months;
if (!empty($num_older))
$data[$str_older] = $num_older;
if ($config['history_db_enabled'] == 1 && !empty($num_history)) {
// In this pie chart only 5 elements are shown, so we need to remove
// an element. With a history db enabled the >3 months element are dispensable
if (count($data) >= 5 && isset($data[$str_3months]))
unset($data[$str_3months]);
$time_historic_db = time() - ((int)$config['history_db_days'] * SECONDS_1DAY);
$date_human = human_time_comparation($time_historic_db);
$str_history = "> $date_human (".__("History db").")";
$data[$str_history] = $num_history;
}
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png")
);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
__('Other'), '', $water_mark, $config['fontpath'], $config['font_size']);
}
/**
@ -3726,8 +3874,8 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
}
else {
$data[$cont]['data'] = 1;
$current_timestamp = $bottom;
}
$current_timestamp = $bottom;
$legend[] = date($time_format, $current_timestamp);
$cont++;

View File

@ -521,7 +521,7 @@ function menu_get_sec($with_categories = false) {
*
* @return array Sections list
*/
function menu_get_sec_pages($sec,$menu_hash = false) {
function menu_get_sec_pages($sec, $menu_hash = false) {
if ($menu_hash === false) {
$menu = menu_get_full_sec();
}
@ -529,21 +529,30 @@ function menu_get_sec_pages($sec,$menu_hash = false) {
$menu = json_decode(base64_decode($menu_hash),true);
}
// Get the sec2 of the main section
$sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text'];
$sec2_array = array();
// Get the sec2 of the subsections
foreach ($menu[$sec]['sub'] as $k => $v) {
// Avoid special cases of standalone windows
if (preg_match('/^javascript:/',$k) || preg_match('/\.php/',$k)) {
continue;
if (isset($sec)) {
// Get the sec2 of the main section
$sec2_array[$menu[$sec]['sec2']] = $menu[$sec]['text'];
// Get the sec2 of the subsections
foreach ($menu[$sec]['sub'] as $k => $v) {
// Avoid special cases of standalone windows
if (preg_match('/^javascript:/', $k) || preg_match('/\.php/', $k)) {
continue;
}
// If this value has various parameters, we only get the first
$k = explode('&',$k);
$k = $k[0];
$sec2_array[$k] = $v['text'];
}
// If this value has various parameters, we only get the first
$k = explode('&',$k);
$k = $k[0];
$sec2_array[$k] = $v['text'];
}
return $sec2_array;

View File

@ -0,0 +1,521 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 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 Lesser General Public License
// as published by the Free Software Foundation; 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.
/**
* @package Include
* @subpackage Planned downtimes
*/
// Load global vars
global $config;
/**
* Include the usual functions
*/
// require_once($config["homedir"] . "/include/functions.php");
// enterprise_include_once('include/functions_inventory.php');
function planned_downtimes_check_dates ($type_execution = 'once', $type_periodicity = '', $datetime_from = false, $datetime_to = false, $periodically_time_from = false, $periodically_time_to = false, $periodically_day_from = false, $periodically_day_to = false) {
global $config;
$now = time();
$result = array(
'result' => false,
'message' => ''
);
if ($type_execution == 'once' && !$config["past_planned_downtimes"] && $datetime_from < $now) {
$result['message'] = ui_print_error_message(__('Not created. Error inserting data. Start time must be higher than the current time' ), '', true);
}
else if ($type_execution == 'once' && $datetime_from >= $datetime_to) {
$result['message'] = ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end date must be higher than the start date'), '', true);
}
else if ($type_execution == 'periodically'
&& (($type_periodicity == 'weekly' && $periodically_time_from >= $periodically_time_to)
|| ($type_periodicity == 'monthly' && $periodically_day_from == $periodically_day_to && $periodically_time_from >= $periodically_time_to))) {
$result['message'] = ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end time must be higher than the start time'), '', true);
}
else if ($type_execution == 'periodically' && $type_periodicity == 'monthly' && $periodically_day_from > $periodically_day_to) {
$result['message'] = ui_print_error_message(__('Not created. Error inserting data') . ". " .__('The end day must be higher than the start day'), '', true);
}
else {
$result['result'] = true;
}
return $result;
}
/**
* Update or create a planned downtime.
*
* @param array Values of the planned downtime.
* @param int Id of the planned downtime. Empty to create a new downtime.
*
* @return array Id of the updated/created planned downtime, result of the operation and result message.
*/
function planned_downtimes_update ($values, $downtime_id = 0, $check_dates = true) {
$result = array(
'id' => $downtime_id,
'result' => false,
'message' => ''
);
if ($check_dates) {
$dates_check = planned_downtimes_check_dates($values['type_execution'], $values['type_periodicity'],
$values['date_from'], $values['date_to'], $values['periodically_time_from'], $values['periodically_time_to'],
$values['periodically_day_from'], $values['periodically_day_to']);
if (!$dates_check['result']) {
$result['message'] = $dates_check['message'];
return $result;
}
}
$name_trimmed = trim(io_safe_output($values['name']));
if (!empty($name_trimmed)) {
$name_exists = (bool) db_get_value('id', 'tplanned_downtime', 'name', $values['name']);
if ($name_exists) {
$result['message'] = ui_print_error_message(__('Each planned downtime must have a different name'), '', true);
return $result;
}
}
else {
$result['message'] = ui_print_error_message(__('Planned downtime must have a name'), '', true);
return $result;
}
if (empty($downtime_id)) {
$res = db_process_sql_insert('tplanned_downtime', $values);
if ($res === false) {
$result['message'] = ui_print_error_message(__('Could not be created'), '', true);
}
else {
$result['message'] = ui_print_success_message(__('Successfully created'), '', true);
$result['result'] = true;
$result['id'] = $res;
}
}
else {
$res = db_process_sql_update('tplanned_downtime', $values, array('id' => $downtime_id));
if (empty($res)) {
$result['message'] = ui_print_error_message(__('Could not be updated'), '', true);
}
else {
$result['message'] = ui_print_success_message(__('Successfully updated'), '', true);
$result['result'] = true;
}
}
return $result;
}
/**
* Add new agents and modules to the planned downtime.
*
* @param int Id of the planned downtime.
* @param array IDs of the agents to add.
* @param bool Add all modules of the agents or not.
* @param array Names of the modules to add. Empty to add all the modules.
*
* @return array The status will be false id any insertion fails.
* The failed insertions will be added to bad_agents and bad_modules.
*/
function planned_downtimes_add_items ($downtime_id, $agents, $all_modules = true, $module_names = array()) {
global $config;
include_once($config['homedir'] . "/include/functions_modules.php");
$result = array(
'status' => true,
'bad_agents' => array(),
'bad_modules' => array()
);
if (empty($module_names)) {
$all_modules = true;
}
else {
//It is empty.
if ($module_names[0] == "0")
$all_modules = true;
}
if (empty($agents)) {
$agents = array();
$result['status'] = false;
}
foreach ($agents as $agent_id) {
$values = array(
'id_downtime' => $downtime_id,
'id_agent' => $agent_id,
'all_modules' => $all_modules,
'id_user' => $config['id_user']
);
$result = db_process_sql_insert('tplanned_downtime_agents', $values);
if (empty($result)) {
$result['bad_agents'][] = $agent_id;
}
else if (!$all_modules) {
foreach ($module_names as $module_name) {
$module = modules_get_agentmodule_id($module_name, $agent_id);
$module_id = $module["id_agente_modulo"];
$values = array(
'id_downtime' => $downtime_id,
'id_agent' => $agent_id,
'id_agent_module' => $module_id
);
$result = db_process_sql_insert('tplanned_downtime_modules', $values);
if (empty($result)) {
$result['bad_modules'][] = $module_id;
}
}
}
}
return $result;
}
/**
* Delete the agents and modules asociated to a planned downtime.
*
* @param int Id of the planned downtime.
* @param int ID of the agent to delete.
*
* @return bool The result of the operation.
*/
function planned_downtimes_delete_items ($downtime_id, $agent_id) {
$filter = array(
'id_downtime' => $downtime_id,
'id_agent' => $agent_id
);
$downtime_agent_row = db_get_row('tplanned_downtime_agents', $filter);
$result = db_process_sql_delete('tplanned_downtime_agents', array('id' => $downtime_agent_row['id']));
if (!empty($result) && $downtime_agent_row['all_modules'] == 0) {
//Delete modules in downtime
$filter = array(
'id_downtime' => $downtime_id,
'id_agent' => $agent_id
);
db_process_sql_delete('tplanned_downtime_modules', $filter);
}
return $result;
}
/**
* Get the planned downtimes that don't comply the actual rules of dates
*
* @return array List of planned downtimes
*/
function planned_downtimes_get_malformed () {
$sql = "SELECT *
FROM tplanned_downtime
WHERE type_execution = 'periodically'
AND ((type_periodicity = 'monthly'
AND (periodically_day_from > periodically_day_to
OR (periodically_day_from = periodically_day_to
AND periodically_time_from >= periodically_time_to)))
OR (type_periodicity = 'weekly'
AND periodically_time_from >= periodically_time_to))";
$malformed_downtimes = db_get_all_rows_sql($sql);
if ($malformed_downtimes === false) {
return false;
}
$malformed_downtimes_aux = array();
foreach ($malformed_downtimes as $malformed_downtime) {
$malformed_downtimes_aux[$malformed_downtime['id']] = $malformed_downtime;
}
$malformed_downtimes = $malformed_downtimes_aux;
return $malformed_downtimes;
}
/**
* Create new downtimes with the correct format and delete the malformed
*
* @param array List with the malformed downtimes
*
* @return bool The result of the migration
*/
function planned_downtimes_migrate_malformed_downtimes ($malformed_downtimes = array()) {
global $config;
$migration_result = array(
'status' => true,
'bad_downtimes' => array()
);
if (empty($malformed_downtimes))
$malformed_downtimes = planned_downtimes_get_malformed();
foreach ($malformed_downtimes as $key => $downtime) {
$downtime_type = $downtime['type_downtime'];
$downtime_execution = $downtime['type_execution'];
$downtime_periodicity = $downtime['type_periodicity'];
$downtime_time_from = $downtime['periodically_time_from'];
$downtime_time_to = $downtime['periodically_time_to'];
if ($downtime_execution == 'periodically') {
if ($downtime_periodicity == 'monthly') {
$downtime_day_from = $downtime['periodically_day_from'];
$downtime_day_to = $downtime['periodically_day_to'];
if (($downtime_day_from > $downtime_day_to) || ($downtime_day_from == $downtime_day_to && $downtime_time_from > $downtime_time_to)) {
$values_first = array(
'name' => $downtime['name'] . "&nbsp;[1/2]",
'description' => $downtime['description'],
'executed' => $downtime['executed'],
'id_group' => $downtime['id_group'],
'only_alerts' => $downtime['only_alerts'],
'periodically_time_from' => $downtime_time_from,
'periodically_time_to' => "23:59:59",
'periodically_day_from' => $downtime_day_from,
'periodically_day_to' => 31,
'type_downtime' => $downtime_type,
'type_execution' => $downtime_execution,
'type_periodicity' => $downtime_periodicity,
'id_user' => $config['id_user']
);
$values_second = $values_first;
$values_second['name'] = $downtime['name'] . "&nbsp;[2/2]";
$values_second['periodically_day_from'] = 1;
$values_second['periodically_time_from'] = "00:00:00";
$values_second['periodically_day_to'] = $downtime_day_to;
$values_second['periodically_time_to'] = $downtime_time_to;
$result_first = planned_downtimes_update($values_first, 0, false);
if ($result_first['result']) {
$result_second = planned_downtimes_update($values_second, 0, false);
if (!$result_second['result']) {
db_process_sql_delete('tplanned_downtime', array('id' => $result_first['id']));
}
}
if ($result_first['result'] && $result_second['result']) {
$result_copy = planned_downtimes_migrate_malformed_downtimes_copy_items($downtime['id'], $result_first['id'], $result_second['id']);
if (!$result_copy) {
$migration_result['status'] = false;
$migration_result['bad_downtimes'][] = $downtime['id'];
}
}
else {
$migration_result['status'] = false;
$migration_result['bad_downtimes'][] = $downtime['id'];
}
}
else if ($downtime_day_from == $downtime_day_to && $downtime_time_from == $downtime_time_to) {
$utimestamp = strtotime("1-1-1970 $downtime_time_to");
$time = date('H:i:s', $utimestamp + 1);
if ($time != '00:00:00') {
$values = array('periodically_time_to' => $time);
}
else {
$utimestamp = strtotime("1-1-1970 $downtime_time_from");
$time = date('H:i:s', $utimestamp - 1);
$values = array('periodically_time_from' => $time);
}
$filter = array('id' => $downtime['id']);
$result_update = db_process_sql_update('tplanned_downtime', $values, $filter);
if (!$result_update) {
$migration_result['status'] = false;
$migration_result['bad_downtimes'][] = $downtime['id'];
}
}
}
else if ($downtime_periodicity == 'weekly') {
if ($downtime_time_from > $downtime_time_to) {
$days = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
$values_first = array(
'name' => $downtime['name'] . "&nbsp;[1/2]",
'description' => $downtime['description'],
'executed' => $downtime['executed'],
'id_group' => $downtime['id_group'],
'only_alerts' => $downtime['only_alerts'],
'monday' => $downtime['monday'],
'tuesday' => $downtime['tuesday'],
'wednesday' => $downtime['wednesday'],
'thursday' => $downtime['thursday'],
'friday' => $downtime['friday'],
'saturday' => $downtime['saturday'],
'sunday' => $downtime['sunday'],
'periodically_time_from' => $downtime_time_from,
'periodically_time_to' => "23:59:59",
'type_downtime' => $downtime_type,
'type_execution' => $downtime_execution,
'type_periodicity' => $downtime_periodicity,
'id_user' => $config['id_user']
);
$values_second = $values_first;
$values_second['name'] = $downtime['name'] . "&nbsp;[2/2]";
$values_second['periodically_time_from'] = "00:00:00";
$values_second['periodically_time_to'] = $downtime_time_to;
$values_second['tuesday'] = $downtime['monday'] ? 1 : 0;
$values_second['wednesday'] = $downtime['tuesday'] ? 1 : 0;
$values_second['thursday'] = $downtime['wednesday'] ? 1 : 0;
$values_second['friday'] = $downtime['thursday'] ? 1 : 0;
$values_second['saturday'] = $downtime['friday'] ? 1 : 0;
$values_second['sunday'] = $downtime['saturday'] ? 1 : 0;
$values_second['monday'] = $downtime['sunday'] ? 1 : 0;
$result_first = planned_downtimes_update($values_first, 0, false);
if ($result_first['result']) {
$result_second = planned_downtimes_update($values_second, 0, false);
if (!$result_second['result']) {
db_process_sql_delete('tplanned_downtime', array('id' => $result_first['id']));
}
}
if ($result_first['result'] && $result_second['result']) {
$result_copy = planned_downtimes_migrate_malformed_downtimes_copy_items($downtime['id'], $result_first['id'], $result_second['id']);
if (!$result_copy) {
$migration_result['status'] = false;
$migration_result['bad_downtimes'][] = $downtime['id'];
}
}
else {
$migration_result['status'] = false;
$migration_result['bad_downtimes'][] = $downtime['id'];
}
}
else if ($downtime_time_from == $downtime_time_to) {
$utimestamp = strtotime("1-1-1970 $downtime_time_to");
$time = date('H:i:s', $utimestamp + 1);
if ($time != '00:00:00') {
$values = array('periodically_time_to' => $time);
}
else {
$utimestamp = strtotime("1-1-1970 $downtime_time_from");
$time = date('H:i:s', $utimestamp - 1);
$values = array('periodically_time_from' => $time);
}
$filter = array('id' => $downtime['id']);
$result_update = db_process_sql_update('tplanned_downtime', $values, $filter);
if (!$result_update) {
$migration_result['status'] = false;
$migration_result['bad_downtimes'][] = $downtime['id'];
}
}
}
}
}
return $migration_result;
}
/**
* Aux function to copy the items of the selected downtime to the new downtimes.
* Deletes the new downtimes if the items are not copied.
*/
function planned_downtimes_migrate_malformed_downtimes_copy_items ($original_downtime_id, $new_downtime_first_id, $new_downtime_second_id) {
$sql = "SELECT *
FROM tplanned_downtime_agents
WHERE id_downtime = " . $original_downtime_id;
$downtime_agents_rows = db_get_all_rows_sql($sql);
$sql = "SELECT *
FROM tplanned_downtime_modules
WHERE id_downtime = " . $original_downtime_id;
$downtime_modules_rows = db_get_all_rows_sql($sql);
if (!empty($downtime_agents_rows)) {
$result_agents = true;
foreach ($downtime_agents_rows as $downtime_agents_row) {
$values_agent = array(
'id_agent' => $downtime_agents_row['id_agent'],
'all_modules' => $downtime_agents_row['all_modules']
);
$values_agent['id_downtime'] = $new_downtime_first_id;
$result_agent_first = db_process_sql_insert('tplanned_downtime_agents', $values_agent);
$values_agent['id_downtime'] = $new_downtime_second_id;
$result_agent_second = db_process_sql_insert('tplanned_downtime_agents', $values_agent);
if (empty($result_agent_first) || empty($result_agent_second)) {
$result_agents = false;
db_process_sql_delete('tplanned_downtime', array('id' => $new_downtime_first_id));
db_process_sql_delete('tplanned_downtime', array('id' => $new_downtime_second_id));
break;
}
}
if ($result_agents) {
if (!empty($downtime_modules_rows)) {
foreach ($downtime_modules_rows as $downtime_modules_row) {
$values_module = array(
'id_agent' => $downtime_modules_row['id_agent'],
'id_agent_module' => $downtime_modules_row['id_agent_module']
);
$values_module['id_downtime'] = $new_downtime_first_id;
$result_module_first = db_process_sql_insert('tplanned_downtime_modules', $values_module);
$values_module['id_downtime'] = $new_downtime_second_id;
$result_module_second = db_process_sql_insert('tplanned_downtime_modules', $values_module);
if (empty($result_module_first) || empty($result_module_second)) {
db_process_sql_delete('tplanned_downtime', array('id' => $new_downtime_first_id));
db_process_sql_delete('tplanned_downtime', array('id' => $new_downtime_second_id));
break;
}
}
}
}
}
// The new downtimes are created
$new_planned_downtimes_exists = (bool) db_get_value('id', 'tplanned_downtime', 'id', $new_downtime_first_id)
&& (bool) db_get_value('id', 'tplanned_downtime', 'id', $new_downtime_second_id);
if ($new_planned_downtimes_exists) {
// Delete the migrated downtime and its items
db_process_sql_delete('tplanned_downtime', array('id' => $original_downtime_id));
}
return $new_planned_downtimes_exists;
}
?>

View File

@ -871,14 +871,22 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
* @return Array with time intervals.
*/
function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_date, $end_date, $check_services = false) {
global $config;
require_once ($config['homedir'] . '/include/functions_planned_downtimes.php');
$malformed_planned_downtimes = planned_downtimes_get_malformed();
if (empty($malformed_planned_downtimes))
$malformed_planned_downtimes = array();
$sql_downtime = "SELECT DISTINCT(tpd.id), tpd.*
FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tplanned_downtime_modules tpdm, tagente_modulo tam
FROM tplanned_downtime_agents tpda, tagente_modulo tam, tplanned_downtime tpd
LEFT OUTER JOIN tplanned_downtime_modules tpdm ON tpd.id = tpdm.id_downtime
WHERE (tpd.id = tpda.id_downtime
AND tpda.all_modules = 1
AND tpda.id_agent = tam.id_agente
AND tam.id_agente_modulo = $id_agent_module)
OR (tpd.id = tpdm.id_downtime
AND tpdm.id_agent_module = $id_agent_module)";
OR (tpdm.id_agent_module = $id_agent_module)";
$downtimes = db_get_all_rows_sql($sql_downtime);
if ($downtimes == false) {
$downtimes = array();
@ -896,6 +904,20 @@ function reporting_get_planned_downtimes_intervals ($id_agent_module, $start_dat
$downtime_dates[] = $dates;
}
else if ($downtime_type == 'periodically') {
// If a planned downtime have malformed dates, its intervals aren't taken account
$downtime_malformed = false;
foreach ($malformed_planned_downtimes as $malformed_planned_downtime) {
if ($downtime_id == $malformed_planned_downtime['id']) {
$downtime_malformed = true;
break;
}
}
if ($downtime_malformed == true) {
continue;
}
// If a planned downtime have malformed dates, its intervals aren't taken account
$downtime_time_from = $downtime['periodically_time_from'];
$downtime_time_to = $downtime['periodically_time_to'];
@ -1160,21 +1182,21 @@ function reporting_get_planned_downtimes ($start_date, $end_date, $id_agent_modu
if (!empty($id_agent_modules)) {
$id_agent_modules_str = implode(",", $id_agent_modules);
$agent_modules_condition_tpda = "AND tam.id_agente_modulo IN ($id_agent_modules_str)";
$agent_modules_condition_tpdm = "AND tpdm.id_agent_module IN ($id_agent_modules_str)";
$agent_modules_condition_tpdm = "tpdm.id_agent_module IN ($id_agent_modules_str)";
}
else {
$agent_modules_condition_tpda = "";
$agent_modules_condition_tpdm = "";
$agent_modules_condition_tpdm = "1=1";
}
$sql_downtime = "SELECT DISTINCT(tpd.id), tpd.*
FROM tplanned_downtime tpd, tplanned_downtime_agents tpda, tplanned_downtime_modules tpdm, tagente_modulo tam
FROM tplanned_downtime_agents tpda, tagente_modulo tam, tplanned_downtime tpd
LEFT OUTER JOIN tplanned_downtime_modules tpdm ON tpd.id = tpdm.id_downtime
WHERE ((tpd.id = tpda.id_downtime
AND tpda.all_modules = 1
AND tpda.id_agent = tam.id_agente
$agent_modules_condition_tpda)
OR (tpd.id = tpdm.id_downtime
$agent_modules_condition_tpdm))
OR ($agent_modules_condition_tpdm))
AND ((type_execution = 'periodically'
AND $periodically_condition)
OR (type_execution = 'once'
@ -3695,6 +3717,266 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table1->style[5] = 'text-align: right';
$table1->style[6] = 'text-align: center';
}
// Table Planned Downtimes
require_once ($config['homedir'] . '/include/functions_planned_downtimes.php');
$metaconsole_on = ($config['metaconsole'] == 1) && defined('METACONSOLE');
$downtime_malformed = false;
$planned_downtimes_empty = true;
$malformed_planned_downtimes_empty = true;
if ($metaconsole_on) {
$id_agent_modules_by_server = array();
foreach ($slas as $sla) {
$server = $sla['server_name'];
if (empty($server))
continue;
if (!isset($id_agent_modules_by_server[$server]))
$id_agent_modules_by_server[$server] = array();
$id_agent_modules_by_server[$server][] = $sla['id_agent_module'];
}
$planned_downtimes_by_server = array();
$malformed_planned_downtimes_by_server = array();
foreach ($id_agent_modules_by_server as $server => $id_agent_modules) {
//Metaconsole connection
if (!empty($server)) {
$connection = metaconsole_get_connection($server);
if (!metaconsole_load_external_db($connection)) {
continue;
}
$planned_downtimes_by_server[$server] = reporting_get_planned_downtimes(($report['datetime']-$content['period']), $report['datetime'], $id_agent_modules);
$malformed_planned_downtimes_by_server[$server] = planned_downtimes_get_malformed();
if (!empty($planned_downtimes_by_server[$server]))
$planned_downtimes_empty = false;
if (!empty($malformed_planned_downtimes_by_server[$server]))
$malformed_planned_downtimes_empty = false;
//Restore db connection
metaconsole_restore_db();
}
}
if (!$planned_downtimes_empty) {
$table_planned_downtimes = new StdClass();
$table_planned_downtimes->width = '100%';
$table_planned_downtimes->title = __('This SLA has been affected by the following planned downtimes');
$table_planned_downtimes->head = array();
$table_planned_downtimes->head[0] = __('Server');
$table_planned_downtimes->head[1] = __('Name');
$table_planned_downtimes->head[2] = __('Description');
$table_planned_downtimes->head[3] = __('Execution');
$table_planned_downtimes->head[4] = __('Dates');
$table_planned_downtimes->headstyle = array();
$table_planned_downtimes->style = array();
$table_planned_downtimes->cellstyle = array();
$table_planned_downtimes->data = array();
foreach ($planned_downtimes_by_server as $server => $planned_downtimes) {
foreach ($planned_downtimes as $planned_downtime) {
$data = array();
$data[0] = $server;
$data[1] = $planned_downtime['name'];
$data[2] = $planned_downtime['description'];
$data[3] = ucfirst($planned_downtime['type_execution']);
$data[4] = "";
switch ($planned_downtime['type_execution']) {
case 'once':
$data[3] = date ("Y-m-d H:i", $planned_downtime['date_from']) .
"&nbsp;" . __('to') . "&nbsp;".
date ("Y-m-d H:i", $planned_downtime['date_to']);
break;
case 'periodically':
switch ($planned_downtime['type_periodicity']) {
case 'weekly':
$data[4] = __('Weekly:');
$data[4] .= "&nbsp;";
if ($planned_downtime['monday']) {
$data[4] .= __('Mon');
$data[4] .= "&nbsp;";
}
if ($planned_downtime['tuesday']) {
$data[4] .= __('Tue');
$data[4] .= "&nbsp;";
}
if ($planned_downtime['wednesday']) {
$data[4] .= __('Wed');
$data[4] .= "&nbsp;";
}
if ($planned_downtime['thursday']) {
$data[4] .= __('Thu');
$data[4] .= "&nbsp;";
}
if ($planned_downtime['friday']) {
$data[4] .= __('Fri');
$data[4] .= "&nbsp;";
}
if ($planned_downtime['saturday']) {
$data[4] .= __('Sat');
$data[4] .= "&nbsp;";
}
if ($planned_downtime['sunday']) {
$data[4] .= __('Sun');
$data[4] .= "&nbsp;";
}
$data[4] .= "&nbsp;(" . $planned_downtime['periodically_time_from'];
$data[4] .= "-" . $planned_downtime['periodically_time_to'] . ")";
break;
case 'monthly':
$data[4] = __('Monthly:') . "&nbsp;";
$data[4] .= __('From day') . "&nbsp;" . $planned_downtime['periodically_day_from'];
$data[4] .= "&nbsp;" . strtolower(__('To day')) . "&nbsp;";
$data[4] .= $planned_downtime['periodically_day_to'];
$data[4] .= "&nbsp;(" . $planned_downtime['periodically_time_from'];
$data[4] .= "-" . $planned_downtime['periodically_time_to'] . ")";
break;
}
break;
}
if (!$malformed_planned_downtimes_empty
&& isset($malformed_planned_downtimes_by_server[$server])
&& isset($malformed_planned_downtimes_by_server[$server][$planned_downtime['id']])) {
$next_row_num = count($table_planned_downtimes->data);
$table_planned_downtimes->cellstyle[$next_row_num][0] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][1] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][2] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][3] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][4] = 'color: red';
if (!$downtime_malformed)
$downtime_malformed = true;
}
$table_planned_downtimes->data[] = $data;
}
}
}
}
else {
$id_agent_modules = array();
foreach ($slas as $sla) {
if (!empty($sla['id_agent_module']))
$id_agent_modules[] = $sla['id_agent_module'];
}
$planned_downtimes = reporting_get_planned_downtimes(($report['datetime']-$content['period']), $report['datetime'], $id_agent_modules);
$malformed_planned_downtimes = planned_downtimes_get_malformed();
if (!empty($planned_downtimes))
$planned_downtimes_empty = false;
if (!empty($malformed_planned_downtimes))
$malformed_planned_downtimes_empty = false;
if (!$planned_downtimes_empty) {
$table_planned_downtimes = new StdClass();
$table_planned_downtimes->width = '100%';
$table_planned_downtimes->title = __('This SLA has been affected by the following planned downtimes');
$table_planned_downtimes->head = array();
$table_planned_downtimes->head[0] = __('Name');
$table_planned_downtimes->head[1] = __('Description');
$table_planned_downtimes->head[2] = __('Execution');
$table_planned_downtimes->head[3] = __('Dates');
$table_planned_downtimes->headstyle = array();
$table_planned_downtimes->style = array();
$table_planned_downtimes->cellstyle = array();
$table_planned_downtimes->data = array();
foreach ($planned_downtimes as $planned_downtime) {
$data = array();
$data[0] = $planned_downtime['name'];
$data[1] = $planned_downtime['description'];
$data[2] = ucfirst($planned_downtime['type_execution']);
$data[3] = "";
switch ($planned_downtime['type_execution']) {
case 'once':
$data[3] = date ("Y-m-d H:i", $planned_downtime['date_from']) .
"&nbsp;" . __('to') . "&nbsp;".
date ("Y-m-d H:i", $planned_downtime['date_to']);
break;
case 'periodically':
switch ($planned_downtime['type_periodicity']) {
case 'weekly':
$data[3] = __('Weekly:');
$data[3] .= "&nbsp;";
if ($planned_downtime['monday']) {
$data[3] .= __('Mon');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['tuesday']) {
$data[3] .= __('Tue');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['wednesday']) {
$data[3] .= __('Wed');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['thursday']) {
$data[3] .= __('Thu');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['friday']) {
$data[3] .= __('Fri');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['saturday']) {
$data[3] .= __('Sat');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['sunday']) {
$data[3] .= __('Sun');
$data[3] .= "&nbsp;";
}
$data[3] .= "&nbsp;(" . $planned_downtime['periodically_time_from'];
$data[3] .= "-" . $planned_downtime['periodically_time_to'] . ")";
break;
case 'monthly':
$data[3] = __('Monthly:') . "&nbsp;";
$data[3] .= __('From day') . "&nbsp;" . $planned_downtime['periodically_day_from'];
$data[3] .= "&nbsp;" . strtolower(__('To day')) . "&nbsp;";
$data[3] .= $planned_downtime['periodically_day_to'];
$data[3] .= "&nbsp;(" . $planned_downtime['periodically_time_from'];
$data[3] .= "-" . $planned_downtime['periodically_time_to'] . ")";
break;
}
break;
}
if (!$malformed_planned_downtimes_empty && isset($malformed_planned_downtimes[$planned_downtime['id']])) {
$next_row_num = count($table_planned_downtimes->data);
$table_planned_downtimes->cellstyle[$next_row_num][0] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][1] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][2] = 'color: red';
$table_planned_downtimes->cellstyle[$next_row_num][3] = 'color: red';
if (!$downtime_malformed)
$downtime_malformed = true;
}
$table_planned_downtimes->data[] = $data;
}
}
}
if ($downtime_malformed) {
$info_malformed = ui_print_error_message(__('This item is affected by a malformed planned downtime') . ". " .
__('Go to the planned downtimes section to solve this') . ".", '', true);
$data = array();
$data[0] = $info_malformed;
$data[0] .= html_print_table($table_planned_downtimes, true);
$table->colspan[$next_row][0] = 3;
$next_row++;
array_push ($table->data, $data);
break;
}
$data_graph = array ();
$data_horin_graph = array();
@ -3818,8 +4100,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
if ($sla_value === false) {
$data[4] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #0000FF;">';
$data[5] = html_print_image('images/status_sets/default/severity_maintenance.png',true,array('title'=>__('Unknown')));
$data[6] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #736F6E;">'.__('Unknown').'</span>';
$data[5] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #736F6E;">'.__('Unknown').'</span>';
$data[6] = html_print_image('images/status_sets/default/severity_maintenance.png',true,array('title'=>__('Unknown')));
}
else {
$data[4] = '';
@ -3928,103 +4210,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data);
}
// Table Planned Downtimes
$id_agent_modules = array();
foreach ($slas as $sla) {
if (!empty($sla['id_agent_module']))
$id_agent_modules[] = $sla['id_agent_module'];
}
$planned_downtimes = reporting_get_planned_downtimes(($report['datetime']-$content['period']), $report['datetime'], $id_agent_modules);
if (!empty($planned_downtimes)) {
$table_planned_downtimes = new StdClass();
$table_planned_downtimes->width = '100%';
$table_planned_downtimes->title = __('This SLA has been affected by the following planned downtimes');
$table_planned_downtimes->head = array();
$table_planned_downtimes->head[0] = __('Name');
$table_planned_downtimes->head[1] = __('Description');
$table_planned_downtimes->head[2] = __('Execution');
$table_planned_downtimes->head[3] = __('Dates');
$table_planned_downtimes->headstyle = array();
$table_planned_downtimes->style = array();
$table_planned_downtimes->data = array();
if ($for_pdf) {
$table_planned_downtimes->titlestyle = 'background: #373737; color: #FFF; display: table-cell; font-size: 12px; border: 1px solid grey';
$table_planned_downtimes->class = 'table_sla table_beauty';
for ($i = 0; $i < count($table_planned_downtimes->head); $i++) {
$table_planned_downtimes->headstyle[$i] = 'background: #666; color: #FFF; display: table-cell; font-size: 11px; border: 1px solid grey';
}
for ($i = 0; $i < count($table_planned_downtimes->head); $i++) {
$table_planned_downtimes->style[$i] = 'display: table-cell; font-size: 10px;';
}
}
foreach ($planned_downtimes as $planned_downtime) {
$data = array();
$data[0] = $planned_downtime['name'];
$data[1] = $planned_downtime['description'];
$data[2] = ucfirst($planned_downtime['type_execution']);
switch ($planned_downtime['type_execution']) {
case 'once':
$data[3] = date ("Y-m-d H:i", $planned_downtime['date_from']) .
"&nbsp;" . __('to') . "&nbsp;".
date ("Y-m-d H:i", $planned_downtime['date_to']);
break;
case 'periodically':
switch ($planned_downtime['type_periodicity']) {
case 'weekly':
$data[3] = __('Weekly:');
$data[3] .= "&nbsp;";
if ($planned_downtime['monday']) {
$data[3] .= __('Mon');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['tuesday']) {
$data[3] .= __('Tue');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['wednesday']) {
$data[3] .= __('Wed');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['thursday']) {
$data[3] .= __('Thu');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['friday']) {
$data[3] .= __('Fri');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['saturday']) {
$data[3] .= __('Sat');
$data[3] .= "&nbsp;";
}
if ($planned_downtime['sunday']) {
$data[3] .= __('Sun');
$data[3] .= "&nbsp;";
}
$data[3] .= "&nbsp;(" . $planned_downtime['periodically_time_from'];
$data[3] .= "-" . $planned_downtime['periodically_time_to'] . ")";
break;
case 'monthly':
$data[3] = __('Monthly:') . "&nbsp;";
$data[3] .= __('From day') . "&nbsp;" . $planned_downtime['periodically_day_from'];
$data[3] .= "&nbsp;" . strtolower(__('To day')) . "&nbsp;";
$data[3] .= $planned_downtime['periodically_day_to'];
$data[3] .= "&nbsp;(" . $planned_downtime['periodically_time_from'];
$data[3] .= "-" . $planned_downtime['periodically_time_to'] . ")";
break;
}
break;
}
$table_planned_downtimes->data[] = $data;
}
if (!empty($table_planned_downtimes)) {
$data = array();
$data[0] = html_print_table($table_planned_downtimes, true);
$table->colspan[$next_row][0] = 3;

View File

@ -756,10 +756,9 @@ function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = '
break;
case 'event_condition':
// Return the condition of the tags for tevento table
$condition = tags_get_acl_tags_event_condition($acltags);
$condition = tags_get_acl_tags_event_condition($acltags);
if(!empty($condition)) {
return " $query_prefix ".$condition;
return " $query_prefix "."(".$condition.")";
}
break;
}

View File

@ -1527,7 +1527,10 @@ function ui_process_page_body ($string, $bitfield) {
*
* @return string The pagination div or nothing if no pagination needs to be done
*/
function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $return = false, $offset_name = 'offset', $print_total_items = true, $other_class = '') {
function ui_pagination ($count, $url = false, $offset = 0,
$pagination = 0, $return = false, $offset_name = 'offset',
$print_total_items = true, $other_class = '') {
global $config;
if (empty ($pagination)) {
@ -1547,13 +1550,14 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
$url = ui_get_url_refresh (array ($offset_name => false));
}
/* URL passed render links with some parameter
/*
URL passed render links with some parameter
&offset - Offset records passed to next page
&counter - Number of items to be blocked
Pagination needs $url to build the base URL to render links, its a base url, like
" http://pandora/index.php?sec=godmode&sec2=godmode/admin_access_logs "
*/
$block_limit = 15; // Visualize only $block_limit blocks
$block_limit = PAGINATION_BLOCKS_LIMIT; // Visualize only $block_limit blocks
if ($count <= $pagination) {
if ($print_total_items) {
@ -1572,32 +1576,22 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
return false;
}
// If exists more registers than I can put in a page, calculate index markers
$index_counter = ceil ($count /$pagination); // Number of blocks of block_size with data
$index_page = ceil ($offset / $pagination) - (ceil ($block_limit / 2)); // block to begin to show data;
if ($index_page < 0)
$index_page = 0;
$number_of_pages = ceil($count / $pagination);
//~ html_debug_print('number_of_pages');
//~ html_debug_print($number_of_pages);
$actual_page = floor($offset / $pagination);
//~ html_debug_print('actual_page');
//~ html_debug_print($actual_page);
$ini_page = floor($actual_page / $block_limit) * $block_limit;
//~ html_debug_print('ini_page');
//~ html_debug_print($ini_page);
$end_page = $ini_page + $block_limit - 1;
if ($end_page > $number_of_pages) {
$end_page = $number_of_pages - 1;
}
//~ html_debug_print('end_page');
//~ html_debug_print($end_page);
// This calculate index_limit, block limit for this search.
if (($index_page + $block_limit) > $index_counter)
$index_limit = $index_counter;
else
$index_limit = $index_page + $block_limit;
// This calculate if there are more blocks than visible (more than $block_limit blocks)
if ($index_counter > $block_limit )
$paginacion_maxima = 1; // If maximum blocks ($block_limit), show only 10 and "...."
else
$paginacion_maxima = 0;
// This setup first block of query
if ( $paginacion_maxima == 1)
if ($index_page == 0)
$inicio_pag = 0;
else
$inicio_pag = $index_page;
else
$inicio_pag = 0;
$output = "<div class='pagination $other_class'>";
@ -1607,82 +1601,70 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
$output .= '<br>';
}
// Show GOTO FIRST button
if ($other_class == '') {
$output .= '<a class="pagination offset_0" href="'.$url.'&amp;' .$offset_name.'=0">'.html_print_image ("images/go_first.png", true, array ("class" => "bot")).'</a>&nbsp;';
} else {
$output .= "<a class='pagination $other_class offset_0' href='$url.&amp;$offset_name=0'>".html_print_image ("images/go_first.png", true, array ("class" => "bot"))."</a>&nbsp;";
}
// Show PREVIOUS button
if ($index_page > 0) {
$index_page_prev = ($index_page - (floor ($block_limit / 2))) * $pagination;
if ($index_page_prev < 0)
$index_page_prev = 0;
if ($other_class == '') {
$output .= '<a class="pagination offset_' . $index_page_prev . '" href="'.$url.'&amp;'.$offset_name.'='.$index_page_prev.'">'.html_print_image ("images/go_previous.png", true, array ("class" => "bot")).'</a>';
} else {
$output .= "<a class='pagination $other_class offset_$index_page_prev' href='$url &amp;$offset_name = $index_page_prev'>".html_print_image ("images/go_previous.png", true, array ("class" => "bot"))."</a>";
}
// Show GOTO FIRST PAGE button
if ($number_of_pages > $block_limit) {
$output .= "<a class='pagination $other_class offset_0' href='$url&amp;$offset_name=0'>" .
html_print_image ("images/go_first.png", true, array ("class" => "bot")) .
"</a>&nbsp;";
}
// Draw blocks markers
// $i stores number of page
for ($i = $inicio_pag; $i < $index_limit; $i++) {
$inicio_bloque = ($i * $pagination);
$final_bloque = $inicio_bloque + $pagination;
if ($final_bloque > $count){ // if upper limit is beyond max, this shouldnt be possible !
$final_bloque = ($i-1) * $pagination + $count-(($i-1) * $pagination);
}
// Show PREVIOUS PAGE GROUP OF PAGES
// For example
// You are in the 12 page with a block of 5 pages
// << < 10 - 11 - [12] - 13 - 14 > >>
// Click in <
// Result << < 5 - 6 - 7 - 8 - [9] > >>
if ($ini_page >= $block_limit) {
$offset_previous_page = ($ini_page - 1) * $pagination;
$output .= "<a class='pagination $other_class offset_$offset_previous_page' href='$url&amp;$offset_name=$offset_previous_page'>" .
html_print_image ("images/go_previous.png", true, array ("class" => "bot")) .
"</a>";
}
// Show pages
for ($iterator = $ini_page; $iterator <= $end_page; $iterator++) {
if ($inicio_bloque == $offset) {
$actual_page = (int)($offset / $pagination);
if ($iterator == $actual_page) {
$output .= "<span style='font-weight: bold;'>";
}
else {
$output .= "<span>";
}
$inicio_bloque_fake = $inicio_bloque + 1;
// To Calculate last block (doesnt end with round data,
// it must be shown if not round to block limit)
$link_offset = $config['block_size'] * $i;
$offset_page = $iterator * $pagination;
if ($other_class == '') {
$output .= '<a class="pagination offset_' . $link_offset . '" href="'.$url.'&amp;'.$offset_name.'='.$inicio_bloque.'">';
} else {
$output .= "<a class='pagination $other_class offset_$link_offset' href='$url &amp;$offset_name=$inicio_bloque'>";
}
$output .= "[ $i ]";
$output .= "<a class='pagination $other_class offset_$offset_page' href='$url&amp;$offset_name=$offset_page'>";
$output .= "[ $iterator ]";
$output .= '</a></span>';
}
$output .= "&nbsp;";
// Show NEXT PAGE (fast forward)
// Index_counter stores max of blocks
if (($paginacion_maxima == 1) AND (($index_counter - $i) > 0)) {
$prox_bloque = ($i + ceil ($block_limit / 2)) * $pagination;
if ($prox_bloque >= $count)
$prox_bloque = (int) (($count - 1) / $pagination) * $pagination;
if ($other_class == '') {
$output .= '<a class="pagination offset_' . $prox_bloque . '" href="'.$url.'&amp;'.$offset_name.'='.$prox_bloque.'">'.html_print_image ("images/go_next.png", true, array ("class" => "bot")).'</a>';
} else {
$output .= "<a class='pagination $other_class offset_$prox_bloque' href='$url&amp;$offset_name=$prox_bloque'>".html_print_image ("images/go_next.png", true, array ("class" => "bot"))."</a>";
}
$i = $index_counter;
}
// if exists more registers than i can put in a page (defined by $block_size config parameter)
// get offset for index calculation
// Draw "last" block link, ajust for last block will be the same
// as painted in last block (last integer block).
if (($count - $pagination) > 0) {
$myoffset = floor (($count - 1) / $pagination) * $pagination;
if ($other_class == '') {
$output .= '<a class="pagination offset_' . $myoffset . '" href="'.$url. '&amp;'.$offset_name.'='.$myoffset.'">'.html_print_image ("images/go_last.png", true, array ("class" => "bot")).'</a>';
} else {
$output .= "<a class='pagination $other_class offset_$myoffset' href='$url&amp;$offset_name=$myoffset'>".html_print_image ("images/go_last.png", true, array ("class" => "bot"))."</a>";
}
}
// Show NEXT PAGE GROUP OF PAGES
// For example
// You are in the 12 page with a block of 5 pages
// << < 10 - 11 - [12] - 13 - 14 > >>
// Click in >
// Result << < [15] - 16 - 17 - 18 - 19 > >>
if ($number_of_pages - $ini_page > $block_limit) {
$offset_next_page = ($end_page + 1) * $pagination;
$output .= "<a class='pagination $other_class offset_$offset_next_page' href='$url&amp;$offset_name=$offset_next_page'>" .
html_print_image ("images/go_next.png", true, array ("class" => "bot")) .
"</a>";
}
//Show GOTO LAST PAGE button
if ($number_of_pages > $block_limit) {
$offset_lastpage = ($number_of_pages - 1) * $pagination;
$output .= "<a class='pagination $other_class offset_$offset_lastpage' href='$url&amp;$offset_name=$offset_lastpage'>" .
html_print_image ("images/go_last.png", true, array ("class" => "bot")) .
"</a>";
}
// End div and layout

View File

@ -973,7 +973,13 @@ function visual_map_get_status_element($layoutData) {
//Status for a whole agent, if agente_modulo was == 0
}
else if ($layoutData['id_agent'] != 0) {
$status = agents_get_status ($layoutData["id_agent"]);
//--------------------------------------------------
// ADDED NO CHECK ACL FOR AVOID CHECK TAGS THAT
// MAKE VERY SLOW THE VISUALMAPS WITH ACL TAGS
//--------------------------------------------------
$status = agents_get_status ($layoutData["id_agent"], true);
if ($status == -1) // agents_get_status return -1 for unknown!
$status = VISUAL_MAP_STATUS_UNKNOWN;
}
@ -1039,7 +1045,9 @@ function visual_map_get_status_element($layoutData) {
* @param bool $show_links
* @param bool $draw_lines
*/
function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_lines = true, $width = null, $height = null, $home_url = '') {
function visual_map_print_visual_map ($id_layout, $show_links = true,
$draw_lines = true, $width = null, $height = null, $home_url = '') {
enterprise_include_once('include/functions_visual_map.php');
//TODO: USE THE SAME CODE THAT THE VISUAL MAP EDITOR
@ -1299,11 +1307,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
if (empty($layout_data['id_metaconsole'])) {
$url_vc = $config['homeurl'] . "index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure=1&amp;id=" . $layout_data["id_layout_linked"];
$url_vc = $config['homeurl'] . "index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure=" . $config["pure"] . "&amp;id=" . $layout_data["id_layout_linked"];
}
else {
$url_vc = "index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=1&id_visualmap=" . $layout_data["id_layout_linked"] . "&refr=0";
}
echo "<a href=\"$url_vc\">";
}
else {
@ -1419,7 +1428,13 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($show_links) {
if ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
echo '<a style="' .
(
$layout_data['label_color'][0] == '#' ?
'color: '.$layout_data['label_color'].';'
:
''
) . '" href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
$endTagA = true;
}
}
@ -2174,7 +2189,12 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) {
}
// Agent
else {
$status = agents_get_status ($data["id_agent"]);
//--------------------------------------------------
// ADDED NO CHECK ACL FOR AVOID CHECK TAGS THAT
// MAKE VERY SLOW THE VISUALMAPS WITH ACL TAGS
//--------------------------------------------------
$status = agents_get_status ($data["id_agent"], true);
}
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD)
return VISUAL_MAP_STATUS_CRITICAL_BAD;

View File

@ -194,7 +194,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
$height = 100;
}
else {
$height = 0;
$height = 1;
}
$return .= "<div id='overview_$graph_id' class='overview_graph' style='visibility: hidden; margin-left:0px; margin-top:20px; width: ".$width."px; height: ".$height ."px;'></div>";

View File

@ -225,6 +225,7 @@ function configure_modules_form () {
network_component_group_change_event();
flag_load_plugin_component = false;
$("#network_component").change (function () {
if (this.value == 0)
return;
@ -237,6 +238,8 @@ function configure_modules_form () {
"id_module_component" : this.value
},
function (data, status) {
flag_load_plugin_component = true;
$("#text-name").attr ("value", js_html_entity_decode (data["name"]));
$("#textarea_description").attr ("value", js_html_entity_decode (data["description"]));
$("#id_module_type").val(data["type"]);
@ -360,10 +363,6 @@ function configure_modules_form () {
}
}
if (data["id_modulo"] == 4) {
changePluginSelect();
}
if (data["throw_unknown_events"])
$("input[name='throw_unknown_events']").check();
else

View File

@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: pandora-ja\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-02 13:15+0200\n"
"PO-Revision-Date: 2014-10-02 09:00+0000\n"
"PO-Revision-Date: 2014-10-08 10:58+0000\n"
"Last-Translator: Junichi Satoh <junichi@rworks.jp>\n"
"Language-Team: Japanese <ja@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-10-02 11:35+0000\n"
"X-Launchpad-Export-Date: 2014-10-08 11:45+0000\n"
"X-Generator: Launchpad (build 17196)\n"
#: ../../godmode/menu.php:28
@ -4287,7 +4287,7 @@ msgstr "実行"
#: ../../godmode/agentes/planned_downtime.editor.php:334
#: ../../godmode/agentes/planned_downtime.list.php:237
msgid "Once"
msgstr ""
msgstr "一回のみ"
#: ../../godmode/agentes/planned_downtime.editor.php:335
#: ../../godmode/agentes/planned_downtime.list.php:237
@ -12914,11 +12914,11 @@ msgstr "メニューの固定"
#: ../../godmode/setup/setup_visuals.php:423
#: ../../include/functions_config.php:451
msgid "Shortened module graph data"
msgstr ""
msgstr "短縮モジュールグラフデータ"
#: ../../godmode/setup/setup_visuals.php:424
msgid "The data number of the module graphs will be rounded and shortened"
msgstr ""
msgstr "モジュールグラフのデータ数が四捨五入して短くなります"
#: ../../godmode/setup/setup_netflow.php:41
#: ../../include/functions_config.php:511
@ -13989,6 +13989,8 @@ msgid ""
"\t\tIn simple mode only the elements configured as \"critical element\" are "
"used to calculate the service status."
msgstr ""
"マニュアルモードではウエイトを手動で設定する必要があります。自動モードではウエイトはデフォルトの値があります。\n"
"\t\tシンプルモードでは、\"障害要素\"として設定したもののみがサービスの状態計算に利用されます。"
#: ../../enterprise/godmode/services/services.service.php:206
#: ../../include/ajax/events.php:475
@ -18209,6 +18211,8 @@ msgid ""
"any group with that name, will be created if check box is selected. "
"Destination group filter is just used to check agents in that group"
msgstr ""
"移行先のグループは移行元サーバと同じになります。同じ名前のグループが無い場合、チェックボックスがチェックされていると作成されます。移行先のグループフィルタ"
"は、エージェントがグループにあるかどうかのみのチェックに利用されます。"
#: ../../enterprise/meta/advanced/agents_setup.move_agents.php:151
msgid "Create group if doesn’t exist in destination"
@ -18216,7 +18220,7 @@ msgstr "移行先にグループが無い場合に作成する"
#: ../../enterprise/meta/advanced/agents_setup.move_agents.php:151
msgid "Based on name"
msgstr ""
msgstr "名前ベース"
#: ../../enterprise/meta/advanced/agents_setup.move_agents.php:160
msgid "Add agents to destination server"
@ -19557,7 +19561,7 @@ msgstr "PDF にエクスポート"
#: ../../enterprise/operation/reporting/custom_reporting.php:46
#: ../../enterprise/operation/reporting/custom_reporting.php:69
msgid "Send by email"
msgstr ""
msgstr "Eメールで送信"
#: ../../enterprise/operation/reporting/custom_reporting.php:54
msgid "ID Report"
@ -19565,7 +19569,7 @@ msgstr "レポートID"
#: ../../enterprise/operation/reporting/custom_reporting.php:88
msgid "Send by email "
msgstr ""
msgstr "Eメールで送信 "
#: ../../enterprise/extensions/backup.php:57
msgid "Backup"
@ -20074,7 +20078,7 @@ msgstr "0 を設定すると手動スキャンです"
#: ../../enterprise/extensions/ipam/ipam_editor.php:85
msgid "Operator users"
msgstr ""
msgstr "オペレータユーザ"
#: ../../enterprise/extensions/ipam/ipam_editor.php:85
msgid ""
@ -20173,7 +20177,7 @@ msgstr "管理対象外"
#: ../../enterprise/extensions/ipam/ipam_network.php:224
msgid "Not Reserved"
msgstr ""
msgstr "未予約"
#: ../../enterprise/extensions/ipam/ipam_network.php:257
msgid "DESC"
@ -20234,7 +20238,7 @@ msgstr "予約済アドレス"
#: ../../enterprise/extensions/ipam/ipam_network.php:292
msgid "Unreserved"
msgstr ""
msgstr "未予約"
#: ../../enterprise/extensions/ipam/ipam_network.php:317
msgid "Filter options"
@ -22305,6 +22309,8 @@ msgid ""
"learn more about Pandora FMS. Monitoring could be overwhelm, but take your "
"time to learn how to use the power of Pandora FMS!"
msgstr ""
"初めての Pandora FMS の利用であれば、Pandora FMS "
"に関して学べるいくつかのリンクを紹介します。強力な監視ができますが、Pandora FMS の能力を使いこなすには時間が必要です。"
#: ../../general/login_help_dialog.php:51
#: ../../general/login_help_dialog.php:53
@ -22816,7 +22822,7 @@ msgstr "他のモジュール"
#: ../../operation/agentes/graphs.php:92
msgid "Modules network no proc"
msgstr ""
msgstr "proc以外のネットワークモジュール"
#: ../../operation/agentes/graphs.php:132
#: ../../operation/agentes/stat_win.php:276
@ -22843,19 +22849,19 @@ msgstr "アラート表示"
#: ../../operation/agentes/graphs.php:148
msgid "the combined graph does not show the alerts into this graph"
msgstr ""
msgstr "組み合わせグラフは、グラフ内にアラートを表示しません"
#: ../../operation/agentes/graphs.php:150
msgid "Show as one combined graph"
msgstr ""
msgstr "一つの組み合わせグラフとして表示"
#: ../../operation/agentes/graphs.php:152
msgid "one combined graph"
msgstr ""
msgstr "一つの組み合わせグラフ"
#: ../../operation/agentes/graphs.php:155
msgid "several graphs for each module"
msgstr ""
msgstr "モジュールごとの複数のグラフ"
#: ../../operation/agentes/graphs.php:166
msgid "Filter graphs"
@ -22863,7 +22869,7 @@ msgstr "グラフフィルタ"
#: ../../operation/agentes/graphs.php:177
msgid "Combined graph"
msgstr ""
msgstr "組み合わせグラフ"
#: ../../operation/agentes/graphs.php:191
msgid "Save as custom graph"
@ -22872,7 +22878,7 @@ msgstr "カスタムグラフとして保存"
#: ../../operation/agentes/graphs.php:225
#: ../../operation/agentes/graphs.php:228
msgid "Name custom graph"
msgstr ""
msgstr "カスタムグラフ名"
#: ../../operation/agentes/graphs.php:250
msgid "Save custom graph"
@ -22880,7 +22886,7 @@ msgstr "カスタムグラフの保存"
#: ../../operation/agentes/graphs.php:271
msgid "Custom graph create from the tab graphs in the agent."
msgstr ""
msgstr "エージェントのグラフタブからカスタムグラフを作成"
#: ../../operation/agentes/datos_agente.php:167
msgid "Received data from"
@ -23981,7 +23987,7 @@ msgstr "トップ %d"
#: ../../operation/snmpconsole/snmp_statistics.php:121
#: ../../operation/snmpconsole/snmp_statistics.php:179
msgid "Number"
msgstr ""
msgstr ""
#: ../../operation/snmpconsole/snmp_statistics.php:136
#: ../../operation/snmpconsole/snmp_view.php:465
@ -25039,7 +25045,7 @@ msgstr "グループ化"
#: ../../include/functions_reports.php:578
#: ../../include/functions_reporting.php:7584
msgid "Network interfaces"
msgstr ""
msgstr "ネットワークインタフェース"
#: ../../include/functions_reports.php:582
#: ../../include/functions_reports.php:584
@ -25590,31 +25596,31 @@ msgstr "不明エージェント数 %d"
#: ../../include/functions_reporting.php:7584
#, php-format
msgid "Group \"%s\""
msgstr ""
msgstr "グループ \"%s\""
#: ../../include/functions_reporting.php:7629
#: ../../include/functions_reporting.php:7633
msgid ""
"The group has no agents or none of the agents has any network interface"
msgstr ""
msgstr "グループにエージェントが無いか、ネットワークインタフェースのあるエージェントがありません"
#: ../../include/functions_reporting.php:7646
#, php-format
msgid "Agent '%s'"
msgstr ""
msgstr "エージェント '%s'"
#: ../../include/functions_reporting.php:7665
#, php-format
msgid "Interface '%s' throughput graph"
msgstr ""
msgstr "インタフェース '%s' スループットグラフ"
#: ../../include/functions_reporting.php:7667
msgid "Mac"
msgstr ""
msgstr "Mac"
#: ../../include/functions_reporting.php:7668
msgid "Actual status"
msgstr ""
msgstr "現在の状態"
#: ../../include/help/clippy/operation_agentes_status_monitor.php:35
msgid ""
@ -25642,11 +25648,11 @@ msgstr "ここでモジュールを編集するには、タイプカラムにあ
#: ../../include/help/clippy/extension_cron_send_email.php:39
msgid "The configuration of email for the task email is in the file:"
msgstr ""
msgstr "メール送信タスクのメール設定はこのファイルにあります:"
#: ../../include/help/clippy/extension_cron_send_email.php:41
msgid "Please check if the email configuration is correct."
msgstr ""
msgstr "メール設定が正しいか確認してください。"
#: ../../include/help/clippy/godmode_agentes_modificar_agente.php:35
msgid "I'm going to show you how to monitor a server."
@ -25690,7 +25696,7 @@ msgstr ""
msgid ""
"Please note that you have your agent setup to do not add new modules coming "
"from the data XML."
msgstr ""
msgstr "エージェント設定で、XML で送られてくる新たなモジュールが追加されないようになっていることに注意してください。"
#: ../../include/help/clippy/modules_not_learning_mode.php:41
msgid ""
@ -25699,12 +25705,14 @@ msgid ""
"manually in the interface (with the exact name and type as coming in the XML "
"file)."
msgstr ""
"ローカルプラグインがあるかまたは、手動で新たなモジュールを設定ファイルに追加した場合は、インタフェースで手動作成するまでエージェントに反映されないというこ"
"とを意味します(正しい名前とタイプは XML で送られます)。"
#: ../../include/help/clippy/modules_not_learning_mode.php:42
msgid ""
"You should use the \"normal\" mode (non learn) only when you don't intend to "
"add more modules to the agent."
msgstr ""
msgstr "エージェントにモジュールを追加したくない時のみ、\"通常\"モード(学習しない)を使います。"
#: ../../include/help/clippy/godmode_agentes_configurar_agente.php:35
msgid "Now you must go to Modules. Don't worry I'll lead you."
@ -27277,7 +27285,7 @@ msgstr "子の表示"
msgid ""
"You can not delete the last group in Pandora. A common installation must has "
"almost one group."
msgstr ""
msgstr "最後のグループは削除できません。通常、1つはグループが設定されていなければなりません。"
#: ../../include/functions_menu.php:400
msgid "Configure user"
@ -29046,24 +29054,3 @@ msgstr "時間 (ミリ秒)"
#~ msgid "Search text"
#~ msgstr "検索文字列"
#, php-format
#~ msgid "%s - agents (%s) - %s"
#~ msgstr "%s - エージェント (%s) - %s"
#, php-format
#~ msgid "%s - %s"
#~ msgstr "%s - %s"
#~ msgid "Schedule report"
#~ msgstr "スケジュールレポート"
#~ msgid "Schedule report "
#~ msgstr "スケジュールレポート "
#~ msgid "Scheduled/Email"
#~ msgstr "スケジュール/メール"
#, php-format
#~ msgid "%s - agents (%s)"
#~ msgstr "%s - エージェント (%s)"

View File

@ -2451,12 +2451,12 @@ DIV.forced_title_layer {
/* Graphs styles */
DIV.legend>DIV {
width: 100% !important;
div.legend>div {
pointer-events: none; /* Allow to click the graphs below */
opacity: 0.65 !important;
}
DIV.nodata_text {
div.nodata_text {
padding: 5px 12px 0px 68px;
font-weight: bold;
color: #C1C1C1;
@ -2466,7 +2466,7 @@ DIV.nodata_text {
text-align: left;
}
DIV.nodata_container {
div.nodata_container {
width:150px;
height:100px;
background-repeat:no-repeat;

View File

@ -62,8 +62,8 @@
<body>
<div style='height: 10px'>
<?php
$version = '5.1SP1';
$build = '141007';
$version = '5.1SP1RC1';
$build = '141014';
$banner = "v$version Build $build";
error_reporting(0);
@ -557,13 +557,20 @@ function install_step2() {
check_extension("mysql", "PHP MySQL extension");
check_extension("pgsql", "PHP PostgreSQL extension");
check_extension("oci8", "PHP Oracle extension");
echo "</table>";
echo "</table>";
if ($res > 0) {
echo "
<div class='err'>You have some incomplete
dependencies. Please correct them or this installer
will not be able to finish your installation.
</div>
<div class='err'>
Remember, if you install any PHP module to comply
with these dependences, you <b>need to restart</b>
your HTTP/Apache server after it to use the new
modules.
</div>
<div style='text-align: right;'>
Ignore it. <a href='install.php?step=3' style='font-weight: bolder;'>Force install Step #3</a>
</div>";
@ -572,9 +579,8 @@ function install_step2() {
else {
echo "</div>";
echo "<a id='step3' href='install.php?step=3'><br>
<img align='right' src='images/arrow_next.png' border='0' alt=''></a> <div style='clear: both;'><!-- --></div>
";
<img align='right' src='images/arrow_next.png' border='0' alt=''></a>
<div style='clear: both;'><!-- --></div>";
}
echo "
</div>

View File

@ -70,7 +70,8 @@ class Visualmap {
case 'render_map':
$map_id = $system->getRequest('map_id', '0');
$width = $system->getRequest('width', '400');
visual_map_print_visual_map($map_id, false, true, $width);
$height = $system->getRequest('height', '400');
visual_map_print_visual_map($map_id, false, true, $width, $height);
exit;
}
}
@ -123,6 +124,7 @@ class Visualmap {
postvars[\"parameter2\"] = \"render_map\";
postvars[\"map_id\"] = \"" . $this->id . "\";
postvars[\"width\"] = map_width;
postvars[\"height\"] = map_height;
$.post(\"index.php\",
postvars,

View File

@ -723,6 +723,7 @@ foreach ($modules as $module) {
<?php
echo "<h4 style='padding-top:0px !important;'>";
ui_print_help_tip(__('For to view the list modules paginated, set in setup visuals.'));
echo __('Full list of monitors');
$modules_not_init = agents_monitor_notinit($id_agente);
if (!empty($modules_not_init)) {

View File

@ -162,20 +162,27 @@ else {
if ($id_user_ack != "0")
$sql_post .= " AND id_usuario = '" . $id_user_ack . "'";
if (!isset($date_from)) {
$date_from = "";
}
if (!isset($date_to)) {
$date_to = "";
}
if (($date_from == '') && ($date_to == '')) {
if ($event_view_hr > 0) {
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR);
$sql_post .= " AND (utimestamp > " . $unixtime . ")";
}
} else {
}
else {
if ($date_from != '') {
$udate_from = strtotime($date_from." 00:00:00");
$udate_from = strtotime($date_from . " 00:00:00");
$sql_post .= " AND (utimestamp >= " . $udate_from . ")";
}
if ($date_to != '') {
$udate_to = strtotime($date_to." 23:59:59");
$udate_to = strtotime($date_to . " 23:59:59");
$sql_post .= " AND (utimestamp <= " . $udate_to . ")";
}
}

View File

@ -200,8 +200,6 @@ $group_rep = (int) get_parameter ("group_rep", 1);
$delete = (bool) get_parameter ("delete");
$validate = (bool) get_parameter ("validate", 0);
$section = (string) get_parameter ("section", "list");
$text_agent = (string) get_parameter('text_agent', __("All"));
$text_module = (string) get_parameter('module_search', '');
$filter_only_alert = (int) get_parameter('filter_only_alert', -1);
$filter_id = (int) get_parameter('filter_id', 0);
$id_name = (string) get_parameter('id_name', '');
@ -210,6 +208,24 @@ $date_from = (string)get_parameter('date_from', '');
$date_to = (string)get_parameter('date_to', '');
$text_agent = (string) get_parameter("text_agent", __("All"));
$id_agent = get_parameter('id_agent', 0);
if ($id_agent != 0) {
$text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
if ($text_agent == false) {
$text_agent = '';
}
}
$text_module = (string) get_parameter('module_search', '');
$id_agent_module = get_parameter('id_agent_module', 0);
if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($text_module == false) {
$text_module = '';
}
}
$tag_with_json = base64_decode(get_parameter("tag_with", '')) ;
$tag_with_json_clean = io_safe_output($tag_with_json);

View File

@ -386,7 +386,7 @@ $data[0] .= html_print_select($user_users, "id_user_ack", $id_user_ack, '',
if (!$meta) {
$data[1] = __('Module search') . '<br>';
$data[1] .= html_print_autocomplete_modules('module_search',
'', false, true, '', array(), true);
$text_module, false, true, '', array(), true);
}
else {
$data[1] .= '';

View File

@ -28,6 +28,9 @@ $ipOrigin = $_SERVER['REMOTE_ADDR'];
// Uncoment this to activate ACL on RSS Events
if (!isInACL($ipOrigin)) {
rss_error_handler(null, null, null, null,
__("Your IP is not into the IP list with API access."));
exit;
}
@ -39,25 +42,52 @@ $pss = get_user_info($user);
$hashup2 = md5($user.$pss['password']);
if ($hashup != $hashup2) {
rss_error_handler(null, null, null, null,
__("The URL of your feed has bad hash."));
exit;
}
header("Content-Type: application/xml; charset=UTF-8"); //Send header before starting to output
function rss_error_handler ($errno, $errstr, $errfile, $errline) {
function rss_error_handler ($errno, $errstr, $errfile, $errline, $error_human_description = null) {
$url = ui_get_full_url(false);
$selfurl = ui_get_full_url('?' . $_SERVER['QUERY_STRING'], false, true);
$rss_feed = '<?xml version="1.0" encoding="utf-8" ?>'; //' Fixes certain highlighters freaking out on the PHP closing tag
$rss_feed .= "\n";
$rss_feed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
$rss_feed .= '<channel><title>Pandora RSS Feed</title><description>Latest events on Pandora</description>';
$rss_feed .= "\n";
$rss_feed .= '<channel>';
$rss_feed .= "\n";
$rss_feed .= '<title>Pandora RSS Feed</title>';
$rss_feed .= "\n";
$rss_feed .= '<description>Latest events on Pandora</description>';
$rss_feed .= "\n";
$rss_feed .= '<lastBuildDate>'.date (DATE_RFC822, 0).'</lastBuildDate>';
$rss_feed .= '<link>'.$url.'</link>'; //Link back to the main Pandora page
$rss_feed .= '<atom:link href="'.io_safe_input ($selfurl).'" rel="self" type="application/rss+xml" />'; //Alternative for Atom feeds. It's the same.
$rss_feed .= '<item><guid>'.$url.'/index.php?sec=eventos&sec2=operation/events/events</guid><title>Error creating feed</title>';
$rss_feed .= '<description>There was an error creating the feed: '.$errno.' - '.$errstr.' in '.$errfile.' on line '.$errline.'</description>';
$rss_feed .= '<link>'.$url.'/index.php?sec=eventos&sec2=operation/events/events</link></item>';
$rss_feed .= "\n";
$rss_feed .= '<link>' . $url . '</link>'; //Link back to the main Pandora page
$rss_feed .= "\n";
$rss_feed .= '<atom:link href="' . xml_entities(io_safe_input ($selfurl)) . '" rel="self" type="application/rss+xml" />'; //Alternative for Atom feeds. It's the same.
$rss_feed .= "\n";
$rss_feed .= '<item>';
$rss_feed .= "\n";
$rss_feed .= '<guid>'.$url.'/index.php?sec=eventos&amp;sec2=operation/events/events</guid>';
$rss_feed .= "\n";
$rss_feed .= '<title>Error creating feed</title>';
$rss_feed .= "\n";
if (empty($error_human_description)) {
$rss_feed .= '<description>There was an error creating the feed: '.$errno.' - '.$errstr.' in '.$errfile.' on line '.$errline.'</description>';
}
else {
$rss_feed .= '<description>' . xml_entities(io_safe_input($error_human_description)) .'</description>';
}
$rss_feed .= "\n";
$rss_feed .= '<link>'.$url.'/index.php?sec=eventos&amp;sec2=operation/events/events</link>';
$rss_feed .= "\n";
$rss_feed .= '</item>';
$rss_feed .= "\n";
$rss_feed .= '</rss>';
exit ($rss_feed); //Exit by displaying the feed
}
@ -128,13 +158,13 @@ $rss_feed .= '<title>Pandora RSS Feed</title>'. "\n";
$rss_feed .= '<description>Latest events on Pandora</description>' . "\n";
$rss_feed .= '<lastBuildDate>'.date (DATE_RFC822, $lastbuild).'</lastBuildDate>'. "\n"; //Last build date is the last event - that way readers won't mark it as having new posts
$rss_feed .= '<link>'.$url.'</link>'. "\n"; //Link back to the main Pandora page
$rss_feed .= '<atom:link href="'.io_safe_input ($selfurl).'" rel="self" type="application/rss+xml" />'. "\n";; //Alternative for Atom feeds. It's the same.
$rss_feed .= '<atom:link href="' . xml_entities(io_safe_input ($selfurl)) . '" rel="self" type="application/rss+xml" />'. "\n";; //Alternative for Atom feeds. It's the same.
if (empty ($result)) {
$result = array();
$rss_feed .= '<item><guid>'.io_safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events').'</guid><title>No results</title>';
$rss_feed .= '<item><guid>' . xml_entities(io_safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events')) . '</guid><title>No results</title>';
$rss_feed .= '<description>There are no results. Click on the link to see all Pending events</description>';
$rss_feed .= '<link>'.io_safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events').'</link></item>'. "\n";
$rss_feed .= '<link>' . xml_entities(io_safe_input ($url.'/index.php?sec=eventos&sec2=operation/events/events')) . '</link></item>'. "\n";
}
foreach ($result as $row) {
@ -152,18 +182,18 @@ foreach ($result as $row) {
$agent_name = __('Alert').__('SNMP');
}
//This is mandatory
//This is mandatory
$rss_feed .= '<item><guid>';
$rss_feed .= io_safe_input($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row['id_evento']);
$rss_feed .= xml_entities(io_safe_input($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row['id_evento']));
$rss_feed .= '</guid><title>';
$rss_feed .= $agent_name;
$rss_feed .= xml_entities($agent_name);
$rss_feed .= '</title><description>';
$rss_feed .= $row['evento'];
if($row['estado'] == 1) {
$rss_feed .= io_safe_input('<br /><br />'.'Validated by ' . $row['id_usuario']);
$rss_feed .= xml_entities($row['evento']);
if ($row['estado'] == 1) {
$rss_feed .= xml_entities(io_safe_input('<br /><br />'.'Validated by ' . $row['id_usuario']));
}
$rss_feed .= '</description><link>';
$rss_feed .= io_safe_input($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row["id_evento"]);
$rss_feed .= xml_entities(io_safe_input($url . "/index.php?sec=eventos&sec2=operation/events/events&id_event=" . $row["id_evento"]));
$rss_feed .= '</link>';
//The rest is optional
@ -176,4 +206,35 @@ foreach ($result as $row) {
$rss_feed .= "</channel>\n</rss>\n";
echo $rss_feed;
function xml_entities($str) {
if (!is_string($str)) {
return "";
}
if (preg_match_all('/(&[^;]+;)/', $str, $matches) != 0) {
$matches = $matches[0];
foreach ($matches as $entity) {
$char = html_entity_decode($entity, ENT_COMPAT | ENT_HTML401, 'UTF-8');
$html_entity_numeric = "&#" . uniord($char) . ";";
$str = str_replace($entity, $html_entity_numeric, $str);
}
}
return $str;
}
function uniord($u) {
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
}
?>

View File

@ -77,8 +77,12 @@ $table->data[1][1] = html_print_checkbox('alert_fired', 'alert_fired', true, tru
html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' .
html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />' .
$table->data[2][0] = '';
$table->data[2][1] = '<a href="javascript: toggleButton();">' . html_print_image("images/play.button.png", true, array("id" => "button")) . '</a>';
$table->data[2][1] .= '<a href="javascript: ok();">' . html_print_image("images/ok.button.png", true, array("style" => "margin-left: 10px;")) . '</a>';
$table->data[2][1] = '<a href="javascript: toggleButton();">' .
html_print_image("images/play.button.png", true, array("id" => "button")) .
'</a>';
$table->data[2][1] .= '<a href="javascript: ok();">' .
html_print_image("images/ok.button.png", true,
array("style" => "margin-left: 10px;")) . '</a>';
html_print_table($table);
?>
@ -96,6 +100,8 @@ var id_row = 0;
var redBackground = false;
var button_play_status = "play";
function changeGroup() {
group = $("#group").val();
}
@ -107,14 +113,22 @@ function changeType() {
}
function toggleButton() {
if ($("#button").attr('src') == '../../images/pause.button.png') {
if (button_play_status == 'pause') {
//~ if ($("#button").attr('src') == '../../images/pause.button.png') {
$("#button").attr('src', '../../images/play.button.png');
stopSound();
button_play_status = 'play';
}
else {
$("#button").attr('src', '../../images/pause.button.png');
forgetPreviousEvents();
startSound();
button_play_status = 'pause';
}
}
@ -135,7 +149,6 @@ function stopSound() {
}
function startSound() {
$('embed').remove();
//running = true;
}
@ -177,7 +190,6 @@ function check_event() {
if (firedId != 0) {
id_row = firedId;
fired = true;
$('embed').remove();
$('body').append("<audio src='../../" + data['sound'] + "' autoplay='true' hidden='true' loop='true'>");
}
},
@ -193,12 +205,12 @@ function animation() {
if (redBackground) {
redBackground = false;
$('body').css('background', 'white');
window.moveBy(5, 0);
//~ window.moveBy(5, 0);
}
else {
redBackground = true;
$('body').css('background-color', 'red');
window.moveBy(-5, 0);
//~ window.moveBy(-5, 0);
}
}
}

View File

@ -57,10 +57,14 @@ if (check_acl ($config['id_user'], 0, "AR")) {
enterprise_hook ('services_menu');
enterprise_hook ('inventory_menu');
}
if (check_acl ($config['id_user'], 0, "PM")) {
$sub["operation/servers/recon_view"]["text"] = __('Recon view');
$sub["operation/servers/recon_view"]["refr"] = 0;
}
if (check_acl ($config['id_user'], 0, "AR")) {
if ($config['log_collector'] == 1) {
enterprise_hook ('log_collector_menu');
}

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 5.1SP1
%define release 141007
%define version 5.1SP1RC1
%define release 141014
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -2,8 +2,8 @@
# Pandora FMS Console
#
%define name pandorafms_console
%define version 5.1SP1
%define release 141007
%define version 5.1SP1RC1
%define release 141014
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -37,8 +37,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('days_compact','0'),
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','5.1SP1'),
('db_scheme_build','PD141007'),
('db_scheme_version','5.1SP1RC1'),
('db_scheme_build','PD141014'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 5.1SP1-141007
Version: 5.1SP1RC1-141014
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.1SP1-141007"
pandora_version="5.1SP1RC1-141014"
package_cpan=0
package_pandora=1

View File

@ -1,7 +1,7 @@
#############################################################################
# Pandora FMS Server Parameters
# Pandora FMS, the Flexible Monitoring System.
# Version 5.1SP1
# Version 5.1SP1RC1
# Licensed under GPL license v2,
# (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com

View File

@ -42,8 +42,8 @@ our @EXPORT = qw(
);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "5.1SP1";
my $pandora_build = "141007";
my $pandora_version = "5.1SP1RC1";
my $pandora_build = "141014";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 5.1SP1
%define release 141007
%define version 5.1SP1RC1
%define release 141014
Summary: Pandora FMS Server
Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server
#
%define name pandorafms_server
%define version 5.1SP1
%define release 141007
%define version 5.1SP1RC1
%define release 141014
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.1SP1 PS141007";
my $version = "5.1SP1RC1 PS141014";
# 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.1SP1 PS141007";
my $version = "5.1SP1RC1 PS141014";
# save program name for logging
my $progname = basename($0);

View File

@ -271,7 +271,7 @@ sub get_if_from_ip($$$) {
}
########################################################################################
# Get the MAC address for the interface with the given IP address.
# Get an interface name from a MAC address.
########################################################################################
sub get_if_from_mac($$$) {
my ($device, $community, $mac) = @_;
@ -639,13 +639,17 @@ sub host_connectivity($) {
my $host = $ARP_CACHE{$mac};
next unless defined ($HOSTS{$host});
my $device_if_name = get_if_from_aft($device, $COMMUNITIES{$device}, $mac);
my $host_if_name = defined($COMMUNITIES{$host}) ? get_if_from_mac($host, $COMMUNITIES{$host}, $mac) : '';
if ($VISITED_DEVICES{$device}->{'type'} eq 'router') {
message("Host $host is connected to router $device (if $device_if_name).");
message("Host $host " . ($host_if_name ne '' ? "(if $host_if_name)" : '') . " is connected to router $device (if $device_if_name).");
}
elsif ($VISITED_DEVICES{$device}->{'type'} eq 'switch') {
message("Host $host " . ($host_if_name ne '' ? "(if $host_if_name)" : '') . " is connected to switch $device (if $device_if_name).");
}
else {
message("Host $host is connected to switch $device (if $device_if_name).");
message("Host $host " . ($host_if_name ne '' ? "(if $host_if_name)" : '') . " is connected to host $device (if $device_if_name).");
}
connect_pandora_agents($device, $device_if_name, $host, '');
connect_pandora_agents($device, $device_if_name, $host, $host_if_name);
}
}