Merge branch 'develop' into 1134-url-routes-analyzer-feature-dev
This commit is contained in:
commit
8cd7b3205b
|
@ -58,6 +58,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# Server password (Tentacle or FTP). Leave empty for no password (default).
|
||||
# server_pwd mypassword
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.712-170919
|
||||
Version: 7.0NG.712-170928
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.712-170919"
|
||||
pandora_version="7.0NG.712-170928"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -88,6 +88,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# Server password (Tentacle or FTP). Leave empty for no password (default).
|
||||
#server_pwd mypassword
|
||||
|
||||
|
|
|
@ -98,6 +98,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# timeout in seconds for file transfer programs execution (30 by default)
|
||||
#transfer_timeout 30
|
||||
|
||||
|
|
|
@ -60,6 +60,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# Server password (Tentacle or FTP). Leave empty for no password (default).
|
||||
# server_pwd mypassword
|
||||
|
||||
|
|
|
@ -104,6 +104,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# timeout in seconds for file transfer programs execution (30 by default)
|
||||
#transfer_timeout 30
|
||||
|
||||
|
|
|
@ -66,6 +66,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# timeout in seconds for file transfer programs execution (30 by default)
|
||||
#transfer_timeout 30
|
||||
|
||||
|
|
|
@ -60,6 +60,9 @@ server_port 41121
|
|||
# Transfer mode: tentacle, ftp, ssh or local
|
||||
transfer_mode tentacle
|
||||
|
||||
# Transfer mode user: Owner of files copied on local transfer mode (default apache)
|
||||
#transfer_mode_user apache
|
||||
|
||||
# timeout in seconds for file transfer programs execution (30 by default)
|
||||
#transfer_timeout 30
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.712';
|
||||
use constant AGENT_BUILD => '170919';
|
||||
use constant AGENT_BUILD => '170928';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -128,6 +128,9 @@ my @BrokerPid;
|
|||
my %DefaultConf = (
|
||||
'server_ip' => 'localhost',
|
||||
'server_path' => '/var/spool/pandora/data_in',
|
||||
'server_path_md5' => 'md5', #undocumented
|
||||
'server_path_conf' => 'conf', #undocumented
|
||||
'server_path_zip' => 'collections', #undocumented
|
||||
'logfile' =>'/var/log/pandora/pandora_agent.log',
|
||||
'logsize' => DEFAULT_MAX_LOG_SIZE,
|
||||
'logrotate' => DEFAULT_LOG_ROTATE,
|
||||
|
@ -146,6 +149,7 @@ my %DefaultConf = (
|
|||
'encoding' => 'UTF-8',
|
||||
'server_port' => 41121,
|
||||
'transfer_mode' => 'tentacle',
|
||||
'transfer_mode_user' => 'apache',
|
||||
'transfer_timeout' => 30,
|
||||
'server_user' => 'pandora',
|
||||
'server_pwd' => '',
|
||||
|
@ -906,13 +910,17 @@ sub fix_directory ($) {
|
|||
################################################################################
|
||||
# Sends a file to the server.
|
||||
################################################################################
|
||||
#sub send_file ($;$$$) {
|
||||
sub send_file {
|
||||
my ($file, $secondary, $rc_primary, $flag_always) = @_;
|
||||
my ($file, $secondary, $rc_primary, $flag_always, $relative) = @_;
|
||||
|
||||
my $output;
|
||||
my $pid = fork();
|
||||
return 1 unless defined $pid;
|
||||
|
||||
# Fix remote dir to some transfer mode
|
||||
my $remote_dir = $Conf{'server_path'} . "/";
|
||||
$remote_dir .= fix_directory($relative) . '/' if defined($relative);
|
||||
|
||||
if ($pid == 0) {
|
||||
# execute the transfer program by child process.
|
||||
eval {
|
||||
|
@ -935,7 +943,7 @@ sub send_file {
|
|||
quit
|
||||
FEOF1`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'local') {
|
||||
$output = `cp "$file" "$Conf{'server_path'}/" 2>&1 >$DevNull`;
|
||||
$output = `cp -p "$file" "$remote_dir" 2>&1 >$DevNull`;
|
||||
}
|
||||
alarm (0);
|
||||
};
|
||||
|
@ -966,7 +974,7 @@ sub send_file {
|
|||
$rc_primary = 1;
|
||||
}
|
||||
swap_servers ();
|
||||
$rc = send_file ($file, undef, $rc_primary);
|
||||
$rc = send_file ($file, undef, $rc_primary, undef, $relative);
|
||||
swap_servers ();
|
||||
|
||||
return $rc;
|
||||
|
@ -1024,7 +1032,7 @@ sub send_file {
|
|||
return $rc unless ($Conf{'secondary_mode'} eq 'always' || ($Conf{'secondary_mode'} eq 'on_error' && $rc != 0));
|
||||
|
||||
swap_servers ();
|
||||
$rc = send_file ($file);
|
||||
$rc = send_file ($file, undef, undef, undef, $relative);
|
||||
swap_servers ();
|
||||
return $rc;
|
||||
}
|
||||
|
@ -1075,12 +1083,16 @@ sub swap_servers () {
|
|||
################################################################################
|
||||
# Receive a file from the server.
|
||||
################################################################################
|
||||
sub recv_file ($) {
|
||||
my $file = shift;
|
||||
sub recv_file {
|
||||
my ($file, $relative) = @_;
|
||||
my $output;
|
||||
|
||||
my $pid = fork();
|
||||
return 1 unless defined $pid;
|
||||
return 1 unless defined $pid;
|
||||
|
||||
# Fix remote dir to some transfer mode
|
||||
my $remote_dir = $Conf{'server_path'};
|
||||
$remote_dir .= "/" . fix_directory($relative) if defined($relative);
|
||||
|
||||
if ($pid == 0) {
|
||||
# execute the transfer program by child process.
|
||||
|
@ -1104,7 +1116,7 @@ sub recv_file ($) {
|
|||
quit
|
||||
FEOF1`
|
||||
} elsif ($Conf{'transfer_mode'} eq 'local') {
|
||||
$output = `cp $Conf{'server_path'}/$file $Conf{'temporal'} 2>&1 >$DevNull`;
|
||||
$output = `cp "$remote_dir/$file" $Conf{'temporal'} 2>&1 >$DevNull`;
|
||||
}
|
||||
alarm (0);
|
||||
};
|
||||
|
@ -1148,14 +1160,19 @@ sub check_remote_config () {
|
|||
}
|
||||
|
||||
# Get the remote MD5 file
|
||||
if (recv_file ($RemoteMD5File) != 0) {
|
||||
if (recv_file ($RemoteMD5File, $Conf{'server_path_md5'}) != 0) {
|
||||
log_message ('remote config', 'Uploading configuration for the first time.');
|
||||
open (MD5_FILE, "> $Conf{'temporal'}/$RemoteMD5File") || error ("Could not open file '$ConfDir/$RemoteMD5File' for writing: $!.");
|
||||
print MD5_FILE $conf_md5;
|
||||
close (MD5_FILE);
|
||||
copy ("$ConfDir/$ConfFile", "$Conf{'temporal'}/$RemoteConfFile");
|
||||
send_file ("$Conf{'temporal'}/$RemoteConfFile");
|
||||
send_file ("$Conf{'temporal'}/$RemoteMD5File");
|
||||
log_message ('remote config', 'Uploading configuration for the first time.');
|
||||
if ($Conf{'transfer_mode'} eq 'local') {
|
||||
my (undef, undef, $uid, $gid) = getpwnam($Conf{'transfer_mode_user'});
|
||||
chown ($uid, $gid, "$Conf{'temporal'}/$RemoteMD5File");
|
||||
chown ($uid, $gid, "$Conf{'temporal'}/$RemoteConfFile");
|
||||
}
|
||||
send_file ("$Conf{'temporal'}/$RemoteConfFile", undef, undef, undef, $Conf{'server_path_conf'});
|
||||
send_file ("$Conf{'temporal'}/$RemoteMD5File", undef, undef, undef, $Conf{'server_path_md5'});
|
||||
unlink ("$Conf{'temporal'}/$RemoteConfFile");
|
||||
unlink ("$Conf{'temporal'}/$RemoteMD5File");
|
||||
return;
|
||||
|
@ -1169,7 +1186,7 @@ sub check_remote_config () {
|
|||
return if ($remote_conf_md5 eq $conf_md5);
|
||||
|
||||
# Get the new configuration file
|
||||
return if (recv_file ($RemoteConfFile) != 0);
|
||||
return if (recv_file ($RemoteConfFile, $Conf{'server_path_conf'}) != 0);
|
||||
log_message ('remote config', 'Configuration has changed!');
|
||||
|
||||
# Save the new configuration
|
||||
|
@ -1255,7 +1272,7 @@ sub check_collections () {
|
|||
|
||||
# Get remote md5
|
||||
error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file"));
|
||||
next unless (recv_file ($collection_md5_file) == 0);
|
||||
next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0);
|
||||
open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!.");
|
||||
my $remote_collection_md5 = <MD5_FILE>;
|
||||
close (MD5_FILE);
|
||||
|
@ -1273,7 +1290,7 @@ sub check_collections () {
|
|||
next if ($local_collection_md5 eq $remote_collection_md5);
|
||||
|
||||
# Download and unzip
|
||||
next unless (recv_file ($collection_file) == 0);
|
||||
next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0);
|
||||
rmrf ("$ConfDir/collections/$collection");
|
||||
`unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`;
|
||||
unlink ("$Conf{'temporal'}/$collection_file");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.712
|
||||
%define release 170919
|
||||
%define release 170928
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.712
|
||||
%define release 170919
|
||||
%define release 170928
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.712"
|
||||
PI_BUILD="170919"
|
||||
PI_BUILD="170928"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{170919}
|
||||
{170928}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.712(Build 170919)")
|
||||
#define PANDORA_VERSION ("7.0NG.712(Build 170928)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.712(Build 170919))"
|
||||
VALUE "ProductVersion", "(7.0NG.712(Build 170928))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.712-170919
|
||||
Version: 7.0NG.712-170928
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.712-170919"
|
||||
pandora_version="7.0NG.712-170928"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -184,7 +184,7 @@ function extension_db_check_tables_differences($connection_test,
|
|||
ui_print_result_message(
|
||||
empty($diff_tables),
|
||||
__('Successful the DB Pandora has all tables'),
|
||||
__('Unsuccessful the DB Pandora has not all tables. The tables lost are (%s)',
|
||||
__('Unsuccessful the DB Pandora has not all tables. The missing tables are (%s)',
|
||||
implode(", ", $diff_tables)));
|
||||
|
||||
if (!empty($diff_tables)) {
|
||||
|
@ -233,16 +233,15 @@ function extension_db_check_tables_differences($connection_test,
|
|||
if (!empty($result)) {
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$fields_system[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
|
||||
foreach ($fields_test as $name_field => $field_test) {
|
||||
if (!isset($fields_system[$name_field])) {
|
||||
$correct_fields = false;
|
||||
|
@ -262,7 +261,6 @@ function extension_db_check_tables_differences($connection_test,
|
|||
$field_system = $fields_system[$name_field];
|
||||
|
||||
$diff = array_diff($field_test, $field_system);
|
||||
|
||||
if (!empty($diff)) {
|
||||
foreach ($diff as $config_field => $value) {
|
||||
switch ($config_field) {
|
||||
|
@ -279,13 +277,14 @@ function extension_db_check_tables_differences($connection_test,
|
|||
break;
|
||||
case 'null':
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
|
||||
__('Unsuccessful the field %s in the table %s must be null: (%s).',
|
||||
$name_field, $table, $value));
|
||||
if ($value == "no") {
|
||||
|
||||
if ($value == "YES") {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . "INT NULL;" .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NULL;" .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
|
@ -293,7 +292,7 @@ function extension_db_check_tables_differences($connection_test,
|
|||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . "INT NOT NULL;" .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
|
@ -307,11 +306,21 @@ function extension_db_check_tables_differences($connection_test,
|
|||
__('Please check the SQL file for to know the kind of key needed.'));
|
||||
break;
|
||||
case 'default':
|
||||
if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){
|
||||
$null_defect = " NULL";
|
||||
}
|
||||
else{
|
||||
$null_defect = " NOT NULL";
|
||||
}
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
|
||||
__('Unsuccessful the field %s in the table %s must be setted %s as default value.',
|
||||
$name_field, $table, $value));
|
||||
ui_print_info_message(
|
||||
__('Please check the SQL file for to know the kind of default value needed.'));
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
|
||||
'</pre>'
|
||||
);
|
||||
break;
|
||||
case 'extra':
|
||||
ui_print_error_message(
|
||||
|
|
|
@ -793,7 +793,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
WHERE id_group = ".$group_old);
|
||||
|
||||
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
|
||||
if ($result === false) {
|
||||
if ($result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent'));
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ if (is_ajax ()) {
|
|||
|
||||
$get_group_json = (bool) get_parameter ('get_group_json');
|
||||
$get_group_agents = (bool) get_parameter ('get_group_agents');
|
||||
$get_is_disabled = (bool) get_parameter ('get_is_disabled');
|
||||
|
||||
if ($get_group_json) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
|
@ -70,6 +71,7 @@ if (is_ajax ()) {
|
|||
$search = (string) get_parameter ('search', '');
|
||||
$recursion = (int) get_parameter ('recursion', 0);
|
||||
$privilege = (string) get_parameter ('privilege', '');
|
||||
$all_agents = (int) get_parameter ('all_agents', 0);
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||
// This attr is for the operation "bulk alert accions add", it controls the query that take the agents
|
||||
|
@ -96,7 +98,12 @@ if (is_ajax ()) {
|
|||
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
|
||||
}
|
||||
|
||||
$filter['disabled'] = $disabled;
|
||||
if ($all_agents) {
|
||||
$filter['all_agents'] = true;
|
||||
}
|
||||
else {
|
||||
$filter['disabled'] = $disabled;
|
||||
}
|
||||
|
||||
if ($search != '') {
|
||||
$filter['string'] = $search;
|
||||
|
@ -126,18 +133,43 @@ if (is_ajax ()) {
|
|||
false, $recursion, false, '|', $add_alert_bulk_op);
|
||||
}
|
||||
|
||||
$agents_disabled = array();
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
foreach($agents as $k => $v) {
|
||||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
if ($all_agents) {
|
||||
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $k));
|
||||
$agents_disabled[$keys_prefix . $k] = $agent_disabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($all_agents) {
|
||||
$all_agents_array = array();
|
||||
$all_agents_array['agents'] = $agents;
|
||||
$all_agents_array['agents_disabled'] = $agents_disabled;
|
||||
|
||||
$agents = $all_agents_array;
|
||||
}
|
||||
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_is_disabled) {
|
||||
$index = get_parameter('id_agent');
|
||||
|
||||
$agent_disabled = db_get_value_filter('disabled', 'tagente', array('id_agente' => $index));
|
||||
|
||||
$return['disabled'] = $agent_disabled;
|
||||
$return['id_agent'] = $index;
|
||||
|
||||
echo json_encode($return);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ $inventory_modules = array();
|
|||
$date = null;
|
||||
// Only avg is selected by default for the simple graphs
|
||||
$only_avg = true;
|
||||
$fullscale = false;
|
||||
$percentil = false;
|
||||
$time_compare_overlapped = false;
|
||||
|
||||
|
@ -212,6 +213,7 @@ switch ($action) {
|
|||
break;
|
||||
case 'simple_graph':
|
||||
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
|
||||
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
|
||||
$percentil = isset($style['percentil']) ? $config['percentil'] : 0;
|
||||
// The break hasn't be forgotten.
|
||||
case 'simple_baseline_graph':
|
||||
|
@ -480,6 +482,7 @@ switch ($action) {
|
|||
$description = $item['description'];
|
||||
$group = $item['id_group'];
|
||||
$period = $item['period'];
|
||||
$fullscale = isset($style['fullscale']) ? (bool) $style['fullscale'] : 0;
|
||||
break;
|
||||
case 'top_n':
|
||||
$description = $item['description'];
|
||||
|
@ -1353,6 +1356,11 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="font-weight:bold;"><?php echo __('Only average');?></td>
|
||||
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
|
||||
</tr>
|
||||
<tr id="row_fullscale" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Full resolution graph (TIP)').
|
||||
ui_print_help_tip(__('This option may cause performance issues.'), true);?></td>
|
||||
<td><?php html_print_checkbox('fullscale', 1, $fullscale);?></td>
|
||||
</tr>
|
||||
<tr id="row_percentil" style="" class="datos">
|
||||
<td style="font-weight:bold;"><?php echo __('Percentil');?></td>
|
||||
<td><?php html_print_checkbox('percentil', 1, $percentil);?></td>
|
||||
|
@ -2643,6 +2651,7 @@ function chooseType() {
|
|||
$("#row_show_graph").hide();
|
||||
$("#row_max_min_avg").hide();
|
||||
$("#row_only_avg").hide();
|
||||
$("#row_fullscale").hide();
|
||||
$("#row_time_compare_overlapped").hide();
|
||||
$("#row_quantity").hide();
|
||||
$("#row_exception_condition_value").hide();
|
||||
|
@ -2725,6 +2734,7 @@ function chooseType() {
|
|||
case 'simple_graph':
|
||||
$("#row_time_compare_overlapped").show();
|
||||
$("#row_only_avg").show();
|
||||
$("#row_fullscale").show();
|
||||
if ($("#checkbox-percentil").prop("checked"))
|
||||
$("#row_percentil").show();
|
||||
// The break hasn't be forgotten, this element
|
||||
|
@ -3122,6 +3132,7 @@ function chooseType() {
|
|||
$("#row_description").show();
|
||||
$("#row_period").show();
|
||||
$("#row_historical_db_check").hide();
|
||||
$("#row_fullscale").show();
|
||||
break;
|
||||
|
||||
case 'top_n':
|
||||
|
|
|
@ -1172,13 +1172,17 @@ switch ($action) {
|
|||
case 'simple_graph':
|
||||
// Warning. We are using this column to hold this value to avoid
|
||||
// the modification of the database for compatibility reasons.
|
||||
$style['only_avg'] = (int) get_parameter('only_avg');
|
||||
$style['only_avg'] = (int) get_parameter('only_avg');
|
||||
$style['percentil'] = (int) get_parameter('percentil');
|
||||
$style['fullscale'] = (int) get_parameter('fullscale');
|
||||
if ($label != '')
|
||||
$style['label'] = $label;
|
||||
else
|
||||
$style['label'] = '';
|
||||
break;
|
||||
case 'network_interfaces_report':
|
||||
$style['fullscale'] = (int) get_parameter('fullscale');
|
||||
break;
|
||||
case 'module_histogram_graph':
|
||||
case 'agent_configuration':
|
||||
case 'alert_report_agent':
|
||||
|
@ -1516,13 +1520,17 @@ switch ($action) {
|
|||
case 'simple_graph':
|
||||
// Warning. We are using this column to hold this value to avoid
|
||||
// the modification of the database for compatibility reasons.
|
||||
$style['only_avg'] = (int) get_parameter('only_avg');
|
||||
$style['only_avg'] = (int) get_parameter('only_avg');
|
||||
$style['percentil'] = (int) get_parameter('percentil');
|
||||
$style['fullscale'] = (int) get_parameter('fullscale');
|
||||
if ($label != '')
|
||||
$style['label'] = $label;
|
||||
else
|
||||
$style['label'] = '';
|
||||
break;
|
||||
case 'network_interfaces_report':
|
||||
$style['fullscale'] = (int) get_parameter('fullscale');
|
||||
break;
|
||||
case 'module_histogram_graph':
|
||||
case 'agent_configuration':
|
||||
case 'alert_report_agent':
|
||||
|
|
|
@ -645,15 +645,27 @@ function ldap_process_user_login ($login, $password) {
|
|||
}
|
||||
}
|
||||
|
||||
$ldap_login_attr = isset($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
|
||||
$ldap_base_dn = isset($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
$ldap_login_attr = !empty($config["ldap_login_attr"]) ? io_safe_output($config["ldap_login_attr"]) . "=" : '';
|
||||
|
||||
if (strlen($password) == 0 ||
|
||||
!@ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$config["auth_error"] = 'User not found in database or incorrect password';
|
||||
@ldap_close ($ds);
|
||||
$ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
|
||||
|
||||
return false;
|
||||
if(!empty($ldap_base_dn)){
|
||||
if (strlen($password) == 0 ||
|
||||
!@ldap_bind($ds, $ldap_login_attr.io_safe_output($login).$ldap_base_dn, $password) ) {
|
||||
$config["auth_error"] = 'User not found in database or incorrect password';
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
} else {
|
||||
if (strlen($password) == 0 ||
|
||||
!@ldap_bind($ds, io_safe_output($login), $password) ) {
|
||||
$config["auth_error"] = 'User not found in database or incorrect password';
|
||||
@ldap_close ($ds);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ldap_close ($ds);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC170919';
|
||||
$build_version = 'PC170928';
|
||||
$pandora_version = 'v7.0NG.712';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -1809,10 +1809,12 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
|
|||
|
||||
$three_eyes_crow_groups = db_get_all_rows_sql("SELECT tperfil.*, tusuario_perfil.id_perfil FROM tperfil, tusuario_perfil WHERE tusuario_perfil.id_usuario = '" .
|
||||
$id_user . "' AND tusuario_perfil.id_grupo = 0 AND tusuario_perfil.id_perfil = tperfil.id_perfil");
|
||||
|
||||
if ($three_eyes_crow_groups && !empty($three_eyes_crow_groups)) {
|
||||
$acl_column = get_acl_column($access);
|
||||
|
||||
foreach ($three_eyes_crow_groups as $three_eyes_crow_group) {
|
||||
if (isset($three_eyes_crow_group[$acl_column])) {
|
||||
if (isset($three_eyes_crow_group[$acl_column]) && $three_eyes_crow_group[$acl_column] == 1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$background_color = 'white', $modules_param = array(), $homeurl = '',
|
||||
$name_list = array(), $unit_list = array(), $show_last = true,
|
||||
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
|
||||
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false) {
|
||||
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false,$id_widget_dashboard=false, $fullscale = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -261,7 +261,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$vconsole,
|
||||
$percentil,
|
||||
$from_interface,
|
||||
$id_widget_dashboard);
|
||||
$id_widget_dashboard,
|
||||
$fullscale);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -98,10 +98,13 @@ function reporting_get_name($id_report) {
|
|||
|
||||
function reporting_make_reporting_data($report = null, $id_report,
|
||||
$date, $time, $period = null, $type = 'dinamic',
|
||||
$force_width_chart = null, $force_height_chart = null, $pdf= false) {
|
||||
$force_width_chart = null, $force_height_chart = null, $pdf= false,
|
||||
$from_template = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
$return = array();
|
||||
|
||||
if (!empty($report)) {
|
||||
|
@ -126,6 +129,8 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
$metaconsole_on = is_metaconsole();
|
||||
|
||||
foreach ($contents as $content) {
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
if (!empty($period)) {
|
||||
$content['period'] = $period;
|
||||
}
|
||||
|
@ -153,6 +158,7 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
array_push ($agents_to_macro, modules_get_agentmodule_agent($graph_item['id_agent_module']));
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
|
@ -170,6 +176,10 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
}
|
||||
$agents_to_macro = $agents_to_macro_aux;
|
||||
|
||||
if (!empty($report) && $from_template) {
|
||||
$agents_to_macro = $content['id_agent'];
|
||||
}
|
||||
|
||||
if(isset($content['style']['name_label'])){
|
||||
//Add macros name
|
||||
$items_label = array();
|
||||
|
@ -178,7 +188,6 @@ function reporting_make_reporting_data($report = null, $id_report,
|
|||
$items_label['id_agent_module'] = $content['id_agent_module'];
|
||||
$items_label['modules'] = $modules_to_macro;
|
||||
$items_label['agents'] = $agents_to_macro;
|
||||
$server_name = $content['server_name'];
|
||||
|
||||
//Metaconsole connection
|
||||
if ($metaconsole_on && $server_name != '') {
|
||||
|
@ -2666,6 +2675,10 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
|
|||
$content['name'] = __('Network interfaces report');
|
||||
}
|
||||
|
||||
if (isset($content['style']['fullscale'])) {
|
||||
$fullscale = (bool) $content['style']['fullscale'];
|
||||
}
|
||||
|
||||
$group_name = groups_get_name($content['id_group']);
|
||||
|
||||
$return['title'] = $content['name'];
|
||||
|
@ -2736,7 +2749,13 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
|
|||
true,
|
||||
true,
|
||||
true,
|
||||
1);
|
||||
1,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
$fullscale);
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
|
@ -2759,7 +2778,13 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
|
|||
true,
|
||||
true,
|
||||
true,
|
||||
2);
|
||||
2,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
$fullscale);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -6026,12 +6051,14 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||
$only_avg = (bool) $content['style']['only_avg'];
|
||||
}
|
||||
|
||||
if (isset($content['style']['fullscale'])) {
|
||||
$fullscale = (bool) $content['style']['fullscale'];
|
||||
}
|
||||
|
||||
$moduletype_name = modules_get_moduletype_name(
|
||||
modules_get_agentmodule_type(
|
||||
$content['id_agent_module']));
|
||||
|
||||
|
||||
|
||||
$return['chart'] = '';
|
||||
// Get chart
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type,
|
||||
|
@ -6105,7 +6132,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
|
|||
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
|
||||
false,
|
||||
false,
|
||||
$config['type_module_charts']);
|
||||
$config['type_module_charts'],
|
||||
$fullscale);
|
||||
}
|
||||
break;
|
||||
case 'data':
|
||||
|
@ -10320,7 +10348,6 @@ function reporting_get_agentmodule_sla_working_timestamp ($period, $date_end, $w
|
|||
}
|
||||
|
||||
function reporting_label_macro ($item, $label) {
|
||||
|
||||
switch ($item['type']) {
|
||||
case 'event_report_agent':
|
||||
case 'alert_report_agent':
|
||||
|
|
|
@ -3886,15 +3886,16 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
$user_groups_ids = array_keys($user_groups);
|
||||
|
||||
if (empty($user_groups)) {
|
||||
$groups_condition = ' 1 = 0 ';
|
||||
$groups_condition = ' AND 1 = 0 ';
|
||||
}
|
||||
else {
|
||||
$groups_condition = ' id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
|
||||
$groups_condition = ' AND id_grupo IN (' . implode(',', $user_groups_ids) . ') ';
|
||||
}
|
||||
|
||||
if (!check_acl ($config['id_user'], 0, "PM")) {
|
||||
$groups_condition .= " AND id_grupo != 0";
|
||||
}
|
||||
$status_condition = " AND estado = 0 ";
|
||||
|
||||
$cont = 0;
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
|
@ -3923,49 +3924,45 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
$full_legend[$cont] = $name;
|
||||
|
||||
$top = $datelimit + ($periodtime * ($i + 1));
|
||||
$event = db_get_row_filter ('tmetaconsole_event',
|
||||
array (
|
||||
'utimestamp > '.$bottom,
|
||||
'utimestamp < '.$top,
|
||||
$groups_condition),
|
||||
'criticity, utimestamp');
|
||||
|
||||
if (!empty($event['utimestamp'])) {
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
switch ($event['criticity']) {
|
||||
case 0:
|
||||
$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
|
||||
break;
|
||||
case 1:
|
||||
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
||||
break;
|
||||
case 2:
|
||||
$data[$cont]['data'] = EVENT_CRIT_NORMAL;
|
||||
break;
|
||||
case 3:
|
||||
$data[$cont]['data'] = EVENT_CRIT_WARNING;
|
||||
break;
|
||||
case 4:
|
||||
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
||||
break;
|
||||
case 5:
|
||||
$data[$cont]['data'] = EVENT_CRIT_MINOR;
|
||||
break;
|
||||
case 6:
|
||||
$data[$cont]['data'] = EVENT_CRIT_MAJOR;
|
||||
break;
|
||||
case 20:
|
||||
$data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL;
|
||||
break;
|
||||
case 34:
|
||||
$data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL;
|
||||
break;
|
||||
default:
|
||||
$data[$cont]['data'] = 1;
|
||||
break;
|
||||
}
|
||||
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
|
||||
$sql = sprintf('SELECT criticity,utimestamp
|
||||
FROM tmetaconsole_event
|
||||
WHERE %s %s %s
|
||||
ORDER BY criticity DESC',
|
||||
$time_condition, $groups_condition, $status_condition);
|
||||
|
||||
$events = db_get_all_rows_sql($sql);
|
||||
|
||||
$events_criticity = array();
|
||||
foreach ($events as $key => $value) {
|
||||
array_push($events_criticity,$value['criticity']);
|
||||
}
|
||||
else {
|
||||
|
||||
if (!empty($events)) {
|
||||
if(array_search('4',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
||||
}else if (array_search('3',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_WARNING;
|
||||
}else if(array_search('6',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_MAJOR;
|
||||
}else if(array_search('5',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_MINOR;
|
||||
}else if(array_search('20',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_NOT_NORMAL;
|
||||
}else if(array_search('34',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_WARNING_OR_CRITICAL;
|
||||
}else if(array_search('2',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_NORMAL;
|
||||
}else if(array_search('0',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_MAINTENANCE;
|
||||
}else {
|
||||
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
||||
}
|
||||
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
|
||||
} else {
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
$data[$cont]['data'] = 1;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '7.0NG.712';
|
||||
$build = '170919';
|
||||
$build = '170928';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -74,17 +74,35 @@ $table_agent->data = array();
|
|||
$data = array();
|
||||
|
||||
$agent_name = ui_print_agent_name($agent["id_agente"], true, 500, "font-size: medium;font-weight:bold", true);
|
||||
$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"]));
|
||||
|
||||
if ($agent['disabled']) {
|
||||
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
|
||||
if ($in_planned_downtime) {
|
||||
$agent_name = "<em>" . $agent_name . ui_print_help_tip(__('Disabled'), true);
|
||||
}
|
||||
else {
|
||||
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
|
||||
}
|
||||
}
|
||||
else if ($agent['quiet']) {
|
||||
$agent_name = "<em'>" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
|
||||
if ($in_planned_downtime) {
|
||||
$agent_name = "<em'>" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
|
||||
}
|
||||
else {
|
||||
$agent_name = "<em'>" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$agent_name = $agent_name;
|
||||
}
|
||||
|
||||
if ($in_planned_downtime && !$agent['disabled'] && !$agent['quiet']) {
|
||||
$agent_name .= "<em>" . " " . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . "</em>";
|
||||
}
|
||||
else if (($in_planned_downtime && !$agent['disabled']) || ($in_planned_downtime && !$agent['quiet'])) {
|
||||
$agent_name .= " " . ui_print_help_tip(__('Agent in planned downtime'), true, 'images/minireloj-16.png') . "</em>";
|
||||
}
|
||||
|
||||
if (!$config["show_group_name"])
|
||||
$data[0] = ui_print_group_icon ($agent["id_grupo"], true);
|
||||
else
|
||||
|
|
|
@ -150,6 +150,7 @@ $interface_traffic_modules = array(
|
|||
$zoom = (int) get_parameter ("zoom", 1);
|
||||
$baseline = get_parameter ("baseline", 0);
|
||||
$show_percentil = get_parameter ("show_percentil", 0);
|
||||
$fullscale = get_parameter("fullscale", 0);
|
||||
|
||||
if ($zoom > 1) {
|
||||
$height = $height * ($zoom / 2.1);
|
||||
|
@ -200,7 +201,9 @@ $interface_traffic_modules = array(
|
|||
false,
|
||||
false,
|
||||
(($show_percentil)? $config['percentil'] : null),
|
||||
true);
|
||||
true,
|
||||
false,
|
||||
$fullscale);
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
@ -259,6 +262,12 @@ $interface_traffic_modules = array(
|
|||
$table->data[] = $data;
|
||||
$table->rowclass[] ='';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Show full scale graph (TIP)') . ui_print_help_tip(__('This option may cause performance issues'), true);
|
||||
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] ='';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Zoom factor');
|
||||
$options = array();
|
||||
|
|
|
@ -404,7 +404,7 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
|
|||
}
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Show full scale graph (TIP)');
|
||||
$data[0] = __('Show full scale graph (TIP)') . ui_print_help_tip(__('This option may cause performance issues'), true);
|
||||
$data[1] = html_print_checkbox ("fullscale", 1, (bool) $fullscale, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.712
|
||||
%define release 170919
|
||||
%define release 170928
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 7.0NG.712
|
||||
%define release 170919
|
||||
%define release 170928
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
|
|||
`custom_id` varchar(255) default '',
|
||||
`server_name` varchar(100) default '',
|
||||
`cascade_protection` tinyint(2) NOT NULL default '0',
|
||||
`cascade_protection_module` tinyint(2) NOT NULL default '0',
|
||||
`cascade_protection_module` int(10) unsigned NOT NULL default '0',
|
||||
`timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'nuber of hours of diference with the server timezone' ,
|
||||
`icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' ,
|
||||
`update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and do not update it' ,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 7.0NG.712-170919
|
||||
Version: 7.0NG.712-170928
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.712-170919"
|
||||
pandora_version="7.0NG.712-170928"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "7.0NG.712";
|
||||
my $pandora_build = "170919";
|
||||
my $pandora_build = "170928";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -73,26 +73,8 @@ sub new ($$;$) {
|
|||
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
||||
|
||||
# Load external .enc files for XML::Parser.
|
||||
if ($config->{'enc_dir'} ne '') {
|
||||
if (opendir(my $dh, $config->{'enc_dir'})) {
|
||||
while (my $enc_file = readdir($dh)) {
|
||||
|
||||
# Ignore unknown files.
|
||||
next unless ($enc_file =~ m/.enc$/);
|
||||
|
||||
# Load the .enc file.
|
||||
eval {
|
||||
local $SIG{__DIE__} = {};
|
||||
XML::Parser::Expat::load_encoding($config->{'enc_dir'} . '/' . $enc_file);
|
||||
};
|
||||
if ($@) {
|
||||
print_message ($config, " [WARNING] Error loading encoding file: $enc_file", 1);
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
} else {
|
||||
print_message($config, " [WARNING] Error opening directory " . $config->{'enc_dir'} . ": $!", 1);
|
||||
}
|
||||
if ($config->{'enc_dir'} ne '' && !grep {$_ eq $config->{'enc_dir'}} @XML::Parser::Expat::Encoding_Path) {
|
||||
push(@XML::Parser::Expat::Encoding_Path, $config->{'enc_dir'});
|
||||
}
|
||||
|
||||
bless $self, $class;
|
||||
|
|
|
@ -211,6 +211,11 @@ sub pandora_snmptrapd {
|
|||
# Try to save as much information as possible if the trap could not be parsed
|
||||
$oid = $type_desc if ($oid eq '' || $oid eq '.');
|
||||
|
||||
if (!defined($oid)) {
|
||||
logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv1 trap?)", 5);
|
||||
return;
|
||||
}
|
||||
|
||||
} elsif ($trap_ver eq "SNMPv2") {
|
||||
($date, $time, $source, $data) = split(/\[\*\*\]/, $line, 4);
|
||||
my @data = split(/\t/, $data);
|
||||
|
@ -219,7 +224,7 @@ sub pandora_snmptrapd {
|
|||
$oid = shift @data;
|
||||
|
||||
if (!defined($oid)) {
|
||||
logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 1);
|
||||
logger($pa_config, "[W] snmpTrapOID not found (Illegal SNMPv2 trap?)", 5);
|
||||
return;
|
||||
}
|
||||
$oid =~ s/.* = OID: //;
|
||||
|
@ -441,21 +446,32 @@ sub read_snmplogfile()
|
|||
|
||||
return undef if (! defined($line));
|
||||
|
||||
my $retry_count = 0;
|
||||
|
||||
# More lines ?
|
||||
while($read_ahead_line = <SNMPLOGFILE>) {
|
||||
while(1) {
|
||||
while($read_ahead_line = <SNMPLOGFILE>) {
|
||||
|
||||
# Get current file position
|
||||
$read_ahead_pos = tell(SNMPLOGFILE);
|
||||
# Get current file position
|
||||
$read_ahead_pos = tell(SNMPLOGFILE);
|
||||
|
||||
# Get out of the loop if you find another Trap
|
||||
last if($read_ahead_line =~ /^SNMP/ );
|
||||
# Get out of the loop if you find another Trap
|
||||
last if($read_ahead_line =~ /^SNMP/ );
|
||||
|
||||
# $read_ahead_line looks continued line...
|
||||
# $read_ahead_line looks continued line...
|
||||
|
||||
# Append to the line and correct the position
|
||||
chomp($line);
|
||||
$line .= "$read_ahead_line";
|
||||
$pos = $read_ahead_pos;
|
||||
# Append to the line and correct the position
|
||||
chomp($line);
|
||||
$line .= "$read_ahead_line";
|
||||
$pos = $read_ahead_pos;
|
||||
}
|
||||
|
||||
# if $line looks incomplete, try to get continued line
|
||||
# just within 10sec. After that, giving up to complete it
|
||||
# and flush $line as it is.
|
||||
last if(chomp($line) > 0 || $retry_count++ >= 10);
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
# return fetched line with file position to be saved.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.712
|
||||
%define release 170919
|
||||
%define release 170928
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 7.0NG.712
|
||||
%define release 170919
|
||||
%define release 170928
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.712"
|
||||
PI_BUILD="170919"
|
||||
PI_BUILD="170928"
|
||||
|
||||
MODE=$1
|
||||
if [ $# -gt 1 ]; then
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.712 PS170919";
|
||||
my $version = "7.0NG.712 PS170928";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "7.0NG.712 PS170919";
|
||||
my $version = "7.0NG.712 PS170928";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
@ -221,7 +221,7 @@ sub help_screen{
|
|||
help_screen_line('--delete_visual_console', '<id>', 'Delete a visual console');
|
||||
help_screen_line('--delete_visual_console_objects', '<id> <mode> <id_mode>', 'Delete a visual console elements');
|
||||
help_screen_line('--duplicate_visual_console', '<id> <times> [<prefix>]', 'Duplicate a visual console');
|
||||
help_screen_line('--export_json_visual_console', '<id> [<path>]', 'Creates a json with the visual console elements information');
|
||||
help_screen_line('--export_json_visual_console', '<id> [<path>] [<with_element_id>]', 'Creates a json with the visual console elements information');
|
||||
|
||||
|
||||
print "\n";
|
||||
|
@ -4821,7 +4821,7 @@ sub cli_create_visual_console() {
|
|||
my $id_agente_modulo = $elem->{'id_agente_modulo'};
|
||||
my $id_agent = $elem->{'id_agent'};
|
||||
my $id_layout_linked = $elem->{'id_layout_linked'};
|
||||
my $parent_item = $elem->{'parent_item'};
|
||||
my $parent_item = 0;
|
||||
my $enable_link = $elem->{'enable_link'};
|
||||
my $id_metaconsole = $elem->{'id_metaconsole'};
|
||||
my $id_group = $elem->{'id_group'};
|
||||
|
@ -4855,11 +4855,11 @@ sub cli_create_visual_console() {
|
|||
|
||||
my $number_of_elements = scalar(@$elements_in_array);
|
||||
|
||||
my $x_divider = 4;
|
||||
my $x_divider = 8;
|
||||
my $y_divider = 1;
|
||||
|
||||
for (my $i = 1; $i <= 1000; $i++) {
|
||||
if (($i * 4) < $number_of_elements) {
|
||||
if (($i * 8) < $number_of_elements) {
|
||||
$y_divider++;
|
||||
}
|
||||
else {
|
||||
|
@ -4870,16 +4870,17 @@ sub cli_create_visual_console() {
|
|||
my $elem_width = ($pos2X - $pos1X) / $x_divider;
|
||||
my $elem_height = ($pos2Y - $pos1Y) / $y_divider;
|
||||
|
||||
if ($number_of_elements < 4) {
|
||||
$elem_height = ($pos2Y - $pos1Y) / 3;
|
||||
if ($number_of_elements <= 8) {
|
||||
$elem_height = ($pos2Y - $pos1Y) / 4;
|
||||
}
|
||||
|
||||
my $elem_count = 1;
|
||||
my $pos_helper_x = 0;
|
||||
my $pos_helper_y = 0;
|
||||
my $pos_aux_count = 0;
|
||||
my $pos_helper_x = $pos1X;
|
||||
my $pos_helper_y = $pos1Y;
|
||||
foreach my $elem (@$elements_in_array) {
|
||||
my $pos_x = $pos_helper_x * $elem_width;
|
||||
my $pos_y = $pos_helper_y * $elem_height;
|
||||
my $pos_x = $pos_helper_x;
|
||||
my $pos_y = $pos_helper_y;
|
||||
my $width = $elem_width;
|
||||
my $height = $elem_height;
|
||||
my $label = $elem->{'label'};
|
||||
|
@ -4907,12 +4908,14 @@ sub cli_create_visual_console() {
|
|||
|
||||
$elem_count++;
|
||||
|
||||
if ($pos_helper_x == 3) {
|
||||
$pos_helper_x = 0;
|
||||
$pos_helper_y++;
|
||||
if ($pos_aux_count == 7) {
|
||||
$pos_helper_x = $pos1X;
|
||||
$pos_helper_y += $elem_height;
|
||||
$pos_aux_count = 0;
|
||||
}
|
||||
else {
|
||||
$pos_helper_x++;
|
||||
$pos_aux_count++;
|
||||
$pos_helper_x += $elem_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5379,7 +5382,7 @@ sub cli_delete_visual_console_objects() {
|
|||
##############################################################################
|
||||
|
||||
sub cli_duplicate_visual_console () {
|
||||
my ($id_console,$prefix) = @ARGV[2..3];
|
||||
my ($id_console,$times,$prefix) = @ARGV[2..4];
|
||||
|
||||
if($id_console eq '') {
|
||||
print_log "[ERROR] Console ID field cannot be empty.\n\n";
|
||||
|
@ -5400,56 +5403,58 @@ sub cli_duplicate_visual_console () {
|
|||
$name_count = 1;
|
||||
}
|
||||
|
||||
my $exist = 1;
|
||||
while ($exist == 1) {
|
||||
my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
|
||||
for (my $iteration = 0; $iteration < $times; $iteration++) {
|
||||
my $exist = 1;
|
||||
while ($exist == 1) {
|
||||
my $name_in_db = get_db_single_row ($dbh, "SELECT name FROM tlayout WHERE name = '$new_name'");
|
||||
|
||||
if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) {
|
||||
$new_name = $name_to_compare . "_" . $name_count;
|
||||
$name_count++;
|
||||
if (defined($name_in_db->{'name'}) && ($name_in_db->{'name'} eq $new_name)) {
|
||||
$new_name = $name_to_compare . "_" . $name_count;
|
||||
$name_count++;
|
||||
}
|
||||
else {
|
||||
$exist = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$exist = 0;
|
||||
|
||||
my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color)
|
||||
VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'});
|
||||
|
||||
print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n";
|
||||
|
||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id_layout = $id_console");
|
||||
|
||||
foreach my $element (@console_elements) {
|
||||
my $pos_x = $element->{'pos_x'};
|
||||
my $pos_y = $element->{'pos_y'};
|
||||
my $width = $element->{'width'};
|
||||
my $height = $element->{'height'};
|
||||
my $label = $element->{'label'};
|
||||
my $image = $element->{'image'};
|
||||
my $type = $element->{'type'};
|
||||
my $period = $element->{'period'};
|
||||
my $id_agente_modulo = $element->{'id_agente_modulo'};
|
||||
my $id_agent = $element->{'id_agent'};
|
||||
my $id_layout_linked = $element->{'id_layout_linked'};
|
||||
my $parent_item = $element->{'parent_item'};
|
||||
my $enable_link = $element->{'enable_link'};
|
||||
my $id_metaconsole = $element->{'id_metaconsole'};
|
||||
my $id_group = $element->{'id_group'};
|
||||
my $id_custom_graph = $element->{'id_custom_graph'};
|
||||
my $border_width = $element->{'border_width'};
|
||||
my $type_graph = $element->{'type_graph'};
|
||||
my $label_position = $element->{'label_position'};
|
||||
my $border_color = $element->{'border_color'};
|
||||
my $fill_color = $element->{'fill_color'};
|
||||
|
||||
my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
|
||||
}
|
||||
}
|
||||
|
||||
my $new_console_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout (name, id_group, background, width, height, background_color)
|
||||
VALUES (?, ?, ?, ?, ?, ?)', $new_name, $console->{'id_group'}, $console->{'background'}, $console->{'width'}, $console->{'height'}, $console->{'background_color'});
|
||||
|
||||
print_log "[INFO] The new visual console '$new_name' has been created. The new ID is '$new_console_id' \n\n";
|
||||
|
||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id_layout = $id_console");
|
||||
|
||||
foreach my $element (@console_elements) {
|
||||
my $pos_x = $element->{'pos_x'};
|
||||
my $pos_y = $element->{'pos_y'};
|
||||
my $width = $element->{'width'};
|
||||
my $height = $element->{'height'};
|
||||
my $label = $element->{'label'};
|
||||
my $image = $element->{'image'};
|
||||
my $type = $element->{'type'};
|
||||
my $period = $element->{'period'};
|
||||
my $id_agente_modulo = $element->{'id_agente_modulo'};
|
||||
my $id_agent = $element->{'id_agent'};
|
||||
my $id_layout_linked = $element->{'id_layout_linked'};
|
||||
my $parent_item = $element->{'parent_item'};
|
||||
my $enable_link = $element->{'enable_link'};
|
||||
my $id_metaconsole = $element->{'id_metaconsole'};
|
||||
my $id_group = $element->{'id_group'};
|
||||
my $id_custom_graph = $element->{'id_custom_graph'};
|
||||
my $border_width = $element->{'border_width'};
|
||||
my $type_graph = $element->{'type_graph'};
|
||||
my $label_position = $element->{'label_position'};
|
||||
my $border_color = $element->{'border_color'};
|
||||
my $fill_color = $element->{'fill_color'};
|
||||
|
||||
my $element_id = db_insert ($dbh, 'id', 'INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_agent, id_layout_linked, parent_item, enable_link, id_metaconsole, id_group, id_custom_graph, border_width, type_graph, label_position, border_color, fill_color, show_statistics)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $new_console_id, $pos_x, $pos_y, $height, $width, $label, $image, $type, $period, $id_agente_modulo, $id_agent, $id_layout_linked, $parent_item, $enable_link, $id_metaconsole, $id_group, $id_custom_graph, $border_width, $type_graph, $label_position, $border_color, $fill_color, 0);
|
||||
|
||||
print_log "[INFO] Element with ID " . $element->{"id"} . " has been duplicated to the new console \n\n";
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
@ -5458,23 +5463,38 @@ sub cli_duplicate_visual_console () {
|
|||
##############################################################################
|
||||
|
||||
sub cli_export_visual_console() {
|
||||
my ($id,$path) = @ARGV[2..3];
|
||||
my ($id,$path,$with_id) = @ARGV[2..4];
|
||||
|
||||
if($id eq '') {
|
||||
print_log "[ERROR] ID field cannot be empty.\n\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $data_to_json = '';
|
||||
my $first = 1;
|
||||
|
||||
print_log "[INFO] Exporting visual console elements with ID '$id' \n\n";
|
||||
|
||||
my $console = get_db_single_row ($dbh, "SELECT *
|
||||
FROM tlayout
|
||||
WHERE id = $id");
|
||||
|
||||
$data_to_json .= '"' . safe_output($console->{'name'}) . '"';
|
||||
$data_to_json .= ' "' . $console->{'background'} . '"';
|
||||
$data_to_json .= ' ' . $console->{'width'};
|
||||
$data_to_json .= ' ' . $console->{'height'};
|
||||
$data_to_json .= ' ' . $console->{'id_group'};
|
||||
$data_to_json .= ' "static_objects"';
|
||||
$data_to_json .= ' ""';
|
||||
$data_to_json .= ' "' . $console->{'background_color'} . '" ';
|
||||
|
||||
my @console_elements = get_db_rows ($dbh, "SELECT *
|
||||
FROM tlayout_data
|
||||
WHERE id_layout = $id");
|
||||
|
||||
my $data_to_json = '[';
|
||||
my $first = 1;
|
||||
|
||||
$data_to_json .= "'[";
|
||||
foreach my $element (@console_elements) {
|
||||
my $id_layout_data = $element->{'id'};
|
||||
my $pos_x = $element->{'pos_x'};
|
||||
my $pos_y = $element->{'pos_y'};
|
||||
my $width = $element->{'width'};
|
||||
|
@ -5504,7 +5524,15 @@ sub cli_export_visual_console() {
|
|||
$first = 0;
|
||||
}
|
||||
|
||||
$data_to_json .= '{"image":"' . $image . '"';
|
||||
$label =~ s/"/\\"/g;
|
||||
|
||||
if ($with_id == 1) {
|
||||
$data_to_json .= '{"id":' . $id_layout_data;
|
||||
$data_to_json .= ',"image":"' . $image . '"';
|
||||
}
|
||||
else {
|
||||
$data_to_json .= '{"image":"' . $image . '"';
|
||||
}
|
||||
$data_to_json .= ',"pos_y":' . $pos_y;
|
||||
$data_to_json .= ',"pos_x":' . $pos_x;
|
||||
$data_to_json .= ',"width":' . $width;
|
||||
|
@ -5528,7 +5556,7 @@ sub cli_export_visual_console() {
|
|||
$data_to_json .= '}';
|
||||
}
|
||||
|
||||
$data_to_json .= ']';
|
||||
$data_to_json .= "]'";
|
||||
|
||||
if ($path eq '') {
|
||||
open(FicheroJSON, ">console_" . $id . "_elements");
|
||||
|
@ -5989,11 +6017,11 @@ sub pandora_manage_main ($$$) {
|
|||
cli_delete_visual_console_objects();
|
||||
}
|
||||
elsif ($param eq '--duplicate_visual_console') {
|
||||
param_check($ltotal, 2, 1);
|
||||
param_check($ltotal, 3, 2);
|
||||
cli_duplicate_visual_console();
|
||||
}
|
||||
elsif ($param eq '--export_json_visual_console') {
|
||||
param_check($ltotal, 2, 1);
|
||||
param_check($ltotal, 3, 2);
|
||||
cli_export_visual_console();
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue