resolved conflicts in ver_agente
This commit is contained in:
commit
3ffd976365
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.728-181025
|
||||
Version: 7.0NG.728-181107
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.728-181025"
|
||||
pandora_version="7.0NG.728-181107"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.728';
|
||||
use constant AGENT_BUILD => '181025';
|
||||
use constant AGENT_BUILD => '181107';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.728
|
||||
%define release 181025
|
||||
%define release 181107
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -95,6 +95,7 @@ if [ ! -e /etc/pandora/plugins ]; then
|
|||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
mkdir -p /usr/share/pandora_agent/collections
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
fi
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.728
|
||||
%define release 181025
|
||||
%define release 181107
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
@ -88,7 +88,7 @@ if [ ! -e /etc/pandora/plugins ]; then
|
|||
fi
|
||||
|
||||
if [ ! -e /etc/pandora/collections ]; then
|
||||
ln -s /usr/share/pandora_agent/collections /etc/pandora
|
||||
mkdir /etc/pandora/collections
|
||||
fi
|
||||
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.728"
|
||||
PI_BUILD="181025"
|
||||
PI_BUILD="181107"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
@ -388,8 +388,8 @@ install () {
|
|||
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||
cp -r collections $PANDORA_BASE$PANDORA_HOME
|
||||
echo "Creating the collections directory in to $PANDORA_BASE$PANDORA_HOME/collections..."
|
||||
mkdir -p $PANDORA_BASE$PANDORA_HOME/collections
|
||||
chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
|
||||
ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
|
||||
|
||||
|
|
|
@ -25,12 +25,33 @@
|
|||
###############################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
# Retrieve information from all filesystems
|
||||
my $all_filesystems = 0;
|
||||
|
||||
# Regex flag
|
||||
my $regex_mode = 0;
|
||||
my $inode_mode = 0;
|
||||
|
||||
# Exclusion
|
||||
my @exclude_fs = ();
|
||||
my $cmd = undef;
|
||||
|
||||
|
||||
sub in_array {
|
||||
my ($array, $value) = @_;
|
||||
|
||||
if (!defined($value)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
my %params = map { $_ => 1 } @{$array};
|
||||
if (exists($params{$value})) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub check_re($$){
|
||||
my $item = shift;
|
||||
|
@ -65,11 +86,25 @@ if ($#ARGV < 0) {
|
|||
$all_filesystems = 1;
|
||||
}
|
||||
|
||||
# Check if regex mode is enabled
|
||||
if ($ARGV[0] eq "-r") {
|
||||
while ($#ARGV >= 0) {
|
||||
my $param = shift @ARGV;
|
||||
if ($param eq '-r') {
|
||||
$regex_mode = 1;
|
||||
shift @ARGV;
|
||||
}
|
||||
elsif ($param eq '-i') {
|
||||
$inode_mode = 1;
|
||||
}
|
||||
elsif ($param eq '-exclude_fs') {
|
||||
my $_tmp = shift @ARGV;
|
||||
chomp ($_tmp);
|
||||
@exclude_fs = split /,/, $_tmp;
|
||||
}
|
||||
elsif ($param eq '-custom_cmd') {
|
||||
$cmd = shift @ARGV;
|
||||
chomp ($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
# Parse command line parameters
|
||||
my %filesystems;
|
||||
|
@ -90,7 +125,15 @@ if ($onlyexclude) {
|
|||
|
||||
# Retrieve filesystem information
|
||||
# -P use the POSIX output format for portability
|
||||
my @df = `df -P`;
|
||||
|
||||
|
||||
$cmd = 'df -PT' unless defined($cmd);
|
||||
|
||||
if ($inode_mode > 0) {
|
||||
$cmd = 'df -PTi';
|
||||
}
|
||||
|
||||
my @df = `$cmd`;
|
||||
shift (@df);
|
||||
|
||||
# No filesystems? Something went wrong.
|
||||
|
@ -102,9 +145,13 @@ my %out;
|
|||
# Parse filesystem usage
|
||||
foreach my $row (@df) {
|
||||
my @columns = split (' ', $row);
|
||||
exit 1 if ($#columns < 4);
|
||||
if (check_in (\%filesystems,$columns[0]) || ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0]) )) {
|
||||
$out{$columns[0]} = $columns[4] ;
|
||||
exit 1 if ($#columns < 5);
|
||||
|
||||
next if (in_array(\@exclude_fs, $columns[1]) > 0);
|
||||
|
||||
if (check_in (\%filesystems,$columns[0])
|
||||
|| ($all_filesystems == 1 && !check_in(\%excluded_filesystems,$columns[0])) ){
|
||||
$out{$columns[0]} = $columns[5] ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +162,7 @@ while (my ($filesystem, $use) = each (%out)) {
|
|||
|
||||
# Print module output
|
||||
print "<module>\n";
|
||||
print "<name><![CDATA[" . $filesystem . "]]></name>\n";
|
||||
print "<name><![CDATA[" . ($inode_mode > 0 ? 'Inodes:' : '') . $filesystem . "]]></name>\n";
|
||||
print "<type><![CDATA[generic_data]]></type>\n";
|
||||
print "<data><![CDATA[" . $use . "]]></data>\n";
|
||||
print "<description><![CDATA[% of usage in this volume]]></description>\n";
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{181025}
|
||||
{181107}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -227,7 +227,7 @@ int Cron::getResetValue (int position) {
|
|||
* @return false if should not execute
|
||||
*/
|
||||
bool Cron::shouldExecuteAt (time_t date) {
|
||||
return this->utimestamp < date;
|
||||
return this->utimestamp <= date;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.728(Build 181025)")
|
||||
#define PANDORA_VERSION ("7.0NG.728(Build 181107)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.728(Build 181025))"
|
||||
VALUE "ProductVersion", "(7.0NG.728(Build 181107))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.728-181025
|
||||
Version: 7.0NG.728-181107
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
Installed-Size: 42112
|
||||
Maintainer: Artica ST <deptec@artica.es>
|
||||
Homepage: http://pandorafms.org/
|
||||
Depends: php5.6 | php5, php5.6-snmp | php5-snmp, php5.6-gd | php5-gd, php5.6-mysql | php5-mysql, php-db, php5.6-xmlrpc | php5-xmlrpc, php-gettext, php5.6-curl | php5-curl, graphviz, dbconfig-common, php5.6-ldap | php5-ldap, mysql-client | virtual-mysql-client
|
||||
Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc
|
||||
Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.728-181025"
|
||||
pandora_version="7.0NG.728-181107"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "Pandora FMS",
|
||||
"description": "Pandora Flexible Monitoring System ",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Artica",
|
||||
"email": "info@artica.es"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"mpdf/mpdf": "^7.1",
|
||||
"swiftmailer/swiftmailer": "^6.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,442 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "18364e5cd8c79657279985942190b4a7",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
"version": "v1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/lexer.git",
|
||||
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
|
||||
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Common\\Lexer\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roman Borschel",
|
||||
"email": "roman@code-factory.org"
|
||||
},
|
||||
{
|
||||
"name": "Guilherme Blanco",
|
||||
"email": "guilhermeblanco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Johannes Schmitt",
|
||||
"email": "schmittjoh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
|
||||
"homepage": "http://www.doctrine-project.org",
|
||||
"keywords": [
|
||||
"lexer",
|
||||
"parser"
|
||||
],
|
||||
"time": "2014-09-09T13:34:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "egulias/email-validator",
|
||||
"version": "2.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/egulias/EmailValidator.git",
|
||||
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
|
||||
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/lexer": "^1.0.1",
|
||||
"php": ">= 5.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"dominicsayers/isemail": "dev-master",
|
||||
"phpunit/phpunit": "^4.8.35||^5.7||^6.0",
|
||||
"satooshi/php-coveralls": "^1.0.1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Egulias\\EmailValidator\\": "EmailValidator"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Eduardo Gulias Davis"
|
||||
}
|
||||
],
|
||||
"description": "A library for validating emails against several RFCs",
|
||||
"homepage": "https://github.com/egulias/EmailValidator",
|
||||
"keywords": [
|
||||
"email",
|
||||
"emailvalidation",
|
||||
"emailvalidator",
|
||||
"validation",
|
||||
"validator"
|
||||
],
|
||||
"time": "2018-09-25T20:47:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v7.1.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/mpdf.git",
|
||||
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
||||
"reference": "2ed29c3a59fa23e77052e9d7fa7e31c707fb7502",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-gd": "*",
|
||||
"ext-mbstring": "*",
|
||||
"myclabs/deep-copy": "^1.7",
|
||||
"paragonie/random_compat": "^1.4|^2.0|9.99.99",
|
||||
"php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0",
|
||||
"psr/log": "^1.0",
|
||||
"setasign/fpdi": "1.6.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^0.9.5",
|
||||
"phpunit/phpunit": "^5.0",
|
||||
"squizlabs/php_codesniffer": "^2.7.0",
|
||||
"tracy/tracy": "^2.4"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "Needed for generation of some types of barcodes",
|
||||
"ext-xml": "Needed mainly for SVG manipulation",
|
||||
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-development": "7.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Mpdf\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0-only"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Matěj Humpál",
|
||||
"role": "Developer, maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Ian Back",
|
||||
"role": "Developer (retired)"
|
||||
}
|
||||
],
|
||||
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
|
||||
"homepage": "https://mpdf.github.io",
|
||||
"keywords": [
|
||||
"pdf",
|
||||
"php",
|
||||
"utf-8"
|
||||
],
|
||||
"time": "2018-09-19T09:58:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "myclabs/deep-copy",
|
||||
"version": "1.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/myclabs/DeepCopy.git",
|
||||
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/collections": "^1.0",
|
||||
"doctrine/common": "^2.6",
|
||||
"phpunit/phpunit": "^4.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"DeepCopy\\": "src/DeepCopy/"
|
||||
},
|
||||
"files": [
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Create deep copies (clones) of your objects",
|
||||
"keywords": [
|
||||
"clone",
|
||||
"copy",
|
||||
"duplicate",
|
||||
"object",
|
||||
"object graph"
|
||||
],
|
||||
"time": "2017-10-19T19:58:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v9.99.99",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/paragonie/random_compat.git",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*|5.*",
|
||||
"vimeo/psalm": "^1"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Paragon Initiative Enterprises",
|
||||
"email": "security@paragonie.com",
|
||||
"homepage": "https://paragonie.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
|
||||
"keywords": [
|
||||
"csprng",
|
||||
"polyfill",
|
||||
"pseudorandom",
|
||||
"random"
|
||||
],
|
||||
"time": "2018-07-02T15:55:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2016-10-10T12:19:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
"version": "1.6.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Setasign/FPDI.git",
|
||||
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
|
||||
"reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"suggest": {
|
||||
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
|
||||
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
|
||||
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"filters/",
|
||||
"fpdi.php",
|
||||
"fpdf_tpl.php",
|
||||
"fpdi_pdf_parser.php",
|
||||
"pdf_context.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jan Slabon",
|
||||
"email": "jan.slabon@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
}
|
||||
],
|
||||
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
|
||||
"homepage": "https://www.setasign.com/fpdi",
|
||||
"keywords": [
|
||||
"fpdf",
|
||||
"fpdi",
|
||||
"pdf"
|
||||
],
|
||||
"time": "2017-05-11T14:25:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "swiftmailer/swiftmailer",
|
||||
"version": "v6.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/swiftmailer/swiftmailer.git",
|
||||
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
|
||||
"reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"egulias/email-validator": "~2.0",
|
||||
"php": ">=7.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9.1",
|
||||
"symfony/phpunit-bridge": "~3.3@dev"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "Needed to support internationalized email addresses",
|
||||
"true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "6.1-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"lib/swift_required.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Chris Corbyn"
|
||||
},
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
}
|
||||
],
|
||||
"description": "Swiftmailer, free feature-rich PHP mailer",
|
||||
"homepage": "https://swiftmailer.symfony.com",
|
||||
"keywords": [
|
||||
"email",
|
||||
"mail",
|
||||
"mailer"
|
||||
],
|
||||
"time": "2018-09-11T07:12:52+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
|
@ -472,7 +472,7 @@ function print_alerts_summary_modal_window($id, $alerts) {
|
|||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
|
|
|
@ -14,20 +14,6 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/*
|
||||
function extension_db_status_extension_tables() {
|
||||
return array(
|
||||
'tbackup',
|
||||
'tfiles_repo',
|
||||
'tfiles_repo_group',
|
||||
'tipam_ip',
|
||||
'tipam_network',
|
||||
'tuser_task',
|
||||
'tuser_task_scheduled',
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
function extension_db_status() {
|
||||
global $config;
|
||||
|
||||
|
@ -37,11 +23,9 @@ function extension_db_status() {
|
|||
$db_name = get_parameter('db_name', '');
|
||||
$db_status_execute = (bool)get_parameter('db_status_execute', false);
|
||||
|
||||
|
||||
ui_print_page_header (__("DB Schema check"),
|
||||
"images/extensions.png", false, "", true, "");
|
||||
|
||||
|
||||
if (!is_user_admin($config['id_user'])) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access db status");
|
||||
|
@ -49,7 +33,6 @@ function extension_db_status() {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
ui_print_info_message(
|
||||
__('This extension checks the DB is correct. Because sometimes the old DB from a migration has not some fields in the tables or the data is changed.'));
|
||||
ui_print_info_message(
|
||||
|
@ -59,7 +42,7 @@ function extension_db_status() {
|
|||
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('DB settings') . "</legend>";
|
||||
$table = null;
|
||||
$table = new stdClass();
|
||||
$table->data = array();
|
||||
$row = array();
|
||||
$row[] = __("DB User with privileges");
|
||||
|
@ -89,7 +72,6 @@ function extension_db_status() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function extension_db_status_execute_checks($db_user, $db_password, $db_host, $db_name) {
|
||||
global $config;
|
||||
|
||||
|
@ -101,21 +83,35 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
|
|||
$db_name = explode(" ", $db_name);
|
||||
$db_name = $db_name[0];
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
$connection_test = mysqli_connect($db_host, $db_user, $db_password);
|
||||
}
|
||||
else{
|
||||
$connection_test = mysql_connect($db_host, $db_user, $db_password);
|
||||
}
|
||||
|
||||
if (!$connection_test) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful connected to the DB'));
|
||||
}
|
||||
else {
|
||||
if($config["mysqli"] === true){
|
||||
$create_db = mysqli_query($connection_test, "CREATE DATABASE `$db_name`");
|
||||
}else{
|
||||
$create_db = mysql_query("CREATE DATABASE `$db_name`");
|
||||
}
|
||||
|
||||
if (!$create_db) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful created the testing DB'));
|
||||
}
|
||||
else {
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name);
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name, $connection_test);
|
||||
}
|
||||
|
||||
$install_tables = extension_db_status_execute_sql_file(
|
||||
$config['homedir'] . "/pandoradb.sql",
|
||||
|
@ -125,29 +121,22 @@ function extension_db_status_execute_checks($db_user, $db_password, $db_host, $d
|
|||
ui_print_error_message(
|
||||
__('Unsuccessful installed tables into the testing DB'));
|
||||
}
|
||||
else {/*
|
||||
if (enterprise_installed()) {
|
||||
$install_tables_enterprise =
|
||||
extension_db_status_execute_sql_file(
|
||||
$config['homedir'] . "/enterprise/pandoradb.sql",
|
||||
$connection_test);
|
||||
|
||||
if (!$install_tables_enterprise) {
|
||||
ui_print_error_message(
|
||||
__('Unsuccessful installed enterprise tables into the testing DB'));
|
||||
}
|
||||
}
|
||||
*/
|
||||
else {
|
||||
extension_db_check_tables_differences(
|
||||
$connection_test,
|
||||
$connection_system,
|
||||
$db_name,
|
||||
$config['dbname']);
|
||||
//extension_db_check_data_differences();
|
||||
}
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name);
|
||||
mysqli_query($connection_test, "DROP DATABASE IF EXISTS `$db_name`");
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name, $connection_test);
|
||||
mysql_query ("DROP DATABASE IF EXISTS `$db_name`");
|
||||
mysql_query("DROP DATABASE IF EXISTS `$db_name`", $connection_test);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,25 +146,52 @@ function extension_db_check_tables_differences($connection_test,
|
|||
|
||||
global $config;
|
||||
|
||||
|
||||
// --------- Check the tables --------------------------------------
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name_test);
|
||||
$result = mysqli_query($connection_test, "SHOW TABLES");
|
||||
}else{
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||
}
|
||||
|
||||
$tables_test = array();
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array($result)) {
|
||||
$tables_test[] = $row[0];
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
|
||||
mysqli_select_db($connection_test, $db_name_system);
|
||||
|
||||
$result = mysqli_query( $connection_test, "SHOW TABLES");
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$tables_test[] = $row[0];
|
||||
}
|
||||
mysql_free_result($result);
|
||||
//~ $tables_test = array_merge($tables_test,
|
||||
//~ extension_db_status_extension_tables());
|
||||
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
|
||||
$result = mysql_query("SHOW TABLES", $connection_test);
|
||||
}
|
||||
|
||||
$tables_system = array();
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array ($result)) {
|
||||
$tables_system[] = $row[0];
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$tables_system[] = $row[0];
|
||||
}
|
||||
mysql_free_result($result);
|
||||
}
|
||||
|
||||
$diff_tables = array_diff($tables_test, $tables_system);
|
||||
|
||||
|
@ -187,6 +203,21 @@ function extension_db_check_tables_differences($connection_test,
|
|||
|
||||
if (!empty($diff_tables)) {
|
||||
foreach ($diff_tables as $table) {
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name_test);
|
||||
$result = mysqli_query($connection_test, "SHOW CREATE TABLE " . $table);
|
||||
$tables_test = array();
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
ui_print_info_message(
|
||||
__('You can execute this SQL query for to fix.') . "<br />" .
|
||||
'<pre>' .
|
||||
$row[1] .
|
||||
'</pre>'
|
||||
);
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("SHOW CREATE TABLE " . $table, $connection_test);
|
||||
$tables_test = array();
|
||||
|
@ -201,16 +232,37 @@ function extension_db_check_tables_differences($connection_test,
|
|||
mysql_free_result($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------- Check the fields -------------------------------
|
||||
$correct_fields = true;
|
||||
|
||||
foreach ($tables_system as $table) {
|
||||
|
||||
if ($config["mysqli"] === true) {
|
||||
mysqli_select_db($connection_test, $db_name_test);
|
||||
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
|
||||
}
|
||||
else{
|
||||
mysql_select_db($db_name_test, $connection_test);
|
||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||
}
|
||||
|
||||
$fields_test = array();
|
||||
if (!empty($result)) {
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array ($result)) {
|
||||
$fields_test[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysqli_free_result ($result);
|
||||
mysqli_select_db($connection_test, $db_name_system);
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
$fields_test[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
|
@ -221,14 +273,32 @@ function extension_db_check_tables_differences($connection_test,
|
|||
'extra' => $row[5]);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
mysql_select_db($db_name_system, $connection_test);
|
||||
if($config["mysqli"] === true){
|
||||
$result = mysqli_query($connection_test, "EXPLAIN " . $table);
|
||||
}
|
||||
else{
|
||||
$result = mysql_query("EXPLAIN " . $table, $connection_test);
|
||||
}
|
||||
|
||||
$fields_system = array();
|
||||
if (!empty($result)) {
|
||||
if ($config["mysqli"] === true) {
|
||||
while ($row = mysqli_fetch_array ($result)) {
|
||||
$fields_system[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
'type' => $row[1],
|
||||
'null' => $row[2],
|
||||
'key' => $row[3],
|
||||
'default' => $row[4],
|
||||
'extra' => $row[5]);
|
||||
}
|
||||
mysqli_free_result($result);
|
||||
}
|
||||
else{
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$fields_system[$row[0]] = array(
|
||||
'field ' => $row[0],
|
||||
|
@ -240,6 +310,7 @@ function extension_db_check_tables_differences($connection_test,
|
|||
}
|
||||
mysql_free_result($result);
|
||||
}
|
||||
}
|
||||
foreach ($fields_test as $name_field => $field_test) {
|
||||
if (!isset($fields_system[$name_field])) {
|
||||
$correct_fields = false;
|
||||
|
@ -303,17 +374,13 @@ function extension_db_check_tables_differences($connection_test,
|
|||
$info_message .= "<br><br>Please check the SQL file for to know the kind of extra config needed.";
|
||||
}
|
||||
|
||||
ui_print_error_message(
|
||||
__($error_message));
|
||||
|
||||
ui_print_info_message(
|
||||
__($info_message));
|
||||
ui_print_error_message(__($error_message));
|
||||
|
||||
ui_print_info_message(__($info_message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($correct_fields) {
|
||||
ui_print_success_message(
|
||||
__('Successful all the tables have the correct fields')
|
||||
|
@ -322,6 +389,7 @@ function extension_db_check_tables_differences($connection_test,
|
|||
}
|
||||
|
||||
function extension_db_status_execute_sql_file($url, $connection) {
|
||||
global $config;
|
||||
if (file_exists($url)) {
|
||||
$file_content = file($url);
|
||||
$query = "";
|
||||
|
@ -329,11 +397,20 @@ function extension_db_status_execute_sql_file($url, $connection) {
|
|||
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
|
||||
$query .= $sql_line;
|
||||
if (preg_match("/;[\040]*\$/", $sql_line)) {
|
||||
if ($config["mysqli"] === true) {
|
||||
if (!$result = mysqli_query($connection, $query)) {
|
||||
echo mysqli_error(); //Uncomment for debug
|
||||
echo "<i><br>$query<br></i>";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (!$result = mysql_query($query, $connection)) {
|
||||
echo mysql_error(); //Uncomment for debug
|
||||
echo "<i><br>$query<br></i>";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$query = "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
function dbmanager_query ($sql, &$error, $dbconnection) {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$retval = array();
|
||||
|
||||
if ($sql == '')
|
||||
|
@ -52,7 +50,7 @@ function dbmanager_query ($sql, &$error, $dbconnection) {
|
|||
}
|
||||
|
||||
if($config["mysqli"]){
|
||||
while ($row = mysqli_fetch_array ($result, MYSQL_ASSOC)) {
|
||||
while ($row = mysqli_fetch_array ($result, MYSQLI_ASSOC)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
}
|
||||
|
@ -74,38 +72,6 @@ function dbmanager_query ($sql, &$error, $dbconnection) {
|
|||
|
||||
//Return false, check with === or !==
|
||||
return "Empty";
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$retval = array();
|
||||
|
||||
if ($sql == '')
|
||||
return false;
|
||||
|
||||
$sql = html_entity_decode($sql, ENT_QUOTES);
|
||||
|
||||
$result = db_process_sql($sql, "affected_rows", '', false, $status);
|
||||
|
||||
//$result = mysql_query ($sql);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace();
|
||||
$error = db_get_last_error();
|
||||
|
||||
if (empty($error)) {
|
||||
return "Empty";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($status == 2) {
|
||||
return $result;
|
||||
}
|
||||
else {
|
||||
return $result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,15 +86,6 @@ function dbmgr_extension_main () {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Disabled at the moment.
|
||||
if (!check_referer()) {
|
||||
require ("general/noaccess.php");
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
$sql = (string) get_parameter ('sql');
|
||||
|
||||
ui_print_page_header (__('Database interface'), "images/gm_db.png", false, false, true);
|
||||
|
|
|
@ -48,7 +48,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
|
|||
$data
|
||||
);
|
||||
|
||||
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data";
|
||||
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . strtotime($time) . ".data";
|
||||
return (bool) @file_put_contents($file_name, $xml);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,15 @@ switch($graph) {
|
|||
if (count($data_array) > 1) {
|
||||
$data = $data_array[1];
|
||||
}
|
||||
// Redefine boolean data
|
||||
switch ($data) {
|
||||
case "up(1)":
|
||||
$data = 1;
|
||||
break;
|
||||
case "down(0)":
|
||||
$data = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
START TRANSACTION;
|
||||
|
||||
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||
|
||||
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
|
||||
|
||||
COMMIT;
|
|
@ -1180,13 +1180,13 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
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', 21);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 22);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '728');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '729');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tconfig_os`
|
||||
|
@ -1230,6 +1230,7 @@ ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REF
|
|||
ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0';
|
||||
alter table tusuario add autorefresh_white_list text not null default '';
|
||||
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
|
||||
ALTER TABLE `tusuario` DROP COLUMN `flash_chart`;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagente_modulo`
|
||||
|
@ -1740,6 +1741,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_template` (
|
|||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout_template_data`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
|
|
@ -198,8 +198,12 @@ echo "<div class='modalgobutton gopandora'>
|
|||
<script>
|
||||
|
||||
$(".cerrar").click(function(){
|
||||
$("#alert_messages").hide();
|
||||
$( "#opacidad" ).remove();
|
||||
$("#alert_messages")
|
||||
.css('opacity', 0)
|
||||
.hide();
|
||||
$( "#opacidad" )
|
||||
.css('opacity', 0)
|
||||
.remove();
|
||||
});
|
||||
|
||||
$(".gopandora").click(function(){
|
||||
|
|
|
@ -70,9 +70,10 @@ switch ($login_screen) {
|
|||
$logo_link = 'index.php';
|
||||
$logo_title = __('Refresh');
|
||||
break;
|
||||
$splash_title = __('Splash login');
|
||||
}
|
||||
|
||||
$splash_title = __('Splash login');
|
||||
|
||||
$url = '?login=1';
|
||||
//These variables come from index.php
|
||||
if (!empty ($page) && !empty ($sec)) {
|
||||
|
@ -303,7 +304,7 @@ echo '</div>';
|
|||
echo '<div id="ver_num">'.$pandora_version.(($develop_bypass == 1) ? ' '.__('Build').' '.$build_version : '') . '</div>';
|
||||
echo '</div>';
|
||||
|
||||
if ($process_error_message == '' && $mail != "") {
|
||||
if (!isset($process_error_message) && isset($mail)) {
|
||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
|
@ -321,7 +322,7 @@ if ($process_error_message == '' && $mail != "") {
|
|||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
else if ($process_error_message != '') {
|
||||
else if (isset($process_error_message)) {
|
||||
echo '<div id="reset_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
|
@ -341,7 +342,7 @@ else if ($process_error_message != '') {
|
|||
}
|
||||
|
||||
|
||||
if ($correct_reset_pass_process != "") {
|
||||
if (isset($correct_reset_pass_process)) {
|
||||
echo '<div id="final_process_correct" title="' . __('Password reset') . '">';
|
||||
echo '<div class="content_alert">';
|
||||
echo '<div class="icon_message_alert">';
|
||||
|
|
|
@ -92,8 +92,8 @@ echo '<div id="login_id_dialog" title="' .
|
|||
|
||||
if ($zone_selected == "") {
|
||||
if ($config["timezone"] != "") {
|
||||
list($zone) = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone;
|
||||
$zone_array = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone_array[0];
|
||||
}
|
||||
else {
|
||||
$zone_selected = 'Europe';
|
||||
|
@ -195,9 +195,10 @@ $("#language").click(function () {
|
|||
{"page": "general/login_required",
|
||||
"change_language": change_language},
|
||||
function (data) {}
|
||||
);
|
||||
).done(function () {
|
||||
location.reload();
|
||||
});
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//DISPLAY
|
||||
|
|
|
@ -210,6 +210,7 @@ if (!empty($all_data)) {
|
|||
echo '<div id="activity">';
|
||||
|
||||
$table = new stdClass();
|
||||
$table->class = "databox data";
|
||||
$table->width = '100%'; //Don't specify px
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
|
@ -274,7 +275,12 @@ if (!empty($all_data)) {
|
|||
. human_time_comparation($session['utimestamp'], 'tiny');
|
||||
$data[3] = $session_ip_origen;
|
||||
$description = str_replace(array(',', ', '), ', ', $session['descripcion']);
|
||||
if(strlen($description)>100){
|
||||
$data[4] = '<div >' . io_safe_output(substr($description, 0, 150).'...') . '</div>';
|
||||
}
|
||||
else{
|
||||
$data[4] = '<div >' . io_safe_output($description) . '</div>';
|
||||
}
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ foreach ($result as $row) {
|
|||
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
|
||||
. ui_print_timestamp($row["utimestamp"], true);
|
||||
$data[3] = $row["ip_origen"];
|
||||
$data[4] = $row["descripcion"];
|
||||
$data[4] = io_safe_output($row["descripcion"]);
|
||||
|
||||
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
|
||||
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));
|
||||
|
|
|
@ -541,7 +541,7 @@ if (!empty($interfaces_list)) {
|
|||
$table->data[0][1] = '';
|
||||
$table->data[0][2] = '<b>'.__('Modules').'</b>';
|
||||
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
|
||||
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
|
||||
$table->data[1][1] = html_print_image('images/darrowright.png', true);
|
||||
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
|
||||
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);
|
||||
|
|
|
@ -1772,13 +1772,15 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
|||
// =====================
|
||||
if ($enable_module) {
|
||||
$result = modules_change_disabled($enable_module, 0);
|
||||
$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$enable_module."");
|
||||
$modulo_nombre = $modulo_nombre['nombre'];
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_enable_module_conf', array($id_agente, $enable_module));
|
||||
db_pandora_audit("Module management", 'Enable ' . $enable_module);
|
||||
db_pandora_audit("Module management", 'Enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Module management", 'Fail to enable ' . $enable_module);
|
||||
db_pandora_audit("Module management", 'Fail to enable #' . $enable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
@ -1787,13 +1789,15 @@ if ($enable_module) {
|
|||
|
||||
if ($disable_module) {
|
||||
$result = modules_change_disabled($disable_module, 1);
|
||||
$modulo_nombre = db_get_row_sql("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = ".$disable_module."");
|
||||
$modulo_nombre = $modulo_nombre['nombre'];
|
||||
|
||||
if ($result === NOERR) {
|
||||
enterprise_hook('config_agents_disable_module_conf', array($id_agente, $disable_module));
|
||||
db_pandora_audit("Module management", 'Disable ' . $disable_module);
|
||||
db_pandora_audit("Module management", 'Disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||
}
|
||||
else {
|
||||
db_pandora_audit("Module management", 'Fail to disable ' . $disable_module);
|
||||
db_pandora_audit("Module management", 'Fail to disable #' . $disable_module . ' | ' . $modulo_nombre . ' | ' . $agent["alias"]);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
|
|
@ -481,8 +481,7 @@ if ($agents !== false) {
|
|||
|
||||
if($agent["id_os"] == 100){
|
||||
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['nombre'].'</a>';
|
||||
|
||||
echo '<a href="index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_builder&id_cluster='.$cluster['id'].'&step=1&update=1">'.$agent['alias'].'</a>';
|
||||
}else{
|
||||
echo "<a alt =".$agent["nombre"]." href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
|
||||
|
|
|
@ -139,7 +139,7 @@ if (($policy_page) || (isset($agent))) {
|
|||
echo '</td>';
|
||||
}
|
||||
echo '<td class="datos" style="font-weight: bold; width:20%;">';
|
||||
echo __("Type");
|
||||
echo __("<p>Type</p>");
|
||||
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
|
||||
html_print_input_hidden ('edit_module', 1);
|
||||
echo '</td>';
|
||||
|
@ -313,7 +313,7 @@ $selectIntervalUp = '';
|
|||
$selectIntervalDown = '';
|
||||
$sortField = get_parameter('sort_field');
|
||||
$sort = get_parameter('sort', 'none');
|
||||
$selected = 'border: 1px solid black;';
|
||||
$selected = '';
|
||||
|
||||
$order[] = array('field' => 'tmodule_group.name', 'order' => 'ASC');
|
||||
|
||||
|
@ -547,7 +547,8 @@ $table->head[7] = __('Warn');
|
|||
|
||||
|
||||
$table->head[8] = __('Action');
|
||||
$table->head[9] = '<span title="' . __('Delete') . '">' . __('D.') . '</span>';
|
||||
$table->head[9] = '<span title="' . __('Delete') . '">' . __('Del.') . '</span>'.
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
|
||||
$table->rowstyle = array();
|
||||
$table->style = array ();
|
||||
|
@ -607,7 +608,7 @@ foreach ($modules as $module) {
|
|||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||
$table->colspan[$i - 1][0] = 10;
|
||||
else
|
||||
$table->colspan[$i - 1][0] = 8;
|
||||
$table->colspan[$i - 1][0] = 9;
|
||||
|
||||
$data = array ();
|
||||
}
|
||||
|
@ -778,12 +779,13 @@ foreach ($modules as $module) {
|
|||
|
||||
if (check_acl_one_of_groups ($config['id_user'], $all_groups, "AW")) {
|
||||
// Delete module
|
||||
$data[9] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
$data[9] .= ' <a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
|
||||
$data[9] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$module['id_agente_modulo'].'"
|
||||
onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">';
|
||||
$data[9] .= html_print_image ('images/cross.png', true,
|
||||
array ('title' => __('Delete')));
|
||||
$data[9] .= '</a> ';
|
||||
$data[9] .= html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true);
|
||||
}
|
||||
|
||||
array_push ($table->data, $data);
|
||||
|
@ -817,8 +819,23 @@ $(document).ready (function () {
|
|||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-id_delete]').parent().parent().addClass('checkselected');
|
||||
$("[name^=id_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-id_delete]').parent().parent().removeClass('checkselected');
|
||||
$("[name^=id_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function change_mod_filter() {
|
||||
var checked = $("#checkbox-status_hierachy_mode").is(":checked");
|
||||
|
||||
|
|
|
@ -35,6 +35,11 @@ if (is_ajax ()) {
|
|||
// Decrypt passwords in the component.
|
||||
$component['plugin_pass'] = io_output_password($component['plugin_pass']);
|
||||
|
||||
$component['str_warning'] = io_safe_output($component['str_warning']);
|
||||
$component['str_critical'] = io_safe_output($component['str_critical']);
|
||||
$component['warning_inverse'] = (bool)$component['warning_inverse'];
|
||||
$component['critical_inverse'] = (bool)$component['critical_inverse'];
|
||||
|
||||
echo io_json_mb_encode ($component);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -179,9 +179,23 @@ if ($create_action) {
|
|||
db_pandora_audit("Command management", "Fail try to create alert action", false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$messageAction = __('No name specified');
|
||||
}
|
||||
|
||||
if ($id_alert_command == "") {
|
||||
$messageAction = __('No command specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
if ($update_action) {
|
||||
|
|
|
@ -307,9 +307,22 @@ if ($create_command) {
|
|||
db_pandora_audit("Command management", "Fail try to create alert command", false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$messageAction = __('No name specified');
|
||||
}
|
||||
|
||||
if ($command == "") {
|
||||
$messageAction = __('No command specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,16 +102,8 @@ if ($groups_user === false) {
|
|||
$groups_id = implode(',', array_keys($groups_user));
|
||||
|
||||
$form_filter .= "<tr>";
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
||||
break;
|
||||
case "oracle":
|
||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id)");
|
||||
break;
|
||||
}
|
||||
|
||||
$temp = db_get_all_rows_sql("SELECT id, name FROM talert_actions WHERE id_group IN ($groups_id);");
|
||||
$arrayActions = array();
|
||||
if (is_array($temp)) {
|
||||
foreach ($temp as $actionElement) {
|
||||
|
@ -186,23 +178,10 @@ if ($searchFlag) {
|
|||
field3_recovery LIKE '%" . trim($fieldContent) . "%')";
|
||||
if (strlen(trim($moduleName)) > 0)
|
||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')";
|
||||
//if ($agentID != -1)
|
||||
//$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $agentID . ")";
|
||||
if (strlen(trim($agentName)) > 0) {
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
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.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.alias LIKE '" . trim($agentName) . "')";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($actionID != -1 && $actionID != '')
|
||||
$where .= " AND talert_template_modules.id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
|
||||
|
@ -212,17 +191,7 @@ if ($searchFlag) {
|
|||
$where .= " AND talert_template_modules.standby = " . $standby;
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$id_agents = array_keys ($agents);
|
||||
break;
|
||||
case "oracle":
|
||||
$id_agents = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$total = agents_get_alerts_simple ($id_agents, false,
|
||||
false, $where, false, false, false, true);
|
||||
|
@ -645,7 +614,7 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
|
@ -704,19 +673,24 @@ foreach ($simple_alerts as $alert) {
|
|||
// To manage alert is necessary LW permissions in the agent group
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LW")) {
|
||||
$data[4] .= ' <form class="delete_alert_form" action="' . $url . '" method="post" style="display: inline;">';
|
||||
$is_cluster = (bool)get_parameter('id_cluster');
|
||||
if (!$is_cluster) {
|
||||
if ($alert['disabled']) {
|
||||
|
||||
$data[4] .= html_print_image('images/add.disabled.png',
|
||||
true, array('title' => __("Add action")));
|
||||
}
|
||||
else {
|
||||
$data[4] .= '<a href="javascript:show_add_action(\'' . $alert['id'] . '\');">';
|
||||
|
||||
$data[4] .= html_print_image('images/add.png', true, array('title' => __("Add action")));
|
||||
$data[4] .= '</a>';
|
||||
}
|
||||
}
|
||||
$data[4] .= html_print_input_image ('delete', 'images/cross.png', 1, '', true, array('title' => __('Delete')));
|
||||
$data[4] .= html_print_input_hidden ('delete_alert', 1, true);
|
||||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
$data[4] .= '</form>';
|
||||
|
||||
if ($is_cluster) {
|
||||
$data[4] .= '<form class="view_alert_form" method="post" style="display: inline;">';
|
||||
|
||||
$data[4] .= html_print_input_image ('update', 'images/builder.png', 1, '', true, array('title' => __('Update')));
|
||||
|
@ -724,7 +698,7 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[4] .= html_print_input_hidden ('id_alert', $alert['id'], true);
|
||||
|
||||
$data[4] .= '</form>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(check_acl_one_of_groups ($config['id_user'], $all_groups, "LM")) {
|
||||
|
|
|
@ -126,8 +126,23 @@ if ($create_alert) {
|
|||
"Fail Added alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'");
|
||||
}
|
||||
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($id_alert_template == "") {
|
||||
$messageAction = __('No template specified');
|
||||
}
|
||||
|
||||
if ($id_agent_module == "") {
|
||||
$messageAction = __('No module specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($id,
|
||||
__('Successfully created'), __('Could not be created'), '', true);
|
||||
__('Successfully created'), $messageAction, '', true);
|
||||
|
||||
|
||||
if ($id !== false) {
|
||||
$action_select = get_parameter('action_select');
|
||||
|
|
|
@ -113,7 +113,13 @@ if ($create_special_day) {
|
|||
$values['id_group'] = (string) get_parameter ('id_group');
|
||||
$values['description'] = (string) get_parameter ('description');
|
||||
|
||||
list($year, $month, $day) = explode("-", $date);
|
||||
|
||||
$array_date = explode("-", $date);
|
||||
|
||||
$year = $array_date[0];
|
||||
$month = $array_date[1];
|
||||
$day = $array_date[2];
|
||||
|
||||
if ($year == '*') {
|
||||
# '0001' means every year.
|
||||
$year = '0001';
|
||||
|
@ -130,6 +136,7 @@ if ($create_special_day) {
|
|||
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
||||
if ($date_check == $date) {
|
||||
$result = '';
|
||||
$messageAction = __('Could not be created, it already exists');
|
||||
}
|
||||
else {
|
||||
$result = alerts_create_alert_special_day ($date, $same_day, $values);
|
||||
|
@ -144,9 +151,15 @@ if ($create_special_day) {
|
|||
db_pandora_audit("Command management", "Fail try to create special day", false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
if ($update_special_day) {
|
||||
|
@ -159,7 +172,12 @@ if ($update_special_day) {
|
|||
$id_group = (string) get_parameter ('id_group');
|
||||
$id_group_orig = (string) get_parameter ('id_group_orig');
|
||||
|
||||
list($year, $month, $day) = explode("-", $date);
|
||||
$array_date = explode("-", $date);
|
||||
|
||||
$year = $array_date[0];
|
||||
$month = $array_date[1];
|
||||
$day = $array_date[2];
|
||||
|
||||
if ($year == '*') {
|
||||
# '0001' means every year.
|
||||
$year = '0001';
|
||||
|
@ -183,6 +201,7 @@ if ($update_special_day) {
|
|||
$date_check = db_get_value_filter ('date', 'talert_special_days', $filter);
|
||||
if ($date_check == $date) {
|
||||
$result = '';
|
||||
$messageAction = __('Could not be updated, it already exists');
|
||||
}
|
||||
else {
|
||||
$result = alerts_update_alert_special_day ($id, $values);
|
||||
|
@ -202,9 +221,15 @@ if ($update_special_day) {
|
|||
db_pandora_audit("Command management", "Fail to update special day " . $id, false, false);
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be updated');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully updated'),
|
||||
__('Could not be updated'));
|
||||
$messageAction);
|
||||
}
|
||||
|
||||
if ($delete_special_day) {
|
||||
|
|
|
@ -82,7 +82,7 @@ $table_details->data[] = $data;
|
|||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
|
|
|
@ -428,9 +428,21 @@ if ($create_template) {
|
|||
json_encode($values));
|
||||
}
|
||||
|
||||
ui_print_result_message ($result,
|
||||
|
||||
/* Show errors */
|
||||
if (!isset($messageAction)) {
|
||||
$messageAction = __('Could not be created');
|
||||
}
|
||||
|
||||
if ($name == "") {
|
||||
$messageAction = __('No template name specified');
|
||||
}
|
||||
|
||||
$messageAction = ui_print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
__('Could not be created'));
|
||||
$messageAction);
|
||||
|
||||
|
||||
/* Go to previous step in case of error */
|
||||
if ($result === false)
|
||||
$step = $step - 1;
|
||||
|
|
|
@ -111,7 +111,7 @@ $table->head[2] = __('Event type');
|
|||
$table->head[3] = __('Event status');
|
||||
$table->head[4] = __('Severity');
|
||||
$table->head[5] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
|
@ -178,12 +178,32 @@ echo "</div>";
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$(".check_delete").prop('checked', true);
|
||||
|
||||
$("input[name=all_delete]").css("margin-left", "32px");
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(".check_delete").prop('checked', false);
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -151,10 +151,13 @@ $table->head[] = __("Login Function");
|
|||
$table->head[] = __("Agent operation tab");
|
||||
$table->head[] = __("Agent godmode tab");
|
||||
$table->head[] = __("Operation");
|
||||
|
||||
/*
|
||||
$table->width = array();
|
||||
$table->width[] = '30%';
|
||||
$table->width[] = '30%';
|
||||
*/
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
|
||||
$table->align = array();
|
||||
$table->align[] = 'left';
|
||||
|
|
|
@ -245,11 +245,12 @@ $module_types = db_get_all_rows_filter (
|
|||
if ($module_types === false)
|
||||
$module_types = array ();
|
||||
|
||||
$types = '';
|
||||
$types = array();
|
||||
foreach ($module_types as $type) {
|
||||
$types[$type['id_tipo']] = $type['description'];
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->data = array ();
|
||||
|
@ -274,7 +275,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types, 'module_type', ''
|
|||
'width:100%');
|
||||
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
||||
html_print_checkbox_extended("force_type", 'type', '', '', false,
|
||||
'', 'style="margin-right: 40px;"', true);
|
||||
'style="margin-right: 40px;"', true, '');
|
||||
|
||||
$modules = array ();
|
||||
if ($module_type != '') {
|
||||
|
|
|
@ -175,6 +175,7 @@ if ($update) {
|
|||
}
|
||||
}
|
||||
|
||||
$table = new stdClass();
|
||||
$table->id = 'delete_table';
|
||||
$table->class = 'databox filters';
|
||||
$table->width = '100%';
|
||||
|
@ -235,7 +236,7 @@ switch ($config["dbtype"]) {
|
|||
if ($module_types === false)
|
||||
$module_types = array ();
|
||||
|
||||
$types = '';
|
||||
$types = array();
|
||||
foreach ($module_types as $type) {
|
||||
$types[$type['id_tipo']] = $type['description'];
|
||||
}
|
||||
|
@ -248,22 +249,18 @@ $snmp_versions['3'] = 'v. 3';
|
|||
$table->width = '100%';
|
||||
$table->data = array ();
|
||||
|
||||
|
||||
|
||||
$table->data['selection_mode'][0] = __('Selection mode');
|
||||
$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] .= '<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);
|
||||
|
||||
|
||||
|
||||
|
||||
$table->rowclass['form_modules_1'] = 'select_modules_row';
|
||||
$table->data['form_modules_1'][0] = __('Module type');
|
||||
$table->data['form_modules_1'][0] .= '<span id="module_loading" class="invisible">';
|
||||
$table->data['form_modules_1'][0] .= html_print_image('images/spinner.png', true);
|
||||
$table->data['form_modules_1'][0] .= '</span>';
|
||||
|
||||
$types[0] = __('All');
|
||||
$table->colspan['form_modules_1'][1] = 2;
|
||||
$table->data['form_modules_1'][1] = html_print_select ($types,
|
||||
|
@ -271,7 +268,7 @@ $table->data['form_modules_1'][1] = html_print_select ($types,
|
|||
|
||||
$table->data['form_modules_1'][3] = __('Select all modules of this type') . ' ' .
|
||||
html_print_checkbox_extended ("force_type", 'type', '', '', false,
|
||||
'', 'style="margin-right: 40px;"', true);
|
||||
'style="margin-right: 40px;"', true, '');
|
||||
|
||||
$modules = array ();
|
||||
if ($module_type != '') {
|
||||
|
|
|
@ -193,7 +193,7 @@ $table->class = 'databox data';
|
|||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
|
@ -250,12 +250,31 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").prop('checked')) {
|
||||
$(".check_delete").prop('checked', true);
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(".check_delete").prop('checked', false);
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -568,8 +568,7 @@ $table->head[3] = __('Description');
|
|||
$table->head[4] = __('Group');
|
||||
$table->head[5] = __('Max/Min');
|
||||
$table->head[6] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false,
|
||||
'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size = array ();
|
||||
$table->size[1] = '75px';
|
||||
$table->size[6] = '80px';
|
||||
|
@ -650,12 +649,30 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").prop("checked")) {
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -125,7 +125,7 @@ $table->data[4][1] .= html_print_input_text ('max_warning', $max_warning,
|
|||
'', 5, 15, true) . '</span>';
|
||||
$table->data[4][1] .= '<span id="string_warning"><em>'.__('Str.').' </em> ';
|
||||
$table->data[4][1] .= html_print_input_text ('str_warning', $str_warning,
|
||||
'', 5, 15, true) . '</span>';
|
||||
'', 5, 64, true) . '</span>';
|
||||
$table->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true);
|
||||
|
||||
|
@ -142,7 +142,7 @@ $table->data[5][1] .= html_print_input_text ('max_critical', $max_critical,
|
|||
'', 5, 15, true) . '</span>';
|
||||
$table->data[5][1] .= '<span id="string_critical"><em>'.__('Str.').' </em> ';
|
||||
$table->data[5][1] .= html_print_input_text ('str_critical', $str_critical,
|
||||
'', 5, 15, true) . '</span>';
|
||||
'', 5, 64, true) . '</span>';
|
||||
$table->data[5][1] .= '<br /><em>'.__('Inverse interval').'</em>';
|
||||
$table->data[5][1] .= html_print_checkbox ("critical_inverse", 1, $critical_inverse, true);
|
||||
|
||||
|
|
|
@ -239,16 +239,33 @@ echo '</div></form>';
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// If you click on the input type checkbox with id checkbox-all_delete
|
||||
$('#checkbox-all_delete').click(function() {
|
||||
// If selected (if the checked property equals true)
|
||||
if ($(this).prop('checked')) {
|
||||
// Select each input that has the class .check_delete
|
||||
$('.check_delete').prop('checked', true);
|
||||
} else {
|
||||
// deselect every input that has the class .check_delete
|
||||
$('.check_delete').prop('checked', false);
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
// If you click on the input type checkbox with id checkbox-all_delete
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
// If selected (if the checked property equals true)
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
// Select each input that has the class .check_delete
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
// deselect every input that has the class .check_delete
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -119,8 +119,7 @@ $table->head = array ();
|
|||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Action') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false,
|
||||
'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->align = array ();
|
||||
|
@ -174,12 +173,30 @@ enterprise_hook('close_meta_frame');
|
|||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").attr('checked')) {
|
||||
$(".check_delete").attr('checked', true);
|
||||
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(".check_delete").attr('checked', false);
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -195,7 +195,8 @@ if ($add_module) {
|
|||
"')");
|
||||
|
||||
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
|
||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
|
||||
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
|
||||
|
||||
$order = $order['field_order'];
|
||||
foreach($id_agent_modules as $id_agent_module){
|
||||
$order++;
|
||||
|
@ -207,8 +208,13 @@ if ($add_module) {
|
|||
}
|
||||
|
||||
if ($delete_module) {
|
||||
$id_graph = get_parameter('id');
|
||||
|
||||
$deleteGraph = get_parameter('delete');
|
||||
$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
|
||||
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
|
||||
db_process_sql ('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
|
||||
|
||||
}
|
||||
|
||||
if ($change_weight) {
|
||||
|
|
|
@ -168,8 +168,7 @@ if (!empty ($graphs)) {
|
|||
$op_column = true;
|
||||
$table->align[4] = 'left';
|
||||
$table->head[4] = __('Op.') .
|
||||
html_print_checkbox('all_delete', 0, false, true, false,
|
||||
'check_all_checkboxes();');
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size[4] = '90px';
|
||||
}
|
||||
$table->data = array ();
|
||||
|
@ -236,13 +235,29 @@ else {
|
|||
|
||||
$("input[name=all_delete]").css("margin-left", "32px");
|
||||
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").prop("checked")) {
|
||||
$( document ).ready(function() {
|
||||
|
||||
$('[id^=checkbox-delete_multiple]').change(function(){
|
||||
if($(this).parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -28,6 +28,27 @@ $( document ).ready(function() {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
$('[id^=checkbox-massive_report_check]').change(function(){
|
||||
if($(this).parent().parent().parent().hasClass('checkselected')){
|
||||
$(this).parent().parent().parent().removeClass('checkselected');
|
||||
}
|
||||
else{
|
||||
$(this).parent().parent().parent().addClass('checkselected');
|
||||
}
|
||||
});
|
||||
|
||||
$('[id^=checkbox-all_delete]').change(function(){
|
||||
if ($("#checkbox-all_delete").prop("checked")) {
|
||||
$('[id^=checkbox-massive_report_check]').parent().parent().parent().addClass('checkselected');
|
||||
$(".check_delete").prop("checked", true);
|
||||
}
|
||||
else{
|
||||
$('[id^=checkbox-massive_report_check]').parent().parent().parent().removeClass('checkselected');
|
||||
$(".check_delete").prop("checked", false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -715,9 +736,10 @@ switch ($action) {
|
|||
if ($edit || $delete) {
|
||||
$columnview = true;
|
||||
if (!isset($table->head[$next])) {
|
||||
$table->head[$next] = '<span title="Operations">' . __('Op.') . '</span>';
|
||||
$table->head[$next] = '<span title="Operations">' . __('Op.') . '</span>'.
|
||||
html_print_checkbox('all_delete', 0, false, true, false);
|
||||
$table->size = array ();
|
||||
$table->size[$next] = '80px';
|
||||
//$table->size[$next] = '80px';
|
||||
$table->style[$next] = 'text-align:left;';
|
||||
}
|
||||
|
||||
|
@ -1847,7 +1869,7 @@ switch ($action) {
|
|||
break;
|
||||
}
|
||||
|
||||
metaconsole_restore_db_force();
|
||||
metaconsole_restore_db();
|
||||
|
||||
$temp_sort[$report_item['id_rc']] = $element_name;
|
||||
|
||||
|
|
|
@ -728,7 +728,7 @@ else {
|
|||
|
||||
if ($rows !== false) {
|
||||
if(defined('METACONSOLE'))
|
||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox">';
|
||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
||||
else
|
||||
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ $rows = db_get_all_rows_in_table('tupdate_settings');
|
|||
|
||||
$settings = new StdClass;
|
||||
foreach ($rows as $row) {
|
||||
$settings->$row['key'] = $row['value'];
|
||||
$settings->{$row['key']} = $row['value'];
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
|
|
|
@ -121,8 +121,8 @@ $zone_name = array('Africa' => __('Africa'), 'America' => __('America'), 'Antarc
|
|||
$zone_selected = get_parameter('zone');
|
||||
if ($zone_selected == "") {
|
||||
if ($config["timezone"] != "") {
|
||||
list($zone) = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone;
|
||||
$zone_array = explode("/", $config["timezone"]);
|
||||
$zone_selected = $zone_array[0];
|
||||
}
|
||||
else {
|
||||
$zone_selected = 'Europe';
|
||||
|
@ -222,7 +222,7 @@ $table->data[36][0] = __('Include agents manually disabled');
|
|||
$table->data[36][1] = __('Yes').' '.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).' ';
|
||||
$table->data[36][1] .= __('No').' '.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
|
||||
|
||||
$table->data[37][0] = __('audit log directory') .
|
||||
$table->data[37][0] = __('Audit log directory') .
|
||||
ui_print_help_tip (__("Directory where audit log is stored."), true);
|
||||
$table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);
|
||||
|
||||
|
|
|
@ -83,13 +83,8 @@ $table_behaviour->data[$row][1] = html_print_checkbox('paginate_module', 1,
|
|||
$row++;
|
||||
|
||||
$table_behaviour->data[$row][0] = __('Display data of proc modules in other format');
|
||||
$table_behaviour->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('render_proc', 1, '',
|
||||
$config["render_proc"], true) .
|
||||
' ';
|
||||
$table_behaviour->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('render_proc', 0, '',
|
||||
$config["render_proc"], true);
|
||||
$table_behaviour->data[$row][1] = html_print_checkbox('render_proc', 1,
|
||||
$config['render_proc'], true);
|
||||
$row++;
|
||||
|
||||
$table_behaviour->data[$row][0] = __('Display text proc modules have state is ok');
|
||||
|
@ -103,13 +98,8 @@ $row++;
|
|||
//Daniel maya 02/06/2016 Display menu with click --INI
|
||||
$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') . ' ' .
|
||||
html_print_radio_button ('click_display', 1, '',
|
||||
$config["click_display"], true) .
|
||||
' ';
|
||||
$table_behaviour->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('click_display', 0, '',
|
||||
$config["click_display"], true);
|
||||
$table_behaviour->data[$row][1] = html_print_checkbox('click_display', 1,
|
||||
$config['click_display'], true);
|
||||
$row++;
|
||||
//Daniel maya 02/06/2016 Display menu with click --END
|
||||
|
||||
|
@ -126,13 +116,8 @@ if (enterprise_installed()) {
|
|||
|
||||
$table_behaviour->data[$row][0] = __('Classic menu mode').
|
||||
ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true);
|
||||
$table_behaviour->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('classic_menu', 1, '',
|
||||
$config["classic_menu"], true) .
|
||||
' ';
|
||||
$table_behaviour->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('classic_menu', 0, '',
|
||||
$config["classic_menu"], true);
|
||||
$table_behaviour->data[$row][1] = html_print_checkbox('classic_menu', 1,
|
||||
$config['classic_menu'], true);
|
||||
$row++;
|
||||
|
||||
echo "<fieldset>";
|
||||
|
@ -398,41 +383,31 @@ if(enterprise_installed()) {
|
|||
$row++;
|
||||
}
|
||||
|
||||
if (enterprise_installed()){
|
||||
$table_styles->data[$row][0] = __('Disable logo in graphs');
|
||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button_extended ('fixed_graph', 1, '', $config["fixed_graph"], $open, '','',true) .
|
||||
' ';
|
||||
$table_styles->data[$row][1] = html_print_checkbox('fixed_graph', 1,
|
||||
$config['fixed_graph'], true);
|
||||
$row++;
|
||||
}
|
||||
|
||||
/* Hello there! :)
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
*/
|
||||
|
||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button_extended ('fixed_graph', 0, '', $config["fixed_graph"], $open, '','',true, $open,'visualmodal');
|
||||
$row++;
|
||||
|
||||
$table_styles->data[$row][0] = __('Disable helps');
|
||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('disable_help', 1, '', $config["disable_help"], true) .
|
||||
' ';
|
||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('disable_help', 0, '', $config["disable_help"], true);
|
||||
$table_styles->data[$row][1] = html_print_checkbox('disable_help', 1,
|
||||
$config['disable_help'], true);
|
||||
$row++;
|
||||
|
||||
$table_styles->data[$row][0] = __('Fixed header');
|
||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('fixed_header', 1, '', $config["fixed_header"], true) .
|
||||
' ';
|
||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('fixed_header', 0, '', $config["fixed_header"], true);
|
||||
$table_styles->data[$row][1] = html_print_checkbox('fixed_header', 1,
|
||||
$config['fixed_header'], true);
|
||||
$row++;
|
||||
|
||||
$table_styles->data[$row][0] = __('Fixed menu');
|
||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('fixed_menu', 1, '', $config["fixed_menu"], true) .
|
||||
' ';
|
||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('fixed_menu', 0, '', $config["fixed_menu"], true);
|
||||
$table_styles->data[$row][1] = html_print_checkbox('fixed_menu', 1,
|
||||
$config['fixed_menu'], true);
|
||||
$row++;
|
||||
|
||||
// For 5.1 Autohidden menu feature
|
||||
|
@ -441,11 +416,8 @@ $table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu',
|
|||
1, $config['autohidden_menu'], true);
|
||||
|
||||
$table_styles->data[$row][0] = __('Visual effects and animation');
|
||||
$table_styles->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('visual_animation', 1, '', $config["visual_animation"], true) .
|
||||
' ';
|
||||
$table_styles->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('visual_animation', 0, '', $config["visual_animation"], true);
|
||||
$table_styles->data[$row][1] = html_print_checkbox('visual_animation', 1,
|
||||
$config['visual_animation'], true);
|
||||
|
||||
echo "<fieldset>";
|
||||
echo "<legend>" . __('Style configuration') . "</legend>";
|
||||
|
@ -465,10 +437,8 @@ $table_gis->data = array ();
|
|||
|
||||
$table_gis->data[$row][0] = __('GIS Labels') .
|
||||
ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true);
|
||||
$table_gis->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).' ';
|
||||
$table_gis->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true);
|
||||
$table_gis->data[$row][1] = html_print_checkbox('gis_label', 1,
|
||||
$config['gis_label'], true);
|
||||
$row++;
|
||||
|
||||
$listIcons = gis_get_array_list_icons();
|
||||
|
@ -558,10 +528,8 @@ $row++;
|
|||
|
||||
$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') . ' ' .
|
||||
html_print_radio_button ('simple_module_value', 1, '', $config["simple_module_value"], true).' ';
|
||||
$table_font->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('simple_module_value', 0, '', $config["simple_module_value"], true);
|
||||
$table_font->data[$row][1] = html_print_checkbox('simple_module_value', 1,
|
||||
$config['simple_module_value'], true);
|
||||
$row++;
|
||||
|
||||
echo "<fieldset>";
|
||||
|
@ -647,8 +615,8 @@ $table_chars->data[$row][1] = html_print_input_text ('custom_graph_width',
|
|||
$row++;
|
||||
|
||||
$table_chars->data[$row][0] = __('Use round corners');
|
||||
$table_chars->data[$row][1] = __('Yes').' '.html_print_radio_button ('round_corner', 1, '', $config["round_corner"], true).' ';
|
||||
$table_chars->data[$row][1] .= __('No').' '.html_print_radio_button ('round_corner', 0, '', $config["round_corner"], true);
|
||||
$table_chars->data[$row][1] = html_print_checkbox('round_corner', 1,
|
||||
$config['round_corner'], true);
|
||||
$row++;
|
||||
|
||||
$table_chars->data[$row][0] = __('Type of module charts');
|
||||
|
@ -876,14 +844,8 @@ $table_other->data['custom_report_front-footer'][1] = html_print_textarea('custo
|
|||
|
||||
|
||||
$table_other->data[$row][0] = __('Show QR Code icon in the header');
|
||||
$table_other->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('show_qr_code_header', 1, '',
|
||||
$config["show_qr_code_header"], true) .
|
||||
' ';
|
||||
$table_other->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('show_qr_code_header', 0, '',
|
||||
$config["show_qr_code_header"], true);
|
||||
|
||||
$table_other->data[$row][1] = html_print_checkbox('show_qr_code_header', 1,
|
||||
$config['show_qr_code_header'], true);
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Custom graphviz directory') .
|
||||
|
@ -903,13 +865,8 @@ $row++;
|
|||
$table_other->data[$row][0] = __('Show only the group name');
|
||||
$table_other->data[$row][0] .= ui_print_help_tip(
|
||||
__('Show the group name instead the group icon.'), true);
|
||||
$table_other->data[$row][1] = __('Yes') . ' ' .
|
||||
html_print_radio_button ('show_group_name', 1, '',
|
||||
$config["show_group_name"], true) .
|
||||
' ';
|
||||
$table_other->data[$row][1] .= __('No') . ' ' .
|
||||
html_print_radio_button ('show_group_name', 0, '',
|
||||
$config["show_group_name"], true);
|
||||
html_print_checkbox('show_group_name', 1,
|
||||
$config['show_group_name'], true);
|
||||
$row++;
|
||||
|
||||
$table_other->data[$row][0] = __('Date format string') . ui_print_help_icon("date_format", true);
|
||||
|
|
|
@ -138,7 +138,6 @@ if ($new_user && $config['admin_can_add_user']) {
|
|||
$user_info['data_section'] = '';
|
||||
//This attributes are inherited from global configuration
|
||||
$user_info['block_size'] = $config["block_size"];
|
||||
$user_info['flash_chart'] = $config["flash_charts"];
|
||||
|
||||
if (enterprise_installed() && defined('METACONSOLE')) {
|
||||
$user_info['metaconsole_agents_manager'] = 0;
|
||||
|
@ -154,6 +153,8 @@ if ($create_user) {
|
|||
}
|
||||
if (html_print_csrf_error()) return;
|
||||
|
||||
$user_is_admin = (int) get_parameter ('is_admin', 0);
|
||||
|
||||
$values = array ();
|
||||
$values['id_user'] = (string) get_parameter ('id_user');
|
||||
$values['fullname'] = (string) get_parameter ('fullname');
|
||||
|
@ -164,7 +165,7 @@ if ($create_user) {
|
|||
$values['email'] = (string) get_parameter ('email');
|
||||
$values['phone'] = (string) get_parameter ('phone');
|
||||
$values['comments'] = (string) get_parameter ('comments');
|
||||
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
|
||||
$values['is_admin'] = $user_is_admin;
|
||||
$values['language'] = get_parameter ('language', 'default');
|
||||
$values['timezone'] = (string) get_parameter('timezone');
|
||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||
|
@ -175,7 +176,6 @@ if ($create_user) {
|
|||
$values['id_skin'] = (int) get_parameter ('skin', 0);
|
||||
}
|
||||
$values['block_size'] = (int) get_parameter ('block_size', $config["block_size"]);
|
||||
$values['flash_chart'] = (int) get_parameter ('flash_charts', $config["flash_charts"]);
|
||||
|
||||
$values['section'] = get_parameter ('section');
|
||||
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
||||
|
@ -193,9 +193,9 @@ if ($create_user) {
|
|||
$values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time());
|
||||
if(defined('METACONSOLE')) {
|
||||
$values['metaconsole_access'] = get_parameter ('metaconsole_access', 'basic');
|
||||
$values['metaconsole_agents_manager'] = get_parameter ('metaconsole_agents_manager', '0');
|
||||
$values['metaconsole_agents_manager'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_agents_manager', '0'));
|
||||
$values['metaconsole_assigned_server'] = get_parameter ('metaconsole_assigned_server', '');
|
||||
$values['metaconsole_access_node'] = get_parameter ('metaconsole_access_node', '0');
|
||||
$values['metaconsole_access_node'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_access_node', '0'));
|
||||
}
|
||||
}
|
||||
$values["not_login"] = (bool)get_parameter ('not_login', false);
|
||||
|
@ -225,7 +225,7 @@ if ($create_user) {
|
|||
}
|
||||
else {
|
||||
$info =
|
||||
'{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] .'","Timezone":"' . $values['timezone'] . '","Block size":"' . $values['block_size'] . '","Interactive Charts":"' . $values['flash_chart'].'"';
|
||||
'{"Id_user":"' . $values['id_user'] . '","FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] .'","Timezone":"' . $values['timezone'] . '","Block size":"' . $values['block_size'] . '"';
|
||||
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
$info .= ',"Skin":"' . $values['id_skin'].'"}';
|
||||
|
@ -234,23 +234,10 @@ if ($create_user) {
|
|||
$info .= '}';
|
||||
}
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$result = create_user($id, $password_new, $values);
|
||||
if ($result) {
|
||||
$res = save_pass_history($id, $password_new);
|
||||
}
|
||||
break;
|
||||
case "oracle":
|
||||
$result = db_process_sql('/INSERT INTO tusuario (fullname, firstname, lastname, email, phone, comments, is_admin, language, id_skin, block_size, flash_chart, id_user, password, last_connect, registered) VALUES (\'' . $values['fullname'] . '\',\'\',\'\',\'\',\'\',\'\',' . $values['is_admin'] . ',\'' . $values['language'] .'\',' . $values['id_skin'] . ',' . $values['block_size'] . ',' . $values['flash_chart'] . ',\'' . $id . '\',\'' . $password_new . '\',0,\'' . get_system_time () . '\')');
|
||||
|
||||
if ($result) {
|
||||
$res = db_process_sql('/INSERT INTO tpassword_history (id_user, password, date_begin) VALUES (\'' . $id . '\',\'' . md5($password_new) . '\',\'' . date ("Y/m/d H:i:s", get_system_time()) . '\')');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
db_pandora_audit("User management",
|
||||
"Created user ".io_safe_output($id), false, false, $info);
|
||||
|
@ -301,8 +288,6 @@ if ($update_user) {
|
|||
$values['id_skin'] = get_parameter ('skin', 0);
|
||||
}
|
||||
$values['block_size'] = get_parameter ('block_size', $config["block_size"]);
|
||||
$values['flash_chart'] = get_parameter ('flash_charts', $config["flash_charts"]);
|
||||
|
||||
|
||||
$values['section'] = get_parameter ('section');
|
||||
if (($values['section'] == 'Event list') || ($values['section'] == 'Group view') || ($values['section'] == 'Alert detail') || ($values['section'] == 'Tactical view') || ($values['section'] == 'Default')) {
|
||||
|
@ -384,7 +369,6 @@ if ($update_user) {
|
|||
"Language":"' . $values['language'] . '",
|
||||
"Timezone":"' . $values['timezone'] . '",
|
||||
"Block size":"' . $values['block_size'] . '",
|
||||
"Flash Chats":"' . $values['flash_chart'] . '",
|
||||
"Section":"' . $values['section'].'"';
|
||||
|
||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -588,8 +572,6 @@ if (!$meta) {
|
|||
|
||||
$table->data[11][0] = __('Interactive charts').' '.ui_print_help_tip(__('Whether to use Javascript or static PNG graphs'), true) ;
|
||||
$values = array(-1 => __('Use global conf'), 1 => __('Yes'), 0 => __('No'));
|
||||
$table->data[11][1] = html_print_select($values, 'flash_charts',
|
||||
$user_info["flash_chart"], '', '', -1, true, false, false);
|
||||
|
||||
$table->data[12][0] = __('Home screen').
|
||||
ui_print_help_tip(__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type sec=estado&sec2=operation/agentes/estado_agente to show agent detail view'), true);
|
||||
|
@ -738,12 +720,11 @@ $(document).ready (function () {
|
|||
$('input:radio[name="is_admin"]').change(function() {
|
||||
if($('#radiobtn0002').prop('checked')) {
|
||||
$('#user_configuration_table-metaconsole_agents_manager').show();
|
||||
$('#user_configuration_table-metaconsole_assigned_server').show();
|
||||
$('#user_configuration_table-metaconsole_access_node').show();
|
||||
}
|
||||
else {
|
||||
$('#user_configuration_table-metaconsole_agents_manager').hide();
|
||||
$('#user_configuration_table-metaconsole_assigned_server').hide();
|
||||
$('#user_configuration_table-metaconsole_assigned_server').show();
|
||||
$('#user_configuration_table-metaconsole_access_node').hide();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -270,7 +270,7 @@ if ($create_profile) {
|
|||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->class = 'databox profile_list';
|
||||
$table->class = 'databox profile_list data';
|
||||
$table->width = '100%';
|
||||
|
||||
$table->head = array ();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 274 B |
Binary file not shown.
After Width: | Height: | Size: 397 B |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -38,6 +38,9 @@ $get_event_name = (bool) get_parameter ('get_event_name');
|
|||
$meta = get_parameter ('meta', 0);
|
||||
$history = get_parameter ('history', 0);
|
||||
$table_events = get_parameter('table_events', 0);
|
||||
$total_events = (bool)get_parameter('total_events');
|
||||
$total_event_graph = (bool)get_parameter('total_event_graph');
|
||||
$graphic_event_group = (bool)get_parameter('graphic_event_group');
|
||||
|
||||
if ($get_event_name) {
|
||||
$event_id = get_parameter ('event_id');
|
||||
|
@ -412,7 +415,7 @@ if ($get_extended_event) {
|
|||
$custom_data = events_page_custom_data($event);
|
||||
|
||||
if ($meta) {
|
||||
metaconsole_restore_db_force();
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
$general = events_page_general($event);
|
||||
|
@ -605,4 +608,37 @@ if ($get_list_events_agents) {
|
|||
echo $returned_list;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($total_events) {
|
||||
global $config;
|
||||
|
||||
$sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento ';
|
||||
if ($config['event_view_hr']) {
|
||||
$sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - ' . $config['event_view_hr'] * SECONDS_1HOUR . ')';
|
||||
}
|
||||
|
||||
$system_events = db_get_value_sql($sql_count_event);
|
||||
echo $system_events;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($total_event_graph) {
|
||||
global $config;
|
||||
|
||||
require_once($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
$prueba = grafico_eventos_total("", 280, 150, false, true);
|
||||
echo $prueba;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($graphic_event_group) {
|
||||
global $config;
|
||||
|
||||
require_once($config["homedir"] . '/include/functions_graph.php');
|
||||
|
||||
$prueba = grafico_eventos_grupo(280, 150, "", false, true);
|
||||
echo $prueba;
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -539,14 +539,6 @@ if ($list_modules) {
|
|||
break;
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "oracle":
|
||||
if (isset($order['field']) && $order['field'] == 'tagente_modulo.nombre') {
|
||||
$order['field'] = 'dbms_lob.substr(tagente_modulo.nombre,4000,1)';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Fix: for tag functionality groups have to be all user_groups (propagate ACL funct!)
|
||||
$groups = users_get_groups($config["id_user"], $access);
|
||||
|
||||
|
@ -599,8 +591,7 @@ if ($list_modules) {
|
|||
|
||||
//Count monitors/modules
|
||||
$order_sql = $order['field'] . " " . $order['order'];
|
||||
$sql = "SELECT COUNT(*)
|
||||
FROM tagente_modulo
|
||||
$sql_condition = "FROM tagente_modulo
|
||||
$tags_join
|
||||
INNER JOIN tagente_estado
|
||||
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
|
@ -609,13 +600,15 @@ if ($list_modules) {
|
|||
WHERE tagente_modulo.id_agente = $id_agente
|
||||
AND nombre LIKE '$status_text_monitor_sql'
|
||||
AND delete_pending = 0
|
||||
AND disabled = 0
|
||||
AND $status_filter_sql
|
||||
AND $status_module_group_filter
|
||||
$tags_sql
|
||||
AND tagente_estado.estado != $monitor_filter
|
||||
GROUP BY tagente_modulo.id_agente_modulo
|
||||
";
|
||||
|
||||
$count_modules = db_get_all_rows_sql($sql);
|
||||
$count_modules = db_get_all_rows_sql('SELECT COUNT(DISTINCT tagente_modulo.id_agente_modulo)' . $sql_condition);
|
||||
|
||||
if (isset($count_modules[0]))
|
||||
$count_modules = reset($count_modules[0]);
|
||||
else
|
||||
|
@ -623,22 +616,9 @@ if ($list_modules) {
|
|||
|
||||
//Get monitors/modules
|
||||
// Get all module from agent
|
||||
$sql = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
|
||||
FROM tagente_modulo
|
||||
$tags_join
|
||||
INNER JOIN tagente_estado
|
||||
ON tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||
LEFT JOIN tmodule_group
|
||||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_modulo.id_agente = $id_agente
|
||||
AND nombre LIKE '$status_text_monitor_sql'
|
||||
AND delete_pending = 0
|
||||
AND $status_filter_sql
|
||||
$tags_sql
|
||||
AND tagente_estado.estado != $monitor_filter
|
||||
GROUP BY tagente_modulo.id_agente_modulo
|
||||
ORDER BY tmodule_group.name, $order_sql
|
||||
";
|
||||
$sql_modules_info = "SELECT tagente_estado.*, tagente_modulo.*, tmodule_group.*
|
||||
$sql_condition
|
||||
GROUP BY tagente_modulo.id_agente_modulo ORDER BY $order_sql";
|
||||
|
||||
if ($monitors_change_filter) {
|
||||
$limit = " LIMIT " . $config['block_size'] . " OFFSET 0";
|
||||
|
@ -651,10 +631,10 @@ if ($list_modules) {
|
|||
$paginate_module = $config['paginate_module'];
|
||||
|
||||
if ($paginate_module) {
|
||||
$modules = db_get_all_rows_sql ($sql . $limit);
|
||||
$modules = db_get_all_rows_sql ($sql_modules_info . $limit);
|
||||
}
|
||||
else {
|
||||
$modules = db_get_all_rows_sql ($sql);
|
||||
$modules = db_get_all_rows_sql ($sql_modules_info);
|
||||
}
|
||||
if (empty ($modules)) {
|
||||
$modules = array ();
|
||||
|
|
|
@ -541,10 +541,9 @@ function get_users ($order = false) {
|
|||
* @return string userid
|
||||
*/
|
||||
function stripdn ($dn) {
|
||||
list ($uid, $trash) = explode (',', $dn, 2);
|
||||
list ($trash, $user) = explode ('=', $uid);
|
||||
|
||||
return ($user);
|
||||
$array_explode = explode (',', $dn, 2);
|
||||
$array_explode2 = explode ('=', $array_explode[0]);
|
||||
return ($$array_explode2[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,20 +112,113 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||
$aux_font_size = $config['font_size'];
|
||||
$config['font_size'] = $config['font_size'] + 3;
|
||||
|
||||
if($type_graph_pdf == 'combined'){
|
||||
echo '<div>';
|
||||
switch ($type_graph_pdf) {
|
||||
case 'combined':
|
||||
echo graphic_combined_module(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
echo '</div>';
|
||||
}
|
||||
elseif($type_graph_pdf == 'sparse'){
|
||||
echo '<div>';
|
||||
break;
|
||||
case 'sparse':
|
||||
echo grafico_modulo_sparse($params);
|
||||
echo '</div>';
|
||||
break;
|
||||
case 'pie_chart':
|
||||
echo flot_pie_chart(
|
||||
$params['values'],
|
||||
$params['keys'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$params['legend_position'],
|
||||
$params['colors'],
|
||||
$params['hide_labels']
|
||||
);
|
||||
break;
|
||||
case 'vbar':
|
||||
echo flot_vcolumn_chart(
|
||||
$params['chart_data'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['color'],
|
||||
$params['legend'],
|
||||
$params['long_index'],
|
||||
$params['homeurl'],
|
||||
$params['unit'],
|
||||
$params['water_mark_url'],
|
||||
$params['homedir'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$params['from_ux'],
|
||||
$params['from_wux'],
|
||||
$params['backgroundColor'],
|
||||
$params['tick_color']
|
||||
);
|
||||
break;
|
||||
case 'hbar':
|
||||
echo flot_hcolumn_chart(
|
||||
$params['chart_data'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['water_mark_url'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$params['backgroundColor'],
|
||||
$params['tick_color'],
|
||||
$params['val_min'],
|
||||
$params['val_max']
|
||||
);
|
||||
break;
|
||||
case 'ring_graph':
|
||||
echo flot_custom_pie_chart (
|
||||
$params['chart_data'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['colors'],
|
||||
$params['module_name_list'],
|
||||
$params['long_index'],
|
||||
$params['no_data'],
|
||||
false,
|
||||
'',
|
||||
$params['water_mark'],
|
||||
$params['font'],
|
||||
$params['font_size'],
|
||||
$params['unit'],
|
||||
$params['ttl'],
|
||||
$params['homeurl'],
|
||||
$params['background_color'],
|
||||
$params['legend_position'],
|
||||
$params['background_color']
|
||||
);
|
||||
break;
|
||||
case 'slicebar':
|
||||
echo flot_slicesbar_graph (
|
||||
$params['graph_data'],
|
||||
$params['period'],
|
||||
$params['width'],
|
||||
$params['height'],
|
||||
$params['legend'],
|
||||
$params['colors'],
|
||||
$params['fontpath'],
|
||||
$params['round_corner'],
|
||||
$params['homeurl'],
|
||||
$params['watermark'],
|
||||
$params['adapt_key'],
|
||||
$params['stat_winalse'],
|
||||
$params['id_agent'],
|
||||
$params['full_legend_daterray'],
|
||||
$params['not_interactive'],
|
||||
1
|
||||
);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
$config['font_size'] = $aux_font_size;
|
||||
?>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC181025';
|
||||
$build_version = 'PC181107';
|
||||
$pandora_version = 'v7.0NG.728';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
@ -78,7 +78,7 @@ else {
|
|||
|
||||
// Check if mysqli is available
|
||||
if (!(isset($config["mysqli"]))) {
|
||||
$config["mysqli"] = extension_loaded(mysqli);
|
||||
$config["mysqli"] = extension_loaded('mysqli');
|
||||
}
|
||||
|
||||
$config['start_time'] = microtime (true);
|
||||
|
@ -250,10 +250,20 @@ if (isset($_POST['vc_refr'])) {
|
|||
|
||||
|
||||
//======= Autorefresh code =============================================
|
||||
if(isset($config['id_user'])){
|
||||
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
|
||||
if(isset($select[0]['value'])){
|
||||
$autorefresh_list = json_decode($select[0]['value']);
|
||||
}
|
||||
else{
|
||||
$autorefresh_list =null;
|
||||
}
|
||||
$config['autorefresh_white_list'] = array();
|
||||
$config['autorefresh_white_list'] = $autorefresh_list;
|
||||
}
|
||||
else{
|
||||
$config['autorefresh_white_list'] = null;
|
||||
}
|
||||
// Specific metaconsole autorefresh white list sections
|
||||
if (defined('METACONSOLE')) {
|
||||
$config['autorefresh_white_list'][] = 'monitoring/tactical';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null) {
|
||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $port = null, $charset = "utf8") {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -42,6 +42,8 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
|
|||
}
|
||||
db_change_cache_id ($db, $host);
|
||||
|
||||
mysqli_set_charset($connect_id, $charset);
|
||||
|
||||
mysqli_select_db($connect_id, $db);
|
||||
}
|
||||
else {
|
||||
|
@ -52,6 +54,8 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
|
|||
|
||||
db_change_cache_id ($db, $host);
|
||||
|
||||
@mysql_set_charset($connect_id, $charset);
|
||||
|
||||
mysql_select_db($db, $connect_id);
|
||||
}
|
||||
|
||||
|
@ -1198,47 +1202,6 @@ function mysql_db_get_type_field_table($table, $field) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element count of a table.
|
||||
*
|
||||
* @param string $sql SQL query to get the element count.
|
||||
*
|
||||
* @return int Return the number of elements in the table.
|
||||
*/
|
||||
function mysql_db_get_table_count($sql, $search_history_db = false) {
|
||||
global $config;
|
||||
|
||||
$history_count = 0;
|
||||
$count = mysql_db_get_value_sql ($sql);
|
||||
if ($count === false) {
|
||||
$count = 0;
|
||||
}
|
||||
|
||||
// Search the history DB for matches
|
||||
if ($search_history_db && $config['history_db_enabled'] == 1) {
|
||||
|
||||
// Connect to the history DB
|
||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
||||
if ($config["mysqli"]) {
|
||||
$config['history_db_connection'] = mysqli_connect_db ($config['history_db_host'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_name'], $config['history_db_port'], false);
|
||||
}
|
||||
else {
|
||||
$config['history_db_connection'] = mysql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
||||
}
|
||||
}
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$history_count = mysql_db_get_value_sql ($sql, $config['history_db_connection']);
|
||||
if ($history_count === false) {
|
||||
$history_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count += $history_count;
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
function mysql_get_fields($table) {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -1476,42 +1476,6 @@ function oracle_list_all_field_table($table_name, $return_mode = 'array') {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element count of a table.
|
||||
*
|
||||
* @param string $sql SQL query to get the element count.
|
||||
*
|
||||
* @return int Return the number of elements in the table.
|
||||
*/
|
||||
function oracle_db_get_table_count($sql, $search_history_db = false) {
|
||||
global $config;
|
||||
|
||||
$history_count = 0;
|
||||
$count = oracle_db_get_value_sql ($sql);
|
||||
if ($count === false) {
|
||||
$count = 0;
|
||||
}
|
||||
|
||||
// Search the history DB for matches
|
||||
if ($search_history_db && $config['history_db_enabled'] == 1) {
|
||||
|
||||
// Connect to the history DB
|
||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
||||
$config['history_db_connection'] = oracle_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
||||
}
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$history_count = oracle_db_get_value_sql ($sql, $config['history_db_connection']);
|
||||
if ($history_count === false) {
|
||||
$history_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count += $history_count;
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a file with an oracle schema sentences.
|
||||
* Based on the function which installs the pandoradb.sql schema.
|
||||
|
|
|
@ -1055,40 +1055,5 @@ function postgresql_db_get_type_field_table($table, $field) {
|
|||
return pg_field_type($result, $field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element count of a table.
|
||||
*
|
||||
* @param string $sql SQL query to get the element count.
|
||||
*
|
||||
* @return int Return the number of elements in the table.
|
||||
*/
|
||||
function postgresql_db_get_table_count($sql, $search_history_db = false) {
|
||||
global $config;
|
||||
|
||||
$history_count = 0;
|
||||
$count = postgresql_db_get_value_sql ($sql);
|
||||
if ($count === false) {
|
||||
$count = 0;
|
||||
}
|
||||
|
||||
// Search the history DB for matches
|
||||
if ($search_history_db && $config['history_db_enabled'] == 1) {
|
||||
|
||||
// Connect to the history DB
|
||||
if (! isset ($config['history_db_connection']) || $config['history_db_connection'] === false) {
|
||||
$config['history_db_connection'] = postgresql_connect_db ($config['history_db_host'], $config['history_db_name'], $config['history_db_user'], io_output_password($config['history_db_pass']), $config['history_db_port'], false);
|
||||
}
|
||||
if ($config['history_db_connection'] !== false) {
|
||||
$history_count = postgresql_db_get_value_sql ($sql, $config['history_db_connection']);
|
||||
if ($history_count === false) {
|
||||
$history_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count += $history_count;
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -69,6 +69,10 @@ require_once('functions_io.php');
|
|||
//}
|
||||
|
||||
function https_is_running() {
|
||||
if(isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])
|
||||
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
||||
return true;
|
||||
}
|
||||
if (isset ($_SERVER['HTTPS'])
|
||||
&& ($_SERVER['HTTPS'] === true
|
||||
|| $_SERVER['HTTPS'] == 'on')) {
|
||||
|
@ -1369,10 +1373,11 @@ function is_metaconsole() {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_management_allowed() {
|
||||
function is_management_allowed($hkey = '') {
|
||||
global $config;
|
||||
return ( (is_metaconsole() && $config["centralized_management"])
|
||||
|| (!is_metaconsole() && !$config["centralized_management"]));
|
||||
|| (!is_metaconsole() && !$config["centralized_management"])
|
||||
|| (!is_metaconsole() && $config["centralized_management"]) && $hkey == generate_hash_to_api());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2477,7 +2482,7 @@ function set_pandora_error_for_header($message, $title = null) {
|
|||
if (!isset($config['alert_cnt']))
|
||||
$config['alert_cnt'] = 0;
|
||||
|
||||
if (!isset($_SESSION['alert_msg']))
|
||||
if ( ( !isset($_SESSION['alert_msg']) && (!is_array($_SESSION['alert_msg'])) ) )
|
||||
$_SESSION['alert_msg'] = array();
|
||||
|
||||
$message_config = array();
|
||||
|
@ -3128,16 +3133,23 @@ function series_type_graph_array($data, $show_elements_graph){
|
|||
if (isset($show_elements_graph['labels']) &&
|
||||
is_array($show_elements_graph['labels']) &&
|
||||
(count($show_elements_graph['labels']) > 0)){
|
||||
$name_legend = $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']] . ' ' ;
|
||||
if ($show_elements_graph['unit'])
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||
else
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||
}
|
||||
else{
|
||||
if(strpos($key, 'baseline') !== false){
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
|
||||
$value['module_name'] . ' Baseline ';
|
||||
if ($show_elements_graph['unit'])
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .'Baseline ';
|
||||
else
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . 'Baseline ';
|
||||
}
|
||||
else{
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
|
||||
$value['module_name'] . ': ';
|
||||
if ($show_elements_graph['unit'])
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||
else
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3173,6 +3185,11 @@ function series_type_graph_array($data, $show_elements_graph){
|
|||
!$show_elements_graph['fullscale'] && strpos($key, 'max') !== false){
|
||||
$data_return['series_type'][$key] = $type_graph;
|
||||
|
||||
if ($show_elements_graph['unit'])
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||
else
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||
|
||||
$data_return['legend'][$key] = $name_legend;
|
||||
if($show_elements_graph['type_mode_graph']){
|
||||
$data_return['legend'][$key] .=
|
||||
|
@ -3234,6 +3251,10 @@ function series_type_graph_array($data, $show_elements_graph){
|
|||
__('Percentil') . ' ' .
|
||||
$config['percentil'] .
|
||||
'º ' . __('of module') . ' ';
|
||||
if ($show_elements_graph['unit'])
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
|
||||
else
|
||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
|
||||
$data_return['legend'][$key] .= $name_legend;
|
||||
$data_return['legend'][$key] .= remove_right_zeros(
|
||||
number_format(
|
||||
|
@ -3367,4 +3388,8 @@ function validate_csrf_code() {
|
|||
return isset($code) && isset($_SESSION['csrf_code'])
|
||||
&& $_SESSION['csrf_code'] == $code;
|
||||
}
|
||||
|
||||
function generate_hash_to_api(){
|
||||
hash('sha256', db_get_value ('value', 'tupdate_settings', '`key`', 'customer_key'));
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -28,13 +28,14 @@ require_once($config['homedir'] . '/include/functions_users.php');
|
|||
*
|
||||
* @param int $id_agent The agent id.
|
||||
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
|
||||
* @param boolean $force_meta
|
||||
*
|
||||
* @return boolean The result to check if the agent is in the DB.
|
||||
*/
|
||||
function agents_check_agent_exists($id_agent, $show_disabled = true) {
|
||||
function agents_check_agent_exists($id_agent, $show_disabled = true, $force_meta = false) {
|
||||
$agent = db_get_value_filter(
|
||||
'id_agente',
|
||||
'tagente',
|
||||
$force_meta ? 'tmetaconsole_agent' : 'tagente',
|
||||
array('id_agente' => $id_agent, 'disabled' => !$show_disabled)
|
||||
);
|
||||
|
||||
|
@ -2733,17 +2734,18 @@ function agents_count_agents_filter ($filter = array(), $access = "AR") {
|
|||
*
|
||||
* @param int Id agent
|
||||
* @param string ACL access bit
|
||||
* @param boolean $force_meta
|
||||
*
|
||||
* @return True if user has access, false if user has not permissions and
|
||||
* null if id agent does not exist
|
||||
*/
|
||||
function agents_check_access_agent ($id_agent, $access = "AR") {
|
||||
function agents_check_access_agent ($id_agent, $access = "AR", $force_meta = false) {
|
||||
global $config;
|
||||
|
||||
if (users_access_to_agent($id_agent, $access)) return true;
|
||||
if (users_access_to_agent($id_agent, $access, false, $force_meta)) return true;
|
||||
|
||||
// If agent exist return false
|
||||
if (agents_check_agent_exists($id_agent)) return false;
|
||||
if (agents_check_agent_exists($id_agent, true, $force_meta)) return false;
|
||||
// Return null otherwise
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ include_once($config['homedir'] . "/include/functions_network_components.php");
|
|||
include_once($config['homedir'] . "/include/functions_netflow.php");
|
||||
include_once($config['homedir'] . "/include/functions_servers.php");
|
||||
include_once($config['homedir'] . "/include/functions_planned_downtimes.php");
|
||||
include_once($config['homedir'] . "/include/functions_db.php");
|
||||
enterprise_include_once ('include/functions_local_components.php');
|
||||
enterprise_include_once ('include/functions_events.php');
|
||||
enterprise_include_once ('include/functions_agents.php');
|
||||
|
@ -100,7 +99,7 @@ function returnError($typeError, $returnType = 'string') {
|
|||
break;
|
||||
default:
|
||||
returnData("string",
|
||||
array('type' => 'string', 'data' => __($typeError)));
|
||||
array('type' => 'string', 'data' => __($returnType)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5412,7 +5411,8 @@ function api_set_planned_downtimes_created ($id, $thrash1, $other, $thrash3) {
|
|||
'periodically_day_to' => $other['data'][14],
|
||||
'type_downtime' => $other['data'][15],
|
||||
'type_execution' => $other['data'][16],
|
||||
'type_periodicity' => $other['data'][17]
|
||||
'type_periodicity' => $other['data'][17],
|
||||
'id_user' => $other['data'][18]
|
||||
);
|
||||
|
||||
$returned = planned_downtimes_created($values);
|
||||
|
@ -6870,7 +6870,6 @@ function api_get_graph_module_data($id, $thrash1, $other, $thrash2) {
|
|||
$ttl = 1;
|
||||
|
||||
global $config;
|
||||
$config['flash_charts'] = 0;
|
||||
|
||||
$params =array(
|
||||
'agent_module_id' => $id,
|
||||
|
@ -6950,7 +6949,7 @@ function api_set_new_user($id, $thrash2, $other, $thrash3) {
|
|||
* @param string $id String username for user login in Pandora
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <fullname>;<firstname>;<lastname>;<middlename>;<password>;
|
||||
* <email>;<phone>;<language>;<comments>;<is_admin>;<block_size>;<flash_chart> in this order and separator char
|
||||
* <email>;<phone>;<language>;<comments>;<is_admin>;<block_size>;in this order and separator char
|
||||
* (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example:
|
||||
*
|
||||
|
@ -6980,9 +6979,8 @@ function api_set_update_user($id, $thrash2, $other, $thrash3) {
|
|||
'language',
|
||||
'comments',
|
||||
'is_admin',
|
||||
'block_size',
|
||||
'flash_chart');
|
||||
|
||||
'block_size'
|
||||
);
|
||||
|
||||
if ($id == "") {
|
||||
returnError('error_update_user',
|
||||
|
@ -9280,18 +9278,27 @@ function api_get_agent_id($trash1, $trash2, $data, $returnType) {
|
|||
* Agent alias for a given id
|
||||
*
|
||||
* @param int $id_agent
|
||||
* @param int $id_node Only for metaconsole
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $returnType
|
||||
*
|
||||
**/
|
||||
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
|
||||
function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_alias&id=1&apipass=1234&user=admin&pass=pandora
|
||||
// http://localhost/pandora_console/enterprise/meta/include/api.php?op=get&op2=agent_alias&id=1&id2=1&apipass=1234&user=admin&pass=pandora
|
||||
function api_get_agent_alias($id_agent, $id_node, $trash1, $returnType) {
|
||||
$table_agent_alias = 'tagente';
|
||||
$force_meta=false;
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$table_agent_alias = 'tmetaconsole_agent';
|
||||
$force_meta = true;
|
||||
$id_agent = db_get_value_sql("SELECT id_agente FROM tmetaconsole_agent WHERE id_tagente = $id_agent AND id_tmetaconsole_setup = $id_node");
|
||||
}
|
||||
|
||||
if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return;
|
||||
if (!util_api_check_agent_and_print_error($id_agent, $returnType, 'AR', $force_meta)) return;
|
||||
|
||||
$sql = sprintf('SELECT alias
|
||||
FROM tagente
|
||||
FROM ' . $table_agent_alias . '
|
||||
WHERE id_agente = %d', $id_agent);
|
||||
$value = db_get_value_sql($sql);
|
||||
|
||||
|
@ -9523,8 +9530,11 @@ function api_set_create_event($id, $trash1, $other, $returnType) {
|
|||
return;
|
||||
}
|
||||
$id_agent = $agent_cache['id_tagente'];
|
||||
|
||||
}
|
||||
|
||||
$values['id_agente'] = $id_agent;
|
||||
|
||||
if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) {
|
||||
if (is_metaconsole()) metaconsole_restore_db();
|
||||
return;
|
||||
|
@ -10756,19 +10766,17 @@ function api_set_metaconsole_synch($keys) {
|
|||
|
||||
// Validate update the license in nodes:
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
list ($nodes_failed, $total_nodes) = metaconsole_update_all_nodes_license();
|
||||
if ($nodes_failed === 0) {
|
||||
echo __('Metaconsole and all nodes license updated');
|
||||
$array_metaconsole_update = metaconsole_update_all_nodes_license();
|
||||
if ($array_metaconsole_update[0] === 0) {
|
||||
ui_print_success_message(__('Metaconsole and all nodes license updated'));
|
||||
}
|
||||
else {
|
||||
echo __('Metaconsole license updated but %d of %d node synchronization failed', $nodes_failed, $total_nodes);
|
||||
ui_print_error_message(__('Metaconsole license updated but %d of %d node synchronization failed', $array_metaconsole_update[0], $array_metaconsole_update[1]));
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo __('This function is only for metaconsole');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
||||
|
@ -10862,12 +10870,17 @@ function api_set_new_cluster($thrash1, $thrash2, $other, $thrash3) {
|
|||
else
|
||||
db_pandora_audit("Report management", "Failed to create cluster agent $name");
|
||||
|
||||
if ($id_cluster !== false)
|
||||
returnData('string',
|
||||
array('type' => 'string', 'data' => (int)$id_cluster));
|
||||
else
|
||||
returnError('error_set_new_cluster', __('Failed to create cluster.'));
|
||||
} else {
|
||||
returnError('error_set_new_cluster', __('Agent name cannot be empty.'));
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function api_set_add_cluster_agent($thrash1, $thrash2, $other, $thrash3) {
|
||||
|
@ -11306,6 +11319,7 @@ function api_get_cluster_status($id_cluster, $trash1, $trash2, $returnType) {
|
|||
|
||||
if ($value === false) {
|
||||
returnError('id_not_found', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = array('type' => 'string', 'data' => $value);
|
||||
|
@ -11323,6 +11337,7 @@ function api_get_cluster_id_by_name($cluster_name, $trash1, $trash2, $returnType
|
|||
$value = cluster_get_id_by_name($cluster_name);
|
||||
if(($value === false) || ($value === null)){
|
||||
returnError('id_not_found', $returnType);
|
||||
return;
|
||||
}
|
||||
|
||||
$cluster_group = clusters_get_group($value);
|
||||
|
@ -11477,10 +11492,10 @@ function api_get_cluster_items ($cluster_id){
|
|||
// AUX FUNCTIONS
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") {
|
||||
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR", $force_meta = false) {
|
||||
global $config;
|
||||
|
||||
$check_agent = agents_check_access_agent($id_agent, $access);
|
||||
$check_agent = agents_check_access_agent($id_agent, $access, $force_meta);
|
||||
if ($check_agent === true) return true;
|
||||
|
||||
if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
|
||||
|
@ -11492,282 +11507,8 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
|
|||
return false;
|
||||
}
|
||||
|
||||
function api_get_user_info($thrash1, $thrash2, $other, $returnType) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$separator = ';';
|
||||
|
||||
$other = json_decode(base64_decode($other['data']),true);
|
||||
|
||||
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
|
||||
|
||||
$user_info = db_get_all_rows_sql($sql);
|
||||
|
||||
if (count($user_info) > 0 and $user_info !== false) {
|
||||
$data = array('type' => 'array', 'data' => $user_info);
|
||||
returnData($returnType, $data, $separator);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users:
|
||||
|
||||
Parameter 0
|
||||
|
||||
The User ID that attempts the action is used to check the status of the application for access.
|
||||
|
||||
Parameter 1
|
||||
|
||||
Login, logout, exclude, browse.
|
||||
|
||||
These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them.
|
||||
|
||||
Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion).
|
||||
|
||||
Browse action: It has the same answers as login, but does not register anything in the audit.
|
||||
|
||||
Logout action: It records the deslogeo but does not send a response.
|
||||
|
||||
All other actions do not return a response,
|
||||
|
||||
Parameter 2
|
||||
|
||||
IP address of the application is also used to check the status of the application for access.
|
||||
|
||||
Parameter 3
|
||||
|
||||
Name of the application, it is also used to check the status of the application for access.
|
||||
|
||||
Parameter 4
|
||||
|
||||
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function api_set_access_process($thrash1, $thrash2, $other, $returnType) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$other['data'] = explode('|',$other['data']);
|
||||
|
||||
$sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1';
|
||||
$audit_concurrence = db_get_all_rows_sql($sql);
|
||||
$sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1';
|
||||
$audit_concurrence_user = db_get_all_rows_sql($sql_user);
|
||||
$sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].' Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1';
|
||||
$audit_concurrence_2 = db_get_all_rows_sql($sql2);
|
||||
|
||||
//The user trying to log in is an administrator
|
||||
if(users_is_admin($other['data'][0])){
|
||||
//The admin user is trying to login
|
||||
if($other['data'][1] == 'login'){
|
||||
// Check if there is an administrator user logged in prior to our last login
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
|
||||
// Check if the administrator user logged in later to us has unlogged and left the node free
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
|
||||
// The administrator user logged in later has not yet unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => 'taken'));
|
||||
}
|
||||
else{
|
||||
// The administrator user logged in later has already unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
}
|
||||
else{
|
||||
// There is no administrator user who has logged in since then to log us in.
|
||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($other['data'][1] == 'logout') {
|
||||
// The administrator user wants to log out
|
||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
|
||||
}
|
||||
elseif ($other['data'][1] == 'exclude') {
|
||||
// The administrator user has ejected another administrator user who was logged in
|
||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']);
|
||||
|
||||
}
|
||||
//The admin user is trying to browse
|
||||
elseif ($other['data'][1] == 'browse') {
|
||||
// Check if there is an administrator user logged in prior to our last login
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
|
||||
// Check if the administrator user logged in later to us has unlogged and left the node free
|
||||
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
|
||||
// The administrator user logged in later has not yet unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario']));
|
||||
}
|
||||
else{
|
||||
// The administrator user logged in later has already unlogged
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
}
|
||||
else{
|
||||
// There is no administrator user who has logged in since then to log us in.
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($other['data'][1] == 'cancelled'){
|
||||
//The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
|
||||
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'cancelled'));
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
if($other['data'][4] == 1){
|
||||
//The user trying to log in is not an administrator and is not allowed no admin access
|
||||
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'denied'));
|
||||
}
|
||||
else{
|
||||
//The user trying to log in is not an administrator and is allowed no admin access
|
||||
if($other['data'][1] == 'login'){
|
||||
//The user trying to login is not admin, can enter without concurrent use filter
|
||||
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
|
||||
}
|
||||
elseif ($other['data'][1] == 'logout') {
|
||||
//The user trying to logoff is not admin
|
||||
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
|
||||
}
|
||||
elseif ($other['data'][1] == 'browse'){
|
||||
//The user trying to browse in an app page is not admin, can enter without concurrent use filter
|
||||
returnData('string', array('type' => 'string', 'data' => 'free'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_traps($thrash1, $thrash2, $other, $returnType) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$other['data'] = explode('|',$other['data']);
|
||||
|
||||
$other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]);
|
||||
|
||||
$sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"';
|
||||
|
||||
// $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"';
|
||||
|
||||
if($other['data'][4]){
|
||||
$other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]);
|
||||
$sql .= ' and timestamp <= "'.$other['data'][4].'"';
|
||||
}
|
||||
|
||||
if($other['data'][2]){
|
||||
$sql .= ' limit '.$other['data'][2];
|
||||
}
|
||||
|
||||
if($other['data'][3]){
|
||||
$sql .= ' offset '.$other['data'][3];
|
||||
}
|
||||
|
||||
if($other['data'][5]){
|
||||
$sql .= ' and status = 0';
|
||||
}
|
||||
|
||||
if(sizeof($other['data']) == 0){
|
||||
$sql = 'SELECT * from ttrap';
|
||||
}
|
||||
|
||||
|
||||
$traps = db_get_all_rows_sql($sql);
|
||||
|
||||
if($other['data'][6]){
|
||||
|
||||
foreach ($traps as $key => $value) {
|
||||
|
||||
if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){
|
||||
unset($traps[$key]);
|
||||
}
|
||||
|
||||
if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){
|
||||
unset($traps[$key]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$traps_json = json_encode($traps);
|
||||
|
||||
if (count($traps) > 0 and $traps !== false) {
|
||||
returnData('string', array('type' => 'string', 'data' => $traps_json));
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($id == 'all'){
|
||||
$result = db_process_sql_update('ttrap',array('status' => 1));
|
||||
}
|
||||
else{
|
||||
$result = db_process_sql_update('ttrap',
|
||||
array('status' => 1), array('id_trap' => $id));
|
||||
}
|
||||
|
||||
if (is_error($result)) {
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_update_trap', __('Error in trap update.'));
|
||||
}
|
||||
else {
|
||||
returnData('string',
|
||||
array('type' => 'string',
|
||||
'data' => __('Validated traps.')));
|
||||
}
|
||||
}
|
||||
|
||||
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
|
||||
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($id == 'all'){
|
||||
$result = db_process_sql ('delete from ttrap');
|
||||
}
|
||||
else{
|
||||
$result = db_process_sql_delete('ttrap',array('id_trap' => $id));
|
||||
}
|
||||
|
||||
if (is_error($result)) {
|
||||
// TODO: Improve the error returning more info
|
||||
returnError('error_delete_trap', __('Error in trap delete.'));
|
||||
}
|
||||
else {
|
||||
returnData('string',
|
||||
array('type' => 'string',
|
||||
'data' => __('Deleted traps.')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -43,7 +43,6 @@ function config_create_value ($token, $value) {
|
|||
*/
|
||||
function config_update_value ($token, $value) {
|
||||
global $config;
|
||||
$config['flash_charts'] = true;
|
||||
// Include functions_io to can call __() function
|
||||
include_once($config['homedir'] . '/include/functions_io.php');
|
||||
|
||||
|
@ -1533,7 +1532,7 @@ function config_process_config () {
|
|||
else {
|
||||
if (!json_decode(io_safe_output($config['ad_adv_perms']))) {
|
||||
$temp_ad_adv_perms = array();
|
||||
if ($config['ad_adv_perms'] != '') {
|
||||
if (!isset($config['ad_adv_perms']) && $config['ad_adv_perms'] != '') {
|
||||
$perms = explode(';', io_safe_output($config['ad_adv_perms']));
|
||||
foreach ($perms as $ad_adv_perm) {
|
||||
if (preg_match('/[\[\]]/',$ad_adv_perm)) {
|
||||
|
@ -1597,7 +1596,7 @@ function config_process_config () {
|
|||
else {
|
||||
if (!json_decode(io_safe_output($config['ldap_adv_perms']))) {
|
||||
$temp_ldap_adv_perms = array();
|
||||
if ($config['ldap_adv_perms'] != '') {
|
||||
if (!isset($config['ad_adv_perms']) && $config['ldap_adv_perms'] != '') {
|
||||
$perms = explode(';', io_safe_output($config['ldap_adv_perms']));
|
||||
foreach ($perms as $ad_adv_perm) {
|
||||
if (preg_match('/[\[\]]/',$ad_adv_perm)) {
|
||||
|
@ -2261,7 +2260,6 @@ function config_user_set_custom_config() {
|
|||
update_user($config['id_user'], array('last_connect' => time()));
|
||||
}
|
||||
|
||||
// If block_size or flash_chart are provided then override global settings
|
||||
if (!empty($userinfo["block_size"]) && ($userinfo["block_size"] != 0))
|
||||
$config["block_size"] = $userinfo["block_size"];
|
||||
|
||||
|
@ -2280,8 +2278,13 @@ function config_user_set_custom_config() {
|
|||
function config_prepare_session() {
|
||||
global $config;
|
||||
|
||||
if(isset($config["id_user"])){
|
||||
$user = users_get_user_by_id($config["id_user"]);
|
||||
$user_sesion_time = $user['session_time'];
|
||||
}
|
||||
else{
|
||||
$user_sesion_time = null;
|
||||
}
|
||||
|
||||
if ($user_sesion_time == 0) {
|
||||
// Change the session timeout value to session_timeout minutes // 8*60*60 = 8 hours
|
||||
|
@ -2297,8 +2300,8 @@ function config_prepare_session() {
|
|||
else
|
||||
$sessionCookieExpireTime *= 60;
|
||||
|
||||
ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
|
||||
session_set_cookie_params ($sessionCookieExpireTime);
|
||||
@ini_set('session.gc_maxlifetime', $sessionCookieExpireTime);
|
||||
@session_set_cookie_params ($sessionCookieExpireTime);
|
||||
|
||||
// Reset the expiration time upon page load //session_name() is default name of session PHPSESSID
|
||||
|
||||
|
|
|
@ -45,7 +45,12 @@ function cron_update_module_interval ($module_id, $cron) {
|
|||
function cron_next_execution ($cron, $module_interval, $module_id) {
|
||||
|
||||
// Get day of the week and month from cron config
|
||||
list ($minute, $hour, $mday, $month, $wday) = explode (" ", $cron);
|
||||
$cron_array = explode (" ", $cron);
|
||||
$minute = $cron_array[0];
|
||||
$hour = $cron_array[1];
|
||||
$mday = $cron_array[2];
|
||||
$month = $cron_array[3];
|
||||
$wday = $cron_array[4];
|
||||
|
||||
// Get last execution time
|
||||
$last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id);
|
||||
|
@ -63,7 +68,10 @@ function cron_next_execution ($cron, $module_interval, $module_id) {
|
|||
do {
|
||||
$nex_time = cron_next_execution_date ($cron, $nex_time, $module_interval);
|
||||
$nex_time_wd = $nex_time;
|
||||
list ($nex_mon, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||
|
||||
$array_nex = explode (" ", date ("m w", $nex_time_wd));
|
||||
$nex_mon = $array_nex[0];
|
||||
$nex_wday = $array_nex[1];
|
||||
|
||||
do {
|
||||
// Check the day of the week
|
||||
|
@ -73,7 +81,10 @@ function cron_next_execution ($cron, $module_interval, $module_id) {
|
|||
|
||||
// Move to the next day of the month
|
||||
$nex_time_wd += SECONDS_1DAY;
|
||||
list ($nex_mon_wd, $nex_wday) = explode (" ", date ("m w", $nex_time_wd));
|
||||
|
||||
$array_nex_w = explode (" ", date ("m w", $nex_time_wd));
|
||||
$nex_mon_wd = $array_nex_w[0];
|
||||
$nex_wday = $array_nex_w[1];
|
||||
}
|
||||
while ($mday == '*' && $nex_mon_wd == $nex_mon);
|
||||
|
||||
|
|
|
@ -43,13 +43,13 @@ function db_select_engine() {
|
|||
}
|
||||
}
|
||||
|
||||
function db_connect($host = null, $db = null, $user = null, $pass = null, $port = null, $critical = true) {
|
||||
function db_connect($host = null, $db = null, $user = null, $pass = null, $port = null, $critical = true, $charset = "utf8") {
|
||||
global $config;
|
||||
static $error = 0;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$return = mysql_connect_db($host, $db, $user, $pass, $port);
|
||||
$return = mysql_connect_db($host, $db, $user, $pass, $port, $charset);
|
||||
break;
|
||||
case "postgresql":
|
||||
$return = postgresql_connect_db($host, $db, $user, $pass, $port);
|
||||
|
@ -544,6 +544,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
|||
|
||||
$return = array();
|
||||
$i=0;
|
||||
if(is_array($events)){
|
||||
foreach ($events as $event) {
|
||||
switch ($event["event_type"]) {
|
||||
case "going_up_critical":
|
||||
|
@ -569,6 +570,7 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isset($return[0])){
|
||||
return false;
|
||||
}
|
||||
|
@ -893,7 +895,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
}
|
||||
|
||||
//sort current slice
|
||||
if(count($return[$pool_id]['data'] > 1)) {
|
||||
if(count($return[$pool_id]['data']) > 1) {
|
||||
usort(
|
||||
$return[$pool_id]['data'],
|
||||
function ($a, $b) {
|
||||
|
@ -1654,28 +1656,12 @@ function db_get_type_field_table($table, $field) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the element count of a table.
|
||||
* Get the columns of a table.
|
||||
*
|
||||
* @param string $sql SQL query to get the element count.
|
||||
* @param string $table table to retrieve columns.
|
||||
*
|
||||
* @return int Return the number of elements in the table.
|
||||
* @return array with column names.
|
||||
*/
|
||||
function db_get_table_count($table, $search_history_db = false) {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
return mysql_db_get_table_count($table, $search_history_db);
|
||||
break;
|
||||
case "postgresql":
|
||||
return postgresql_db_get_table_count($table, $search_history_db);
|
||||
break;
|
||||
case "oracle":
|
||||
return oracle_db_get_table_count($table, $search_history_db);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function db_get_fields($table) {
|
||||
global $config;
|
||||
|
||||
|
|
|
@ -851,21 +851,10 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
|||
$filter = '1 = 1';
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT DISTINCT tevento.*
|
||||
FROM tevento LEFT JOIN tagent_secondary_group tasg ON tevento.id_agente = tasg.id_agent
|
||||
WHERE %s %s
|
||||
ORDER BY utimestamp DESC LIMIT %d", $agent_condition, $filter, $limit);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("SELECT *
|
||||
FROM tevento
|
||||
WHERE %s %s AND rownum <= %d
|
||||
ORDER BY utimestamp DESC", $agent_condition, $filter, $limit);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql ($sql);
|
||||
|
||||
|
@ -997,8 +986,6 @@ function events_print_event_table ($filter = "", $limit = 10, $width = 440, $ret
|
|||
|
||||
$data[4] = "<a class='$myclass' href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$event["id_agente"]."'>".
|
||||
agents_get_alias($event["id_agente"]). "</A>";
|
||||
|
||||
// ui_print_agent_name ($event["id_agente"], true, 25, '', true);
|
||||
// for System or SNMP generated alerts
|
||||
}
|
||||
elseif ($event["event_type"] == "system") {
|
||||
|
@ -1162,7 +1149,7 @@ function events_print_type_description ($type, $return = false) {
|
|||
break;
|
||||
case "going_down_critical":
|
||||
case "going_up_critical": //This is to be backwards compatible
|
||||
$output .= __('Going down to critical state');
|
||||
$output .= __('Going up to critical state');
|
||||
break;
|
||||
case "going_up_normal":
|
||||
case "going_down_normal": //This is to be backwards compatible
|
||||
|
@ -1863,15 +1850,20 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
|
|||
// Substitute each macro
|
||||
if (strpos($target, '_agent_address_') !== false) {
|
||||
if ($meta) {
|
||||
$server = metaconsole_get_connection_by_id ($server_id);
|
||||
metaconsole_connect($server);
|
||||
$agente_table_name = 'tmetaconsole_agent';
|
||||
$filter = array(
|
||||
'id_tagente' => $event['id_agente'],
|
||||
'id_tmetaconsole_setup' => $server_id
|
||||
);
|
||||
} else {
|
||||
$agente_table_name = 'tagente';
|
||||
$filter = array('id_agente' => $event['id_agente']);
|
||||
}
|
||||
|
||||
$target = str_replace('_agent_address_', $event['id_agente'], $target);
|
||||
|
||||
if($meta) {
|
||||
metaconsole_restore_db_force();
|
||||
}
|
||||
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
|
||||
// If agent has not an ip, display N/A
|
||||
if ($ip === false) $ip = __('N/A');
|
||||
$target = str_replace('_agent_address_', $ip, $target);
|
||||
}
|
||||
if (strpos($target, '_agent_id_') !== false) {
|
||||
$target = str_replace('_agent_id_', $event['id_agente'], $target);
|
||||
|
@ -1896,7 +1888,7 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
|
|||
);
|
||||
|
||||
if($meta) {
|
||||
metaconsole_restore_db_force();
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
} else {
|
||||
$target = str_replace('_module_address_', __('N/A'), $target);
|
||||
|
@ -2678,12 +2670,13 @@ function events_page_comments ($event, $childrens_ids = array()) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) {
|
||||
$comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true);
|
||||
if (((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) && $config["show_events_in_local"] == false || $config["event_replication"] == false) {
|
||||
$comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%; disabled"', true);
|
||||
|
||||
$comments_form .= '<br><div style="text-align:right;">'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'</div><br></div>';
|
||||
}
|
||||
else {
|
||||
$comments_form = '';
|
||||
$comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.'));
|
||||
}
|
||||
|
||||
$comments = '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';
|
||||
|
|
|
@ -1286,7 +1286,6 @@ function graphic_combined_module (
|
|||
$background_color = $params['backgroundColor'];
|
||||
$datelimit = $date_array["start_date"];
|
||||
$fixed_font_size = $config['font_size'];
|
||||
$flash_charts = false;
|
||||
|
||||
if($config["fixed_graph"] == false){
|
||||
$water_mark = array(
|
||||
|
@ -1820,11 +1819,8 @@ function graphic_combined_module (
|
|||
$height = 500;
|
||||
}
|
||||
|
||||
$flash_charts = true;
|
||||
|
||||
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
||||
$output = hbar_graph(
|
||||
true,
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
|
@ -1847,7 +1843,6 @@ function graphic_combined_module (
|
|||
|
||||
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
||||
$output = vbar_graph(
|
||||
true,
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
|
@ -1941,7 +1936,6 @@ function graphic_combined_module (
|
|||
$color = color_graph_array();
|
||||
|
||||
$output = ring_graph(
|
||||
true,
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
|
@ -2162,8 +2156,8 @@ function graph_alert_status ($defined_alerts, $fired_alerts, $width = 300, $heig
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
$out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
||||
'', '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
||||
$out = pie_graph($data, $width, $height, __("other"),
|
||||
'', '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors, false);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
@ -2194,19 +2188,26 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
|||
|
||||
if ($data_agents == false) {
|
||||
$groups = implode(',', array_keys(users_get_groups(false, 'AR', false)));
|
||||
$p_table = "tagente";
|
||||
$s_table = "tagent_secondary_group";
|
||||
if (is_metaconsole()) {
|
||||
$p_table = "tmetaconsole_agent";
|
||||
$s_table = "tmetaconsole_agent_secondary_group";
|
||||
}
|
||||
$data = db_get_row_sql(sprintf('SELECT
|
||||
SUM(critical_count) AS Critical,
|
||||
SUM(warning_count) AS Warning,
|
||||
SUM(normal_count) AS Normal,
|
||||
SUM(unknown_count) AS Unknown
|
||||
%s
|
||||
FROM tagente ta LEFT JOIN tagent_secondary_group tasg
|
||||
FROM %s ta LEFT JOIN %s tasg
|
||||
ON ta.id_agente = tasg.id_agent
|
||||
WHERE
|
||||
ta.disabled = 0 AND
|
||||
%s
|
||||
(ta.id_grupo IN (%s) OR tasg.id_group IN (%s))',
|
||||
$show_not_init ? ', SUM(notinit_count) "Not init"' : '',
|
||||
$p_table, $s_table,
|
||||
empty($id_agent) ? '' : "ta.id_agente = $id_agent AND",
|
||||
$groups,
|
||||
$groups
|
||||
|
@ -2241,9 +2242,20 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
|
|||
$data = array();
|
||||
}
|
||||
|
||||
$out = pie2d_graph($config['flash_charts'], $data, $width, $height,
|
||||
__("other"), ui_get_full_url(false, false, false, false), '',
|
||||
$config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
||||
$out = pie_graph(
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
__("other"),
|
||||
ui_get_full_url(false, false, false, false),
|
||||
'',
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
1,
|
||||
"hidden",
|
||||
$colors,
|
||||
0
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
@ -2316,8 +2328,19 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
|
|||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
||||
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "bottom");
|
||||
|
||||
return pie_graph(
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
__("other"),
|
||||
'',
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
1,
|
||||
"bottom"
|
||||
);
|
||||
}
|
||||
|
||||
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
|
||||
|
@ -2393,31 +2416,48 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va
|
|||
"&colorRGB=". $colorRGB . "' />";
|
||||
}
|
||||
|
||||
function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek = null, $time_from = null, $time_to = null, $width, $height, $home_url, $ttl = 1, $data = false, $round_corner = null) {
|
||||
function graph_sla_slicebar (
|
||||
$id, $period, $sla_min, $sla_max,
|
||||
$date, $daysWeek = null, $time_from = null,
|
||||
$time_to = null, $width, $height, $home_url,
|
||||
$ttl = 1, $data = false, $round_corner = null) {
|
||||
|
||||
global $config;
|
||||
|
||||
if ($round_corner === null) {
|
||||
$round_corner = $config['round_corner'];
|
||||
}
|
||||
|
||||
// If the data is not provided, we got it
|
||||
if ($data === false) {
|
||||
$data = reporting_get_agentmodule_sla_array ($id, $period,
|
||||
$sla_min, $sla_max, $date, $daysWeek, null, null);
|
||||
}
|
||||
|
||||
$col_planned_downtime = '#20973F';
|
||||
|
||||
$colors = array(1 => COL_NORMAL,
|
||||
$colors = array(
|
||||
1 => COL_NORMAL,
|
||||
2 => COL_WARNING,
|
||||
3 => COL_CRITICAL,
|
||||
4 => COL_UNKNOWN,
|
||||
5 => COL_DOWNTIME,
|
||||
6 => COL_NOTINIT,
|
||||
7 => COL_IGNORED);
|
||||
7 => COL_IGNORED
|
||||
);
|
||||
|
||||
return slicesbar_graph($data, $period, $width, $height, $colors,
|
||||
$config['fontpath'], $round_corner, $home_url, $ttl);
|
||||
return $return['chart'] = flot_slicesbar_graph (
|
||||
$data,
|
||||
$period,
|
||||
$width,
|
||||
$height,
|
||||
'',
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$round_corner,
|
||||
$home_url,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2456,9 +2496,11 @@ function grafico_incidente_prioridad () {
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
return pie_graph(
|
||||
$data, 320, 200,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
$config['fontpath'], $config['font_size']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2497,7 +2539,7 @@ function graph_incidents_status () {
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
return pie_graph($data, 320, 200,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
@ -2553,7 +2595,7 @@ function graphic_incident_group () {
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
return pie_graph($data, 320, 200,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
@ -2608,7 +2650,8 @@ function graphic_incident_user () {
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, 320, 200,
|
||||
return pie_graph(
|
||||
$data, 320, 200,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
@ -2662,7 +2705,8 @@ function graphic_incident_source($width = 320, $height = 200) {
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||
return pie_graph(
|
||||
$data, $width, $height,
|
||||
__('Other'), '', '',
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
@ -2707,10 +2751,19 @@ function graph_events_validated($width = 300, $height = 200, $extra_filters = ar
|
|||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
echo pie3d_graph(
|
||||
true, $data_graph, $width, $height, __("other"), "",
|
||||
echo pie_graph(
|
||||
$data_graph,
|
||||
$width,
|
||||
$height,
|
||||
__("other"),
|
||||
"",
|
||||
$water_mark,
|
||||
$config['fontpath'], $config['font_size'], 1, false, $colors);
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
1,
|
||||
false,
|
||||
$colors
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2719,10 +2772,8 @@ function graph_events_validated($width = 300, $height = 200, $extra_filters = ar
|
|||
* @param integer width pie graph width
|
||||
* @param integer height pie graph height
|
||||
* @param string url
|
||||
* @param bool if the graph required is or not for metaconsole
|
||||
* @param bool if the graph required is or not for history table
|
||||
*/
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta = false, $history = false, $noWaterMark = true) {
|
||||
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $noWaterMark = true, $time_limit = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -2752,27 +2803,18 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||
$url = str_replace(
|
||||
'SELECT_id_agente_modulo', 'SELECT id_agente_modulo', $url);
|
||||
|
||||
|
||||
// Choose the table where search if metaconsole or not
|
||||
if ($meta) {
|
||||
if ($history) {
|
||||
$event_table = 'tmetaconsole_event_history';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tmetaconsole_event';
|
||||
}
|
||||
$field_extra = ', agent_name';
|
||||
$groupby_extra = ', server_id';
|
||||
}
|
||||
else {
|
||||
$event_table = 'tevento';
|
||||
$field_extra = '';
|
||||
$groupby_extra = '';
|
||||
}
|
||||
|
||||
// Add tags condition to filter
|
||||
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
||||
|
||||
if ($time_limit && $config['event_view_hr']) {
|
||||
$tags_condition .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " .
|
||||
$config['event_view_hr'] * SECONDS_1HOUR . ")";
|
||||
}
|
||||
|
||||
//This will give the distinct id_agente, give the id_grupo that goes
|
||||
//with it and then the number of times it occured. GROUP BY statement
|
||||
//is required if both DISTINCT() and COUNT() are in the statement
|
||||
|
@ -2804,14 +2846,9 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||
if ($row["id_agente"] == 0) {
|
||||
$system_events += $row["count"];
|
||||
}
|
||||
else {
|
||||
if ($meta) {
|
||||
$name = mb_substr (io_safe_output($row['agent_name']), 0, 25)." (".$row["count"].")";
|
||||
}
|
||||
else {
|
||||
$alias = agents_get_alias($row["id_agente"]);
|
||||
$name = mb_substr($alias, 0, 25)." #".$row["id_agente"]." (".$row["count"].")";
|
||||
}
|
||||
$data[$name] = $row["count"];
|
||||
}
|
||||
}
|
||||
|
@ -2823,13 +2860,6 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||
$data[$name] = $system_events;
|
||||
}
|
||||
|
||||
/*
|
||||
if ($other_events > 0) {
|
||||
$name = __('Other')." (".$other_events.")";
|
||||
$data[$name] = $other_events;
|
||||
}
|
||||
*/
|
||||
|
||||
// Sort the data
|
||||
arsort($data);
|
||||
if ($noWaterMark) {
|
||||
|
@ -2841,7 +2871,8 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||
$water_mark = array();
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||
return pie_graph(
|
||||
$data, $width, $height,
|
||||
__('Other'), '', $water_mark,
|
||||
$config['fontpath'], $config['font_size'], 1, 'bottom');
|
||||
}
|
||||
|
@ -2851,7 +2882,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
|
|||
*
|
||||
* @param string filter Filter for query in DB
|
||||
*/
|
||||
function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true) {
|
||||
function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWaterMark = true, $time_limit = false) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
@ -2860,12 +2891,15 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
|
|||
// Add tags condition to filter
|
||||
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
|
||||
$filter .= $tags_condition;
|
||||
if ($time_limit && $config['event_view_hr']) {
|
||||
$filter .= " AND utimestamp > (UNIX_TIMESTAMP(NOW()) - " . $config['event_view_hr'] * SECONDS_1HOUR . ")";
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
$legend = array ();
|
||||
$total = 0;
|
||||
|
||||
$where = '';
|
||||
$where = "WHERE 1=1";
|
||||
if (!users_is_admin()) {
|
||||
$where = 'WHERE event_type NOT IN (\'recon_host_detected\', \'system\',\'error\', \'new_agent\', \'configuration_change\')';
|
||||
}
|
||||
|
@ -2876,7 +2910,6 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
|
|||
ON tevento.id_agente = tasg.id_agent
|
||||
%s %s
|
||||
GROUP BY criticity ORDER BY events DESC", $where , $filter);
|
||||
|
||||
$criticities = db_get_all_rows_sql ($sql, false, false);
|
||||
|
||||
if (empty($criticities)) {
|
||||
|
@ -2925,7 +2958,8 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
|
|||
$water_mark = array();
|
||||
}
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||
return pie_graph(
|
||||
$data, $width, $height,
|
||||
__('Other'), '', $water_mark,
|
||||
$config['fontpath'], $config['font_size'], 1, 'bottom', $colors);
|
||||
}
|
||||
|
@ -2975,7 +3009,8 @@ function grafico_eventos_usuario ($width, $height) {
|
|||
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
|
||||
|
||||
return pie3d_graph($config['flash_charts'], $data, $width, $height,
|
||||
return pie_graph(
|
||||
$data, $width, $height,
|
||||
__('Other'), '', $water_mark,
|
||||
$config['fontpath'], $config['font_size']);
|
||||
}
|
||||
|
@ -2993,6 +3028,7 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
$ttl = 1, $max_num_elements = 8) {
|
||||
|
||||
global $config;
|
||||
|
||||
$SQL_GRAPH_MAX_LABEL_SIZE = 20;
|
||||
|
||||
$report_content = db_get_row ('treport_content', 'id_rc', $id);
|
||||
|
@ -3023,20 +3059,8 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = str_replace(";", "", $sql);
|
||||
break;
|
||||
}
|
||||
|
||||
$data_result = db_get_all_rows_sql ($sql,$historical_db);
|
||||
|
||||
|
||||
|
||||
if (($config['metaconsole'] == 1) && defined('METACONSOLE'))
|
||||
enterprise_hook('metaconsole_restore_db');
|
||||
|
||||
|
@ -3087,12 +3111,6 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
}
|
||||
}
|
||||
|
||||
$flash_charts = $config['flash_charts'];
|
||||
|
||||
if ($only_image) {
|
||||
$flash_charts = false;
|
||||
}
|
||||
|
||||
if($config["fixed_graph"] == false){
|
||||
$water_mark = array('file' =>
|
||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
|
@ -3102,7 +3120,6 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
return vbar_graph(
|
||||
$flash_charts,
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
|
@ -3119,14 +3136,13 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
$ttl,
|
||||
$homeurl,
|
||||
"white",
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
"c1c1c1"
|
||||
"#c1c1c1"
|
||||
);
|
||||
break;
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
return hbar_graph(
|
||||
$flash_charts,
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
|
@ -3143,12 +3159,21 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||
$ttl,
|
||||
$homeurl,
|
||||
'white',
|
||||
'c1c1c1'
|
||||
'#c1c1c1'
|
||||
);
|
||||
break;
|
||||
case 'sql_graph_pie': // Pie
|
||||
return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl,
|
||||
$water_mark, $config['fontpath'], '', $ttl);
|
||||
return pie_graph(
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
__("other"),
|
||||
$homeurl,
|
||||
$water_mark,
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3167,7 +3192,6 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
||||
$data = array ();
|
||||
|
||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||
|
@ -3187,13 +3211,8 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
if (! $graphic_type) {
|
||||
if ($config['flash_charts']) {
|
||||
$name = date('H:i', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = date('H\h', $bottom);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$name = $bottom;
|
||||
}
|
||||
|
@ -3239,20 +3258,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
}
|
||||
else {
|
||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
|
||||
// Draw legend
|
||||
$out .= "<br>";
|
||||
$out .= " ";
|
||||
foreach ($legend as $hour) {
|
||||
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
||||
$out .= " ";
|
||||
}
|
||||
}
|
||||
$out = flot_slicesbar_graph($data, $period, 100, 40, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
@ -3293,13 +3299,8 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
|||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
if (! $graphic_type) {
|
||||
if ($config['flash_charts']) {
|
||||
$name = date('H:i:s', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = date('H\h', $bottom);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$name = $bottom;
|
||||
}
|
||||
|
@ -3341,23 +3342,31 @@ function graph_graphic_moduleevents ($id_agent, $id_module, $width, $height, $pe
|
|||
$cont++;
|
||||
}
|
||||
|
||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||
$colors = array(
|
||||
1 => COL_NORMAL,
|
||||
2 => COL_WARNING,
|
||||
3 => COL_CRITICAL,
|
||||
4 => COL_UNKNOWN
|
||||
);
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent);
|
||||
}
|
||||
else {
|
||||
$out = slicesbar_graph($data, $period, $width, $height, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
|
||||
// Draw legend
|
||||
$out .= "<br>";
|
||||
$out .= " ";
|
||||
foreach ($legend as $hour) {
|
||||
$out .= "<span style='font-size: 6pt'>" . $hour . "</span>";
|
||||
$out .= " ";
|
||||
}
|
||||
}
|
||||
$out = flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
100,
|
||||
$height,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
$id_agent,
|
||||
array(),
|
||||
true,
|
||||
1
|
||||
);
|
||||
|
||||
if ($return) {
|
||||
return $out;
|
||||
|
@ -3861,18 +3870,14 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image =
|
|||
$i++;
|
||||
}
|
||||
|
||||
$flash_chart = $config['flash_charts'];
|
||||
if ($only_image) {
|
||||
$flash_chart = false;
|
||||
}
|
||||
|
||||
if($config["fixed_graph"] == false){
|
||||
$water_mark = array('file' =>
|
||||
$config['homedir'] . "/images/logo_vertical_water.png",
|
||||
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
|
||||
}
|
||||
|
||||
return pie3d_graph($flash_chart, $values, 370, 200,
|
||||
return pie_graph(
|
||||
$values, 370, 200,
|
||||
__('Other'), $config['homeurl'], $water_mark,
|
||||
$config['fontpath'], $config['font_size'], $ttl);
|
||||
}
|
||||
|
@ -4048,12 +4053,20 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu
|
|||
$colors = array(1 => '#38B800', 2 => '#FFFF00', 3 => '#FF0000', 4 => '#C3C3C3');
|
||||
|
||||
// Draw slicebar graph
|
||||
if ($config['flash_charts']) {
|
||||
echo flot_slicesbar_graph($data, $period, $width, 50, $legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', $adapt_key, $stat_win);
|
||||
}
|
||||
else {
|
||||
echo slicesbar_graph($data, $period, $width, 15, $colors, $config['fontpath'], $config['round_corner'], $homeurl);
|
||||
}
|
||||
echo flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
$width,
|
||||
50,
|
||||
$legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$homeurl,
|
||||
'',
|
||||
$adapt_key,
|
||||
$stat_win
|
||||
);
|
||||
}
|
||||
|
||||
function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') {
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $config;
|
||||
|
||||
require_once ($config['homedir'].'/include/functions_users.php');
|
||||
|
||||
/**
|
||||
|
@ -1226,7 +1228,7 @@ function groups_get_monitors_counter ($group, $agent_filter = array(), $module_f
|
|||
else
|
||||
$module_status = array($module_filter["status"]);
|
||||
|
||||
$status_array = "";
|
||||
$status_array = array();
|
||||
foreach ($module_status as $status) {
|
||||
switch ($status) {
|
||||
case AGENT_MODULE_STATUS_ALL:
|
||||
|
|
|
@ -95,16 +95,18 @@ function groupview_get_all_counters($tree_group) {
|
|||
? 'tmetaconsole_agent_secondary_group'
|
||||
: 'tagent_secondary_group';
|
||||
$sql =
|
||||
"SELECT SUM(ta.normal_count) AS _monitors_ok_,
|
||||
SUM(ta.critical_count) AS _monitors_critical_,
|
||||
"SELECT SUM(ta.critical_count) AS _monitors_critical_,
|
||||
SUM(ta.warning_count) AS _monitors_warning_,
|
||||
SUM(ta.unknown_count) AS _monitors_unknown_,
|
||||
SUM(ta.notinit_count) AS _monitors_not_init_,
|
||||
SUM(ta.fired_count) AS _monitors_alerts_fired_,
|
||||
SUM(ta.normal_count) AS _monitors_ok_,
|
||||
SUM(ta.total_count) AS _monitor_checks_,
|
||||
SUM(ta.fired_count) AS _monitors_alerts_fired_,
|
||||
SUM(IF(ta.critical_count > 0, 1, 0)) AS _agents_critical_,
|
||||
SUM(IF(ta.critical_count = 0 AND ta.warning_count > 0, 1, 0)) AS _agents_warning_,
|
||||
SUM(IF(ta.critical_count = 0 AND ta.warning_count = 0 AND ta.unknown_count > 0, 1, 0)) AS _agents_unknown_,
|
||||
SUM(IF(ta.total_count = ta.notinit_count, 1, 0)) AS _agents_not_init_,
|
||||
SUM(IF(ta.total_count = ta.normal_count AND ta.total_count <> ta.notinit_count, 1, 0)) AS _agents_ok_,
|
||||
COUNT(ta.id_agente) AS _total_agents_,
|
||||
'$all_name' AS _name_,
|
||||
0 AS _id_,
|
||||
|
@ -169,9 +171,11 @@ function groupview_get_groups_list($id_user = false, $access = 'AR', $is_not_pag
|
|||
$list[$id_group]['_id_'] = $agent_counter['id'];
|
||||
$list[$id_group]['_iconImg_'] = $agent_counter['icon'];
|
||||
|
||||
$list[$id_group]['_agents_not_init_'] = $agent_counter['counters']['not_init'];
|
||||
$list[$id_group]['_agents_unknown_'] = $agent_counter['counters']['unknown'];
|
||||
$list[$id_group]['_agents_critical_'] = $agent_counter['counters']['critical'];
|
||||
$list[$id_group]['_agents_warning_'] = $agent_counter['counters']['warning'];
|
||||
$list[$id_group]['_agents_unknown_'] = $agent_counter['counters']['unknown'];
|
||||
$list[$id_group]['_agents_not_init_'] = $agent_counter['counters']['not_init'];
|
||||
$list[$id_group]['_agents_ok_'] = $agent_counter['counters']['ok'];
|
||||
$list[$id_group]['_total_agents_'] = $agent_counter['counters']['total'];
|
||||
|
||||
$list[$id_group]['_monitors_critical_'] = (int)$modules_counters[$id_group]['total_module_critical'];
|
||||
|
|
|
@ -375,6 +375,7 @@ function __ ($string /*, variable arguments */) {
|
|||
global $config;
|
||||
static $extensions_cache = array();
|
||||
|
||||
if( !isset($config["id_user"]) && count($extensions_cache) > 0 ) {
|
||||
if (array_key_exists($config["id_user"], $extensions_cache)) {
|
||||
$extensions = $extensions_cache[$config["id_user"]];
|
||||
}
|
||||
|
@ -382,6 +383,10 @@ function __ ($string /*, variable arguments */) {
|
|||
$extensions = extensions_get_extensions();
|
||||
$extensions_cache[$config["id_user"]] = $extensions;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$extension =null;
|
||||
}
|
||||
if (empty($extensions))
|
||||
$extensions = array();
|
||||
|
||||
|
@ -490,7 +495,7 @@ function io_input_password($password) {
|
|||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_crypto.php');
|
||||
$ciphertext = enterprise_hook('crypto_encrypt', array($password));
|
||||
$ciphertext = enterprise_hook('openssl_encrypt_decrypt', array('encrypt', $password));
|
||||
if ($ciphertext === ENTERPRISE_NOT_HOOK) {
|
||||
return $password;
|
||||
}
|
||||
|
@ -510,7 +515,7 @@ function io_output_password($password) {
|
|||
global $config;
|
||||
|
||||
enterprise_include_once('include/functions_crypto.php');
|
||||
$plaintext = enterprise_hook('crypto_decrypt', array($password));
|
||||
$plaintext = enterprise_hook('openssl_encrypt_decrypt', array('decrypt', $password));
|
||||
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
||||
return $password;
|
||||
}
|
||||
|
|
|
@ -666,6 +666,8 @@ function planned_downtimes_stop ($downtime) {
|
|||
function planned_downtimes_created ($values) {
|
||||
global $config;
|
||||
|
||||
$check_id_user = (bool) db_get_value ('id_user', 'tusuario', 'id_user', $values['id_user']);
|
||||
$check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']);
|
||||
$check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']);
|
||||
|
||||
$datetime_from = strtotime ($values['once_date_from'] . ' ' . $values['once_time_from']);
|
||||
|
@ -702,6 +704,31 @@ function planned_downtimes_created ($values) {
|
|||
'message' => __('Not created. Error inserting data') . ". "
|
||||
. __('The end day must be higher than the start day'));
|
||||
}
|
||||
else if ($values['type_downtime'] !== 'quiet' && $values['type_downtime'] !== 'disable_agents' && $values['type_downtime'] !== 'disable_agents_alerts') {
|
||||
return array('return' => false,
|
||||
'message' => __('Not created. Error inserting data') . ". "
|
||||
. __('The downtime must be quiet, disable_agents or disable_agents_alerts'));
|
||||
}
|
||||
else if ($values['type_execution'] !== 'periodically' && $values['type_execution'] !== 'once' ) {
|
||||
return array('return' => false,
|
||||
'message' => __('Not created. Error inserting data') . ". "
|
||||
. __('The execution must be once or periodically'));
|
||||
}
|
||||
else if ($values['type_periodicity'] !== 'weekly' && $values['type_periodicity'] !== 'monthly' ) {
|
||||
return array('return' => false,
|
||||
'message' => __('Not created. Error inserting data') . ". "
|
||||
. __('The periodicity must be weekly or monthly'));
|
||||
}
|
||||
else if (!$check_id_user){
|
||||
return array('return' => false,
|
||||
'message' => __('Not created. Error inserting data') . ". "
|
||||
. __('User not exist'));
|
||||
}
|
||||
else if (!$check_group && $values['id_group'] != 0) {
|
||||
return array('return' => false,
|
||||
'message' => __('Not created. Error inserting data') . ". "
|
||||
. __('Group not exist'));
|
||||
}
|
||||
else {
|
||||
if (trim(io_safe_output($values['name'])) != '') {
|
||||
if (!$check) {
|
||||
|
|
|
@ -696,7 +696,6 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
|
||||
$urlImage = ui_get_full_url(false, true, false, false);
|
||||
|
||||
|
||||
$sla_failed = false;
|
||||
$total_SLA = 0;
|
||||
$total_result_SLA = 'ok';
|
||||
|
@ -775,7 +774,6 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$slice
|
||||
);
|
||||
|
||||
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
|
@ -933,6 +931,38 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
|
||||
// Slice graphs calculation
|
||||
if ($show_graphs) {
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = array();
|
||||
$i=0;
|
||||
foreach ($raw_graph as $key => $value) {
|
||||
if($data_init == -1){
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['data'];
|
||||
}
|
||||
else{
|
||||
if($data_init == $value['data']){
|
||||
$acum = $acum + $value['utimestamp'];
|
||||
$sum = $sum + $value['real_data'];
|
||||
}
|
||||
else{
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
|
||||
$dataslice = array();
|
||||
$dataslice['agent'] = io_safe_output(modules_get_agentmodule_agent_alias ($sla['id_agent_module']));
|
||||
$dataslice['module'] = io_safe_output(modules_get_agentmodule_name ($sla['id_agent_module']));
|
||||
|
@ -948,12 +978,13 @@ function reporting_SLA($report, $content, $type = 'dinamic',
|
|||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
1920,
|
||||
50,
|
||||
100,
|
||||
70,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$raw_graph,
|
||||
false);
|
||||
$array_result,
|
||||
false
|
||||
);
|
||||
|
||||
$return['charts'][] = $dataslice;
|
||||
}
|
||||
|
@ -1307,7 +1338,7 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
|
|||
|
||||
if ($show_graph != REPORT_TOP_N_ONLY_TABLE) {
|
||||
arsort($data_pie_graph);
|
||||
$return['charts']['pie'] = pie3d_graph(false,
|
||||
$return['charts']['pie'] = pie_graph(
|
||||
$data_pie_graph,
|
||||
$width, $height,
|
||||
__("other"),
|
||||
|
@ -1320,7 +1351,6 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
|
|||
|
||||
//Display bars graph
|
||||
$return['charts']['bars'] = hbar_graph(
|
||||
false,
|
||||
$data_hbar,
|
||||
$width,
|
||||
count($data_hbar) * 50,
|
||||
|
@ -1460,8 +1490,7 @@ function reporting_event_report_group($report, $content,
|
|||
$filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$return['chart']['by_agent']= pie3d_graph(
|
||||
false,
|
||||
$return['chart']['by_agent']= pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -1470,7 +1499,8 @@ function reporting_event_report_group($report, $content,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_by_user_validator) {
|
||||
|
@ -1479,8 +1509,7 @@ function reporting_event_report_group($report, $content,
|
|||
$report["datetime"],$filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$return['chart']['by_user_validator'] = pie3d_graph(
|
||||
false,
|
||||
$return['chart']['by_user_validator'] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -1489,7 +1518,8 @@ function reporting_event_report_group($report, $content,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_by_criticity) {
|
||||
|
@ -1500,8 +1530,7 @@ function reporting_event_report_group($report, $content,
|
|||
|
||||
$colors = get_criticity_pie_colors($data_graph);
|
||||
|
||||
$return['chart']['by_criticity'] = pie3d_graph(
|
||||
false,
|
||||
$return['chart']['by_criticity'] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -1512,7 +1541,8 @@ function reporting_event_report_group($report, $content,
|
|||
$config['font_size'],
|
||||
$ttl,
|
||||
false,
|
||||
$colors);
|
||||
$colors
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_validated_vs_unvalidated) {
|
||||
|
@ -1521,8 +1551,7 @@ function reporting_event_report_group($report, $content,
|
|||
$report["datetime"],$filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$return['chart']['validated_vs_unvalidated'] = pie3d_graph(
|
||||
false,
|
||||
$return['chart']['validated_vs_unvalidated'] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -1531,7 +1560,8 @@ function reporting_event_report_group($report, $content,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
|
@ -2195,8 +2225,7 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||
}
|
||||
|
||||
|
||||
$return["chart"]["pie"] = pie3d_graph(
|
||||
false,
|
||||
$return["chart"]["pie"] = pie_graph(
|
||||
$data_pie_graph,
|
||||
600,
|
||||
150,
|
||||
|
@ -2205,11 +2234,11 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
|
||||
|
||||
$params = array(
|
||||
'flash_chart' => false,
|
||||
'chart_data' => $data_hbar,
|
||||
'width' => 600,
|
||||
'height' => 25 * count($data_hbar),
|
||||
|
@ -2377,8 +2406,7 @@ function reporting_event_report_agent($report, $content,
|
|||
$report["datetime"],$filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$return["chart"]["by_user_validator"] = pie3d_graph(
|
||||
false,
|
||||
$return["chart"]["by_user_validator"] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -2387,7 +2415,8 @@ function reporting_event_report_agent($report, $content,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_by_criticity) {
|
||||
|
@ -2398,8 +2427,7 @@ function reporting_event_report_agent($report, $content,
|
|||
|
||||
$colors = get_criticity_pie_colors($data_graph);
|
||||
|
||||
$return["chart"]["by_criticity"] = pie3d_graph(
|
||||
false,
|
||||
$return["chart"]["by_criticity"] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -2410,7 +2438,8 @@ function reporting_event_report_agent($report, $content,
|
|||
$config['font_size'],
|
||||
$ttl,
|
||||
false,
|
||||
$colors);
|
||||
$colors
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_validated_vs_unvalidated) {
|
||||
|
@ -2419,8 +2448,7 @@ function reporting_event_report_agent($report, $content,
|
|||
$report["datetime"],$filter_event_severity, $filter_event_type,
|
||||
$filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$return["chart"]["validated_vs_unvalidated"] = pie3d_graph(
|
||||
false,
|
||||
$return["chart"]["validated_vs_unvalidated"] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -2429,7 +2457,8 @@ function reporting_event_report_agent($report, $content,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
|
@ -3337,8 +3366,7 @@ function reporting_sql_graph($report, $content, $type,
|
|||
}
|
||||
|
||||
// Get chart
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type,
|
||||
$content, $ttl);
|
||||
reporting_set_conf_charts($width, $height, $only_image, $type,$content, $ttl);
|
||||
|
||||
if (!empty($force_width_chart)) {
|
||||
$width = $force_width_chart;
|
||||
|
@ -5502,7 +5530,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
reporting_set_conf_charts($width, $height, $only_image, $type,
|
||||
$content, $ttl);
|
||||
|
||||
|
||||
$return["id_rc"] = $content['id_rc'];
|
||||
|
||||
$edge_interval = 10;
|
||||
|
@ -5550,7 +5577,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -5600,7 +5626,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$slice
|
||||
);
|
||||
|
||||
|
||||
if ($metaconsole_on) {
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
|
@ -5725,6 +5750,38 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$data['order'] = $data['sla_value'];
|
||||
$return['data'][] = $data;
|
||||
|
||||
$data_init = -1;
|
||||
$acum = 0;
|
||||
$sum = 0;
|
||||
$array_result = array();
|
||||
$i=0;
|
||||
foreach ($raw_graph as $key => $value) {
|
||||
if($data_init == -1){
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['data'];
|
||||
}
|
||||
else{
|
||||
if($data_init == $value['data']){
|
||||
$acum = $acum + $value['utimestamp'];
|
||||
$sum = $sum + $value['real_data'];
|
||||
}
|
||||
else{
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
$i++;
|
||||
$data_init = $value['data'];
|
||||
$acum = $value['utimestamp'];
|
||||
$sum = $value['real_data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_result[$i]['data'] = $data_init;
|
||||
$array_result[$i]['utimestamp'] = $acum;
|
||||
$array_result[$i]['real_data'] = $sum;
|
||||
|
||||
// Slice graphs calculation
|
||||
$dataslice = array();
|
||||
$dataslice['agent'] = modules_get_agentmodule_agent_alias ($sla['id_agent_module']);
|
||||
|
@ -5746,12 +5803,13 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
$content,
|
||||
$content['time_from'],
|
||||
$content['time_to'],
|
||||
1920,
|
||||
50,
|
||||
100,
|
||||
70,
|
||||
$urlImage,
|
||||
$ttl,
|
||||
$raw_graph,
|
||||
false);
|
||||
$array_result,
|
||||
false
|
||||
);
|
||||
|
||||
$return['charts'][] = $dataslice;
|
||||
|
||||
|
@ -5759,7 +5817,6 @@ function reporting_availability_graph($report, $content, $pdf=false) {
|
|||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// SLA items sorted descending ()
|
||||
|
@ -6607,8 +6664,7 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||
array('id_agentmodule' => $id_module), $period, $date, $filter_event_severity,
|
||||
$filter_event_type, $filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$event['chart']['by_user_validator'] = pie3d_graph(
|
||||
false,
|
||||
$event['chart']['by_user_validator'] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -6617,7 +6673,8 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_by_criticity) {
|
||||
|
@ -6627,8 +6684,7 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||
|
||||
$colors = get_criticity_pie_colors($data_graph);
|
||||
|
||||
$event['chart']['by_criticity'] = pie3d_graph(
|
||||
false,
|
||||
$event['chart']['by_criticity'] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -6639,7 +6695,8 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||
$config['font_size'],
|
||||
$ttl,
|
||||
false,
|
||||
$colors);
|
||||
$colors
|
||||
);
|
||||
}
|
||||
|
||||
if ($event_graph_validated_vs_unvalidated) {
|
||||
|
@ -6647,8 +6704,7 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||
array('id_agentmodule' => $id_module), $period, $date, $filter_event_severity,
|
||||
$filter_event_type, $filter_event_status, $filter_event_filter_search);
|
||||
|
||||
$event['chart']['validated_vs_unvalidated'] = pie3d_graph(
|
||||
false,
|
||||
$event['chart']['validated_vs_unvalidated'] = pie_graph(
|
||||
$data_graph,
|
||||
500,
|
||||
150,
|
||||
|
@ -6657,7 +6713,8 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'],
|
||||
$config['font_size'],
|
||||
$ttl);
|
||||
$ttl
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty ($event)) {
|
||||
|
@ -7510,8 +7567,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he
|
|||
}
|
||||
|
||||
// Fixed width non interactive charts
|
||||
$status_chart_width = $config["flash_charts"] == false
|
||||
? 100 : $graph_width;
|
||||
$status_chart_width = $graph_width;
|
||||
|
||||
// Modules by status table
|
||||
$table_mbs = html_get_predefined_table();
|
||||
|
@ -7629,10 +7685,11 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
*/
|
||||
|
||||
if($data["total_agents"]){
|
||||
if(($data["monitor_checks"]/$data["total_agents"]>100) && !enterprise_installed()) {
|
||||
$tdata[5] = "<div id='monitorcheckmodal' class='publienterprise' title='Community version' style=''><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
|
||||
}
|
||||
}
|
||||
|
||||
$table_am->rowclass[] = '';
|
||||
$table_am->data[] = $tdata;
|
||||
|
@ -9545,7 +9602,12 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
// Substract the not working time
|
||||
// Initialize the working time status machine ($wt_status)
|
||||
// Search the first data at worktime start
|
||||
list ($period_reduced, $wt_status, $datelimit_increased) = reporting_get_agentmodule_sla_day_period ($period, $date, $timeFrom, $timeTo);
|
||||
$array_sla_report = reporting_get_agentmodule_sla_day_period ($period, $date, $timeFrom, $timeTo);
|
||||
|
||||
$period_reduced = $array_sla_report[0];
|
||||
$wt_status = $array_sla_report[1];
|
||||
$datelimit_increased = $array_sla_report[2];
|
||||
|
||||
if ($period_reduced <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -9740,332 +9802,7 @@ function reporting_get_agentmodule_sla_day ($id_agent_module, $period = 0, $min_
|
|||
return (float) (100 - ($bad_period / $period_reduced) * 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get several SLA data for an agentmodule within a period divided on subperiods
|
||||
*
|
||||
* @param int Agent module to calculate SLA
|
||||
* @param int Period to check the SLA compliance.
|
||||
* @param int Minimum data value the module in the right interval
|
||||
* @param int Maximum data value the module in the right interval. False will
|
||||
* ignore max value
|
||||
* @param array $days Array of days week to extract as array('monday' => false, 'tuesday' => true....), and by default is null.
|
||||
* @param string $timeFrom Time in the day to start to extract in mysql format, by default null.
|
||||
* @param string $timeTo Time in the day to end to extract in mysql format, by default null.
|
||||
*
|
||||
* @return Array with values either 1, 2, 3 or 4 depending if the SLA percentage for this subperiod
|
||||
* is within the sla limits, on the edge, outside or with an unknown value.
|
||||
*/
|
||||
function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||
global $config;
|
||||
|
||||
if (empty($id_agent_module))
|
||||
return false;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) {
|
||||
$date = get_system_time ();
|
||||
}
|
||||
if ($daysWeek === null) {
|
||||
$daysWeek = array();
|
||||
}
|
||||
|
||||
// Hotfix: The edge values are confuse to the users
|
||||
$percent = 0;
|
||||
|
||||
// Limit date to start searching data
|
||||
$datelimit = $date - $period;
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get interval data
|
||||
$sql = sprintf ('SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = %d
|
||||
AND utimestamp > %d AND utimestamp <= %d',
|
||||
$id_agent_module, $datelimit, $date);
|
||||
|
||||
//Add the working times (mon - tue - wed ...) and from time to time
|
||||
$days = array();
|
||||
//Translate to mysql week days
|
||||
|
||||
if ($daysWeek) {
|
||||
foreach ($daysWeek as $key => $value) {
|
||||
if (!$value) {
|
||||
if ($key == 'monday') {
|
||||
$days[] = 2;
|
||||
}
|
||||
if ($key == 'tuesday') {
|
||||
$days[] = 3;
|
||||
}
|
||||
if ($key == 'wednesday') {
|
||||
$days[] = 4;
|
||||
}
|
||||
if ($key == 'thursday') {
|
||||
$days[] = 5;
|
||||
}
|
||||
if ($key == 'friday') {
|
||||
$days[] = 6;
|
||||
}
|
||||
if ($key == 'saturday') {
|
||||
$days[] = 7;
|
||||
}
|
||||
if ($key == 'sunday') {
|
||||
$days[] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($days) > 0) {
|
||||
$sql .= ' AND DAYOFWEEK(FROM_UNIXTIME(utimestamp)) NOT IN (' . implode(',', $days) . ')';
|
||||
}
|
||||
|
||||
if ($timeFrom != $timeTo) {
|
||||
if ($timeFrom < $timeTo) {
|
||||
$sql .= ' AND (TIME(FROM_UNIXTIME(utimestamp)) >= \'' .
|
||||
$timeFrom . '\'
|
||||
AND TIME(FROM_UNIXTIME(utimestamp)) <= \'' .
|
||||
$timeTo . '\')';
|
||||
}
|
||||
elseif ($timeFrom > $timeTo) {
|
||||
$sql .= ' AND (TIME(FROM_UNIXTIME(utimestamp)) >= \'' .
|
||||
$timeFrom . '\'
|
||||
OR TIME(FROM_UNIXTIME(utimestamp)) <= \''.
|
||||
$timeTo . '\')';
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= ' ORDER BY utimestamp ASC';
|
||||
$interval_data = db_get_all_rows_sql ($sql, $search_in_history_db);
|
||||
|
||||
if ($interval_data === false) {
|
||||
$interval_data = array ();
|
||||
}
|
||||
|
||||
|
||||
// Indexing data
|
||||
$interval_data_indexed = array();
|
||||
foreach($interval_data as $idata) {
|
||||
$interval_data_indexed[$idata['utimestamp']]['data'] = $idata['datos'];
|
||||
}
|
||||
|
||||
//-----------Calculate unknown status events------------------------
|
||||
$events_unknown = db_get_all_rows_filter ('tevento',
|
||||
array ('id_agentmodule' => $id_agent_module,
|
||||
"utimestamp > $datelimit",
|
||||
"utimestamp < $date",
|
||||
'order' => 'utimestamp ASC'),
|
||||
array ('id_evento', 'evento', 'timestamp', 'utimestamp', 'event_type'));
|
||||
|
||||
if ($events_unknown === false) {
|
||||
$events_unknown = array ();
|
||||
}
|
||||
|
||||
// Add unknown periods to data
|
||||
for ($i = 0; isset($events_unknown[$i]); $i++) {
|
||||
$eu = $events_unknown[$i];
|
||||
|
||||
if ($eu['event_type'] == 'going_unknown') {
|
||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 4;
|
||||
|
||||
// Search the corresponding recovery event.
|
||||
for ($j = $i+1; isset($events_unknown[$j]); $j++) {
|
||||
$eu = $events_unknown[$j];
|
||||
|
||||
if ($eu['event_type'] != 'going_unknown' && substr ($eu['event_type'], 0, 5) == 'going') {
|
||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 6;
|
||||
|
||||
// Do not process read events again.
|
||||
$i = $j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the last event before inverval to know if graph start on unknown
|
||||
$prev_event = db_get_row_filter ('tevento',
|
||||
array ('id_agentmodule' => $id_agent_module,
|
||||
"utimestamp <= $datelimit",
|
||||
'order' => 'utimestamp DESC'));
|
||||
if (isset($prev_event['event_type']) && $prev_event['event_type'] == 'going_unknown') {
|
||||
$start_unknown = true;
|
||||
}
|
||||
else {
|
||||
$start_unknown = false;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//-----------------Set limits of the interval-----------------------
|
||||
// Get previous data (This adds the first data if the begin of module data is after the begin time interval)
|
||||
$previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
|
||||
if ($previous_data !== false ) {
|
||||
$previous_value = $previous_data['datos'];
|
||||
// if ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
|
||||
// (($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
|
||||
// $previous_known_status = 2;
|
||||
// }
|
||||
// else
|
||||
if (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
|
||||
$previous_known_status = 1;
|
||||
}
|
||||
elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||
$previous_known_status = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// If the starting of the graph is unknown we set it
|
||||
if ($start_unknown) {
|
||||
$interval_data_indexed[$datelimit]['data'] = 0;
|
||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||
}
|
||||
else {
|
||||
if ($previous_data !== false ) {
|
||||
$interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
|
||||
}
|
||||
else { // If there are not data befor interval set unknown
|
||||
$interval_data_indexed[$datelimit]['data'] = 0;
|
||||
$interval_data_indexed[$datelimit]['status'] = 4;
|
||||
$previous_known_status = 1; // Assume the module was in normal status if there is no previous data.
|
||||
}
|
||||
}
|
||||
|
||||
// Get next data (This adds data before the interval of the report)
|
||||
$next_data = modules_get_next_data ($id_agent_module, $date);
|
||||
|
||||
if ($next_data !== false) {
|
||||
$interval_data_indexed[$date]['data'] = $previous_data['datos'];
|
||||
}
|
||||
else if (count ($interval_data_indexed) > 0) {
|
||||
// Propagate the last known data to the end of the interval (if there is no module data at the end point)
|
||||
ksort($interval_data_indexed);
|
||||
$last_data = end($interval_data_indexed);
|
||||
$interval_data_indexed[$date] = $last_data;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//--------Calculate planned downtime dates--------------------------
|
||||
$downtime_dates = reporting_get_planned_downtimes_intervals($id_agent_module, $datelimit, $date);
|
||||
|
||||
foreach ($downtime_dates as $downtime_date) {
|
||||
// Delete data of the planned downtime and put the last data on the upper limit
|
||||
$interval_data_indexed[$downtime_date['date_from']]['data'] = 0;
|
||||
$interval_data_indexed[$downtime_date['date_from']]['status'] = 5;
|
||||
$interval_data_indexed[$downtime_date['date_to']]['data'] = 0;
|
||||
$interval_data_indexed[$downtime_date['date_to']]['status'] = 4;
|
||||
|
||||
$last_downtime_data = false;
|
||||
foreach ($interval_data_indexed as $idi_timestamp => $idi) {
|
||||
if ($idi_timestamp != $downtime_date['date_from'] && $idi_timestamp != $downtime_date['date_to'] &&
|
||||
$idi_timestamp >= $downtime_date['date_from'] && $idi_timestamp <= $downtime_date['date_to']) {
|
||||
$last_downtime_data = $idi['data'];
|
||||
unset($interval_data_indexed[$idi_timestamp]);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the last data of the interval as limit
|
||||
if ($last_downtime_data !== false) {
|
||||
$interval_data_indexed[$downtime_date['date_to']]['data'] = $last_downtime_data;
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
// Sort the array
|
||||
ksort($interval_data_indexed);
|
||||
|
||||
// We need more or equal two points
|
||||
if (count ($interval_data_indexed) < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get the percentage for the limits
|
||||
$diff = $max_value - $min_value;
|
||||
|
||||
// Get module type
|
||||
$id_module_type = db_get_value('id_tipo_modulo', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
|
||||
// If module is boolean don't create translation intervals (on the edge intervals)
|
||||
// if ($id_module_type == 2 or $id_module_type == 6 or $id_module_type == 9 or $id_module_type == 18) {
|
||||
// $percent = 0;
|
||||
// }
|
||||
// else {
|
||||
// // Getting 10% of $diff --> $percent = ($diff/100)*10, so...
|
||||
// $percent = $diff / 10;
|
||||
// }
|
||||
|
||||
//Set initial conditions
|
||||
$first_data = array_shift ($interval_data);
|
||||
$previous_utimestamp = $date - $period;
|
||||
|
||||
$previous_value = $first_data ['datos'];
|
||||
$previous_status = 0;
|
||||
|
||||
if (isset($first_data['status'])) {
|
||||
// 4 for the Unknown value and 5 for planned downtime
|
||||
$previous_status = $first_data['status'];
|
||||
}
|
||||
// elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) ||
|
||||
// (($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges
|
||||
// $previous_status = 2;
|
||||
// }
|
||||
elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK
|
||||
$previous_status = 1;
|
||||
}
|
||||
elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||
$previous_status = 3;
|
||||
}
|
||||
|
||||
$data_colors = array();
|
||||
$i = 0;
|
||||
|
||||
foreach ($interval_data_indexed as $utimestamp => $data) {
|
||||
$change = false;
|
||||
$value = $data['data'];
|
||||
if (isset($data['status'])) {
|
||||
// Leaving unkown status.
|
||||
if ($data['status'] == 6) {
|
||||
$status = $previous_known_status;
|
||||
}
|
||||
// 4 unknown, 5 planned downtime.
|
||||
else {
|
||||
$status = $data['status'];
|
||||
}
|
||||
}
|
||||
// elseif ((($value > ($min_value - $percent)) && ($value < ($min_value + $percent))) ||
|
||||
// (($value > ($max_value - $percent)) && ($value < ($max_value + $percent)))) { //2 when value is within the edges
|
||||
// $status = 2;
|
||||
// }
|
||||
elseif (($value >= ($min_value + $percent)) && ($value <= ($max_value - $percent))) { //1 when value is OK
|
||||
$status = 1;
|
||||
}
|
||||
elseif (($value <= ($min_value - $percent)) || ($value >= ($max_value + $percent))) { //3 when value is Wrong
|
||||
$status = 3;
|
||||
}
|
||||
|
||||
if ($status != $previous_status) {
|
||||
$change = true;
|
||||
$data_colors[$i]['data'] = $previous_status;
|
||||
$data_colors[$i]['utimestamp'] = $utimestamp - $previous_utimestamp;
|
||||
$i++;
|
||||
$previous_status = $status;
|
||||
$previous_utimestamp = $utimestamp;
|
||||
}
|
||||
|
||||
// Save the last known status.
|
||||
if ($status <= 3) {
|
||||
$previous_known_status = $status;
|
||||
}
|
||||
}
|
||||
if ($change == false) {
|
||||
$data_colors[$i]['data'] = $previous_status;
|
||||
$data_colors[$i]['utimestamp'] = $date - $previous_utimestamp;
|
||||
}
|
||||
|
||||
return $data_colors;
|
||||
}
|
||||
|
||||
function reporting_get_stats_servers($tiny = true) {
|
||||
function reporting_get_stats_servers() {
|
||||
global $config;
|
||||
|
||||
$server_performance = servers_get_performance();
|
||||
|
@ -10101,30 +9838,6 @@ function reporting_get_stats_servers($tiny = true) {
|
|||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
|
||||
if ($tiny) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Remote modules'), 'width' => '25px'));
|
||||
$tdata[1] = '<span class="big_data">' . format_numeric($server_performance ["total_remote_modules"]) . '</span>';
|
||||
|
||||
/* Hello there! :)
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
*/
|
||||
|
||||
$tdata[2] = '<span class="med_data">' . format_numeric($server_performance ["remote_modules_rate"], 2) . '</span>';
|
||||
$tdata[3] = html_print_image('images/module.png', true, array('title' => __('Ratio') . ': ' . __('Modules by second'), 'width' => '16px')) . '/sec </span>';
|
||||
|
||||
if($server_performance ["total_remote_modules"]>10000 && !enterprise_installed()){
|
||||
$tdata[4] = "<div id='agentsmodal' class='publienterprise' title='Community version' style='text-align:left;'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
|
||||
}
|
||||
else{
|
||||
$tdata[4] = ' ';
|
||||
}
|
||||
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
else {
|
||||
if (isset($server_performance ["total_network_modules"])) {
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/network.png', true, array('title' => __('Network modules'), 'width' => '25px'));
|
||||
|
@ -10206,28 +9919,11 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$system_events = db_get_value_sql(
|
||||
'SELECT SQL_NO_CACHE COUNT(id_evento)
|
||||
FROM tevento');
|
||||
break;
|
||||
case "postgresql":
|
||||
case "oracle":
|
||||
$system_events = db_get_value_sql(
|
||||
'SELECT COUNT(id_evento)
|
||||
FROM tevento');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$tdata = array();
|
||||
$tdata[0] = html_print_image('images/lightning_go.png', true,
|
||||
array('title' => __('Total events'), 'width' => '25px'));
|
||||
$tdata[1] = '<span class="big_data">' .
|
||||
format_numeric($system_events) . '</span>';
|
||||
$tdata[1] = '<span class="big_data" id="total_events">' .
|
||||
html_print_image('images/spinner.gif',true) . '</span>';
|
||||
|
||||
/* Hello there! :)
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
|
@ -10236,15 +9932,12 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
|
||||
if($system_events > 50000 && !enterprise_installed()){
|
||||
$tdata[2] = "<div id='monitoreventsmodal' class='publienterprise' title='Community version' style='text-align:left'><img data-title='Enterprise version' class='img_help forced_title' data-use_title_for_force_title='1' src='images/alert_enterprise.png'></div>";
|
||||
}
|
||||
|
||||
else{
|
||||
} else {
|
||||
$tdata[3] = " ";
|
||||
}
|
||||
$table_srv->colspan[count($table_srv->data)][1] = 2;
|
||||
$table_srv->rowclass[] = '';
|
||||
$table_srv->data[] = $tdata;
|
||||
}
|
||||
|
||||
$output = '<fieldset class="databox tactical_set">
|
||||
<legend>' .
|
||||
|
@ -10252,6 +9945,20 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
'</legend>' .
|
||||
html_print_table($table_srv, true) . '</fieldset>';
|
||||
|
||||
$output .= '<script type="text/javascript">';
|
||||
$output .= '$(document).ready(function () {';
|
||||
$output .= 'var parameters = {};';
|
||||
$output .= 'parameters["page"] = "include/ajax/events";';
|
||||
$output .= 'parameters["total_events"] = 1;';
|
||||
|
||||
$output .= '$.ajax({type: "GET",url: "ajax.php",data: parameters,';
|
||||
$output .= 'success: function(data) {';
|
||||
$output .= '$("#total_events").text(data);';
|
||||
$output .= '}';
|
||||
$output .= '});';
|
||||
$output .= '});';
|
||||
$output .= '</script>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,10 @@ function html_do_report_info($report) {
|
|||
<tr>
|
||||
<td><b>' . __('Report date') . ': </b></td>';
|
||||
if (isset($report['period'])) {
|
||||
$html .= '<td>' . date($config["date_format"], ($report['datetime'] - $report['period']));
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period'])) {
|
||||
$html .= '<td>' . date($config["date_format"], ($report['datetime'] - $report['period'])) . '</td>';
|
||||
}
|
||||
$html .= '<td></td>';
|
||||
}
|
||||
else {
|
||||
$html .= '<td>' . __('Items period before') . ' <b>' . date($config["date_format"], $report['datetime']) . '</b></td>';
|
||||
|
@ -371,7 +374,6 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table->data['sla']['cell'] = $item['failed'];
|
||||
}
|
||||
else {
|
||||
|
||||
if (!empty($item['planned_downtimes'])) {
|
||||
$downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']);
|
||||
|
||||
|
@ -381,7 +383,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
}
|
||||
}
|
||||
|
||||
if(isset($item['data'])){
|
||||
if(!(!isset($item['data']) && $hide_notinit_agent == 1)) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
|
||||
|
@ -471,7 +473,7 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
foreach ($item['data'] as $sla) {
|
||||
if(isset($sla)){
|
||||
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
|
||||
if (!$hide_notinit_agent) {
|
||||
|
||||
//first_table
|
||||
$row = array();
|
||||
$row[] = $sla['agent'];
|
||||
|
@ -486,6 +488,8 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
}
|
||||
$row[] = round($sla['sla_limit'], 2) . "%";
|
||||
|
||||
if (!$hide_notinit_agent) {
|
||||
|
||||
if (reporting_sla_is_not_init_from_array($sla)) {
|
||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
|
||||
__('N/A') . '</span>';
|
||||
|
@ -638,7 +642,6 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table3->data[] = $row3;
|
||||
}
|
||||
}
|
||||
|
||||
$table->colspan['sla']['cell'] = 2;
|
||||
$table->data['sla']['cell'] = html_print_table($table1, true);
|
||||
$table->colspan['time_global']['cell'] = 2;
|
||||
|
@ -646,10 +649,17 @@ function reporting_html_SLA($table, $item, $mini) {
|
|||
$table->colspan['checks_global']['cell'] = 2;
|
||||
$table->data['checks_global']['cell'] = html_print_table($table3, true);
|
||||
}
|
||||
else {
|
||||
$table->colspan['error']['cell'] = 3;
|
||||
$table->data['error']['cell'] =
|
||||
__('There are no Agent/Modules defined');
|
||||
}
|
||||
|
||||
if (!empty($item['charts'])) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->size = array ();
|
||||
$table1->size[0] = '10%';
|
||||
|
||||
$table1->data = array ();
|
||||
if (!$hide_notinit_agent) {
|
||||
|
@ -2319,7 +2329,7 @@ function reporting_html_availability(&$table, $item) {
|
|||
|
||||
global $config;
|
||||
|
||||
if (!empty($item["data"])) {
|
||||
if (!empty($item["data"]) || $hide_notinit_agent !=1) {
|
||||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
|
@ -2498,7 +2508,6 @@ function reporting_html_availability(&$table, $item) {
|
|||
$same_agent_in_resume = $item['data']['agent'];
|
||||
}
|
||||
}
|
||||
|
||||
$table1->data[] = $table_row;
|
||||
$table2->data[] = $table_row2;
|
||||
}
|
||||
|
@ -2574,6 +2583,11 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) {
|
|||
$table1 = new stdClass();
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
$table1->size = array();
|
||||
$table1->size[0] = '10%';
|
||||
$table1->size[1] = '80%';
|
||||
$table1->size[2] = '5%';
|
||||
$table1->size[3] = '5%';
|
||||
foreach ($item['charts'] as $chart) {
|
||||
$checks_resume = '';
|
||||
$sla_value = '';
|
||||
|
@ -2857,24 +2871,6 @@ function reporting_html_sql(&$table, $item) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
||||
global $config;
|
||||
|
||||
|
@ -2899,8 +2895,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
|||
|
||||
if ($data["monitor_checks"] > 0) {
|
||||
// Fixed width non interactive charts
|
||||
$status_chart_width = $config["flash_charts"] == false
|
||||
? 100 : $graph_width;
|
||||
$status_chart_width = $graph_width;
|
||||
|
||||
$tdata[0] =
|
||||
'<div style="margin: auto; width: ' . $graph_width . 'px;">' .
|
||||
|
@ -3038,125 +3033,6 @@ function reporting_get_fired_alerts_table ($alerts_fired) {
|
|||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a report for alerts in a group of agents.
|
||||
*
|
||||
* It prints the numbers of alerts defined, fired and not fired in a group.
|
||||
* It also prints all the alerts that were fired grouped by agents.
|
||||
*
|
||||
* @param int $id_group Group to get info of the alerts.
|
||||
* @param int $period Period of time of the desired alert report.
|
||||
* @param int $date Beggining date of the report (current date by default).
|
||||
* @param bool $return Flag to return or echo the report (echo by default).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return = false) {
|
||||
global $config;
|
||||
|
||||
$output = '';
|
||||
$alerts = get_group_alerts ($id_group);
|
||||
$alerts_fired = get_alerts_fired ($alerts, $period, $date);
|
||||
|
||||
$fired_percentage = 0;
|
||||
if (sizeof ($alerts) > 0)
|
||||
$fired_percentage = round (sizeof ($alerts_fired) / sizeof ($alerts) * 100, 2);
|
||||
$not_fired_percentage = 100 - $fired_percentage;
|
||||
|
||||
$data = array ();
|
||||
$data[__('Alerts fired')] = $fired_percentage;
|
||||
$data[__('Alerts not fired')] = $not_fired_percentage;
|
||||
|
||||
$output .= pie3d_graph(false, $data, 280, 150,
|
||||
__("other"),
|
||||
ui_get_full_url(false, false, false, false) . '/',
|
||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
|
||||
$output .= '<strong>'.__('Alerts fired').': '.sizeof ($alerts_fired).'</strong><br />';
|
||||
$output .= '<strong>'.__('Total alerts monitored').': '.sizeof ($alerts).'</strong><br />';
|
||||
|
||||
if (! sizeof ($alerts_fired)) {
|
||||
if (!$return)
|
||||
echo $output;
|
||||
|
||||
return $output;
|
||||
}
|
||||
$table = reporting_get_fired_alerts_table ($alerts_fired);
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '100px';
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
|
||||
$output .= html_print_table ($table, true);
|
||||
|
||||
if (!$return)
|
||||
echo $output;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a report for monitors modules in a group of agents.
|
||||
*
|
||||
* It prints the numbers of monitors defined, showing those which went up and down, in a group.
|
||||
* It also prints all the down monitors in the group.
|
||||
*
|
||||
* @param int $id_group Group to get info of the monitors.
|
||||
* @param int $period Period of time of the desired monitor report.
|
||||
* @param int $date Beginning date of the report in UNIX time (current date by default).
|
||||
* @param bool $return Flag to return or echo the report (by default).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return = false) {
|
||||
if (empty ($date)) //If date is 0, false or empty
|
||||
$date = get_system_time ();
|
||||
|
||||
$datelimit = $date - $period;
|
||||
$output = '';
|
||||
|
||||
$monitors = modules_get_monitors_in_group ($id_group);
|
||||
if (empty ($monitors)) //If monitors has returned false or an empty array
|
||||
return;
|
||||
$monitors_down = modules_get_monitors_down ($monitors, $period, $date);
|
||||
$down_percentage = round (count ($monitors_down) / count ($monitors) * 100, 2);
|
||||
$not_down_percentage = 100 - $down_percentage;
|
||||
|
||||
$output .= '<strong>'.__('Total monitors').': '.count ($monitors).'</strong><br />';
|
||||
$output .= '<strong>'.__('Monitors down on period').': '.count ($monitors_down).'</strong><br />';
|
||||
|
||||
$table = reporting_get_monitors_down_table ($monitors_down);
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox';
|
||||
$table->size = array ();
|
||||
$table->size[0] = '100px';
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
|
||||
$table->size = array ();
|
||||
$table->size[0] = '100px';
|
||||
|
||||
$output .= html_print_table ($table, true);
|
||||
|
||||
$data = array();
|
||||
$data[__('Monitors OK')] = $down_percentage;
|
||||
$data[__('Monitors BAD')] = $not_down_percentage;
|
||||
|
||||
$output .= pie3d_graph(false, $data, 280, 150,
|
||||
__("other"),
|
||||
ui_get_full_url(false, false, false, false) . '/',
|
||||
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
|
||||
if (!$return)
|
||||
echo $output;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a report table with all the monitors down.
|
||||
*
|
||||
|
@ -3797,6 +3673,7 @@ function reporting_get_last_activity() {
|
|||
}
|
||||
|
||||
function reporting_get_event_histogram ($events, $text_header_event = false) {
|
||||
|
||||
global $config;
|
||||
if (!defined("METACONSOLE")) {
|
||||
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
|
||||
|
@ -3881,17 +3758,7 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
|
|||
}
|
||||
|
||||
$table = new stdClass();
|
||||
if (!$text_header_event) {
|
||||
$table->width = '100%';
|
||||
}
|
||||
else {
|
||||
if (defined("METACONSOLE")) {
|
||||
$table->width = '100%';
|
||||
}
|
||||
else {
|
||||
$table->width = '70%';
|
||||
}
|
||||
}
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
$table->head = array ();
|
||||
|
@ -3899,17 +3766,28 @@ function reporting_get_event_histogram ($events, $text_header_event = false) {
|
|||
$table->data[0][0] = "" ;
|
||||
|
||||
if (!empty($graph_data)) {
|
||||
if (defined("METACONSOLE"))
|
||||
$slicebar = flot_slicesbar_graph($graph_data, $max_value, "100%", 35, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url);
|
||||
else {
|
||||
if (!$text_header_event) {
|
||||
$slicebar = slicesbar_graph($graph_data, $max_value, 700, 25, $colors, $config['fontpath'], $config['round_corner'], $urlImage, $ttl);
|
||||
}
|
||||
else {
|
||||
$slicebar = slicesbar_graph($graph_data, $max_value, 350, 18, $colors, $config['fontpath'], $config['round_corner'], $urlImage, $ttl);
|
||||
}
|
||||
}
|
||||
$url_slice = defined("METACONSOLE")
|
||||
? $url
|
||||
: $urlImage;
|
||||
|
||||
$slicebar = flot_slicesbar_graph (
|
||||
$graph_data,
|
||||
$max_value,
|
||||
100,
|
||||
35,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$url,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
array(),
|
||||
true,
|
||||
$ttl
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
}
|
||||
|
@ -4001,13 +3879,8 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
if (! $graphic_type) {
|
||||
if ($config['flash_charts']) {
|
||||
$name = date('H:i:s', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = date('H\h', $bottom);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$name = $bottom;
|
||||
}
|
||||
|
@ -4061,9 +3934,7 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
}else {
|
||||
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
||||
}
|
||||
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
|
||||
} else {
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
$data[$cont]['data'] = 1;
|
||||
|
@ -4082,7 +3953,24 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
$table->data[0][0] = "" ;
|
||||
|
||||
if (!empty($data)) {
|
||||
$slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date);
|
||||
$slicebar = flot_slicesbar_graph(
|
||||
$data,
|
||||
$period,
|
||||
100,
|
||||
30,
|
||||
$full_legend,
|
||||
$colors,
|
||||
$config['fontpath'],
|
||||
$config['round_corner'],
|
||||
$url,
|
||||
'',
|
||||
'',
|
||||
false,
|
||||
0,
|
||||
$full_legend_date,
|
||||
true,
|
||||
1
|
||||
);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
}
|
||||
|
@ -4101,7 +3989,6 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
$table->class = 'noclass';
|
||||
$event_graph = html_print_table($table, true);
|
||||
}
|
||||
|
||||
return $event_graph;
|
||||
}
|
||||
|
||||
|
|
|
@ -468,8 +468,6 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
enterprise_include_once ('meta/include/functions_ui_meta.php');
|
||||
include_graphs_dependencies();
|
||||
|
||||
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||
|
||||
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||
|
@ -483,17 +481,27 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
return;
|
||||
}
|
||||
|
||||
// Get the agent info
|
||||
$agent = db_get_row ("tagente", "id_agente", $id_agente);
|
||||
if ($agent == false) return;
|
||||
|
||||
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) {
|
||||
// Check all groups
|
||||
$groups = agents_get_all_groups_agent($id_agente, $agent["id_grupo"]);
|
||||
if (! check_acl_one_of_groups ($config["id_user"], $groups, "AR") && ! check_acl_one_of_groups ($config["id_user"], $groups, "AW") && !$is_extra) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to access Agent General Information");
|
||||
require_once ("general/noaccess.php");
|
||||
if (!empty($server_data) && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($agent === false) {
|
||||
ui_print_error_message(__('There was a problem loading agent'));
|
||||
if (!empty($server_data) && is_metaconsole()) {
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -522,7 +530,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
$hashdata = $user.$pwd_deserialiced['auth_token'];
|
||||
|
||||
$hashdata = md5($hashdata);
|
||||
$url = $server_data["server_url"] . "/index.php?" .
|
||||
$url = "//" . $server_data["server_url"] . "/index.php?" .
|
||||
"sec=estado&" .
|
||||
"sec2=operation/agentes/ver_agente&" .
|
||||
"id_agente=" . $agent["id_agente"] . "&" .
|
||||
|
@ -608,7 +616,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
|
|||
$go_to_agent = '<div style="text-align: right;">';
|
||||
|
||||
if($agent["id_os"] != 100){
|
||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= '<a target=_blank href="' . "//" . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -855,7 +855,8 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
// Restore the default connection.
|
||||
metaconsole_restore_db();
|
||||
$errors++;
|
||||
break;
|
||||
//break; It does not work in the php7 version remplace for:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -978,7 +979,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
|||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$status = STATUS_ALERT_FIRED;
|
||||
$title = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
$title = __('Alert fired').' '.$alert["internal_counter"].' '.__('time(s)');
|
||||
}
|
||||
elseif ($alert["disabled"] > 0) {
|
||||
$status = STATUS_ALERT_DISABLED;
|
||||
|
@ -1594,15 +1595,8 @@ function ui_process_page_head ($string, $bitfield) {
|
|||
//End load JQuery
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
if ($config['flash_charts']) {
|
||||
//Include the javascript for the js charts library
|
||||
include_once($config["homedir"] . '/include/graphs/functions_flot.php');
|
||||
$output .= include_javascript_dependencies_flot_graph(true);
|
||||
}
|
||||
|
||||
|
||||
$output .= '<!--[if gte IE 6]>
|
||||
<link rel="stylesheet" href="include/styles/ie.css" type="text/css"/>
|
||||
|
@ -1610,7 +1604,6 @@ function ui_process_page_head ($string, $bitfield) {
|
|||
|
||||
$output .= $string;
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
@ -1968,6 +1961,23 @@ function ui_print_help_tip ($text, $return = false, $img = 'images/tip.png', $is
|
|||
echo $output;
|
||||
}
|
||||
|
||||
function ui_print_help_tip_border ($text, $return = false, $img = 'images/tip_border.png', $is_relative = false) {
|
||||
$output =
|
||||
'<a href="javascript:" class="tip" >' .
|
||||
html_print_image (
|
||||
$img,
|
||||
true,
|
||||
array('title' => $text),
|
||||
false,
|
||||
$is_relative && is_metaconsole()
|
||||
) .
|
||||
'</a>';
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Powerful debug function that also shows a backtrace.
|
||||
*
|
||||
|
@ -2144,11 +2154,17 @@ function ui_get_status_images_path () {
|
|||
|
||||
if (strpos ($imageset, ",") === false)
|
||||
$imageset .= ",40x18";
|
||||
list ($imageset, $sizes) = preg_split ("/\,/", $imageset);
|
||||
|
||||
$array_split = preg_split ("/\,/", $imageset);
|
||||
$imageset = $array_split[0];
|
||||
$sizes = $array_split[1];
|
||||
|
||||
if (strpos ($sizes, "x") === false)
|
||||
$sizes .= "x18";
|
||||
list ($imagewidth, $imageheight) = preg_split ("/x/", $sizes);
|
||||
|
||||
$array_split_size = preg_split ("/x/", $sizes);
|
||||
$imagewidth = $array_split_size[0];
|
||||
$imageheight = $array_split_size[1];
|
||||
|
||||
$imagespath = 'images/status_sets/'.$imageset;
|
||||
|
||||
|
@ -2168,7 +2184,8 @@ function ui_get_status_images_path () {
|
|||
*/
|
||||
function ui_print_status_image ($type, $title = "", $return = false, $options = false, $path = false) {
|
||||
if ($path === false) {
|
||||
list ($imagepath) = ui_get_status_images_path ();
|
||||
$imagepath_array = ui_get_status_images_path ();
|
||||
$imagepath = $imagepath_array[0];
|
||||
}
|
||||
else {
|
||||
$imagepath = $path;
|
||||
|
@ -2378,6 +2395,10 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
|
|||
$port = null; // null means 'use the starndard port'
|
||||
$proxy = false; //By default Pandora FMS doesn't run across proxy.
|
||||
|
||||
if(isset ($_SERVER['HTTP_X_FORWARDED_PROTO'])
|
||||
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
}
|
||||
if (isset ($_SERVER['HTTPS'])
|
||||
&& ($_SERVER['HTTPS'] === true
|
||||
|| $_SERVER['HTTPS'] == 'on')) {
|
||||
|
@ -3828,8 +3849,7 @@ function ui_print_module_string_value($value, $id_agente_module,
|
|||
'id_module' => $id_agente_module,
|
||||
'last_data' => $value,
|
||||
'interval' => $current_interval,
|
||||
'module_name' => $module_name,
|
||||
'timestamp' => db_get_value('timestamp', 'tagente_estado', 'id_agente_modulo', $id_agente_module)
|
||||
'module_name' => $module_name
|
||||
));
|
||||
$salida = ui_get_snapshot_image($link, $is_snapshot) . ' ';
|
||||
} else {
|
||||
|
@ -3947,8 +3967,14 @@ function ui_get_snapshot_link($params, $only_params = false) {
|
|||
"id=" . $params['id_module'] .
|
||||
"&label=" . rawurlencode(urlencode(io_safe_output($params['module_name']))).
|
||||
"&id_node=" . $params['id_node'];
|
||||
if ($params['timestamp'] != 0) $url .= "×tamp=" . $parms['timestamp'];
|
||||
if ($params['timestamp'] != 0) $url .= "&refr=" . $parms['interval'];
|
||||
|
||||
if ($params['timestamp'] != 0) {
|
||||
$url .= "×tamp=" . $params['timestamp'];
|
||||
}
|
||||
|
||||
if ($params['interval'] != 0) {
|
||||
$url .= "&refr=" . $params['interval'];
|
||||
}
|
||||
|
||||
// Second parameter of js winopeng_var
|
||||
$win_handle = dechex(crc32('snapshot_' . $params['id_module']));
|
||||
|
|
|
@ -1203,7 +1203,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['label_position']=='left') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1211,7 +1211,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1221,7 +1221,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
elseif($layoutData['label_position']=='right') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1229,7 +1229,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1238,14 +1238,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph(true, $module_data,
|
||||
$img = hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph(true, $module_data,
|
||||
$img = vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1257,7 +1257,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
if ($layoutData['label_position']=='left') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1265,7 +1265,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1275,7 +1275,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
elseif($layoutData['label_position']=='right') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1283,7 +1283,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1292,14 +1292,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
}
|
||||
else {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph(true, $module_data,
|
||||
$img = hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph(true, $module_data,
|
||||
$img = vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -1494,24 +1494,24 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||
else {
|
||||
if ($width == 0 || $height == 0) {
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;width:500px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true);
|
||||
$img = '<div style="width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($layoutData['label_position']=='left') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:left;height:'.$himg.'px;width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
elseif ($layoutData['label_position']=='right') {
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
$img = '<div style="z-index:'.$show_on_top_index.';float:right;height:'.$himg.'px;width:500px;">' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
else {
|
||||
$img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true);
|
||||
$img = '<div style="width:500px;">' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3597,13 +3597,13 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter
|
|||
$retval[$layout['id']] = $layout;
|
||||
|
||||
//add_perms
|
||||
if ($groups[$layout['id_group']]['vconsole_view']){
|
||||
if (isset($groups[$layout['id_group']]['vconsole_view'])){
|
||||
$retval[$layout['id']]['vr'] = $groups[$layout['id_group']]['vconsole_view'];
|
||||
}
|
||||
if ($groups[$layout['id_group']]['vconsole_edit']){
|
||||
if (isset($groups[$layout['id_group']]['vconsole_edit'])){
|
||||
$retval[$layout['id']]['vw'] = $groups[$layout['id_group']]['vconsole_edit'];
|
||||
}
|
||||
if ($groups[$layout['id_group']]['vconsole_management']){
|
||||
if (isset($groups[$layout['id_group']]['vconsole_management'])){
|
||||
$retval[$layout['id']]['vm'] = $groups[$layout['id_group']]['vconsole_management'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -476,20 +476,20 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
$form_items['background_row_2']['items'] = array('background', 'datos');
|
||||
$form_items['background_row_2']['html'] = '<td align="left">' .
|
||||
__('Original Size') . '</td>
|
||||
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . '</td>';
|
||||
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub vs_button_ghost"', true) . '</td>';
|
||||
|
||||
|
||||
$form_items['background_row_3'] = array();
|
||||
$form_items['background_row_3']['items'] = array('background', 'datos');
|
||||
$form_items['background_row_3']['html'] = '<td align="left">' .
|
||||
__('Aspect ratio') . '</td>
|
||||
<td align="left">' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . '</td>';
|
||||
<td align="left">' . html_print_button(__('Proportional Width'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub vs_button_ghost"', true) . '</td>';
|
||||
|
||||
|
||||
$form_items['background_row_4'] = array();
|
||||
$form_items['background_row_4']['items'] = array('background', 'datos');
|
||||
$form_items['background_row_4']['html'] = '<td align="left"></td>
|
||||
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . '</td>';
|
||||
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub vs_button_ghost"', true) . '</td>';
|
||||
|
||||
|
||||
$form_items['percentile_bar_row_1'] = array();
|
||||
|
@ -640,7 +640,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
|
||||
|
||||
foreach ($form_items as $item => $item_options) {
|
||||
echo '<tr id="' . $item . '" style="" class="' . implode(' ', $item_options['items']) . '">';
|
||||
echo '<tr id="' . $item . '" style="" class="' . implode(' ', (array)$item_options['items']) . '">';
|
||||
echo $item_options['html'];
|
||||
echo '</tr>';
|
||||
}
|
||||
|
@ -721,10 +721,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||
|
||||
$node_visual_maps = db_get_all_rows_filter("tlayout", array(), array("id", "name"));
|
||||
|
||||
if(isset($node_visual_maps) && is_array($node_visual_maps)){
|
||||
foreach ($node_visual_maps as $node_visual_map) {
|
||||
$node_visual_map["node_id"] = (int) $server["id"];
|
||||
$visual_maps[] = $node_visual_map;
|
||||
}
|
||||
}
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
|
|
@ -269,7 +269,6 @@ class gettext_reader {
|
|||
|
||||
/**
|
||||
* Translates a string
|
||||
*
|
||||
* @access public
|
||||
* @param string string to be translated
|
||||
* @return string translated string (or original, if not found)
|
||||
|
@ -294,99 +293,6 @@ class gettext_reader {
|
|||
return $this->get_translation_string($num);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get possible plural forms from MO header
|
||||
*
|
||||
* @access private
|
||||
* @return string plural form header
|
||||
*/
|
||||
function get_plural_forms() {
|
||||
// lets assume message number 0 is header
|
||||
// this is true, right?
|
||||
$this->load_tables();
|
||||
|
||||
// cache header field for plural forms
|
||||
if (! is_string($this->pluralheader)) {
|
||||
if ($this->enable_cache) {
|
||||
$header = $this->cache_translations[""];
|
||||
} else {
|
||||
$header = $this->get_translation_string(0);
|
||||
}
|
||||
if (eregi("plural-forms: ([^\n]*)\n", $header, $regs))
|
||||
$expr = $regs[1];
|
||||
else
|
||||
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
|
||||
$this->pluralheader = $expr;
|
||||
}
|
||||
return $this->pluralheader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects which plural form to take
|
||||
*
|
||||
* @access private
|
||||
* @param n count
|
||||
* @return int array index of the right plural form
|
||||
*/
|
||||
function select_string($n) {
|
||||
$string = $this->get_plural_forms();
|
||||
$string = str_replace('nplurals',"\$total",$string);
|
||||
$string = str_replace("n",$n,$string);
|
||||
$string = str_replace('plural',"\$plural",$string);
|
||||
|
||||
$total = 0;
|
||||
$plural = 0;
|
||||
|
||||
eval("$string");
|
||||
if ($plural >= $total) $plural = $total - 1;
|
||||
return $plural;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plural version of gettext
|
||||
*
|
||||
* @access public
|
||||
* @param string single
|
||||
* @param string plural
|
||||
* @param string number
|
||||
* @return translated plural form
|
||||
*/
|
||||
function ngettext($single, $plural, $number) {
|
||||
if ($this->short_circuit) {
|
||||
if ($number != 1)
|
||||
return $plural;
|
||||
else
|
||||
return $single;
|
||||
}
|
||||
|
||||
// find out the appropriate form
|
||||
$select = $this->select_string($number);
|
||||
|
||||
// this should contains all strings separated by NULLs
|
||||
$key = $single.chr(0).$plural;
|
||||
|
||||
|
||||
if ($this->enable_cache) {
|
||||
if (! array_key_exists($key, $this->cache_translations)) {
|
||||
return ($number != 1) ? $plural : $single;
|
||||
} else {
|
||||
$result = $this->cache_translations[$key];
|
||||
$list = explode(chr(0), $result);
|
||||
return $list[$select];
|
||||
}
|
||||
} else {
|
||||
$num = $this->find_string($key);
|
||||
if ($num == -1) {
|
||||
return ($number != 1) ? $plural : $single;
|
||||
} else {
|
||||
$result = $this->get_translation_string($num);
|
||||
$list = explode(chr(0), $result);
|
||||
return $list[$select];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -93,23 +93,6 @@ switch($graph_type) {
|
|||
break;
|
||||
}
|
||||
|
||||
function histogram($chart_data, $width, $height, $font, $max, $title,
|
||||
$mode, $ttl = 1) {
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['font'] = $font;
|
||||
$graph['max'] = $max;
|
||||
$graph['title'] = $title;
|
||||
$graph['mode'] = $mode;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=histogram&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
}
|
||||
|
||||
function progressbar($progress, $width, $height, $title, $font,
|
||||
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
||||
$ttl = 1) {
|
||||
|
@ -134,26 +117,7 @@ function progressbar($progress, $width, $height, $title, $font,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
||||
$font, $round_corner, $home_url = '', $ttl = 1) {
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['period'] = $period;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['font'] = $font;
|
||||
$graph['round_corner'] = $round_corner;
|
||||
$graph['color'] = $colors;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."' style='width:100%;'>";
|
||||
}
|
||||
|
||||
function vbar_graph(
|
||||
$flash_chart,
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
|
@ -180,43 +144,46 @@ function vbar_graph(
|
|||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_vcolumn_chart ($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl, $unit, $water_mark_url,
|
||||
$homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor,
|
||||
$tick_color);
|
||||
}
|
||||
else {
|
||||
$new_chart_data = array();
|
||||
foreach ($chart_data as $key => $value) {
|
||||
if(strlen($key) > 20 && strpos($key, ' - ') !== false){
|
||||
$key_temp = explode(" - ",$key);
|
||||
$key_temp[0] = $key_temp[0]." \n";
|
||||
$key_temp[1]= '...'.substr($key_temp[1],-15);
|
||||
$key2 = $key_temp[0].$key_temp[1];
|
||||
io_safe_output($key2);
|
||||
$new_chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
||||
} else {
|
||||
$new_chart_data[$key] = $value;
|
||||
}
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'chart_data' => $chart_data,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'color' => $color,
|
||||
'legend' => $legend,
|
||||
'long_index' => $long_index,
|
||||
'homeurl' => $homeurl,
|
||||
'unit' => $unit,
|
||||
'water_mark_url' => $water_mark_url,
|
||||
'homedir' => $homedir,
|
||||
'font' => $font,
|
||||
'font_size' => $font_size,
|
||||
'from_ux' => $from_ux,
|
||||
'from_wux' => $from_wux,
|
||||
'backgroundColor' => $backgroundColor,
|
||||
'tick_color' => $tick_color
|
||||
);
|
||||
return generator_chart_to_pdf('vbar', $params);
|
||||
}
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $new_chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
}
|
||||
return flot_vcolumn_chart (
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
$homedir,
|
||||
$font,
|
||||
$font_size,
|
||||
$from_ux,
|
||||
$from_wux,
|
||||
$backgroundColor,
|
||||
$tick_color
|
||||
);
|
||||
}
|
||||
|
||||
function area_graph(
|
||||
|
@ -295,7 +262,7 @@ function stacked_gauge($chart_data, $width, $height,
|
|||
);
|
||||
}
|
||||
|
||||
function hbar_graph($flash_chart, $chart_data, $width, $height,
|
||||
function hbar_graph($chart_data, $width, $height,
|
||||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
|
@ -307,68 +274,39 @@ function hbar_graph($flash_chart, $chart_data, $width, $height,
|
|||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
if ($flash_chart) {
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'chart_data' => $chart_data,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'water_mark_url' => $water_mark_url,
|
||||
'font' => $font,
|
||||
'font_size' => $font_size,
|
||||
'backgroundColor' => $backgroundColor,
|
||||
'tick_color' => $tick_color,
|
||||
'val_min' => $val_min,
|
||||
'val_max' => $val_max
|
||||
);
|
||||
return generator_chart_to_pdf('hbar', $params);
|
||||
}
|
||||
|
||||
return flot_hcolumn_chart(
|
||||
$chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max);
|
||||
}
|
||||
else {
|
||||
foreach ($chart_data as $key => $value) {
|
||||
$str_key = io_safe_output($key);
|
||||
if(strlen($str_key) > 40){
|
||||
if(strpos($str_key, ' - ') != -1){
|
||||
$key_temp = explode(" - ",$str_key);
|
||||
$key_temp[0] = $key_temp[0]." <br>";
|
||||
$key_temp[1]= '...'.substr($key_temp[1],-20);
|
||||
$key2 = $key_temp[0].$key_temp[1];
|
||||
}
|
||||
$chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
||||
unset($chart_data[$key]);
|
||||
}
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$water_mark_url,
|
||||
$font,
|
||||
$font_size,
|
||||
$backgroundColor,
|
||||
$tick_color,
|
||||
$val_min,
|
||||
$val_max
|
||||
);
|
||||
}
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['force_height'] = $force_height;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['force_steps'] = $force_steps;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
}
|
||||
}
|
||||
|
||||
function pie3d_graph($flash_chart, $chart_data, $width, $height,
|
||||
$others_str = "other", $homedir = "", $water_mark = "", $font = '',
|
||||
$font_size = '', $ttl = 1, $legend_position = false, $colors = '',
|
||||
$hide_labels = false) {
|
||||
|
||||
return pie_graph('3d', $flash_chart, $chart_data, $width, $height,
|
||||
$others_str, $homedir, $water_mark, $font, $font_size, $ttl,
|
||||
$legend_position, $colors, $hide_labels);
|
||||
}
|
||||
|
||||
function pie2d_graph($flash_chart, $chart_data, $width, $height,
|
||||
$others_str = "other", $homedir="", $water_mark = "", $font = '',
|
||||
$font_size = '', $ttl = 1, $legend_position = false, $colors = '',
|
||||
$hide_labels = false) {
|
||||
|
||||
return pie_graph('2d', $flash_chart, $chart_data, $width, $height,
|
||||
$others_str, $homedir, $water_mark, $font, $font_size, $ttl,
|
||||
$legend_position, $colors, $hide_labels);
|
||||
}
|
||||
|
||||
function pie_graph($graph_type, $flash_chart, $chart_data, $width,
|
||||
function pie_graph($chart_data, $width,
|
||||
$height, $others_str = "other", $homedir="", $water_mark = "",
|
||||
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
||||
$font = '', $font_size = 8, $ttl = 1, $legend_position = false,
|
||||
$colors = '', $hide_labels = false) {
|
||||
|
||||
if (empty($chart_data)) {
|
||||
|
@ -405,37 +343,38 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width,
|
|||
$chart_data = $chart_data_trunc;
|
||||
}
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_pie_chart(array_values($chart_data),
|
||||
array_keys($chart_data), $width, $height, $water_mark_url,
|
||||
$font, $font_size, $legend_position, $colors, $hide_labels);
|
||||
}
|
||||
else {
|
||||
//TODO SET THE LEGEND POSITION
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['legend_position'] = $legend_position;
|
||||
$graph['color'] = $colors;
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'values' => array_values($chart_data),
|
||||
'keys' => array_keys($chart_data),
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'water_mark_url' => $water_mark_url,
|
||||
'font' => $font,
|
||||
'font_size' => $font_size,
|
||||
'legend_position' => $legend_position,
|
||||
'colors' => $colors,
|
||||
'hide_labels' => $hide_labels
|
||||
);
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
switch ($graph_type) {
|
||||
case "2d":
|
||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie2d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
break;
|
||||
case "3d":
|
||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return generator_chart_to_pdf('pie_chart', $params);
|
||||
}
|
||||
|
||||
function ring_graph($flash_chart, $chart_data, $width,
|
||||
return flot_pie_chart(
|
||||
array_values($chart_data),
|
||||
array_keys($chart_data),
|
||||
$width,
|
||||
$height,
|
||||
$water_mark_url,
|
||||
$font,
|
||||
$font_size,
|
||||
$legend_position,
|
||||
$colors,
|
||||
$hide_labels
|
||||
);
|
||||
}
|
||||
|
||||
function ring_graph($chart_data, $width,
|
||||
$height, $others_str = "other", $homedir="", $water_mark = "",
|
||||
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
||||
$colors = '', $hide_labels = false,$background_color = 'white') {
|
||||
|
@ -449,64 +388,49 @@ function ring_graph($flash_chart, $chart_data, $width,
|
|||
// This library allows only 8 colors
|
||||
$max_values = 18;
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_custom_pie_chart ($flash_chart, $chart_data,
|
||||
$width, $height, $colors, $module_name_list, $long_index,
|
||||
$no_data, false, '', $water_mark, $font, $font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $legend_position,$background_color);
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'chart_data' => $chart_data,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'colors' => $colors,
|
||||
'module_name_list' => $module_name_list,
|
||||
'long_index' => $long_index,
|
||||
'no_data' => $no_data,
|
||||
'water_mark' => $water_mark,
|
||||
'font' => $font,
|
||||
'font_size' => $font_size,
|
||||
'unit' => $unit,
|
||||
'ttl' => $ttl,
|
||||
'homeurl' => $homeurl,
|
||||
'background_color' => $background_color,
|
||||
'legend_position' => $legend_position,
|
||||
'background_color' => $background_color
|
||||
);
|
||||
|
||||
return generator_chart_to_pdf('ring_graph', $params);
|
||||
}
|
||||
else {
|
||||
$total_modules = $chart_data['total_modules'];
|
||||
unset($chart_data['total_modules']);
|
||||
|
||||
$max_values = 9;
|
||||
//Remove the html_entities
|
||||
$n = 0;
|
||||
$temp = array();
|
||||
$coloretes = array();
|
||||
foreach ($chart_data as $key => $value) {
|
||||
if ($n < $max_values) {
|
||||
$temp[io_safe_output($key)] = $value['value'];
|
||||
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
$chart_data = $temp;
|
||||
|
||||
$chart_data_trunc = array();
|
||||
$coloretes = array();
|
||||
$n = 1;
|
||||
//~ foreach ($chart_data as $key => $value) {
|
||||
//~ if ($n < $max_values) {
|
||||
|
||||
//~ $chart_data_trunc[$key] = $value;
|
||||
//~ }
|
||||
//~ else {
|
||||
//~ if (!isset($chart_data_trunc[$others_str])) {
|
||||
//~ $chart_data_trunc[$others_str] = 0;
|
||||
//~ }
|
||||
//~ $chart_data_trunc[$others_str] += $value;
|
||||
//~ }
|
||||
//~ $n++;
|
||||
//~ }
|
||||
//~ $chart_data = $chart_data_trunc;
|
||||
|
||||
//TODO SET THE LEGEND POSITION
|
||||
$graph = array();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
$graph['legend_position'] = $legend_position;
|
||||
$graph['legend'] = $legend;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=ring3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
|
||||
}
|
||||
return flot_custom_pie_chart (
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$colors,
|
||||
$module_name_list,
|
||||
$long_index,
|
||||
$no_data,
|
||||
false,
|
||||
'',
|
||||
$water_mark,
|
||||
$font,
|
||||
$font_size,
|
||||
$unit,
|
||||
$ttl,
|
||||
$homeurl,
|
||||
$background_color,
|
||||
$legend_position,
|
||||
$background_color
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
/*
|
||||
|
||||
|
||||
*/
|
||||
|
||||
function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, water_mark, separator, legend_position, height, colors, hide_labels) {
|
||||
var labels = labels.split(separator);
|
||||
var data = values.split(separator);
|
||||
|
||||
if (colors != '') {
|
||||
colors = colors.split(separator);
|
||||
}
|
||||
|
@ -17,33 +14,9 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
|||
if (colors != '') {
|
||||
color = colors[i];
|
||||
}
|
||||
|
||||
data[i] = { label: labels[i], data: parseFloat(data[i]), color: color}
|
||||
}
|
||||
|
||||
var label_conf;
|
||||
|
||||
if (width < 400 || hide_labels) {
|
||||
label_conf = {
|
||||
show: false
|
||||
};
|
||||
}
|
||||
else {
|
||||
label_conf = {
|
||||
show: true,
|
||||
radius: pieRadius,
|
||||
formatter: function(label, series) {
|
||||
return '<div style="font-size:' + font_size + 'pt;' +
|
||||
'text-align:center;padding:2px;color:white;">' +
|
||||
label + '<br/>' + series.percent.toFixed(2) + '%</div>';
|
||||
},
|
||||
background: {
|
||||
opacity: 0.5,
|
||||
color: ''
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var show_legend = true;
|
||||
if (legend_position == 'hidden') {
|
||||
show_legend = false;
|
||||
|
@ -53,10 +26,7 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
|||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: pieRadius,
|
||||
//offset: {top: -100},
|
||||
label: label_conf,
|
||||
//$label_str
|
||||
radius: pieRadius
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
|
@ -68,9 +38,17 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
|||
}
|
||||
};
|
||||
|
||||
if (width < 400) {
|
||||
conf_pie.legend.labelFormatter = function(label, series) {
|
||||
return label + " (" + series.percent.toFixed(2) + "%)";
|
||||
if(hide_labels != false && hide_labels != 0){
|
||||
conf_pie.series.pie.label = {
|
||||
show: true,
|
||||
radius: 2/3,
|
||||
formatter: labelFormatter,
|
||||
threshold: 0.1
|
||||
}
|
||||
}
|
||||
else{
|
||||
conf_pie.series.pie.label = {
|
||||
show:false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,14 +84,18 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat
|
|||
legends.eq(index).css('color', '');
|
||||
}
|
||||
|
||||
function labelFormatter(label, series) {
|
||||
return '<div style="font-size:' + font_size + 'pt;' + 'text-align:center;padding:2px;color:white;">' +
|
||||
label + '<br/>' + series.percent.toFixed(2) + '%</div>';
|
||||
}
|
||||
|
||||
// Reset styles
|
||||
function resetInteractivity() {
|
||||
legends.css('color', '#3F3F3D');
|
||||
}
|
||||
|
||||
if (water_mark) {
|
||||
set_watermark(graph_id, plot,
|
||||
$('#watermark_image_' + graph_id).attr('src'));
|
||||
set_watermark(graph_id, plot,$('#watermark_image_' + graph_id).attr('src'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -687,16 +669,21 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||
}
|
||||
}
|
||||
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent, full_legend) {
|
||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick,
|
||||
font, font_size, separator, separator2, id_agent, full_legend, not_interactive) {
|
||||
|
||||
values = values.split(separator2);
|
||||
labels = labels.split(separator);
|
||||
legend = legend.split(separator);
|
||||
acumulate_data = acumulate_data.split(separator);
|
||||
datacolor = datacolor.split(separator);
|
||||
|
||||
if (full_legend != false) {
|
||||
full_legend = full_legend.split(separator);
|
||||
}
|
||||
|
||||
var font_size = parseInt(font_size);
|
||||
var font = font.split("/").pop().split(".").shift();
|
||||
// Check possible adapt_keys on classes
|
||||
check_adaptions(graph_id);
|
||||
|
||||
|
@ -704,6 +691,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
|
||||
for (i=0;i<values.length;i++) {
|
||||
var serie = values[i].split(separator);
|
||||
|
||||
var aux = new Array();
|
||||
$.each(serie,function(i,v) {
|
||||
aux.push([v, i]);
|
||||
|
@ -711,34 +699,43 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
|
||||
datas.push({
|
||||
data: aux,
|
||||
bars: { show: true, fill: true ,fillColor: datacolor[i] , horizontal: true, lineWidth:0, steps:false }
|
||||
bars: {
|
||||
show: true,
|
||||
fill: 1,
|
||||
fillColor: { colors: [ { opacity: 1 }, { opacity: 1 } ] },
|
||||
lineWidth:0,
|
||||
horizontal: true,
|
||||
steps:false,
|
||||
barWidth: 24 * 60 * 60 * 600
|
||||
},
|
||||
color:datacolor[i]
|
||||
});
|
||||
}
|
||||
|
||||
var stack = 0, bars = true, lines = false, steps = false;
|
||||
|
||||
var regex = /visual_console/;
|
||||
var match = regex.exec(window.location.href);
|
||||
|
||||
if (match == null) {
|
||||
var options = {
|
||||
series: {
|
||||
stack: stack,
|
||||
shadowSize: 0.1,
|
||||
color: '#ddd'
|
||||
stack: true,
|
||||
bars:{
|
||||
align: 'center'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
hoverable: true,
|
||||
clickable: true,
|
||||
borderWidth:1,
|
||||
borderColor: '',
|
||||
borderColor: '#C1C1C1',
|
||||
tickColor: '#fff'
|
||||
},
|
||||
xaxes: [ {
|
||||
tickFormatter: xFormatter,
|
||||
color: '',
|
||||
tickSize: intervaltick,
|
||||
tickLength: 0
|
||||
tickLength: 0,
|
||||
font: {
|
||||
size: font_size + 2,
|
||||
family: font+'Font'
|
||||
}
|
||||
} ],
|
||||
yaxes: [ {
|
||||
show: false,
|
||||
|
@ -748,38 +745,17 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
if (match == null && not_interactive == 0) {
|
||||
options.grid['hoverable'] = true;
|
||||
options.grid['clickable'] = true;
|
||||
}
|
||||
else{
|
||||
var options = {
|
||||
series: {
|
||||
stack: stack,
|
||||
shadowSize: 0.1,
|
||||
color: '#ddd'
|
||||
},
|
||||
grid: {
|
||||
hoverable: false,
|
||||
clickable: false,
|
||||
borderWidth:1,
|
||||
borderColor: '',
|
||||
tickColor: '#fff'
|
||||
},
|
||||
xaxes: [ {
|
||||
tickFormatter: xFormatter,
|
||||
color: '',
|
||||
tickSize: intervaltick,
|
||||
tickLength: 0
|
||||
} ],
|
||||
yaxes: [ {
|
||||
show: false,
|
||||
tickLength: 0
|
||||
}],
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
options.grid['hoverable'] = false;
|
||||
options.grid['clickable'] = false;
|
||||
}
|
||||
|
||||
var plot = $.plot($('#'+graph_id), datas, options );
|
||||
$.plot($('#'+graph_id), datas, options );
|
||||
|
||||
if (match == null) {
|
||||
// Events
|
||||
|
@ -849,12 +825,10 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||
|
||||
// Format functions
|
||||
function xFormatter(v, axis) {
|
||||
for (i = 0; i < acumulate_data.length; i++) {
|
||||
if (acumulate_data[i] == v) {
|
||||
return '<span style=\'font-size: 6pt\'>' + legend[i] + '</span>';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
v = new Date(1000*v);
|
||||
date_format = (v.getHours()<10?'0':'') + v.getHours() + ":" +
|
||||
(v.getMinutes()<10?'0':'') + v.getMinutes();
|
||||
return date_format;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2269,10 +2243,18 @@ function pandoraFlotArea( graph_id, values, legend,
|
|||
$('#overview_' + graph_id).toggle();
|
||||
});
|
||||
|
||||
$("#menu_export_csv_"+graph_id)
|
||||
.click(function (event) {
|
||||
event.preventDefault();
|
||||
$("#menu_export_csv_"+graph_id).click(function (e) {
|
||||
e.preventDefault();
|
||||
plot.exportDataCSV();
|
||||
var es_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
if(es_firefox){
|
||||
$("#dialog").css('visibility', 'visible').dialog();
|
||||
}
|
||||
delete data_base[0].threshold;
|
||||
plot = $.plot($('#' + graph_id), data_base,
|
||||
$.extend(true, {}, options, {
|
||||
legend: { show: true }
|
||||
}));
|
||||
});
|
||||
|
||||
$('#menu_threshold_' + graph_id).click(function() {
|
||||
|
@ -2508,7 +2490,6 @@ function update_left_width_canvas(graph_id) {
|
|||
|
||||
function check_adaptions(graph_id) {
|
||||
var classes = $('#'+graph_id).attr('class').split(' ');
|
||||
|
||||
$.each(classes, function(i,v) {
|
||||
// If has a class starting with adapted, we adapt it
|
||||
if (v.split('_')[0] == 'adapted') {
|
||||
|
|
|
@ -421,7 +421,7 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
|||
}
|
||||
|
||||
// Prints a FLOT pie chart
|
||||
function flot_custom_pie_chart ($flash_charts, $graph_values,
|
||||
function flot_custom_pie_chart ($graph_values,
|
||||
$width, $height, $colors, $module_name_list, $long_index,
|
||||
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
||||
|
@ -684,12 +684,39 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||
return $return;
|
||||
}
|
||||
|
||||
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) {
|
||||
function flot_slicesbar_graph (
|
||||
$graph_data, $period, $width,
|
||||
$height, $legend, $colors, $fontpath,
|
||||
$round_corner, $homeurl, $watermark = '',
|
||||
$adapt_key = '', $stat_win = false,
|
||||
$id_agent = 0, $full_legend_date = array(),
|
||||
$not_interactive = 0, $ttl = 1,
|
||||
$widgets = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
// include_javascript_dependencies_flot_graph();
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'graph_data' => $graph_data,
|
||||
'period' => $period,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'legend' => $legend,
|
||||
'colors' => $colors,
|
||||
'fontpath' => $fontpath,
|
||||
'round_corner' => $round_corner,
|
||||
'homeurl' => $homeurl,
|
||||
'watermark' => $watermark = '',
|
||||
'adapt_key' => $adapt_key = '',
|
||||
'stat_win' => $stat_win = false,
|
||||
'id_agent' => $id_agent = 0,
|
||||
'full_legend_date' => $full_legend_date = array(),
|
||||
'not_interactive' => $not_interactive = 0,
|
||||
'ttl' => $ttl = 1
|
||||
);
|
||||
|
||||
$stacked_str = 'stack: stack,';
|
||||
return generator_chart_to_pdf('slicebar', $params);
|
||||
}
|
||||
|
||||
// Get a unique identifier to graph
|
||||
$graph_id = uniqid('graph_');
|
||||
|
@ -698,9 +725,15 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
if ($stat_win) {
|
||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px; display: inline-block;'></div>";
|
||||
}
|
||||
else {
|
||||
if($widgets){
|
||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."px; height: ".$height."px;'></div>";
|
||||
}
|
||||
else{
|
||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px;'></div>";
|
||||
}
|
||||
}
|
||||
|
||||
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
||||
|
||||
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
||||
|
@ -720,14 +753,8 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
|
||||
$intervaltick = $period / $i;
|
||||
|
||||
$leg_max_length = 0;
|
||||
foreach ($legend as $l) {
|
||||
if (strlen($l) > $leg_max_length) {
|
||||
$leg_max_length = strlen($l);
|
||||
}
|
||||
}
|
||||
|
||||
$fontsize = 7;
|
||||
$fontsize = $config['font_size'];
|
||||
$fontpath = $config['fontpath'];
|
||||
|
||||
$extra_height = 15;
|
||||
if (defined("METACONSOLE"))
|
||||
|
@ -735,9 +762,10 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
|
||||
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
||||
|
||||
$maxticks = (int) ($width / ($fontsize * $leg_max_length));
|
||||
$maxticks = (int) 20;
|
||||
|
||||
$i_aux = $i;
|
||||
|
||||
while(1) {
|
||||
if ($i_aux <= $maxticks ) {
|
||||
break;
|
||||
|
@ -749,6 +777,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
}
|
||||
|
||||
$intervaltick = (int) $intervaltick;
|
||||
|
||||
$acumulate = 0;
|
||||
$c = 0;
|
||||
$acumulate_data = array();
|
||||
|
@ -777,8 +806,11 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
// Store serialized data to use it from javascript
|
||||
$labels = implode($separator,$labels);
|
||||
$datacolor = implode($separator,$datacolor);
|
||||
if(is_array($legend)){
|
||||
$legend = io_safe_output(implode($separator,$legend));
|
||||
if (!empty($full_legend_date)) {
|
||||
}
|
||||
|
||||
if (!empty($full_legend_date) && count($full_legend_date) > 0 ) {
|
||||
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
|
||||
}
|
||||
else {
|
||||
|
@ -807,7 +839,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$return .= "//<![CDATA[\n";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent, '$full_legend_date')";
|
||||
$return .= "pandoraFlotSlicebar('$graph_id','$values','$datacolor','$labels','$legend','$acumulate_data',$intervaltick,'$fontpath',$fontsize,'$separator','$separator2',$id_agent,'$full_legend_date',$not_interactive)";
|
||||
$return .= "\n//]]>";
|
||||
$return .= "</script>";
|
||||
|
||||
|
|
|
@ -1,966 +0,0 @@
|
|||
<?php
|
||||
|
||||
ob_start(); //HACK TO EAT ANYTHING THAT CORRUPS THE IMAGE FILE
|
||||
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
include_once('functions_utils.php');
|
||||
include_once('../functions_io.php');
|
||||
include_once('../functions.php');
|
||||
include_once('../functions_html.php');
|
||||
|
||||
/* pChart library inclusions */
|
||||
include_once("pChart/pData.class.php");
|
||||
include_once("pChart/pDraw.class.php");
|
||||
include_once("pChart/pImage.class.php");
|
||||
include_once("pChart/pPie.class.php");
|
||||
include_once("pChart/pScatter.class.php");
|
||||
include_once("pChart/pRadar.class.php");
|
||||
|
||||
// Define default fine colors
|
||||
|
||||
$default_fine_colors = array();
|
||||
$default_fine_colors[] = "#2222FF";
|
||||
$default_fine_colors[] = "#00DD00";
|
||||
$default_fine_colors[] = "#CC0033";
|
||||
$default_fine_colors[] = "#9900CC";
|
||||
$default_fine_colors[] = "#FFCC66";
|
||||
$default_fine_colors[] = "#999999";
|
||||
|
||||
// Default values
|
||||
|
||||
$antialiasing = true;
|
||||
$font = '../fonts/unicode.ttf';
|
||||
$xaxisname = '';
|
||||
$yaxisname = '';
|
||||
$legend = null;
|
||||
$colors = null;
|
||||
$font_size = 8;
|
||||
$force_steps = true;
|
||||
$legend_position = null;
|
||||
$series_type = null;
|
||||
|
||||
|
||||
$graph_type = get_parameter('graph_type', '');
|
||||
|
||||
$id_graph = get_parameter('id_graph', false);
|
||||
|
||||
$graph_threshold = get_parameter('graph_threshold', false);
|
||||
|
||||
$id_module = get_parameter('id_module');
|
||||
|
||||
|
||||
if (!$id_graph) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ttl = get_parameter('ttl', 1);
|
||||
|
||||
$graph = unserialize_in_temp($id_graph, true, $ttl);
|
||||
|
||||
if (!$graph) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = $graph['data'];
|
||||
$width = $graph['width'];
|
||||
$height = $graph['height'];
|
||||
|
||||
if (isset($graph['legend_position'])) {
|
||||
$legend_position = $graph['legend_position'];
|
||||
}
|
||||
if (isset($graph['color'])) {
|
||||
$colors = $graph['color'];
|
||||
}
|
||||
if (isset($graph['legend'])) {
|
||||
$legend = $graph['legend'];
|
||||
}
|
||||
if (isset($graph['xaxisname'])) {
|
||||
$xaxisname = $graph['xaxisname'];
|
||||
}
|
||||
if (isset($graph['yaxisname'])) {
|
||||
$yaxisname = $graph['yaxisname'];
|
||||
}
|
||||
if (isset($graph['round_corner'])) {
|
||||
$round_corner = $graph['round_corner'];
|
||||
}
|
||||
if (isset($graph['font'])) {
|
||||
if (!empty($graph['font'])) {
|
||||
$font = $graph['font'];
|
||||
}
|
||||
}
|
||||
if (isset($graph['font_size'])) {
|
||||
if (!empty($graph['font_size'])) {
|
||||
$font_size = $graph['font_size'];
|
||||
}
|
||||
}
|
||||
if (isset($graph['backgroundColor'])) {
|
||||
if (!empty($graph['backgroundColor'])) {
|
||||
$backgroundColor = $graph['backgroundColor'];
|
||||
}
|
||||
}
|
||||
if (isset($graph['antialiasing'])) {
|
||||
$antialiasing = $graph['antialiasing'];
|
||||
}
|
||||
$force_height = true;
|
||||
if (isset($graph['force_height'])) {
|
||||
$force_height = $graph['force_height'];
|
||||
}
|
||||
if (isset($graph['period'])) {
|
||||
$period = $graph['period'];
|
||||
}
|
||||
if (isset($graph['unit'])){
|
||||
$unit = $graph['unit'];
|
||||
}
|
||||
|
||||
if (!$force_height) {
|
||||
if ($height < (count($graph['data']) * 14)) {
|
||||
$height = (count($graph['data']) * 14);
|
||||
}
|
||||
}
|
||||
|
||||
$water_mark = '';
|
||||
if (isset($graph['water_mark'])) {
|
||||
//"/var/www/pandora_console/images/logo_vertical_water.png";
|
||||
$water_mark = $graph['water_mark'];
|
||||
}
|
||||
|
||||
if (isset($graph['force_steps'])) {
|
||||
$force_steps = $graph['force_steps'];
|
||||
}
|
||||
|
||||
if (isset($graph['series_type'])) {
|
||||
$series_type = $graph['series_type'];
|
||||
}
|
||||
|
||||
if (isset($graph['percentil'])){
|
||||
$percentil = $graph['percentil'];
|
||||
}
|
||||
|
||||
$step = 1;
|
||||
if ($force_steps) {
|
||||
$pixels_between_xdata = 50;
|
||||
$max_xdata_display = round($width / $pixels_between_xdata);
|
||||
$ndata = count($data);
|
||||
if ($max_xdata_display > $ndata) {
|
||||
$xdata_display = $ndata;
|
||||
}
|
||||
else {
|
||||
$xdata_display = $max_xdata_display;
|
||||
}
|
||||
|
||||
$step = round($ndata/$xdata_display);
|
||||
}
|
||||
|
||||
$c = 1;
|
||||
|
||||
switch ($graph_type) {
|
||||
case 'hbar':
|
||||
case 'vbar':
|
||||
foreach ($data as $i => $values) {
|
||||
foreach ($values as $name => $val) {
|
||||
$data_values[$name][] = $val;
|
||||
}
|
||||
|
||||
$data_keys[] = $i;
|
||||
|
||||
}
|
||||
$fine_colors = array();
|
||||
|
||||
// If is set fine colors we store it or set default
|
||||
|
||||
foreach ($colors as $i => $fine_color) {
|
||||
$rgb_fine = html_html2rgb($fine_color);
|
||||
$fine_colors[$i]['R'] = $rgb_fine[0];
|
||||
$fine_colors[$i]['G'] = $rgb_fine[1];
|
||||
$fine_colors[$i]['B'] = $rgb_fine[2];
|
||||
$fine_colors[$i]['Alpha'] = 100;
|
||||
}
|
||||
$colors = $fine_colors;
|
||||
|
||||
break;
|
||||
case 'bullet_chart':
|
||||
$anterior = 0;
|
||||
foreach ($data as $i => $values) {
|
||||
foreach ($values as $key => $val) {
|
||||
switch ($key) {
|
||||
case 0:
|
||||
$name = __("Max");
|
||||
break;
|
||||
case 1:
|
||||
$name = __("Actual");
|
||||
break;
|
||||
case 2:
|
||||
$name = __("Min");
|
||||
break;
|
||||
}
|
||||
$data_values[$name][] = ($val - $anterior);
|
||||
$anterior += (($val - $anterior)<0) ? 0 : ($val - $anterior);
|
||||
}
|
||||
$anterior = 0;
|
||||
$data_keys[] = $i;
|
||||
|
||||
}
|
||||
break;
|
||||
case 'progress':
|
||||
case 'area':
|
||||
case 'stacked_area':
|
||||
case 'stacked_line':
|
||||
case 'line':
|
||||
case 'threshold':
|
||||
case 'scatter':
|
||||
|
||||
if (!empty($percentil)) {
|
||||
$count_percentil = count($percentil);
|
||||
for ($j=0; $j < $count_percentil; $j++) {
|
||||
$i=0;
|
||||
foreach ($data as $key => $value) {
|
||||
$data[$key]['percentil' . $j] = $percentil[$j][$i];
|
||||
if($graph_type == 'area'){
|
||||
$series_type['percentil' . $j] = 'line';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($data as $i => $d) {
|
||||
$data_values[] = $d;
|
||||
|
||||
if (($c % $step) == 0) {
|
||||
$data_keys[] = $i;
|
||||
}
|
||||
else {
|
||||
$data_keys[] = "";
|
||||
}
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'slicebar':
|
||||
case 'polar':
|
||||
case 'radar':
|
||||
case 'pie3d':
|
||||
case 'pie2d':
|
||||
case 'ring3d':
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
switch($graph_type) {
|
||||
case 'slicebar':
|
||||
case 'polar':
|
||||
case 'radar':
|
||||
case 'pie3d':
|
||||
case 'pie2d':
|
||||
case 'ring3d':
|
||||
case 'bullet_chart':
|
||||
break;
|
||||
default:
|
||||
if (!is_array(reset($data_values))) {
|
||||
$data_values = array($data_values);
|
||||
if (is_array($colors) && !empty($colors)) {
|
||||
$colors = array($colors);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$rgb_color = array();
|
||||
|
||||
if (!isset($colors))
|
||||
$colors = array();
|
||||
|
||||
if (empty($colors)) {
|
||||
$colors = array();
|
||||
}
|
||||
|
||||
foreach ($colors as $i => $color) {
|
||||
if (isset ($color['border'])) {
|
||||
$rgb['border'] = html_html2rgb($color['border']);
|
||||
|
||||
if (isset($rgb['border'])) {
|
||||
$rgb_color[$i]['border']['R'] = $rgb['border'][0];
|
||||
$rgb_color[$i]['border']['G'] = $rgb['border'][1];
|
||||
$rgb_color[$i]['border']['B'] = $rgb['border'][2];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset ($color['color'])) {
|
||||
$rgb['color'] = html_html2rgb($color['color']);
|
||||
|
||||
if (isset($rgb['color'])) {
|
||||
$rgb_color[$i]['color']['R'] = $rgb['color'][0];
|
||||
$rgb_color[$i]['color']['G'] = $rgb['color'][1];
|
||||
$rgb_color[$i]['color']['B'] = $rgb['color'][2];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset ($color['alpha'])) {
|
||||
$rgb_color[$i]['alpha'] = $color['alpha'];
|
||||
}
|
||||
}
|
||||
|
||||
//add color for percentil
|
||||
if($percentil){
|
||||
for ($j=0; $j < $count_percentil; $j++) {
|
||||
if (isset ($colors[$j]['border'])) {
|
||||
$rgb['border'] = html_html2rgb($colors[$j]['border']);
|
||||
|
||||
if (isset($rgb['border'])) {
|
||||
$rgb_color['percentil' . $j]['border']['R'] = $rgb['border'][0];
|
||||
$rgb_color['percentil' . $j]['border']['G'] = $rgb['border'][1];
|
||||
$rgb_color['percentil' . $j]['border']['B'] = $rgb['border'][2];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset ($colors[$j]['color'])) {
|
||||
$rgb['color'] = html_html2rgb($colors[$j]['color']);
|
||||
|
||||
if (isset($rgb['color'])) {
|
||||
$rgb_color['percentil' . $j]['color']['R'] = $rgb['color'][0];
|
||||
$rgb_color['percentil' . $j]['color']['G'] = $rgb['color'][1];
|
||||
$rgb_color['percentil' . $j]['color']['B'] = $rgb['color'][2];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset ($colors[$j]['alpha'])) {
|
||||
$rgb_color['percentil' . $j]['alpha'] = $colors[$j]['alpha'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//add for report with max 15 modules comparation repeat
|
||||
$countlegend = count($legend);
|
||||
if($countlegend > 15){
|
||||
$i=16;
|
||||
$l=0;
|
||||
while ($countlegend > 15){
|
||||
$rgb_color[$i] = $rgb_color[$l];
|
||||
$l++;
|
||||
$i++;
|
||||
$countlegend--;
|
||||
}
|
||||
}
|
||||
|
||||
ob_get_clean(); //HACK TO EAT ANYTHING THAT CORRUPS THE IMAGE FILE
|
||||
|
||||
switch ($graph_type) {
|
||||
case 'ring3d':
|
||||
pch_ring_graph($graph_type, array_values($data), $legend,
|
||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors);
|
||||
break;
|
||||
case 'bullet_chart':
|
||||
pch_bullet_chart($graph_type, $data_values, $legend,
|
||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors);
|
||||
break;
|
||||
case 'pie3d':
|
||||
case 'pie2d':
|
||||
pch_pie_graph($graph_type, array_values($data), array_keys($data),
|
||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors);
|
||||
break;
|
||||
case 'slicebar':
|
||||
pch_slicebar_graph($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size);
|
||||
break;
|
||||
case 'polar':
|
||||
case 'radar':
|
||||
pch_kiviat_graph($graph_type, array_values($data), array_keys($data),
|
||||
$width, $height, $font, $font_size);
|
||||
break;
|
||||
case 'hbar':
|
||||
case 'vbar':
|
||||
pch_bar_graph($graph_type, $data_keys, $data_values, $width, $height,
|
||||
$font, $antialiasing, $rgb_color, $xaxisname, $yaxisname, false,
|
||||
$legend, $fine_colors, $water_mark, $font_size);
|
||||
break;
|
||||
default:
|
||||
case 'threshold':
|
||||
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
|
||||
$height, $font, $antialiasing, $xaxisname, $yaxisname, $title,
|
||||
$font_size);
|
||||
break;
|
||||
}
|
||||
|
||||
function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size) {
|
||||
/* CAT:Slicebar charts */
|
||||
|
||||
set_time_limit (0);
|
||||
|
||||
// Dataset definition
|
||||
$myPicture = new pImage($width,$height);
|
||||
|
||||
/* Turn of Antialiasing */
|
||||
$myPicture->Antialias = 0;
|
||||
|
||||
$myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
||||
|
||||
// Round corners defined in global setup
|
||||
if ($round_corner != 0)
|
||||
$radius = ($height > 18) ? 8 : 0;
|
||||
else
|
||||
$radius = 0;
|
||||
|
||||
$thinest_slice = $width / $period;
|
||||
|
||||
/* Color stuff */
|
||||
$colorsrgb = array();
|
||||
foreach($colors as $key => $col) {
|
||||
$rgb = html_html2rgb($col);
|
||||
$colorsrgb[$key]['R'] = $rgb[0];
|
||||
$colorsrgb[$key]['G'] = $rgb[1];
|
||||
$colorsrgb[$key]['B'] = $rgb[2];
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
foreach ($data as $d) {
|
||||
$color = $d['data'];
|
||||
$color = $colorsrgb[$color];
|
||||
$ratio = $thinest_slice * $d['utimestamp'];
|
||||
$myPicture->drawRoundedFilledRectangle ($i, 0, $ratio+$i,
|
||||
$height, $radius,
|
||||
array('R' => $color['R'],
|
||||
'G' => $color['G'],
|
||||
'B' => $color['B'])
|
||||
);
|
||||
$i+=$ratio;
|
||||
}
|
||||
|
||||
if ($round_corner) {
|
||||
/* Under this value, the rounded rectangle is painted great */
|
||||
if ($thinest_slice <= 16) {
|
||||
/* Clean a bit of pixels */
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$myPicture->drawLine (0, $i, 6 - $i, $i, array('R' => 255, 'G' => 255, 'B' => 255));
|
||||
}
|
||||
$end = $height - 1;
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$myPicture->drawLine (0, $end - $i, 5 - $i, $end - $i, array('R' => 255, 'G' => 255, 'B' => 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$myPicture->drawRoundedRectangle (0, 0, $width,
|
||||
$height - 1, $radius, array('R' => 157, 'G' => 157, 'B' => 157));
|
||||
|
||||
$myPicture->Stroke ();
|
||||
}
|
||||
|
||||
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
|
||||
$height, $font, $water_mark, $font_size, $legend_position, $colors) {
|
||||
/* CAT:Pie charts */
|
||||
|
||||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
$MyData->addPoints($data_values,"ScoreA");
|
||||
$MyData->setSerieDescription("ScoreA","Application A");
|
||||
|
||||
/* Define the absissa serie */
|
||||
$MyData->addPoints($legend_values,"Labels");
|
||||
$MyData->setAbscissa("Labels");
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage($width,$height,$MyData,TRUE);
|
||||
|
||||
/* Set the default font properties */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
||||
|
||||
$water_mark_height = 0;
|
||||
$water_mark_width = 0;
|
||||
if (!empty($water_mark)) {
|
||||
if (is_array($water_mark)) {
|
||||
if (!empty($water_mark['file'])) {
|
||||
$water_mark = $water_mark['file'];
|
||||
}
|
||||
}
|
||||
|
||||
$size_water_mark = getimagesize($water_mark);
|
||||
$water_mark_height = $size_water_mark[1];
|
||||
$water_mark_width = $size_water_mark[0];
|
||||
|
||||
$myPicture->drawFromPNG(($width - $water_mark_width),
|
||||
($height - $water_mark_height) - 50, $water_mark);
|
||||
}
|
||||
|
||||
|
||||
/* Create the pPie object */
|
||||
$PieChart = new pPie($myPicture,$MyData);
|
||||
foreach ($legend_values as $key => $value) {
|
||||
if (isset($colors[$value])) {
|
||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$value]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw an AA pie chart */
|
||||
switch($graph_type) {
|
||||
case "pie2d":
|
||||
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
|
||||
break;
|
||||
case "pie3d":
|
||||
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>5,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE, "SecondPass"=>FALSE));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Write down the legend next to the 2nd chart*/
|
||||
//Calculate the bottom margin from the size of string in each index
|
||||
$max_chars = graph_get_max_index($legend_values);
|
||||
|
||||
if ($legend_position != 'hidden') {
|
||||
// This is a hardcore adjustment to match most of the graphs, please don't alter
|
||||
$legend_with_aprox = 32 + (9.5 * $max_chars);
|
||||
|
||||
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
|
||||
}
|
||||
|
||||
/* Enable shadow computing */
|
||||
$myPicture->setShadow(TRUE,
|
||||
array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
|
||||
function pch_ring_graph ($graph_type, $data_values, $legend_values, $width,
|
||||
$height, $font, $water_mark, $font_size, $legend_position, $colors) {
|
||||
/* CAT:Ring charts */
|
||||
|
||||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
$MyData->addPoints($data_values,"ScoreA");
|
||||
$MyData->setSerieDescription("ScoreA","Application A");
|
||||
|
||||
/* Define the absissa serie */
|
||||
$MyData->addPoints($legend_values,"Labels");
|
||||
$MyData->setAbscissa("Labels");
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage($width,$height,$MyData,TRUE);
|
||||
|
||||
/* Set the default font properties */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
||||
|
||||
$water_mark_height = 0;
|
||||
$water_mark_width = 0;
|
||||
if (!empty($water_mark)) {
|
||||
if (is_array($water_mark)) {
|
||||
if (!empty($water_mark['file'])) {
|
||||
$water_mark = $water_mark['file'];
|
||||
}
|
||||
}
|
||||
|
||||
$size_water_mark = getimagesize($water_mark);
|
||||
$water_mark_height = $size_water_mark[1];
|
||||
$water_mark_width = $size_water_mark[0];
|
||||
|
||||
$myPicture->drawFromPNG(($width - $water_mark_width),
|
||||
($height - $water_mark_height) - 50, $water_mark);
|
||||
}
|
||||
|
||||
|
||||
/* Create the pPie object */
|
||||
$PieChart = new pPie($myPicture,$MyData);
|
||||
foreach ($legend_values as $key => $value) {
|
||||
if (isset($colors[$value])) {
|
||||
$PieChart->setSliceColor($key, hex_2_rgb($colors[$value]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw an AA pie chart */
|
||||
$PieChart->draw3DRing($width/3, $height/2,array("InnerRadius"=>100, "InnerRadius"=>10,"DrawLabels"=>TRUE,"LabelStacked"=>FALSE,"Precision"=>2,"Border"=>FALSE,"WriteValues"=>TRUE,"ValueR"=>0,"ValueG"=>0,"ValueB"=>0,"ValuePadding" => 15));
|
||||
|
||||
|
||||
/* Write down the legend next to the 2nd chart*/
|
||||
//Calculate the bottom margin from the size of string in each index
|
||||
$max_chars = graph_get_max_index($legend_values);
|
||||
|
||||
if ($legend_position != 'hidden') {
|
||||
// This is a hardcore adjustment to match most of the graphs, please don't alter
|
||||
$legend_with_aprox = 150 + (4.5 * $max_chars);
|
||||
|
||||
$PieChart->drawPieLegend($width - $legend_with_aprox, 10, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
|
||||
}
|
||||
|
||||
/* Enable shadow computing */
|
||||
$myPicture->setShadow(TRUE,
|
||||
array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
|
||||
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width,
|
||||
$height, $font, $font_size) {
|
||||
/* CAT:Radar/Polar charts */
|
||||
|
||||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
$MyData->addPoints($data_values,"ScoreA");
|
||||
$MyData->setSerieDescription("ScoreA","Application A");
|
||||
|
||||
/* Define the absissa serie */
|
||||
$MyData->addPoints($legend_values,"Labels");
|
||||
$MyData->setAbscissa("Labels");
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage($width,$height,$MyData,TRUE);
|
||||
|
||||
/* Set the default font properties */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
|
||||
|
||||
/* Create the pRadar object */
|
||||
$SplitChart = new pRadar();
|
||||
|
||||
/* Draw a radar chart */
|
||||
$myPicture->setGraphArea(20,25,$width-10,$height-10);
|
||||
|
||||
/* Draw an AA pie chart */
|
||||
switch($graph_type) {
|
||||
case "radar":
|
||||
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL,
|
||||
"LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,
|
||||
"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,
|
||||
"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
|
||||
"FontName"=>$font,"FontSize"=>$font_size);
|
||||
$SplitChart->drawRadar($myPicture,$MyData,$Options);
|
||||
break;
|
||||
case "polar":
|
||||
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
|
||||
"FontName"=>$font,"FontSize"=>$font_size);
|
||||
$SplitChart->drawRadar($myPicture,$MyData,$Options);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
|
||||
function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
|
||||
$antialiasing, $rgb_color = false, $xaxisname = "", $yaxisname = "",
|
||||
$show_values = false, $legend = array(), $fine_colors = array(), $water_mark = '', $font_size) {
|
||||
/* CAT: Vertical Bar Chart */
|
||||
if (!is_array($legend) || empty($legend)) {
|
||||
unset($legend);
|
||||
}
|
||||
|
||||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
$overridePalette = array();
|
||||
foreach ($data as $i => $values) {
|
||||
$MyData->addPoints($values,$i);
|
||||
|
||||
if (!empty($rgb_color)) {
|
||||
$MyData->setPalette($i,
|
||||
array("R" => $rgb_color[$i]['color']["R"],
|
||||
"G" => $rgb_color[$i]['color']["G"],
|
||||
"B" => $rgb_color[$i]['color']["B"],
|
||||
"BorderR" => $rgb_color[$i]['border']["R"],
|
||||
"BorderG" => $rgb_color[$i]['border']["G"],
|
||||
"BorderB" => $rgb_color[$i]['border']["B"],
|
||||
"Alpha" => $rgb_color[$i]['alpha']));
|
||||
}
|
||||
|
||||
// Assign cyclic colors to bars if are setted
|
||||
if ($fine_colors) {
|
||||
$c = 0;
|
||||
foreach ($values as $ii => $vv) {
|
||||
if (!isset($fine_colors[$c])) {
|
||||
$c = 0;
|
||||
}
|
||||
$overridePalette[$ii] = $fine_colors[$c];
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$overridePalette = false;
|
||||
}
|
||||
}
|
||||
|
||||
$MyData->setAxisName(0,$yaxisname);
|
||||
$MyData->addPoints($index,"Xaxis");
|
||||
$MyData->setSerieDescription("Xaxis", $xaxisname);
|
||||
$MyData->setAbscissa("Xaxis");
|
||||
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage($width,$height,$MyData);
|
||||
|
||||
|
||||
|
||||
/* Turn of Antialiasing */
|
||||
$myPicture->Antialias = $antialiasing;
|
||||
|
||||
/* Add a border to the picture */
|
||||
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
|
||||
|
||||
/* Turn on shadow computing */
|
||||
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>120,"G"=>120,"B"=>120,"Alpha"=>10));
|
||||
|
||||
$pdf = get_parameter('pdf',false);
|
||||
|
||||
if($pdf == true){
|
||||
$font_size = $font_size+1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Set the default font */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
||||
|
||||
/* Draw the scale */
|
||||
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
|
||||
// TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px
|
||||
|
||||
//Calculate the top margin from the size of string in each index
|
||||
$max_chars = graph_get_max_index($index);
|
||||
$margin_top = 10 * $max_chars;
|
||||
|
||||
switch($graph_type) {
|
||||
case "vbar":
|
||||
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE,
|
||||
"GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
|
||||
"Mode"=>SCALE_MODE_START0, "LabelRotation" => 45);
|
||||
$margin_left = 40+50;
|
||||
$margin_right = 90;
|
||||
$margin_top = 10;
|
||||
$margin_bottom = (3 * $max_chars)+80;
|
||||
break;
|
||||
case "hbar":
|
||||
$scaleSettings = array("GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE,
|
||||
"CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM,
|
||||
"LabelValuesRotation" => 30);
|
||||
$margin_left = $font_size * $max_chars;
|
||||
$margin_right = 15;
|
||||
$margin_top = 40;
|
||||
$margin_bottom = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Define the chart area */
|
||||
$myPicture->setGraphArea($margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom);
|
||||
|
||||
$myPicture->drawScale($scaleSettings);
|
||||
|
||||
/* Turn on shadow computing */
|
||||
$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||
|
||||
|
||||
/* Draw the chart */
|
||||
$settings = array("ForceTransparency"=>"-1", "Gradient"=>FALSE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette);
|
||||
|
||||
/* goes through a series of colors and assigns them to the bars, when it ends it starts from the beginning */
|
||||
|
||||
for ($i=0,$j=1; $i < count($settings['OverrideColors']); $i++) {
|
||||
|
||||
switch ($j) {
|
||||
case 1:
|
||||
$settings['OverrideColors'][$i]['R'] = 43;
|
||||
$settings['OverrideColors'][$i]['G'] = 98;
|
||||
$settings['OverrideColors'][$i]['B'] = 201;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$settings['OverrideColors'][$i]['R'] = 243;
|
||||
$settings['OverrideColors'][$i]['G'] = 86;
|
||||
$settings['OverrideColors'][$i]['B'] = 157;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$settings['OverrideColors'][$i]['R'] = 191;
|
||||
$settings['OverrideColors'][$i]['G'] = 191;
|
||||
$settings['OverrideColors'][$i]['B'] = 191;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$settings['OverrideColors'][$i]['R'] = 251;
|
||||
$settings['OverrideColors'][$i]['G'] = 183;
|
||||
$settings['OverrideColors'][$i]['B'] = 50;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
$settings['OverrideColors'][$i]['R'] = 157;
|
||||
$settings['OverrideColors'][$i]['G'] = 117;
|
||||
$settings['OverrideColors'][$i]['B'] = 177;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$settings['OverrideColors'][$i]['R'] = 39;
|
||||
$settings['OverrideColors'][$i]['G'] = 172;
|
||||
$settings['OverrideColors'][$i]['B'] = 151;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
$settings['OverrideColors'][$i]['R'] = 171;
|
||||
$settings['OverrideColors'][$i]['G'] = 42;
|
||||
$settings['OverrideColors'][$i]['B'] = 46;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
$settings['OverrideColors'][$i]['R'] = 185;
|
||||
$settings['OverrideColors'][$i]['G'] = 218;
|
||||
$settings['OverrideColors'][$i]['B'] = 87;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
$settings['OverrideColors'][$i]['R'] = 60;
|
||||
$settings['OverrideColors'][$i]['G'] = 182;
|
||||
$settings['OverrideColors'][$i]['B'] = 203;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$settings['OverrideColors'][$i]['R'] = 105;
|
||||
$settings['OverrideColors'][$i]['G'] = 65;
|
||||
$settings['OverrideColors'][$i]['B'] = 179;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
$settings['OverrideColors'][$i]['R'] = 228;
|
||||
$settings['OverrideColors'][$i]['G'] = 35;
|
||||
$settings['OverrideColors'][$i]['B'] = 102;
|
||||
$j++;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
$settings['OverrideColors'][$i]['R'] = 252;
|
||||
$settings['OverrideColors'][$i]['G'] = 130;
|
||||
$settings['OverrideColors'][$i]['B'] = 53;
|
||||
$j = 1;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$myPicture->drawBarChart($settings);
|
||||
|
||||
// Paint the water mark at the last moment to show it in front
|
||||
if (!empty($water_mark)) {
|
||||
$size_water_mark = getimagesize($water_mark);
|
||||
$water_mark_width = $size_water_mark[0];
|
||||
|
||||
$myPicture->drawFromPNG(($width - $water_mark_width - $margin_right),
|
||||
$margin_top, $water_mark);
|
||||
}
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
|
||||
function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font,
|
||||
$antialiasing, $xaxisname = "", $yaxisname = "", $title = "",
|
||||
$show_values = false, $show_legend = false, $font_size) {
|
||||
/* CAT:Threshold Chart */
|
||||
|
||||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
$MyData->addPoints($data,"DEFCA");
|
||||
$MyData->setAxisName(0,$yaxisname);
|
||||
$MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY);
|
||||
$MyData->addPoints($index,"Labels");
|
||||
$MyData->setSerieDescription("Labels",$xaxisname);
|
||||
$MyData->setAbscissa("Labels");
|
||||
$MyData->setPalette("DEFCA",array("R"=>55,"G"=>91,"B"=>127));
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage(700,230,$MyData);
|
||||
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>220,"StartG"=>220,"StartB"=>220,"EndR"=>255,"EndG"=>255,"EndB"=>255,"Alpha"=>100));
|
||||
$myPicture->drawRectangle(0,0,699,229,array("R"=>200,"G"=>200,"B"=>200));
|
||||
|
||||
/* Write the picture title */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
||||
$myPicture->drawText(60,35,$title,array("FontSize"=>$font_size,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
|
||||
|
||||
/* Do some cosmetic and draw the chart */
|
||||
$myPicture->setGraphArea(60,40,670,190);
|
||||
$myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
|
||||
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0));
|
||||
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
||||
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
|
||||
$myPicture->drawSplineChart($settings);
|
||||
$myPicture->setShadow(FALSE);
|
||||
|
||||
if ($show_legend) {
|
||||
/* Write the chart legend */
|
||||
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
||||
}
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
|
||||
function pch_bullet_chart($graph_type, $data, $legend,
|
||||
$width, $height, $font, $water_mark, $font_size, $legend_position, $colors) {
|
||||
|
||||
|
||||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
|
||||
foreach ($data as $key => $dat) {
|
||||
$MyData->addPoints($dat, $key);
|
||||
}
|
||||
$MyData->setPalette(__("Min"),array("R"=>55,"G"=>91,"B"=>127));
|
||||
$MyData->setPalette(__("Actual"),array("R"=>70,"G"=>130,"B"=>180));
|
||||
$MyData->setPalette(__("Max"),array("R"=>221,"G"=>221,"B"=>221));
|
||||
|
||||
$MyData->addPoints($legend,"Labels");
|
||||
|
||||
|
||||
$MyData->setAbscissa("Labels");
|
||||
$MyData->setSerieDescription("Labels", __("Agents/Modules"));
|
||||
|
||||
$height_t = ($height * count($data) ) + 40;
|
||||
$height_t = $height;
|
||||
$max_chars = graph_get_max_index($legend);
|
||||
$width_t = ($width + ( 100 + $max_chars));
|
||||
|
||||
/* Create the pChart object */
|
||||
$myPicture = new pImage($width_t, $height_t,$MyData);
|
||||
|
||||
/* Write the picture title */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
||||
|
||||
/* Write the chart title */
|
||||
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
|
||||
|
||||
$height_t - 10;
|
||||
/* Draw the scale and chart */
|
||||
$myPicture->setGraphArea(250,20,($width + 100), $height_t);
|
||||
$myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM, "Mode"=>SCALE_MODE_ADDALL_START0,
|
||||
"LabelingMethod"=>LABELING_DIFFERENT, "GridR"=>255, "GridG"=>255,
|
||||
"GridB"=>255, "GridAlpha"=>50, "TickR"=>0,"TickG"=>0, "TickB"=>0,
|
||||
"TickAlpha"=>50, "LabelRotation"=>0, "CycleBackground"=>1,
|
||||
"DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255,
|
||||
"SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50,
|
||||
"DrawYLines"=>ALL));
|
||||
$myPicture->drawStackedBarChart(array("MODE"=>SCALE_MODE_START0));
|
||||
|
||||
/* Write the chart legend */
|
||||
//$myPicture->drawLegend(0,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
|
||||
|
||||
/* Render the picture */
|
||||
$myPicture->stroke();
|
||||
}
|
||||
?>
|
|
@ -1,107 +0,0 @@
|
|||
0;32;11011001100
|
||||
1;33;11001101100
|
||||
2;34;11001100110
|
||||
3;35;10010011000
|
||||
4;36;10010001100
|
||||
5;37;10001001100
|
||||
6;38;10011001000
|
||||
7;39;10011000100
|
||||
8;40;10001100100
|
||||
9;41;11001001000
|
||||
10;42;11001000100
|
||||
11;43;11000100100
|
||||
12;44;10110011100
|
||||
13;45;10011011100
|
||||
14;46;10011001110
|
||||
15;47;10111001100
|
||||
16;48;10011101100
|
||||
17;49;10011100110
|
||||
18;50;11001110010
|
||||
19;51;11001011100
|
||||
20;52;11001001110
|
||||
21;53;11011100100
|
||||
22;54;11001110100
|
||||
23;55;11101101110
|
||||
24;56;11101001100
|
||||
25;57;11100101100
|
||||
26;58;11100100110
|
||||
27;59;11101100100
|
||||
28;60;11100110100
|
||||
29;61;11100110010
|
||||
30;62;11011011000
|
||||
31;63;11011000110
|
||||
32;64;11000110110
|
||||
33;65;10100011000
|
||||
34;66;10001011000
|
||||
35;67;10001000110
|
||||
36;68;10110001000
|
||||
37;69;10001101000
|
||||
38;70;10001100010
|
||||
39;71;11010001000
|
||||
40;72;11000101000
|
||||
41;73;11000100010
|
||||
42;74;10110111000
|
||||
43;75;10110001110
|
||||
44;76;10001101110
|
||||
45;77;10111011000
|
||||
46;78;10111000110
|
||||
47;79;10001110110
|
||||
48;80;11101110110
|
||||
49;81;11010001110
|
||||
50;82;11000101110
|
||||
51;83;11011101000
|
||||
52;84;11011100010
|
||||
53;85;11011101110
|
||||
54;86;11101011000
|
||||
55;87;11101000110
|
||||
56;88;11100010110
|
||||
57;89;11101101000
|
||||
58;90;11101100010
|
||||
59;91;11100011010
|
||||
60;92;11101111010
|
||||
61;93;11001000010
|
||||
62;94;11110001010
|
||||
63;95;10100110000
|
||||
64;96;10100001100
|
||||
65;97;10010110000
|
||||
66;98;10010000110
|
||||
67;99;10000101100
|
||||
68;100;10000100110
|
||||
69;101;10110010000
|
||||
70;102;10110000100
|
||||
71;103;10011010000
|
||||
72;104;10011000010
|
||||
73;105;10000110100
|
||||
74;106;10000110010
|
||||
75;107;11000010010
|
||||
76;108;11001010000
|
||||
77;109;11110111010
|
||||
78;110;11000010100
|
||||
79;111;10001111010
|
||||
80;112;10100111100
|
||||
81;113;10010111100
|
||||
82;114;10010011110
|
||||
83;115;10111100100
|
||||
84;116;10011110100
|
||||
85;117;10011110010
|
||||
86;118;11110100100
|
||||
87;119;11110010100
|
||||
88;120;11110010010
|
||||
89;121;11011011110
|
||||
90;122;11011110110
|
||||
91;123;11110110110
|
||||
92;124;10101111000
|
||||
93;125;10100011110
|
||||
94;126;10001011110
|
||||
95;200;10111101000
|
||||
96;201;10111100010
|
||||
97;202;11110101000
|
||||
98;203;11110100010
|
||||
99;204;10111011110
|
||||
100;205;10111101110
|
||||
101;206;11101011110
|
||||
102;207;11110101110
|
||||
103;208;11010000100
|
||||
104;209;11010010000
|
||||
105;210;11010011100
|
||||
106;211;1100011101011
|
|
@ -1,44 +0,0 @@
|
|||
0;101001101101
|
||||
1;110100101011
|
||||
2;101100101011
|
||||
3;110110010101
|
||||
4;101001101011
|
||||
5;110100110101
|
||||
6;101100110101
|
||||
7;101001011011
|
||||
8;110100101101
|
||||
9;101100101101
|
||||
A;110101001011
|
||||
B;101101001011
|
||||
C;110110100101
|
||||
D;101011001011
|
||||
E;110101100101
|
||||
F;101101100101
|
||||
G;101010011011
|
||||
H;110101001101
|
||||
I;101101001101
|
||||
J;101011001101
|
||||
K;110101010011
|
||||
L;101101010011
|
||||
M;110110101001
|
||||
N;101011010011
|
||||
O;110101101001
|
||||
P;101101101001
|
||||
Q;101010110011
|
||||
R;110101011001
|
||||
S;101101011001
|
||||
T;101011011001
|
||||
U;110010101011
|
||||
V;100110101011
|
||||
W;110011010101
|
||||
X;100101101011
|
||||
Y;110010110101
|
||||
Z;100110110101
|
||||
-;100101011011
|
||||
.;110010101101
|
||||
;100110101101
|
||||
$;100100100101
|
||||
/;100100101001
|
||||
+;100101001001
|
||||
%;101001001001
|
||||
*;100101101101
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue