Merge branch 'develop' into '84-el-tamano-de-las-graficas-no-respeta-lo-que-se-previsualiza-en-el-editor'

# Conflicts:
#   pandora_console/operation/visual_console/render_view.php
This commit is contained in:
Enrique Camargo 2017-03-07 13:19:34 +01:00
commit 7be73cbfce
83 changed files with 32910 additions and 2621229 deletions

View File

@ -143,8 +143,8 @@ echo "Updating Pandora Windows Agent version..."
sed -i -e "s/\s*#define\s*PANDORA_VERSION\s*.*/#define PANDORA_VERSION (\"$VERSION(Build $BUILD)\")/" "$AGENT_WIN_FILE"
sed -i -e "s/{Pandora FMS Windows Agent v.*}/{Pandora FMS Windows Agent v$VERSION}/" "$AGENT_WIN_MPI_FILE"
NUMERIC_VERSION=$(echo $VERSION | sed -e "s/\([0-9]*\.[0-9]*\).*/\1/")
sed -in "1h;1!H;\${;g;s/[\r\n]InstallVersion[\r\n]{\S*}/\nInstallVersion\n{$NUMERIC_VERSION.0.0}/g;p;}" "$AGENT_WIN_MPI_FILE"
sed -in "1h;1!H;\${;g;s/[\r\n]Version[\r\n]{[^\n\r]*}/\nVersion\n{$BUILD}/g;p;}" "$AGENT_WIN_MPI_FILE"
sed -i -n "1h;1!H;\${;g;s/[\r\n]InstallVersion[\r\n]{\S*}/\nInstallVersion\n{$NUMERIC_VERSION.0.0}/g;p;}" "$AGENT_WIN_MPI_FILE"
sed -i -n "1h;1!H;\${;g;s/[\r\n]Version[\r\n]{[^\n\r]*}/\nVersion\n{$BUILD}/g;p;}" "$AGENT_WIN_MPI_FILE"
if [ $NB == 1 ]; then
sed --in-place -n "1h;1!H;\${;g;s/[\r\n]Windows\,Executable[\r\n]{[^\n\r]*}/\nWindows\,Executable\n{\<\%AppName\%\>\-\<\%Version\%\>\-Setup\<\%Ext\%\>}/g;p;}" "$AGENT_WIN_MPI_FILE"
else

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: NG_BETA-170303
Version: NG_BETA-170307
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="NG_BETA-170303"
pandora_version="NG_BETA-170307"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => 'NG_BETA';
use constant AGENT_BUILD => '170303';
use constant AGENT_BUILD => '170307';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version NG_BETA
%define release 170303
%define release 170307
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version NG_BETA
%define release 170303
%define release 170307
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="NG_BETA"
PI_BUILD="170303"
PI_BUILD="170307"
OS_NAME=`uname -s`
FORCE=0

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -7,4 +7,6 @@ attachment/files_repo
include/config.php
pandora_console.log
enterprise
*.bak
*.bak
audit.log
install_old.php

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: NG_BETA-170303
Version: NG_BETA-170307
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="NG_BETA-170303"
pandora_version="NG_BETA-170307"
package_pear=0
package_pandora=1

View File

@ -181,10 +181,6 @@ function extension_db_check_tables_differences($connection_test,
$diff_tables = array_diff($tables_test, $tables_system);
//~ html_debug_print($tables_test);
//~ html_debug_print($tables_system);
//~ html_debug_print($diff_tables);
ui_print_result_message(
empty($diff_tables),
__('Successful the DB Pandora has all tables'),

View File

@ -20,7 +20,7 @@ $id_agente = get_parameter ("id_agente");
$address = agents_get_address($id_agente);
if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1");
extensions_add_opemode_tab_agent ('ssh_gateway','SSH Gateway','extensions/ssh_gateway/secure_console.png',"ssh_gateway", "v1r1", 'AW');
}
function ssh_gateway () {

View File

@ -39,6 +39,6 @@ $id_agente = get_parameter ("id_agente");
$address = agents_get_address($id_agente);
if (!empty($address) || empty($id_agente)) {
extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1");
extensions_add_opemode_tab_agent('vnc_view', __('VNC view'), 'images/vnc.png', 'vnc_view', "v1r1", 'AW');
}
?>

View File

@ -0,0 +1,41 @@
-- Pandora FMS - the Flexible Monitoring System
-- ============================================
-- Copyright (c) 2005-2011 Artica Soluciones Tecnológicas, http://www.artica.es
-- Please see http://pandora.sourceforge.net 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.
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-- PLEASE NO NOT USE MULTILINE COMMENTS
-- Because Pandora Installer don't understand them
-- and fails creating database !!!
-- Priority : 0 - Maintance (grey)
-- Priority : 1 - Low (green)
-- Priority : 2 - Normal (blue)
-- Priority : 3 - Warning (yellow)
-- Priority : 4 - Critical (red)
-- ---------------------------------------------------------------------
-- Table `ttable_test`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttable_test` (
`id` int(10) unsigned NOT NULL auto_increment,
`field1` varchar(60) NOT NULL default '',
`field2` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `tusuario`
-- ---------------------------------------------------------------------
ALTER TABLE `tusuario` ADD COLUMN `test` tinyint(1) NOT NULL DEFAULT 0;

View File

@ -0,0 +1,41 @@
-- ============================================
-- Copyright (c) 2005-2011 Artica Soluciones Tecnológicas, http://www.artica.es
-- Please see http://pandora.sourceforge.net 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.
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-- PLEASE NO NOT USE MULTILINE COMMENTS
-- Because Pandora Installer don't understand them
-- and fails creating database !!!
-- Priority : 0 - Maintance (grey)
-- Priority : 1 - Low (green)
-- Priority : 2 - Normal (blue)
-- Priority : 3 - Warning (yellow)
-- Priority : 4 - Critical (red)
-- ---------------------------------------------------------------------
-- Table `ttable_test`
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `ttable_test2` (
`id` int(10) unsigned NOT NULL auto_increment,
`field1` varchar(60) NOT NULL default '',
`field2` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ---------------------------------------------------------------------
-- Table `ttable_test`
-- ---------------------------------------------------------------------
ALTER TABLE `ttable_test` ADD COLUMN `field3` tinyint(1) NOT NULL DEFAULT 0;
ALTER TABLE `ttable_test` MODIFY COLUMN `field1` tinyint(1) NOT NULL DEFAULT 0;

View File

@ -1208,6 +1208,7 @@ ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `cascade_protection_module` int(10) unsigned default '0';
ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default '');
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0';
UPDATE tagente SET tagente.alias = tagente.nombre;
-- ---------------------------------------------------------------------
@ -1271,9 +1272,15 @@ ALTER TABLE tmetaconsole_agent ADD COLUMN `remote` tinyint(1) NOT NULL default '
ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.nombre;
-- ---------------------------------------------------------------------
-- Table `twidget_dashboard`
-- ---------------------------------------------------------------------
ALTER TABLE twidget_dashboard MODIFY options LONGTEXT NOT NULL default "";
ALTER TABLE twidget_dashboard MODIFY options LONGTEXT NOT NULL default "";
-- ---------------------------------------------------------------------
-- Table `trecon_task`
-- ---------------------------------------------------------------------
ALTER TABLE trecon_task ADD `alias_as_name` int(2) unsigned default '0';

View File

@ -15,12 +15,16 @@
// GNU General Public License for more details.
global $config;
global $incident_w;
global $incident_m;
check_login ();
ui_require_css_file ('firts_task');
?>
<?php
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no incidents defined yet.') ) );
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no incidents defined yet.') ) );
if ($incident_w || $incident_m) {
?>
<div class="new_task">
@ -41,3 +45,4 @@ ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no in
</form>
</div>
</div>
<?php } ?>

View File

@ -15,6 +15,8 @@
// GNU General Public License for more details.
global $config;
global $vconsoles_write;
global $vconsoles_manage;
check_login ();
ui_require_css_file ('firts_task');
@ -22,6 +24,7 @@ ui_print_info_message(
array(
'no_close'=>true,
'message'=> __('There are no visual console defined yet.')));
if ($vconsoles_write || $vconsoles_manage) {
?>
<div class="new_task">
@ -41,3 +44,4 @@ ui_print_info_message(
</form>
</div>
</div>
<?php } ?>

View File

@ -15,25 +15,31 @@
// GNU General Public License for more details.
global $config;
global $agent_w;
check_login ();
ui_require_css_file ('firts_task');
?>
<?php ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no services defined yet.') ) ); ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, array("title" => __('Services')));?>
<?php if ($agent_w) { ?>
<div class="new_task">
<div class="image_task">
<?php echo html_print_image('images/firts_task/icono_grande_servicios.png', true, array("title" => __('Services')));?>
</div>
<div class="text_task">
<h3> <?php echo __('Create Services'); ?></h3>
<p id="description_task"> <?php echo __("A service is a way to group your IT resources based on their functionalities.
A service could be e.g. your official website, your CRM system, your support application, or even your printers.
Services are logical groups which can include hosts, routers, switches, firewalls, CRMs, ERPs, websites and numerous other services.
By the following example, you're able to see more clearly what a service is:
A chip manufacturer sells computers by its website all around the world.
His company consists of three big departments: A management, an on-line shop and support."); ?></p>
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" />
</form>
</div>
</div>
<div class="text_task">
<h3> <?php echo __('Create Services'); ?></h3>
<p id="description_task"> <?php echo __("A service is a way to group your IT resources based on their functionalities.
A service could be e.g. your official website, your CRM system, your support application, or even your printers.
Services are logical groups which can include hosts, routers, switches, firewalls, CRMs, ERPs, websites and numerous other services.
By the following example, you're able to see more clearly what a service is:
A chip manufacturer sells computers by its website all around the world.
His company consists of three big departments: A management, an on-line shop and support."); ?></p>
<form action="index.php?sec=estado&sec2=enterprise/godmode/services/services.service&action=new_service" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Services'); ?>" />
</form>
</div>
</div>
<?php } ?>

View File

@ -15,10 +15,15 @@
// GNU General Public License for more details.
global $config;
global $networkmaps_write;
global $networkmaps_manage;
check_login ();
ui_require_css_file ('firts_task');
?>
<?php ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no transactions defined yet.') ) ); ?>
<?php ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no transactions defined yet.') ) );
if ($networkmaps_write || $networkmaps_manage) {
?>
<div class="new_task">
<div class="image_task">
@ -33,4 +38,5 @@ Transaction graphs represent the different processes within our infrastructure t
<input type="submit" class="button_task" value="<?php echo __('Create Transactions'); ?>" />
</form>
</div>
</div>
</div>
<?php } ?>

View File

@ -146,10 +146,12 @@ if (!empty($all_data)) {
$table->data[] = $tdata;
// Users
$tdata = array();
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
if (users_is_admin()) {
$tdata = array();
$tdata[0] = reporting_get_stats_users($data);
$table->rowclass[] = '';
$table->data[] = $tdata;
}
html_print_table($table);
unset($table);

View File

@ -204,8 +204,9 @@ if (!$new_agent) {
}
$table->data[1][0] = __('Alias');
$table->data[1][1] = html_print_input_text ('alias', $alias, '', 50, 100, true);
if($new_agent){
$table->data[1][1] .= html_print_checkbox ("alias_as_name", 1, $alias_as_name, true).__('Use alias as name');
}
$table->data[2][0] = __('IP Address');
$table->data[2][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true);

View File

@ -74,6 +74,7 @@ $maximo = 0;
$minimo = 0;
$nombre_agente = "";
$alias = get_parameter('alias', '');
$alias_as_name = 0;
$direccion_agente = get_parameter('direccion', '');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
@ -149,6 +150,7 @@ $module_macros = array ();
// Create agent
if ($create_agent) {
$alias = (string) get_parameter_post("alias",'');
$alias_as_name = (int) get_parameter_post("alias_as_name", 0);
$direccion_agente = (string) get_parameter_post("direccion",'');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
@ -175,7 +177,7 @@ if ($create_agent) {
if ($fields === false) $fields = array();
$field_values = array();
foreach ($fields as $field) {
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
}
@ -191,26 +193,40 @@ if ($create_agent) {
$agent_created_ok = 0;
}*/
else {
$id_agente = db_process_sql_insert ('tagente',
array ('nombre' => $nombre_agente,
'alias' => $alias,
'direccion' => $direccion_agente,
'id_grupo' => $grupo,
'intervalo' => $intervalo,
'comentarios' => $comentarios,
'modo' => $modo,
'id_os' => $id_os,
'disabled' => $disabled,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
'server_name' => $server_name,
'id_parent' => $id_parent,
'custom_id' => $custom_id,
'icon_path' => $icon_path,
'update_gis_data' => $update_gis_data,
'url_address' => $url_description,
'quiet' => $quiet));
enterprise_hook ('update_agent', array ($id_agente));
if($alias_as_name){
$sql = 'SELECT nombre FROM tagente WHERE nombre = "' . $alias . '"';
$exists_alias = db_get_row_sql($sql);
html_debug_print($exists_alias, true);
$nombre_agente = $alias;
}
if(!$exists_alias){
$id_agente = db_process_sql_insert ('tagente',
array ('nombre' => $nombre_agente,
'alias' => $alias,
'alias_as_name' => $alias_as_name,
'direccion' => $direccion_agente,
'id_grupo' => $grupo,
'intervalo' => $intervalo,
'comentarios' => $comentarios,
'modo' => $modo,
'id_os' => $id_os,
'disabled' => $disabled,
'cascade_protection' => $cascade_protection,
'cascade_protection_module' => $cascade_protection_module,
'server_name' => $server_name,
'id_parent' => $id_parent,
'custom_id' => $custom_id,
'icon_path' => $icon_path,
'update_gis_data' => $update_gis_data,
'url_address' => $url_description,
'quiet' => $quiet));
enterprise_hook ('update_agent', array ($id_agente));
}
else{
$id_agente = false;
}
if ($id_agente !== false) {
// Create custom fields for this agent
foreach ($field_values as $key => $value) {
@ -249,6 +265,9 @@ if ($create_agent) {
else {
$id_agente = 0;
$agent_creation_error = __('Could not be created');
if($exists_alias){
$agent_creation_error = __('Could not be created, because name already exists');
}
}
}
}
@ -471,25 +490,27 @@ if ($id_agente) {
//Extensions tabs
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_god_tab']) && check_acl ($config["id_user"], $group, "AW", $id_agente)) {
$image = $extension['extension_god_tab']['icon'];
$name = $extension['extension_god_tab']['name'];
$id = $extension['extension_god_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
if (isset($extension['extension_god_tab'])) {
if (check_acl ($config["id_user"], $group, $extension['extension_god_tab']['acl'])) {
$image = $extension['extension_god_tab']['icon'];
$name = $extension['extension_god_tab']['name'];
$id = $extension['extension_god_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
}
else {
$active = false;
}
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
else {
$active = false;
}
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
}
@ -591,7 +612,6 @@ if ($delete_conf_file) {
__('Could not delete conf file'));
}
// Show agent creation results
if ($create_agent) {
if (!isset($agent_creation_error)) {
@ -645,6 +665,7 @@ if ($update_agent) { // if modified some agent paramenter
$id_agente = (int) get_parameter_post ("id_agente");
$nombre_agente = str_replace('`','&lsquo;',(string) get_parameter_post ("agente", ""));
$alias = str_replace('`','&lsquo;',(string) get_parameter_post ("alias", ""));
$alias_as_name = (int) get_parameter_post ('alias_as_name', 0);
$direccion_agente = (string) get_parameter_post ("direccion", '');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
@ -737,6 +758,7 @@ if ($update_agent) { // if modified some agent paramenter
'id_os' => $id_os,
'modo' => $modo,
'alias' => $alias,
'alias_as_name' => $alias_as_name,
'direccion' => $direccion_agente,
'id_grupo' => $grupo,
'intervalo' => $intervalo,
@ -814,6 +836,7 @@ if ($id_agente) {
$alias = $nombre_agente;
}
}
$alias_as_name = $agent["alias_as_name"];
$direccion_agente = $agent["direccion"];
$grupo = $agent["id_grupo"];
$ultima_act = $agent["ultimo_contacto"];

View File

@ -221,7 +221,7 @@ $table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
false, array ('tagente.alias', 'tagente.id_agente'));
html_debug($agents_alerts);
$table->data[2][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'alias'),
'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0);
$table->data[2][2] = __('When select agents');

View File

@ -106,7 +106,7 @@ if (count($module_array) > 0) {
echo "<table><tr>";
echo "<form method='post' action='index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&tab=graph_editor&change_label=1&id=". $id_graph ."&graph=" . $idgs_array[$a] . "'>";
html_print_input_text ('label', $label_array[$a], '', 20, 10, false, false);
html_print_input_text ('label', $label_array[$a], '', 20, 30, false, false);
html_print_submit_button ('Ok', 'btn', false, '', false);
echo "</form>";

View File

@ -776,10 +776,10 @@ You can of course remove the warnings, that's why we include the source and do n
<td style="font-weight:bold;"><?php echo __('Data range') . ui_print_help_icon('prediction_date', true); ?></td>
<td>
<?php
echo __('Max') . "&nbsp;";
html_print_input_text('max_interval', $max_interval, '', 5, 10);
echo "&nbsp;" . __('Min') . "&nbsp;";
echo __('Min') . "&nbsp;";
html_print_input_text('min_interval', $min_interval, '', 5, 10);
echo "&nbsp;" . __('Max') . "&nbsp;";
html_print_input_text('max_interval', $max_interval, '', 5, 10);
?>
</td>
</tr>

View File

@ -930,6 +930,7 @@ switch ($action) {
$es['id_agents'] = $agents_to_report;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'prediction_date':
@ -1284,6 +1285,7 @@ switch ($action) {
$es['id_agents'] = $agents_to_report;
$values['external_source'] = json_encode($es);
$values['period'] = get_parameter('period');
$good_format = true;
break;
case 'agent_module':

View File

@ -107,6 +107,7 @@ if ((isset ($_GET["update"])) OR ((isset ($_GET["create"])))) {
$resolve_names = (int) get_parameter ("resolve_names", 0);
$parent_detection = (int) get_parameter ("parent_detection", 0);
$parent_recursion = (int) get_parameter ("parent_recursion", 1);
$alias_as_name = (int) get_parameter ("alias_as_name", 0);
// Get macros
$macros = (string) get_parameter ('macros');
@ -149,7 +150,8 @@ if (isset($_GET["update"])) {
'resolve_names' => $resolve_names,
'parent_detection' => $parent_detection,
'parent_recursion' => $parent_recursion,
'macros' => $macros
'macros' => $macros,
'alias_as_name' => $alias_as_name
);
$where = array('id_rt' => $id);
@ -209,7 +211,8 @@ if (isset($_GET["create"])) {
'resolve_names' => $resolve_names,
'parent_detection' => $parent_detection,
'parent_recursion' => $parent_recursion,
'macros' => $macros
'macros' => $macros,
'alias_as_name' => $alias_as_name
);
$name = io_safe_output($name);

View File

@ -120,10 +120,10 @@ if (isset($_GET["update"]) || (isset($_GET["upd"]))) {
$os_detect = $row["os_detect"];
$resolve_names = $row["resolve_names"];
$os_detect = $row["os_detect"];
$resolve_names = $row["resolve_names"];
$parent_detection = $row["parent_detection"];
$parent_recursion = $row["parent_recursion"];
$macros = $row["macros"];
$alias_as_name = $row["alias_as_name"];
$name_script = db_get_value('name',
'trecon_script', 'id_recon_script', $id_recon_script);
@ -168,6 +168,7 @@ elseif (isset($_GET["create"]) || isset($_GET["crt"])) {
$parent_detection = 1;
$parent_recursion = 5;
$macros = '';
$alias_as_name = 0;
}
$modify = false;
@ -370,6 +371,10 @@ $table->data[20][1] = html_print_checkbox ('parent_detection', 1, $parent_detec
$table->data[21][0] = "<b>".__('Parent recursion');
$table->data[21][1] = html_print_input_text ('parent_recursion', $parent_recursion, '', 5, 0, true) . ui_print_help_tip (__('Maximum number of parent hosts that will be created if parent detection is enabled.'), true);
// Alias as name
$table->data[22][0] = "<b>".__('Alias as Name');
$table->data[22][1] = html_print_checkbox ('alias_as_name', 1, $alias_as_name, true);
// Different Form url if it's a create or if it's a update form
echo '<form name="modulo" method="post" action="index.php?sec=gservers&sec2=godmode/servers/manage_recontask&'.(($id_rt != -1) ? 'update='.$id_rt : 'create=1').'">';
html_print_table ($table);

View File

@ -206,11 +206,16 @@ $row++;
$table_styles->data[$row][0] = __('Custom logo (login)') . ui_print_help_icon("custom_logo_login", true);
if(enterprise_installed()) {
$table_styles->data[$row][1] = html_print_select(
list_files('enterprise/images/custom_logo_login', "png", 1, 0), 'custom_logo_login',
$config["custom_logo_login"], '', '', '',true,false,true,'',$open,'width:240px');
}
else {
$table_styles->data[$row][1] = html_print_select(
"", 'custom_logo_login',
$config["custom_logo_login"], '', '', '',true,false,true,'',$open,'width:240px');
}
$table_styles->data[$row][1] .= "&nbsp;" . html_print_button(__("View"), 'custom_logo_login_preview', $open, '', 'class="sub camera"', true,false,$open,'visualmodal');
$row++;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC170303';
$build_version = 'PC170307';
$pandora_version = 'vNG_BETA';
// Do not overwrite default timezone set if defined.

View File

@ -346,11 +346,8 @@ function postgresql_db_process_sql_insert($table, $values) {
}
$query .= '(' . implode(', ', $fields) . ')';
$query .= ' VALUES (' . $values_str . ')';
//html_debug_print($query);
return db_process_sql($query, 'insert_id');
}

View File

@ -173,7 +173,7 @@ function list_files ($directory, $stringSearch, $searchHandler, $return = false)
}
if ($searchHandler == 1) {
while (false !== ($fileName = @readdir ($directoryHandler))) {
if (@substr_count ($fileName, $stringSearch) > 0) {
if ((@substr_count ($fileName, $stringSearch) > 0) || (@substr_count ($fileName, strtoupper($stringSearch)) > 0)) {
$result[$fileName] = $fileName;
}
}

View File

@ -342,6 +342,52 @@ function api_get_agent_module_name_last_value($agentName, $moduleName, $other =
}
}
function api_get_agent_module_name_last_value_alias($alias, $moduleName, $other = ';', $returnType)
{
global $config;
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf('SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.alias LIKE "%s" AND tagente_modulo.nombre LIKE "%s"', $alias, $moduleName);
break;
case "postgresql":
case "oracle":
$sql = sprintf('SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.alias LIKE \'%s\' AND tagente_modulo.nombre LIKE \'%s\'', $alias, $moduleName);
break;
}
$idModuleAgent = db_get_value_sql($sql);
if ($idModuleAgent === false) {
switch ($other['type']) {
case 'string':
switch ($other['data']) {
case 'error_message':
default:
returnError('id_not_found', $returnType);
break;
}
break;
case 'array':
switch ($other['data'][0]) {
case 'error_value':
returnData($returnType, array('type' => 'string', 'data' => $other['data'][1]));
break;
}
break;
}
}
else {
api_get_module_last_value($idModuleAgent, null, $other, $returnType);
}
}
function api_get_module_last_value($idAgentModule, $trash1, $other = ';', $returnType) {
if (defined ('METACONSOLE')) {
return;
@ -525,7 +571,7 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) {
'group_other',
'agent_id',
'agent_name',
'alias',
'agent_direction',
'agent_comentary',
'agent_id_group',
@ -542,6 +588,7 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) {
'agent_server_name',
'agent_cascade_protection',
'agent_cascade_protection_module',
'agent_name',
'module_id_agent_modulo',
'module_id_agent',
@ -764,7 +811,7 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) {
$groups = str_replace('\n', $returnReplace, $groups);
$agents = db_get_all_rows_sql('
SELECT id_agente AS agent_id, id_grupo AS agent_id_group ' . $agent_additional_columns . ' FROM tagente');
SELECT id_agente AS agent_id, id_grupo AS agent_id_group , alias' . $agent_additional_columns . ' FROM tagente');
if ($agents === false) $agents = array();
$agents = str_replace('\n', $returnReplace, $agents);
@ -936,6 +983,67 @@ function api_get_module_properties_by_name($agent_name, $module_name, $other, $r
/*
* subroutine for api_get_module_properties() and api_get_module_properties_by_name().
*/
/**
*
* @param $alias
* @param $module_name
* @param mixed $other If $other is string is only the separator,
* but if it's array, $other as param is <separator>;<replace_return>;(<field_1>,<field_2>...<field_n>) in this order
* and separator char (after text ; ) must be diferent that separator (and other) url (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* return csv with fields type_row,group_id and agent_name, separate with ";" and the return of the text replace for " "
* api.php?op=get&op2=module_properties_by_name&id=sample_agent&id2=sample_module&return_type=csv&other=;| |module_id_agent,module_name,module_str_critical,module_str_warning&other_mode=url_encode_separator_|
*
* @param $returnType
* @return unknown_type
*/
function api_get_module_properties_by_alias($alias, $module_name, $other, $returnType)
{
if ($other['type'] == 'array') {
$separator = $other['data'][0];
$returnReplace = $other['data'][1];
if (trim($other['data'][2]) == '')
$fields = false;
else {
$fields = explode(',', $other['data'][2]);
foreach($fields as $index => $field)
$fields[$index] = trim($field);
}
}
else {
if (strlen($other['data']) == 0)
$separator = ';'; //by default
else
$separator = $other['data'];
$returnReplace = ' ';
$fields = false;
}
$sql = sprintf('SELECT tagente_modulo.id_agente_modulo FROM tagente_modulo
INNER JOIN tagente ON tagente_modulo.id_agente = tagente.id_agente
WHERE tagente.alias LIKE "%s" AND tagente_modulo.nombre LIKE "%s"', $alias, $module_name);
$module_id = db_get_value_sql($sql);
if( !empty($alias) && $module_id > 0 ) {
get_module_properties($module_id, $fields, $separator, $returnType, $returnReplace);
}
else {
if(empty($alias)) {
returnError('error_get_module_properties_by_name', __('Does not exist agent with this name.'));
} else {
returnError('error_get_module_properties_by_name', __('Does not exist module with this name.'));
}
}
}
/*
* subroutine for api_get_module_properties() and api_get_module_properties_by_name().
*/
function get_module_properties($id_module, $fields, $separator, $returnType, $returnReplace)
{
/** NOTE: if you want to add an output field, you have to add it to;
@ -1371,9 +1479,9 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
}
}
if (isset($other['data'][3])) {
// Filter by name
// Filter by alias
if ($other['data'][3] != "") {
$where .= " AND nombre LIKE ('%" . $other['data'][3] . "%')";
$where .= " AND alias LIKE ('%" . $other['data'][3] . "%')";
}
}
if (isset($other['data'][4])) {
@ -1394,14 +1502,14 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
// Initialization of array
$result_agents = array();
// Filter by state
$sql = "SELECT id_agente, nombre, direccion, comentarios,
tconfig_os.name, url_address
$sql = "SELECT id_agente, alias, direccion, comentarios,
tconfig_os.name, url_address, nombre
FROM tagente, tconfig_os
WHERE tagente.id_os = tconfig_os.id_os
AND disabled = 0 " . $where;
$all_agents = db_get_all_rows_sql($sql);
// Filter by status: unknown, warning, critical, without modules
if (isset($other['data'][2])) {
if ($other['data'][2] != "") {
@ -1469,7 +1577,6 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType) {
if (count($result_agents) > 0 and $result_agents !== false) {
$data = array('type' => 'array', 'data' => $result_agents);
returnData($returnType, $data, $separator);
}
else {
@ -1950,6 +2057,78 @@ function api_get_group_agent_by_name($thrash1, $thrash2, $other, $thrash3) {
}
}
/**
* Get name group for an agent, and print all the result like a csv.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param are the filters available <alias> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* api.php?op=get&op2=group_agent_by_alias&return_type=csv&other=Pepito&other_mode=url_encode_separator_|
*
* @param $thrash3 Don't use.
*/
function api_get_group_agent_by_alias($thrash1, $thrash2, $other, $thrash3) {
$group_names =array();
if (is_metaconsole()) {
$servers = db_get_all_rows_sql ("SELECT *
FROM tmetaconsole_setup
WHERE disabled = 0");
if ($servers === false)
$servers = array();
foreach($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$agent_id = agents_get_agent_id($other['data'][0],true);
if ($agent_id) {
$sql = sprintf("SELECT groups.nombre nombre
FROM tagente agents, tgrupo groups
WHERE id_agente = %d
AND agents.id_grupo = groups.id_grupo",$agent_id);
$group_server_names = db_get_all_rows_sql($sql);
if ($group_server_names) {
foreach($group_server_names as $group_server_name) {
$group_names[] = $group_server_name;
}
}
}
}
metaconsole_restore_db();
}
}
else {
$sql = sprintf("SELECT tagente.id_agente FROM tagente WHERE alias LIKE '%s' ",$other['data'][0]);
$agent_id = db_get_all_rows_sql($sql);
foreach ($agent_id as &$id) {
$sql = sprintf("SELECT groups.nombre nombre
FROM tagente agents, tgrupo groups
WHERE id_agente = %d
AND agents.id_grupo = groups.id_grupo",$id['id_agente']);
$group_name = db_get_all_rows_sql($sql);
$group_names[] = $group_name[0];
}
}
if (count($group_names) > 0 and $group_names !== false) {
$data = array('type' => 'array', 'data' => $group_names);
returnData('csv', $data, ';');
}
else {
returnError('error_group_agent', 'No groups retrieved.');
}
}
/**
* Get id server whare agent is located, and print all the result like a csv.
*
@ -2064,6 +2243,78 @@ function api_get_id_group_agent_by_name($thrash1, $thrash2, $other, $thrash3) {
}
}
/**
* Get id group for an agent, and print all the result like a csv.
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param are the filters available <alias> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example:
*
* api.php?op=get&op2=id_group_agent_by_alias&return_type=csv&other=Nova&other_mode=url_encode_separator_|
*
* @param $thrash3 Don't use.
*/
function api_get_id_group_agent_by_alias($thrash1, $thrash2, $other, $thrash3) {
$group_names =array();
if (is_metaconsole()) {
$servers = db_get_all_rows_sql ("SELECT *
FROM tmetaconsole_setup
WHERE disabled = 0");
if ($servers === false)
$servers = array();
foreach($servers as $server) {
if (metaconsole_connect($server) == NOERR) {
$sql = sprintf("SELECT tagente.id_agente FROM tagente WHERE alias LIKE '%s' ",$other['data'][0]);
$agent_id = db_get_all_rows_sql($sql);
foreach ($agent_id as &$id) {
$sql = sprintf("SELECT groups.id_grupo id_group
FROM tagente agents, tgrupo groups
WHERE id_agente = %d
AND agents.id_grupo = groups.id_grupo",$id['id_agente']);
$group_server_names = db_get_all_rows_sql($sql);
if ($group_server_names) {
foreach($group_server_names as $group_server_name) {
$group_names[] = $group_server_name;
}
}
}
}
metaconsole_restore_db();
}
}
else {
$sql = sprintf("SELECT tagente.id_agente FROM tagente WHERE alias LIKE '%s' ",$other['data'][0]);
$agent_id = db_get_all_rows_sql($sql);
foreach ($agent_id as &$id) {
$sql = sprintf("SELECT groups.id_grupo id_group
FROM tagente agents, tgrupo groups
WHERE id_agente = %d
AND agents.id_grupo = groups.id_grupo",$id['id_agente']);
$group_name = db_get_all_rows_sql($sql);
$group_names[] = $group_name[0];
}
}
if (count($group_names) > 0 and $group_names !== false) {
$data = array('type' => 'array', 'data' => $group_names);
returnData('csv', $data);
}
else {
returnError('error_group_agent', 'No groups retrieved.');
}
}
/**
* Get all policies, possible filtered by agent, and print all the result like a csv.
*
@ -3702,7 +3953,7 @@ function api_get_module_value_all_agents($id, $thrash1, $other, $thrash2) {
return;
}
$sql = sprintf("SELECT agent.id_agente, agent.nombre, module_state.datos FROM tagente agent, tagente_modulo module, tagente_estado module_state WHERE agent.id_agente = module.id_agente AND module.id_agente_modulo=module_state.id_agente_modulo AND module.nombre = '%s'", $id);
$sql = sprintf("SELECT agent.id_agente, agent.alias, module_state.datos, agent.nombre FROM tagente agent, tagente_modulo module, tagente_estado module_state WHERE agent.id_agente = module.id_agente AND module.id_agente_modulo=module_state.id_agente_modulo AND module.nombre = '%s'", $id);
$module_values = db_get_all_rows_sql($sql);
@ -6086,7 +6337,6 @@ function api_set_update_group($id_group, $thrash2, $other, $thrash3) {
return;
}
//html_debug_print($other);
$name = $other['data'][0];
$icon = $other['data'][1];
$parent = $other['data'][2];
@ -7714,7 +7964,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
}
else {
$sql = "SELECT *,
(SELECT t1.nombre
(SELECT t1.alias
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
(SELECT t2.nombre
@ -7740,7 +7990,7 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
case "postgresql":
//TODO TOTAL
$sql = "SELECT *,
(SELECT t1.nombre
(SELECT t1.alias
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
(SELECT t2.nombre
@ -7767,6 +8017,9 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
$set['offset'] = $offset;
$sql = "SELECT *,
(SELECT t1.alias
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS alias,
(SELECT t1.nombre
FROM tagente t1
WHERE t1.id_agente = tevento.id_agente) AS agent_name,
@ -7853,9 +8106,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
else if ($other['type'] == 'array') {
$separator = $other['data'][0];
}
//html_debug_print($filter, true);
$result = db_get_all_rows_sql ($sql);
//html_debug_print($sql, true);
if (($result !== false) &&
(!$filter['total']) &&
@ -7911,8 +8163,6 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
}
}
//html_debug_print($result);
$data['type'] = 'array';
$data['data'] = $result;
@ -7945,12 +8195,10 @@ function api_get_events($trash1, $trash2, $other, $returnType, $user_in_db = nul
returnError('ERROR_API_PANDORAFMS', $returnType);
}
}
return;
}
if ($other['type'] == 'string') {
if ($other['data'] != '') {
returnError('error_parameter', 'Error in the parameters.');
@ -8390,7 +8638,7 @@ function api_get_total_agents($id_group, $trash1, $trash2, $returnType) {
/**
* Agent name for a given id
*
* @param int $id_group
* @param int $id_agent
*
**/
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
@ -8412,6 +8660,31 @@ function api_get_agent_name($id_agent, $trash1, $trash2, $returnType) {
returnData($returnType, $data);
}
/**
* Agent alias for a given id
*
* @param int $id_agent
*
**/
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$sql = sprintf('SELECT alias
FROM tagente
WHERE id_agente = %d', $id_agent);
$value = db_get_value_sql($sql);
if ($value === false) {
returnError('id_not_found', $returnType);
}
$data = array('type' => 'string', 'data' => $value);
returnData($returnType, $data);
}
/**
* Module name for a given id
*

6
pandora_console/include/functions_extensions.php Normal file → Executable file
View File

@ -409,7 +409,7 @@ function extensions_add_godmode_menu_option ($name, $acl, $fatherId = null, $ico
* @param tabIcon Path to the image icon
* @param tabFunction Name of the function to execute when this extension is called
*/
function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A") {
function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A", $acl = 'AW') {
global $config;
global $extension_file;
@ -420,6 +420,7 @@ function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
$extension['extension_god_tab']['icon'] = $tabIcon;
$extension['extension_god_tab']['function'] = $tabFunction;
$extension['extension_god_tab']['version'] = $version;
$extension['extension_ope_tab']['acl'] = $acl;
}
/**
@ -430,7 +431,7 @@ function extensions_add_godmode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
* @param tabIcon Path to the image icon
* @param tabFunction Name of the function to execute when this extension is called
*/
function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A") {
function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFunction, $version="N/A", $acl = 'AR') {
global $config;
global $extension_file;
@ -441,6 +442,7 @@ function extensions_add_opemode_tab_agent($tabId, $tabName, $tabIcon, $tabFuncti
$extension['extension_ope_tab']['icon'] = $tabIcon;
$extension['extension_ope_tab']['function'] = $tabFunction;
$extension['extension_ope_tab']['version'] = $version;
$extension['extension_ope_tab']['acl'] = $acl;
}
/**

View File

@ -480,7 +480,7 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
}
}
if (!is_null($percentil)) {
if (!is_null($percentil) && $percentil) {
$avg = array_map(function($item) { return $item['sum'];}, $chart);
$percentil_result = get_percentile($percentil, $avg);
@ -774,7 +774,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$chart_extra_data['legend_unknown'] = $legend['unknown'.$series_suffix_str];
}
if (!is_null($percentil)) {
if (!is_null($percentil) && $percentil) {
$first_data = reset($chart);
$percentil_value = format_for_graph($first_data['percentil'], 2);
@ -1429,8 +1429,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if ($projection == false or ($projection != false and $i == 0)) {
$module_name_list[$i] .= ": ";
if ($show_last)
$module_name_list[$i] .= __('Last') . ": $last $unit; ";
if ($show_max)
$module_name_list[$i] .= __("Max") . ": $max $unit; ";
if ($show_min)
@ -1739,8 +1737,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
break;
default:
if (!is_null($percentil)) {
if (!is_null($percentil) && $percentil) {
foreach ($graph_values as $graph_group => $point) {
foreach ($point as $timestamp_point => $point_value) {
$temp[$timestamp_point][$graph_group] = $point_value;
@ -1750,7 +1747,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value);
$series_type[$graph_group] = 'line';
$agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($module_list[$graph_group]));
modules_get_agentmodule_agent_alias ($module_list[$graph_group]));
$module_name = io_safe_output(
modules_get_agentmodule_name ($module_list[$graph_group]));
$module_name_list['percentil'.$graph_group] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') ';
@ -2004,7 +2001,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$width, $height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
"", $ttl, $homeurl, $background_color);
"", $ttl, $homeurl, $background_color, true);
break;
case CUSTOM_GRAPH_PIE:
return ring_graph($flash_charts, $graph_values, $width, $height,
@ -2825,7 +2822,7 @@ function graph_incidents_status () {
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
}
return pie3d_graph($config['flash_charts'], $data, 370, 180,
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}

View File

@ -1199,7 +1199,7 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
if ($show_graph != REPORT_TOP_N_ONLY_TABLE) {
arsort($data_pie_graph);
$return['charts']['pie'] = pie3d_graph(false,
$data_pie_graph,
$width, $height,
@ -1221,14 +1221,14 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
array(),
"",
"",
true,
ui_get_full_url(false, true, false, false) . '/',
false,
false,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'],
$config['font_size'],
true,
$ttl,
true);
$config['homeurl']);
}
$return['resume'] = null;
@ -3387,11 +3387,11 @@ function reporting_prediction_date($report, $content) {
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
set_time_limit(500);
$intervals_text = explode(';', $content['text']);
$intervals_text = $content['text'];
$max_interval = substr($intervals_text, 0, strpos($intervals_text, ';'));
$min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1);
$max_interval = $intervals_text[0];
$min_interval = $intervals_text[1];
$value = forecast_prediction_date ($content['id_agent_module'], $content['period'], $max_interval, $min_interval);
if ($value === false) {
@ -5780,7 +5780,15 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
reporting_set_conf_charts($width, $height, $only_image, $type,
$content, $ttl);
$height += count($modules) * REPORTING_CUSTOM_GRAPH_LEGEND_EACH_MODULE_VERTICAL_SIZE;
//height for bullet chart
if($graph['stacked'] != 4){
$height += count($modules) * REPORTING_CUSTOM_GRAPH_LEGEND_EACH_MODULE_VERTICAL_SIZE;
}
else{
if(!$only_image){
$height = 50;
}
}
switch ($type) {
case 'dinamic':

View File

@ -1360,13 +1360,8 @@ function reporting_html_agent_module($table, $item) {
$textcolor = '#FFF';
break;
}
/*
$file_name = string2image(
ui_print_truncate_text($row['agent_name'], 'agent_small',
false, true, false, '...'),
false, false, 6, 0, $rowcolor, $textcolor, 4, 0);
*/
$file_name = ui_print_truncate_text($row['agent_name'], 'agent_small',
$file_name = ui_print_truncate_text($row['agent_alias'], 'agent_small',
false, true, false, '...');
$table_data .= "<td style='background-color: " . $rowcolor . ";'>" .
$file_name . "</td>";
@ -2053,7 +2048,7 @@ function reporting_html_monitor_report($table, $item, $mini) {
function reporting_html_graph($table, $item) {
$table->colspan['chart']['cell'] = 3;
$table->cellstyle['chart']['cell'] = 'text-align: center;';
$table->data['chart']['cell'] = $item['chart'];
$table->data['chart']['cell'] = $item['chart'].'<br><br><br><br>';
}
function reporting_html_prediction_date($table, $item, $mini) {

View File

@ -250,11 +250,6 @@ function update_manager_check_online_free_packages_available() {
$http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE);
curl_close($curlObj);
//~ html_debug_print("----------", true);
//~ html_debug_print($params, true);
//~ html_debug_print($http_status, true);
//~ html_debug_print($result, true);
if ($result === false) {
return false;
}
@ -316,11 +311,6 @@ function update_manager_check_online_free_packages ($is_ajax=true) {
$http_status = curl_getinfo($curlObj, CURLINFO_HTTP_CODE);
curl_close($curlObj);
//~ html_debug_print("=============", true);
//~ html_debug_print($params, true);
//~ html_debug_print($http_status, true);
//~ html_debug_print($result, true);
if ($result === false) {
if ($is_ajax) {
echo __("Could not connect to internet");
@ -412,10 +402,6 @@ function update_manager_curl_request ($action, $additional_params = false) {
curl_close($curlObj);
$error_array['http_status'] = $http_status;
//~ html_debug_print("=============", true);
//~ html_debug_print($params, true);
//~ html_debug_print($http_status, true);
//~ html_debug_print($result, true);
if ($result === false) {
$error_array['success'] = false;
@ -591,10 +577,6 @@ function update_manager_remote_read_messages ($id_message) {
$result = update_manager_curl_request ('mark_as_read', $params);
//if (!$result['success']) {
// html_debug ($result['update_message'], true);
//}
return $result['success'];
}

View File

@ -124,105 +124,83 @@ function visual_map_print_item($mode = "read", $layoutData,
$text = '<span id="text_' . $id . '" class="text">' . $label .'</span>';
if($height == 0){
switch($type){
case 0:
case 11:
$tableheight0 = '70';
break;
case 3:
$tableheight0 = '30';
break;
case 9:
$tableheight0 = '130';
break;
case 1:
$tableheight0 = '180';
break;
case SERVICE:
$tableheight0 = '50';
break;
if ($height == 0) {
switch($type) {
case 0:
case 11:
$tableheight0 = '70';
break;
case 3:
$tableheight0 = '30';
break;
case 9:
$tableheight0 = '130';
break;
case 1:
$tableheight0 = '180';
break;
case SERVICE:
$tableheight0 = '50';
break;
}
}
else {
$tableheight0 = $height;
}
}
else{
$tableheight0 = $height;
}
if ($layoutData['width'] == 0 || $layoutData['height'] == 0){
switch($type){
case 0:
case 11:
$himg = '70';
$wimg ='70';
break;
case 3:
if(get_parameter('action') == 'edit'){
$himg = '30';
$wimg = '150';
}
else{
$himg = '15';
$wimg = '150';
}
break;
case 9:
$himg = '130';
$wimg = '130';
break;
case 1:
$himg = '180';
$wimg = '300';
break;
case SERVICE:
$himg = '50';
$wimg = '150';
break;
}
}
else{
$wimg = $layoutData['width'];
$himg = $layoutData['height'];
if($type == 3){
if(get_parameter('action') == 'edit'){
$himg = '30';
}
else{
$himg = '15';
if ($layoutData['width'] == 0 || $layoutData['height'] == 0) {
switch($type) {
case 0:
case 11:
$himg = '70';
$wimg ='70';
break;
case 3:
if (get_parameter('action') == 'edit') {
$himg = '30';
$wimg = '150';
}
else{
$himg = '15';
$wimg = '150';
}
break;
case 9:
$himg = '130';
$wimg = '130';
break;
case 1:
$himg = '180';
$wimg = '300';
break;
case SERVICE:
$himg = '50';
$wimg = '150';
break;
}
}
if($type == 9){
$himg = $wimg;
else {
$wimg = $layoutData['width'];
$himg = $layoutData['height'];
if ($type == 3) {
if(get_parameter('action') == 'edit')
$himg = '30';
else
$himg = '15';
}
if ($type == 9) {
$himg = $wimg;
}
}
}
if($label_position == 'left'){
if ($label_position == 'left') {
$text = '<table style="float:left;height:'.$himg.'px;"><tr><td></td></tr><tr><td><span id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
}
else if($label_position == 'right'){
elseif ($label_position == 'right') {
$text = '<table style="float:right;height:'.$himg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
}
else{
else {
$text = '<table style="width:'.$wimg.'px;"><tr><td></td></tr><tr><td><span style="" id="text_' . $id . '" class="text">' . $label .'</span></td></tr><tr><td></td></tr></table>';
}
@ -276,9 +254,7 @@ else{
case GROUP_ITEM:
if ($layoutData['enable_link']
&& can_user_access_node()) {
$link = true;
}
break;
case LABEL:
@ -1013,10 +989,11 @@ else{
false, $type_graph) . '</div>';
}
else {
$img = grafico_modulo_sparse($id_module, $period, 0,300,180,
'',null,
false, 1, false, 0, '', 0, 0, true, $only_image, '', 1, false,
'', false, false, false, $layoutData['image'], null, true, false,$type_graph);
$img = grafico_modulo_sparse($id_module,
$period, 0, 300, 180, '',null, false, 1,
false, 0, '', 0, 0, true, $only_image, '',
1, false, '', false, false, false,
$layoutData['image'], null, true, false, $type_graph);
}
}
else{
@ -1237,72 +1214,66 @@ else{
break;
case PERCENTILE_BAR:
$imgpos = '';
if($layoutData['label_position']=='left'){
$imgpos = 'float:right;';
}
else if($layoutData['label_position']=='right'){
$imgpos = 'float:left;';
}
$progress_bar_heigh = 15;
if (!empty($proportion)) {
if ($width != 0) {
$width = (integer)($proportion['proportion_width'] * $width);
$imgpos = '';
if($layoutData['label_position']=='left'){
$imgpos = 'float:right;';
}
else {
$width = (integer)($proportion['proportion_width'] * $infoImage[0]);
else if($layoutData['label_position']=='right'){
$imgpos = 'float:left;';
}
if ($height != 0) {
$height = (integer)($proportion['proportion_height'] * $height);
$progress_bar_heigh = $progress_bar_heigh * $proportion['proportion_height'];
}
else {
$height = (integer)($proportion['proportion_height'] * $infoImage[1]);
}
}
if($layoutData['label_position']=='up'){
echo io_safe_output($text);
}
ob_start();
if ($type == PERCENTILE_BUBBLE) {
echo progress_bubble($percentile, $width, $width, '', 1, $value_text, $colorStatus,$imgpos);
}
else {
echo progress_bar($percentile, $width, $progress_bar_heigh, '', 1, $value_text, $colorStatus,$imgpos);
}
$img = ob_get_clean();
if(get_parameter('action') == 'edit'){
if($width == 0){
$img = '<img src="images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
}
else{
$img = '<img src="images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
}
}
else{
$img = str_replace('>', 'class="image" style="height:'.$himg.'px;width:'.$wimg.'px;'.$imgpos.'" id="image_' . $id . '" />', $img);
}
echo $img;
if($layoutData['label_position']=='down'){
echo io_safe_output($text);
}
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
echo io_safe_output($text);
}
$progress_bar_heigh = 15;
if (!empty($proportion)) {
if ($width != 0) {
$width = (integer)($proportion['proportion_width'] * $width);
}
else {
$width = (integer)($proportion['proportion_width'] * $infoImage[0]);
}
if ($height != 0) {
$height = (integer)($proportion['proportion_height'] * $height);
$progress_bar_heigh = $progress_bar_heigh * $proportion['proportion_height'];
}
else {
$height = (integer)($proportion['proportion_height'] * $infoImage[1]);
}
}
if($layoutData['label_position']=='up'){
echo io_safe_output($text);
}
ob_start();
if ($type == PERCENTILE_BUBBLE) {
echo progress_bubble($percentile, $width, $width, '', 1, $value_text, $colorStatus,$imgpos);
}
else {
echo progress_bar($percentile, $width, $progress_bar_heigh, '', 1, $value_text, $colorStatus,$imgpos);
}
$img = ob_get_clean();
if (get_parameter('action') == 'edit') {
if ($width == 0) {
$img = '<img src="images/console/signes/percentil.png" style="width:130px;height:30px;'.$imgpos.'">';
}
else {
$img = '<img src="images/console/signes/percentil.png" style="width:'.$width.'px;height:30px;'.$imgpos.'">';
}
}
else{
$img = str_replace('>', 'class="image" style="height:'.$himg.'px;width:'.$wimg.'px;'.$imgpos.'" id="image_' . $id . '" />', $img);
}
echo $img;
if($layoutData['label_position']=='down'){
echo io_safe_output($text);
}
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
echo io_safe_output($text);
}
break;

View File

@ -287,6 +287,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['backgroundColor'] = $backgroundColor;
$graph['unit'] = $unit;
$graph['series_type'] = $series_type;
$graph['percentil'] = $percentil_values;
$id_graph = serialize_in_temp($graph, null, $ttl);
// Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/"
@ -399,7 +400,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height,
false,
'',
$menu,
$background_color,
$backgroundColor,
$dashboard,
$vconsole);
}
@ -569,7 +570,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$graph['backgroundColor'] = $backgroundColor;
$graph['percentil'] = $percentil_values;
$id_graph = serialize_in_temp($graph, null, $ttl);
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />";

View File

@ -164,9 +164,8 @@ function pandoraFlotPieCustom(graph_id, values, labels, width,
pie: {
show: true,
radius: 3/4,
innerRadius: 0.4,
label: label_conf
innerRadius: 0.4
//label: label_conf
}
},
legend: {
@ -1723,7 +1722,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show();
// If no legend, the timestamp labels are short and with value
if (legends.length == 0) {
if (legend.length == 0) {
$('#timestamp_'+graph_id).text(labels[j] + ' (' + parseFloat(y).toFixed(2) + ')');
}
else {
@ -1982,7 +1981,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
// Adjust the menu image on top of the plot
// If there is no legend we increase top-padding to make space to the menu
if (legends.length == 0) {
if (legend.length == 0) {
$('#menu_' + graph_id).parent().css('padding-top',
$('#menu_' + graph_id).css('height'));
}

View File

@ -137,6 +137,10 @@ if (isset($graph['series_type'])) {
$series_type = $graph['series_type'];
}
if (isset($graph['percentil'])){
$percentil = $graph['percentil'];
}
/*
@ -219,10 +223,23 @@ switch ($graph_type) {
case 'line':
case 'threshold':
case 'scatter':
if (!empty($percentil)) {
$count_percentil = count($percentil);
for ($j=0; $j < $count_percentil; $j++) {
$i=0;
foreach ($data as $key => $value) {
$data[$key]['percentil' . $j] = $percentil[$j][$i];
if($graph_type == 'area'){
$series_type['percentil' . $j] = 'line';
}
$i++;
}
}
}
foreach ($data as $i => $d) {
$data_values[] = $d;
if (($c % $step) == 0) {
$data_keys[] = $i;
}
@ -297,6 +314,36 @@ foreach ($colors as $i => $color) {
$rgb_color[$i]['alpha'] = $color['alpha'];
}
}
//add color for percentil
if($percentil){
for ($j=0; $j < $count_percentil; $j++) {
if (isset ($colors[$j]['border'])) {
$rgb['border'] = html_html2rgb($colors[$j]['border']);
if (isset($rgb['border'])) {
$rgb_color['percentil' . $j]['border']['R'] = $rgb['border'][0];
$rgb_color['percentil' . $j]['border']['G'] = $rgb['border'][1];
$rgb_color['percentil' . $j]['border']['B'] = $rgb['border'][2];
}
}
if (isset ($colors[$j]['color'])) {
$rgb['color'] = html_html2rgb($colors[$j]['color']);
if (isset($rgb['color'])) {
$rgb_color['percentil' . $j]['color']['R'] = $rgb['color'][0];
$rgb_color['percentil' . $j]['color']['G'] = $rgb['color'][1];
$rgb_color['percentil' . $j]['color']['B'] = $rgb['color'][2];
}
}
if (isset ($colors[$j]['alpha'])) {
$rgb_color['percentil' . $j]['alpha'] = $colors[$j]['alpha'];
}
}
}
//add for report with max 15 modules comparation repeat
$countlegend = count($legend);
if($countlegend > 15){
@ -812,7 +859,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
"BorderB" => $rgb_color[$i]['border']["B"],
"Alpha" => $rgb_color[$i]['alpha']));
/*$palette_color = array();
$palette_color = array();
if (isset($rgb_color[$i]['color'])) {
$palette_color["R"] = $rgb_color[$i]['color']["R"];
$palette_color["G"] = $rgb_color[$i]['color']["G"];
@ -827,7 +874,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$palette_color["Alpha"] = $rgb_color[$i]['Alpha'];
}
$MyData->setPalette($point_id, $palette_color);*/
$MyData->setPalette($point_id, $palette_color);
}
// The weight of the line is not calculated in pixels, so it needs to be transformed

View File

@ -1,8 +1,8 @@
<?php
/**
* @package Include/help/en
*/
?>
<h1>Reports - Time lapse</h1>
<br>
This is the range, or period of time over which the report renders the information for this report type. For example, a week means data from a week ago from now.
<?php
/**
* @package Include/help/ja
*/
?>
<h1>レポート - 時間経過</h1>
<br>
これは、レポートがこのレポートタイプの情報をレンダリングする範囲または期間です。 たとえば、1週間は、今から1週間前のデータを意味します。

File diff suppressed because it is too large Load Diff

View File

@ -23,8 +23,7 @@ h1 {
text-align: center;
}
h2 {
font: bold 1em Arial, Sans-serif;
border-bottom: solid 1px #00aa00;
font: Verdana;
font-size: 16px;
}
@ -40,7 +39,6 @@ div#logo_img {
}
div#wizard {
text-align: left;
border: 1px solid #999;
margin-top: 1em;
width: 650px;
@ -51,7 +49,6 @@ div#wizard {
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
border-radius: 10px;
position: relative;
}
@ -74,19 +71,13 @@ div#install_box, div#install_img {
div#install_box {
background: F3F3F3;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
border: 0px;
border: 1px solid #ccc;
padding: 10px 25px;
margin-top: 10px;
-moz-box-shadow: -1px 1px 6px #aaa;
-webkit-box-shadow: -1px 1px 6px #aaa;
box-shadow: -1px 1px 6px #aaa;
margin-top: 40px;
}
div#install_box h2 {
color: #00aa00;
color: #82B92E;
text-transform: uppercase;
}
@ -114,22 +105,25 @@ input#step4, input#step4:hover {
background-color: #fafafa;
}
div.warn {
background: url(../../images/warn.png) no-repeat 0% -2px;
color: #880;
margin-top: 7px;
padding: 2px 1px 6px 30px;
min-height: 24px;
background: url(../../images/icono_warning_install.png) no-repeat 0% -2px;
color: #222;
margin-top: 14px;
padding: 2px 1px 6px 40px;
}
div.info {
background: url(../../images/info.png) no-repeat 0% -2px;
color: #222;
margin-top: 7px;
padding: 2px 1px 6px 30px;
min-height: 24px;
background: url(../../images/icono_info_install.png) no-repeat 0% -2px;
color: #222;
margin-top: 14px;
padding: 2px 1px 6px 40px;
}
div.err {
background: url(../../images/error_red.png) no-repeat 0% -2px;
color: #cc0000;
margin-top: 7px;
padding: 2px 1px 6px 30px;
min-height: 24px;
background: url(../../images/icono_critical_install.png) no-repeat 0% -2px;
color: #cc0000;
margin-top: 14px;
padding: 2px 1px 6px 40px;
}
span.arr {
background: url(../../images/arrow.png) no-repeat;
@ -152,8 +146,22 @@ body{
}
div.installation_step {
position: absolute;
position: static;
float: right;
top: 7px;
right: 10px;
color: #666;
margin-top: 14px;
margin-right: 12px;
}
.btn_install_next {
margin: 10px;
padding: 8px 20px 8px 20px;
background-color: transparent;
border: 1px solid #82B92E;
font: bold 1em Verdana;
font-size: 14pt;
color: #82B92E;
border-radius: 0%;
}

View File

@ -71,7 +71,7 @@
<div style='height: 10px'>
<?php
$version = 'NG_BETA';
$build = '170303';
$build = '170307';
$banner = "v$version Build $build";
error_reporting(0);
@ -150,41 +150,52 @@ function check_exists ( $file, $label ) {
}
function check_generic ( $ok, $label ) {
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
echo "<tr><td style='width:10%'>";
if ($ok == 0 ) {
echo " <img src='images/dot_red.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 1;
}
else {
echo " <img src='images/dot_green.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 0;
}
echo "</td></tr>";
}
function check_writable ( $fullpath, $label ) {
echo "<tr><td>";
echo "<span class='arr'> $label </span>";
echo "</td><td>";
echo "<tr><td style='width:10%;'>";
if (file_exists($fullpath))
if (is_writable($fullpath)) {
echo " <img src='images/dot_green.png'>";
echo " <img style='margin-left:50px;' src='images/dot_green.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 0;
}
else {
echo " <img src='images/dot_red.png'>";
echo " <img style='margin-left:50px;' src='images/dot_red.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 1;
}
else {
echo " <img src='images/dot_red.png'>";
echo " <img style='margin-left:50px;' src='images/dot_red.png'>";
echo "<td>";
echo "<span class='arr'> $label </span>";
echo "</td>";
echo "</td></tr>";
return 1;
}
}
function check_variable ( $var, $value, $label, $mode ) {
@ -258,160 +269,6 @@ function parse_mysqli_dump($connection, $url) {
return 0;
}
function parse_postgresql_dump($connection, $url, $debug = false) {
if (file_exists($url)) {
$file_content = file($url);
$query = "";
foreach ($file_content as $sql_line) {
$clean_line = trim($sql_line);
$comment = preg_match("/^(\s|\t)*--.*$/", $clean_line);
if ($comment) {
continue;
}
if (empty($clean_line)) {
continue;
}
$query .= $clean_line;
//Check if the end of query with the the semicolon and any returns in the end of line
if(preg_match("/;[\040]*\$/", $clean_line)) {
//And execute and clean buffer
pg_send_query($connection, $query);
$result = pg_get_result($connection);
if ($debug) {
var_dump($query);
var_dump(pg_result_error($result));
}
if (pg_result_status($result) == PGSQL_FATAL_ERROR) {
echo pg_result_error($result);
echo "<i><br>$query<br></i>";
return 0;
}
$query = "";
}
}
return 1;
}
else {
return 0;
}
}
function parse_oracle_dump($connection, $url, $debug = false) {
if (file_exists($url)) {
$file_content = file($url);
$query = "";
$plsql_block = false;
$datetime_tz_format = oci_parse($connection, 'alter session set NLS_TIMESTAMP_TZ_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
$datetime_format = oci_parse($connection, 'alter session set NLS_TIMESTAMP_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
$date_format = oci_parse($connection, 'alter session set NLS_DATE_FORMAT =\'YYYY-MM-DD HH24:MI:SS\'');
$decimal_separator = oci_parse($connection, 'alter session set NLS_NUMERIC_CHARACTERS =\',.\'');
oci_execute($datetime_tz_format);
oci_execute($datetime_format);
oci_execute($date_format);
oci_execute($decimal_separator);
oci_free_statement($datetime_tz_format);
oci_free_statement($datetime_format);
oci_free_statement($date_format);
oci_free_statement($decimal_separator);
foreach ($file_content as $sql_line) {
$clean_line = trim($sql_line);
$comment = preg_match("/^(\s|\t)*--.*$/", $clean_line);
if ($comment) {
continue;
}
if (empty($clean_line)) {
continue;
}
//Support for PL/SQL blocks
if (preg_match("/^BEGIN$/", $clean_line)) {
$query .= $clean_line . ' ';
$plsql_block = true;
}
else {
$query .= $clean_line;
}
//Check query's end with a back slash and any returns in the end of line or if it's a PL/SQL block 'END;;' string
if ((preg_match("/;[\040]*\$/", $clean_line) && !$plsql_block) ||
(preg_match("/^END;;[\040]*\$/", $clean_line) && $plsql_block)) {
$plsql_block = false;
//Execute and clean buffer
//Delete the last semicolon from current query
$query = substr($query, 0, strlen($query) - 1);
$sql = oci_parse($connection, $query);
$result = oci_execute($sql);
if ($debug) {
var_dump($query);
}
if (!$result) {
$e = oci_error($sql);
echo "<tr><td><div class='warn'>Errors creating schema:</div><div style=\"overflow:auto; height:50px;\" >";
echo htmlentities($e['message'], ENT_QUOTES);
echo "<i><br>$query<br></i>";
echo "</div></td></tr>";
return 0;
}
$query = "";
oci_free_statement($sql);
}
}
return 1;
}
else {
return 0;
}
}
function oracle_drop_all_objects ($connection) {
//Drop all objects of the current installation
$stmt = oci_parse($connection,
"BEGIN " .
"FOR cur_rec IN (SELECT object_name, object_type " .
"FROM user_objects " .
"WHERE object_type IN ('TABLE', 'VIEW', 'PACKAGE', 'PROCEDURE', 'FUNCTION', 'SEQUENCE', 'SNAPSHOT', 'MATERIALIZED VIEW')) LOOP " .
"BEGIN " .
"IF cur_rec.object_type = 'TABLE' THEN " .
"EXECUTE IMMEDIATE 'DROP ' || cur_rec.object_type || ' \"' || cur_rec.object_name || '\" CASCADE CONSTRAINTS'; " .
"ELSE " .
"EXECUTE IMMEDIATE 'DROP ' || cur_rec.object_type || ' \"' || cur_rec.object_name || '\"'; " .
"END IF; " .
"EXCEPTION " .
"WHEN OTHERS THEN " .
"DBMS_OUTPUT.put_line('FAILED: DROP ' || cur_rec.object_type || ' \"' || cur_rec.object_name || '\"'); " .
"END; " .
"END LOOP; " .
"END; ");
$result = oci_execute($stmt);
oci_free_statement($stmt);
return 0;
}
function random_name ($size) {
$temp = "";
for ($a=0;$a< $size;$a++)
@ -423,16 +280,19 @@ function random_name ($size) {
function print_logo_status ($step, $step_total) {
global $banner;
return "
<div id='logo_img'>
<div>
<img src='images/pandora_tinylogo_open.png' border='0'><br>
<span style='font-size: 9px;'>$banner</span>
</div>
<div class='installation_step'>
<b>Install step $step of $step_total</b>
$header = "
<div id='logo_img' style='width: 100%;'>
<div style='width:100%; background-color:#333333;'>
<img src='images/logo_opensource.png' border='0'><br>
<span style='font-size: 9px;'>$banner</span>
</div>
</div>";
$header .= "
<div class='installation_step'>
<b>Install step $step of $step_total</b>
</div>";
return $header;
}
//
@ -515,14 +375,17 @@ function install_step1() {
If you want to upgrade from Pandora FMS 4.x to 5.0 version, please use the migration tool inside /extras directory in this setup.
</div>";
echo "<br>";
if ($writable == 0) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step11' href='install.php?step=11'><button type='submit' class='btn_install_next'>Next</button></a>";
echo "</div>";
echo "<a id='step11' href='install.php?step=11'><img align='right' style='margin-top: 20px;' src='images/arrow_next.png' border='0'></a>";
}
else {
echo "<div class='err'><b>ERROR:</b>You need to setup permissions to be able to write in ./include directory</div>";
echo "</div>";
}
echo "</div>";
echo "<div style='clear:both;'></div>";
echo "
@ -556,7 +419,7 @@ function install_step1_licence() {
echo file_get_contents ("COPYING");
echo "</textarea>";
echo "<p>";
echo "<div style='text-align: right;'><input type=submit value='Yes, I accept licence terms'></div>";
echo "<div style='text-align: right;'><button id='btn_accept' class='btn_install_next' type='submit'>Yes, I accept licence terms</button></div>";
}
echo "</div>";
@ -612,8 +475,6 @@ function install_step2() {
echo "</td></tr>";
check_extension("mysql", "PHP MySQL extension");
check_extension("mysqli", "PHP MySQL(mysqli) extension");
check_extension("pgsql", "PHP PostgreSQL extension");
check_extension("oci8", "PHP Oracle extension");
echo "</table>";
if ($res > 0) {
@ -628,17 +489,18 @@ function install_step2() {
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 style='text-align:right; width:100%;'>
Ignore it. <a id='step3' href='install.php?step=3' style='font-weight: bolder;'><button class='btn_install_next' type='submit'>Force install Step #3</button></a>
</div>";
echo "</div>";
}
else {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step3' href='install.php?step=3'>
<button class='btn_install_next' type='submit'>Next</button></a>";
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>";
}
echo "</div>";
echo "<div style='clear: both;'><!-- --></div>";
echo "
</div>
<div style='clear: both;'><!-- --></div>
@ -659,12 +521,6 @@ function install_step3() {
if (extension_loaded("mysqli")) {
$options .= "<option value='mysqli'>MySQL(mysqli)</option>";
}
if (extension_loaded("pgsql")) {
$options .= "<option value='pgsql'>PostgreSQL</option>";
}
if (extension_loaded("oci8")) {
$options .= "<option value='oracle'>Oracle</option>";
}
$error = false;
if (empty($options)) {
@ -778,13 +634,15 @@ function install_step3() {
</table>
";
if (!$error) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step4' href='install.php?step=4'>
<button class='btn_install_next' type='submit'>Next</button></a>";
echo "</div>";
}
echo "</div>";
if (!$error) {
echo "<input type='image' src='images/arrow_next.png' value='Step #4' id='step4'>";
}
echo "</form>";
echo "<div style='clear:both;'></div>";
@ -1034,296 +892,14 @@ function install_step4() {
$everything_ok = 1;
}
break;
case 'oracle':
$connection = oci_connect($dbuser, $dbpassword, '//' . $dbhost . '/' . $dbname);
if (!$connection) {
check_generic(0, "Connection with Database");
}
else {
check_generic(1, "Connection with Database");
// Drop all objects if needed
if ($dbdrop == 1) {
oracle_drop_all_objects($connection);
}
$step1 = parse_oracle_dump($connection, "pandoradb.oracle.sql");
check_generic($step1, "Creating schema");
if ($step1) {
$step2 = parse_oracle_dump($connection, "pandoradb.data.oracle.sql");
}
check_generic ($step2, "Populating database");
if (PHP_OS == "FreeBSD")
{
$step_freebsd = adjust_paths_for_freebsd ($engine, $connection);
check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD");
}
echo "<tr><td><div class='warn'>Please, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file and set database password.</div></tr></td>";
if ($step2) {
$step3 = is_writable("include");
}
check_generic ($step3, "Write permissions to save config file in './include'");
if ($step3) {
$cfgin = fopen ("include/config.inc.php","r");
$cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'oracle';
$config_new = '<?php
// Begin of automatic config file
$config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql, oracle)
$config["dbname"]="' . $dbname . '"; // Oracle DataBase name
$config["dbuser"]="' . $dbuser . '"; // DB User
$config["dbpass"]="' . $dbpassword . '"; // DB Password
$config["dbhost"]="' . $dbhost . '"; // DB Host
$config["homedir"]="' . $path . '"; // Config homedir
/*
----------Attention--------------------
Please note that in certain installations:
- reverse proxy.
- web server in other ports.
- https
This variable might be dynamically altered.
But it is save as backup in the
$config["homeurl_static"]
for expecial cases.
----------Attention--------------------
*/
$config["homeurl"]="' . $url . '"; // Base URL
$config["homeurl_static"]="'.$url.'"; // Don\'t delete
// End of automatic config file
?>';
$step4 = fputs ($cfgout, $config_new);
$step4 = $step4 + fputs ($cfgout, $config_contents);
if ($step4 > 0)
$step4 = 1;
fclose ($cfgin);
fclose ($cfgout);
chmod ($pandora_config, 0600);
}
check_generic ($step4, "Created new config file at '" . $pandora_config . "'");
if (($step4 + $step3 + $step2 + $step1) == 4) {
$everything_ok = 1;
}
}
break;
case 'pgsql':
$step1 = $step2 = $step3 = $step4 = $step5 = $step6 = $step7 = 0;
$connection = pg_connect("host='" . $dbhost . "' dbname='postgres' user='" . $dbuser . "' password='" . $dbpassword . "'");
if ($connection === false) {
check_generic(0, "Connection with Database");
}
else {
check_generic(1, "Connection with Database");
// Drop database if needed
if ($dbdrop == 1 && $dbaction == 'db_exist') {
$result = pg_query($connection, "DROP DATABASE \"" . $dbname . "\";");
}
if ($dbaction != 'db_exist' || $dbdrop == 1) {
pg_send_query($connection, "CREATE DATABASE \"" . $dbname . "\" WITH ENCODING 'utf8';");
$result = pg_get_result($connection);
if (pg_result_status($result) != PGSQL_FATAL_ERROR) {
$step1 = 1;
}
check_generic ($step1, "Creating database '$dbname'");
}
else {
$step1 = 1;
}
check_generic ($step1, "Creating database '$dbname'");
if ($step1 == 1) {
//Reopen DB because I don't know how to use DB in PostgreSQL
pg_close($connection);
$connection = pg_connect("host='" . $dbhost . "' dbname='" . $dbname .
"' user='" . $dbuser . "' password='" . $dbpassword . "'");
if ($connection !== false) {
$step2 = 1;
}
}
check_generic ($step2, "Opening database '$dbname'");
if ($step2) {
$step3 = parse_postgresql_dump($connection, "pandoradb.postgreSQL.sql");
}
check_generic($step3, "Creating schema");
if ($step3) {
$step4 = parse_postgresql_dump($connection, "pandoradb.data.postgreSQL.sql");
}
check_generic ($step4, "Populating database");
if (PHP_OS == "FreeBSD") {
$step_freebsd = adjust_paths_for_freebsd ($engine, $connection);
check_generic ($step_freebsd, "Adjusting paths in database for FreeBSD");
}
if ($step4) {
$random_password = random_name (8);
pg_query($connection, "DROP USER pandora");
pg_send_query($connection, "CREATE USER pandora WITH PASSWORD '" . $random_password . "'");
$result = pg_get_result($connection);
if (pg_result_status($result) != PGSQL_FATAL_ERROR) {
//Set the privileges for DB
pg_send_query($connection, "GRANT ALL PRIVILEGES ON DATABASE pandora TO pandora;");
$result = pg_get_result($connection);
$setDBPrivileges = 0;
if (pg_result_status($result) != PGSQL_FATAL_ERROR) {
$setDBPrivileges = 1;
}
if ($setDBPrivileges) {
//Set the privileges for each tables.
pg_send_query($connection, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';");
$result = pg_get_result($connection);
$tables = array();
while ($row = pg_fetch_assoc($result)) {
$tables[] = $row['table_name'];
}
$correct = 1;
foreach ($tables as $table) {
pg_send_query($connection, "GRANT ALL PRIVILEGES ON TABLE " . $table . " TO pandora;");
$result = pg_get_result($connection);
if (pg_result_status($result) == PGSQL_FATAL_ERROR) {
$correct = 0;
break;
}
//For each table make owner pandora
pg_send_query($connection, "ALTER TABLE " . $table . " OWNER TO pandora;");
$result = pg_get_result($connection);
if (pg_result_status($result) == PGSQL_FATAL_ERROR) {
$correct = 0;
break;
}
//INI ----- Grant for secuences
pg_send_query($connection, "SELECT column_name FROM information_schema.columns WHERE table_name = '" . $table . "';");
$result2 = pg_get_result($connection);
$columns = array();
while ($row = pg_fetch_assoc($result2)) {
$columns[] = $row['column_name'];
}
//Check for each column if it have a sequence to grant
foreach ($columns as $column) {
pg_send_query($connection, "SELECT pg_get_serial_sequence('" . $table . "', '" . $column . "');");
$result3 = pg_get_result($connection);
$sequence = pg_fetch_assoc($result3);
if (!empty($sequence['pg_get_serial_sequence'])) {
pg_send_query($connection, "GRANT ALL PRIVILEGES ON SEQUENCE " . $sequence['pg_get_serial_sequence'] . " to pandora;");
$result4 = pg_get_result($connection);
if (pg_result_status($result4) == PGSQL_FATAL_ERROR) {
$correct = 0;
break;
}
}
}
//END ----- Grant for secuences
}
if ($correct) {
$step5 = 1;
}
}
}
}
check_generic ($step5, "Established privileges for user pandora. A new random password has been generated: <b>$random_password</b><div class='warn'>Please write it down, you will need to setup your Pandora FMS server, editing the </i>/etc/pandora/pandora_server.conf</i> file</div>");
if ($step5) {
$step6 = is_writable("include");
}
check_generic ($step6, "Write permissions to save config file in './include'");
if ($step6) {
$cfgin = fopen ("include/config.inc.php","r");
$cfgout = fopen ($pandora_config,"w");
$config_contents = fread ($cfgin, filesize("include/config.inc.php"));
$dbtype = 'postgresql';
$config_new = '<?php
// Begin of automatic config file
$config["dbtype"] = "' . $dbtype . '"; //DB type (mysql, postgresql...in future others)
$config["dbname"]="'.$dbname.'"; // MySQL DataBase name
$config["dbuser"]="pandora"; // DB User
$config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir
/*
----------Attention--------------------
Please note that in certain installations:
- reverse proxy.
- web server in other ports.
- https
This variable might be dynamically altered.
But it is save as backup in the
$config["homeurl_static"]
for expecial cases.
----------Attention--------------------
*/
$config["homeurl"]="'.$url.'"; // Base URL
$config["homeurl_static"]="'.$url.'"; // Don\'t delete
// End of automatic config file
?>';
$step7 = fputs ($cfgout, $config_new);
$step7 = $step7 + fputs ($cfgout, $config_contents);
if ($step7 > 0)
$step7 = 1;
fclose ($cfgin);
fclose ($cfgout);
chmod ($pandora_config, 0600);
}
check_generic ($step7, "Created new config file at '".$pandora_config."'");
if (($step7 + $step6 + $step5 + $step4 + $step3 + $step2 + $step1) == 7) {
$everything_ok = 1;
}
}
break;
}
echo "</table>";
if ($everything_ok == 1) {
echo "<div style='text-align:right; width:100%;'>";
echo "<a id='step5' href='install.php?step=5'>
<button class='btn_install_next' type='submit'>Next</button></a>";
echo "</div>";
echo "<div style='margin-top: 20px;'><a id='step5' href='install.php?step=5'>
<img align='right' src='images/arrow_next.png' border='0' alt=''></a></div>";
}
else {
$info = "<div class='err'><b>There were some problems.
@ -1358,15 +934,10 @@ function install_step4() {
mysqli_query ($connection, "DROP DATABASE $dbname");
}
break;
case 'pgsql':
break;
case 'oracle':
oracle_drop_all_objects($connection);
break;
}
echo "</div>";
}
echo "</div>";
echo "<div style='clear: both;'></div>";
echo "
</div>
@ -1395,10 +966,10 @@ function install_step5() {
for updates.
<p>Select if you want to rename '<i>install.php</i>'.</p>
<form method='post' action='index.php'>
<input type='submit' name='rn_file' value='Yes, rename the file'>
<button class='btn_install_next' type='submit' name='rn_file'>Yes, rename the file</button>
<input type='hidden' name='rename_file' value='1'>
</form>
<p><br><b><a id='access_pandora' href='index.php'>Click here to access to your Pandora FMS console</a>.</b>
<p><br><b><a id='access_pandora' href='index.php'><button class='btn_install_next' type='submit'>Click here to access to your Pandora FMS console</button></a>.</b>
</p>
</div>";

View File

@ -157,19 +157,15 @@ $data_agents = array(
$table->data[1][0] = reporting_get_stats_alerts($data);
$table->data[2][0] = reporting_get_stats_modules_status($data, 180, 100, false, $data_agents);
$table->data[3][0] = reporting_get_stats_agents_monitors($data);
$table->rowclass[] = '';
// ---------------------------------------------------------------------
// Server performance
// ---------------------------------------------------------------------
if ($is_admin) {
$table->data[4][0] = reporting_get_stats_servers(false);
$table->rowclass[] = '';
}
html_print_table($table);
@ -178,7 +174,6 @@ echo '</td>'; //Left column
echo '<td style="vertical-align: top; width: 75%; padding-top: 0px;" id="rightcolumn">';
// ---------------------------------------------------------------------
// Last events information
// ---------------------------------------------------------------------

View File

@ -1155,57 +1155,53 @@ if (isset($ehorus_tab) && !empty($ehorus_tab)) {
//Tabs for extensions
foreach ($config['extensions'] as $extension) {
if (isset($extension['extension_ope_tab'])) {
//VMware extension is only available for VMware OS
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
//Check if OS is vmware
$id_remote_field = db_get_value ("id_field",
"tagent_custom_fields", "name", "vmware_type");
$vmware_type = db_get_value_filter("description",
"tagent_custom_data",
array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
if ($vmware_type != "vm") {
continue;
if (check_acl($config['id_user'], $id_grupo, $extension['extension_ope_tab']['acl'])) {
//VMware extension is only available for VMware OS
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
//Check if OS is vmware
$id_remote_field = db_get_value ("id_field",
"tagent_custom_fields", "name", "vmware_type");
$vmware_type = db_get_value_filter("description",
"tagent_custom_data",
array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
if ($vmware_type != "vm") {
continue;
}
}
}
//RHEV extension is only available for RHEV Virtual Machines
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
//Get id for remote field "rhev_type"
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
//Get rhev type for this agent
$rhev_type = db_get_value_filter ("description", "tagent_custom_data", array ("id_field" => $id_remote_field, "id_agent" => $agent['id_agente']));
//Check if rhev type is a vm
if ($rhev_type != "vm") {
continue;
//RHEV extension is only available for RHEV Virtual Machines
if ($extension['extension_ope_tab']['id'] === "rhev_manager") {
//Get id for remote field "rhev_type"
$id_remote_field = db_get_value("id_field", "tagent_custom_fields", "name", "rhev_type");
//Get rhev type for this agent
$rhev_type = db_get_value_filter ("description", "tagent_custom_data", array ("id_field" => $id_remote_field, "id_agent" => $agent['id_agente']));
//Check if rhev type is a vm
if ($rhev_type != "vm") {
continue;
}
}
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
}
else {
$active = false;
}
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
$image = $extension['extension_ope_tab']['icon'];
$name = $extension['extension_ope_tab']['name'];
$id = $extension['extension_ope_tab']['id'];
$id_extension = get_parameter('id_extension', '');
if ($id_extension == $id) {
$active = true;
}
else {
$active = false;
}
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=extension&id_agente='.$id_agente . '&id_extension=' . $id;
$extension_tab = array('text' => '<a href="' . $url .'">' . html_print_image ($image, true, array ( "title" => $name)) . '</a>', 'active' => $active);
$onheader = $onheader + array($id => $extension_tab);
}
}

View File

@ -259,6 +259,9 @@ else {
$table->head[$i] = html_print_checkbox ("all_validate_box", "1", false, true);
$table->align[$i] = 'left';
}
else {
$table->head[$i] = '';
}
}
if ($meta) {

View File

@ -69,35 +69,42 @@ echo "<h1 class='modalheaderh1'>" . __("Sound console"). "</h1>";
$table = null;
$table->width = '100%';
$table->class = ' ';
$table->size[0] = '10%';
$table->style[0] = 'font-weight: bold; vertical-align: top;';
$table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->style[2] = 'font-weight: bold; vertical-align: top;';
$table->data[0][0] = __('Group');
$table->data[0][0] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
$table->data[0][0] .= __('Agent');
$table->data[0][0] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','','',false,'','',true);
$table->data[0][1] = __('Type');
$table->data[0][1] .= '<br />' . html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
$table->data[0][1] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
$table->data[1][0] .= __('Agent');
$table->data[1][1] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','','',false,'','',true);
$table->data[0][2] = __('Type');
$table->data[0][3] .= html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' .
html_print_checkbox('unknown', 'unknown', true, true, false, 'changeType();') . __('Monitor unknown') . '<br />' .
html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />';
html_print_table($table);
echo '<br />';
echo '<div style="text-align:center">';
echo '<a href="javascript: toggleButton();">' .
html_print_image("images/play.button.png", true, array("id" => "button")) .
'</a>';
echo '<a href="javascript: ok();">' .
html_print_image("images/ok.button.png", true, array("style" => "margin-left: 15px;")) .
'</a>';
echo '<a href="javascript: test_sound_button();">' .
html_print_image("images/icono_test.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) .
'</a>';
echo '</div>';
echo '<br>';
$table = null;
$table->width = '100%';
$table->class = ' ';
$table->bgcolor = 'white';
$table->data[0][0] = '<a href="javascript: toggleButton();">' .
html_print_image("images/play.button.png", true, array("id" => "button")) .
'</a>';
$table->data[0][1] .= '<a href="javascript: ok();">' .
html_print_image("images/ok.button.png", true, array("style" => "margin-left: 15px;")) .
'</a>';
$table->data[0][2] .= '<a href="javascript: test_sound_button();">' .
html_print_image("images/icono_test.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) .
'</a>';
html_print_table($table);
?>
<script src="../../include/javascript/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
@ -120,7 +127,7 @@ var test_sound = false;
function test_sound_button() {
if (!test_sound) {
$("#button_try").attr('src', '../../images/icono_test_active.png');
$("#button_try").attr('src', '../../images/icono_test.png');
$('body').append("<audio src='../../include/sounds/Star_Trek_emergency_simulation.wav' autoplay='true' hidden='true' loop='false'>");
test_sound = true;
}
@ -273,6 +280,8 @@ function animation() {
$(document).ready (function () {
setInterval("check_event()", (10 * 1000)); //10 seconds between ajax request
setInterval("animation()", (0.1 * 1000));
$("#table1").css("background-color", "#fff");
$("#table2").css("background-color", "#fff");
});
</script>
<?php

View File

@ -215,6 +215,9 @@ if ($enable_init_date) {
$report = reporting_make_reporting_data(null, $id_report, $date, $time,
$period, 'dinamic');
for ($i=0; $i < sizeof($report['contents']); $i++) {
$report['contents'][$i]['description'] = str_replace('&#x0d;&#x0a;','<br/>',$report['contents'][$i]['description']);
}
reporting_html_print_report($report,false,$config['custom_report_info']);

View File

@ -100,7 +100,10 @@ if ($vconsole_write || $vconsole_manage) {
$hash = md5($config["dbpass"] . $id_layout . $config["id_user"]);
$options['public_link']['text'] = '<a href="' . ui_get_full_url('operation/visual_console/public_console.php?hash='.$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]) . '" target="_blank">'.
$options['public_link']['text'] = '<a href="' .
ui_get_full_url('operation/visual_console/public_console.php?hash=' .
$hash.'&id_layout='.$id_layout.'&id_user='.$config["id_user"]) .
'" target="_blank">'.
html_print_image ("images/camera_mc.png", true,
array ("title" => __('Show link to public Visual Console'))).'</a>';
$options['public_link']['active'] = false;
@ -153,7 +156,7 @@ if ($config['pure']) {
. '</div>';
// Floating menu - Start
echo '<div id="vc-controls">';
echo '<div id="vc-controls" style="z-index: 999">';
echo '<div id="menu_tab">';
echo '<ul class="mn">';
@ -234,35 +237,13 @@ $ignored_params['refr'] = '';
url = js_html_entity_decode( href ) + duration;
//$(document).attr ("location", url);
$.get(window.location.href.replace("render_view","pure_ajax"), function(respuestaSolicitud){
$('#background_<?php echo $id_layout; ?>').html(respuestaSolicitud);
$('#background_<?php echo $id_layout; ?>').html(respuestaSolicitud);
startCountDown(refr, false);
});
}
});
}
//~ var fetchMap = function () {
//~ $.ajax({
//~ url: 'ajax.php',
//~ type: 'GET',
//~ dataType: 'html',
//~ data: {
//~ page: 'include/ajax/visual_console.ajax',
//~ render_map: true,
//~ keep_aspect_ratio: true,
//~ id_visual_console: <?php echo $id_layout; ?>,
//~ graph_javascript: <?php echo (int) $graph_javascript; ?>,
//~ width: $(window).width(),
//~ height: $(window).height()
//~ }
//~ })
//~ .done(function (data, textStatus, xhr) {
//~ $('div#vc-container').html(data);
//~ startCountDown(refr, false);
//~ });
//~ }
startCountDown(refr, false);
//~ // Auto hide controls
var controls = document.getElementById('vc-controls');
@ -272,9 +253,6 @@ $ignored_params['refr'] = '';
refr = Number.parseInt(event.target.value, 10);
startCountDown(refr, false);
});
//~ // Start the map fetch
//~ fetchMap();
}
else {
$('#refr').change(function () {
@ -282,77 +260,46 @@ $ignored_params['refr'] = '';
});
}
/*
$(".module_graph").each(function(){
left = parseInt($(this).css("left")) + 150 + ((parseInt($(this).css("width"))-300)/2);
$(this).css('left', left);
});
$('.item:not([class~="module_graph"])').each(function(){
left = parseInt($(this).css('left')) + ((parseInt($('#' + $(this).attr('id')).css('width')) - parseInt($('#' + $(this).attr('id') + " img").css('width')))*0.5);
$(this).css('left', left);
});
*/
$(".module_graph .menu_graph").css('display','none');
$(".parent_graph").each(function(){
if($(this).css('background-color') != 'rgb(255, 255, 255)'){
$(this).css('color', '#999');
}
});
$(".parent_graph").each( function() {
if ($(this).css('background-color') != 'rgb(255, 255, 255)')
$(this).css('color', '#999');
});
$(".overlay").removeClass("overlay").addClass("overlaydisabled");
$('.item:not(.icon) img').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
$(this).css('margin-left','');
$('.item:not(.icon) img').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2)+'px');
$(this).css('margin-left','');
}
else{
else {
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
$('.item > div').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2-15)+'px');
$(this).css('margin-left','');
$('.item > div').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
$(this).css('margin-top',(parseInt($(this).parent().css('height'))/2-parseInt($(this).css('height'))/2-15)+'px');
$(this).css('margin-left','');
}
else{
else {
$(this).css('margin-left',(parseInt($(this).parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
$('.item > a > div').each(function(){
if($(this).css('float')=='left' || $(this).css('float')=='right'){
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2-5)+'px');
$(this).css('margin-left','');
$('.item > a > div').each( function() {
if ($(this).css('float')=='left' || $(this).css('float')=='right') {
$(this).css('margin-top',(parseInt($(this).parent().parent().css('height'))/2-parseInt($(this).css('height'))/2-5)+'px');
$(this).css('margin-left','');
}
else{
else {
$(this).css('margin-left',(parseInt($(this).parent().parent().css('width'))/2-parseInt($(this).css('width'))/2)+'px');
$(this).css('margin-top','');
}
});
$(".graph").each(function(){
@ -380,4 +327,4 @@ $ignored_params['refr'] = '';
*/
});
</script>
</script>

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version NG_BETA
%define release 170303
%define release 170307
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version NG_BETA
%define release 170303
%define release 170307
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -66,7 +66,7 @@ INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
INSERT INTO tconfig (token, value) VALUES('db_scheme_version','NG_BETA');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD170303');
INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD170307');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora');

View File

@ -84,6 +84,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
`update_alert_count` tinyint(1) NOT NULL default '0',
`alias` varchar(600) BINARY NOT NULL default '',
`transactional_agent` tinyint(1) NOT NULL default '0',
`alias_as_name` tinyint(2) NOT NULL default '0',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`),
@ -726,6 +727,7 @@ CREATE TABLE IF NOT EXISTS `trecon_task` (
`parent_recursion` tinyint(1) unsigned default '0',
`disabled` tinyint(1) unsigned NOT NULL DEFAULT '0',
`macros` TEXT,
`alias_as_name` tinyint(2) NOT NULL default '0',
PRIMARY KEY (`id_rt`),
KEY `recon_task_daemon` (`id_recon_server`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -2881,6 +2883,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
`update_alert_count` tinyint(1) NOT NULL default '0',
`transactional_agent` tinyint(1) NOT NULL default '0',
`alias` varchar(600) BINARY NOT NULL default '',
`alias_as_name` tinyint(2) NOT NULL default '0',
PRIMARY KEY (`id_agente`),
KEY `nombre` (`nombre`(255)),
KEY `direccion` (`direccion`),

3
pandora_server/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
Makefile
blib/
pm_to_blib

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: NG_BETA-170303
Version: NG_BETA-170307
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="NG_BETA-170303"
pandora_version="NG_BETA-170307"
package_cpan=0
package_pandora=1

View File

@ -284,18 +284,15 @@ sub pandora_server_tasks ($) {
# TASKS EXECUTED EVERY 5 SECONDS (Low latency tasks)
# --------------------------------------------------
if (($counter % 5) == 0) {
# Update forced alerts
pandora_exec_forced_alerts ($pa_config, $dbh);
# Rotate Log File
pandora_rotate_logfile($pa_config);
}
# TASKS EXECUTED EVERY 30 SECONDS (Mid latency tasks)
# ---------------------------------------------------
if (($counter % 30) == 0) {
# Update module status and fired alert counts
my @agents = get_db_rows ($dbh, 'SELECT id_agente, nombre, update_module_count, update_alert_count FROM tagente WHERE disabled = 0 AND (update_module_count=1 OR update_alert_count=1)');
foreach my $agent (@agents) {
@ -351,26 +348,28 @@ sub pandora_server_tasks ($) {
db_do ($dbh, 'UPDATE tevento SET estado=1, ack_utimestamp=? WHERE estado=0 AND utimestamp < ? AND utimestamp > ?', $time_ref, $expiry_limit, $expiry_window);
}
}
# Pandora self monitoring
if (defined($pa_config->{"self_monitoring"})
&& $pa_config->{"self_monitoring"} == 1
&& $counter % $pa_config->{'self_monitoring_interval'} == 0) {
pandora_self_monitoring ($pa_config, $dbh);
}
# Avoid counter overflow
if ($counter > 10000){
$counter = 0;
}
else {
$counter++;
}
}
# COMMON TASKS (master and non-master)
# ---------------------------------------------------------------
# Rotate Log File
if (($counter % 30) == 0) {
pandora_rotate_logfile($pa_config);
}
# Pandora self monitoring
if (defined($pa_config->{"self_monitoring"})
&& $pa_config->{"self_monitoring"} == 1
&& $counter % $pa_config->{'self_monitoring_interval'} == 0) {
pandora_self_monitoring ($pa_config, $dbh);
}
# Avoid counter overflow
if ($counter > 10000){
$counter = 0;
}
else {
# Do an additional sleep if we are not the master server
sleep ($pa_config->{'server_threshold'});
$counter++;
}
};

View File

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

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version NG_BETA
%define release 170303
%define release 170307
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version NG_BETA
%define release 170303
%define release 170307
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="NG_BETA"
PI_BUILD="170303"
PI_BUILD="170307"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "NG_BETA PS170303";
my $version = "NG_BETA PS170307";
# Pandora server configuration
my %conf;

View File

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

View File

@ -16,17 +16,17 @@ browser.get('http://localhost/pandora_console/install.php')
assert("Pandora FMS - Installation Wizard" in browser.title)
# Accept the license agreement.
browser.find_element_by_xpath("//*[@id='step11']/img").click()
browser.find_element_by_xpath("//*[@id='install_box']/form/div/input").click()
browser.find_element_by_xpath("//*[@id='step11']").click()
browser.find_element_by_xpath("//*[@id='btn_accept']").click()
# Fill-in the configuration form.
browser.find_element_by_xpath("//*[@id='step3']/img").click()
browser.find_element_by_xpath("//*[@id='step3']").click()
browser.find_element_by_name("pass").send_keys("pandora")
browser.find_element_by_id("step4").click()
browser.find_element_by_xpath("//*[@id='step4']").click()
# Complete the installation.
browser.implicitly_wait(300) # The installation is going to take a long time.
browser.find_element_by_xpath("//*[@id='step5']/img").click()
browser.find_element_by_xpath("//*[@id='step5']").click()
browser.implicitly_wait(5)
assert("Installation complete" in browser.page_source)
browser.find_element_by_name("rn_file").click()