Merge branch 'develop' into 186-tentacle-inverso-sync-server

This commit is contained in:
Ramon Novoa 2017-02-22 13:41:36 +01:00
commit bb6ab10fdb
134 changed files with 49556 additions and 45374 deletions
pandora_agents
pandora_console
DEBIAN
extensions
extras
general
godmode
images
include
index.phpinstall.php
mobile
operation/agentes

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0dev-170217
Version: 7.0dev-170222
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="7.0dev-170217"
pandora_version="7.0dev-170222"
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

@ -39,7 +39,9 @@ udp_server_auth_address 0.0.0.0
# To define agent name by specific command, define 'agent_name_cmd'.
# (In the following example, agent name is 'hostname_IP')
#agent_name_cmd /bin/echo -n `hostname` ; /bin/echo -n "_" ; /bin/echo `/sbin/ifconfig bce0 | /usr/bin/grep 'inet' | /usr/bin/awk '{print $2;}' | cut -d: -f2`
# If set to __rand__ the agent will generate a random name.
#agent_name_cmd LANG=C; /bin/echo -n `hostname`; /bin/echo -n "_"; /bin/echo `/sbin/ifconfig eth0 | /bin/grep 'inet addr' | /usr/bin/awk '{print $2;}' | /usr/bin/cut -d: -f2`
agent_name_cmd __rand__
#Parent agent_name
#parent_agent_name parent_name

View File

@ -39,7 +39,9 @@ udp_server_auth_address 0.0.0.0
# To define agent name by specific command, define 'agent_name_cmd'.
# (In the following example, agent name is 'hostname_IP')
# If set to __rand__ the agent will generate a random name.
#agent_name_cmd LANG=C; /bin/echo -n `hostname`; /bin/echo -n "_"; /bin/echo `/sbin/ifconfig eth0 | /bin/grep 'inet addr' | /usr/bin/awk '{print $2;}' | /usr/bin/cut -d: -f2`
agent_name_cmd __rand__
#Parent agent_name
#parent_agent_name caprica

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0dev';
use constant AGENT_BUILD => '170217';
use constant AGENT_BUILD => '170222';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -100,6 +100,9 @@ use constant DF_CMDS => {
aix => 'df -kP',
freebsd => 'df -k'
};
# 2 to the power of 32.
use constant POW232 => 2**32;
# OS and OS version
my $OS = $^O;
@ -131,8 +134,9 @@ my %DefaultConf = (
'temporal' => '/var/spool/pandora',
'interval' => 300,
'debug' => 0,
'agent_name' => '',
'agent_alias' => hostname(),
'ehorus_conf' => undef,
'agent_name' => hostname (),
'agent_name_cmd' => '',
'description' => '',
'group' => '',
@ -800,17 +804,24 @@ sub read_config (;$) {
parse_conf_modules(\@file);
# If agent_name_cmd is defined, agent_name is set by command result.
if ($Conf{'agent_name_cmd'} ne '') {
my $result = `$Conf{'agent_name_cmd'}`;
# Use only the first line.
my ($temp_agent_name, $remain) = split(/\n/, $result);
chomp ($temp_agent_name);
# Remove white spaces of the first and last.
$temp_agent_name =~ s/^ *(.*?) *$/$1/;
$Conf{'agent_name'} = $temp_agent_name if ($temp_agent_name ne '');
if ($Conf{'agent_name'} eq '') {
if ($Conf{'agent_name_cmd'} eq '__rand__') {
$Conf{'agent_name'} = generate_agent_name();
config_update('agent_name', $Conf{'agent_name'});
} elsif ($Conf{'agent_name_cmd'} ne '') {
my $result = `$Conf{'agent_name_cmd'}`;
# Use only the first line.
my ($temp_agent_name, $remain) = split(/\n/, $result);
chomp ($temp_agent_name);
# Remove white spaces of the first and last.
$temp_agent_name =~ s/^ *(.*?) *$/$1/;
$Conf{'agent_name'} = $temp_agent_name if ($temp_agent_name ne '');
} else {
$Conf{'agent_name'} = hostname();
}
}
# Update the agent MD5 since agent_name may have changed
@ -1196,73 +1207,78 @@ sub check_collections () {
}
###############################################################################
# MD5 leftrotate function. See http://en.wikipedia.org/wiki/MD5#Pseudocode.
# Return the MD5 checksum of the given string as a hex string.
# Pseudocode from: http://en.wikipedia.org/wiki/MD5#Pseudocode
###############################################################################
sub leftrotate ($$) {
my ($x, $c) = @_;
return (0xFFFFFFFF & ($x << $c)) | ($x >> (32 - $c));
}
###############################################################################
# Initialize some variables needed by the MD5 algorithm.
# See http://en.wikipedia.org/wiki/MD5#Pseudocode.
###############################################################################
my (@R, @K);
sub md5_init () {
# R specifies the per-round shift amounts
@R = (7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21);
# Use binary integer part of the sines of integers (radians) as constants
for (my $i = 0; $i < 64; $i++) {
$K[$i] = floor(abs(sin($i + 1)) * MOD232);
}
}
###############################################################################
# Return the MD5 checksum of the given string.
# Pseudocode from http://en.wikipedia.org/wiki/MD5#Pseudocode.
###############################################################################
sub md5 ($) {
my @S = (
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21
);
my @K = (
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391
);
sub md5 {
my $str = shift;
# Note: All variables are unsigned 32 bits and wrap modulo 2^32 when calculating
# No input!
if (!defined($str)) {
return "";
}
# Initialize variables
# Note: All variables are unsigned 32 bits and wrap modulo 2^32 when
# calculating.
# Initialize variables.
my $h0 = 0x67452301;
my $h1 = 0xEFCDAB89;
my $h2 = 0x98BADCFE;
my $h3 = 0x10325476;
# Pre-processing
# Pre-processing.
my $msg = unpack ("B*", pack ("A*", $str));
my $bit_len = length ($msg);
# Append "1" bit to message
# Append "1" bit to message.
$msg .= '1';
# Append "0" bits until message length in bits ≡ 448 (mod 512)
# Append "0" bits until message length in bits ≡ 448 (mod 512).
$msg .= '0' while ((length ($msg) % 512) != 448);
# Append bit /* bit, not byte */ length of unpadded message as 64-bit little-endian integer to message
$msg .= unpack ("B64", pack ("VV", $bit_len));
# Append bit /* bit, not byte */ length of unpadded message as 64-bit
# little-endian integer to message.
$msg .= unpack ("B32", pack ("V", $bit_len));
$msg .= unpack ("B32", pack ("V", $bit_len >> 32));
# Process the message in successive 512-bit chunks
# Process the message in successive 512-bit chunks.
for (my $i = 0; $i < length ($msg); $i += 512) {
my @w;
my $chunk = substr ($msg, $i, 512);
# Break chunk into sixteen 32-bit little-endian words w[i], 0 <= i <= 15
# Break chunk into sixteen 32-bit little-endian words w[i], 0 <= i <=
# 15.
for (my $j = 0; $j < length ($chunk); $j += 32) {
push (@w, unpack ("V", pack ("B32", substr ($chunk, $j, 32))));
}
# Initialize hash value for this chunk
# Initialize hash value for this chunk.
my $a = $h0;
my $b = $h1;
my $c = $h2;
@ -1270,7 +1286,7 @@ sub md5 ($) {
my $f;
my $g;
# Main loop
# Main loop.
for (my $y = 0; $y < 64; $y++) {
if ($y <= 15) {
$f = $d ^ ($b & ($c ^ $d));
@ -1292,19 +1308,163 @@ sub md5 ($) {
my $temp = $d;
$d = $c;
$c = $b;
$b = ($b + leftrotate (($a + $f + $K[$y] + $w[$g]) % MOD232, $R[$y])) % MOD232;
$b = ($b + leftrotate (($a + $f + $K[$y] + $w[$g]) % POW232, $S[$y])) % POW232;
$a = $temp;
}
# Add this chunk's hash to result so far
$h0 = ($h0 + $a) % MOD232;
$h1 = ($h1 + $b) % MOD232;
$h2 = ($h2 + $c) % MOD232;
$h3 = ($h3 + $d) % MOD232;
# Add this chunk's hash to result so far.
$h0 = ($h0 + $a) % POW232;
$h1 = ($h1 + $b) % POW232;
$h2 = ($h2 + $c) % POW232;
$h3 = ($h3 + $d) % POW232;
}
# Digest := h0 append h1 append h2 append h3 #(expressed as little-endian)
return unpack ("H*", pack ("V", $h0)) . unpack ("H*", pack ("V", $h1)) . unpack ("H*", pack ("V", $h2)) . unpack ("H*", pack ("V", $h3));
return unpack ("H*", pack ("V", $h0)) .
unpack ("H*", pack ("V", $h1)) .
unpack ("H*", pack ("V", $h2)) .
unpack ("H*", pack ("V", $h3));
}
###############################################################################
# MD5 leftrotate function. See: http://en.wikipedia.org/wiki/MD5#Pseudocode
###############################################################################
sub leftrotate {
my ($x, $c) = @_;
return (0xFFFFFFFF & ($x << $c)) | ($x >> (32 - $c));
}
###############################################################################
# Return the SHA256 checksum of the given string as a hex string.
# Pseudocode from: http://en.wikipedia.org/wiki/SHA-2#Pseudocode
###############################################################################
my @K2 = (
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
);
sub sha256 {
my $str = shift;
# No input!
if (!defined($str)) {
return "";
}
# Note: All variables are unsigned 32 bits and wrap modulo 2^32 when
# calculating.
# First 32 bits of the fractional parts of the square roots of the first 8
# primes.
my $h0 = 0x6a09e667;
my $h1 = 0xbb67ae85;
my $h2 = 0x3c6ef372;
my $h3 = 0xa54ff53a;
my $h4 = 0x510e527f;
my $h5 = 0x9b05688c;
my $h6 = 0x1f83d9ab;
my $h7 = 0x5be0cd19;
# Pre-processing.
my $msg = unpack ("B*", pack ("A*", $str));
my $bit_len = length ($msg);
# Append "1" bit to message.
$msg .= '1';
# Append "0" bits until message length in bits = 448 (mod 512).
$msg .= '0' while ((length ($msg) % 512) != 448);
# Append bit /* bit, not byte */ length of unpadded message as 64-bit
# big-endian integer to message.
$msg .= unpack ("B32", pack ("N", $bit_len >> 32));
$msg .= unpack ("B32", pack ("N", $bit_len));
# Process the message in successive 512-bit chunks.
for (my $i = 0; $i < length ($msg); $i += 512) {
my @w;
my $chunk = substr ($msg, $i, 512);
# Break chunk into sixteen 32-bit big-endian words.
for (my $j = 0; $j < length ($chunk); $j += 32) {
push (@w, unpack ("N", pack ("B32", substr ($chunk, $j, 32))));
}
# Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array:
for (my $i = 16; $i < 64; $i++) {
my $s0 = rightrotate($w[$i - 15], 7) ^ rightrotate($w[$i - 15], 18) ^ ($w[$i - 15] >> 3);
my $s1 = rightrotate($w[$i - 2], 17) ^ rightrotate($w[$i - 2], 19) ^ ($w[$i - 2] >> 10);
$w[$i] = ($w[$i - 16] + $s0 + $w[$i - 7] + $s1) % POW232;
}
# Initialize working variables to current hash value.
my $a = $h0;
my $b = $h1;
my $c = $h2;
my $d = $h3;
my $e = $h4;
my $f = $h5;
my $g = $h6;
my $h = $h7;
# Compression function main loop.
for (my $i = 0; $i < 64; $i++) {
my $S1 = rightrotate($e, 6) ^ rightrotate($e, 11) ^ rightrotate($e, 25);
my $ch = ($e & $f) ^ ((0xFFFFFFFF & (~ $e)) & $g);
my $temp1 = ($h + $S1 + $ch + $K2[$i] + $w[$i]) % POW232;
my $S0 = rightrotate($a, 2) ^ rightrotate($a, 13) ^ rightrotate($a, 22);
my $maj = ($a & $b) ^ ($a & $c) ^ ($b & $c);
my $temp2 = ($S0 + $maj) % POW232;
$h = $g;
$g = $f;
$f = $e;
$e = ($d + $temp1) % POW232;
$d = $c;
$c = $b;
$b = $a;
$a = ($temp1 + $temp2) % POW232;
}
# Add the compressed chunk to the current hash value.
$h0 = ($h0 + $a) % POW232;
$h1 = ($h1 + $b) % POW232;
$h2 = ($h2 + $c) % POW232;
$h3 = ($h3 + $d) % POW232;
$h4 = ($h4 + $e) % POW232;
$h5 = ($h5 + $f) % POW232;
$h6 = ($h6 + $g) % POW232;
$h7 = ($h7 + $h) % POW232;
}
# Produce the final hash value (big-endian).
return unpack ("H*", pack ("N", $h0)) .
unpack ("H*", pack ("N", $h1)) .
unpack ("H*", pack ("N", $h2)) .
unpack ("H*", pack ("N", $h3)) .
unpack ("H*", pack ("N", $h4)) .
unpack ("H*", pack ("N", $h5)) .
unpack ("H*", pack ("N", $h6)) .
unpack ("H*", pack ("N", $h7));
}
###############################################################################
# Rotate a 32-bit number a number of bits to the right.
###############################################################################
sub rightrotate {
my ($x, $c) = @_;
return (0xFFFFFFFF & ($x << (32 - $c))) | ($x >> $c);
}
################################################################################
@ -2196,6 +2356,46 @@ sub init_module ($) {
$module->{'alert_template'} = undef;
}
################################################################################
# Generate a unique agent name.
################################################################################
sub generate_agent_name {
return sha256(join('|', ($Conf{'agent_alias'}, $Conf{server_ip}, time(), sprintf("%04d", rand(10000)))));
}
################################################################################
# Set the value of a token in the configuration file. If the token does not
# exist, it is appended to the end of the file.
################################################################################
sub config_update ($$) {
my ($token, $value) = @_;
# Read the original configuration file.
open(my $fh, '<', "$ConfDir/$ConfFile") or die($!);
my @lines = <$fh>;
close ($fh);
# Set the new value for the configuration token.
my $found = 0;
for(my $i = 0; $i < $#lines; $i++) {
if ($lines[$i] =~ m/[#\s]*$token/) {
$lines[$i] = "$token $value\n";
$found = 1;
last;
}
}
# Append the token to the end if it was not found in the file.
if ($found == 0) {
push(@lines, "$token $value\n");
}
# Write the changes to the configuration file.
open($fh, '>', "$ConfDir/$ConfFile") or die($!);
print $fh @lines;
close($fh);
}
################################################################################
# Get the eHorus key from the eHorus agent configuration file.
################################################################################
@ -2261,9 +2461,6 @@ if (defined ($pandora_user)) {
# Guess the OS version
$OS_VERSION = guess_os_version ($OS);
# Initialize MD5 variables
md5_init ();
# Start logging
start_log ();
log_message ('log', 'Running as user ' . getpwuid ($>));
@ -2472,8 +2669,9 @@ while (1) {
(defined($Conf{'group_id'}) ? ("' group_id='" . $Conf{'group_id'}) : '') .
"' os_name='$OS' os_version='$OS_VERSION' interval='" . $Conf{'interval'} .
"' version='" . AGENT_VERSION . '(Build ' . AGENT_BUILD . ')' . ($Conf{'autotime'} eq '1' ? '' : "' timestamp='" . strftime ('%Y/%m/%d %H:%M:%S', localtime ())) .
"' agent_name='" . $Conf{'agent_name'} . "' timezone_offset='". $Conf{'timezone_offset'} .
"' custom_id='" . $Conf{'custom_id'} . "' url_address='". $Conf{'url_address'};
"' agent_name='" . $Conf{'agent_name'} . "' agent_alias='". $Conf{'agent_alias'} .
"' timezone_offset='". $Conf{'timezone_offset'} . "' custom_id='" . $Conf{'custom_id'} .
"' url_address='". $Conf{'url_address'};
if (defined ($Conf{'address'})) {
$xml_header .= "' address='" .$address;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0dev
%define release 170217
%define release 170222
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0dev
%define release 170217
%define release 170222
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0dev"
PI_BUILD="170217"
PI_BUILD="170222"
OS_NAME=`uname -s`
FORCE=0

View File

@ -1,9 +1,9 @@
bin_PROGRAMS = PandoraAgent
if DEBUG
PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp
PandoraAgent_CXXFLAGS=-g -O0
else
PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc
PandoraAgent_CXXFLAGS=-O2
endif

View File

@ -33,7 +33,10 @@ temporal "%ProgramFiles%\pandora_agent\temp"
# To define agent name by specific command, define 'agent_name_cmd'.
# If agent_name_cmd is defined, agent_name is ignored.
# (In the following example, agent name is 'hostname_IP')
# If set to __rand__ the agent will generate a random name.
#agent_name_cmd cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\agentname.vbs"
agent_name_cmd __rand__
#Parent agent_name
#parent_agent_name caprica

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{170217}
{170222}
ViewReadme
{Yes}

View File

@ -0,0 +1,44 @@
/* Pandora agents service for Win32.
Copyright (C) 2016 Artica ST.
Written by Ramon Novoa.
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; either version 2, or (at your option)
any later version.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <string.h>
#include "openssl/sha.h"
#include "sha256.h"
void
sha256(const char *data, char hex_digest[SHA256_HEX_LENGTH + 1])
{
int i, j;
unsigned char hash[SHA256_DIGEST_LENGTH];
SHA256_CTX sha256;
// Calculate the SHA-256 hash.
SHA256_Init(&sha256);
SHA256_Update(&sha256, data, strlen(data));
SHA256_Final(hash, &sha256);
// Convert it to a hexadecimal string.
for(i = 0, j = 0; i < SHA256_DIGEST_LENGTH, j < SHA256_HEX_LENGTH; i++, j+=2) {
sprintf(&(hex_digest[j]), "%02x", hash[i]);
}
// Add a NULL terminator.
hex_digest[SHA256_HEX_LENGTH] = 0;
}

View File

@ -0,0 +1,29 @@
/* Pandora agents service for Win32.
Copyright (C) 2016 Artica ST.
Written by Ramon Novoa.
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; either version 2, or (at your option)
any later version.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _SHA256_H_
#define _SHA256_H_
// Length of the sha256 hex string.
#define SHA256_HEX_LENGTH 64
void sha256(const char *data, char hex_digest[SHA256_HEX_LENGTH + 1]);
#endif

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0dev(Build 170217)")
#define PANDORA_VERSION ("7.0dev(Build 170222)")
string pandora_path;
string pandora_dir;
@ -99,6 +99,15 @@ Key_Value::getKey () {
return key;
}
/**
* Set the key of the object.
*
*/
void
Key_Value::setKey (const string key) {
this->key = key;
}
/**
* Get the value of the object.
*
@ -109,6 +118,16 @@ Key_Value::getValue () {
return value;
}
/**
* Set the value of the object.
*
* @return The value
*/
void
Key_Value::setValue (const string value) {
this->value = value;
}
void
pandoraWriteLog (string filename, string line) {
string buffer;

View File

@ -62,7 +62,9 @@ namespace Pandora {
void parseLine (string str);
void parseLineByPosition (string str, int pos);
string getKey ();
void setKey (const string value);
string getValue ();
void setValue (const string value);
};
static const HKEY hkey = HKEY_LOCAL_MACHINE;

View File

@ -350,6 +350,70 @@ Pandora::Pandora_Agent_Conf::setFile (string filename) {
file.close ();
}
/**
* Update a configuration value in the configuration file. If it is not found,
* it is appended at the end of the file.
*
* @param string key Name of the configuration option.
* @param string value New value.
*/
void
Pandora::Pandora_Agent_Conf::updateFile (string key, string value){
string buffer, filename, temp_filename;
int pos;
/* Open the configuration file. */
filename = Pandora::getPandoraInstallDir ();
filename += "pandora_agent.conf";
ifstream file (filename.c_str ());
if (!file.is_open ()) {
return;
}
/* Open the temporary file. */
temp_filename = filename + ".tmp";
ofstream temp_file (temp_filename.c_str ());
if (!temp_file.is_open ()) {
return;
}
/* Look for the configuration value. */
bool found = false;
while (!file.eof ()) {
getline (file, buffer);
/* Copy the rest of the file if the key was found. */
if (found) {
temp_file << buffer << std::endl;
continue;
}
/* We will only look for the key in the first three characters, hoping
to catch "key", "#key" and "# key". We would also catch "..key", but
no such keys exist in the configuration file. */
pos = buffer.find(key);
if (pos == std::string::npos || pos > 2) {
temp_file << buffer << std::endl;
continue;
}
/* Match! */
found = true;
temp_file << key + " " + value << std::endl;
}
/* Append the value at the end of the file if it was not found. */
if (!found) {
temp_file << key + " " + value << std::endl;
}
/* Rename the temporary file. */
file.close ();
temp_file.close ();
remove(filename.c_str());
rename(temp_filename.c_str(), filename.c_str());
}
/**
* Queries for a configuration value.
*
@ -375,6 +439,33 @@ Pandora::Pandora_Agent_Conf::getValue (const string key)
return "";
}
/**
* Sets a configuration value.
*
* @param key Key to look for.
* @param string New value.
*
*/
void
Pandora::Pandora_Agent_Conf::setValue (const string key, const string value)
{
std::list<Key_Value>::iterator i;
// Update.
for (i = this->key_values->begin (); i != this->key_values->end (); i++) {
if ((*i).getKey () == key) {
(*i).setValue (value);
return;
}
}
// Append.
Key_Value kv;
kv.setKey(key);
kv.setValue(value);
this->key_values->push_back (kv);
}
/**
* Queries for a collection name.
*

View File

@ -55,7 +55,9 @@ namespace Pandora {
void parseFile(string path_file, Collection *aux);
void setFile (string *all_conf);
void setFile (string filename);
void updateFile (string key, string value);
string getValue (const string key);
void setValue (const string key, const string value);
string getCurrentCollectionName();
unsigned char getCurrentCollectionVerify();

View File

@ -26,6 +26,7 @@
#include "ssh/pandora_ssh_client.h"
#include "ftp/pandora_ftp_client.h"
#include "misc/pandora_file.h"
#include "misc/sha256.h"
#include "windows/pandora_windows_info.h"
#include "udp_server/udp_server.h"
@ -39,6 +40,8 @@
#include <pandora_agent_conf.h>
#include <fstream>
#include <unistd.h>
#include <sstream>
#include <string>
#define BUFSIZE 4096
@ -207,7 +210,7 @@ void
Pandora_Windows_Service::pandora_init () {
string conf_file, interval, debug, disable_logfile, intensive_interval, util_dir, path, env;
string udp_server_enabled, udp_server_port, udp_server_addr, udp_server_auth_addr;
string name_agent, name;
string agent_name, agent_name_cmd, agent_alias, pandora_agent;
string proxy_mode, server_ip;
string *all_conf;
int pos, num;
@ -255,12 +258,60 @@ Pandora_Windows_Service::pandora_init () {
this->modules = new Pandora_Module_List (conf_file);
delete []all_conf;
name = checkAgentName(conf_file);
if (name.empty ()) {
name = Pandora_Windows_Info::getSystemName ();
// Get the agent name.
agent_name = conf->getValue ("agent_name");
printf("AGENT NAME: %s\n", agent_name.c_str());
if (agent_name == "") {
agent_name_cmd = conf->getValue ("agent_name_cmd");
// Random name.
if (agent_name_cmd == "__rand__") {
agent_name = generateAgentName();
this->conf->setValue("agent_name", agent_name);
conf->updateFile("agent_name", agent_name); // Write random names to disk!
}
// Name from command.
else if (agent_name_cmd != "") {
agent_name_cmd = "cmd.exe /c \"" + agent_name_cmd + "\"";
static string temp_agent_name = getAgentNameFromCmdExec(agent_name_cmd);
// Delete new line and carriage return.
pos = temp_agent_name.find("\n");
if(pos != string::npos) {
temp_agent_name.erase(pos, temp_agent_name.size () - pos);
}
pos = temp_agent_name.find("\r");
if(pos != string::npos) {
temp_agent_name.erase(pos, temp_agent_name.size () - pos);
}
// Remove leading and trailing white spaces.
temp_agent_name = trim(temp_agent_name);
if (temp_agent_name != "") {
agent_name = temp_agent_name;
this->conf->setValue("agent_name", agent_name);
}
}
}
name_agent = "PANDORA_AGENT=" + name;
putenv(name_agent.c_str());
printf("AGENT NAME2: %s\n", agent_name.c_str());
// Fall back to the hostname if agent_name is still empty.
if (agent_name == "") {
agent_name = Pandora_Windows_Info::getSystemName ();
this->conf->setValue("agent_name", agent_name);
}
printf("AGENT NAME3: %s\n", agent_name.c_str());
printf("AGENT NAME4: %s\n", this->conf->getValue("agent_name").c_str());
// Get the agent alias.
conf->getValue ("agent_alias");
if (agent_alias == "") {
agent_alias = Pandora_Windows_Info::getSystemName ();
this->conf->setValue("agent_alias", agent_alias);
}
pandora_agent = "PANDORA_AGENT=" + agent_name;
putenv(pandora_agent.c_str());
debug = conf->getValue ("debug");
setPandoraDebug (is_enabled (debug));
@ -383,7 +434,7 @@ Pandora_Windows_Service::launchTentacleProxy() {
string
Pandora_Windows_Service::getXmlHeader () {
char timestamp[20];
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd;
string agent_name, os_name, os_version, encoding, value, xml, address, parent_agent_name, agent_name_cmd, agent_alias;
string custom_id, url_address, latitude, longitude, altitude, position_description, gis_exec, gis_result, agent_mode;
string group_password, group_id, ehorus_conf;
time_t ctime;
@ -392,30 +443,9 @@ Pandora_Windows_Service::getXmlHeader () {
// Get agent name
agent_name = conf->getValue ("agent_name");
if (agent_name == "") {
agent_name = Pandora_Windows_Info::getSystemName ();
}
agent_name_cmd = conf->getValue ("agent_name_cmd");
if (agent_name_cmd != "") {
agent_name_cmd = "cmd.exe /c \"" + agent_name_cmd + "\"";
static string temp_agent_name = getAgentNameFromCmdExec(agent_name_cmd);
// Delete carriage return if is provided
pos = temp_agent_name.find("\n");
if(pos != string::npos) {
temp_agent_name.erase(pos, temp_agent_name.size () - pos);
}
pos = temp_agent_name.find("\r");
if(pos != string::npos) {
temp_agent_name.erase(pos, temp_agent_name.size () - pos);
}
// Remove white spaces of the first and last.
temp_agent_name = trim(temp_agent_name);
if (temp_agent_name != "") {
agent_name = temp_agent_name;
}
}
// Get agent alias
conf->getValue ("agent_alias");
// Get parent agent name
parent_agent_name = conf->getValue ("parent_agent_name");
@ -443,6 +473,7 @@ Pandora_Windows_Service::getXmlHeader () {
xml = "<?xml version=\"1.0\" encoding=\"" + encoding + "\" ?>\n" +
"<agent_data agent_name=\"" + agent_name +
"\" agent_alias=\"" + agent_alias +
"\" description=\"" + conf->getValue ("description") +
"\" version=\"" + getPandoraAgentVersion ();
@ -1492,35 +1523,8 @@ Pandora_Windows_Service::checkConfig (string file) {
}
/* Get agent name */
tmp = checkAgentName(file);
if (tmp.empty ()) {
tmp = Pandora_Windows_Info::getSystemName ();
}
agent_name = tmp;
tmp = conf->getValue ("agent_name");
/* Get agent name cmd */
tmp = conf->getValue ("agent_name_cmd");
if (!tmp.empty ()) {
tmp = "cmd.exe /c \"" + tmp + "\"";
tmp = getCoordinatesFromCmdExec(tmp);
// Delete carriage return if is provided
pos = tmp.find("\n");
if(pos != string::npos) {
tmp.erase(pos, tmp.size () - pos);
}
pos = tmp.find("\r");
if(pos != string::npos) {
tmp.erase(pos, tmp.size () - pos);
}
// Remove white spaces of the first and last.
tmp = trim (tmp);
if (tmp != "") {
agent_name = tmp;
}
}
/* Error getting agent name */
if (agent_name.empty ()) {
@ -1722,10 +1726,6 @@ Pandora_Windows_Service::sendXml (Pandora_Module_List *modules) {
/* Generate temporal filename */
random_integer = inttostr (rand());
tmp_filename = conf->getValue ("agent_name");
if (tmp_filename == "") {
tmp_filename = Pandora_Windows_Info::getSystemName ();
}
tmp_filename += "." + random_integer + ".data";
xml_filename = conf->getValue ("temporal");
@ -2098,3 +2098,17 @@ Pandora_Windows_Service::getIntensiveInterval () {
return this->intensive_interval;
}
string
Pandora_Windows_Service::generateAgentName () {
stringstream data;
char digest[SHA256_HEX_LENGTH + 1];
std::srand(std::time(0));
data << this->conf->getValue("agent_alias") <<
this->conf->getValue("server_ip") <<
time(NULL) <<
std::rand();
sha256(data.str().c_str(), digest);
return std::string(digest);
}

View File

@ -44,6 +44,7 @@ namespace Pandora {
Pandora_Module_List *modules;
long execution_number;
string agent_name;
string alias;
time_t timestamp;
time_t run_time;
bool started;
@ -117,6 +118,7 @@ namespace Pandora {
string getEHKey (string ehorus_conf);
long getInterval ();
long getIntensiveInterval ();
string generateAgentName ();
};
}

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0dev(Build 170217))"
VALUE "ProductVersion", "(7.0dev(Build 170222))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0dev-170217
Version: 7.0dev-170222
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="7.0dev-170217"
pandora_version="7.0dev-170222"
package_pear=0
package_pandora=1

View File

@ -223,9 +223,10 @@ function mainAgentsAlerts() {
}
foreach ($agents as $agent) {
$alias = db_get_row ('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>';
// Name of the agent
echo '<td style="font-weight:bold;">'.$agent['nombre'].'</td>';
echo '<td style="font-weight:bold;">'.$alias['alias'].'</td>';
// Alerts of the agent
$anyfired = false;

View File

@ -148,19 +148,18 @@ function mainAgentsModules() {
$agents = agents_get_group_agents($group_id);
if ((empty($agents)) || $agents == -1) $agents = array();
$filter_agents_label = '<b>'.__('Agents').'</b>';
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, "min-width: 180px");
$filter_agents = html_print_select($agents, 'id_agents2[]', $agents_id, '', '', 0, true, true, true, '', false, "min-width: 180px; max-width: 200px;");
//type show
$selection = array(0 => __('Show common modules'),
1=> __('Show all modules'));
$filter_type_show_label = '<b>'.__('Show common modules').'</b>';
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', "", 0, true, false, true, '', false, "min-width: 180px");
$filter_type_show = html_print_select($selection, 'selection_agent_module', $selection_a_m, '', "", 0, true, false, true, '', false, "min-width: 180px;");
//modules
$all_modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo WHERE id_agente IN (" . implode(',', array_keys($agents)) . ")");
$all_modules = select_modules_for_agent_group($group_id, $agents_id, $selection_a_m, false);
$filter_modules_label = '<b>'.__('Module').'</b>';
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', __('None'), 0, true, true, true, '', false, "min-width: 180px");
$filter_modules = html_print_select($all_modules, 'module[]', $modules_selected, '', '', 0, true, true, true, '', false, "min-width: 180px; max-width: 200px;");
//update
$filter_update = html_print_submit_button(__('Update item'), 'edit_item', false, 'class="sub upd"', true);
@ -218,35 +217,52 @@ function mainAgentsModules() {
if($agents_id[0] != -1){
$agents = $agents_id;
$all_modules = array();
$total_pagination = count($agents);
foreach ($modules_selected as $key => $value) {
$all_modules[$value] = io_safe_output(modules_get_agentmodule_name($value));
}
}
else {
$agents = '';
$agents = agents_get_group_agents($group_id,array('disabled' => 0));
$agents = array_keys($agents);
$filter_module_group = array('disabled' => 0);
if ($modulegroup > 0) {
$filter_module_group['id_module_group'] = $modulegroup;
}
$count = 0;
foreach ($agents as $agent) {
$module = agents_get_modules($agent, false,
$filter_module_group, true, false);
if ($module == false) {
unset($agents[$count]);
}
$count++;
}
$total_pagination = count($agents);
}
$filter_module_group = array('disabled' => 0);
if ($modulegroup > 0) {
$filter_module_group['id_module_group'] = $modulegroup;
}
$count = 0;
foreach ($agents as $agent) {
$module = agents_get_modules($agent, false,
$filter_module_group, true, true);
if ($module == false) {
unset($agents[$count]);
}
$count++;
}
$total_pagination = count($agents);
if($agents_id[0] != -1){
$all_modules = array();
foreach ($modules_selected as $key => $value) {
//$all_modules[$value] = io_safe_output(modules_get_agentmodule_name($value));
$name = modules_get_agentmodule_name($value);
$sql = "SELECT id_agente_modulo
FROM tagente_modulo
WHERE nombre = '". $name ."';";
$result_sql = db_get_all_rows_sql($sql);
if(is_array($result_sql)){
foreach ($result_sql as $key => $value) {
$all_modules[$value['id_agente_modulo']] = io_safe_output($name);
}
}
}
}
else{
$all_modules = agents_get_modules($agents, false,
$filter_module_group, true, false);
$filter_module_group, true, true);
}
$modules_by_name = array();
@ -369,6 +385,10 @@ function mainAgentsModules() {
foreach ($agents as $agent) {
// Get stats for this group
$agent_status = agents_get_status($agent['id_agente']);
$alias = db_get_row ("tagente", "id_agente", $agent['id_agente']);
if (empty($alias['alias'])){
$alias['alias'] = $agent['nombre'];
}
switch($agent_status) {
case 4: // Alert fired status
@ -394,9 +414,9 @@ function mainAgentsModules() {
echo "<td class='$rowcolor'>
<a class='$rowcolor' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$agent['id_agente']."'>" .
ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') .
$alias['alias'] .
"</a></td>";
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, false);
$agent_modules = agents_get_modules($agent['id_agente'], false, $filter_module_group, true, true);
$nmodules = 0;
@ -408,6 +428,7 @@ function mainAgentsModules() {
}
$match = false;
foreach ($module['id'] as $module_id) {
if (!$match && array_key_exists($module_id,$agent_modules)) {
$status = modules_get_agentmodule_status($module_id);
@ -438,9 +459,14 @@ function mainAgentsModules() {
case AGENT_MODULE_STATUS_UNKNOWN:
ui_print_status_image ('module_unknown.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;
case 4:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
ui_print_status_image ('module_alertsfired.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;
case 4:
ui_print_status_image ('module_no_data.png', modules_get_last_value($module_id), false, array('width' => '20px', 'height' => '20px'));
break;
}
echo '</a>';
echo "</td>";
@ -467,6 +493,7 @@ function mainAgentsModules() {
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module has a warning status") . "</td></tr>";
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module has a normal status") . "</td></tr>";
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module has an unknown status") . "</td></tr>";
echo "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NOTINIT . ";'></div></td><td>" . __("Cell turns grey when the module is in 'not initialize' status") . "</td></tr>";
echo "</table>";
echo "</div>";
@ -563,7 +590,7 @@ extensions_add_main_function('mainAgentsModules');
);
});
$("#id_agents2").change (function(){
$("#id_agents2").click (function(){
selection_agent_module();
});
@ -590,8 +617,6 @@ extensions_add_main_function('mainAgentsModules');
);
});
selection_agent_module();
});
function selection_agent_module() {
@ -614,6 +639,6 @@ extensions_add_main_function('mainAgentsModules');
}
},
"json"
);
);
}
</script>

View File

@ -37,10 +37,12 @@ function createXMLData($agent, $agentModule, $time, $data) {
$xml = sprintf($xmlTemplate, io_safe_output(get_os_name($agent['id_os'])),
io_safe_output($agent['os_version']), $agent['intervalo'],
io_safe_output($agent['agent_version']), $time,
io_safe_output($agent['nombre']), $agent['timezone_offset'],
io_safe_output($agent['nombre']),
io_safe_output($agent['alias']), $agent['timezone_offset'],
io_safe_output($agentModule['nombre']), io_safe_output($agentModule['descripcion']), modules_get_type_name($agentModule['id_tipo_modulo']), $data);
if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['nombre']) . '.' . strtotime($time) . '.data', $xml)) {
if (false === @file_put_contents($config['remote_config'] . '/' . io_safe_output($agent['alias']) . '.' . strtotime($time) . '.data', $xml)) {
return false;
}
else {
@ -61,6 +63,14 @@ function mainInsertData() {
$save = (bool)get_parameter('save', false);
$id_agent = (string)get_parameter('id_agent', '');
foreach ($_POST as $key => $value) {
if(strpos($key,"agent_autocomplete_idagent")!== false){
$id_agente = $value;
}
}
$id_agent_module = (int)get_parameter('id_agent_module', '');
$data = (string)get_parameter('data');
$date = (string) get_parameter('date', date(DATE_FORMAT));
@ -83,7 +93,8 @@ function mainInsertData() {
ui_print_error_message(__('You haven\'t privileges for insert data in the agent.'));
}
else {
$agent = db_get_row_filter('tagente', array('nombre' => $id_agent));
$agent = db_get_row_filter('tagente', array('id_agente' => $id_agente));
$agentModule = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $id_agent_module));
$done = 0;
@ -116,14 +127,14 @@ function mainInsertData() {
}
if ($errors > 0) {
$msg = sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
$msg = sprintf(__('Can\'t save agent (%s), module (%s) data xml.'), $agent['alias'], $agentModule['nombre']);
if ($errors > 1) {
$msg .= " ($errors)";
}
ui_print_error_message($msg);
}
if ($done > 0) {
$msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['nombre'], $agentModule['nombre']);
$msg = sprintf(__('Save agent (%s), module (%s) data xml.'), $agent['alias'], $agentModule['nombre']);
if ($done > 1) {
$msg .= " ($done)";
}
@ -153,14 +164,19 @@ function mainInsertData() {
$params['javascript_is_function_select'] = true;
$params['javascript_name_function_select'] = 'custom_select_function';
$params['javascript_code_function_select'] = '';
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[1][0] = __('Module');
$modules = array ();
if ($id_agent)
$modules = agents_get_modules ($id_agent, false, array("delete_pending" => 0));
if ($id_agente){
$modules = agents_get_modules ($id_agente, false, array("delete_pending" => 0));
}
$table->data[1][1] = html_print_select ($modules, 'id_agent_module', $id_agent_module, true,
__('Select'), 0, true, false, true, '', ($id_agent === ''));
__('Select'), 0, true, false, true, '', ($id_agente === ''));
$table->data[2][0] = __('Data');
$table->data[2][1] = html_print_input_text('data', $data, __('Data'), 40, 60, true);
$table->data[3][0] = __('Date');
@ -206,9 +222,10 @@ function mainInsertData() {
function custom_select_function(agent_name) {
$('#id_agent_module').empty ();
var inputs = [];
inputs.push ("agent_name=" + agent_name);
var id_agent = $('#hidden-autocomplete_id_agent').val();
inputs.push ("id_agent=" + id_agent);
inputs.push ("delete_pending=0");
inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente");

View File

@ -97,12 +97,12 @@ function output_xml_report($id) {
echo "<description>" . io_safe_output($item['description']) . "</description>\n";
echo "<period>" . io_safe_output($item['period']) . "</period>\n";
if ($item['id_agent'] != 0) {
$agent = agents_get_name($item['id_agent']);
$agent = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
}
if ($item['id_agent_module'] != 0) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
$agent = agents_get_name($item['id_agent']);
$agent = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
}
@ -140,7 +140,7 @@ function output_xml_report($id) {
foreach ($slas as $sla) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $sla['id_agent_module']);
$agent = agents_get_name($item['id_agent']);
$agent = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
echo "<sla>";
echo "<agent><![CDATA[" . $agent . "]]></agent>\n";
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
@ -245,8 +245,14 @@ function output_xml_visual_console($id) {
foreach ($items as $item) {
echo "<item>\n";
echo "<other_id>" . $item['id'] . "</other_id>\n"; //OLD ID USE FOR parent item
$agent = '';
if ($item['id_agent'] != 0) {
$agent = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
}
if (!empty($item['label'])) {
echo "<label><![CDATA[" . io_safe_output($item['label']) . "]]></label>\n";
$aux = explode("-",$item['label']);
$label = $agent .' -'. $aux[1];
echo "<label><![CDATA[" . io_safe_output($label) . "]]></label>\n";
}
echo "<x>" . $item['pos_x'] . "</x>\n";
echo "<y>" . $item['pos_y'] . "</y>\n";
@ -263,15 +269,11 @@ function output_xml_visual_console($id) {
if ($item['period'] != 0) {
echo "<period>" . $item['period'] . "</period>\n";
}
$agent = '';
if ($item['id_agent'] != 0) {
$agent = agents_get_name($item['id_agent']);
}
if (isset($item['id_agente_modulo'])) {
if ($item['id_agente_modulo'] != 0) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
$agent = agents_get_name($id_agent);
$agent = db_get_value ("alias","tagente","id_agente",$id_agent);
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
}

View File

@ -157,7 +157,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 0);
UPDATE tconfig SET value = 'https://firefly.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
-- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
@ -219,7 +219,9 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsign
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 '');
UPDATE tagente SET tagente.alias = tagente.nombre;
-- ---------------------------------------------------------------------
-- Table `tlayout`
-- ---------------------------------------------------------------------

View File

@ -80,7 +80,7 @@ INSERT INTO tconfig (token, value) VALUES ('big_operation_step_datos_purge', '10
INSERT INTO tconfig (token, value) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO tconfig (token, value) VALUES ('days_autodisable_deletion', '30');
INSERT INTO tconfig (token, value) VALUES ('MR', 0);
UPDATE tconfig SET value = 'https://firefly.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
-- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents`
@ -134,7 +134,9 @@ ALTER TABLE tnetwork_component ADD COLUMN dynamic_two_tailed tinyint(1) unsigned
ALTER TABLE tagente ADD transactional_agent tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD remoteto tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD cascade_protection_module int(10) unsigned default '0';
ALTER TABLE tagente ADD COLUMN (alias VARCHAR2(600) not null DEFAULT '');
UPDATE `tagente` SET tagente.alias = tagente.nombre;
-- ---------------------------------------------------------------------
-- Table `tlayout`
-- ---------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ require_once ("include/functions_reporting.php");
require_once ("include/functions_tactical.php");
require_once ($config["homedir"] . '/include/functions_graph.php');
ui_print_page_header (__('Welcome to Pandora FMS Web Console'),'',false,"",false);
//ui_print_page_header (__('Welcome to Pandora FMS Web Console'),'',false,"",false);
if (tags_has_user_acl_tags()) {
ui_print_tags_warning();

View File

@ -32,12 +32,12 @@ require_once ("../include/functions_html.php");
$id = get_parameter ('id');
if (! isset($_SESSION[$config['homeurl_static']]['id_usuario'])) {
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
}
$user_language = get_user_language ($_SESSION[$config['homeurl_static']]['id_usuario']);
$user_language = get_user_language ($_SESSION['id_usuario']);
if (file_exists ('../include/languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('../include/languages/'.$user_language.'.mo'));

View File

@ -30,10 +30,10 @@ if (is_ajax ()) {
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%' . $string . '%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%' . $string . '%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%" OR alias LIKE "%'.$string.'%")';
break;
case "oracle":
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\'))';
$filter[] = '(upper(nombre) LIKE upper(\'%'.$string.'%\') OR upper(direccion) LIKE upper(\'%'.$string.'%\') OR upper(comentarios) LIKE upper(\'%'.$string.'%\') OR upper(alias) LIKE upper(\'%'.$string.'%\'))';
break;
}
$filter[] = 'id_agente != ' . $id_agent;
@ -151,21 +151,26 @@ $table->data = array ();
$table->align[2] = 'center';
$table->data[0][0] = __('Agent name') .
ui_print_help_tip (__("The agent's name must be the same as the one defined at the console"), true);
$table->data[0][1] = html_print_input_text ('agente', $nombre_agente, '', 50, 100,true);
if(!$new_agent && $alias != ''){
$table->data[0][0] = __('Agent name') .
ui_print_help_tip (__("The agent's name must be the same as the one defined at the console"), true);
$table->data[0][1] = html_print_input_text ('agente', $nombre_agente, '', 50, 100,true);
$table->data[0][2] = __('QR Code Agent view');
$table->data[0][2] = __('QR Code Agent view');
if ($id_agente) {
$table->data[0][1] .= "&nbsp;<b>" . __("ID") . "</b>&nbsp; $id_agente &nbsp;";
$table->data[0][1] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">';
$table->data[0][1] .= html_print_image ("images/zoom.png",
true, array ("border" => 0, "title" => __('Agent detail')));
$table->data[0][1] .= '</a>';
if ($id_agente) {
$table->data[0][1] .= "&nbsp;<b>" . __("ID") . "</b>&nbsp; $id_agente &nbsp;";
$table->data[0][1] .= '&nbsp;&nbsp;<a href="index.php?sec=gagente&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agente.'">';
$table->data[0][1] .= html_print_image ("images/zoom.png",
true, array ("border" => 0, "title" => __('Agent detail')));
$table->data[0][1] .= '</a>';
}
}
// Remote configuration available
if (!$new_agent) {
if (isset($filename)) {
@ -197,17 +202,21 @@ if (!$new_agent) {
if (!$new_agent) {
$table->data[0][1] .= "&nbsp;&nbsp;<span align='right'><a onClick=\"if (!confirm('" . __('Are you sure?') . "')) return false;\" href='index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&borrar_agente=$id_agente&search=&offset=0&sort_field=&sort=none'>" . html_print_image('images/cross.png', true, array('title' => __("Delete agent"))) . "</a>";
}
$table->data[1][0] = __('Alias');
$table->data[1][1] = html_print_input_text ('alias', $alias, '', 50, 100, true);
$table->data[1][0] = __('IP Address');
$table->data[1][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true);
$table->data[2][0] = __('IP Address');
$table->data[2][1] = html_print_input_text ('direccion', $direccion_agente, '', 16, 100, true);
if ($id_agente) {
$table->data[1][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data[2][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$ip_all = agents_get_addresses ($id_agente);
$table->data[1][1] .= html_print_select ($ip_all, "address_list", $direccion_agente, '', '', 0, true);
$table->data[1][1] .= "&nbsp;". html_print_checkbox ("delete_ip", 1, false, true).__('Delete selected');
$table->data[2][1] .= html_print_select ($ip_all, "address_list", $direccion_agente, '', '', 0, true);
$table->data[2][1] .= "&nbsp;". html_print_checkbox ("delete_ip", 1, false, true).__('Delete selected');
}
?>
@ -217,77 +226,83 @@ if ($id_agente) {
}
</style>
<?php
$table->rowspan[1][2] = 3;
if ($id_agente) {
$table->data[1][2] =
"<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" .
ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente) . "\" );'></a>";
}
else {
$table->data[1][2] = __("Only it is show when<br />the agent is saved.");
if(!$new_agent){
$table->rowspan[2][2] = 3;
if ($id_agente) {
$table->data[2][2] =
"<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" .
ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente) . "\" );'></a>";
}
else {
$table->data[2][2] = __("Only it is show when<br />the agent is saved.");
}
}
$groups = users_get_groups ($config["id_user"], "AR",false);
$agents = agents_get_group_agents (array_keys ($groups));
$modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = " . $id_parent);
$modules_values = array();
$modules_values[0] = __('Any');
foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
$table->data[2][0] = __('Parent');
$table->data[3][0] = __('Parent');
$params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
$params['value'] = agents_get_name ($id_parent);
$table->data[2][1] = ui_print_agent_autocomplete_input($params);
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$table->data[3][1] = ui_print_agent_autocomplete_input($params);
$table->data[2][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[2][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
$table->data[3][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
$table->data[3][0] = __('Group');
$table->data[3][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
$table->data[3][1] .= ' <span id="group_preview">';
$table->data[3][1] .= ui_print_group_icon ($grupo, true);
$table->data[3][1] .= '</span>';
$table->data[4][0] = __('Group');
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
$table->data[4][1] .= ' <span id="group_preview">';
$table->data[4][1] .= ui_print_group_icon ($grupo, true);
$table->data[4][1] .= '</span>';
$table->data[4][0] = __('Interval');
$table->data[5][0] = __('Interval');
$table->data[4][1] = html_print_extended_select_for_time ('intervalo', $intervalo, '', '', '0', 10, true);
$table->data[5][1] = html_print_extended_select_for_time ('intervalo', $intervalo, '', '', '0', 10, true);
if ($intervalo < SECONDS_5MINUTES) {
$table->data[4][1] .= clippy_context_help("interval_agent_min");
$table->data[5][1] .= clippy_context_help("interval_agent_min");
}
$table->data[5][0] = __('OS');
$table->data[5][1] = html_print_select_from_sql ('SELECT id_os, name FROM tconfig_os',
$table->data[6][0] = __('OS');
$table->data[6][1] = html_print_select_from_sql ('SELECT id_os, name FROM tconfig_os',
'id_os', $id_os, '', '', '0', true);
$table->data[5][1] .= ' <span id="os_preview">';
$table->data[5][1] .= ui_print_os_icon ($id_os, false, true);
$table->data[5][1] .= '</span>';
$table->data[6][1] .= ' <span id="os_preview">';
$table->data[6][1] .= ui_print_os_icon ($id_os, false, true);
$table->data[6][1] .= '</span>';
// Network server
$servers = servers_get_names();
if (!array_key_exists($server_name, $servers)) {
$server_Name = 0; //Set the agent have not server.
}
$table->data[6][0] = __('Server');
$table->data[7][0] = __('Server');
if ($new_agent) {
//Set first server by default.
$servers_get_names = servers_get_names();
$array_keys_servers_get_names = array_keys($servers_get_names);
$server_name = reset($array_keys_servers_get_names);
}
$table->data[6][1] = html_print_select (servers_get_names (),
$table->data[7][1] = html_print_select (servers_get_names (),
'server_name', $server_name, '', __('None'), 0, true). ' ' . ui_print_help_icon ('agent_server', true);
// Description
$table->data[7][0] = __('Description');
$table->data[7][1] = html_print_input_text ('comentarios', $comentarios,
$table->data[8][0] = __('Description');
$table->data[8][1] = html_print_input_text ('comentarios', $comentarios,
'', 45, 200, true);
html_print_table ($table);
@ -593,5 +608,7 @@ ui_require_jquery_file('bgiframe');
echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente);
?>",
"#qr_code_agent_view", 128, 128);
$("#text-agente").prop('disabled', true);
});
</script>

View File

@ -73,6 +73,7 @@ $campo_3 = "";
$maximo = 0;
$minimo = 0;
$nombre_agente = "";
$alias = get_parameter('alias', '');
$direccion_agente = get_parameter('direccion', '');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
@ -147,10 +148,11 @@ $module_macros = array ();
// Create agent
if ($create_agent) {
$nombre_agente = (string) get_parameter_post("agente",'');
$alias = (string) get_parameter_post("alias",'');
$direccion_agente = (string) get_parameter_post("direccion",'');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
$nombre_agente = hash("sha256",$alias . "|" .$direccion_agente ."|". time() ."|". sprintf("%04d", rand(0,10000)));
$grupo = (int) get_parameter_post ("grupo");
$intervalo = (string) get_parameter_post ("intervalo", SECONDS_5MINUTES);
$comentarios = (string) get_parameter_post ("comentarios", '');
@ -179,18 +181,19 @@ if ($create_agent) {
}
// Check if agent exists (BUG WC-50518-2)
if ($nombre_agente == "") {
$agent_creation_error = __('No agent name specified');
if ($alias == "") {
$agent_creation_error = __('No agent alias specified');
$agent_created_ok = 0;
}
elseif (agents_get_agent_id ($nombre_agente)) {
/*elseif (agents_get_agent_id ($nombre_agente)) {
$agent_creation_error =
__('There is already an agent in the database with this name');
$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,
@ -241,7 +244,7 @@ if ($create_agent) {
' Quiet: ' . (int)$quiet;
db_pandora_audit("Agent management",
"Created agent $nombre_agente", false, true, $info);
"Created agent $alias", false, true, $info);
}
else {
$id_agente = 0;
@ -554,10 +557,9 @@ if ($id_agente) {
default:
break;
}
ui_print_page_header (
agents_get_name ($id_agente) . ' ' . $tab_description,
"images/setup.png", false, $help_header , true, $onheader);
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
ui_print_page_header ($agent["nombre"],
"images/setup.png", false, $help_header , true, $onheader, false, '', GENERIC_SIZE_TEXT, $agent["alias"] . ' ' . $tab_description);
}
else {
// Create agent
@ -641,6 +643,7 @@ $update_agent = (bool) get_parameter ('update_agent');
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", ""));
$direccion_agente = (string) get_parameter_post ("direccion", '');
$direccion_agente = trim(io_safe_output($direccion_agente));
$direccion_agente = io_safe_input($direccion_agente);
@ -705,14 +708,14 @@ if ($update_agent) { // if modified some agent paramenter
}
//Verify if there is another agent with the same name but different ID
if ($nombre_agente == "") {
ui_print_error_message(__('No agent name specified'));
if ($alias == "") {
ui_print_error_message(__('No agent alias specified'));
//If there is an agent with the same name, but a different ID
}
elseif (agents_get_agent_id ($nombre_agente) > 0 &&
/*elseif (agents_get_agent_id ($nombre_agente) > 0 &&
agents_get_agent_id ($nombre_agente) != $id_agente) {
ui_print_error_message(__('There is already an agent in the database with this name'));
}
}*/
else {
//If different IP is specified than previous, add the IP
if ($direccion_agente != '' &&
@ -732,7 +735,7 @@ if ($update_agent) { // if modified some agent paramenter
'id_parent' => $id_parent,
'id_os' => $id_os,
'modo' => $modo,
'nombre' => $nombre_agente,
'alias' => $alias,
'direccion' => $direccion_agente,
'id_grupo' => $grupo,
'intervalo' => $intervalo,
@ -778,8 +781,8 @@ if ($update_agent) { // if modified some agent paramenter
enterprise_hook ('update_agent', array ($id_agente));
ui_print_success_message (__('Successfully updated'));
db_pandora_audit("Agent management",
"Updated agent $nombre_agente", false, false, $info);
"Updated agent $alias", false, false, $info);
}
}
}
@ -804,6 +807,12 @@ if ($id_agente) {
$intervalo = $agent["intervalo"]; // Define interval in seconds
$nombre_agente = $agent["nombre"];
if(empty($alias)){
$alias = $agent["alias"];
if(empty($alias)){
$alias = $nombre_agente;
}
}
$direccion_agente = $agent["direccion"];
$grupo = $agent["id_grupo"];
$ultima_act = $agent["ultimo_contacto"];
@ -1075,7 +1084,7 @@ if ($update_module || $create_module) {
$throw_unknown_events = (bool)get_parameter('throw_unknown_events', false);
//Set the event type that can show.
$disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)!$throw_unknown_events);
$disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)$throw_unknown_events);
$disabled_types_event = io_json_mb_encode($disabled_types_event);
$module_macro_names = (array) get_parameter('module_macro_names', array());
@ -1200,7 +1209,7 @@ if ($update_module) {
$edit_module = true;
db_pandora_audit("Agent management",
"Fail to try update module '$name' for agent " . $agent["nombre"]);
"Fail to try update module '$name' for agent " . $agent["alias"]);
}
else {
if ($prediction_module == 3) {
@ -1218,7 +1227,7 @@ if ($update_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Updated module '$name' for agent ".$agent["nombre"], false, false, io_json_mb_encode($values));
"Updated module '$name' for agent ".$agent["alias"], false, false, io_json_mb_encode($values));
}
}
@ -1336,7 +1345,7 @@ if ($create_module) {
$edit_module = true;
$moduletype = $id_module;
db_pandora_audit("Agent management",
"Fail to try added module '$name' for agent ".$agent["nombre"]);
"Fail to try added module '$name' for agent ".$agent["alias"]);
}
else {
if ($prediction_module == 3) {
@ -1354,7 +1363,7 @@ if ($create_module) {
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Added module '$name' for agent ".$agent["nombre"], false, true, io_json_mb_encode($values));
"Added module '$name' for agent ".$agent["alias"], false, true, io_json_mb_encode($values));
}
}
@ -1471,7 +1480,7 @@ if ($delete_module) { // DELETE agent module !
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
db_pandora_audit("Agent management",
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["nombre"]);
"Deleted module '".$module_data["nombre"]."' for agent ".$agent["alias"]);
}
}
@ -1502,11 +1511,11 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
if ($result) {
db_pandora_audit("Agent management",
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"] . " with the new id for clon " . $result);
"Duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"] . " with the new id for clon " . $result);
}
else {
db_pandora_audit("Agent management",
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["nombre"]);
"Fail to try duplicate module '".$id_duplicate_module."' for agent " . $agent["alias"]);
}
}

View File

@ -215,14 +215,14 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'nombre ' . $order_collation,
'field2' => 'nombre ' . $order_collation,
$order = array('field' => 'alias ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'nombre ' . $order_collation,
'field2' => 'nombre ' . $order_collation,
$order = array('field' => 'alias ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'DESC');
break;
}
@ -232,13 +232,13 @@ switch ($sortField) {
case 'up':
$selectOsUp = $selected;
$order = array('field' => 'id_os',
'field2' => 'nombre ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'ASC');
break;
case 'down':
$selectOsDown = $selected;
$order = array('field' => 'id_os',
'field2' => 'nombre ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'DESC');
break;
}
@ -248,13 +248,13 @@ switch ($sortField) {
case 'up':
$selectGroupUp = $selected;
$order = array('field' => 'id_grupo',
'field2' => 'nombre ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'ASC');
break;
case 'down':
$selectGroupDown = $selected;
$order = array('field' => 'id_grupo',
'field2' => 'nombre ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'DESC');
break;
}
@ -266,8 +266,8 @@ switch ($sortField) {
$selectOsDown = '';
$selectGroupUp = '';
$selectGroupDown = '';
$order = array('field' => 'nombre ' . $order_collation,
'field2' => 'nombre ' . $order_collation,
$order = array('field' => 'alias ' . $order_collation,
'field2' => 'alias ' . $order_collation,
'order' => 'ASC');
break;
}
@ -292,8 +292,9 @@ if ($search != "") {
}
$search_sql .= ")";
}else{
$search_sql = " AND ( LOWER(nombre) " . $order_collation . "
LIKE LOWER('%$search%')) ";
$search_sql = " AND ( nombre " . $order_collation . "
LIKE '%$search%' OR alias " . $order_collation . "
LIKE '%$search%') ";
}
}
@ -386,7 +387,7 @@ else {
FROM tagente
WHERE 1=1
%s
ORDER BY %s %s %s LIMIT %d OFFSET %d', $search_sql, $order['field'], $order['field2'],
ORDER BY %s %s, %s %s LIMIT %d OFFSET %d', $search_sql, $order['field'],$order['order'], $order['field2'],
$order['order'], $config["block_size"], $offset);
break;
case "oracle":
@ -397,7 +398,7 @@ else {
FROM tagente
WHERE 1=1
%s
ORDER BY %s %s %s', $search_sql, $order['field'], $order['field2'], $order['order']);
ORDER BY %s %s, %s %s', $search_sql, $order['field'],$order['order'], $order['field2'], $order['order']);
$sql = oracle_recode_query ($sql, $set);
break;
}
@ -547,11 +548,14 @@ if ($agents !== false) {
else {
$main_tab = 'module';
}
echo "<a href='index.php?sec=gagente&
if($agent["alias"] == ''){
$agent["alias"] = $agent["nombre"];
}
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=" . $agent["id_agente"] . "'>" .
ui_print_truncate_text($agent["nombre"], 'agent_medium', true, true, true, '[&hellip;]', 'font-size: 7pt') .
'<span style="font-size: 7pt" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
"</a>";
echo "</strong>";
if ($agent["disabled"]) {

View File

@ -672,7 +672,7 @@ if ($id_downtime > 0) {
}
$sql = sprintf("SELECT tagente.id_agente, tagente.nombre
$sql = sprintf("SELECT tagente.id_agente, tagente.alias
FROM tagente
WHERE tagente.id_agente NOT IN (
SELECT tagente.id_agente
@ -687,7 +687,7 @@ if ($id_downtime > 0) {
$agents = array();
$agent_ids = extract_column($agents, 'id_agente');
$agent_names = extract_column($agents, 'nombre');
$agent_names = extract_column($agents, 'alias');
// item[<id>] = <name>;
$agents = array_combine($agent_ids, $agent_names);
if ($agents === false)
@ -765,7 +765,8 @@ if ($id_downtime > 0) {
foreach ($downtimes_agents as $downtime_agent) {
$data = array ();
$data[0] = $downtime_agent['nombre'];
$alias = db_get_value("alias","tagente","id_agente",$downtime_agent['id_agente']);
$data[0] = $alias;
$data[1] = db_get_sql ("SELECT nombre
FROM tgrupo

View File

@ -150,7 +150,7 @@ if (!empty($downtimes)) {
$affected_items = array();
$sql_agents = "SELECT tpda.id_agent AS agent_id, tpda.all_modules AS all_modules, ta.nombre AS agent_name
$sql_agents = "SELECT tpda.id_agent AS agent_id, tpda.all_modules AS all_modules, ta.nombre AS agent_name, ta.alias
FROM tplanned_downtime_agents tpda, tagente ta
WHERE tpda.id_downtime = $id
AND tpda.id_agent = ta.id_agente";
@ -159,7 +159,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) {
$downtime_items = array();
$downtime_items[] = $downtime_agent['agent_name'];
$downtime_items[] = $downtime_agent[alias];
if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id'];

View File

@ -189,12 +189,12 @@ if ($searchFlag) {
case "postgresql":
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
WHERE t1.nombre LIKE '" . trim($agentName) . "')";
WHERE t1.alias LIKE '" . trim($agentName) . "')";
break;
case "oracle":
$where .= " AND id_agent_module IN (SELECT t2.id_agente_modulo
FROM tagente t1 INNER JOIN tagente_modulo t2 ON t1.id_agente = t2.id_agente
WHERE t1.nombre LIKE '" . trim($agentName) . "')";
WHERE t1.alias LIKE '" . trim($agentName) . "')";
break;
}
}
@ -459,8 +459,8 @@ foreach ($simple_alerts as $alert) {
if ($alert['disabled'])
$data[0] .= '<span style="font-style: italic; color: #aaaaaa;">';
$agent_name = agents_get_name ($id_agent);
$data[0] .= ui_print_truncate_text($agent_name, 'agent_small', false, true, true, '[&hellip;]', 'display:block;font-size: 7.2pt');
$alias = db_get_value ("alias","tagente","id_agente",$id_agent);
$data[0] .= $alias;
if ($alert['disabled'])
$data[0] .= '</span>';

View File

@ -554,7 +554,7 @@ if ($step == 2) {
$table->data[3][1] = html_print_input_text ('min_alerts',
$min_alerts, '', 5, 7, true);
$table->data[3][2] = __('Reset counter when alert is not continuously') . ui_print_help_tip(__('Enable this option if you want to reset the counter for minimum number of alerts when the alert state is not continuously even if it\'s in the time threshold.'), true);;
$table->data[3][2] = __('Reset counter for non-sustained alerts') . ui_print_help_tip(__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'), true);
$table->data[3][3] = html_print_checkbox ('min_alerts_reset_counter', 1, $min_alerts_reset_counter, true);
$table->data[4][0] = __('Max. number of alerts');
@ -585,7 +585,7 @@ if ($step == 2) {
'default_action', $default_action, '', __('None'), 0,
true, false, false, false, false, false, 0) .
ui_print_help_tip (
__('In case you fill any Field 1, Field 2 or Field 3 above, those will replace the corresponding fields of this associated "Default action".'), true);
__('Unless they\'re left blank, the fields from the action will override those set on the template.'), true);
$table->data[6][0] = __('Condition type');
$table->data[6][1] = html_print_select (alerts_get_alert_templates_types (), 'type',

View File

@ -57,6 +57,7 @@ if ($id) {
$search = $filter['search'];
$text_agent = $filter['text_agent'];
$id_agent = $filter['id_agent'];
$text_module = $filter['text_module'];
$id_agent_module = $filter['id_agent_module'];
$pagination = $filter['pagination'];
$event_view_hr = $filter['event_view_hr'];
@ -76,13 +77,13 @@ if ($id) {
$filter_only_alert = $filter['filter_only_alert'];
if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
$text_module = modules_get_agentmodule_name($id_agent_module);
if ($text_module == false) {
$text_module = '';
}
}
if ($id_agent != 0) {
$text_agent = db_get_value('nombre', 'tagente', 'id_agente', $id_agent);
$text_agent = agents_get_alias($id_agent);
if ($text_agent == false) {
$text_agent = '';
}
@ -111,7 +112,7 @@ else {
$filter_only_alert = '';
}
if($update || $create) {
if ($update || $create) {
$id_group = (string) get_parameter ('id_group');
$id_group_filter = get_parameter('id_group_filter');
$id_name = (string) get_parameter ('id_name');
@ -120,8 +121,9 @@ if($update || $create) {
$status = get_parameter('status', '');
$search = get_parameter('search', '');
$text_agent = get_parameter('text_agent', '');
$id_agent_module = get_parameter('module_search_hidden', '');
$id_agent = get_parameter('id_agent', '');
$id_agent = (int) get_parameter('id_agent');
$text_module = get_parameter('text_module', '');
$id_agent_module = (int) get_parameter('module_search_hidden');
$pagination = get_parameter('pagination', '');
$event_view_hr = get_parameter('event_view_hr', '');
$id_user_ack = get_parameter('id_user_ack', '');
@ -383,10 +385,9 @@ $table->data[20][1] = html_print_select(
"filter_only_alert", $filter_only_alert, '', '', '', true);
if (!is_metaconsole()) {
echo $id_agent_module;
$table->data[21][0] = '<b>' . __('Module search') . '</b>';
$table->data[21][1] .= html_print_autocomplete_modules('module_search',
$text_module, false, $id_agent_module, true, '', array(), true);
$text_module, false, true, '', array(), true, $id_agent_module);
}
echo '<form method="post" action="index.php?sec=geventos&sec2=godmode/events/events&section=edit_filter&pure='.$config['pure'].'">';

View File

@ -147,28 +147,26 @@ foreach ($filters as $filter) {
href='index.php?sec=geventos&sec2=godmode/events/events&section=filter&delete=1&id=".$filter['id_filter']."&offset=0&pure=".$config['pure']."'>" .
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
html_print_checkbox_extended ('delete_multiple[]', $filter['id_filter'], false, false, '', 'class="check_delete"', true);
array_push ($table->data, $data);
}
if (isset($data)) {
html_print_table ($table);
echo "<form method='post' action='index.php?sec=geventos&sec2=godmode/events/events&amp;pure=".$config['pure']."'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table ($table);
if(!is_metaconsole())
echo "<div style='padding-bottom: 20px; text-align: right;'>";
else
echo "<div style='float:right; '>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}
else {
ui_print_info_message ( array('no_close'=>true, 'message'=> __('There are no defined filters') ) );
}
if (isset($data)) {
echo "<form method='post' action='index.php?sec=geventos&sec2=godmode/events/events&amp;pure=".$config['pure']."'>";
html_print_input_hidden('multiple_delete', 1);
if(!is_metaconsole())
echo "<div style='padding-bottom: 20px; text-align: right;'>";
else
echo "<div style='float:right; '>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}
if(!defined("METACONSOLE"))
echo "<div style='padding-bottom: 20px; text-align: right; width:100%;'>";
else
@ -181,11 +179,11 @@ echo "</div>";
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) {
$(".check_delete").attr('checked', true);
if ($("#checkbox-all_delete").prop("checked")) {
$(".check_delete").prop('checked', true);
}
else {
$(".check_delete").attr('checked', false);
$(".check_delete").prop('checked', false);
}
}
</script>

View File

@ -49,13 +49,13 @@ if (is_ajax ()) {
$agents_alerts = array();
foreach( $groups as $group ) {
$agents_alerts_one_group = alerts_get_agents_with_alert_template ($id_alert_template, $group,
false, array ('tagente.nombre', 'tagente.id_agente'));
false, array ('tagente.alias', 'tagente.id_agente'));
if (is_array($agents_alerts_one_group)) {
$agents_alerts = array_merge($agents_alerts, $agents_alerts_one_group);
}
}
$agents = index_array ($agents_alerts, 'id_agente', 'nombre');
$agents = index_array ($agents_alerts, 'id_agente', 'alias');
asort($agents);
@ -220,8 +220,9 @@ $table->data[2][0] .= '<span id="agent_loading" class="invisible">';
$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.nombre', 'tagente.id_agente'));
$table->data[2][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
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');
$table->data[2][2] .= '<br>';

View File

@ -39,10 +39,10 @@ if (is_ajax ()) {
$agents_modules = modules_get_agents_with_module_name ($module_name, $id_group,
array ('delete_pending' => 0,
'tagente_modulo.disabled' => 0),
array ('tagente.id_agente', 'tagente.nombre'),
array ('tagente.id_agente', 'tagente.alias'),
$recursion);
echo json_encode (index_array ($agents_modules, 'id_agente', 'nombre'));
echo json_encode (index_array ($agents_modules, 'id_agente', 'alias'));
return;
}
return;
@ -394,9 +394,9 @@ $table->style[2] = 'font-weight: bold';
$table->data['selection_mode'][0] = __('Selection mode');
$table->data['selection_mode'][1] = __('Select modules first') . ' ' .
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
$table->data['selection_mode'][1] .= __('Select agents first') . ' ' .
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
@ -702,7 +702,7 @@ $(document).ready (function () {
option = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["nombre"]);
.html (value["alias"]);
$("#id_agents").append (option);
});
},
@ -729,6 +729,12 @@ $(document).ready (function () {
}
});
if("<?php echo $delete ?>"){
if("<?php echo $selection_mode ?>" == 'agents'){
$("#groups_select").trigger("change");
}
}
$("#status_module").change(function() {
selector = $("#form_modules input[name=selection_mode]:checked").val();
if(selector == 'agents') {

View File

@ -59,7 +59,7 @@ if ($update_agents) {
if (get_parameter ('id_os', '') != -1)
$values['id_os'] = get_parameter ('id_os');
if (get_parameter ('id_parent', '') != '')
$values['id_parent'] = agents_get_agent_id(get_parameter('id_parent'));
$values['id_parent'] = get_parameter('id_agent_parent', 0);
if (get_parameter ('server_name', '') != -1)
$values['server_name'] = get_parameter ('server_name');
if (get_parameter ('description', '') != '')
@ -282,7 +282,10 @@ $params = array();
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
$params['value'] = agents_get_name ($id_parent);
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][1] .= "<b>" . __('Cascade protection'). "</b>&nbsp;" .

View File

@ -237,9 +237,9 @@ $table->data = array ();
$table->data['selection_mode'][0] = __('Selection mode');
$table->data['selection_mode'][1] = __('Select modules first') . ' ' .
$table->data['selection_mode'][1] = '<span style="width:110px;display:inline-block;">'.__('Select modules first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'modules', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true).'<br>';
$table->data['selection_mode'][1] .= __('Select agents first') . ' ' .
$table->data['selection_mode'][1] .= '<span style="width:110px;display:inline-block;">'.__('Select agents first ') . '</span>' .
html_print_radio_button_extended ("selection_mode", 'agents', '', $selection_mode, false, '', 'style="margin-right: 40px;"', true);
@ -1010,7 +1010,7 @@ $(document).ready (function () {
option = $("<option></option>")
.attr("value", value["id_agente"])
.html(value["nombre"]);
.html(value["alias"]);
$("#id_agents").append (option);
});
},
@ -1023,6 +1023,13 @@ $(document).ready (function () {
$("#groups_select").trigger("change");
});
if("<?php echo $update ?>"){
if("<?php echo $selection_mode ?>" == 'agents'){
$("#groups_select").trigger("change");
}
}
$("#status_module").change(function() {
selector = $("#form_edit input[name=selection_mode]:checked").val();
@ -1033,6 +1040,7 @@ $(document).ready (function () {
$("#module_type").trigger("change");
}
});
});
function disabled_status () {

View File

@ -49,8 +49,8 @@ if (is_ajax ()) {
$disabled = (int) get_parameter ('disabled');
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false,
array('order' => 'tagente.nombre, talert_template_modules.disabled', 'talert_template_modules.disabled' => $disabled),
array ('CONCAT(tagente.nombre, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
array('order' => 'tagente.alias, talert_template_modules.disabled', 'talert_template_modules.disabled' => $disabled),
array ('CONCAT(tagente.alias, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
'talert_template_modules.id as template_module_id'), $id_agents);
echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name'));
@ -156,8 +156,8 @@ $table->data[3][0] .= '<span id="alerts_loading" class="invisible">';
$table->data[3][0] .= html_print_image("images/spinner.png", true);
$table->data[3][0] .= '</span>';
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
false, array ('tagente.alias', 'tagente.id_agente'));
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'alias'),
'id_enabled_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);
$table->data[4][0] = __('Action');

View File

@ -49,8 +49,8 @@ if (is_ajax ()) {
$standby = (int) get_parameter ('standby');
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false,
array('order' => 'tagente.nombre, talert_template_modules.standby', 'talert_template_modules.standby' => $standby),
array ('CONCAT(tagente.nombre, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
array('order' => 'tagente.alias, talert_template_modules.standby', 'talert_template_modules.standby' => $standby),
array ('CONCAT(tagente.alias, " - ", tagente_modulo.nombre) as agent_agentmodule_name',
'talert_template_modules.id as template_module_id'), $id_agents);
echo json_encode (index_array ($agents_alerts, 'template_module_id', 'agent_agentmodule_name'));
@ -156,8 +156,8 @@ $table->data[3][0] .= '<span id="alerts_loading" class="invisible">';
$table->data[3][0] .= html_print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
false, array ('tagente.alias', 'tagente.id_agente'));
$table->data[3][1] = html_print_select (index_array ($agents_alerts, 'id_agente', 'alias'),
'id_not_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);
$table->data[4][0] = __('Action');
@ -172,7 +172,7 @@ $table->data[5][0] = __('Standby alerts').ui_print_help_tip(__('Format').":<br>
$table->data[5][0] .= '<span id="alerts_loading2" class="invisible">';
$table->data[5][0] .= html_print_image('images/spinner.png', true);
$table->data[5][0] .= '</span>';
$table->data[5][1] = html_print_select (index_array ($agents_alerts, 'id_agente2', 'nombre'),
$table->data[5][1] = html_print_select (index_array ($agents_alerts, 'id_agente2', 'alias'),
'id_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);
$table->data[5][1] .= '</form>';

View File

@ -41,7 +41,7 @@ if (isset ($_GET["get_agent"])) {
if ($editGraph) {
$graphRows = db_get_all_rows_sql("SELECT t1.*,
(SELECT t3.nombre
(SELECT t3.alias
FROM tagente t3
WHERE t3.id_agente =
(SELECT t2.id_agente
@ -149,7 +149,7 @@ echo "<td style='vertical-align: top;'>".__('Modules')."</td>";
echo "</tr><tr>";
echo "<td>".html_print_select (agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, '')."</td>";
echo "<td style='vertical-align: center; text-align: center;'>" . html_print_image("images/darrowright.png", true) . "</td>";
echo "<td>".html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:300px;')."</td>";
echo "<td>".html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, '')."</td>";
echo "</tr><tr>";
echo "<td colspan='3'>";
echo "<table cellpadding='4'><tr>";

View File

@ -174,7 +174,7 @@ echo "</div>";
echo "</div></td>";
echo "<tr><td class='datos2'><b>".__('Type of graph')."</b></td>";
echo "<tr><td class='datos2'><b>".__('Percentil')."</b></td>";
echo "<td class='datos2'>" . html_print_checkbox ("percentil", 1, $percentil, true) . "</td></tr>";
echo "</table>";

View File

@ -142,6 +142,7 @@ switch ($action) {
case 'general':
case 'network_interfaces_report':
case 'availability':
case 'event_report_log':
case 'availability_graph':
case 'agent_module':
$get_data_editor = true;
@ -193,7 +194,9 @@ switch ($action) {
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
break;
case 'event_report_log':
$period = $item['period'];
$description = $item['description'];
case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
$percentil = isset($style['percentil']) ? $config['percentil'] : 0;
@ -569,6 +572,7 @@ switch ($action) {
case 'MTBF':
case 'MTTR':
case 'simple_baseline_graph':
case 'event_report_log':
$label = (isset($style['label'])) ? $style['label'] : '';
break;
default:
@ -632,7 +636,12 @@ You can of course remove the warnings, that's why we include the source and do n
echo '<input type="hidden" id="type" name="type" value="' . $type . '" />';
}
?>
<?php
$text = __('This type of report brings a lot of data loading, it is recommended to use it for scheduled reports and not for real-time view.');
echo '<a id="log_help_tip" style="visibility: hidden;" href="javascript:" class="tip" >' . html_print_image ("images/tip.png", true, array('title' => $text)) . '</a>';
?>
</td>
</tr>
<tr id="row_name" style="" class="datos">
@ -689,7 +698,8 @@ You can of course remove the warnings, that's why we include the source and do n
<tr id="row_period" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Period');
echo __('Time lapse');
ui_print_help_tip(__('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. '));
?>
</td>
<td style="">
@ -2534,6 +2544,7 @@ function chooseType() {
$("#row_last_value").hide();
$("#row_filter_search").hide();
$("#row_percentil").hide();
$("#log_help_tip").css("visibility", "hidden");
$("#agents_row").hide();
$("#select_agent_modules").hide();
$("#modules_row").hide();
@ -2556,6 +2567,30 @@ function chooseType() {
$('#agent_autocomplete_events').show();
switch (type) {
case 'event_report_group':
$("#row_description").show();
$("#row_period").show();
$("#row_servers").show();
$("#row_group").show();
$("#row_show_in_two_columns").show();
$("#row_event_filter").show();
$("#row_event_graphs").show();
$("#row_event_graph_by_agent").show();
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
$("#row_filter_search").show();
break;
case 'event_report_log':
$("#log_help_tip").css("visibility", "visible");
$("#row_description").show();
$("#row_period").show();
$("#row_agent").show();
break;
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_only_avg").show();

View File

@ -87,7 +87,8 @@ else {
$agents = array();
foreach ($rows as $row) {
$agents[$row['id_agente']] = $row['nombre'];
$alias = db_get_value ("alias","tagente","id_agente",$row['id_agente']);
$agents[$row['id_agente']] = $alias;
}
switch ($config['dbtype']) {
@ -372,15 +373,17 @@ foreach ($items as $item) {
$agent_name_db = array();
foreach ($agents as $a) {
$agent_name_db[] = agents_get_name($a);
$alias = db_get_value ("alias","tagente","id_agente",$a);
$agent_name_db[] = $alias;
}
$agent_name_db = implode('<br>',$agent_name_db);
$module_name_db = implode('<br>',$modules);
}
else {
$agent_name_db = agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module']));
$agent_name_db = ui_print_truncate_text($agent_name_db, 'agent_small');
$alias = db_get_value ("alias","tagente","id_agente",agents_get_agent_id_by_module_id($item['id_agent_module']));
$agent_name_db = '<span title='. agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module'])) . '>' .$alias . '</span>';
$module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$module_name_db = ui_print_truncate_text(io_safe_output($module_name_db), 'module_small');
}
@ -390,7 +393,8 @@ foreach ($items as $item) {
}
}
else {
$row[2] = ui_print_truncate_text(agents_get_name($item['id_agent']), 'agent_small');
$alias = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
$row[2] = '<span title='. agents_get_name($item['id_agent']) . '>' .$alias . '</span>';
if ($item['id_agent_module'] == '') {
$row [3] = '';

View File

@ -365,7 +365,7 @@ switch ($action) {
}
// Page header for normal console
else
ui_print_page_header (__('Reporting').' &raquo; '.__('Custom reporting'), "images/op_reporting.png", false, "", false, $buttons,false,'',80);
ui_print_page_header (__('Reporting').' &raquo; '.__('Custom reporting'), "images/op_reporting.png", false, "", false, $buttons,false,'',50);
if ($action == 'delete_report') {
@ -1677,7 +1677,7 @@ switch ($action) {
$sql = sprintf($sql, 'DESC');
break;
}
echo $sql;
$ids = db_get_all_rows_sql($sql);
}
@ -1908,7 +1908,7 @@ switch ($action) {
}
// Page header for normal console
else
ui_print_page_header (__('Reporting') . $subsection, "images/op_reporting.png", false, "", false, $buttons,false,'',80);
ui_print_page_header (__('Reporting') . $subsection, "images/op_reporting.png", false, "", false, $buttons,false,'',50);
reporting_enterprise_select_main_tab($action);
@ -1980,7 +1980,7 @@ if ($enterpriseEnable and defined('METACONSOLE')) {
else {
ui_print_page_header(__('Reporting') . $textReportName,
"images/op_reporting.png", false,
"reporting_" . $activeTab . "_tab", false, $buttons,false,'',80);
"reporting_" . $activeTab . "_tab", false, $buttons,false,'',50);
}
if ($resultOperationDB !== null) {

View File

@ -95,12 +95,26 @@ if (defined('METACONSOLE')) {
$table->align[1] = 'left';
}
$table->class = 'databox filters';
$table->size[0] = '20%';
$table->size[1] = '20%';
$table->size[1] = '50%';
$table->data = array ();
$table->data[0][0] = __('Name:') .
ui_print_help_tip(__("Use [ or ( as first character, for example '[*] Map name', to render this map name in main menu"), true);
$table->data[0][1] = html_print_input_text('name', $visualConsoleName,
'', 80, 100, true);
$table->rowspan[0][2] = 6;
if ($action == 'new') {
$table->data[0][2] = '<img id="imagen" style="display:none;"
src="">';
}
else {
$table->data[0][2] = '<img id="imagen" style="width:230px;"
src="images/console/background/'.$background.'">';
}
$table->data[1][0] = __('Group:');
$groups = users_get_groups ($config['id_user'], 'RW');
@ -125,36 +139,31 @@ $table->data[3][0] = __('Background image');
$table->data[3][1] = html_print_input_file('background_image',true);
$table->data[4][0] = __('Background color');
if($action == 'new'){
$table->data[4][1] .= html_print_input_text ('background_color', 'white', '', 8, 8, true);
if ($action == 'new') {
$table->data[4][1] .= html_print_input_text ('background_color',
'white', '', 8, 8, true);
}
else{
$table->data[4][1] .= html_print_input_text ('background_color', $background_color, '', 8, 8, true);
else {
$table->data[4][1] .= html_print_input_text ('background_color',
$background_color, '', 8, 8, true);
}
$table->data[5][0] = __('Size - (Width x Height)');
if($action == 'new'){
$table->data[5][1] = '<button id="modsize" style="margin-right:20px;" value="modsize">Set custom size</button>';
}
else{
$table->data[5][1] = '<button id="modsize" style="margin-right:20px;" value="modsize">Set custom size</button>';
}
$table->data[5][1] = '<button id="modsize"
style="margin-right:20px;" value="modsize">' .
__('Set custom size') . '</button>';
$table->data[5][1] .= '<span class="opt" style="visibility:hidden;">'.html_print_input_text('width', 1024, '', 10, 10, true , false) .
' x ' .
$table->data[5][1] .= '<span class="opt" style="visibility:hidden;">' .
html_print_input_text('width', 1024, '', 10, 10, true , false) .
' x ' .
html_print_input_text('height', 768, '', 10, 10, true, false).'</span>';
if($action == 'new'){
$table->data[5][1] .= '<span class="opt" style="visibility:hidden;">'.'<button id="getsize" style="margin-left:20px;" value="modsize">Set default size</button>'.'</span>';
}
else{
$table->data[5][1] .= '<span class="opt" style="visibility:hidden;">'.'<button id="getsize" style="margin-left:20px;" value="modsize">Set default size</button>'.'</span>';
}
$table->data[5][1] .= '<span class="opt" style="visibility:hidden;">
<button id="getsize" style="margin-left:20px;"
value="modsize">' . __('Set default size') .
'</button></span>';
$table->data[5][2] = '<img id="imagen" style="display:none" src="images/console/background/'.$background.'">';
$table->data[0][3] = $table->data[0][4] = $table->data[0][5] = '';
if ($action == 'new') {
$textButtonSubmit = __('Save');
$classButtonSubmit = 'sub wand';
@ -166,18 +175,10 @@ else {
html_print_table($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">';
if($action == 'new'){
html_print_submit_button ($textButtonSubmit, 'update_layout', false,
'class="' . $classButtonSubmit . '"');
}
else{
html_print_submit_button ($textButtonSubmit, 'update_layout', false,
'class="' . $classButtonSubmit . '"');
}
echo '</div>';
echo '<div class="action-buttons" style="width: ' . $table->width . '">';
html_print_submit_button ($textButtonSubmit, 'update_layout', false,
'class="' . $classButtonSubmit . '"');
echo '</div>';
echo "</form>";
?>
@ -188,46 +189,60 @@ echo "</form>";
$(document).ready (function () {
$("#modsize").click(function(event){
event.preventDefault();
$("#modsize").click(function(event){
event.preventDefault();
if($('.opt').css('visibility') == 'hidden'){
$('.opt').css('visibility','visible');
}
if ($('#imagen').attr('src') != '') {
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
}
});
$("#getsize").click(function(event){
event.preventDefault();
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
});
});
$("#getsize").click(function(event){
event.preventDefault();
$("#background").change(function() {
$('#imagen').attr('src','images/console/background/'+$('#background').val());
$('#imagen').width(230);
$('#imagen').show();
});
$( "input[type=submit]" ).click(function( event ) {
if($( "#getsize" ).css('visibility')=='hidden'){
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
}
});
$("#file-background_image").change(function(){
readURL(this);
});
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
});
$("#background").click(function(event){
$('#imagen').attr('src','images/console/background/'+$('#background').val());
});
$( "input[type=submit]" ).click(function( event ) {
if($( "#getsize" ).css('visibility')=='hidden'){
$('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height());
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#imagen').attr('src', e.target.result);
$('#imagen').width(230);
$('#imagen').show();
}
reader.readAsDataURL(input.files[0]);
}
}
});
$("#file-background_image").change(function(event){
$('#back').submit();
});
$("#text-background_color").attachColorPicker();
$("#imgInp").change(function(){
readURL(this);
});
$("#text-background_color").attachColorPicker();
});

View File

@ -437,6 +437,7 @@ function readFields() {
values['left'] = $("input[name=left]").val();
values['top'] = $("input[name=top]").val();
values['agent'] = $("input[name=agent]").val();
values['id_agent'] = $("input[name=id_agent]").val();
values['module'] = $("select[name=module]").val();
values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val();
@ -971,18 +972,18 @@ function loadFieldsFromDB(item) {
}
if (key == 'type_graph') {
$("select[name=type_graph]").val(val);
}
$("select[name=type_graph]").val(val);
}
if (key == 'label_position') {
$('#labelposup'+" img").attr('src','/pandora_console/images/label_up.png');
$('#labelposdown'+" img").attr('src','/pandora_console/images/label_down.png');
$('#labelposleft'+" img").attr('src','/pandora_console/images/label_left.png');
$('#labelposright'+" img").attr('src','/pandora_console/images/label_right.png');
$('.labelpos').attr('sel','no');
$('#labelpos'+val+" img").attr('src','/pandora_console/images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
$('#labelpos'+val).attr('sel','yes');
}
if (key == 'label_position') {
$('#labelposup'+" img").attr('src','/pandora_console/images/label_up.png');
$('#labelposdown'+" img").attr('src','/pandora_console/images/label_down.png');
$('#labelposleft'+" img").attr('src','/pandora_console/images/label_left.png');
$('#labelposright'+" img").attr('src','/pandora_console/images/label_right.png');
$('.labelpos').attr('sel','no');
$('#labelpos'+val+" img").attr('src','/pandora_console/images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png');
$('#labelpos'+val).attr('sel','yes');
}
if (key == 'image') {
//Load image preview
@ -997,6 +998,9 @@ function loadFieldsFromDB(item) {
$("input[name=agent]").val(val);
//Reload no-sincrone the select of modules
}
if (key == 'id_agent') {
$("input[name=id_agent]").val(val);
}
if (key == 'modules_html') {
$("select[name=module]").empty().html(val);
$("select[name=module]").val(moduleId);
@ -1165,7 +1169,14 @@ function setAspectRatioBackground(side) {
success: function(data) {
old_width = parseInt($("#background").css('width').replace('px', ''));
old_height = parseInt($("#background").css('height').replace('px', ''));
if (old_width < 1024) {
old_width = 1024;
}
if (old_height < 768) {
old_height = 768;
}
img_width = data[0];
img_height = data[1];
@ -2975,23 +2986,45 @@ function eventsBackground() {
$('#background').bind('resizestop', function(event, ui) {
if (!is_opened_palette) {
unselectAll();
var launch_message = false;
var dont_resize = false;
var values = {};
values['width'] = $('#background').css('width').replace('px', '');
values['height'] = $('#background').css('height').replace('px', '');
var actual_width = $('#background').css('width').replace('px', '');
var actual_height = $('#background').css('height').replace('px', '');
if (actual_width < 1024) {
actual_width = 1024;
$('#background').css('width', 1024);
launch_message = true;
dont_resize = true;
}
if (actual_height < 768) {
actual_height = 768;
$('#background').css('height', 768);
launch_message = true;
dont_resize = true;
}
values['width'] = actual_width;
values['height'] = actual_height;
if (!dont_resize) {
updateDB('background', 0, values, 'resizestop');
width = ui.size['width'];
height = ui.size['height'];
updateDB('background', 0, values, 'resizestop');
original_width = ui.originalSize['width'];
original_height = ui.originalSize['height'];
move_elements_resize(original_width, original_height, width, height);
width = ui.size['width'];
height = ui.size['height'];
original_width = ui.originalSize['width'];
original_height = ui.originalSize['height'];
move_elements_resize(original_width, original_height, width, height);
$('#background_grid').css('width', width);
$('#background_grid').css('height', height);
$('#background_grid').css('width', width);
$('#background_grid').css('height', height);
}
if (launch_message)
alert($('#hidden-message_size').val());
}
});

View File

@ -87,10 +87,7 @@ echo "<div id='background_grid'
//Print the layout datas from the DB.
foreach ($layoutDatas as $layoutData) {
$layoutData['status_calculated'] =
visual_map_get_status_element($layoutData);
$layoutData['status_calculated'] = visual_map_get_status_element($layoutData);
// Pending delete and disable modules must be ignored
$delete_pending_module = db_get_value ("delete_pending",
@ -134,6 +131,7 @@ $backgroundSizes = getimagesize(
html_print_input_hidden('background_original_width', $backgroundSizes[0]);
html_print_input_hidden('background_original_height', $backgroundSizes[1]);
html_print_input_hidden('id_visual_console', $visualConsole['id']);
html_print_input_hidden('message_size', __('Please min size recommend is 1024x768'));
// Loading dialog

View File

@ -370,7 +370,10 @@ foreach ($layoutDatas as $layoutData) {
"none", $layoutData['id_metaconsole'], true);
}
else {
$params['value'] = agents_get_name($layoutData['id_agent']);
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_' . $idLayoutData;
$params['hidden_input_idagent_value'] = $layoutData['id_agent'];
$params['value'] = db_get_value ("alias","tagente","id_agente",$layoutData['id_agent']);
}
if ($layoutData['id_agent'] == 0 and $layoutData['id_custom_graph'] != 0) {

View File

@ -174,7 +174,7 @@ switch ($activeTab) {
if ($uploadOK == 1) {
if (move_uploaded_file($_FILES["background_image"]["tmp_name"], $target_file)) {
$background = $_FILES["background_image"]["name"];
$background = $nameImage;
$values['background'] = $background;
$error2 = chmod($target_file, 0644);
$uploadOK = $error2;
@ -365,7 +365,8 @@ switch ($activeTab) {
$values['id_agent'] = (int) get_parameter('id_agent_' . $id, 0);
}
else {
$values['id_agent'] = agents_get_agent_id($agentName);
$agent_id = (int) get_parameter('id_agent_' . $id, 0);
$values['id_agent'] = $agent_id;
}
$values['id_agente_modulo'] = get_parameter('module_' . $id, 0);
$values['id_custom_graph'] = get_parameter('custom_graph_' . $id, 0);

View File

@ -76,7 +76,7 @@ $table->data[9][1] = html_print_input_text ('days_autodisable_deletion', $config
$table->data[10][0] = __('Retention period of past special days') . ui_print_help_tip(__('This number is days to keep past special days. 0 means never remove.'), true);
$table->data[10][1] = html_print_input_text ('num_past_special_days', $config["num_past_special_days"], '', 5, 5, true);
$table->data[11][0] = __('Max. macro data fields') . ui_print_help_tip(__('Number of macro fields in alerts and templates between 1 and 50'), true);
$table->data[11][0] = __('Max. macro data fields') . ui_print_help_tip(__('Number of macro fields in alerts and templates between 1 and 15'), true);
$table->data[11][1] = html_print_input_text ('max_macro_fields', $config["max_macro_fields"], '', 5, 5, true, false, false, "onChange=\"change_macro_fields()\"");
if (enterprise_installed ()) {

View File

@ -100,8 +100,8 @@ $table_behaviour->data[$row][1] = html_print_input_text ('render_proc_fail', $co
$row++;
//Daniel maya 02/06/2016 Display menu with click --INI
$table_behaviour->data[$row][0] = __('Display lateral menus with click').
ui_print_help_tip(__('If you check this option, the lateral menus display with left click. Otherwise it will show by placing the mouse over'), true);
$table_behaviour->data[$row][0] = __('Click to display lateral menus').
ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true);
$table_behaviour->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('click_display', 1, '',
$config["click_display"], true) .
@ -117,7 +117,7 @@ if (enterprise_installed()) {
$table_behaviour->data[$row][1] = html_print_input_text ('service_label_font_size', $config["service_label_font_size"], '', 5, 5, true);
$row++;
$table_behaviour->data[$row][0] = __('Service item padding size');
$table_behaviour->data[$row][0] = __('Space between items in Service maps');
$table_behaviour->data[$row][1] = html_print_input_text ('service_item_padding_size', $config["service_item_padding_size"], '', 5, 5, true);
$row++;
}
@ -183,7 +183,7 @@ $table_styles->data[$row][1] .= "&nbsp;" .
html_print_button(__("View"), 'login_background_preview', false, '', 'class="sub camera"', true);
$row++;
$table_styles->data[$row][0] = __('Custom logo') . ui_print_help_icon("custom_logo", true);
$table_styles->data[$row][0] = __('Custom logo (header)') . ui_print_help_icon("custom_logo", true);
if(enterprise_installed()){
$ent_files = list_files('enterprise/images/custom_logo', "png", 1, 0);
@ -202,7 +202,7 @@ else{
$table_styles->data[$row][1] .= "&nbsp;" . html_print_button(__("View"), 'custom_logo_preview', $open, '', 'class="sub camera"', true,false,$open,'visualmodal');
$row++;
$table_styles->data[$row][0] = __('Custom logo in login') . ui_print_help_icon("custom_logo_login", true);
$table_styles->data[$row][0] = __('Custom logo (login)') . ui_print_help_icon("custom_logo_login", true);
$table_styles->data[$row][1] = html_print_select(
@ -355,7 +355,7 @@ $table_font->data[$row][1] = html_print_input_text('item_title_size_text',
$config["item_title_size_text"], '', 3, 3, true);
$row++;
$table_font->data[$row][0] = __('Show units in values report') .
$table_font->data[$row][0] = __('Show unit along with value in reports') .
ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true);
$table_font->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('simple_module_value', 1, '', $config["simple_module_value"], true).'&nbsp;&nbsp;';
@ -432,7 +432,7 @@ if (!enterprise_installed()) {
}
$table_chars->data[$row][0] = __('Data precision for reports');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Precision must be a integer number between 0 and 5'), true);
$table_chars->data[$row][0] .= ui_print_help_tip(__('Number of decimals shown in reports. It must be a number between 0 and 5'), true);
$table_chars->data[$row][1] = html_print_input_text ('graph_precision', $config["graph_precision"], '', 5, 5, true, $disabled_graph_precision, false, "onChange=\"change_precision()\"");
$row++;
@ -486,15 +486,15 @@ $table_chars->data[$row][1] .= __('Line').'&nbsp;' .
$row++;
$table_chars->data[$row][0] = __('Show only average');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Allows only show the average in graphs'), true);
$table_chars->data[$row][0] .= ui_print_help_tip(__('Hide Max and Min values in graphs'), true);
$table_chars->data[$row][1] = __('Yes').'&nbsp;' .
html_print_radio_button ('only_average', 1, '', $config["only_average"], true).'&nbsp;&nbsp;';
$table_chars->data[$row][1] .= __('No').'&nbsp;' .
html_print_radio_button ('only_average', 0, '', $config["only_average"], true);
$row++;
$table_chars->data[$row][0] = __('Percentil');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Allows only show the average in graphs'), true);
$table_chars->data[$row][0] = __('Percentile');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Show percentile 95 in graphs'), true);
$table_chars->data[$row][1] = html_print_input_text ('percentil', $config['percentil'], '', 20, 20, true);
$row++;
@ -637,10 +637,6 @@ $table_other->data[$row][1] .= __('No') . '&nbsp;' .
$config["show_group_name"], true);
$row++;
$table_other->data[$row][0] = __('Date format string') . ui_print_help_icon("date_format", true);
$table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date ($config["date_format"]);
$table_other->data[$row][1] .= html_print_input_text ('date_format', $config["date_format"], '', 30, 100, true);

Binary file not shown.

Before

(image error) Size: 1.8 KiB

After

(image error) Size: 1.1 KiB

View File

@ -113,11 +113,12 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_agents[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_agents, array ('id_agente', 'nombre', 'direccion'));
$agents = agents_get_agents($filter_agents, array ('id_agente', 'nombre', 'direccion','alias'));
if ($agents !== false) {
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']),
'ip' => io_safe_output($agent['direccion']),
'filter' => 'agent');
}
@ -136,11 +137,12 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_address[] = '(UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_address, array ('id_agente', 'nombre', 'direccion'));
$agents = agents_get_agents($filter_address, array ('id_agente', 'nombre', 'direccion', 'alias'));
if ($agents !== false) {
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']),
'ip' => io_safe_output($agent['direccion']),
'filter' => 'address');
}
@ -159,16 +161,40 @@ if ($search_agents && (!is_metaconsole() || $force_local)) {
$filter_description[] = '(UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_description, array ('id_agente', 'nombre', 'direccion'));
$agents = agents_get_agents($filter_description, array ('id_agente', 'nombre', 'direccion', 'alias'));
if ($agents !== false) {
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']),
'ip' => io_safe_output($agent['direccion']),
'filter' => 'description');
}
}
//Get agents for only the alias
$filter_description = $filter;
switch ($config['dbtype']) {
case "mysql":
$filter_description[] = '(nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios NOT LIKE "%'.$string.'%" AND alias LIKE "%'.$string.'%")';
break;
case "postgresql":
$filter_description[] = '(nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios NOT LIKE \'%'.$string.'%\' AND alias LIKE \'%'.$string.'%\')';
break;
case "oracle":
$filter_description[] = '(UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(alias) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_description, array ('id_agente', 'nombre', 'direccion', 'alias'));
if ($agents !== false) {
foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']),
'alias' => io_safe_output($agent['alias']),
'ip' => io_safe_output($agent['direccion']),
'filter' => 'alias');
}
}
echo json_encode($data);
return;
}

View File

@ -107,7 +107,7 @@ if ($print_sparse_graph) {
$pure, $date, $unit, $baseline, $return_data, $show_title,
$only_image, $homeurl, $ttl, $projection, $adapt_key, $compare,
$show_unknown, $menu, $backgroundColor, $percentil,
$dashboard, $vconsole);
$dashboard, $vconsole, $config['type_module_charts']);
return;
}

View File

@ -161,7 +161,8 @@ switch ($action) {
$img = grafico_modulo_sparse($id_agent_module,
$period, 0, $width, $height, '', null, false, 1,
0, 0, '', 0, 0, true, true, '', 1, false, '',
false, false, true, $background_color);
false, false, true, $background_color,
false, false, false, $config['type_module_charts']);
}
//Restore db connection
@ -477,6 +478,9 @@ switch ($action) {
$values['id_agent'] = $id_agent;
}
}
else if (!empty($id_agent)) {
$values['id_agent'] = $id_agent;
}
else if ($agent !== null) {
$id_agent = agents_get_agent_id($agent);
$values['id_agent'] = $id_agent;
@ -663,12 +667,12 @@ switch ($action) {
if (!empty($connection['server_name'])) {
$elementFields['agent_name'] =
io_safe_output(agents_get_name($elementFields['id_agent']))
io_safe_output(agents_get_alias($elementFields['id_agent']))
. " (" . io_safe_output($connection['server_name']) . ")";
}
else {
$elementFields['agent_name'] =
io_safe_output(agents_get_name($elementFields['id_agent']));
io_safe_output(agents_get_alias($elementFields['id_agent']));
}
//Make the html of select box of modules about id_agent.
@ -783,10 +787,15 @@ switch ($action) {
$values['id_agent'] = $id_agent;
}
else {
if ($agent != '')
if (!empty($id_agent)) {
$values['id_agent'] = $id_agent;
}
else if (!empty($agent)) {
$values['id_agent'] = agents_get_agent_id($agent);
else
}
else {
$values['id_agent'] = 0;
}
}
$values['id_agente_modulo'] = $id_module;
$values['id_layout_linked'] = $map_linked;

View File

@ -636,11 +636,8 @@ 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"]) : '';
if (strlen($password) == 0 ||
!@ldap_bind($ds,
$ldap_login_attr. io_safe_output($login) . $ldap_base_dn,
$password)) {
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);

View File

@ -234,7 +234,7 @@ class Tree {
// Agent name filter
$agent_search_filter = "";
if (!empty($this->filter['searchAgent'])) {
$agent_search_filter = " AND LOWER(ta.nombre) LIKE LOWER('%".$this->filter['searchAgent']."%')";
$agent_search_filter = " AND LOWER(ta.nombre) LIKE LOWER('%".$this->filter['searchAgent']."%') OR ta.alias LIKE '%".$this->filter['searchAgent']."%'";
}
// Agent status filter
@ -409,15 +409,15 @@ class Tree {
}
else {
if (! is_metaconsole() || $this->strictACL) {
$columns = 'ta.id_agente AS id, ta.nombre AS name,
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
$group_by_fields = 'ta.id_agente, ta.nombre, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$order_fields = 'ta.alias ASC, ta.id_agente ASC';
$sql = "SELECT $columns
FROM tagente ta
@ -435,11 +435,11 @@ class Tree {
ORDER BY $order_fields";
}
else {
$columns = 'ta.id_tagente AS id, ta.nombre AS name,
$columns = 'ta.id_tagente AS id, ta.nombre AS name, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet, id_tmetaconsole_setup AS server_id';
$order_fields = 'ta.nombre ASC, ta.id_tagente ASC';
$order_fields = 'ta.alias ASC, ta.id_tagente ASC';
$sql = "SELECT $columns
FROM tmetaconsole_agent ta
@ -595,15 +595,15 @@ class Tree {
}
}
else {
$columns = 'ta.id_agente AS id, ta.nombre AS name,
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
$group_by_fields = 'ta.id_agente, ta.nombre, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$order_fields = 'ta.alias ASC, ta.id_agente ASC';
$sql = "SELECT $columns
FROM tagente ta
@ -718,15 +718,15 @@ class Tree {
}
}
else {
$columns = 'ta.id_agente AS id, ta.nombre AS name,
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
$group_by_fields = 'ta.id_agente, ta.nombre, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$order_fields = 'ta.alias ASC, ta.id_agente ASC';
$sql = "SELECT $columns
FROM tagente ta
@ -847,15 +847,15 @@ class Tree {
}
}
else {
$columns = 'ta.id_agente AS id, ta.nombre AS name,
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
$group_by_fields = 'ta.id_agente, ta.nombre, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$order_fields = 'ta.alias ASC, ta.id_agente ASC';
$sql = "SELECT $columns
FROM tagente ta
@ -978,15 +978,15 @@ class Tree {
}
}
else {
$columns = 'ta.id_agente AS id, ta.nombre AS name,
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$group_by_fields = 'ta.id_agente, ta.nombre,
$group_by_fields = 'ta.id_agente, ta.nombre, ta.alias,
ta.fired_count, ta.normal_count, ta.warning_count,
ta.critical_count, ta.unknown_count, ta.notinit_count,
ta.total_count, ta.quiet';
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
$order_fields = 'ta.alias ASC, ta.id_agente ASC';
$symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~';
$name = $rootID;

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC170217';
$build_version = 'PC170222';
$pandora_version = 'v7.0dev';
// Do not overwrite default timezone set if defined.
@ -166,7 +166,7 @@ if (!isset($config['inventory_changes_blacklist'])) {
//NEW UPDATE MANAGER URL
if (!isset($config['url_update_manager'])) {
config_update_value('url_update_manager',
'https://firefly.artica.es/pandoraupdate7/server.php');
'https://licensing.artica.es/pandoraupdate7/server.php');
}
if (defined('METACONSOLE')) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,8 @@
.btn.active.focus {
outline: none;
}
#files-table a.file-link span.glyphicon {
#files-table a.file-link span.glyphicon,
#files-table span.file-link span.glyphicon {
vertical-align: middle;
font-size: x-large;
margin-right: 10px;
@ -24,3 +25,47 @@ div.term-container div.terminal {
-moz-border-radius: 4px;
border-radius: 4px;
}
.glyphicon-refresh-animate {
-animation: spin 1s infinite linear;
-webkit-animation: spin2 1s infinite linear;
}
@-webkit-keyframes spin2 {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes spin {
from {
transform: scale(1) rotate(0deg);
}
to {
transform: scale(1) rotate(360deg);
}
}
@-webkit-keyframes spin {
from {
transform: scale(1) rotate(0deg);
}
to {
transform: scale(1) rotate(360deg);
}
}
@-o-keyframes spin {
from {
transform: scale(1) rotate(0deg);
}
to {
transform: scale(1) rotate(360deg);
}
}
@keyframes spin {
from {
transform: scale(1) rotate(0deg);
}
to {
transform: scale(1) rotate(360deg);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -221,7 +221,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
}
}
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.nombre AS agent_name, t4.name AS template_name';
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
if ($count !== false) {
$selectText = 'COUNT(talert_template_modules.id) AS count';
}
@ -890,6 +890,21 @@ function agents_get_group_agents ($id_group = 0, $search = false,
unset ($search["name"]);
}
if (isset ($search["alias"])) {
$name = io_safe_input ($search["alias"]);
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$filter[] = "alias COLLATE utf8_general_ci LIKE '$name'";
break;
case "oracle":
$filter[] = "UPPER(alias) LIKE UPPER('$name')";
break;
}
unset ($search["alias"]);
}
if (isset($search['status'])) {
switch ($search['status']) {
case AGENT_STATUS_NORMAL:
@ -941,14 +956,14 @@ function agents_get_group_agents ($id_group = 0, $search = false,
$filter['disabled'] = 0;
}
$filter['order'] = 'nombre';
$filter['order'] = 'alias';
if (is_metaconsole()) {
$table_name = 'tmetaconsole_agent';
$fields = array(
'id_tagente AS id_agente',
'nombre',
'alias',
'id_tmetaconsole_setup AS id_server'
);
}
@ -957,7 +972,7 @@ function agents_get_group_agents ($id_group = 0, $search = false,
$fields = array(
'id_agente',
'nombre'
'alias'
);
}
@ -968,7 +983,7 @@ function agents_get_group_agents ($id_group = 0, $search = false,
$agents = array ();
foreach ($result as $row) {
if (!isset($row["id_agente"]) || !isset($row["nombre"]))
if (!isset($row["id_agente"]) || !isset($row["alias"]))
continue;
if ($serialized && isset($row["id_server"])) {
@ -980,13 +995,13 @@ function agents_get_group_agents ($id_group = 0, $search = false,
switch ($case) {
case "lower":
$value = mb_strtolower ($row["nombre"], "UTF-8");
$value = mb_strtolower ($row["alias"], "UTF-8");
break;
case "upper":
$value = mb_strtoupper ($row["nombre"], "UTF-8");
$value = mb_strtoupper ($row["alias"], "UTF-8");
break;
default:
$value = $row["nombre"];
$value = $row["alias"];
break;
}
@ -1310,6 +1325,28 @@ function agents_get_name ($id_agent, $case = "none") {
}
}
/**
* Get alias of an agent.
*
* @param int $id_agent Agent id.
* @param string $case Case (upper, lower, none)
*
* @return string Alias of the given agent.
*/
function agents_get_alias ($id_agent, $case = 'none') {
$alias = (string) db_get_value ('alias', 'tagente', 'id_agente', (int) $id_agent);
switch ($case) {
case 'upper':
return mb_strtoupper($alias, 'UTF-8');
case 'lower':
return mb_strtolower($alias, 'UTF-8');
case 'none':
default:
return ($alias);
}
}
/**
* Get the number of pandora data packets in the database.
*
@ -1405,8 +1442,7 @@ function agents_get_interval_status ($agent) {
$now = time ();
$diferencia = $now - $last_time;
$time = ui_print_timestamp ($last_time, true, array('style' => 'font-size:6.5pt'));
$min_interval = modules_get_agentmodule_mininterval($agent['id_agente']);
$min_interval = modules_get_agentmodule_mininterval_no_async($agent['id_agente']);
$return = $time;
if ($diferencia > ($min_interval["min_interval"] * 2))
$return = '<b><span style="color: #ff0000;">'.$time.'</span></b>';
@ -2485,4 +2521,79 @@ function agents_get_agent_custom_field ($agent_id, $custom_field_name) {
return db_get_value_sql($sql);
}
function select_modules_for_agent_group($id_group, $id_agents, $selection, $return=true){
$agents = implode(",", $id_agents);
$filter_group = "";
$filter_agent = "";
if ($id_group != 0) {
$filter_group = " AND id_module_group = ". $id_group;
}
if ($agents != null) {
$filter_agent = " AND id_agente IN (" . $agents . ")";
}
if ($selection == 1 || (count($id_agents) == 1)) {
$modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
if (empty($modules)) $modules = array();
$found = array();
foreach ($modules as $i=>$row) {
$check = $row['nombre'];
if (@$found[$check]++) {
unset($modules[$i]);
}
}
}
else {
$modules = db_get_all_rows_sql("SELECT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
if (empty($modules)) $modules = array();
foreach ($modules as $m) {
$is_in_all_agents = true;
$module_name = modules_get_agentmodule_name($m['id_agente_modulo']);
foreach ($id_agents as $a) {
$module_in_agent = db_get_value_filter('id_agente_modulo',
'tagente_modulo', array('id_agente' => $a, 'nombre' => $module_name));
if (!$module_in_agent) {
$is_in_all_agents = false;
}
}
if ($is_in_all_agents) {
$modules_to_report[] = $m;
}
}
$modules = $modules_to_report;
$found = array();
if (is_array($modules) || is_object($modules)){
foreach ($modules as $i=>$row) {
$check = $row['nombre'];
if (@$found[$check]++) {
unset($modules[$i]);
}
}
}
}
if (is_array($modules) || is_object($modules)){
foreach ($modules as $k => $v) {
$modules[$k] = io_safe_output($v);
}
}
if($return == false){
foreach ($modules as $value) {
$modules_array[$value['id_agente_modulo']] = $value['nombre'];
}
return $modules_array;
}
else{
echo json_encode($modules);
return;
}
}
?>

View File

@ -1822,7 +1822,7 @@ function get_group_alerts($id_group, $filter = '', $options = false,
}
}
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.nombre AS agent_name, t4.name AS template_name';
$selectText = 'talert_template_modules.*, t2.nombre AS agent_module_name, t3.alias AS agent_name, t4.name AS template_name';
if ($count !== false) {
$selectText = 'COUNT(talert_template_modules.id) AS count';
}

View File

@ -9287,8 +9287,9 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
$graph_html = grafico_modulo_sparse(
$id_module, $graph_seconds, false, 600, 300, '',
'', false, false, true, time(), '', 0, 0, true, true,
ui_get_full_url(false) . '/', 1, false, '', false, true);
ui_get_full_url(false) . '/', 1, false, '', false, true,
true, 'white', null, false, false, $config['type_module_charts']);
$graph_image_file_encoded = false;
if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) {
$file_url = $matches[1];

View File

@ -979,7 +979,7 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
$myclass = get_priority_class ($event["criticity"]);
$data[4] = "<a class='$myclass' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'>".
agents_get_name ($event["id_agente"]). "</A>";
agents_get_alias($event["id_agente"]). "</A>";
// ui_print_agent_name ($event["id_agente"], true, 25, '', true);
// for System or SNMP generated alerts
@ -2017,10 +2017,13 @@ function events_page_details ($event, $server = "") {
$data = array();
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Name').'</div>';
if (can_user_access_node ()) {
$data[1] = ui_print_agent_name ($event["id_agente"], true, 'agent_medium', '', false, $serverstring, $hashstring, $agent['nombre']);
//$data[1] = ui_print_agent_name ($event["id_agente"], true, 'agent_medium', '', false, $serverstring, $hashstring, $agent['nombre']);
$alias = db_get_row ("tagente","id_agente",$event["id_agente"]);
$data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $event["id_agente"] . '" title='.$alias['nombre']. '>';
$data[1] .= '<b>' . $alias['alias'] . '</a></b>';
}
else {
$data[1] = ui_print_truncate_text($agent['nombre'], 'agent_medium', true, true, true);
$data[1] = ui_print_truncate_text($agent['alias'], 'agent_medium', true, true, true);
}
$table_details->data[] = $data;

View File

@ -512,9 +512,13 @@ function gis_get_map_conf($idMap) {
}
function get_good_con() {
$sql = 'SELECT * FROM tgis_map_connection WHERE id_tmap_connection = 2';
return db_get_all_rows_sql($sql);
$good_map = db_get_row('tgis_map_connection', 'id_tmap_connection', 2);
// Try to open the default OpenStreetMap
if ($good_map !== false) {
return $good_map;
}
return db_get_row('tgis_map_connection', 'connection_type', 'OSM');
}
function gis_get_map_connection($idMapConnection) {

View File

@ -755,12 +755,12 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
. __('Avg') . ': ' . remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])) . ($unit ? ' ' . $unit : '');
}
else if (!$avg_only) {
$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['max']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit;
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['min']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit;
$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['max']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['max']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['max']['min'], $config['graph_precision'])).' '.$unit;
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['min']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['min']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['min']['min'], $config['graph_precision'])).' '.$unit;
}
else {
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.remove_right_zeros(number_format($graph_stats['sum']['last'], $config['graph_precision'])).' '.$unit.' ; '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Avg').': '.remove_right_zeros(number_format($graph_stats['sum']['avg'], $config['graph_precision'])).' '.$unit.' ; '.__('Max').': '.remove_right_zeros(number_format($graph_stats['sum']['max'], $config['graph_precision'])).' '.$unit.' ; '.__('Min').': '.remove_right_zeros(number_format($graph_stats['sum']['min'], $config['graph_precision'])).' '.$unit;
}
//Baseline was replaced by compare graph feature
/*if ($baseline) {
@ -790,12 +790,11 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
$adapt_key = '', $compare = false, $show_unknown = false,
$menu = true, $backgroundColor = 'white', $percentil = null,
$dashboard = false, $vconsole = false,$type_graph = 'area') {
$dashboard = false, $vconsole = false, $type_graph = 'area') {
global $config;
global $graphic_type;
$flash_chart = $config['flash_charts'];
enterprise_include_once("include/functions_reporting.php");
@ -1222,19 +1221,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else {
$agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($agent_module_id));
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output(
modules_get_agentmodule_name ($agent_module_id));
if ($flash_charts)
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $agent_name . " / " . $module_name. '</span>';
$module_name_list[$i] = '<span style=\"font-size:' . ($config['font_size']) . 'pt;font-family: smallfontFont;\" >' . $alias . " / " . $module_name. '</span>';
else
$module_name_list[$i] = $agent_name . " / " . $module_name;
$module_name_list[$i] = $alias . " / " . $module_name;
}
}
else {
//Get and process agent name
$agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($agent_module_id));
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$agent_name = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '...', false);
$agent_id = agents_get_agent_id ($agent_name);
@ -1253,13 +1254,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$module_name_list[$i] = '<span style=\"font-size:' .
($config['font_size']) . 'pt;font-family: smallfontFont;\" >' .
$agent_name . ' / ' . $module_name . '</span>';
$alias . ' / ' . $module_name . '</span>';
}
else {
if ($labels[$agent_module_id] != '')
$module_name_list[$i] = $labels[$agent_module_id];
else
$module_name_list[$i] = $agent_name . ' / ' . $module_name;
$module_name_list[$i] = $alias . ' / ' . $module_name;
}
}
@ -1523,11 +1524,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$value = false;
}
if ( !empty($labels) && isset($labels[$module]) )
$label = io_safe_input($labels[$module]);
else
$label = agents_get_name($temp[$module]['id_agente']) . ': ' . $temp[$module]['nombre'];
if ( !empty($labels) && isset($labels[$module]) ){
$label = io_safe_input($labels[$module]);
}else{
$alias = db_get_value ("alias","tagente","id_agente",$temp[$module]['id_agente']);
$label = $alias . ': ' . $temp[$module]['nombre'];
}
$temp[$module]['label'] = $label;
$temp[$module]['value'] = $value;
@ -1590,10 +1593,13 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$agent_name = io_safe_output(
modules_get_agentmodule_agent_name ($module));
if (!empty($labels) && isset($labels[$module]) )
$label = $labels[$module];
else
$label = $agent_name . " - " .$module_data['nombre'];
if (!empty($labels) && isset($labels[$module]) ){
$label = $labels[$module];
}else {
$alias = db_get_value ("alias","tagente","id_agente",$module_data['id_agente']);
$label = $alias . " - " .$module_data['nombre'];
}
$temp[$label]['g'] = round($temp_data,4);
@ -1650,8 +1656,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
if ( !empty($labels) && isset($labels[$module]) ){
$label = io_safe_output($labels[$module]);
}else {
$agent_name = agents_get_name($data_module['id_agente']);
$label = io_safe_output($agent_name . ": " . $data_module['nombre']);
$alias = db_get_value ("alias","tagente","id_agente",$data_module['id_agente']);
$label = io_safe_output($alias . ": " . $data_module['nombre']);
}
$temp[$label] = array('value'=>$value,
@ -3127,7 +3133,9 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
$name = mb_substr (io_safe_output($row['agent_name']), 0, 14)." (".$row["count"].")";
}
else {
$name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
$alias = db_get_value ("alias","tagente","id_agente",$row["id_agente"]);
//$name = mb_substr (agents_get_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
$name = mb_substr ($alias, 0, 14)." (".$row["count"].")";
}
$data[$name] = $row["count"];
}
@ -3190,7 +3198,7 @@ function grafico_eventos_agente ($width = 300, $height = 200, $result = false, $
$count[] = __('SYSTEM');
}
else
$count[] = agents_get_name ($row["id_agente"]) ;
$count[] = agents_get_alias($row["id_agente"]) ;
}
}
@ -4059,6 +4067,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
'url' => ui_get_full_url("/images/logo_vertical_water.png",
false, false, false));
$type_graph = $config['type_module_charts'];
if ($type_graph === 'area') {
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,

View File

@ -1023,6 +1023,18 @@ function modules_get_agentmodule_agent_name ($id_agentmodule) {
return (string) agents_get_name (modules_get_agentmodule_agent ($id_agentmodule));
}
/**
* Get agent alias of an agent module.
*
* @param int $id_agente_modulo Agent module id.
*
* @return string The alias of the given agent module.
*/
function modules_get_agentmodule_agent_alias ($id_agentmodule) {
// Since this is a helper function we don't need to do casting
return (string) agents_get_alias (modules_get_agentmodule_agent ($id_agentmodule));
}
/**
* Get the module name of an agent module.
*
@ -2495,6 +2507,16 @@ function modules_get_agentmodule_mininterval($id_agent) {
return db_get_row_sql($sql);
}
function modules_get_agentmodule_mininterval_no_async($id_agent) {
$sql = 'SELECT MIN(tae.current_interval) AS min_interval
FROM tagente_estado tae
INNER JOIN tagente_modulo tam ON tae.id_agente_modulo = tam.id_agente_modulo
INNER JOIN ttipo_modulo ttm ON tam.id_tipo_modulo = ttm.id_tipo where ttm.nombre not like "async%" and tae.id_agente = '.$id_agent;
return db_get_row_sql($sql);
}
function get_same_modules ($agents, $modules) {
$modules_to_report = array();
if ($modules != "") {

View File

@ -851,7 +851,7 @@ function networkmap_loadfile($id = 0, $file = '',
case 'agent':
$data['id_agent'] = $ids[$node_id]['id_agent'];
$text = agents_get_name($ids[$node_id]['id_agent']);
$text = agents_get_alias($ids[$node_id]['id_agent']);
$text = io_safe_output($text);
$text = ui_print_truncate_text($text,
'agent_medium', false, true, false,

View File

@ -165,6 +165,12 @@ function reporting_make_reporting_data($report = null, $id_report,
$force_width_chart,
$force_height_chart);
break;
case 'event_report_log':
$report['contents'][] =
reporting_log(
$report,
$content);
break;
case 'general':
$report['contents'][] =
reporting_general(
@ -5954,7 +5960,10 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
true,
true,
'white',
($content['style']['percentil'] == 1) ? $config['percentil'] : null);
($content['style']['percentil'] == 1) ? $config['percentil'] : null,
false,
false,
$config['type_module_charts']);
}
break;
case 'data':
@ -7965,10 +7974,11 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
switch ($type) {
case 'modules':
$template_title['total_count'] = __('%d Total modules');
$template_title['normal_count'] = __('%d Normal modules');
$template_title['critical_count'] = __('%d Critical modules');
$template_title['warning_count'] = __('%d Warning modules');
$template_title['unknown_count'] = __('%d Unknown modules');
$template_title['normal_count'] = __('%d Modules in normal status');
$template_title['critical_count'] = __('%d Modules in critical status');
$template_title['warning_count'] = __('%d Modules in warning status');
$template_title['unknown_count'] = __('%d Modules in unknown status');
$template_title['not_init_count'] = __('%d Not init modules');
break;
case 'agent':
$template_title['total_count'] = __('%d Total modules');

View File

@ -152,6 +152,10 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) {
}
else
$label = '';
$aux = explode("-",$item['subtitle']);
$item['subtitle'] = db_get_value ("alias","tagente","nombre",$item['agent_name']) .' -'. $aux[1];
reporting_html_header($table,
$mini, $item['title'],
$item['subtitle'],
@ -174,6 +178,9 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) {
case 'availability':
reporting_html_availability($table, $item);
break;
case 'event_report_log':
reporting_html_log($table, $item);
break;
case 'availability_graph':
reporting_html_availability_graph($table, $item);
break;
@ -1221,8 +1228,9 @@ function reporting_html_inventory_changes($table, $item) {
$table1->data[2][0] = __('Added');
$table1->colspan[2][0] = 2;
$table1->data = array_merge($table1->data, $module_item['added']);
if (count ($module_item['added'])) {
$table1->data = array_merge($table1->data, $module_item['added']);
}
$table1->cellstyle[3 + count($module_item['added'])][0] =
@ -1230,8 +1238,9 @@ function reporting_html_inventory_changes($table, $item) {
$table1->data[3 + count($module_item['added'])][0] = __('Deleted');
$table1->colspan[3 + count($module_item['added'])][0] = 2;
$table1->data = array_merge($table1->data, $module_item['deleted']);
if (count ($module_item['deleted'])) {
$table1->data = array_merge($table1->data, $module_item['deleted']);
}
$table->colspan[
@ -1403,7 +1412,9 @@ function reporting_html_agent_module($table, $item) {
$row['agent_name']),
true, array('width' => '20px', 'height' => '20px'));
break;
case AGENT_STATUS_ALERT_FIRED:
case AGENT_MODULE_STATUS_NORMAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
$table_data .= ui_print_status_image(
'module_alertsfired.png',
__("%s in %s : ALERTS FIRED",
@ -1411,6 +1422,14 @@ function reporting_html_agent_module($table, $item) {
$row['agent_name']),
true, array('width' => '20px', 'height' => '20px'));
break;
case 4:
$table_data .= ui_print_status_image(
'module_no_data.png',
__("%s in %s : Not initialize",
$module_name,
$row['agent_name']),
true, array('width' => '20px', 'height' => '20px'));
break;
}
$table_data .= "</td>";
}
@ -1429,6 +1448,7 @@ function reporting_html_agent_module($table, $item) {
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_WARNING . ";'></div></td><td>" . __("Yellow cell when the module has a warning status") . "</td></tr>";
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NORMAL . ";'></div></td><td>" . __("Green cell when the module has a normal status") . "</td></tr>";
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_UNKNOWN . ";'></div></td><td>" . __("Grey cell when the module has an unknown status") . "</td></tr>";
$table_data .= "<tr><td class='legend_square_simple'><div style='background-color: " . COL_NOTINIT . ";'></div></td><td>" . __("Cell turns grey when the module is in 'not initialize' status") . "</td></tr>";
$table_data .= "</table>";
$table_data .= "</div>";
@ -2423,8 +2443,8 @@ function reporting_html_availability(&$table, $item) {
$table1->head = array ();
$table1->head['max_text'] = __('Agent max value');
$table1->head['max'] = __('Max Value');
$table1->head['min_text'] = __('Agent min');
$table1->head['min'] = __('Agent min Value');
$table1->head['min_text'] = __('Agent min value');
$table1->head['min'] = __('Min Value');
$table1->head['avg'] = __('Average Value');
$table1->headstyle = array();

View File

@ -633,8 +633,6 @@ function reports_get_report_types ($template = false, $not_editor = false) {
}
}
if (!$template) {
$types['agent_configuration'] = array('optgroup' => __('Configuration'),
'name' => __('Agent configuration'));
@ -651,6 +649,11 @@ function reports_get_report_types ($template = false, $not_editor = false) {
$types['netflow_summary'] = array('optgroup' => __('Netflow'),
'name' => __('Netflow summary table'));
}
if ($config['enterprise_installed']) {
$types['event_report_log'] = array('optgroup' => __('Log'),
'name' => __('Log report'));
}
return $types;
}

View File

@ -522,8 +522,9 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
else {
$cellName = '';
}
$cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, $user_access_node);
$cellName .= '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$agent["id_agente"].'">' .
'<b><span style="font-weight:bold;text-transform:uppercase;" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span></b></a>';
if ($agent['disabled']) {
$cellName .= ui_print_help_tip(__('Disabled'), true) . "</em>";
@ -780,4 +781,4 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
return;
}
?>
?>

View File

@ -787,6 +787,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
// Get agent id
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$agente = db_get_row ('tagente', 'id_agente', $id_agent);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$description = io_safe_output($template['name']);
@ -847,10 +848,10 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
}
else {
if ($agent_style !== false) {
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled . " $agent_style", false, $console_url, $url_hash, $agent_name);
$data[$index['agent_name']] .='<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agente['nombre']. '">'.$agente["alias"].'</span></a>';
}
else {
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled, false, $console_url, $url_hash);
$data[$index['agent_name']] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agente['nombre']. '">'.$agente["alias"].'</span></a>';
}
}
@ -2390,7 +2391,8 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
* @return string Header HTML
*/
function ui_print_page_header ($title, $icon = "", $return = false, $help = "", $godmode = false, $options = "",$modal = false, $message = "", $numChars = GENERIC_SIZE_TEXT) {
function ui_print_page_header ($title, $icon = "", $return = false, $help = "", $godmode = false, $options = "", $modal = false, $message = "", $numChars = GENERIC_SIZE_TEXT, $alias = "") {
$title = io_safe_input_html($title);
if (($icon == "") && ($godmode == true)) {
$icon = "images/gm_setup.png";
@ -2411,19 +2413,18 @@ function ui_print_page_header ($title, $icon = "", $return = false, $help = "",
$separator_class = "separator_view";
}
$buffer = '<div id="'.$type2.'" style=""><div id="menu_tab_left">';
$buffer .= '<ul class="mn"><li class="' . $type . '">&nbsp;' . '&nbsp; ';
if(strpos($title, "Monitoring » Services »") != -1){
$title = str_replace("Monitoring » Services » Service Map » ",'',$title);
}
$buffer .= '<span style="margin-right:10px;">' .
ui_print_truncate_text($title, $numChars);
$buffer .= '<span style="margin-right:10px;">';
if (empty($alias)) $buffer .= ui_print_truncate_text($title, $numChars);
else $buffer .= ui_print_truncate_text($alias, $numChars);
if ($modal && !enterprise_installed()){
$buffer .= "
<div id='".$message."' class='publienterprise' title='Community version' style='float: right;margin-top: -2px !important; margin-left: 2px !important;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>
@ -3212,7 +3213,7 @@ function ui_print_agent_autocomplete_input($parameters) {
select: function( event, ui ) {
var agent_name = ui.item.name;
var agent_name = ui.item.alias;
var agent_id = ui.item.id;
var server_name = "";
var server_id = "";
@ -3270,10 +3271,10 @@ function ui_print_agent_autocomplete_input($parameters) {
})
.data("ui-autocomplete")._renderItem = function( ul, item ) {
if (item.ip == "") {
text = "<a>" + item.name + "</a>";
text = "<a>" + item.alias+ "</a>";
}
else {
text = "<a>" + item.name
text = "<a>" + item.alias
+ "<br><span style=\"font-size: 70%; font-style: italic;\">IP:" + item.ip + "</span></a>";
}
@ -3297,6 +3298,12 @@ function ui_print_agent_autocomplete_input($parameters) {
.append(text)
.appendTo(ul);
break;
case \'alias\':
return $("<li style=\'background: #a8e7eb;\'></li>")
.data("item.autocomplete", item)
.append(text)
.appendTo(ul);
break;
}

View File

@ -122,8 +122,6 @@ function visual_map_print_item($mode = "read", $layoutData,
$left = $left * $proportion['proportion_width'];
}
$agentname = agents_get_name(agents_get_module_id ($id_module));
$label = str_replace($agentname,ui_print_truncate_text($agentname, 'agent_small', false, true, false, '…', false),$label);
$text = '<span id="text_' . $id . '" class="text">' . $label .'</span>';
if($height == 0){
@ -1670,7 +1668,7 @@ function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range,
break;
}
$label = agents_get_name($id_agent);
$label = agents_get_alias($id_agent);
$value_label = '(_VALUE_)';
if ($type === SIMPLE_VALUE) {
@ -1747,12 +1745,12 @@ function visual_map_process_wizard_add_modules ($id_modules, $image,
}
}
$id_agent = modules_get_agentmodule_agent ($id_module);
$id_agent = modules_get_agentmodule_agent($id_module);
switch ($label_type) {
case 'agent_module':
default:
$agent_label = agents_get_name ($id_agent);
$agent_label = agents_get_alias($id_agent);
$module_label = modules_get_agentmodule_name($id_module);
$label = '<p><span class="visual_font_size_'.$fonts.'" style="font-family:'.$fontf.';">'.$agent_label . " - " . $module_label.'</span></p>';
break;
@ -1761,7 +1759,7 @@ function visual_map_process_wizard_add_modules ($id_modules, $image,
$label = '<p><span class="visual_font_size_'.$fonts.'" style="font-family:'.$fontf.';">'.$module_label.'</span></p>';
break;
case 'agent':
$agent_label = agents_get_name ($id_agent);
$agent_label = agents_get_alias($id_agent);
$label = '<p><span class="visual_font_size_'.$fonts.'" style="font-family:'.$fontf.';">'.$agent_label.'</span></p>';
break;
case 'none':
@ -1953,9 +1951,7 @@ function visual_map_process_wizard_add_agents ($id_agents, $image,
switch ($label_type) {
case 'agent':
$agent_label =
agents_get_name($id_agent);
$label = $agent_label;
$label = agents_get_alias($id_agent);
break;
case 'none':
$label = '';

View File

@ -168,20 +168,22 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
<div id="label_box_arrow" style="text-align:center;width:120px;height:110px;margin-top:50px;">
<span>Label position</span>
<div class="labelpos" id="labelposup" position="up" style="width:20px;height:20px;margin-top:10px;margin-left:45px;cursor: pointer;"><img src="'.$config['homeurl'].'images/label_up.png" style="height:100%;width:100%;"></div>
<div class="labelpos" id="labelposleft" position="left" style="position:relative;top:-5px;width:20px;height:20px;margin-top:15px;cursor: pointer;"><img src="'.$config['homeurl'].'images/label_left.png" style="height:100%;width:100%;"></div>
<div style="font-weight:bold;width:40px;height:20px;position:relative;margin-left:35px;margin-top:-24px;cursor: default;"><span style="float:left;margin-top:3px;margin-left:5px;">Object</span></div>
<div class="labelpos" id="labelposright" position="right" style="top:2px;width:20px;height:20px;position:relative;margin-left:90px;margin-top:-24px;cursor: pointer;"><img src="'.$config['homeurl'].'images/label_right.png" style="height:100%;width:100%;"></div>
<div class="labelpos" sel="yes" id="labelposdown" position="down" style="width:20px;height:20px;position:relative;margin-left:45px;margin-top:10px;cursor: pointer;"><img src="'.$config['homeurl'].'images/label_down_2.png" style="height:100%;width:100%;"></div>
<div class="labelpos" id="labelposup" position="up" style="width:20px;height:20px;margin-top:10px;margin-left:45px;cursor: pointer;">
'. html_print_image ('images/label_up.png', true, array('style'=>'height:100%;width:100%;')). '
</div>
<div class="labelpos" id="labelposleft" position="left" style="position:relative;top:-5px;width:20px;height:20px;margin-top:15px;cursor: pointer;">
'. html_print_image ('images/label_left.png', true, array('style'=>'height:100%;width:100%;')). '
</div>
<div style="font-weight:bold;width:40px;height:20px;position:relative;margin-left:35px;margin-top:-24px;cursor: default;">
<span style="float:left;margin-top:3px;margin-left:5px;">Object</span>
</div>
<div class="labelpos" id="labelposright" position="right" style="top:2px;width:20px;height:20px;position:relative;margin-left:90px;margin-top:-24px;cursor: pointer;">
'. html_print_image ('images/label_right.png', true, array('style'=>'height:100%;width:100%;')). '
</div>
<div class="labelpos" sel="yes" id="labelposdown" position="down" style="width:20px;height:20px;position:relative;margin-left:45px;margin-top:10px;cursor: pointer;">
'. html_print_image ('images/label_down_2.png', true, array('style'=>'height:100%;width:100%;')). '
</div>
</div>
</td>
<td align="left" style="">' .
html_print_input_text('label', '', '', 20, 200, true) . '</td>';
@ -282,6 +284,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$params['javascript_is_function_select'] = true;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent';
if (defined('METACONSOLE')) {
$params['javascript_ajax_page'] = '../../ajax.php';
$params['disabled_javascript_on_blur_function'] = true;

View File

@ -1537,7 +1537,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
hoverable: true,
clickable: true,
borderWidth:1,
borderColor: '#666',
borderColor: '#C1C1C1',
tickColor: background_color,
markings: markings,
color: legend_color
@ -2198,10 +2198,10 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
set_watermark(graph_id, plot, $('#watermark_image_'+graph_id).attr('src'));
}
adjust_menu(graph_id, plot, parent_height);
adjust_menu(graph_id, plot, parent_height, width);
}
function adjust_menu(graph_id, plot, parent_height) {
function adjust_menu(graph_id, plot, parent_height, width) {
if ($('#'+graph_id+' .xAxis .tickLabel').eq(0).css('width') != undefined) {
left_ticks_width = $('#'+graph_id+' .xAxis .tickLabel').eq(0).css('width').split('px')[0];
}
@ -2234,7 +2234,7 @@ function adjust_menu(graph_id, plot, parent_height) {
//$('#legend_' + graph_id).css('width',plot.width());
$('#menu_' + graph_id)
.css('left',plot.width() - $('#menu_'+graph_id).width() + 10);
.css('left',width - $('#menu_'+graph_id).width());
$('#menu_' + graph_id).show();
}
@ -2251,10 +2251,10 @@ function set_watermark(graph_id, plot, watermark_src) {
if ($('#'+graph_id+' .yAxis .tickLabel').eq(0).css('height') != undefined) {
down_ticks_height = $('#'+graph_id+' .yAxis .tickLabel').eq(0).css('height').split('px')[0];
}
//var left_pos = parseInt(context.canvas.width - 3) - $('#watermark_image_'+graph_id)[0].width;
//var top_pos = parseInt(context.canvas.height - down_ticks_height - 10) - $('#watermark_image_'+graph_id)[0].height;
var left_pos = 380;
var left_pos = parseInt(context.canvas.width - 3) - $('#watermark_image_'+graph_id)[0].width;
var top_pos = 6;
//var top_pos = parseInt(context.canvas.height - down_ticks_height - 10) - $('#watermark_image_'+graph_id)[0].height;
//var left_pos = 380;
context.drawImage(this, left_pos, top_pos);
}, false);

View File

@ -246,7 +246,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
"style='display: none; " .
"text-align: center; " .
"width: " . $menu_width . "px; ".
"border: solid 1px #666; ".
"border-bottom: 0px; " .
"padding: 4px 4px 4px 4px;margin-bottom:5px;'>
<a href='javascript:'><img id='menu_cancelzoom_$graph_id' src='".$homeurl."images/zoom_cross_grey.disabled.png' alt='".__('Cancel zoom')."' title='".__('Cancel zoom')."'></a>";

View File

@ -1560,7 +1560,7 @@ function show_menu(item, data) {
var selection = d3.selectAll('.node_selected');
selection = selection[0];
if (selection.length > 1) {
alert("Yo no tengo dedo, por eso no poido trabajo, una ayuda, amorfa");
alert("Only one-one relations (one father, one son)");
}
else {
add_interface_link(data);
@ -1603,7 +1603,7 @@ function show_menu(item, data) {
var selection = d3.selectAll('.node_selected');
selection = selection[0];
if (selection.length > 1) {
alert("Yo no tengo dedo, por eso no poido trabajo");
alert("Only one-one relations (one father, one son)");
}
else {
set_parent(data);

View File

@ -369,7 +369,7 @@ var TreeController = {
$content.append($alertImage);
}
$content.append(element.name);
$content.append(element.alias);
break;
case 'module':
// Status image

BIN
pandora_console/include/languages/es.mo Executable file → Normal file

Binary file not shown.

67197
pandora_console/include/languages/es.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1262,7 +1262,7 @@ div.title_line {
#menu_tab_left li.view {
background: #82b92e;
max-width: 45%;
max-width: 60%;
min-width: 20%;
padding: 5px 5px 0px;
text-align: center;
@ -1289,7 +1289,7 @@ div.title_line {
#menu_tab_left li a, #menu_tab_left li span {
text-transform: uppercase;
padding: 0px 20px 0px 20px;
padding: 0px 0px 0px 5px;
color: #fff;
font-size: 9.5pt;
line-height: 20px;

View File

@ -508,12 +508,12 @@ if (! isset ($config['id_user'])) {
</script>
<?php
}
set_time_limit((int)$PHPmax_execution_time);
ini_set('upload_max_filesize', $PHPupload_max_filesize);
ini_set('memory_limit', $PHPmemory_limit);
}
set_time_limit((int)$PHPmax_execution_time);
ini_set('upload_max_filesize', $PHPupload_max_filesize);
ini_set('memory_limit', $PHPmemory_limit);
//==========================================================
//-------- SET THE CUSTOM CONFIGS OF USER ------------------

View File

@ -71,7 +71,7 @@
<div style='height: 10px'>
<?php
$version = '7.0dev';
$build = '170217';
$build = '170222';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -585,12 +585,13 @@ table.event_details td.cell_event_name {
padding-top: 7px;
display: table-cell;
clear: none;
float: none;
padding-left: 0px !important;
padding-right: 0px !important;
width: auto !important;
}
#list_agents td.cell_0 {
width: 45%;
border-top: 0px none;
}
#list_agents td.cell_0>span.tiny>img {
@ -599,12 +600,6 @@ table.event_details td.cell_event_name {
margin-top: -6px;
margin-left: 0px;
}
#list_agents td.cell_5 {
width: 30%;
}
#list_agents td.cell_6 {
width: 25%;
}
#list_agents .cell_2 .ui-table-cell-label,
#list_agents .cell_3 .ui-table-cell-label,

View File

@ -421,12 +421,9 @@ class Agents {
$.each(data.agents, function(key, agent) {
$(\"table#list_agents tbody\")
.append(\"<tr class=''>\" +
\"<th class='head_vertical'></th>\" +
\"<td class='cell_0'>\" + agent[0] + \"</td>\" +
// \"<td class='cell_1'>\" + agent[1] + \"</td>\" +
\"<td class='cell_1'>\" + agent[2] + \"</td>\" +
\"<td class='cell_2'>\" + agent[3] + \"</td>\" +
// \"<td class='cell_4'>\" + agent[4] + \"</td>\" +
\"<td class='cell_3'>\" + agent[5] + \"</td>\" +
\"<td class='cell_4'>\" + agent[6] + \"</td>\" +
\"<td class='cell_5'>\" + agent[7] + \"</td>\" +

View File

@ -187,7 +187,8 @@ class ModuleGraph {
1,
false,
'adapter_' . $this->graph_type,
$time_compare, $this->unknown_graph, false);
$time_compare, $this->unknown_graph, false,
'white', null, false, false, $config['type_module_charts']);
if ($this->draw_events) {
$graph .= '<br>';
$graph .= graphic_module_events($this->id,

View File

@ -179,7 +179,7 @@ if ($free_search != '') {
WHERE id_agente IN (
SELECT id_agente
FROM tagente
WHERE nombre LIKE "%' . $free_search . '%"))' .
WHERE nombre LIKE "%' . $free_search . '%") OR alias LIKE "%' . $free_search . '%")' .
')';
break;
@ -214,7 +214,7 @@ if ($free_search != '') {
WHERE id_agente IN (
SELECT id_agente
FROM tagente
WHERE nombre LIKE \'%' . $free_search . '%\'))' .
WHERE nombre LIKE \'%' . $free_search . '%\' OR alias LIKE \'%' . $free_search . '%\'))' .
')';
break;

View File

@ -41,6 +41,7 @@ $section = (string) get_parameter_get('section');
<title>eHorus client</title>
<link rel="stylesheet" href="../../include/ehorus/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/ehorus/css/style.css" type="text/css" />
<link rel="stylesheet" href="../../include/ehorus/css/xterm.css" type="text/css" />
<script type="text/javascript" src="../../include/ehorus/bundle.min.js"></script>
</head>
<body>

View File

@ -258,13 +258,13 @@ switch ($sortField) {
switch ($sort) {
case 'up':
$selectNameUp = $selected;
$order = array('field' => 'nombre' . $order_collation,
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
$order = array('field' => 'alias' . $order_collation,
'field2' => 'alias' . $order_collation, 'order' => 'ASC');
break;
case 'down':
$selectNameDown = $selected;
$order = array('field' => 'nombre' . $order_collation,
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
$order = array('field' => 'alias' . $order_collation,
'field2' => 'alias' . $order_collation, 'order' => 'DESC');
break;
}
break;
@ -273,12 +273,12 @@ switch ($sortField) {
case 'up':
$selectOsUp = $selected;
$order = array('field' => 'id_os',
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
'field2' => 'alias' . $order_collation, 'order' => 'ASC');
break;
case 'down':
$selectOsDown = $selected;
$order = array('field' => 'id_os',
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
'field2' => 'alias' . $order_collation, 'order' => 'DESC');
break;
}
break;
@ -287,12 +287,12 @@ switch ($sortField) {
case 'up':
$selectIntervalUp = $selected;
$order = array('field' => 'intervalo',
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
'field2' => 'alias' . $order_collation, 'order' => 'ASC');
break;
case 'down':
$selectIntervalDown = $selected;
$order = array('field' => 'intervalo',
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
'field2' => 'alias' . $order_collation, 'order' => 'DESC');
break;
}
break;
@ -301,12 +301,12 @@ switch ($sortField) {
case 'up':
$selectGroupUp = $selected;
$order = array('field' => 'id_grupo',
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
'field2' => 'alias' . $order_collation, 'order' => 'ASC');
break;
case 'down':
$selectGroupDown = $selected;
$order = array('field' => 'id_grupo',
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
'field2' => 'alias' . $order_collation, 'order' => 'DESC');
break;
}
break;
@ -315,12 +315,12 @@ switch ($sortField) {
case 'up':
$selectLastContactUp = $selected;
$order = array('field' => 'ultimo_contacto',
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
'field2' => 'alias' . $order_collation, 'order' => 'DESC');
break;
case 'down':
$selectLastContactDown = $selected;
$order = array('field' => 'ultimo_contacto',
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
'field2' => 'alias' . $order_collation, 'order' => 'ASC');
break;
}
break;
@ -329,12 +329,12 @@ switch ($sortField) {
case 'up':
$selectLastContactUp = $selected;
$order = array('field' => 'comentarios',
'field2' => 'nombre' . $order_collation, 'order' => 'DESC');
'field2' => 'alias' . $order_collation, 'order' => 'DESC');
break;
case 'down':
$selectLastContactDown = $selected;
$order = array('field' => 'comentarios',
'field2' => 'nombre' . $order_collation, 'order' => 'ASC');
'field2' => 'alias' . $order_collation, 'order' => 'ASC');
break;
}
break;
@ -349,8 +349,8 @@ switch ($sortField) {
$selectGroupDown = '';
$selectLastContactUp = '';
$selectLastContactDown = '';
$order = array('field' => 'nombre' . $order_collation,
'field2' => 'nombre' . $order_collation,
$order = array('field' => 'alias' . $order_collation,
'field2' => 'alias' . $order_collation,
'order' => 'ASC');
break;
}
@ -377,7 +377,7 @@ if ($search != "") {
$search_sql .= ")";
}else{
$search_sql = " AND ( nombre " . $order_collation . "
LIKE '%$search%') ";
LIKE '%$search%' OR alias ".$order_collation." LIKE '%$search%') ";
}
}
@ -453,6 +453,8 @@ else {
array ('id_agente',
'id_grupo',
'nombre',
'alias',
'id_os',
'ultimo_contacto',
'intervalo',
@ -569,7 +571,7 @@ foreach ($agents as $agent) {
if ($agent['quiet']) {
$data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "&nbsp;";
}
$data[0] .= ui_print_agent_name($agent["id_agente"], true, 60, 'font-size:8pt !important;', true);
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'"> <span style="font-size: 7pt;font-weight:bold" title ="' . $agent["nombre"]. '">'.$agent["alias"].'</span></a>';
$data[0] .= '</span>';
$data[0] .= '<div class="agentleft_' . $agent["id_agente"] . '" style="visibility: hidden; clear: left;">';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_agente"].'">'.__('View').'</a>';
@ -599,7 +601,7 @@ foreach ($agents as $agent) {
$data[4] = ui_print_group_icon ($agent["id_grupo"], true);
$agent['not_init_count'] = $agent['notinit_count'];
$data[5] = reporting_tiny_stats($agent, true, ' ', ':', $strict_user);
$data[5] = reporting_tiny_stats($agent, true, 'modules', ':', $strict_user);
$data[6] = $status_img;

View File

@ -73,8 +73,12 @@ $table_agent->styleTable = 'padding:0px;';
$table_agent->data = array();
$data = array();
$agent_name = ui_print_agent_name ($agent["id_agente"], true, 500,
"font-size: medium;", true);
/*$agent_name = ui_print_agent_name ($agent["id_agente"], true, 500,
"font-size: medium;", true);*/
$agent_name = "<a alt =".$agent["nombre"]." href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" . $agent["id_agente"] . "'>" .
'<span style="font-size: medium;font-weight:bold" title="' . $agent["nombre"] . '">'.$agent["alias"].'</span>' .
"</a>";
if ($agent['disabled']) {
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);

Some files were not shown because too many files have changed in this diff Show More