diff --git a/extras/android-event-viewer/.idea/misc.xml b/extras/android-event-viewer/.idea/misc.xml index 38041c7cc6..a4aaf9f97e 100644 --- a/extras/android-event-viewer/.idea/misc.xml +++ b/extras/android-event-viewer/.idea/misc.xml @@ -1,8 +1,5 @@ - - - - - - - - - - - - - - + diff --git a/extras/android-event-viewer/app/build.gradle b/extras/android-event-viewer/app/build.gradle index 92924f93b3..d9a280d817 100644 --- a/extras/android-event-viewer/app/build.gradle +++ b/extras/android-event-viewer/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 8 - buildToolsVersion "25.0.2" + buildToolsVersion "26.0.2" defaultConfig { applicationId "pandroid_event_viewer.pandorafms" diff --git a/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/EventList.java b/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/EventList.java index 15ca771bad..b208855e0b 100644 --- a/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/EventList.java +++ b/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/EventList.java @@ -159,8 +159,14 @@ public class EventList extends ListActivity { } }); - - + ImageButton btnSettings = (ImageButton) findViewById(R.id.settings_icon_button_list); + // Open the settings + btnSettings.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + startActivity(new Intent(v.getContext(), Options.class)); + } + }); + registerReceiver(onBroadcast, new IntentFilter("eventlist.java")); this.toggleLoadingLayout(); diff --git a/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/Main.java b/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/Main.java index 6ab57371e9..2548b8023b 100644 --- a/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/Main.java +++ b/extras/android-event-viewer/app/src/main/java/pandroid_event_viewer/pandorafms/Main.java @@ -96,10 +96,29 @@ public class Main extends Activity { Activity.MODE_PRIVATE); setContentView(R.layout.main); + final ImageButton btnSettings = (ImageButton) findViewById(R.id.settings_icon_button_main); + final ImageButton btnFilter = (ImageButton) findViewById(R.id.filter_icon_button_main); final Button buttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher); final ImageButton buttonSearch = (ImageButton) findViewById(R.id.refresh_icon_button_main); final ImageButton buttonDeleteProfile = (ImageButton) findViewById(R.id.button_delete_profile); final ImageButton buttonSaveProfile = (ImageButton) findViewById(R.id.button_save_profile); + + // Open the settings + btnSettings.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + startActivity(new Intent(v.getContext(), Options.class)); + } + }); + + // Go to the events list + btnFilter.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + Activity a = (Activity) v.getContext(); + TabActivity ta = (TabActivity) a.getParent(); + ta.getTabHost().setCurrentTab(1); + } + }); + // Check if the user preferences it is set. if (object.user.length() == 0 || object.password.length() == 0 || object.url.length() == 0) { diff --git a/extras/android-event-viewer/app/src/main/res/layout/list_view_layout.xml b/extras/android-event-viewer/app/src/main/res/layout/list_view_layout.xml index 9b32dfe1dc..b0135b4489 100644 --- a/extras/android-event-viewer/app/src/main/res/layout/list_view_layout.xml +++ b/extras/android-event-viewer/app/src/main/res/layout/list_view_layout.xml @@ -63,8 +63,22 @@ android:layout_weight="0" android:padding="0dp" android:src="@drawable/filter_icon_button" + android:background="@null" /> + + + + + android:tint="@android:color/white" + android:src="@android:drawable/ic_menu_preferences" /> + + + + + + /dev/null diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index 723b17232c..d7647191a4 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.716, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index 8a8ecd3451..2625ca7542 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, FreeBSD Version +# Version 7.0NG.716, FreeBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index f31d7e6cd0..2387412e15 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, HP-UX Version +# Version 7.0NG.716, HP-UX Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 59ea7ed59d..da5c2b2c18 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.716, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf index ee6b7bb18d..a0717d889e 100644 --- a/pandora_agents/unix/NT4/pandora_agent.conf +++ b/pandora_agents/unix/NT4/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, GNU/Linux +# Version 7.0NG.716, GNU/Linux # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index aa64beba39..0cc5dc41cc 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, NetBSD Version +# Version 7.0NG.716, NetBSD Version # Licensed under GPL license v2, # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index 3dada142de..ac8ece9b0c 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -1,5 +1,5 @@ # Base config file for Pandora FMS agents -# Version 7.0NG.714, Solaris Version +# Version 7.0NG.716, Solaris Version # Licensed under GPL license v2, # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # http://www.pandorafms.com diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 1baa741ddd..7ee9868b87 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -40,8 +40,8 @@ my $Sem = undef; # Semaphore used to control the number of threads my $ThreadSem = undef; -use constant AGENT_VERSION => '7.0NG.714'; -use constant AGENT_BUILD => '171026'; +use constant AGENT_VERSION => '7.0NG.716'; +use constant AGENT_BUILD => '171129'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -1244,7 +1244,11 @@ sub check_collections () { # Delete old collections if there are no broker agents if ($BrokerEnabled == 0) { - opendir (DIR, "$ConfDir/collections") || return; + if(!opendir (DIR, "$ConfDir/collections")){ + log_message ('Collection', "Could not open dir $ConfDir/collections"); + return; + } + while (defined (my $file_name = readdir(DIR))) { next if ($file_name eq '.' || $file_name eq '..'); @@ -1252,8 +1256,14 @@ sub check_collections () { $file_name =~ s/\.md5$//; if (! defined ($Collections{$file_name})) { - rmrf ("$ConfDir/collections/$file_name"); - unlink ("$ConfDir/collections/$file_name.md5"); + if(opendir (DIR_check, "$ConfDir/collections/$file_name")){ + closedir (DIR_check); + rmrf ("$ConfDir/collections/$file_name"); + unlink ("$ConfDir/collections/$file_name.md5"); + } + else { + log_message ('Collection', "Could not open dir $ConfDir/collections/$file_name"); + } } } closedir (DIR); @@ -1272,7 +1282,11 @@ sub check_collections () { # Get remote md5 error ("File '$Conf{'temporal'}/$collection_md5_file' already exists as a symlink and could not be removed: $!.") if (-l "$Conf{'temporal'}/$collection_md5_file" && !unlink("$Conf{'temporal'}/$collection_md5_file")); - next unless (recv_file ($collection_md5_file, $Conf{'server_path_md5'}) == 0); + if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){ + log_message ('Collection', "Could not write $collection_md5_file on " . $Conf{'server_path_md5'}); + next; + } + open (MD5_FILE, "< $Conf{'temporal'}/$collection_md5_file") || error ("Could not open file '$Conf{'temporal'}/$collection_md5_file' for reading: $!."); my $remote_collection_md5 = ; close (MD5_FILE); @@ -1284,13 +1298,20 @@ sub check_collections () { $local_collection_md5 = ; close MD5_FILE; } + else{ + log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file"); + next; + } # Check for changes $local_collection_md5 = $remote_collection_md5 unless defined ($local_collection_md5); next if ($local_collection_md5 eq $remote_collection_md5); # Download and unzip - next unless (recv_file ($collection_file, $Conf{'server_path_zip'}) == 0); + if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){ + log_message ('Collection', "Could not write $collection_file on " . $Conf{'server_path_zip'}); + next; + } rmrf ("$ConfDir/collections/$collection"); `unzip -d "$ConfDir/collections/$collection" "$Conf{'temporal'}/$collection_file" 2>$DevNull`; unlink ("$Conf{'temporal'}/$collection_file"); diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index d5e904b50b..45bf73aa6f 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.714 -%define release 171026 +%define version 7.0NG.716 +%define release 171129 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index c42622d2fa..f73c761f4e 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -2,8 +2,8 @@ #Pandora FMS Linux Agent # %define name pandorafms_agent_unix -%define version 7.0NG.714 -%define release 171026 +%define version 7.0NG.716 +%define release 171129 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 8aabf312e2..bd1033168b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -9,8 +9,8 @@ # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION="7.0NG.714" -PI_BUILD="171026" +PI_VERSION="7.0NG.716" +PI_BUILD="171129" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/route_parser b/pandora_agents/unix/plugins/route_parser new file mode 100644 index 0000000000..40cfcea36f --- /dev/null +++ b/pandora_agents/unix/plugins/route_parser @@ -0,0 +1,780 @@ +#!/usr/bin/perl +# +# Dynamic route parser +# Combines MTR and Ping features +# +# + +use strict; +use warnings; +use POSIX qw(strftime); +use Scalar::Util qw(looks_like_number); +use Socket; + +my $HELP=< 1 } @{$array}; + if (exists($params{$value})) { + return 1; + } + return 0; +} + +################################################################################ +# Check if a given variable contents a number +################################################################################ +sub to_number($) { + my $n = shift; + + if(empty($n)) { + return undef; + } + + if ($n =~ /[\d+,]*\d+\.\d+/) { + # American notation + $n =~ s/,//g; + } + elsif ($n =~ /[\d+\.]*\d+,\d+/) { + # Spanish notation + $n =~ s/\.//g; + $n =~ s/,/./g; + } + if(looks_like_number($n)) { + return $n; + } + return undef; +} + +################################################################################ +# Erase blank spaces before and after the string +################################################################################ +sub trim($){ + my $string = shift; + if (empty ($string)){ + return ""; + } + + $string =~ s/\r//g; + + chomp ($string); + $string =~ s/^\s+//g; + $string =~ s/\s+$//g; + + return $string; +} + +################################################################################ +# Empty +################################################################################ +sub empty($){ + my $str = shift; + + if (! (defined ($str)) ){ + return 1; + } + + if(looks_like_number($str)){ + return 0; + } + + if (ref ($str) eq "ARRAY") { + return (($#{$str}<0)?1:0); + } + + if (ref ($str) eq "HASH") { + my @tmp = keys %{$str}; + return (($#tmp<0)?1:0); + } + + if ($str =~ /^\ *[\n\r]{0,2}\ *$/) { + return 1; + } + return 0; +} + +################################################################################ +# is Enabled +################################################################################ +sub is_enabled($){ + my $value = shift; + + if ((defined ($value)) && ($value > 0)){ + # return true + return 1; + } + #return false + return 0; + +} + +################################################################################ +# print_module +################################################################################ +sub print_module ($$;$){ + my $config = shift; + my $data = shift; + my $not_print_flag = shift; + + if ((ref($data) ne "HASH") || (!defined $data->{name})) { + return undef; + } + + my $xml_module = ""; + # If not a string type, remove all blank spaces! + if ($data->{type} !~ m/string/){ + $data->{value} = trim($data->{value}); + } + + $data->{tags} = $data->{tags}?$data->{tags}:($config->{MODULE_TAG_LIST}?$config->{MODULE_TAG_LIST}:undef); + $data->{interval} = $data->{interval}?$data->{interval}:($config->{MODULE_INTERVAL}?$config->{MODULE_INTERVAL}:undef); + $data->{module_group} = $data->{module_group}?$data->{module_group}:($config->{MODULE_GROUP}?$config->{MODULE_GROUP}:undef); + + # Global instructions (if defined) + $data->{unknown_instructions} = $config->{unknown_instructions} unless (defined($data->{unknown_instructions}) || (!defined($config->{unknown_instructions}))); + $data->{warning_instructions} = $config->{warning_instructions} unless (defined($data->{warning_instructions}) || (!defined($config->{warning_instructions}))); + $data->{critical_instructions} = $config->{critical_instructions} unless (defined($data->{critical_instructions}) || (!defined($config->{critical_instructions}))); + + $xml_module .= "\n"; + $xml_module .= "\t{name} . "]]>\n"; + $xml_module .= "\t" . $data->{type} . "\n"; + + if (ref ($data->{value}) eq "ARRAY") { + $xml_module .= "\t\n"; + foreach (@{$data->{value}}) { + $xml_module .= "\t{value} . "]]>\n"; + } + $xml_module .= "\t\n"; + } + else { + $xml_module .= "\t{value} . "]]>\n"; + } + + if ( !(empty($data->{desc}))) { + $xml_module .= "\t{desc} . "]]>\n"; + } + if ( !(empty ($data->{unit})) ) { + $xml_module .= "\t{unit} . "]]>\n"; + } + if (! (empty($data->{interval})) ) { + $xml_module .= "\t{interval} . "]]>\n"; + } + if (! (empty($data->{tags})) ) { + $xml_module .= "\t" . $data->{tags} . "\n"; + } + if (! (empty($data->{module_group})) ) { + $xml_module .= "\t" . $data->{module_group} . "\n"; + } + if (! (empty($data->{module_parent})) ) { + $xml_module .= "\t" . $data->{module_parent} . "\n"; + } + if (! (empty($data->{wmin})) ) { + $xml_module .= "\t{wmin} . "]]>\n"; + } + if (! (empty($data->{wmax})) ) { + $xml_module .= "\t{wmax} . "]]>\n"; + } + if (! (empty ($data->{cmin})) ) { + $xml_module .= "\t{cmin} . "]]>\n"; + } + if (! (empty ($data->{cmax})) ){ + $xml_module .= "\t{cmax} . "]]>\n"; + } + if (! (empty ($data->{wstr}))) { + $xml_module .= "\t{wstr} . "]]>\n"; + } + if (! (empty ($data->{cstr}))) { + $xml_module .= "\t{cstr} . "]]>\n"; + } + if (! (empty ($data->{cinv}))) { + $xml_module .= "\t{cinv} . "]]>\n"; + } + if (! (empty ($data->{winv}))) { + $xml_module .= "\t{winv} . "]]>\n"; + } + if (! (empty ($data->{max}))) { + $xml_module .= "\t{max} . "]]>\n"; + } + if (! (empty ($data->{min}))) { + $xml_module .= "\t{min} . "]]>\n"; + } + if (! (empty ($data->{post_process}))) { + $xml_module .= "\t{post_process} . "]]>\n"; + } + if (! (empty ($data->{disabled}))) { + $xml_module .= "\t{disabled} . "]]>\n"; + } + if (! (empty ($data->{min_ff_event}))) { + $xml_module .= "\t{min_ff_event} . "]]>\n"; + } + if (! (empty ($data->{status}))) { + $xml_module .= "\t{status} . "]]>\n"; + } + if (! (empty ($data->{timestamp}))) { + $xml_module .= "\t{timestamp} . "]]>\n"; + } + if (! (empty ($data->{custom_id}))) { + $xml_module .= "\t{custom_id} . "]]>\n"; + } + if (! (empty ($data->{critical_instructions}))) { + $xml_module .= "\t{critical_instructions} . "]]>\n"; + } + if (! (empty ($data->{warning_instructions}))) { + $xml_module .= "\t{warning_instructions} . "]]>\n"; + } + if (! (empty ($data->{unknown_instructions}))) { + $xml_module .= "\t{unknown_instructions} . "]]>\n"; + } + if (! (empty ($data->{quiet}))) { + $xml_module .= "\t{quiet} . "]]>\n"; + } + if (! (empty ($data->{module_ff_interval}))) { + $xml_module .= "\t{module_ff_interval} . "]]>\n"; + } + if (! (empty ($data->{crontab}))) { + $xml_module .= "\t{crontab} . "]]>\n"; + } + if (! (empty ($data->{min_ff_event_normal}))) { + $xml_module .= "\t{min_ff_event_normal} . "]]>\n"; + } + if (! (empty ($data->{min_ff_event_warning}))) { + $xml_module .= "\t{min_ff_event_warning} . "]]>\n"; + } + if (! (empty ($data->{min_ff_event_critical}))) { + $xml_module .= "\t{min_ff_event_critical} . "]]>\n"; + } + if (! (empty ($data->{ff_timeout}))) { + $xml_module .= "\t{ff_timeout} . "]]>\n"; + } + if (! (empty ($data->{each_ff}))) { + $xml_module .= "\t{each_ff} . "]]>\n"; + } + if (! (empty ($data->{parent_unlink}))) { + $xml_module .= "\t{parent_unlink} . "]]>\n"; + } + if (! (empty ($data->{alerts}))) { + foreach my $alert (@{$data->{alerts}}){ + $xml_module .= "\t\n"; + } + } + if (defined ($config->{global_alerts})){ + foreach my $alert (@{$config->{global_alerts}}){ + $xml_module .= "\t\n"; + } + } + + $xml_module .= "\n"; + + if (empty ($not_print_flag)) { + print $xml_module; + } + + return $xml_module; +} + +################################################################################ +# General arguments parser +################################################################################ +sub parse_arguments($) { + my $raw = shift; + my @args; + if (defined($raw)){ + @args = @{$raw}; + } + else { + return {}; + } + + my %data; + for (my $i = 0; $i < $#args; $i+=2) { + my $key = trim($args[$i]); + + $key =~ s/^-//; + $data{$key} = trim($args[$i+1]); + } + + return \%data; + +} + +################################################################################ +# General configuration file parser +# +# log=/PATH/TO/LOG/FILE +# +################################################################################ +sub parse_configuration($;$$){ + my $conf_file = shift; + my $separator; + $separator = shift or $separator = "="; + my $custom_eval = shift; + my $_CFILE; + + my $_config; + + if (empty($conf_file)) { + return { + error => "Configuration file not specified" + }; + } + + if( !open ($_CFILE,"<", "$conf_file")) { + return { + error => "Cannot open configuration file" + }; + } + + while (my $line = <$_CFILE>){ + if (($line =~ /^ *\r*\n*$/) + || ($line =~ /^#/ )){ + # skip blank lines and comments + next; + } + my @parsed = split /$separator/, $line, 2; + if ($line =~ /^\s*global_alerts/){ + push (@{$_config->{global_alerts}}, trim($parsed[1])); + next; + } + if (ref ($custom_eval) eq "ARRAY") { + my $f = 0; + foreach my $item (@{$custom_eval}) { + if ($line =~ /$item->{exp}/) { + $f = 1; + my $aux; + eval { + $aux = $item->{target}->($item->{exp},$line); + }; + + if (empty($_config)) { + $_config = $aux; + } + elsif (!empty($aux) && (ref ($aux) eq "HASH")) { + $_config = merge_hashes($_config, $aux); + } + } + } + + if (is_enabled($f)){ + next; + } + } + $_config->{trim($parsed[0])} = trim($parsed[1]); + } + close ($_CFILE); + + return $_config; +} + +################################################################################ +# End of import +################################################################################ + + +########################################################################## +# Show a message to STDERR +########################################################################## +sub msg { + my $msg = shift; + print STDERR strftime ("%Y-%m-%d %H:%M:%S", localtime()) . ": $msg\n"; +} + + +sub get_next { + my ($route, $step) = @_; + return $route->{'next'}->{$step}; +} + +########################################################################## +# Extract route steps & timming from mtr output +########################################################################## +sub get_steps { + my ($conf) = @_; + my $target = $conf->{'t'}; + + return [] if empty($target); + + my $mtr_r = ""; + my $ping_r = ""; + + my @route_raw; + my @ping_raw; + + + if ($^O =~ /win/i){ + $ping_r = trim(`ping -r 9 $target -n 1 | tr "Routea:->-" " " | gawk "/^[0-9\. ]*\$/ {if (\$1 != \\"\\"){ print \$1\";\"0}}"`) unless is_enabled($conf->{'-no-ping'}); + + @ping_raw = split /\n/, $ping_r; + + if ($#ping_raw < 0) { + $mtr_r = trim(`mtr -n -o A -c $conf->{'c'} -r $target 2>/NUL | gawk "{print \$2";"\$3}"`) unless is_enabled($conf->{'-no-mtr'}); + } + } + else { + $ping_r = trim(`for x in \$(ping -n -c 1 -R $target 2>/dev/null | tr -s "R:" " " | awk '/^[0-9\. \t]*\$/ {if (\$1 != ""){print \$1}}'); do echo -n \$x";"; ping -c $conf->{'c'} \$x 2>/dev/null | grep rtt |awk '{print \$4}'| cut -f2 -d"/"; done`) unless is_enabled($conf->{'-no-ping'}); + + @ping_raw = split /\n/, $ping_r; + + if ($#ping_raw < 0) { + $mtr_r = trim(`mtr -n -c $conf->{'c'} -r $target -o A 2>/dev/null | awk '/^[0-9\\|\\-\\. \\t]*\$/ {print \$2\";\"\$3}'`) unless is_enabled($conf->{'-no-mtr'}); + } + + } + + @route_raw = split /\n/, $mtr_r; + + my @modules; + my @steps; + my $route; + + if ($#ping_raw >= 0) { + # PING mode + + my $rng = scalar @ping_raw; + my $checked; + my $j; + + if (is_enabled($conf->{'s'})) { + # Symmetric routing + + if ($^O =~ /win/i){ + $j = 1; + } + else { + $j = 0; + } + + for (my $i=0; $i< ($rng/2); $i++) { + my ($step,$time) = split /;/, $ping_raw[$i]; + my $_r; + + if (defined($checked->{$step})) { + $j-=2; + next; + } + $checked->{$step} = 1; + + $_r->{'step'} = $step; + if ($^O =~ /win/i) { + $_r->{'time'} = trim(`ping -n $conf->{'c'} $_r->{'step'} | grep -e "Av" -e "Me" | gawk "{print \$NF}" | tr -d "ms"`) unless ((!defined($_r->{'step'}) || ($_r->{'step'} eq ""))); + } + else { + $_r->{'time'} = $time; + } + + if ((!defined($_r->{'step'}) || ($_r->{'step'} eq ""))) { + $_r->{'step'} = "???"; + } + + $steps[$j] = $_r; + $j+=2; + } + + if ($^O =~ /win/i){ + $j = 0; + } + else { + $j = 1; + } + for (my $i=$rng-1; $i>= ($rng/2); $i--) { + my ($step,$time) = split /;/, $ping_raw[$i]; + my $_r; + + if (defined($checked->{$step})) { + $j-=2 if $j>2; + next; + } + + $_r->{'step'} = $step; + if ($^O =~ /win/i) { + $_r->{'time'} = trim(`ping -n $conf->{'c'} $_r->{'step'} | grep -e "Av" -e "Me" | gawk "{print \$NF}" | tr -d "ms"`) unless ((!defined($_r->{'step'}) || ($_r->{'step'} eq ""))); + } + else { + $_r->{'time'} = $time; + } + + + if ((!defined($_r->{'step'}) || ($_r->{'step'} eq ""))) { + $_r->{'step'} = "???"; + } + + $steps[$j] = $_r; + $j+=2; + } + } + else { + # Asymmetric routing + + for (my $i=0; $i< $rng; $i++) { + my ($step,$time) = split /;/, $ping_raw[$i]; + my $_r; + + if (defined($checked->{$step})) { + # target reached + last; + } + + $checked->{$step} = 1; + + $_r->{'step'} = $step; + if ($^O =~ /win/i) { + $_r->{'time'} = trim(`ping -n $conf->{'c'} $_r->{'step'} | grep -e "Av" -e "Me" | gawk "{print \$NF}" | tr -d "ms"`) unless ((!defined($_r->{'step'}) || ($_r->{'step'} eq ""))); + } + else { + $_r->{'time'} = $time; + } + + if ((!defined($_r->{'step'}) || ($_r->{'step'} eq ""))) { + $_r->{'step'} = "???"; + } + + $steps[$i] = $_r; + } + } + + my $__origin; + + if ($^O !~ /win/i){ + $__origin = shift @steps; + } + + my $gw; + + if ($^O =~ /win/i) { + ($gw->{'step'},$__origin->{'step'}) = split /;/, trim(`route print -4 | gawk "BEGIN {min=10000} /^\\ *0.0.0.0/ {met=\$NF;if(met{'time'} = trim(`ping -n $conf->{'c'} $gw->{'step'} 2>/NUL | grep ms | grep -v TTL | gawk "{print \$NF}" | tr -d "ms"`); + $__origin->{'time'} = 0; + } + else { + $gw->{'step'} = trim(`route -n | awk 'BEGIN {min=100000} /^0/ {met=\$5; if(min>met){gw=\$2;min=met} } END { print gw}'`); + $gw->{'time'} = trim(`ping -c $conf->{'c'} $gw->{'step'} 2>/dev/null | grep rtt |awk '{print \$4}'| cut -f2 -d"/"`); + } + + unshift (@steps,($__origin,$gw)); + + my $unknown_count = 0; + my $previous = undef; + + for(my $i=0; $i <= $#steps; $i++) { + my $host = $steps[$i]->{'step'}; + my $time = to_number($steps[$i]->{'time'}); + my $preffix = 'RouteStep_'; + my $desc = ''; + + if (!defined($time)) { + next; + } + + if ($host eq "???") { + $host = "Hidden_" . (++$unknown_count); + } + if (($i == $#steps) && in_array($conf->{'target_ip'},$host)) { + $preffix = 'RouteStepTarget_'; + } + elsif($i == $#steps) { + $desc = 'Step unreachable'; + } + + push @modules, { + name => $preffix . $host, + type => "generic_data", + value => $time, + unit => 'ms', + desc => $desc, + module_parent => $previous, + parent_unlink => (empty($previous)?'1':undef) + }; + + $previous = $preffix . $host; + } + + return \@modules; + } + else { + # MTR mode + + if ($#route_raw < 0) { + # Empty output + msg("Failed to analyze [$target]"); + return []; + + } + + for (my $i=0; $i <= $#route_raw; $i++) { + my $line = $route_raw[$i]; + if (trim($line) =~ /(.*?);(.*)/) { + my $host = $1; + my $time = to_number($2); + my $preffix = 'RouteStep_'; + my $desc = ''; + my $item; + my $_r; + + if (!defined($time)) { + next; + } + + $_r->{'step'} = $host; + $_r->{'time'} = $time; + + push @steps, $_r; + } + } + + my $__origin; + + if ($^O !~ /win/i){ + $__origin = shift @steps; + } + + my $gw; + + if ($^O =~ /win/i) { + ($gw->{'step'},$__origin->{'step'}) = split /;/, trim(`route print -4 | gawk "BEGIN {min=10000} /^\\ *0.0.0.0/ {met=\$NF;if(met{'time'} = trim(`ping -n $conf->{'c'} $gw->{'step'} 2>/NUL | grep ms | grep -v TTL | gawk "{print \$NF}" | tr -d "ms"`); + $__origin->{'time'} = 0; + } + else { + $gw->{'step'} = trim(`route -n | awk 'BEGIN {min=100000} /^0/ {met=\$5; if(min>met){gw=\$2;min=met} } END { print gw}'`); + $gw->{'time'} = trim(`ping -c $conf->{'c'} $gw->{'step'} 2>/dev/null | grep rtt |awk '{print \$4}'| cut -f2 -d"/"`); + + my $__xorigin = trim(`ip a show dev \`route -n | awk 'BEGIN {min=100000} /^0/ {met=\$5; if(min>met){iface=\$NF;min=met} } END { print iface}'\` | grep -w inet | awk '{print \$2}' | cut -d'/' -f1`); + + if ($__xorigin ne $__origin->{'step'}) { + unshift(@steps, $__origin); + $__origin = {}; + $__origin->{'step'} = $__xorigin; + $__origin->{'time'} = 0; + } + } + + unshift (@steps,($__origin,$gw)); + + my $unknown_count = 0; + my $previous = undef; + + for(my $i=0; $i <= $#steps; $i++) { + my $host = $steps[$i]->{'step'}; + my $time = to_number($steps[$i]->{'time'}); + my $preffix = 'RouteStep_'; + my $desc = ''; + + if (!defined($time)) { + next; + } + + if ($host eq "???") { + $host = "Hidden_" . (++$unknown_count); + } + if (($i == $#steps) && in_array($conf->{'target_ip'},$host)) { + $preffix = 'RouteStepTarget_'; + } + elsif($i == $#steps) { + $desc = 'Step unreachable'; + } + + push @modules, { + name => $preffix . $host, + type => "generic_data", + value => $time, + unit => 'ms', + desc => $desc, + module_parent => $previous, + parent_unlink => (empty($previous)?'1':undef) + }; + + $previous = $preffix . $host; + } + } + + return \@modules; +} + + +########################################################################## +########################################################################## +# MAIN +########################################################################## +########################################################################## + +if ($#ARGV < 0) { + print STDERR $HELP; + exit 1; +} + +my $conf; +my $file_conf = {}; +my $args_conf = {}; + +if (-e $ARGV[0]) { + $file_conf = parse_configuration($ARGV[0]); + shift @ARGV; +} + +$args_conf = parse_arguments(\@ARGV); +$conf = merge_hashes($file_conf,$args_conf); + +if (!defined $conf->{'t'}) { + print STDERR $HELP; + exit 1; +} + +my @targets = gethostbyname($conf->{'t'}); +@targets = map { inet_ntoa($_) } @targets[4 .. $#targets]; +if (empty(\@targets)) { + print STDERR "Cannot resolve $conf->{'t'} \n"; + exit 2; +} + + +$conf->{'target_ip'} = \@targets; + +$conf->{'c'} = 4 unless looks_like_number($conf->{'c'}); +$conf->{'s'} = 1 unless looks_like_number($conf->{'s'}); + + +my $results = get_steps($conf); + +foreach (@{$results}) { + print_module($conf, $_); +} + + + diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index 8ba3b48e60..b01a9d3519 100644 --- a/pandora_agents/win32/bin/pandora_agent.conf +++ b/pandora_agents/win32/bin/pandora_agent.conf @@ -1,6 +1,6 @@ # Base config file for Pandora FMS Windows Agent # (c) 2006-2017 Artica Soluciones Tecnologicas -# Version 7.0NG.714 +# Version 7.0NG.716 # This program is Free Software, you can redistribute it and/or modify it # under the terms of the GNU General Public Licence as published by the Free Software diff --git a/pandora_agents/win32/bin/util/mtr.exe b/pandora_agents/win32/bin/util/mtr.exe new file mode 100644 index 0000000000..3646ca89aa Binary files /dev/null and b/pandora_agents/win32/bin/util/mtr.exe differ diff --git a/pandora_agents/win32/bin/util/route_parser.exe b/pandora_agents/win32/bin/util/route_parser.exe new file mode 100644 index 0000000000..4da75a272a Binary files /dev/null and b/pandora_agents/win32/bin/util/route_parser.exe differ diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 044490051c..af6f1f63a3 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -3,7 +3,7 @@ AllowLanguageSelection {Yes} AppName -{Pandora FMS Windows Agent v7.0NG.714} +{Pandora FMS Windows Agent v7.0NG.716} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171026} +{171129} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index dac37430c2..3efb7124c4 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.714(Build 171026)") +#define PANDORA_VERSION ("7.0NG.716(Build 171129)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index c34abc2ebe..7a3f16fdaa 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.714(Build 171026))" + VALUE "ProductVersion", "(7.0NG.716(Build 171129))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 0f7f4593d0..b40d8460f2 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.714-171026 +Version: 7.0NG.716-171129 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 19b0e092c0..f6285eab5f 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.714-171026" +pandora_version="7.0NG.716-171129" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 97f1bc7589..f5cad20d74 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -546,9 +546,11 @@ ui_require_jquery_file('pandora'); }); $('#group_id').change(function(){ - var regx = /&group_id=\d*/g; - var url = location.href.replace(regx, ""); - location.href = url+"&group_id="+$("#group_id").val(); + if(location.href.indexOf("extensions/agents_modules") == -1){ + var regx = /&group_id=\d*/g; + var url = location.href.replace(regx, ""); + location.href = url+"&group_id="+$("#group_id").val(); + } }); }); diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index a69343d6dd..6e6cf9a92e 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -72,7 +72,7 @@ function mainAgentsModules() { $hor_offset = (int)get_parameter('hor_offset', 0); $block = $config['block_size']; if(get_parameter('modulegroup') != null){ - $agents_id = (array)get_parameter('id_agents2', -1); + $agents_id = (array)get_parameter('id_agents2', -1); } $selection_a_m = (int)get_parameter('selection_agent_module'); $modules_selected = (array)get_parameter('module', 0); diff --git a/pandora_console/extensions/db_status.php b/pandora_console/extensions/db_status.php index 2b0e281993..d184850a34 100755 --- a/pandora_console/extensions/db_status.php +++ b/pandora_console/extensions/db_status.php @@ -259,80 +259,60 @@ function extension_db_check_tables_differences($connection_test, $field_system = $fields_system[$name_field]; $diff = array_diff($field_test, $field_system); + if (!empty($diff)) { - foreach ($diff as $config_field => $value) { - switch ($config_field) { - case 'type': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set the type with %s.', - $name_field, $table, $value)); - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-										"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $value . ";" .
-									'
' - ); - break; - case 'null': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be null: (%s).', - $name_field, $table, $value)); + $info_message = ""; + $error_message = ""; + if($diff['type']){ + $error_message .= "Unsuccessful the field ".$name_field." in the table ".$table." must be set the type with ".$diff['type']."
"; + } + + if($diff['null']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be null: (".$diff['null'].").
"; + } + + if($diff['default']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set ".$diff['default']." as default value.
"; + } + + if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ + $null_defect = " NULL"; + } + else{ + $null_defect = " NOT NULL"; + } + + if(!isset($field_test['default']) || $field_test['default'] == ""){ + $default_value = ""; + } + else{ + $default_value = " DEFAULT ".$field_test['default']; + } + + if($diff['type'] || $diff['null'] || $diff['default']){ + $info_message .= "ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . $null_defect . $default_value.";"; + } + + if($diff['key']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set the key as defined in the SQL file.
"; + $info_message .= "

Please check the SQL file for to know the kind of key needed."; + } + + if($diff['extra']){ + $error_message .= "Unsuccessful the field $name_field in the table $table must be set as defined in the SQL file.
"; + $info_message .= "

Please check the SQL file for to know the kind of extra config needed."; + } + + ui_print_error_message( + __($error_message)); - if ($value == "YES") { - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " "  . $field_test['type'] . " NULL;" .
-										'
' - ); - } - else { - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " " . $field_test['type'] . " NOT NULL;" .
-										'
' - ); - } + ui_print_info_message( + __($info_message)); - break; - case 'key': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set the key as defined in the SQL file.', - $name_field, $table)); - ui_print_info_message( - __('Please check the SQL file for to know the kind of key needed.')); - break; - case 'default': - if($field_test['null'] == "YES" || !isset($field_test['null']) || $field_test['null'] == ""){ - $null_defect = " NULL"; - } - else{ - $null_defect = " NOT NULL"; - } - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set %s as default value.', - $name_field, $table, $value)); - ui_print_info_message( - __('You can execute this SQL query for to fix.') . "
" . - '
' .
-											"ALTER TABLE " . $table . " MODIFY COLUMN " . $name_field . " "  . $field_test['type'] . $null_defect . " DEFAULT " . $value . ";" .
-										'
' - ); - break; - case 'extra': - ui_print_error_message( - __('Unsuccessful the field %s in the table %s must be set as defined in the SQL file.', - $name_field, $table)); - ui_print_info_message( - __('Please check the SQL file for to know the kind of extra config needed.')); - break; } } } } - } - } if ($correct_fields) { ui_print_success_message( @@ -366,4 +346,4 @@ function extension_db_status_execute_sql_file($url, $connection) { extensions_add_godmode_function('extension_db_status'); extensions_add_godmode_menu_option(__('DB Schema check'), 'DM', 'gextensions', null, "v1r1", 'gdbman'); -?> \ No newline at end of file +?> diff --git a/pandora_console/extras/mr/10.sql b/pandora_console/extras/mr/10.sql new file mode 100644 index 0000000000..e27f4fccf1 --- /dev/null +++ b/pandora_console/extras/mr/10.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/mr/8.sql b/pandora_console/extras/mr/8.sql new file mode 100644 index 0000000000..402fb7e82c --- /dev/null +++ b/pandora_console/extras/mr/8.sql @@ -0,0 +1,21 @@ +START TRANSACTION; +ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30'; +ALTER TABLE treport_content ADD COLUMN lapse_calc tinyint(1) default '0'; +ALTER TABLE treport_content ADD COLUMN lapse int(11) default '300'; +ALTER TABLE treport_content ADD COLUMN visual_format tinyint(1) default '0'; +ALTER TABLE treport_content_template ADD COLUMN lapse_calc tinyint(1) default '0'; +ALTER TABLE treport_content_template ADD COLUMN lapse int(11) default '300'; +ALTER TABLE treport_content_template ADD COLUMN visual_format tinyint(1) default '0'; + +UPDATE `talert_commands` +SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using: _field1_ as destination email address, and _field2_ as subject for message. _field3_ as text of message. _field4_ as content type (text/plain or html/text).', + `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', + `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' +WHERE id=1; + +UPDATE `talert_actions` +SET `field4` = 'text/html', + `field4_recovery` = 'text/html' +WHERE id = 1; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/mr/9.sql b/pandora_console/extras/mr/9.sql new file mode 100644 index 0000000000..dbf0456323 --- /dev/null +++ b/pandora_console/extras/mr/9.sql @@ -0,0 +1,24 @@ +START TRANSACTION; + +SET @st_oum708 = (SELECT IF( + (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0, + "ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL", + "SELECT 1" +)); + +PREPARE pr_oum708 FROM @st_oum708; +EXECUTE pr_oum708; +DEALLOCATE PREPARE pr_oum708; + +ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; +ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; + +alter table tlayout_data add column element_group int(10) not null default 0; + +alter table tlayout_data add column id_layout_linked_weight int(10) not null default 0; + +ALTER TABLE tlayout_data ADD COLUMN show_on_top tinyint(1) default 0; + +ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0; + +COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 22bcc52766..111ac54ee0 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -725,6 +725,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `module_free_text` TEXT, `each_agent` tinyint(1) default 1, `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, + `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', + `lapse` int(11) UNSIGNED NOT NULL default '300', + `visual_format` tinyint(1) UNSIGNED NOT NULL default '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -1134,6 +1137,10 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT " -- --------------------------------------------------------------------- UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket'; +UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using: _field1_ as destination email address, and _field2_ as subject for message. _field3_ as text of message. _field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1; + +UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1; + -- --------------------------------------------------------------------- -- Table `tmap` -- --------------------------------------------------------------------- @@ -1150,10 +1157,10 @@ 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', 7); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 9); 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', '714'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '716'); -- --------------------------------------------------------------------- -- Table `tplanned_downtime_agents` @@ -1183,6 +1190,7 @@ ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) UNSIGNED NULL DEFAULT NULL; ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL; 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'; -- --------------------------------------------------------------------- -- Table `tagente_modulo` @@ -1218,6 +1226,7 @@ ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0'; ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default ''); ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0'; +ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; UPDATE tagente SET tagente.alias = tagente.nombre; -- --------------------------------------------------------------------- @@ -1231,6 +1240,9 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF'; ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down'; ALTER TABLE tlayout_data ADD COLUMN `show_statistics` tinyint(2) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `element_group` int(10) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0'; +ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` @@ -1248,6 +1260,8 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %'; -- Table `tgraph` -- --------------------------------------------------------------------- ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0'; +ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0'; +ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tnetflow_filter` @@ -1269,6 +1283,9 @@ UPDATE treport_custom_sql SET `sql` = 'select t1.alias as agent_n -- --------------------------------------------------------------------- ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0'; +ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; +ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0'; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` @@ -1295,6 +1312,7 @@ ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) de ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT ''; ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0'; +ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0'; UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.nombre; -- --------------------------------------------------------------------- @@ -1326,6 +1344,10 @@ SET @vv1 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = IF @vv1>0 THEN ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT ""; END IF; +SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled'); +IF @vv2>0 THEN + ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL; +END IF; END; // delimiter ; @@ -1440,3 +1462,7 @@ INSERT INTO tmodule VALUES (8, 'Wux module'); INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'); +-- --------------------------------------------------------------------- +-- Table `tdashboard` +-- --------------------------------------------------------------------- +ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 46e95a7026..e228c1eca4 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -191,7 +191,7 @@ config_check(); $_GET['refr'] = null; } - $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); + $select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { @@ -261,7 +261,13 @@ config_check(); if ($check_minor_release_available) { if (users_is_admin($config['id_user'])) { - set_pandora_error_for_header('There are one or more minor releases waiting for update', 'minor release/s available'); + + if($config['language'] == 'es'){ + set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. '.__('Sobre actualización de revisión menor').'', 'Revisión/es menor/es disponible/s'); + } + else{ + set_pandora_error_for_header('There are one or more minor releases waiting for update. '.__('About minor release update').'', 'minor release/s available'); + } } } echo ''; @@ -389,7 +395,15 @@ config_check(); $("#combo_refr").toggle (); $("#combo_refr").css('padding-right', '9px'); href = $("a.autorefresh").attr ("href"); - $(document).attr ("location", href + "30"); + + var refresh = ''; + $(document).attr ("location", href + refresh); + + data[3][0] = __('Parent'); -$params = array(); -$params['return'] = true; -$params['show_helptip'] = true; -$params['input_name'] = 'id_parent'; -$params['print_hidden_input_idagent'] = true; -$params['hidden_input_idagent_name'] = 'id_agent_parent'; -$params['hidden_input_idagent_value'] = $id_parent; -$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); -$params['selectbox_id'] = 'cascade_protection_module'; -$params['javascript_is_function_select'] = true; -$params['cascade_protection'] = true; - -$table->data[3][1] = ui_print_agent_autocomplete_input($params); - -$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); - -$table->data[3][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true); - $table->data[4][0] = __('Group'); $table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true); $table->data[4][1] .= ' '; @@ -320,52 +301,87 @@ $table->class = "databox filters"; $table->head = array (); $table->style = array (); $table->style[0] = 'font-weight: bold; '; -$table->style[2] = 'font-weight: bold;'; +$table->style[4] = 'font-weight: bold;'; $table->data = array (); // Custom ID $table->data[0][0] = __('Custom ID'); $table->data[0][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$table->data[1][0] = __('Parent'); +$params = array(); +$params['return'] = true; +$params['show_helptip'] = true; +$params['input_name'] = 'id_parent'; +$params['print_hidden_input_idagent'] = true; +$params['hidden_input_idagent_name'] = 'id_agent_parent'; +$params['hidden_input_idagent_value'] = $id_parent; +$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); +$params['selectbox_id'] = 'cascade_protection_module'; +$params['javascript_is_function_select'] = true; +$params['cascade_protection'] = true; + +$table->data[1][1] = ui_print_agent_autocomplete_input($params); +$table->data[1][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). " " . ui_print_help_icon("cascade_protection", true); +$table->data[1][1] .= "  " . __('Module') . " " . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true); + +//safe operation mode +if($id_agente){ + $sql_modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo + WHERE id_agente = " . $id_agente); + $safe_mode_modules = array(); + $safe_mode_modules[0] = __('Any'); + foreach ($sql_modules as $m) { + $safe_mode_modules[$m['id_module']] = $m['name']; + } + + $table->data[2][0] = __('Safe operation mode') + . ui_print_help_tip(__('This mode allow Pandora FMS to disable all modules + of this agent while the selected module is on CRITICAL status'), true); + $table->data[2][1] = html_print_checkbox('safe_mode', 1, $safe_mode, true); + $table->data[2][1] .= "  " . __('Module') . " " . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true); +} + + // Learn mode / Normal mode -$table->data[1][0] = __('Module definition') . +$table->data[3][0] = __('Module definition') . ui_print_help_icon("module_definition", true); -$table->data[1][1] = __('Learning mode') . ' ' . +$table->data[3][1] = __('Learning mode') . ' ' . html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Normal mode') . ' ' . +$table->data[3][1] .= __('Normal mode') . ' ' . html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); -$table->data[1][1] .= __('Autodisable mode') . ' ' . +$table->data[3][1] .= __('Autodisable mode') . ' ' . html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();', 'style="margin-right: 40px;"', true); // Status (Disabled / Enabled) -$table->data[2][0] = __('Status'); -$table->data[2][1] = __('Disabled') . ' ' . +$table->data[4][0] = __('Status'); +$table->data[4][1] = __('Disabled') . ' ' . html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); -$table->data[2][1] .= __('Active') . ' ' . +$table->data[4][1] .= __('Active') . ' ' . html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true); // Remote configuration -$table->data[3][0] = __('Remote configuration'); +$table->data[5][0] = __('Remote configuration'); if (!$new_agent) { - $table->data[3][1] = '' . __('Not available') . ''; + $table->data[5][1] = '' . __('Not available') . ''; if (isset($filename)) { if (file_exists ($filename['md5'])) { - $table->data[3][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); + $table->data[5][1] = date ("F d Y H:i:s", fileatime ($filename['md5'])); // Delete remote configuration - $table->data[3][1] .= ''; - $table->data[3][1] .= html_print_image( + $table->data[5][1] .= html_print_image( "images/cross.png", true, array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).''; - $table->data[3][1] .= '' . + $table->data[5][1] .= '' . ui_print_help_tip( __('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), true); @@ -373,7 +389,7 @@ if (!$new_agent) { } } else - $table->data[3][1] = '' . __('Not available') . ''; + $table->data[5][1] = '' . __('Not available') . ''; $listIcons = gis_get_array_list_icons(); @@ -411,23 +427,23 @@ $table->data[0][3] = html_print_select($arraySelectIcon, "icon_path", array("id" => "icon_warning", "style" => "display:".$display_icons.";")); if ($config['activate_gis']) { - $table->data[1][2] = __('Ignore new GIS data:'); - $table->data[1][3] = __('Yes') . ' ' . + $table->data[3][2] = __('Ignore new GIS data:'); + $table->data[3][3] = __('Yes') . ' ' . html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); - $table->data[1][3] .= __('No') . ' ' . + $table->data[3][3] .= __('No') . ' ' . html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); } -$table->data[2][2] = __('Url address'); -$table->data[2][3] = html_print_input_text ('url_description', +$table->data[4][2] = __('Url address'); +$table->data[4][3] = html_print_input_text ('url_description', $url_description, '', 45, 255, true); -$table->data[3][2] = __('Quiet'); -$table->data[3][3] = ui_print_help_tip( +$table->data[5][2] = __('Quiet'); +$table->data[5][3] = ui_print_help_tip( __('The agent still runs but the alerts and events will be stop'), true); -$table->data[3][3] .= html_print_checkbox('quiet', 1, $quiet, true); +$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true); ui_toggle(html_print_table ($table, true), __('Advanced options')); unset($table); @@ -582,6 +598,26 @@ ui_require_jquery_file('bgiframe'); $("#cascade_protection_module").attr("disabled", 'disabled'); } }); + + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); + if (safe_mode_checked) { + $("#safe_mode_module").removeAttr("disabled"); + } + else { + $("#safe_mode_module").attr("disabled", 'disabled'); + } + + $("#checkbox-safe_mode").change(function () { + var safe_mode_checked = $("#checkbox-safe_mode").is(":checked"); + + if (safe_mode_checked) { + $("#safe_mode_module").removeAttr("disabled"); + } + else { + $("#safe_mode_module").val(0); + $("#safe_mode_module").attr("disabled", 'disabled'); + } + }); paint_qrcode( "data[0][1] = ''; $table->data[0][2] = ''.__('Modules').''; - $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;'); + $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;'); $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); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index e2a264e6e0..1311620c34 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -135,6 +135,8 @@ $id_os = 9; // Windows $custom_id = ""; $cascade_protection = 0; $cascade_protection_modules = 0; +$safe_mode = 0; +$safe_mode_module = 0; $icon_path = ''; $update_gis_data = 0; $unit = ""; @@ -166,6 +168,8 @@ if ($create_agent) { $custom_id = (string) get_parameter_post ("custom_id",''); $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0); + $safe_mode = (int) get_parameter_post ("safe_mode", 0); + $safe_mode_module = (int) get_parameter_post ("safe_mode_module", 0); $icon_path = (string) get_parameter_post ("icon_path",''); $update_gis_data = (int) get_parameter_post("update_gis_data", 0); $url_description = (string) get_parameter("url_description"); @@ -228,7 +232,7 @@ if ($create_agent) { if ($id_agente !== false) { // Create custom fields for this agent foreach ($field_values as $key => $value) { - db_process_sql_insert ('tagent_custom_data', + $update_custom = db_process_sql_insert ('tagent_custom_data', array('id_field' => $key, 'id_agent' => $id_agente, 'description' => $value)); } @@ -707,6 +711,7 @@ if ($update_agent) { // if modified some agent paramenter $custom_id = (string) get_parameter_post ("custom_id", ""); $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $cascade_protection_module = (int) get_parameter ("cascade_protection_module", 0); + $safe_mode_module = (int) get_parameter ("safe_mode_module", 0); $icon_path = (string) get_parameter_post ("icon_path",''); $update_gis_data = (int) get_parameter_post("update_gis_data", 0); $url_description = (string) get_parameter("url_description"); @@ -730,13 +735,17 @@ if ($update_agent) { // if modified some agent paramenter if ($old_value === false) { // Create custom field if not exist - db_process_sql_insert ('tagent_custom_data', + $update_custom = db_process_sql_insert ('tagent_custom_data', array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value)); } else { - db_process_sql_update ('tagent_custom_data', + $update_custom = db_process_sql_update ('tagent_custom_data', array('description' => $value), array('id_field' => $key,'id_agent' => $id_agente)); + + if($update_custom == 1){ + $update_custom_result = 1; + } } } @@ -782,7 +791,8 @@ if ($update_agent) { // if modified some agent paramenter 'update_gis_data' => $update_gis_data, 'url_address' => $url_description, 'url_address' => $url_description, - 'quiet' => $quiet); + 'quiet' => $quiet, + 'safe_mode_module' => $safe_mode_module); if ($config['metaconsole_agent_cache'] == 1) { $values['update_module_count'] = 1; // Force an update of the agent cache. @@ -793,7 +803,9 @@ if ($update_agent) { // if modified some agent paramenter WHERE id_group = ".$group_old); $result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente)); - if ($result == false) { + + + if ($result == false && $update_custom_result == false) { ui_print_error_message( __('There was a problem updating the agent')); } @@ -900,6 +912,8 @@ if ($id_agente) { $update_gis_data = $agent["update_gis_data"]; $url_description = $agent["url_address"]; $quiet = $agent["quiet"]; + $safe_mode_module = $agent["safe_mode_module"]; + $safe_mode = ($safe_mode_module) ? 1 : 0; } $update_module = (bool) get_parameter ('update_module'); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 090011dae9..cc5349182e 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -201,13 +201,13 @@ switch ($sortField) { switch ($sort) { case 'up': $selectRemoteUp = $selected; - $order = array('field' => 'remote ' . $order_collation, + $order = array('field' => 'remote ', 'field2' => 'nombre ' . $order_collation, 'order' => 'ASC'); break; case 'down': $selectRemoteDown = $selected; - $order = array('field' => 'remote ' . $order_collation, + $order = array('field' => 'remote ', 'field2' => 'nombre ' . $order_collation, 'order' => 'DESC'); break; diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index e2739aee29..921296545d 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -111,12 +111,12 @@ if (is_ajax ()) { else $snmp_community = (string) get_parameter ('snmp_community'); $snmp_version = get_parameter('snmp_version'); - $snmp3_auth_user = get_parameter('snmp3_auth_user'); + $snmp3_auth_user = io_safe_output(get_parameter('snmp3_auth_user')); $snmp3_security_level = get_parameter('snmp3_security_level'); $snmp3_auth_method = get_parameter('snmp3_auth_method'); - $snmp3_auth_pass = get_parameter('snmp3_auth_pass'); + $snmp3_auth_pass = io_safe_output(get_parameter('snmp3_auth_pass')); $snmp3_privacy_method = get_parameter('snmp3_privacy_method'); - $snmp3_privacy_pass = get_parameter('snmp3_privacy_pass'); + $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_privacy_pass')); $snmp_port = get_parameter('snmp_port'); $snmpwalk = get_snmpwalk($ip_target, $snmp_version, $snmp_community, diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 9b9b96ffaf..473e36dfdc 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -590,8 +590,7 @@ $table_advanced->colspan[10][1] = 6; if (isset($id_agente) && $moduletype == MODULE_DATA) { $has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"])); if ($has_remote_conf) { - $table_advanced->data[11][0] = __('Cron from') . - ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); + $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->colspan[11][1] = 6; @@ -600,8 +599,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) { $table_advanced->colspan[12][1] = 6; } else { - $table_advanced->data[11][0] = __('Cron from') . - ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); + $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true); $table_advanced->colspan[11][1] = 6; @@ -611,8 +609,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) { } } else { - $table_advanced->data[11][0] = __('Cron from') . - ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true); + $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->colspan[11][1] = 6; diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 24d0105d42..b640243cfe 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -398,12 +398,12 @@ function snmpBrowserWindow () { $('#text-target_ip').val($('#text-ip_target').val()); $('#text-community').val($('#text-snmp_community').val()); $('#snmp_browser_version').val($('#snmp_version').val()); - $('#snmp3_browser_auth_user').val($('#snmp3_auth_user').val()); + $('#text-snmp3_browser_auth_user').val($('#text-snmp3_auth_user').val()); $('#snmp3_browser_security_level').val($('#snmp3_security_level').val()); $('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val()); - $('#snmp3_browser_auth_pass').val($('#snmp3_auth_pass').val()); + $('#password-snmp3_browser_auth_pass').val($('#password-snmp3_auth_pass').val()); $('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val()); - $('#snmp3_browser_privacy_pass').val($('#snmp3_privacy_pass').val()); + $('#password-snmp3_browser_privacy_pass').val($('#password-snmp3_privacy_pass').val()); $("#snmp_browser_container").show().dialog ({ title: '', diff --git a/pandora_console/godmode/alerts/alert_commands.php b/pandora_console/godmode/alerts/alert_commands.php index d4106e3460..10edc6bead 100644 --- a/pandora_console/godmode/alerts/alert_commands.php +++ b/pandora_console/godmode/alerts/alert_commands.php @@ -165,8 +165,26 @@ if (is_ajax ()) { $rfield = $editor_type_chkbx; $rfield .= html_print_textarea ('field'.$i.'_recovery_value', 1, 1, '', 'class="fields_recovery"', true); } + elseif(preg_match ("/^_content_type_$/i", $field_value)){ + $editor_type_chkbx = "
"; + $editor_type_chkbx .= __('Text/plain') . ui_print_help_tip (__("For sending emails only text plain"), true); + $editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_value', 'text/plain', '', '', false, '', '', true); + $editor_type_chkbx .= "    "; + $editor_type_chkbx .= __('Text/html') . "  "; + $editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', true); + $editor_type_chkbx .= "
"; + $ffield = $editor_type_chkbx; + + $editor_type_chkbx = "
"; + $editor_type_chkbx .= __('Text/plain') . ui_print_help_tip (__("For sending emails only text plain"), true); + $editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_recovery_value', 'text/plain', '', '', false, '', '', true); + $editor_type_chkbx .= "    "; + $editor_type_chkbx .= __('Text/html') . "  "; + $editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true); + $editor_type_chkbx .= "
"; + $rfield = $editor_type_chkbx; // Select type - else { + }else { $fields_value_select = array(); $fv = explode(';', $field_value); diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index bef56c026c..990653f19f 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -305,8 +305,33 @@ $(document).ready (function () { // Replace the old column with the new $table_macros_field.replaceWith(field_row); if (old_value != '' || old_recovery_value != '') { - $("[name=field" + i + "_value]").val(old_value); - $("[name=field" + i + "_recovery_value]").val(old_recovery_value); + var inputType = $("[name=field" + i + "_value]").attr('type') + if (inputType == 'radio') { + if(old_value == 'text/plain'){ + if ($("[name=field" + i + "_value]").val() == 'text/plain') { + $("[name=field" + i + "_value]").attr('checked','checked'); + } + } + else{ + if($("[name=field" + i + "_value]").val() == 'text/html') { + $("[name=field" + i + "_value]").attr('checked','checked'); + } + } + if(old_recovery_value == 'text/plain'){ + if ($("[name=field" + i + "_recovery_value]").val() == 'text/plain') { + $("[name=field" + i + "_recovery_value]").attr('checked','checked'); + } + } + else{ + if ($("[name=field" + i + "_recovery_value]").val() == 'text/html') { + $("[name=field" + i + "_recovery_value]").attr('checked','checked'); + } + } + } + else { + $("[name=field" + i + "_value]").val(old_value); + $("[name=field" + i + "_recovery_value]").val(old_recovery_value); + } } else { $("[name=field" + i + "_value]") diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 933bb747c8..f37a39e10d 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -503,6 +503,10 @@ $table->data['edit3'][2] = __('SMNP community'); $table->data['edit3'][3] = html_print_input_text ('snmp_community', '', '', 10, 100, true); +$table->data['edit15'][2] = __('SNMP OID'); +$table->data['edit15'][3] = html_print_input_text ('snmp_oid', '', + '', 80, 80, true); + $target_ip_values = array(); $target_ip_values['auto'] = __('Auto'); $target_ip_values['force_pri'] = __('Force primary key'); @@ -736,7 +740,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); var params = { "page" : "operation/agentes/ver_agente", @@ -800,7 +805,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").show (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").show (); } function clean_lists() { @@ -829,7 +835,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); $('input[type=checkbox]').attr('checked', false); $('input[type=checkbox]').attr('disabled', true); @@ -877,7 +884,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); } } } @@ -919,7 +927,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").show (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").show (); } else { $(".select_agents_row_2").css('display', ''); @@ -942,7 +951,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); } } } @@ -1026,7 +1036,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", @@ -1158,8 +1169,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu /* List of fields which can be updated */ $fields = array ('dynamic_interval', 'dynamic_max', 'dynamic_min', 'dynamic_two_tailed', 'min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', - 'module_interval', 'disabled', 'post_process', 'unit_select', - 'snmp_community', 'tcp_send', 'custom_string_1', + 'module_interval', 'disabled', 'post_process', 'unit', + 'snmp_community','snmp_oid','tcp_send', 'custom_string_1', 'plugin_parameter', 'custom_string_2', 'custom_string_3', 'min', 'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data', 'critical_inverse', diff --git a/pandora_console/godmode/modules/manage_network_components.php b/pandora_console/godmode/modules/manage_network_components.php index ec448f0cf4..e2f3cdab26 100644 --- a/pandora_console/godmode/modules/manage_network_components.php +++ b/pandora_console/godmode/modules/manage_network_components.php @@ -129,7 +129,7 @@ else { } $snmp_version = (string) get_parameter('snmp_version'); -$snmp3_auth_user = (string) get_parameter('snmp3_auth_user'); +$snmp3_auth_user = (string) io_safe_output(get_parameter('snmp3_auth_user')); $snmp3_auth_pass = io_input_password((string) get_parameter('snmp3_auth_pass')); $snmp3_auth_method = (string) get_parameter('snmp3_auth_method'); $snmp3_privacy_method = (string) get_parameter('snmp3_privacy_method'); diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 2651751809..b1dffe8e5b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -112,6 +112,10 @@ $netflow_filter = 0; $max_values = 0; $resolution = 0; +$lapse_calc = 0; +$lapse = 300; +$visual_format = 0; + //Others $filter_search = ""; @@ -148,6 +152,7 @@ switch ($action) { case 'network_interfaces_report': case 'availability': case 'event_report_log': + case 'increment': case 'availability_graph': case 'agent_module': $get_data_editor = true; @@ -195,12 +200,6 @@ switch ($action) { $name = $item['name']; switch ($type) { - case 'avg_value': - $period = $item['period']; - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - break; case 'event_report_log': $period = $item['period']; $description = $item['description']; @@ -282,6 +281,13 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); break; + case 'increment': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'SLA_services': $description = $item['description']; $period = $item['period']; @@ -312,6 +318,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'max_value': $description = $item['description']; @@ -319,6 +328,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'min_value': $description = $item['description']; @@ -326,6 +338,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'sumatory': $description = $item['description']; @@ -593,6 +608,7 @@ switch ($action) { case 'MTTR': case 'simple_baseline_graph': case 'event_report_log': + case 'increment': $label = (isset($style['label'])) ? $style['label'] : ''; break; default: @@ -1580,6 +1596,78 @@ You can of course remove the warnings, that's why we include the source and do n ?> + + + + + + + + + + + + + + + + + + + + + + + + + +
'; + html_print_radio_button ('visual_format', 1, '', $visual_format_table,'',!$lapse_calc); + echo (''); + echo __('Graph only').''; + html_print_radio_button ('visual_format', 2, '', $visual_format_graph,'',!$lapse_calc); + echo (''); + echo __('Graph and table').''; + html_print_radio_button ('visual_format', 3, '', $visual_format_both,'',!$lapse_calc); + + ?> + + + + + @@ -2211,6 +2299,19 @@ $(document).ready (function () { } }); + $("#checkbox-lapse_calc").change(function () { + + if($(this).is(":checked")){ + $( "#lapse_select" ).prop( "disabled", false ); + $("[name=visual_format]").prop( "disabled", false ); + } + else{ + $( "#lapse_select" ).prop( "disabled", true ); + $("[name=visual_format]").prop( "disabled", true ); + } + + }); + }); function create_custom_graph() { @@ -2692,6 +2793,9 @@ function chooseType() { $("#row_show_in_two_columns").hide(); $("#row_show_in_same_row").hide(); $("#row_historical_db_check").hide(); + $("#row_lapse_calc").hide(); + $("#row_lapse").hide(); + $("#row_visual_format").hide(); $("#row_show_in_landscape").hide(); $('#row_hide_notinit_agents').hide(); $("#row_module_group").hide(); @@ -2763,6 +2867,13 @@ function chooseType() { $("#row_source").show(); $("#row_historical_db_check").hide(); break; + + case 'increment': + $("#row_description").show(); + $("#row_agent").show(); + $("#row_module").show(); + $("#row_period").show(); + break; case 'simple_graph': $("#row_time_compare_overlapped").show(); @@ -2884,6 +2995,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; @@ -2893,6 +3007,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; @@ -2902,6 +3019,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index f2f780b911..e52994b810 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1069,6 +1069,15 @@ switch ($action) { $values['period'] = get_parameter('period'); $good_format = true; break; + case 'min_value': + case 'max_value': + case 'avg_value': + $values['period'] = get_parameter('period'); + $values['lapse_calc'] = get_parameter('lapse_calc'); + $values['lapse'] = get_parameter('lapse'); + $values['visual_format'] = get_parameter('visual_format'); + $good_format = true; + break; default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0); @@ -1404,6 +1413,15 @@ switch ($action) { $values['period'] = get_parameter('period'); $good_format = true; break; + case 'min_value': + case 'max_value': + case 'avg_value': + $values['period'] = get_parameter('period'); + $values['lapse_calc'] = get_parameter('lapse_calc'); + $values['lapse'] = get_parameter('lapse'); + $values['visual_format'] = get_parameter('visual_format'); + $good_format = true; + break; default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index c588548957..fd7886f275 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -32,8 +32,6 @@ var SIZE_GRID = 16; //Const the size (for width and height) of grid. var img_handler_start; var img_handler_end; -var font; - function toggle_advance_options_palette(close) { if ($("#advance_options").css('display') == 'none') { $("#advance_options").css('display', ''); @@ -48,6 +46,7 @@ function toggle_advance_options_palette(close) { } // Main function, execute in event documentReady + function visual_map_main() { img_handler_start = "images/dot_red.png"; img_handler_end = "images/dot_green.png"; @@ -58,23 +57,6 @@ function visual_map_main() { img_handler_end = data; }); - //Get the actual system font. - parameter = Array(); - parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); - parameter.push ({name: "action", value: "get_font"}); - parameter.push ({name: "id_visual_console", - value: id_visual_console}); - jQuery.ajax({ - url: get_url_ajax(), - data: parameter, - type: "POST", - dataType: 'json', - success: function (data) - { - font = data['font']; - } - }); - //Get the list of posible parents parents = Base64.decode($("input[name='parents_load']").val()); parents = eval("(" + parents + ")"); @@ -107,7 +89,7 @@ function visual_map_main() { if($('#process_value').val() != '0'){ $('#period_row').css('display','table-row'); } - } + } else{ $('#data_image_container').css('display','inline'); $('#data_image_check').css('display','inline'); @@ -288,6 +270,157 @@ function update_button_palette_callback() { } break; case 'group_item': + if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){ + alert('Undefined image'); + return false; + } + + $("#text_" + idItem).html(values['label']); + + if(values['show_statistics'] == 1){ + + if (!$('#image_'+idItem).length) { + + if(values['label_position'] == 'left'){ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png") + .attr('style','float:right;'); + + } + else if(values['label_position'] == 'right'){ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png") + .attr('style','float:left;'); + + } + else{ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png"); + + } + + + $('#'+idItem).append($image); + + } + + if ((values['width'] == 0) || (values['height'] == 0)) { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 520); + $("#image_" + idItem).attr('height', 80); + $("#image_" + idItem).css('width', '520px'); + $("#image_" + idItem).css('height', '80px'); + $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); + + } + else { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); + } + + } + else{ + + if ((values['width'] == 0) || (values['height'] == 0)) { + + if(values['image'] != '' && values['image'] != 'none'){ + + if (!$('#image_'+idItem).length) { + + if(values['label_position'] == 'left'){ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png") + .attr('style','float:right;'); + + } + else if(values['label_position'] == 'right'){ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png") + .attr('style','float:left;'); + + } + else{ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png"); + + } + + + $('#'+idItem).append($image); + + } + + + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } + else{ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + + $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); + $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); + + + } + + } + else{ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + $("#image_" + idItem).remove(); + } + + } + else { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + } + + } + + + + break; case 'static_graph': if($('input[name=width]').val() == ''){ @@ -298,6 +431,10 @@ function update_button_palette_callback() { alert('Undefined height'); return false; } + if(((values['image'] == '' || values['image'] == 'none') && (values['label'] == ''))){ + alert('Undefined image'); + return false; + } $("#text_" + idItem).html(values['label']); @@ -328,22 +465,75 @@ function update_button_palette_callback() { else{ if ((values['width'] == 0) || (values['height'] == 0)) { - if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + + if(values['image'] != '' && values['image'] != 'none'){ + + if (!$('#image_'+idItem).length) { + + if(values['label_position'] == 'left'){ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png") + .attr('style','float:right;'); + + } + else if(values['label_position'] == 'right'){ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png") + .attr('style','float:left;'); + + } + else{ + + var $image = $('') + .attr('id', 'image_' + idItem) + .attr('class', 'image') + .attr('src', 'images/console/icons/'+values["image"]+".png"); + + } + + + $('#'+idItem).append($image); + + } + + + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } + else{ + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + + $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); + $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); + $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); + + + } + + } + else{ $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); $("#image_" + idItem).attr('width', 70); $("#image_" + idItem).attr('height', 70); $("#image_" + idItem).css('width', '70px'); $("#image_" + idItem).css('height', '70px'); + $("#image_" + idItem).remove(); } - else{ - $("#image_" + idItem).removeAttr('width'); - $("#image_" + idItem).removeAttr('height'); - $("#image_" + idItem).attr('width', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).attr('height', $('#preview > img')[0].naturalHeight); - $("#image_" + idItem).css('width', $('#preview > img')[0].naturalHeight+'px'); - $("#image_" + idItem).css('height', $('#preview > img')[0].naturalHeight+'px'); - } + } else { $("#image_" + idItem).removeAttr('width'); @@ -425,6 +615,11 @@ function update_button_palette_callback() { alert('Undefined width'); return false; } + + if($('input[name=bars_graph_height]').val() == ''){ + alert('Undefined height'); + return false; + } $("#text_" + idItem).html(values['label']); $("#image_" + idItem).attr("src", "images/spinner.gif"); @@ -452,21 +647,19 @@ function update_button_palette_callback() { break; case 'simple_value': $("#" + idItem).html(values['label']); - if( (values['label'].replace( /<.*?>/g, '' ) != '_VALUE_') - && (values['label'].replace( /<.*?>/g, '' ) != '(_VALUE_)') ){ - + + if($("#data_image_check").html() == "On"){ $("#text_" + idItem).html(''); $("#" + idItem).html(''); } else{ $("#text_" + idItem).html( - '
'+values["label"]+'
' + '
'+values["label"]+'
' ) $("#" + idItem).html( - '
'+values["label"]+'
' + '
'+values["label"]+'
' ) } - setModuleValue(idItem,values['process_simple_value'], values['period'],values['width']); break; case 'label': $("#text_" + idItem).html(values['label']); @@ -480,6 +673,10 @@ function update_button_palette_callback() { alert('Undefined height'); return false; } + if(values['image'] == '' || values['image'] == 'none'){ + alert('Undefined image'); + return false; + } $("#image_" + idItem).attr('src', "images/spinner.gif"); if ((values['width'] == 0) || (values['height'] == 0)) { if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ @@ -550,7 +747,6 @@ function update_button_palette_callback() { $("#" + idItem + ' img').css('margin-top',(parseInt($("#" + idItem).css('height'))/2)-(parseInt($("#" + idItem + " img").css('height'))/2)+'px'); $("#" + idItem + ' > p').remove(); } - else if(values['label_position']=='down'){ $("#" + idItem + ' table').css('float',''); $("#" + idItem + ' img').css('float',''); @@ -558,15 +754,16 @@ function update_button_palette_callback() { $('#' + idItem + ' table').remove(); $('#' + idItem).append(tempoimg); $("#" + idItem + ' table').css('height',''); - $("#" + idItem + ' table').css('width','70'); - $("#" + idItem + ' span').css('width','70'); + if (selectedItem != 'simple_value') { + $("#" + idItem + ' table').css('width','70'); + $("#" + idItem + ' span').css('width','70'); + } + else { + $("#" + idItem + ' table').css('width',''); + $("#" + idItem + ' table').css('text-align','center'); + $("#" + idItem + ' span').css('width',''); + } $("#" + idItem + ' img').css('margin-top',''); - //if(parseInt($("#" + idItem).css('width'))-parseInt($("#" + idItem + " img").css('width'))/2 == 0 || values['height'] == 0 || values['width'] == 0){ - //$("#" + idItem + ' img').css('margin-left',(parseInt($("#" + idItem).css('width'))/2)-(parseInt($("#" + idItem + " img").css('width'))/2)+'px'); - //} - //else{ - //$("#" + idItem + ' img').css('margin-left',''); - //} $("#" + idItem + ' > p').remove(); } @@ -577,19 +774,19 @@ function update_button_palette_callback() { $('#' + idItem + ' img').remove(); $('#' + idItem).append(tempoimg); $("#" + idItem + ' table').css('height',''); - $("#" + idItem + ' table').css('width','70'); - $("#" + idItem + ' span').css('width','70'); + if (selectedItem != 'simple_value') { + $("#" + idItem + ' table').css('width','70'); + $("#" + idItem + ' span').css('width','70'); + } + else { + $("#" + idItem + ' table').css('width',''); + $("#" + idItem + ' table').css('text-align','center'); + $("#" + idItem + ' span').css('width',''); + } $("#" + idItem + ' img').css('margin-top',''); - //if(parseInt($("#" + idItem).css('width'))-parseInt($("#" + idItem + " img").css('width'))/2 == 0 || values['height'] == 0 || values['width'] == 0){ - //$("#" + idItem + ' img').css('margin-left',''); - - //} - //else{ - //$("#" + idItem + ' img').css('margin-left',(parseInt($("#" + idItem).css('width'))/2)-(parseInt($("#" + idItem + " img").css('width'))/2)+'px'); - //} + $("#" + idItem + ' > p').remove(); } - } function readFields() { @@ -608,6 +805,8 @@ function readFields() { values['top'] = $("input[name=top]").val(); values['agent'] = $("input[name=agent]").val(); values['id_agent'] = $("input[name=id_agent]").val(); + values['agent_string'] = $("input[name=agent_string]").val(); + values['id_agent_string'] = $("input[name=id_agent_string]").val(); values['module'] = $("select[name=module]").val(); values['process_simple_value'] = $("select[name=process_value]").val(); values['background'] = $("#background_image").val(); @@ -623,7 +822,10 @@ function readFields() { values['bars_graph_type'] = $("select[name=bars_graph_type]").val(); values['parent'] = $("select[name=parent]").val(); values['map_linked'] = $("select[name=map_linked]").val(); + values['element_group'] = $("select[name=element_group]").val(); + values['map_linked_weight'] = $("select[name=map_linked_weight]").val(); values['width_percentile'] = $("input[name=width_percentile]").val(); + values['bars_graph_height'] = $("input[name=bars_graph_height]").val(); values['max_percentile'] = parseInt($("input[name=max_percentile]").val()); values['width_module_graph'] = $("input[name=width_module_graph]").val(); values['height_module_graph'] = $("input[name=height_module_graph]").val(); @@ -643,6 +845,8 @@ function readFields() { values['height_box'] = parseInt( $("input[name='height_box']").val()); values['border_color'] = $("input[name='border_color']").val(); + values['resume_color'] = $("input[name='resume_color']").val(); + values['grid_color'] = $("input[name='grid_color']").val(); values['border_width'] = parseInt( $("input[name='border_width']").val()); values['fill_color'] = $("input[name='fill_color']").val(); @@ -651,6 +855,7 @@ function readFields() { values['line_color'] = $("input[name='line_color']").val(); values['label_position'] = $(".labelpos[sel=yes]").attr('position'); values['show_statistics'] = $("input[name=show_statistics]").is(':checked') ? 1 : 0; + values['show_on_top'] = $("input[name=show_on_top]").is(':checked') ? 1 : 0; if (is_metaconsole()) { values['metaconsole'] = 1; @@ -688,6 +893,11 @@ function create_button_palette_callback() { } break; case 'group_item': + if((values['image'] == '' || values['image'] == 'none') && (values['label'] == '') && (values['show_statistics'] == false)){ + alert('Undefined images'); + validate = false; + } + break; case 'static_graph': if ((values['width'] == '')) { alert('Undefined width'); @@ -697,10 +907,12 @@ function create_button_palette_callback() { alert('Undefined height'); validate = false; } - if ((values['label'] == '') && (values['image'] == '') && (values['show_statistics']) == false) { - alert($("#message_alert_no_label_no_image").html()); + if((values['image'] == '' || values['image'] == 'none') && (values['label']) == false){ + alert('Undefined image'); validate = false; } + + break; case 'auto_sla_graph': if ((values['agent'] == '')) { @@ -709,7 +921,7 @@ function create_button_palette_callback() { } break; case 'donut_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -729,7 +941,7 @@ function create_button_palette_callback() { alert('Undefined height'); validate = false; } - if ((values['image'] == '')) { + if ((values['image'] == '' || values['image'] == 'none')) { alert($("#message_alert_no_image").html()); validate = false; } @@ -782,7 +994,7 @@ function create_button_palette_callback() { } break; case 'bars_graph': - if ((values['agent'] == '')) { + if ((values['agent_string'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; } @@ -790,6 +1002,14 @@ function create_button_palette_callback() { alert($("#message_alert_no_module").html()); validate = false; } + if ((values['width_percentile'] == '')) { + alert($("#message_alert_no_width_percentile").html()); + validate = false; + } + if ((values['bars_graph_height'] == '')) { + alert($("#message_alert_no_bars_graph_height").html()); + validate = false; + } break; case 'simple_value': if ((values['agent'] == '')) { @@ -1076,6 +1296,9 @@ function toggle_item_palette() { } hiddenFields(item); + + $("#show_on_top_row").css('display', 'table-row'); + $("#show_on_top." + item).css('display', 'block'); $("#properties_panel").show("fast"); @@ -1205,6 +1428,17 @@ function loadFieldsFromDB(item) { } } + if (key == 'show_on_top') { + if (val == "1") { + $("input[name=show_on_top]") + .prop("checked", true); + } + else { + $("input[name=show_on_top]") + .prop("checked", false); + } + } + if (key == 'type_graph') { $("select[name=type_graph]").val(val); } @@ -1241,11 +1475,16 @@ function loadFieldsFromDB(item) { if (key == 'pos_y') $("input[name=top]").val(val); if (key == 'agent_name') { $("input[name=agent]").val(val); + $("input[name=agent_string]").val(val); //Reload no-sincrone the select of modules } + if (key == 'id_agent') { $("input[name=id_agent]").val(val); } + if (key == 'id_agent_string') { + $("input[name=id_agent_string]").val(val); + } if (key == 'modules_html') { $("select[name=module]").empty().html(val); $("select[name=module]").val(moduleId); @@ -1288,8 +1527,14 @@ function loadFieldsFromDB(item) { $("select[name=parent]").val(val); if (key == 'id_layout_linked') $("select[name=map_linked]").val(val); + if (key == 'id_layout_linked_weight') + $("select[name=map_linked_weight]").val(val); + if (key == 'element_group') + $("select[name=element_group]").val(val); if (key == 'width_percentile') $("input[name=width_percentile]").val(val); + if (key == 'bars_graph_height') + $("input[name=bars_graph_height]").val(val); if (key == 'max_percentile') $("input[name=max_percentile]").val(val); if (key == 'width_module_graph') @@ -1314,14 +1559,7 @@ function loadFieldsFromDB(item) { } if (key == 'value_show') { - if (val == 'percent') { - $("input[name=value_show][value=percent]") - .attr("checked", "checked"); - } - else { - $("input[name=value_show][value=value]") - .attr("checked", "checked"); - } + $("select[name=value_show]").val(val); } if (key == 'id_group') { @@ -1347,6 +1585,16 @@ function loadFieldsFromDB(item) { $("#border_color_row .ColorPickerDivSample") .css('background-color', val); } + if (key == 'grid_color') { + $("input[name='grid_color']").val(val); + $("#grid_color_row .ColorPickerDivSample") + .css('background-color', val); + } + if (key == 'resume_color') { + $("input[name='resume_color']").val(val); + $("#resume_color_row .ColorPickerDivSample") + .css('background-color', val); + } if (key == 'border_width') $("input[name='border_width']").val(val); if (key == 'fill_color') { @@ -1510,6 +1758,9 @@ function hiddenFields(item) { $("#agent_row").css('display', 'none'); $("#agent_row." + item).css('display', ''); + $("#agent_row_string").css('display', 'none'); + $("#agent_row_string." + item).css('display', ''); + $("#module_row").css('display', 'none'); $("#module_row." + item).css('display', ''); @@ -1537,6 +1788,9 @@ function hiddenFields(item) { $("#percentile_bar_row_1").css('display', 'none'); $("#percentile_bar_row_1." + item).css('display', ''); + $("#height_bars_graph_row").css('display', 'none'); + $("#height_bars_graph_row." + item).css('display', ''); + $("#percentile_bar_row_2").css('display', 'none'); $("#percentile_bar_row_2." + item).css('display', ''); @@ -1546,6 +1800,15 @@ function hiddenFields(item) { $("#percentile_item_row_4").css('display', 'none'); $("#percentile_item_row_4." + item).css('display', ''); + $("#percentile_item_row_5").css('display', 'none'); + $("#percentile_item_row_5." + item).css('display', ''); + + $("#percentile_item_row_6").css('display', 'none'); + $("#percentile_item_row_6." + item).css('display', ''); + + $("#percentile_bar_row_7").css('display', 'none'); + $("#percentile_bar_row_7." + item).css('display', ''); + $("#period_row").css('display', 'none'); $("#period_row." + item).css('display', ''); @@ -1558,6 +1821,12 @@ function hiddenFields(item) { $("#map_linked_row").css('display', 'none'); $("#map_linked_row." + item).css('display', ''); + $("#element_group_row").css('display', 'none'); + $("#element_group_row." + item).css('display', ''); + + $("#map_linked_weight").css('display', 'none'); + $("#map_linked_weight." + item).css('display', ''); + $("#module_graph_size_row").css('display', 'none'); $("#module_graph_size_row." + item).css('display', ''); @@ -1582,6 +1851,12 @@ function hiddenFields(item) { $("#border_color_row").css('display', 'none'); $("#border_color_row." + item).css('display', ''); + $("#grid_color_row").css('display', 'none'); + $("#grid_color_row." + item).css('display', ''); + + $("#resume_color_row").css('display', 'none'); + $("#resume_color_row." + item).css('display', ''); + $("#border_width_row").css('display', 'none'); $("#border_width_row." + item).css('display', ''); @@ -1602,14 +1877,6 @@ function hiddenFields(item) { if (typeof(enterprise_hiddenFields) == 'function') { enterprise_hiddenFields(item); } - - //~ var code_control = tinyMCE.activeEditor.controlManager.controls['text-label_code']; - //~ if (item == 'label') { - //~ code_control.setDisabled(false); - //~ } - //~ else { - //~ code_control.setDisabled(true); - //~ } } function cleanFields(item) { @@ -1619,25 +1886,37 @@ function cleanFields(item) { $("input[name=left]").val(0); $("input[name=top]").val(0); $("input[name=agent]").val(''); + $("input[name=agent_string]").val(''); $("select[name=module]").val(''); $("select[name=process_value]").val(0); $("select[name=background_image]").val(''); $("input[name=width_percentile]").val(''); + $("input[name=bars_graph_height]").val(''); $("input[name=max_percentile]").val(''); $("select[name=period]").val(''); $("input[name=width]").val(0); $("input[name=height]").val(0); $("select[name=parent]").val(''); $("select[name=map_linked]").val(''); + $("select[name=element_group]").val(''); + $("select[name=map_linked_weight]").val(''); $("input[name=width_module_graph]").val(300); $("input[name=height_module_graph]").val(180); $("input[name='width_box']").val(300); $("input[name='height_box']").val(180); $("input[name='border_color']").val('#000000'); + $("input[name='grid_color']").val('#000000'); + $("input[name='resume_color']").val('#000000'); $("input[name='border_width']").val(3); $("input[name='fill_color']").val('#ffffff'); $("input[name='line_width']").val(3); $("input[name='line_color']").val('#000000'); + $("select[name=type_percentile]").val(''); + $("input[name=percentile_color]").val(''); + $("input[name=percentile_label_color]").val(''); + $("input[name=percentile_label]").val(''); + $(".ColorPickerDivSample").css('background-color', '#FFF'); + $("input[name=show_on_top]").prop("checked", false); $("#preview").empty(); @@ -1697,7 +1976,7 @@ function set_static_graph_status(idElement, image, status) { data: parameter, success: function (data) { set_static_graph_status(idElement, image, data); - if(values['show_statistics'] == 1){ + if(data['show_statistics'] == 1){ if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); } @@ -1787,12 +2066,13 @@ function setBarsGraph(id_data, values) { } width_percentile = values['width_percentile']; + bars_graph_height = values['bars_graph_height']; parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); @@ -1802,28 +2082,16 @@ function setBarsGraph(id_data, values) { type: "POST", dataType: 'json', success: function (data) { - if (data['no_data'] == true) { - if (values['width_percentile'] == "0") { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png'); - } - else { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras-no.png'); - $("#" + id_data + " img").css('width', width_percentile + 'px'); - $("#" + id_data + " img").css('height', width_percentile + 'px'); - } + $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png'); + + if (values['width_percentile'] == "0" && values["bars_graph_height"] == "0") { + // Image size } - else { - $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/barras.png'); - - if (values['width_percentile'] == "0") { - // Image size - } - else{ - $("#" + id_data + " img").css('width', width_percentile+'px'); - $("#" + id_data + " img").css('height', width_percentile+'px'); - } + else{ + $("#" + id_data + " img").css('width', width_percentile + 'px'); + $("#" + id_data + " img").css('height', bars_graph_height + 'px'); } - + if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){ $('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2); } @@ -1927,7 +2195,7 @@ function setModuleGraph(id_data) { } -function setModuleValue(id_data, process_simple_value, period,width_data_image) { +function setModuleValue(id_data, process_simple_value, period, width_data_image) { var parameter = Array(); parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_value"}); @@ -1945,12 +2213,9 @@ function setModuleValue(id_data, process_simple_value, period,width_data_image) type: "POST", dataType: 'json', success: function (data) { + var currentValue = $("#text_" + id_data).html(); - var currentValue = $("#text_" + id_data).html(); - - //currentValue = currentValue.replace(/_VALUE_/gi, data.value); $("#text_" + id_data).html(currentValue); - //$("#text_" + id_data).html('Data value'); } }); } @@ -2003,9 +2268,9 @@ function setPercentileBar(id_data, values) { value_text = module_value + " " + unit_text; } - var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar&height=15&' + + var img = url_hack_metaconsole + 'include/graphs/fgraph.php?graph_type=progressbar&height=15&' + 'width=' + width_percentile + '&mode=1&progress=' + percentile + - '&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB; + '&value_text=' + value_text + '&colorRGB=' + colorRGB; $("#"+ id_data).attr('src', img); @@ -2229,8 +2494,8 @@ function setDonutsGraph (id_data, values) { parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_module_type_string"}); - parameter.push ({name: "id_agent", value: values['id_agent']}); - parameter.push ({name: "id_agent_module", value: values['module']}); + parameter.push ({name: "id_agent", value: values['id_agent_string']}); + parameter.push ({name: "module", value: values['module']}); parameter.push ({name: "id_element", value: id_data}); parameter.push ({name: "id_visual_console", value: id_visual_console}); jQuery.ajax({ @@ -2252,7 +2517,7 @@ function setDonutsGraph (id_data, values) { else { $("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png'); - if($('#text-width').val() == 0 || $('#text-height').val() == 0){ + if($('#text-width_percentile').val() == 0){ // Image size } else{ @@ -2309,9 +2574,9 @@ function setPercentileBubble(id_data, values) { value_text = module_value + " " + unit_text; } - var img = url_hack_metaconsole + 'include/graphs/fgraph.php?homeurl=../../&graph_type=progressbubble&height=' + width_percentile + '&' + + var img = url_hack_metaconsole + 'include/graphs/fgraph.php?graph_type=progressbubble&height=' + width_percentile + '&' + 'width=' + width_percentile + '&mode=1&progress=' + percentile + - '&font=' + font + '&value_text=' + value_text + '&colorRGB=' + colorRGB; + '&value_text=' + value_text + '&colorRGB=' + colorRGB; $("#image_" + id_data).attr('src', img); @@ -2454,6 +2719,262 @@ function createItem(type, values, id_data) { break; case 'group_item': + + switch (type) { + case 'group_item': + class_type = "group_item"; + break; + case 'static_graph': + class_type = "static_graph"; + break; + } + + img_src = "images/spinner.gif"; + + item = $('
') + .attr('id', id_data) + .attr('class', 'item ' + class_type) + .css('text-align', 'left') + .css('position', 'absolute') + .css('display', 'inline-block') + .css('top', values['top'] + 'px') + .css('left', values['left'] + 'px'); + + + + if(values['show_statistics'] != 1){ + if(values['label_position'] == 'left'){ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', 'images/console/signes/group_status.png') + .attr('style','float:right;'); + + } + else if(values['label_position'] == 'right'){ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', 'images/console/signes/group_status.png') + .attr('style','float:left;'); + + } + else{ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', 'images/console/signes/group_status.png'); + + } + } + else{ + if(values['label_position'] == 'left'){ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', img_src) + .attr('style','float:right;'); + + } + else if(values['label_position'] == 'right'){ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', img_src) + .attr('style','float:left;'); + + } + else{ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', img_src); + + } + } + + + + if(values['show_statistics'] != 1){ + + if ((values['width'] == 0) || (values['height'] == 0)) { + // Do none + if(values['image'] != '' && values['image'] != 'none'){ + + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $image.attr('width', '70') + .attr('height', '70'); + } + else{ + $image.attr('width', $('#preview > img')[0].naturalWidth) + .attr('height', $('#preview > img')[0].naturalHeight); + } + + + } + else{ + $image.attr('width', '70') + .attr('height', '70'); + } + + + } + else { + $image.attr('width', values['width']) + .attr('height', values['height']); + } + } + + var $input = $('') + .attr('id', 'hidden-status_' + id_data) + .attr('type', 'hidden') + .attr('value', -1) + .attr('name', 'status_' + id_data); + + if(values['label_position'] == 'up'){ + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append('
'+values['label']+'
') + .append($input); + } + else{ + item + .append('
'+values['label']+'
') + .append($image) + .append($image) + .append($input); + } + + } + else if(values['label_position'] == 'down'){ + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append('
'+values['label']+'
') + .append($input); + + } + else{ + item + .append($image) + .append($image) + .append('
'+values['label']+'
') + .append($input); + } + + } + else if(values['label_position'] == 'left'){ + + if(values['height'] == 0){ + item + .append('
'+values['label']+'
'); + } + else{ + item + .append('
'+values['label']+'
') + } + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append($input); + } + else{ + item + .append($image) + .append($image) + .append($input); + } + + + } + else if(values['label_position'] == 'right'){ + if(values['height'] == 0){ + item + .append('
'+values['label']+'
'); + } + else{ + item + .append('
'+values['label']+'
') + } + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append($input); + } + else{ + item + .append($image) + .append($image) + .append($input); + } + + + + } + + if(values['show_statistics'] != 1){ + set_static_graph_status(id_data, values['image']); + } + else{ + set_static_graph_status(id_data, 'show_statistics'); + } + + if(values['show_statistics'] != 1){ + + if ((values['width'] == 0) || (values['height'] == 0)) { + + if(values['image'] != '' && values['image'] != 'none'){ + // Do none + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $image.attr('width', '70') + .attr('height', '70'); + } + else{ + $image.attr('width', $('#preview > img')[0].naturalWidth) + .attr('height', $('#preview > img')[0].naturalHeight); + } + } + else{ + $image.attr('width', '70') + .attr('height', '70'); + } + } + else { + $image.attr('width', values['width']) + .attr('height', values['height']); + } + } + else{ + if ((values['width'] == 0) || (values['height'] == 0)) { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 520); + $("#image_" + idItem).attr('height', 80); + $("#image_" + idItem).css('width', '520px'); + $("#image_" + idItem).css('height', '80px'); + $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); + + } + else { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); + $("#image_" + idItem).attr('src', 'images/console/signes/group_status.png'); + } + } + + break; + case 'static_graph': switch (type) { case 'group_item': @@ -2508,6 +3029,8 @@ function createItem(type, values, id_data) { if ((values['width'] == 0) || (values['height'] == 0)) { // Do none + if(values['image'] != '' && values['image'] != 'none'){ + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ $image.attr('width', '70') .attr('height', '70'); @@ -2515,7 +3038,16 @@ function createItem(type, values, id_data) { else{ $image.attr('width', $('#preview > img')[0].naturalWidth) .attr('height', $('#preview > img')[0].naturalHeight); - } + } + + + } + else{ + $image.attr('width', '70') + .attr('height', '70'); + } + + } else { $image.attr('width', values['width']) @@ -2540,19 +3072,37 @@ function createItem(type, values, id_data) { .attr('name', 'status_' + id_data); if(values['label_position'] == 'up'){ - item - .append('
'+values['label']+'
') - .append($image) - .append($image) - .append($input); + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append('
'+values['label']+'
') + .append($input); + } + else{ + item + .append('
'+values['label']+'
') + .append($image) + .append($image) + .append($input); + } } else if(values['label_position'] == 'down'){ - item - .append($image) - .append($image) - .append('
'+values['label']+'
') - .append($input); + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append('
'+values['label']+'
') + .append($input); + + } + else{ + item + .append($image) + .append($image) + .append('
'+values['label']+'
') + .append($input); + } + } else if(values['label_position'] == 'left'){ @@ -2564,10 +3114,19 @@ function createItem(type, values, id_data) { item .append('
'+values['label']+'
') } + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append($input); + } + else{ item .append($image) .append($image) - .append($input); + .append($input); + } + + } else if(values['label_position'] == 'right'){ if(values['height'] == 0){ @@ -2578,10 +3137,20 @@ function createItem(type, values, id_data) { item .append('
'+values['label']+'
') } + + if(values['image'] == '' || values['image'] == 'none'){ + item + .append($input); + } + else{ item .append($image) .append($image) - .append($input); + .append($input); + } + + + } if(values['show_statistics'] != 1){ @@ -2594,15 +3163,22 @@ function createItem(type, values, id_data) { if(values['show_statistics'] != 1){ if ((values['width'] == 0) || (values['height'] == 0)) { + + if(values['image'] != '' && values['image'] != 'none'){ // Do none - if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ - $image.attr('width', '70') - .attr('height', '70'); + if($('#preview > img')[0].naturalWidth > 150 || $('#preview > img')[0].naturalHeight > 150){ + $image.attr('width', '70') + .attr('height', '70'); + } + else{ + $image.attr('width', $('#preview > img')[0].naturalWidth) + .attr('height', $('#preview > img')[0].naturalHeight); + } } else{ - $image.attr('width', $('#preview > img')[0].naturalWidth) - .attr('height', $('#preview > img')[0].naturalHeight); - } + $image.attr('width', '70') + .attr('height', '70'); + } } else { $image.attr('width', values['width']) @@ -2857,7 +3433,6 @@ function createItem(type, values, id_data) { item = $('
' + ' ' + values['label'] + ' ' + '
' ); - setModuleValue(id_data,values.process_simple_value,values.period,values.width_data_image); break; case 'label': item = $('
0){ - $("#data_image_check").css('display','inline'); - $("#data_image_check_label").css('display','inline'); - $('#data_image_container').css('display','inline'); - $("#data_image_check").html('On'); - $('.block_tinymce').remove(); - $('#label_row').append('
'); - $('#process_value_row').css('display','none'); - $('#period_row').css('display','none'); - } - else{ - $("#data_image_check").html('Off'); - $("#data_image_check").css('display','none'); - $("#data_image_check_label").css('display','none'); - $('#data_image_container').css('display','none'); - $('.block_tinymce').remove(); - $('#process_value_row').css('display','table-row'); - if($('#process_value').val() != 0){ - $('#period_row').css('display','table-row'); + + parameter = Array(); + parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); + parameter.push ({name: "action", value: "get_image_from_module"}); + parameter.push ({name: "id_element", value: idItem}); + parameter.push ({name: "id_visual_console", value: id_visual_console}); + + jQuery.ajax({ + url: "ajax.php", + data: parameter, + type: "POST", + dataType: "json", + success: function(data) { + if(!data['correct']){ + $("#data_image_check").html('Off'); + $('#data_image_container').css('display','none'); + $('#data_image_check').css('display','none'); + $('#data_image_check_label').css('display','none'); + $('.block_tinymce').remove(); + $('#process_value_row').css('display','table-row'); + if($('#process_value').val() != '0'){ + $('#period_row').css('display','table-row'); + } + } + else{ + $('#data_image_container').css('display','inline'); + $('#data_image_check').css('display','inline'); + $('#data_image_check_label').css('display','inline'); + $("#data_image_check").html('On'); + $('#process_value_row').css('display','none'); + $('#period_row').css('display','none'); + $('#text-label_ifr').contents().find('#tinymce').html('_VALUE_'); + $('.block_tinymce').remove(); + $('#label_row').append('
'); + } } - } + }); } else{ $("#data_image_check").css('display','none'); @@ -3958,6 +4556,8 @@ function eventsBackground() { if ((!is_opened_palette) && (autosave)) { toggle_item_palette(); } + $("#show_on_top_row").css('display', 'none'); + $("#show_on_top." + item).css('display', ''); }); } @@ -4202,7 +4802,17 @@ function showPreviewStaticGraph(staticGraph) { .css('text-align', 'right') .append($spinner); - if (staticGraph != '') { + if(staticGraph == '' || staticGraph == 'none'){ + + if (is_metaconsole()) { + $spinner.prop("src", "../../images/image_problem_area.png"); + } + else{ + $spinner.prop("src", "images/image_problem_area.png"); + } + $('#preview > img').css({'max-width':'100px','max-height':'100px'}); + } + else{ imgBase = "images/console/icons/" + staticGraph; var parameter = Array(); @@ -4247,7 +4857,17 @@ function showPreviewIcon(icon) { .css('text-align', 'left') .append($spinner); - if (icon != '') { + + if (icon == '' || icon == 'none') { + if (is_metaconsole()) { + $spinner.prop("src", "../../images/image_problem_area.png"); + } + else{ + $spinner.prop("src", "images/image_problem_area.png"); + } + $('#preview > img').css({'max-width':'100px','max-height':'100px'}); + } + else{ imgBase = "images/console/icons/" + icon; var params = []; diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 88ea386ee6..c84cb95f9c 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -180,6 +180,7 @@ ui_require_javascript_file ('encode_decode_base64'); tinyMCE.init({ mode : "exact", elements: "text-label", + convert_urls: false, theme : "advanced", item per module; item_per_agent <> 0 => item per agent $item_per_agent = get_parameter ("item_per_agent", 0); $id_server = (int)get_parameter('servers', 0); diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 1b18f0f7ec..96893aa091 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -106,6 +106,18 @@ if (is_ajax ()) { $row['name'] = __('Login attribute'); $row['control'] = html_print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true); $table->data['ldap_login_attr'] = $row; + + // Admin LDAP login + $row = array(); + $row['name'] = __('Admin LDAP login'); + $row['control'] = html_print_input_text ('ldap_admin_login', $config['ldap_admin_login'], '', 60, 100, true); + $table->data['ldap_admin_login'] = $row; + + // Admin LDAP password + $row = array(); + $row['name'] = __('Admin LDAP password'); + $row['control'] = html_print_input_password ('ldap_admin_pass', $config['ldap_admin_pass'], $alt = '', 60, 100, true); + $table->data['ldap_admin_pass'] = $row; break; case 'pandora': diff --git a/pandora_console/godmode/snmpconsole/snmp_filters.php b/pandora_console/godmode/snmpconsole/snmp_filters.php index 085b23957d..9316b36b05 100644 --- a/pandora_console/godmode/snmpconsole/snmp_filters.php +++ b/pandora_console/godmode/snmpconsole/snmp_filters.php @@ -28,6 +28,7 @@ $update_filter = (int) get_parameter ('update_filter', -2); $delete_filter = (int) get_parameter ('delete_filter', -1); $description = (string) get_parameter ('description', ''); $filter = (string) get_parameter ('filter', ''); +$index_post = (int) get_parameter('index_post', 0); // Create/update header if ($edit_filter > -2) { @@ -44,9 +45,35 @@ else {// Overview header // Create/update filter if ($update_filter > -2) { + // UPDATE if ($update_filter > -1) { - $values = array('description' => $description, 'filter' => $filter); - $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $update_filter)); + $new_unified_id = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $update_filter)); + $elements = get_parameter('elements', array()); + + $elements = explode(",", $elements); + foreach ($elements as $e) { + $filter = get_parameter('filter_' . $e); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $e)); + } + if (count($elements) == 1) { + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + + $filter = get_parameter('filter_' . $elements[0]); + $values = array('description' => $description, 'filter' => $filter, 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_update('tsnmp_filter', $values, array('id_snmp_filter' => $elements[0])); + } + for ($i = 1; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + if ($filter != "") { + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + } + if ($result === false) { ui_print_error_message (__('There was a problem updating the filter')); } @@ -54,11 +81,29 @@ if ($update_filter > -2) { ui_print_success_message (__('Successfully updated')); } } + // CREATE else { - $values = array( - 'description' => $description, - 'filter' => $filter); - $result = db_process_sql_insert('tsnmp_filter', $values); + $new_unified_id = (db_get_value_sql("SELECT MAX(unified_filters_id) FROM tsnmp_filter")) + 1; + + if ($index_post == 1) { + $filter = get_parameter('filter_0'); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => 0); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + else { + for ($i = 0; $i < $index_post; $i++) { + $filter = get_parameter('filter_' . $i); + $values = array( + 'description' => $description, + 'filter' => $filter, + 'unified_filters_id' => $new_unified_id); + $result = db_process_sql_insert('tsnmp_filter', $values); + } + } + if ($result === false) { ui_print_error_message (__('There was a problem creating the filter')); } @@ -68,7 +113,15 @@ if ($update_filter > -2) { } } else if ($delete_filter > -1) { // Delete - $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); + $unified_id_to_delete = (db_get_value_sql("SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $delete_filter)); + + if ($unified_id_to_delete == 0) { + $result = db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $delete_filter)); + } + else { + $result = db_process_sql_delete('tsnmp_filter', array('unified_filters_id' => $unified_id_to_delete)); + } + if ($result === false) { ui_print_error_message (__('There was a problem deleting the filter')); } @@ -88,19 +141,50 @@ if ($edit_filter > -1) { // Create/update form if ($edit_filter > -2) { + $index = $index_post; $table->data = array (); + $table->id = 'filter_table'; $table->width = '100%'; $table->class = 'databox filters'; $table->data[0][0] = __('Description'); $table->data[0][1] = html_print_input_text ('description', $description, '', 60, 100, true); $table->data[1][0] = __('Filter'); - $table->data[1][1] = html_print_input_text ('filter', $filter, '', 60, 100, true); - $table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); - + if ($edit_filter > -1) { + $filters = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = (SELECT unified_filters_id FROM tsnmp_filter WHERE id_snmp_filter = " . $edit_filter . ")"); + $j = 1; + foreach ($filters as $f) { + if ($j != 1) { + $table->data[$j][0] = ""; + } + $table->data[$j][1] = html_print_input_text ('filter_' . $f['id_snmp_filter'], $f['filter'], '', 60, 100, true); + if ($j == 1) { + $table->data[$j][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); + } + else { + $table->data[$j][1] .= html_print_image('images/cross.png', true, array('id' => 'delete_filter_' . $f['id_snmp_filter'], 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'))); + } + $j++; + $index++; + } + } + else { + $table->data[1][1] = html_print_input_text ('filter_' . $index, $filter, '', 60, 100, true); + $table->data[1][1] .= ui_print_help_tip (__("This field contains a substring, could be part of a IP address, a numeric OID, or a plain substring") . SEPARATOR_COLUMN, true); + } + $index++; echo '
'; html_print_input_hidden ('update_filter', $edit_filter); + html_print_input_hidden ('index_post', $index); + if ($edit_filter > -1) { + $filters_to_post = array(); + foreach ($filters as $fil) { + $filters_to_post[] = $fil['id_snmp_filter']; + } + html_print_input_hidden ('elements', implode(",", $filters_to_post)); + } html_print_table ($table); echo '
'; + html_print_image('images/add.png', false, array('id' => 'add_filter', 'alt' => __('Click to add new filter'), 'title' => __('Click to add new filter'), 'style' => 'float:left;')); if ($edit_filter > -1) { html_print_submit_button (__('Update'), 'submit_button', false, 'class="sub upd"'); } @@ -112,13 +196,13 @@ if ($edit_filter > -2) { // Overview } else { - $result = db_get_all_rows_in_table ("tsnmp_filter"); - if ($result === false) { - $result = array (); - require_once ($config['homedir'] . "/general/firts_task/snmp_filters.php"); - return; + $result_unified = db_get_all_rows_sql("SELECT DISTINCT(unified_filters_id) FROM tsnmp_filter ORDER BY unified_filters_id ASC"); + + $aglomerate_result = array(); + foreach ($result_unified as $res) { + $aglomerate_result[$res['unified_filters_id']] = db_get_all_rows_sql("SELECT * FROM tsnmp_filter WHERE unified_filters_id = " . $res['unified_filters_id'] . " ORDER BY id_snmp_filter ASC"); } - + $table->data = array (); $table->head = array (); $table->size = array (); @@ -133,16 +217,43 @@ else { $table->head[2] = __('Action'); $table->size[2] = "50px"; $table->align[2] = 'center'; - - foreach ($result as $row) { - $data = array (); - $data[0] = '' . $row['description'] . ''; - $data[1] = $row['filter']; - $data[2] = '' . - html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . - '  ' . - html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; - array_push ($table->data, $data); + + foreach ($aglomerate_result as $ind => $row) { + if ($ind == 0) { + foreach ($row as $r) { + $data = array (); + $data[0] = '' . $r['description'] . ''; + $data[1] = $r['filter']; + $data[2] = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . + '  ' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; + array_push ($table->data, $data); + } + } + else { + $ind2 = 0; + $compose_filter = array(); + $compose_id = ""; + $compose_action = ""; + foreach ($row as $i => $r) { + if ($ind2 == 0) { + $compose_id = '' . $r['description'] . ''; + $compose_action = '' . + html_print_image("images/config.png", true, array("border" => '0', "alt" => __('Update'))) . '' . + '  ' . + html_print_image("images/cross.png", true, array("border" => '0', "alt" => __('Delete'))) . ''; + $ind2++; + } + $compose_filter[] = $r['filter']; + } + $data = array (); + $data[0] = $compose_id; + $data[1] = implode(" AND ", $compose_filter); + $data[2] = $compose_action; + array_push ($table->data, $data); + } + } if (!empty ($table->data)) { @@ -157,3 +268,44 @@ else { echo '
'; } ?> + + diff --git a/pandora_console/images/groups_small/application_osx_terminal.bad.png b/pandora_console/images/groups_small/application_osx_terminal.bad.png index ccc8f3f04d..3862246d9e 100644 Binary files a/pandora_console/images/groups_small/application_osx_terminal.bad.png and b/pandora_console/images/groups_small/application_osx_terminal.bad.png differ diff --git a/pandora_console/images/groups_small/application_osx_terminal.default.png b/pandora_console/images/groups_small/application_osx_terminal.default.png index 85f0016ce2..7ddaec3117 100644 Binary files a/pandora_console/images/groups_small/application_osx_terminal.default.png and b/pandora_console/images/groups_small/application_osx_terminal.default.png differ diff --git a/pandora_console/images/groups_small/application_osx_terminal.ok.png b/pandora_console/images/groups_small/application_osx_terminal.ok.png index 0678cb09a1..1da9e887bf 100644 Binary files a/pandora_console/images/groups_small/application_osx_terminal.ok.png and b/pandora_console/images/groups_small/application_osx_terminal.ok.png differ diff --git a/pandora_console/images/groups_small/application_osx_terminal.warning.png b/pandora_console/images/groups_small/application_osx_terminal.warning.png index e95f210a5f..41fcb8eaf0 100644 Binary files a/pandora_console/images/groups_small/application_osx_terminal.warning.png and b/pandora_console/images/groups_small/application_osx_terminal.warning.png differ diff --git a/pandora_console/images/groups_small/bricks.bad.png b/pandora_console/images/groups_small/bricks.bad.png index 0a0cd5459f..5f22537353 100644 Binary files a/pandora_console/images/groups_small/bricks.bad.png and b/pandora_console/images/groups_small/bricks.bad.png differ diff --git a/pandora_console/images/groups_small/bricks.default.png b/pandora_console/images/groups_small/bricks.default.png index 14d8bab5ca..1fccda728d 100644 Binary files a/pandora_console/images/groups_small/bricks.default.png and b/pandora_console/images/groups_small/bricks.default.png differ diff --git a/pandora_console/images/groups_small/bricks.ok.png b/pandora_console/images/groups_small/bricks.ok.png index 931d1a389c..304efe93df 100644 Binary files a/pandora_console/images/groups_small/bricks.ok.png and b/pandora_console/images/groups_small/bricks.ok.png differ diff --git a/pandora_console/images/groups_small/bricks.png b/pandora_console/images/groups_small/bricks.png index c234efafb6..d197f3fd56 100644 Binary files a/pandora_console/images/groups_small/bricks.png and b/pandora_console/images/groups_small/bricks.png differ diff --git a/pandora_console/images/groups_small/bricks.warning.png b/pandora_console/images/groups_small/bricks.warning.png index bbfeb0ce3f..0345d612f3 100644 Binary files a/pandora_console/images/groups_small/bricks.warning.png and b/pandora_console/images/groups_small/bricks.warning.png differ diff --git a/pandora_console/images/groups_small/chart_organisation.bad.png b/pandora_console/images/groups_small/chart_organisation.bad.png index 410cd5116c..51771a4664 100644 Binary files a/pandora_console/images/groups_small/chart_organisation.bad.png and b/pandora_console/images/groups_small/chart_organisation.bad.png differ diff --git a/pandora_console/images/groups_small/chart_organisation.default.png b/pandora_console/images/groups_small/chart_organisation.default.png index 53619a608b..597c229fa0 100644 Binary files a/pandora_console/images/groups_small/chart_organisation.default.png and b/pandora_console/images/groups_small/chart_organisation.default.png differ diff --git a/pandora_console/images/groups_small/chart_organisation.ok.png b/pandora_console/images/groups_small/chart_organisation.ok.png index ca7f04061b..5d34f43765 100644 Binary files a/pandora_console/images/groups_small/chart_organisation.ok.png and b/pandora_console/images/groups_small/chart_organisation.ok.png differ diff --git a/pandora_console/images/groups_small/chart_organisation.warning.png b/pandora_console/images/groups_small/chart_organisation.warning.png index c9ba529187..7dac5502fc 100644 Binary files a/pandora_console/images/groups_small/chart_organisation.warning.png and b/pandora_console/images/groups_small/chart_organisation.warning.png differ diff --git a/pandora_console/images/groups_small/clock.bad.png b/pandora_console/images/groups_small/clock.bad.png index f281439c87..c1241ce275 100644 Binary files a/pandora_console/images/groups_small/clock.bad.png and b/pandora_console/images/groups_small/clock.bad.png differ diff --git a/pandora_console/images/groups_small/clock.default.png b/pandora_console/images/groups_small/clock.default.png index 2b7a58aa20..b8d58d6dec 100644 Binary files a/pandora_console/images/groups_small/clock.default.png and b/pandora_console/images/groups_small/clock.default.png differ diff --git a/pandora_console/images/groups_small/clock.ok.png b/pandora_console/images/groups_small/clock.ok.png index a3cb173d9e..1ab3c8383f 100644 Binary files a/pandora_console/images/groups_small/clock.ok.png and b/pandora_console/images/groups_small/clock.ok.png differ diff --git a/pandora_console/images/groups_small/clock.warning.png b/pandora_console/images/groups_small/clock.warning.png index 20880b31df..a06ceda51f 100644 Binary files a/pandora_console/images/groups_small/clock.warning.png and b/pandora_console/images/groups_small/clock.warning.png differ diff --git a/pandora_console/images/groups_small/drive.network.bad.png b/pandora_console/images/groups_small/drive.network.bad.png new file mode 100644 index 0000000000..886ca44d2b Binary files /dev/null and b/pandora_console/images/groups_small/drive.network.bad.png differ diff --git a/pandora_console/images/groups_small/drive_network.default.png b/pandora_console/images/groups_small/drive_network.default.png index 428b2eb2a4..2fd2519029 100644 Binary files a/pandora_console/images/groups_small/drive_network.default.png and b/pandora_console/images/groups_small/drive_network.default.png differ diff --git a/pandora_console/images/groups_small/drive_network.ok.png b/pandora_console/images/groups_small/drive_network.ok.png index dbe58f007c..c84acaa7f4 100644 Binary files a/pandora_console/images/groups_small/drive_network.ok.png and b/pandora_console/images/groups_small/drive_network.ok.png differ diff --git a/pandora_console/images/groups_small/drive_network.warning.png b/pandora_console/images/groups_small/drive_network.warning.png index 0dbdd4b2a5..3abda093e3 100644 Binary files a/pandora_console/images/groups_small/drive_network.warning.png and b/pandora_console/images/groups_small/drive_network.warning.png differ diff --git a/pandora_console/images/groups_small/email.bad.png b/pandora_console/images/groups_small/email.bad.png index 064222d63e..78a2ed0913 100644 Binary files a/pandora_console/images/groups_small/email.bad.png and b/pandora_console/images/groups_small/email.bad.png differ diff --git a/pandora_console/images/groups_small/email.default.png b/pandora_console/images/groups_small/email.default.png index 1486cd82a0..e07d9c3022 100644 Binary files a/pandora_console/images/groups_small/email.default.png and b/pandora_console/images/groups_small/email.default.png differ diff --git a/pandora_console/images/groups_small/email.ok.png b/pandora_console/images/groups_small/email.ok.png index 681fc2ddfa..5d5fca4f0c 100644 Binary files a/pandora_console/images/groups_small/email.ok.png and b/pandora_console/images/groups_small/email.ok.png differ diff --git a/pandora_console/images/groups_small/email.warning.png b/pandora_console/images/groups_small/email.warning.png index b08c99d7c1..10662435e1 100644 Binary files a/pandora_console/images/groups_small/email.warning.png and b/pandora_console/images/groups_small/email.warning.png differ diff --git a/pandora_console/images/groups_small/eye.bad.png b/pandora_console/images/groups_small/eye.bad.png index f8191a1b17..9c08baf0a3 100644 Binary files a/pandora_console/images/groups_small/eye.bad.png and b/pandora_console/images/groups_small/eye.bad.png differ diff --git a/pandora_console/images/groups_small/eye.default.png b/pandora_console/images/groups_small/eye.default.png index cd852b7502..a8dc65e8be 100644 Binary files a/pandora_console/images/groups_small/eye.default.png and b/pandora_console/images/groups_small/eye.default.png differ diff --git a/pandora_console/images/groups_small/eye.ok.png b/pandora_console/images/groups_small/eye.ok.png index 0da4304f71..abf8578709 100644 Binary files a/pandora_console/images/groups_small/eye.ok.png and b/pandora_console/images/groups_small/eye.ok.png differ diff --git a/pandora_console/images/groups_small/eye.warning.png b/pandora_console/images/groups_small/eye.warning.png index 65a5722201..2bd3af45f8 100644 Binary files a/pandora_console/images/groups_small/eye.warning.png and b/pandora_console/images/groups_small/eye.warning.png differ diff --git a/pandora_console/images/groups_small/heart.bad.png b/pandora_console/images/groups_small/heart.bad.png index ff3008fcc4..f9da31b2c5 100644 Binary files a/pandora_console/images/groups_small/heart.bad.png and b/pandora_console/images/groups_small/heart.bad.png differ diff --git a/pandora_console/images/groups_small/heart.default.png b/pandora_console/images/groups_small/heart.default.png index a7cfff0cc3..73a101809a 100644 Binary files a/pandora_console/images/groups_small/heart.default.png and b/pandora_console/images/groups_small/heart.default.png differ diff --git a/pandora_console/images/groups_small/heart.ok.png b/pandora_console/images/groups_small/heart.ok.png index 0f0798523d..0b2b4e0653 100644 Binary files a/pandora_console/images/groups_small/heart.ok.png and b/pandora_console/images/groups_small/heart.ok.png differ diff --git a/pandora_console/images/groups_small/heart.warning.png b/pandora_console/images/groups_small/heart.warning.png index 66b8583393..f97cc1251b 100644 Binary files a/pandora_console/images/groups_small/heart.warning.png and b/pandora_console/images/groups_small/heart.warning.png differ diff --git a/pandora_console/images/groups_small/house.bad.png b/pandora_console/images/groups_small/house.bad.png index 815f719f7c..a7dcd9b6fd 100644 Binary files a/pandora_console/images/groups_small/house.bad.png and b/pandora_console/images/groups_small/house.bad.png differ diff --git a/pandora_console/images/groups_small/house.default.png b/pandora_console/images/groups_small/house.default.png index fac912b267..07b9842b2d 100644 Binary files a/pandora_console/images/groups_small/house.default.png and b/pandora_console/images/groups_small/house.default.png differ diff --git a/pandora_console/images/groups_small/house.ok.png b/pandora_console/images/groups_small/house.ok.png index c3a2e9053e..9190bfd075 100644 Binary files a/pandora_console/images/groups_small/house.ok.png and b/pandora_console/images/groups_small/house.ok.png differ diff --git a/pandora_console/images/groups_small/house.warning.png b/pandora_console/images/groups_small/house.warning.png index cf76552f5f..27ba33bca9 100644 Binary files a/pandora_console/images/groups_small/house.warning.png and b/pandora_console/images/groups_small/house.warning.png differ diff --git a/pandora_console/images/groups_small/images.bad.png b/pandora_console/images/groups_small/images.bad.png index 454b36e1d5..cdcb423d83 100644 Binary files a/pandora_console/images/groups_small/images.bad.png and b/pandora_console/images/groups_small/images.bad.png differ diff --git a/pandora_console/images/groups_small/images.default.png b/pandora_console/images/groups_small/images.default.png index 501a97fe27..04b186e57f 100644 Binary files a/pandora_console/images/groups_small/images.default.png and b/pandora_console/images/groups_small/images.default.png differ diff --git a/pandora_console/images/groups_small/images.ok.png b/pandora_console/images/groups_small/images.ok.png index 530af4f4c4..0936d2f2e0 100644 Binary files a/pandora_console/images/groups_small/images.ok.png and b/pandora_console/images/groups_small/images.ok.png differ diff --git a/pandora_console/images/groups_small/images.warning.png b/pandora_console/images/groups_small/images.warning.png index 46cd29d989..f735403dc8 100644 Binary files a/pandora_console/images/groups_small/images.warning.png and b/pandora_console/images/groups_small/images.warning.png differ diff --git a/pandora_console/images/groups_small/lightning.bad.png b/pandora_console/images/groups_small/lightning.bad.png index a6ec10a2bc..dc4de71df3 100644 Binary files a/pandora_console/images/groups_small/lightning.bad.png and b/pandora_console/images/groups_small/lightning.bad.png differ diff --git a/pandora_console/images/groups_small/lightning.default.png b/pandora_console/images/groups_small/lightning.default.png index 47447d48be..b50d496caa 100644 Binary files a/pandora_console/images/groups_small/lightning.default.png and b/pandora_console/images/groups_small/lightning.default.png differ diff --git a/pandora_console/images/groups_small/lightning.ok.png b/pandora_console/images/groups_small/lightning.ok.png index 7dee1c4a81..7b134afecf 100644 Binary files a/pandora_console/images/groups_small/lightning.ok.png and b/pandora_console/images/groups_small/lightning.ok.png differ diff --git a/pandora_console/images/groups_small/lightning.warning.png b/pandora_console/images/groups_small/lightning.warning.png index 020cfe9ac7..3182a8aa72 100644 Binary files a/pandora_console/images/groups_small/lightning.warning.png and b/pandora_console/images/groups_small/lightning.warning.png differ diff --git a/pandora_console/images/groups_small/lock.bad.png b/pandora_console/images/groups_small/lock.bad.png index 29fecde26d..0f25d5361b 100644 Binary files a/pandora_console/images/groups_small/lock.bad.png and b/pandora_console/images/groups_small/lock.bad.png differ diff --git a/pandora_console/images/groups_small/lock.default.png b/pandora_console/images/groups_small/lock.default.png index d462751473..b3958972ed 100644 Binary files a/pandora_console/images/groups_small/lock.default.png and b/pandora_console/images/groups_small/lock.default.png differ diff --git a/pandora_console/images/groups_small/lock.ok.png b/pandora_console/images/groups_small/lock.ok.png index fb9a8749bd..06e639a7bf 100644 Binary files a/pandora_console/images/groups_small/lock.ok.png and b/pandora_console/images/groups_small/lock.ok.png differ diff --git a/pandora_console/images/groups_small/lock.warning.png b/pandora_console/images/groups_small/lock.warning.png index bfb2826d31..9cd24bc69b 100644 Binary files a/pandora_console/images/groups_small/lock.warning.png and b/pandora_console/images/groups_small/lock.warning.png differ diff --git a/pandora_console/images/groups_small/network.bad.png b/pandora_console/images/groups_small/network.bad.png index f3293d77ac..fec08fa66b 100644 Binary files a/pandora_console/images/groups_small/network.bad.png and b/pandora_console/images/groups_small/network.bad.png differ diff --git a/pandora_console/images/groups_small/network.default.png b/pandora_console/images/groups_small/network.default.png index c330e90893..6b2107017f 100644 Binary files a/pandora_console/images/groups_small/network.default.png and b/pandora_console/images/groups_small/network.default.png differ diff --git a/pandora_console/images/groups_small/network.ok.png b/pandora_console/images/groups_small/network.ok.png index edd8831666..ce767cf880 100644 Binary files a/pandora_console/images/groups_small/network.ok.png and b/pandora_console/images/groups_small/network.ok.png differ diff --git a/pandora_console/images/groups_small/network.warning.png b/pandora_console/images/groups_small/network.warning.png index 6ddd996e56..66a55e22b4 100644 Binary files a/pandora_console/images/groups_small/network.warning.png and b/pandora_console/images/groups_small/network.warning.png differ diff --git a/pandora_console/images/groups_small/old/application_osx_terminal.bad.png b/pandora_console/images/groups_small/old/application_osx_terminal.bad.png new file mode 100644 index 0000000000..ccc8f3f04d Binary files /dev/null and b/pandora_console/images/groups_small/old/application_osx_terminal.bad.png differ diff --git a/pandora_console/images/groups_small/old/application_osx_terminal.default.png b/pandora_console/images/groups_small/old/application_osx_terminal.default.png new file mode 100644 index 0000000000..85f0016ce2 Binary files /dev/null and b/pandora_console/images/groups_small/old/application_osx_terminal.default.png differ diff --git a/pandora_console/images/groups_small/old/application_osx_terminal.ok.png b/pandora_console/images/groups_small/old/application_osx_terminal.ok.png new file mode 100644 index 0000000000..0678cb09a1 Binary files /dev/null and b/pandora_console/images/groups_small/old/application_osx_terminal.ok.png differ diff --git a/pandora_console/images/groups_small/old/application_osx_terminal.warning.png b/pandora_console/images/groups_small/old/application_osx_terminal.warning.png new file mode 100644 index 0000000000..e95f210a5f Binary files /dev/null and b/pandora_console/images/groups_small/old/application_osx_terminal.warning.png differ diff --git a/pandora_console/images/groups_small/applications.bad_old.png b/pandora_console/images/groups_small/old/applications.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/applications.bad_old.png rename to pandora_console/images/groups_small/old/applications.bad_old.png diff --git a/pandora_console/images/groups_small/applications.default_old.png b/pandora_console/images/groups_small/old/applications.default_old.png similarity index 100% rename from pandora_console/images/groups_small/applications.default_old.png rename to pandora_console/images/groups_small/old/applications.default_old.png diff --git a/pandora_console/images/groups_small/applications.ok_old.png b/pandora_console/images/groups_small/old/applications.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/applications.ok_old.png rename to pandora_console/images/groups_small/old/applications.ok_old.png diff --git a/pandora_console/images/groups_small/applications.warning_old.png b/pandora_console/images/groups_small/old/applications.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/applications.warning_old.png rename to pandora_console/images/groups_small/old/applications.warning_old.png diff --git a/pandora_console/images/groups_small/old/bricks.bad.png b/pandora_console/images/groups_small/old/bricks.bad.png new file mode 100644 index 0000000000..0a0cd5459f Binary files /dev/null and b/pandora_console/images/groups_small/old/bricks.bad.png differ diff --git a/pandora_console/images/groups_small/old/bricks.default.png b/pandora_console/images/groups_small/old/bricks.default.png new file mode 100644 index 0000000000..14d8bab5ca Binary files /dev/null and b/pandora_console/images/groups_small/old/bricks.default.png differ diff --git a/pandora_console/images/groups_small/old/bricks.ok.png b/pandora_console/images/groups_small/old/bricks.ok.png new file mode 100644 index 0000000000..931d1a389c Binary files /dev/null and b/pandora_console/images/groups_small/old/bricks.ok.png differ diff --git a/pandora_console/images/groups_small/old/bricks.warning.png b/pandora_console/images/groups_small/old/bricks.warning.png new file mode 100644 index 0000000000..bbfeb0ce3f Binary files /dev/null and b/pandora_console/images/groups_small/old/bricks.warning.png differ diff --git a/pandora_console/images/groups_small/old/chart_organisation.bad.png b/pandora_console/images/groups_small/old/chart_organisation.bad.png new file mode 100644 index 0000000000..410cd5116c Binary files /dev/null and b/pandora_console/images/groups_small/old/chart_organisation.bad.png differ diff --git a/pandora_console/images/groups_small/old/chart_organisation.default.png b/pandora_console/images/groups_small/old/chart_organisation.default.png new file mode 100644 index 0000000000..53619a608b Binary files /dev/null and b/pandora_console/images/groups_small/old/chart_organisation.default.png differ diff --git a/pandora_console/images/groups_small/old/chart_organisation.ok.png b/pandora_console/images/groups_small/old/chart_organisation.ok.png new file mode 100644 index 0000000000..ca7f04061b Binary files /dev/null and b/pandora_console/images/groups_small/old/chart_organisation.ok.png differ diff --git a/pandora_console/images/groups_small/old/chart_organisation.warning.png b/pandora_console/images/groups_small/old/chart_organisation.warning.png new file mode 100644 index 0000000000..c9ba529187 Binary files /dev/null and b/pandora_console/images/groups_small/old/chart_organisation.warning.png differ diff --git a/pandora_console/images/groups_small/old/clock.bad.png b/pandora_console/images/groups_small/old/clock.bad.png new file mode 100644 index 0000000000..f281439c87 Binary files /dev/null and b/pandora_console/images/groups_small/old/clock.bad.png differ diff --git a/pandora_console/images/groups_small/old/clock.default.png b/pandora_console/images/groups_small/old/clock.default.png new file mode 100644 index 0000000000..2b7a58aa20 Binary files /dev/null and b/pandora_console/images/groups_small/old/clock.default.png differ diff --git a/pandora_console/images/groups_small/old/clock.ok.png b/pandora_console/images/groups_small/old/clock.ok.png new file mode 100644 index 0000000000..a3cb173d9e Binary files /dev/null and b/pandora_console/images/groups_small/old/clock.ok.png differ diff --git a/pandora_console/images/groups_small/old/clock.warning.png b/pandora_console/images/groups_small/old/clock.warning.png new file mode 100644 index 0000000000..20880b31df Binary files /dev/null and b/pandora_console/images/groups_small/old/clock.warning.png differ diff --git a/pandora_console/images/groups_small/computer.bad_old.png b/pandora_console/images/groups_small/old/computer.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/computer.bad_old.png rename to pandora_console/images/groups_small/old/computer.bad_old.png diff --git a/pandora_console/images/groups_small/computer.default_old.png b/pandora_console/images/groups_small/old/computer.default_old.png similarity index 100% rename from pandora_console/images/groups_small/computer.default_old.png rename to pandora_console/images/groups_small/old/computer.default_old.png diff --git a/pandora_console/images/groups_small/computer.ok_old.png b/pandora_console/images/groups_small/old/computer.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/computer.ok_old.png rename to pandora_console/images/groups_small/old/computer.ok_old.png diff --git a/pandora_console/images/groups_small/computer.warning_old.png b/pandora_console/images/groups_small/old/computer.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/computer.warning_old.png rename to pandora_console/images/groups_small/old/computer.warning_old.png diff --git a/pandora_console/images/groups_small/database_gear.bad_old.png b/pandora_console/images/groups_small/old/database_gear.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/database_gear.bad_old.png rename to pandora_console/images/groups_small/old/database_gear.bad_old.png diff --git a/pandora_console/images/groups_small/database_gear.default_old.png b/pandora_console/images/groups_small/old/database_gear.default_old.png similarity index 100% rename from pandora_console/images/groups_small/database_gear.default_old.png rename to pandora_console/images/groups_small/old/database_gear.default_old.png diff --git a/pandora_console/images/groups_small/database_gear.ok_old.png b/pandora_console/images/groups_small/old/database_gear.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/database_gear.ok_old.png rename to pandora_console/images/groups_small/old/database_gear.ok_old.png diff --git a/pandora_console/images/groups_small/database_gear.warning_old.png b/pandora_console/images/groups_small/old/database_gear.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/database_gear.warning_old.png rename to pandora_console/images/groups_small/old/database_gear.warning_old.png diff --git a/pandora_console/images/groups_small/drive_network.bad.png b/pandora_console/images/groups_small/old/drive_network.bad.png similarity index 100% rename from pandora_console/images/groups_small/drive_network.bad.png rename to pandora_console/images/groups_small/old/drive_network.bad.png diff --git a/pandora_console/images/groups_small/old/drive_network.default.png b/pandora_console/images/groups_small/old/drive_network.default.png new file mode 100644 index 0000000000..428b2eb2a4 Binary files /dev/null and b/pandora_console/images/groups_small/old/drive_network.default.png differ diff --git a/pandora_console/images/groups_small/old/drive_network.ok.png b/pandora_console/images/groups_small/old/drive_network.ok.png new file mode 100644 index 0000000000..dbe58f007c Binary files /dev/null and b/pandora_console/images/groups_small/old/drive_network.ok.png differ diff --git a/pandora_console/images/groups_small/old/drive_network.png b/pandora_console/images/groups_small/old/drive_network.png new file mode 100644 index 0000000000..952cf5352c Binary files /dev/null and b/pandora_console/images/groups_small/old/drive_network.png differ diff --git a/pandora_console/images/groups_small/old/drive_network.warning.png b/pandora_console/images/groups_small/old/drive_network.warning.png new file mode 100644 index 0000000000..0dbdd4b2a5 Binary files /dev/null and b/pandora_console/images/groups_small/old/drive_network.warning.png differ diff --git a/pandora_console/images/groups_small/old/email.bad.png b/pandora_console/images/groups_small/old/email.bad.png new file mode 100644 index 0000000000..064222d63e Binary files /dev/null and b/pandora_console/images/groups_small/old/email.bad.png differ diff --git a/pandora_console/images/groups_small/old/email.default.png b/pandora_console/images/groups_small/old/email.default.png new file mode 100644 index 0000000000..1486cd82a0 Binary files /dev/null and b/pandora_console/images/groups_small/old/email.default.png differ diff --git a/pandora_console/images/groups_small/old/email.ok.png b/pandora_console/images/groups_small/old/email.ok.png new file mode 100644 index 0000000000..681fc2ddfa Binary files /dev/null and b/pandora_console/images/groups_small/old/email.ok.png differ diff --git a/pandora_console/images/groups_small/old/email.warning.png b/pandora_console/images/groups_small/old/email.warning.png new file mode 100644 index 0000000000..b08c99d7c1 Binary files /dev/null and b/pandora_console/images/groups_small/old/email.warning.png differ diff --git a/pandora_console/images/groups_small/old/eye.bad.png b/pandora_console/images/groups_small/old/eye.bad.png new file mode 100644 index 0000000000..f8191a1b17 Binary files /dev/null and b/pandora_console/images/groups_small/old/eye.bad.png differ diff --git a/pandora_console/images/groups_small/old/eye.default.png b/pandora_console/images/groups_small/old/eye.default.png new file mode 100644 index 0000000000..cd852b7502 Binary files /dev/null and b/pandora_console/images/groups_small/old/eye.default.png differ diff --git a/pandora_console/images/groups_small/old/eye.ok.png b/pandora_console/images/groups_small/old/eye.ok.png new file mode 100644 index 0000000000..0da4304f71 Binary files /dev/null and b/pandora_console/images/groups_small/old/eye.ok.png differ diff --git a/pandora_console/images/groups_small/old/eye.warning.png b/pandora_console/images/groups_small/old/eye.warning.png new file mode 100644 index 0000000000..65a5722201 Binary files /dev/null and b/pandora_console/images/groups_small/old/eye.warning.png differ diff --git a/pandora_console/images/groups_small/firewall.bad_old.png b/pandora_console/images/groups_small/old/firewall.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/firewall.bad_old.png rename to pandora_console/images/groups_small/old/firewall.bad_old.png diff --git a/pandora_console/images/groups_small/firewall.default_old.png b/pandora_console/images/groups_small/old/firewall.default_old.png similarity index 100% rename from pandora_console/images/groups_small/firewall.default_old.png rename to pandora_console/images/groups_small/old/firewall.default_old.png diff --git a/pandora_console/images/groups_small/firewall.ok_old.png b/pandora_console/images/groups_small/old/firewall.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/firewall.ok_old.png rename to pandora_console/images/groups_small/old/firewall.ok_old.png diff --git a/pandora_console/images/groups_small/firewall.warning_old.png b/pandora_console/images/groups_small/old/firewall.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/firewall.warning_old.png rename to pandora_console/images/groups_small/old/firewall.warning_old.png diff --git a/pandora_console/images/groups_small/old/heart.bad.png b/pandora_console/images/groups_small/old/heart.bad.png new file mode 100644 index 0000000000..ff3008fcc4 Binary files /dev/null and b/pandora_console/images/groups_small/old/heart.bad.png differ diff --git a/pandora_console/images/groups_small/old/heart.default.png b/pandora_console/images/groups_small/old/heart.default.png new file mode 100644 index 0000000000..a7cfff0cc3 Binary files /dev/null and b/pandora_console/images/groups_small/old/heart.default.png differ diff --git a/pandora_console/images/groups_small/old/heart.ok.png b/pandora_console/images/groups_small/old/heart.ok.png new file mode 100644 index 0000000000..0f0798523d Binary files /dev/null and b/pandora_console/images/groups_small/old/heart.ok.png differ diff --git a/pandora_console/images/groups_small/old/heart.warning.png b/pandora_console/images/groups_small/old/heart.warning.png new file mode 100644 index 0000000000..66b8583393 Binary files /dev/null and b/pandora_console/images/groups_small/old/heart.warning.png differ diff --git a/pandora_console/images/groups_small/old/house.bad.png b/pandora_console/images/groups_small/old/house.bad.png new file mode 100644 index 0000000000..815f719f7c Binary files /dev/null and b/pandora_console/images/groups_small/old/house.bad.png differ diff --git a/pandora_console/images/groups_small/old/house.default.png b/pandora_console/images/groups_small/old/house.default.png new file mode 100644 index 0000000000..fac912b267 Binary files /dev/null and b/pandora_console/images/groups_small/old/house.default.png differ diff --git a/pandora_console/images/groups_small/old/house.ok.png b/pandora_console/images/groups_small/old/house.ok.png new file mode 100644 index 0000000000..c3a2e9053e Binary files /dev/null and b/pandora_console/images/groups_small/old/house.ok.png differ diff --git a/pandora_console/images/groups_small/old/house.warning.png b/pandora_console/images/groups_small/old/house.warning.png new file mode 100644 index 0000000000..cf76552f5f Binary files /dev/null and b/pandora_console/images/groups_small/old/house.warning.png differ diff --git a/pandora_console/images/groups_small/old/images.bad.png b/pandora_console/images/groups_small/old/images.bad.png new file mode 100644 index 0000000000..454b36e1d5 Binary files /dev/null and b/pandora_console/images/groups_small/old/images.bad.png differ diff --git a/pandora_console/images/groups_small/old/images.default.png b/pandora_console/images/groups_small/old/images.default.png new file mode 100644 index 0000000000..501a97fe27 Binary files /dev/null and b/pandora_console/images/groups_small/old/images.default.png differ diff --git a/pandora_console/images/groups_small/old/images.ok.png b/pandora_console/images/groups_small/old/images.ok.png new file mode 100644 index 0000000000..530af4f4c4 Binary files /dev/null and b/pandora_console/images/groups_small/old/images.ok.png differ diff --git a/pandora_console/images/groups_small/old/images.warning.png b/pandora_console/images/groups_small/old/images.warning.png new file mode 100644 index 0000000000..46cd29d989 Binary files /dev/null and b/pandora_console/images/groups_small/old/images.warning.png differ diff --git a/pandora_console/images/groups_small/old/lightning.bad.png b/pandora_console/images/groups_small/old/lightning.bad.png new file mode 100644 index 0000000000..a6ec10a2bc Binary files /dev/null and b/pandora_console/images/groups_small/old/lightning.bad.png differ diff --git a/pandora_console/images/groups_small/old/lightning.default.png b/pandora_console/images/groups_small/old/lightning.default.png new file mode 100644 index 0000000000..47447d48be Binary files /dev/null and b/pandora_console/images/groups_small/old/lightning.default.png differ diff --git a/pandora_console/images/groups_small/old/lightning.ok.png b/pandora_console/images/groups_small/old/lightning.ok.png new file mode 100644 index 0000000000..7dee1c4a81 Binary files /dev/null and b/pandora_console/images/groups_small/old/lightning.ok.png differ diff --git a/pandora_console/images/groups_small/old/lightning.warning.png b/pandora_console/images/groups_small/old/lightning.warning.png new file mode 100644 index 0000000000..020cfe9ac7 Binary files /dev/null and b/pandora_console/images/groups_small/old/lightning.warning.png differ diff --git a/pandora_console/images/groups_small/old/lock.bad.png b/pandora_console/images/groups_small/old/lock.bad.png new file mode 100644 index 0000000000..29fecde26d Binary files /dev/null and b/pandora_console/images/groups_small/old/lock.bad.png differ diff --git a/pandora_console/images/groups_small/old/lock.default.png b/pandora_console/images/groups_small/old/lock.default.png new file mode 100644 index 0000000000..d462751473 Binary files /dev/null and b/pandora_console/images/groups_small/old/lock.default.png differ diff --git a/pandora_console/images/groups_small/old/lock.ok.png b/pandora_console/images/groups_small/old/lock.ok.png new file mode 100644 index 0000000000..fb9a8749bd Binary files /dev/null and b/pandora_console/images/groups_small/old/lock.ok.png differ diff --git a/pandora_console/images/groups_small/old/lock.warning.png b/pandora_console/images/groups_small/old/lock.warning.png new file mode 100644 index 0000000000..bfb2826d31 Binary files /dev/null and b/pandora_console/images/groups_small/old/lock.warning.png differ diff --git a/pandora_console/images/groups_small/old/network.bad.png b/pandora_console/images/groups_small/old/network.bad.png new file mode 100644 index 0000000000..f3293d77ac Binary files /dev/null and b/pandora_console/images/groups_small/old/network.bad.png differ diff --git a/pandora_console/images/groups_small/old/network.default.png b/pandora_console/images/groups_small/old/network.default.png new file mode 100644 index 0000000000..c330e90893 Binary files /dev/null and b/pandora_console/images/groups_small/old/network.default.png differ diff --git a/pandora_console/images/groups_small/old/network.ok.png b/pandora_console/images/groups_small/old/network.ok.png new file mode 100644 index 0000000000..edd8831666 Binary files /dev/null and b/pandora_console/images/groups_small/old/network.ok.png differ diff --git a/pandora_console/images/groups_small/old/network.warning.png b/pandora_console/images/groups_small/old/network.warning.png new file mode 100644 index 0000000000..6ddd996e56 Binary files /dev/null and b/pandora_console/images/groups_small/old/network.warning.png differ diff --git a/pandora_console/images/groups_small/old/plugin.bad.png b/pandora_console/images/groups_small/old/plugin.bad.png new file mode 100644 index 0000000000..6d156e363f Binary files /dev/null and b/pandora_console/images/groups_small/old/plugin.bad.png differ diff --git a/pandora_console/images/groups_small/old/plugin.default.png b/pandora_console/images/groups_small/old/plugin.default.png new file mode 100644 index 0000000000..d97051dec6 Binary files /dev/null and b/pandora_console/images/groups_small/old/plugin.default.png differ diff --git a/pandora_console/images/groups_small/old/plugin.ok.png b/pandora_console/images/groups_small/old/plugin.ok.png new file mode 100644 index 0000000000..ff830a1475 Binary files /dev/null and b/pandora_console/images/groups_small/old/plugin.ok.png differ diff --git a/pandora_console/images/groups_small/old/plugin.warning.png b/pandora_console/images/groups_small/old/plugin.warning.png new file mode 100644 index 0000000000..58104424a0 Binary files /dev/null and b/pandora_console/images/groups_small/old/plugin.warning.png differ diff --git a/pandora_console/images/groups_small/old/printer.bad.png b/pandora_console/images/groups_small/old/printer.bad.png new file mode 100644 index 0000000000..9b2d285e85 Binary files /dev/null and b/pandora_console/images/groups_small/old/printer.bad.png differ diff --git a/pandora_console/images/groups_small/old/printer.default.png b/pandora_console/images/groups_small/old/printer.default.png new file mode 100644 index 0000000000..859c2474af Binary files /dev/null and b/pandora_console/images/groups_small/old/printer.default.png differ diff --git a/pandora_console/images/groups_small/old/printer.ok.png b/pandora_console/images/groups_small/old/printer.ok.png new file mode 100644 index 0000000000..8f17c7a050 Binary files /dev/null and b/pandora_console/images/groups_small/old/printer.ok.png differ diff --git a/pandora_console/images/groups_small/old/printer.warning.png b/pandora_console/images/groups_small/old/printer.warning.png new file mode 100644 index 0000000000..7eb19cf180 Binary files /dev/null and b/pandora_console/images/groups_small/old/printer.warning.png differ diff --git a/pandora_console/images/groups_small/server_database.bad_old.png b/pandora_console/images/groups_small/old/server_database.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/server_database.bad_old.png rename to pandora_console/images/groups_small/old/server_database.bad_old.png diff --git a/pandora_console/images/groups_small/server_database.default_old.png b/pandora_console/images/groups_small/old/server_database.default_old.png similarity index 100% rename from pandora_console/images/groups_small/server_database.default_old.png rename to pandora_console/images/groups_small/old/server_database.default_old.png diff --git a/pandora_console/images/groups_small/server_database.ok_old.png b/pandora_console/images/groups_small/old/server_database.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/server_database.ok_old.png rename to pandora_console/images/groups_small/old/server_database.ok_old.png diff --git a/pandora_console/images/groups_small/server_database.warning_old.png b/pandora_console/images/groups_small/old/server_database.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/server_database.warning_old.png rename to pandora_console/images/groups_small/old/server_database.warning_old.png diff --git a/pandora_console/images/groups_small/transmit.bad_old.png b/pandora_console/images/groups_small/old/transmit.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/transmit.bad_old.png rename to pandora_console/images/groups_small/old/transmit.bad_old.png diff --git a/pandora_console/images/groups_small/transmit.default_old.png b/pandora_console/images/groups_small/old/transmit.default_old.png similarity index 100% rename from pandora_console/images/groups_small/transmit.default_old.png rename to pandora_console/images/groups_small/old/transmit.default_old.png diff --git a/pandora_console/images/groups_small/transmit.ok_old.png b/pandora_console/images/groups_small/old/transmit.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/transmit.ok_old.png rename to pandora_console/images/groups_small/old/transmit.ok_old.png diff --git a/pandora_console/images/groups_small/transmit.warning_old.png b/pandora_console/images/groups_small/old/transmit.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/transmit.warning_old.png rename to pandora_console/images/groups_small/old/transmit.warning_old.png diff --git a/pandora_console/images/groups_small/without_group.bad_old.png b/pandora_console/images/groups_small/old/without_group.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/without_group.bad_old.png rename to pandora_console/images/groups_small/old/without_group.bad_old.png diff --git a/pandora_console/images/groups_small/without_group.default_old.png b/pandora_console/images/groups_small/old/without_group.default_old.png similarity index 100% rename from pandora_console/images/groups_small/without_group.default_old.png rename to pandora_console/images/groups_small/old/without_group.default_old.png diff --git a/pandora_console/images/groups_small/without_group.ok_old.png b/pandora_console/images/groups_small/old/without_group.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/without_group.ok_old.png rename to pandora_console/images/groups_small/old/without_group.ok_old.png diff --git a/pandora_console/images/groups_small/without_group.warning_old.png b/pandora_console/images/groups_small/old/without_group.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/without_group.warning_old.png rename to pandora_console/images/groups_small/old/without_group.warning_old.png diff --git a/pandora_console/images/groups_small/world.bad_old.png b/pandora_console/images/groups_small/old/world.bad_old.png similarity index 100% rename from pandora_console/images/groups_small/world.bad_old.png rename to pandora_console/images/groups_small/old/world.bad_old.png diff --git a/pandora_console/images/groups_small/world.default_old.png b/pandora_console/images/groups_small/old/world.default_old.png similarity index 100% rename from pandora_console/images/groups_small/world.default_old.png rename to pandora_console/images/groups_small/old/world.default_old.png diff --git a/pandora_console/images/groups_small/world.ok_old.png b/pandora_console/images/groups_small/old/world.ok_old.png similarity index 100% rename from pandora_console/images/groups_small/world.ok_old.png rename to pandora_console/images/groups_small/old/world.ok_old.png diff --git a/pandora_console/images/groups_small/world.warning_old.png b/pandora_console/images/groups_small/old/world.warning_old.png similarity index 100% rename from pandora_console/images/groups_small/world.warning_old.png rename to pandora_console/images/groups_small/old/world.warning_old.png diff --git a/pandora_console/images/groups_small/plugin.bad.png b/pandora_console/images/groups_small/plugin.bad.png index 6d156e363f..7004df6a1e 100644 Binary files a/pandora_console/images/groups_small/plugin.bad.png and b/pandora_console/images/groups_small/plugin.bad.png differ diff --git a/pandora_console/images/groups_small/plugin.default.png b/pandora_console/images/groups_small/plugin.default.png index d97051dec6..d815c117ba 100644 Binary files a/pandora_console/images/groups_small/plugin.default.png and b/pandora_console/images/groups_small/plugin.default.png differ diff --git a/pandora_console/images/groups_small/plugin.ok.png b/pandora_console/images/groups_small/plugin.ok.png index ff830a1475..dfa215c35e 100644 Binary files a/pandora_console/images/groups_small/plugin.ok.png and b/pandora_console/images/groups_small/plugin.ok.png differ diff --git a/pandora_console/images/groups_small/plugin.warning.png b/pandora_console/images/groups_small/plugin.warning.png index 58104424a0..957bedbc15 100644 Binary files a/pandora_console/images/groups_small/plugin.warning.png and b/pandora_console/images/groups_small/plugin.warning.png differ diff --git a/pandora_console/images/groups_small/printer.bad.png b/pandora_console/images/groups_small/printer.bad.png index 9b2d285e85..79ad2126d4 100644 Binary files a/pandora_console/images/groups_small/printer.bad.png and b/pandora_console/images/groups_small/printer.bad.png differ diff --git a/pandora_console/images/groups_small/printer.default.png b/pandora_console/images/groups_small/printer.default.png index 859c2474af..c16416c149 100644 Binary files a/pandora_console/images/groups_small/printer.default.png and b/pandora_console/images/groups_small/printer.default.png differ diff --git a/pandora_console/images/groups_small/printer.ok.png b/pandora_console/images/groups_small/printer.ok.png index 8f17c7a050..4f2cd88e81 100644 Binary files a/pandora_console/images/groups_small/printer.ok.png and b/pandora_console/images/groups_small/printer.ok.png differ diff --git a/pandora_console/images/groups_small/printer.warning.png b/pandora_console/images/groups_small/printer.warning.png index 7eb19cf180..f3aaa8ef07 100644 Binary files a/pandora_console/images/groups_small/printer.warning.png and b/pandora_console/images/groups_small/printer.warning.png differ diff --git a/pandora_console/images/reset.png b/pandora_console/images/reset.png new file mode 100644 index 0000000000..a3304f8263 Binary files /dev/null and b/pandora_console/images/reset.png differ diff --git a/pandora_console/include/ajax/snmp.ajax.php b/pandora_console/include/ajax/snmp.ajax.php index 7b3e45c704..a372d50e11 100644 --- a/pandora_console/include/ajax/snmp.ajax.php +++ b/pandora_console/include/ajax/snmp.ajax.php @@ -20,6 +20,7 @@ require_once("include/functions_snmp.php"); $save_snmp_translation = (bool)get_parameter('save_snmp_translation', 0); $delete_snmp_translation = (bool)get_parameter('delete_snmp_translation', 0); $update_snmp_translation = (bool)get_parameter('update_snmp_translation', 0); +$delete_snmp_filter = (bool)get_parameter('delete_snmp_filter', 0); /* skins image checks */ if ($save_snmp_translation) { @@ -56,4 +57,12 @@ if ($update_snmp_translation) { return; } + +if ($delete_snmp_filter) { + $filter_id = get_parameter('filter_id'); +html_debug($filter_id, true); + db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id)); + + return; +} ?> diff --git a/pandora_console/include/ajax/snmp_browser.ajax.php b/pandora_console/include/ajax/snmp_browser.ajax.php index 3376245093..63053e1919 100644 --- a/pandora_console/include/ajax/snmp_browser.ajax.php +++ b/pandora_console/include/ajax/snmp_browser.ajax.php @@ -25,12 +25,12 @@ if(is_ajax()){ $target_ip = (string) get_parameter ("target_ip", ''); $community = (string) get_parameter ("community", ''); $snmp_version = (string) get_parameter ("snmp_browser_version", ''); - $snmp3_auth_user = get_parameter('snmp3_browser_auth_user'); + $snmp3_auth_user = io_safe_output(get_parameter('snmp3_browser_auth_user')); $snmp3_security_level = get_parameter('snmp3_browser_security_level'); $snmp3_auth_method = get_parameter('snmp3_browser_auth_method'); - $snmp3_auth_pass = get_parameter('snmp3_browser_auth_pass'); + $snmp3_auth_pass = io_safe_output(get_parameter('snmp3_browser_auth_pass')); $snmp3_privacy_method = get_parameter('snmp3_browser_privacy_method'); - $snmp3_privacy_pass = get_parameter('snmp3_browser_privacy_pass'); + $snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_browser_privacy_pass')); $targets_oids = get_parameter ("oids", ""); $targets_oids = explode(",", $targets_oids); diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 89f2cf3bf7..6e7a612171 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -17,8 +17,25 @@ if (is_ajax ()) { global $config; - // Login check - check_login (); + enterprise_include_once("include/functions_dashboard.php"); + + $public_hash = get_parameter('hash', 0); + + // Try to authenticate by hash on public dashboards + if ($public_hash == 0) { + // Login check + check_login(); + } else { + $validate_hash = enterprise_hook( + 'dasboard_validate_public_hash', + array($public_hash, 'tree_view') + ); + if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) { + db_pandora_audit("Invalid public hash", "Trying to access report builder"); + require ("general/noaccess.php"); + exit; + } + } require_once($config['homedir'] . "/include/class/Tree.class.php"); enterprise_include_once("include/class/Tree.class.php"); @@ -36,6 +53,10 @@ if (is_ajax ()) { $rootID = get_parameter('rootID', -1); $serverID = get_parameter('serverID', false); $childrenMethod = get_parameter('childrenMethod', 'on_demand'); + $hash = get_parameter('hash', false); + if ($hash !== false) { + enterprise_hook('dasboard_validate_public_hash', array($hash, 'tree_view')); + } $default_filters = array( 'searchAgent' => '', diff --git a/pandora_console/include/ajax/visual_console.ajax.php b/pandora_console/include/ajax/visual_console.ajax.php index 789398139c..91af22ec7e 100644 --- a/pandora_console/include/ajax/visual_console.ajax.php +++ b/pandora_console/include/ajax/visual_console.ajax.php @@ -12,10 +12,30 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// Login check global $config; -check_login (); +enterprise_include_once ('include/functions_dashboard.php'); +require_once('include/functions_visual_map.php'); +enterprise_include_once('include/functions_visual_map.php'); + +$public_hash = get_parameter('hash', false); +$id_visual_console = get_parameter('id_visual_console', null); + +// Try to authenticate by hash on public dashboards +if ($public_hash === false) { + // Login check + check_login(); +} else { + $validate_hash = enterprise_hook( + 'dasboard_validate_public_hash', + array($public_hash, $id_visual_console, 'visual_console') + ); + if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) { + db_pandora_audit("Invalid public hash", "Trying to access report builder"); + require ("general/noaccess.php"); + exit; + } +} // Fix: IW was the old ACL to check for report editing, now is RW if (! check_acl ($config['id_user'], 0, "VR")) { @@ -29,12 +49,6 @@ if (! check_acl ($config['id_user'], 0, "VR")) { //Fix ajax to avoid include the file, 'functions_graph.php'. $ajax = true; - -require_once('include/functions_visual_map.php'); -enterprise_include_once('include/functions_visual_map.php'); - -$id_visual_console = get_parameter('id_visual_console', null); - $render_map = (bool)get_parameter('render_map', false); $graph_javascript = (bool)get_parameter('graph_javascript', false); diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 88bcd45898..05e6f7fc4c 100755 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -100,7 +100,10 @@ $width = get_parameter('width', null); $height = get_parameter('height', null); $parent = get_parameter('parent', null); $map_linked = get_parameter('map_linked', null); +$map_linked_weight = get_parameter('map_linked_weight', null); +$element_group = get_parameter('element_group', null); $width_percentile = get_parameter('width_percentile', null); +$bars_graph_height = get_parameter('bars_graph_height', null); $max_percentile = get_parameter('max_percentile', null); $height_module_graph = get_parameter('height_module_graph', null); $width_module_graph = get_parameter('width_module_graph', null); @@ -113,14 +116,17 @@ $metaconsole = get_parameter('metaconsole', 0); $server_name = get_parameter('server_name', null); $server_id = (int)get_parameter('server_id', 0); $id_agent = get_parameter('id_agent', null); +$id_agent_string = get_parameter('id_agent_string', null); $id_metaconsole = get_parameter('id_metaconsole', null); $id_group = (int)get_parameter('id_group', 0); $id_custom_graph = get_parameter('id_custom_graph', null); $border_width = (int)get_parameter('border_width', 0); $border_color = get_parameter('border_color', ''); +$grid_color = get_parameter('grid_color', ''); +$resume_color = get_parameter('resume_color', ''); $fill_color = get_parameter('fill_color', ''); $percentile_color = get_parameter('percentile_color', ''); -$percentile_label = get_parameter('percentile_label', ''); +$percentile_label = io_safe_output(get_parameter('percentile_label', '')); $percentile_label_color = get_parameter('percentile_label_color', ''); $width_box = (int)get_parameter('width_box', 0); $height_box = (int)get_parameter('height_box', 0); @@ -134,6 +140,7 @@ $line_color = get_parameter('line_color', ''); $get_element_status = get_parameter('get_element_status', 0); $enable_link = get_parameter('enable_link', 1); +$show_on_top = get_parameter('show_on_top', 0); $type_graph = get_parameter('type_graph', 'area'); $label_position = get_parameter('label_position', 'down'); $show_statistics = get_parameter('show_statistics', 0); @@ -145,6 +152,24 @@ switch ($action) { echo json_encode($return); break; + case 'get_image_from_module': + $layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element)); + $sql = 'SELECT datos FROM tagente_estado WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']; + ob_clean(); + $result = db_get_sql($sql); + $image = strpos($result, 'data:image'); + + if($image === false){ + $return['correct'] = false; + } + else{ + $return['correct'] = true; + } + + echo json_encode($return); + + break; + case 'get_module_type_string': $data = array (); @@ -358,7 +383,7 @@ switch ($action) { // Linked to other layout ?? - Only if not module defined if ($layoutData['id_layout_linked'] != 0) { - $status = visual_map_get_layout_status ($layoutData['id_layout_linked']); + $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], $layoutData['id_layout_linked_weight']); // Single object } @@ -468,6 +493,7 @@ switch ($action) { $values = array(); $values['label_position'] = $label_position; + $values['show_on_top'] = $show_on_top; // In Graphs, background color is stored in column image (sorry) if ($type == 'module_graph') { @@ -489,12 +515,6 @@ switch ($action) { echo (int)$result; break; case 'simple_value': - if ($action == 'update') { - $values['type'] = visual_map_get_simple_value_type( - $process_simple_value); - $values['period'] = $period; - $values['width'] = $width; - } case 'percentile_bar': case 'percentile_item': case 'static_graph': @@ -513,6 +533,9 @@ switch ($action) { if ($enable_link !== null) { $values['enable_link'] = $enable_link; } + if ($show_on_top !== null) { + $values['show_on_top'] = $show_on_top; + } if ($label !== null) { $values['label'] = $label; } @@ -538,8 +561,6 @@ switch ($action) { break; } - - if (defined('METACONSOLE') && $metaconsole) { if ($server_name !== null) { $values['id_metaconsole'] = db_get_value('id', @@ -554,6 +575,9 @@ switch ($action) { $values['id_agent'] = $id_agent; } } + else if ($id_agent == 0) { + $values['id_agent'] = 0; + } else if (!empty($id_agent)) { $values['id_agent'] = $id_agent; } @@ -570,6 +594,12 @@ switch ($action) { if ($map_linked !== null) { $values['id_layout_linked'] = $map_linked; } + if ($element_group !== null) { + $values['element_group'] = $element_group; + } + if ($map_linked_weight !== null) { + $values['id_layout_linked_weight'] = $map_linked_weight; + } switch ($type) { // -- line_item ------------------------------------ case 'handler_start': @@ -590,6 +620,15 @@ switch ($action) { $values['height'] = $height; } break; + case 'donut_graph': + if ($width_percentile !== null) { + $values['width'] = $width_percentile; + $values['height'] = $width_percentile; + } + $values['border_color'] = $resume_color; + $values['type'] = DONUT_GRAPH; + $values['id_agent'] = $id_agent_string; + break; case 'box_item': $values['border_width'] = $border_width; $values['border_color'] = $border_color; @@ -631,12 +670,19 @@ switch ($action) { if ($width_percentile !== null) { $values['width'] = $width_percentile; } + if ($bars_graph_height !== null) { + $values['height'] = $bars_graph_height; + } if ($bars_graph_type !== null) { $values['type_graph'] = $bars_graph_type; } if ($background_color !== null) { $values['image'] = $background_color; } + if ($grid_color !== null) { + $values['border_color'] = $grid_color; + } + $values['id_agent'] = $id_agent_string; break; case 'percentile_item': case 'percentile_bar': @@ -662,11 +708,7 @@ switch ($action) { $values['type'] = PERCENTILE_BUBBLE; } - //Check the field's value for back compatibility - $values['image'] = 'percent'; - if (($value_show == 'percent') || - ($value_show == 'value')) - $values['image'] = $value_show; + $values['image'] = $value_show; $values['border_color'] = $percentile_color; $values['fill_color'] = $percentile_label_color; @@ -684,6 +726,15 @@ switch ($action) { if ($height !== null) { $values['height'] = $height; } + break; + case 'simple_value': + if ($action == 'update') { + $values['type'] = visual_map_get_simple_value_type( + $process_simple_value); + $values['period'] = $period; + $values['width'] = $width; + } + break; default: if (enterprise_installed()) { @@ -699,6 +750,14 @@ switch ($action) { // Don't change the label because only change the positions unset($values['label']); unset($values['label_position']); + // Don't change this values when move + unset($values['id_agent']); + unset($values['id_agente_modulo']); + unset($values['enable_link']); + unset($values['show_on_top']); + unset($values['id_layout_linked']); + unset($values['element_group']); + unset($values['id_layout_linked_weight']); // Don't change background color in graphs when move switch ($type) { @@ -713,6 +772,15 @@ switch ($action) { case 'bars_graph': unset($values['image']); unset($values['type_graph']); + unset($values['border_color']); + unset($values['width']); + unset($values['id_agent']); + unset($values['height']); + break; + case 'donut_graph': + unset($values['border_color']); + unset($values['width']); + unset($values['id_agent']); break; case 'box_item': unset($values['border_width']); @@ -776,6 +844,7 @@ switch ($action) { case 'label': case 'icon': case 'auto_sla_graph': + case 'donut_graph': $elementFields = db_get_row_filter('tlayout_data', array('id' => $id_element)); @@ -833,11 +902,8 @@ switch ($action) { case 'percentile_bar': $elementFields['width_percentile'] = $elementFields['width']; $elementFields['max_percentile'] = $elementFields['height']; - //Check the field's value for back compatibility - $elementFields['value_show'] = 'percent'; - if (($elementFields['image'] == 'percent') || - ($elementFields['image'] == 'value')) - $elementFields['value_show'] = $elementFields['image']; + + $elementFields['value_show'] = $elementFields['image']; $elementFields['type_percentile'] = 'percentile'; if ($elementFields['type'] == PERCENTILE_BAR) { @@ -856,6 +922,24 @@ switch ($action) { $elementFields['percentile_label_color'] = $elementFields['fill_color']; $elementFields['percentile_label'] = $elementFields['label']; break; + case 'donut_graph': + $elementFields['width_percentile'] = $elementFields['width']; + $elementFields['resume_color'] = $elementFields['border_color']; + $elementFields['id_agent_string'] = $elementFields['id_agent']; + if (($elementFields['id_agent_string'] != 0) + && ($elementFields['id_layout_linked'] == 0)) { + $modules = agents_get_modules( + $elementFields['id_agent'], false, + array('disabled' => 0, + 'id_agente' => $elementFields['id_agent'], + 'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)")); + + $elementFields['modules_html'] = ''; + foreach ($modules as $id => $name) { + $elementFields['modules_html'] .= ''; + } + } + break; case 'module_graph': $elementFields['width_module_graph'] = $elementFields['width']; @@ -863,7 +947,23 @@ switch ($action) { break; case 'bars_graph': $elementFields['width_percentile'] = $elementFields['width']; + $elementFields['bars_graph_height'] = $elementFields['height']; $elementFields['bars_graph_type'] = $elementFields['type_graph']; + $elementFields['grid_color'] = $elementFields['border_color']; + $elementFields['id_agent_string'] = $elementFields['id_agent']; + if (($elementFields['id_agent_string'] != 0) + && ($elementFields['id_layout_linked'] == 0)) { + $modules = agents_get_modules( + $elementFields['id_agent'], false, + array('disabled' => 0, + 'id_agente' => $elementFields['id_agent'], + 'tagente_modulo.id_tipo_modulo IN' => "(17,23,3,10,33)")); + + $elementFields['modules_html'] = ''; + foreach ($modules as $id => $name) { + $elementFields['modules_html'] .= ''; + } + } break; case 'box_item': $elementFields['width_box'] = $elementFields['width']; @@ -943,8 +1043,11 @@ switch ($action) { } $values['id_agente_modulo'] = $id_module; $values['id_layout_linked'] = $map_linked; + $values['element_group'] = $element_group; + $values['id_layout_linked_weight'] = $map_linked_weight; $values['parent_item'] = $parent; $values['enable_link'] = $enable_link; + $values['show_on_top'] = $show_on_top; $values['image'] = $background_color; $values['type_graph'] = $type_graph; @@ -969,6 +1072,13 @@ switch ($action) { $values['width'] = $width_box; $values['height'] = $height_box; break; + case 'donut_graph': + $values['type'] = DONUT_GRAPH; + $values['width'] = $width_percentile; + $values['height'] = $width_percentile; + $values['border_color'] = $resume_color; + $values['id_agent'] = $id_agent_string; + break; case 'module_graph': $values['type'] = MODULE_GRAPH; @@ -1003,14 +1113,12 @@ switch ($action) { break; case 'bars_graph': $values['type'] = BARS_GRAPH; - if ($width_percentile == null) { - $values['width'] = 0; - } - else { - $values['width'] = $width_percentile; - } + $values['width'] = $width_percentile; + $values['height'] = $bars_graph_height; $values['type_graph'] = $bars_graph_type; $values['image'] = $background_color; + $values['border_color'] = $grid_color; + $values['id_agent'] = $id_agent_string; break; case 'auto_sla_graph': $values['type'] = AUTO_SLA_GRAPH; diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 139543ee75..acd777102c 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -215,6 +215,13 @@ function process_user_login_remote ($login, $pass, $api = false) { break; } + if ($config["auth"] === 'ldap') { + $login_user_attribute = $login; + if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) { + $login = get_ldap_login_attr($login); + } + } + // Authentication ok, check if the user exists in the local database if (is_user ($login)) { if (!user_can_login($login)) { @@ -240,26 +247,19 @@ function process_user_login_remote ($login, $pass, $api = false) { } } } - elseif (($config["auth"] === 'ldap') && - (isset($config['ldap_advanced_config']) && $config['ldap_advanced_config'])) { + elseif ($config["auth"] === 'ldap') { + if ($config['ldap_save_password']) { + $update_credentials = change_local_user_pass_ldap ($login, $pass); - $return = enterprise_hook ('prepare_permissions_groups_of_user_ldap', - array ($login, $pass, false, true, defined('METACONSOLE'))); - - if ($return === "error_permissions") { - $config["auth_error"] = - __("Problems with configuration permissions. Please contact with Administrator"); - return false; - } - else { - if ($return === "permissions_changed") { + if ($update_credentials) { $config["auth_error"] = __("Your permissions have changed. Please, login again."); return false; } } - - change_local_user_pass_ldap ($login, $pass); + else { + delete_user_pass_ldap ($login); + } } return $login; @@ -310,9 +310,7 @@ function process_user_login_remote ($login, $pass, $api = false) { return false; } } - elseif ($config["auth"] === 'ldap' && - (isset($config['ldap_advanced_config']) && - $config['ldap_advanced_config'])) { + elseif ($config["auth"] === 'ldap') { if ( defined('METACONSOLE') ) { enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once ('meta/include/functions_groups_meta.php'); @@ -332,13 +330,11 @@ function process_user_login_remote ($login, $pass, $api = false) { } // Create the user - if (enterprise_hook ('prepare_permissions_groups_of_user_ldap', - array($login, - $pass, - array ('fullname' => $login, - 'comments' => 'Imported from ' . $config['auth']), - false, defined('METACONSOLE'))) === false) { - + $prepare_perms = prepare_permissions_groups_of_user_ldap($login_user_attribute, $pass, + array ('fullname' => $login_user_attribute, 'comments' => 'Imported from ' . $config['auth']), + false, defined('METACONSOLE')); + + if (!$prepare_perms) { $config["auth_error"] = __("User not found in database or incorrect password"); @@ -693,10 +689,220 @@ function ldap_process_user_login ($login, $password) { } } - $dc = $config["ldap_base_dn"]; + $correct_admin_bind = true; + if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") { + if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) { + $correct_admin_bind = false; + } + } + + if (!$correct_admin_bind) { + $config["auth_error"] = 'Admin ldap connection fail'; + @ldap_close ($ds); + + return false; + } + + $dc = io_safe_output($config["ldap_base_dn"]); #Search group of this user it belong. - $filter="(cn=" . io_safe_output($login) . ")"; + $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")"; + $justthese = array("objectclass=group"); + + $sr = ldap_search($ds, $dc, $filter, $justthese); + + $memberof = ldap_get_entries($ds, $sr); + + if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) { + @ldap_close ($ds); + return false; + } + else { + $memberof = $memberof[0]; + } + + unset($memberof["count"]); + + $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : ''; + + $correct = false; + if(!empty($ldap_base_dn)) { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) { + $correct = true; + } + } + else { + if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) { + $correct = true; + } + } + + @ldap_close ($ds); + + if ($correct) { + return true; + } + else { + $config["auth_error"] = 'User not found in database or incorrect password'; + + return false; + } +} + +function get_ldap_login_attr ($login) { + global $config; + + if (! function_exists ("ldap_connect")) { + $config["auth_error"] = __('Your installation of PHP does not support LDAP'); + + return false; + } + + // Connect to the LDAP server + $ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]); + + if (!$ds) { + $config["auth_error"] = 'Error connecting to LDAP server'; + + return false; + } + + // Set the LDAP version + ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]); + + if ($config["ldap_start_tls"]) { + if (!@ldap_start_tls ($ds)) { + $config["auth_error"] = 'Could not start TLS for LDAP connection'; + @ldap_close ($ds); + + return false; + } + } + + $id_user = $login; + + switch ($config['ldap_login_user_attr']) { + case 'email': + $dc = io_safe_output($config["ldap_base_dn"]); + + $correct_admin_bind = true; + if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") { + if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) { + $correct_admin_bind = false; + } + } + + if (!$correct_admin_bind) { + $config["auth_error"] = 'Admin ldap connection fail'; + @ldap_close ($ds); + + return false; + } + + $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")"; + $justthese = array("mail"); + + $sr = ldap_search($ds, $dc, $filter, $justthese); + + $info = ldap_get_entries($ds, $sr); + + if ($info["count"] == 0 && !isset($info[0]["mail"])) { + @ldap_close ($ds); + return $id_user; + } + else { + $info = $info[0]; + } + + $id_user = $info['mail'][0]; + + @ldap_close ($ds); + + break; + } + + return $id_user; +} + +/** + * Checks if a user is in the autocreate blacklist. + * + * @param string User + * + * @return bool True if the user is in the blacklist, false otherwise. + */ +function is_user_blacklisted ($user) { + global $config; + + $blisted_users = explode (',', $config['autocreate_blacklist']); + foreach ($blisted_users as $blisted_user) { + if ($user == $blisted_user) { + return true; + } + } + + return false; +} + +/** + * Check permissions in LDAP for prepare to create user in Pandora. + * + * @param string Login + * @param string Password + * @param string User Info + * @param string check_permissions Check if change permissions + * + * @return bool True if the login succeeds, false otherwise + */ +function prepare_permissions_groups_of_user_ldap ($id_user, $password, + $user_info, $check_permissions = false, $syncronize = false) { + + global $config; + include_once($config['homedir'] . "/include/functions_html.php"); + + if (! function_exists ("ldap_connect")) { + return false; + } + + // Do not allow blank passwords + if ($password == "") { + return false; + } + + // Connect to the LDAP server + $ds = @ldap_connect ($config["ldap_server"], $config["ldap_port"]); + if (!$ds) { + return false; + } + + // Set the LDAP version + ldap_set_option ($ds, LDAP_OPT_PROTOCOL_VERSION, $config["ldap_version"]); + + if ($config["ldap_start_tls"]) { + if (!@ldap_start_tls ($ds)) { + @ldap_close ($ds); + return false; + } + } + + $dc = io_safe_output($config["ldap_base_dn"]); + + $correct_admin_bind = true; + if ($config['ldap_admin_login'] != "" && $config['ldap_admin_pass'] != "") { + if (!@ldap_bind($ds, io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'])) { + $correct_admin_bind = false; + } + } + + if (!$correct_admin_bind) { + $config["auth_error"] = 'Admin ldap connection fail'; + @ldap_close ($ds); + + return false; + } + + #Search group of this user it belong. + $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")"; $justthese = array("objectclass=group"); $sr = ldap_search($ds, $dc, $filter, $justthese); @@ -727,36 +933,381 @@ function ldap_process_user_login ($login, $password) { } } - @ldap_close ($ds); + if (!$correct) { + @ldap_close ($ds); - if ($correct) { - return true; - } - else { - $config["auth_error"] = 'User not found in database or incorrect password'; - return false; } + + $permissions = array(); + $i = 0; + $count_total = 0; + + $ldap_adv_perms = json_decode(io_safe_output($config['ldap_adv_perms']), true); + + foreach ($ldap_adv_perms as $ldap_adv_perm) { + $groups = $ldap_adv_perm['groups_ldap']; + + if ($groups[0] == '') { + $groups = array(); + } + else { + $groups = $groups[0]; + } + + $count_ad_adv_perms = count(explode(",", $groups)); + + $tags_ids = array(); + $tags = implode(",", $tags); + if ($tags == null) { + $tags = ""; + } + + foreach ($memberof as $member) { + $member_to_compare = str_replace($config['ldap_login_attr'] . "=", "", $member); + $member_to_compare = str_replace($id_user . ",", "", $member_to_compare); + $member_to_compare = str_replace("," . $dc, "", $member_to_compare); + + if (($member_to_compare == $dc) && (empty($groups))) { + $count_total++; + } + else { + $member_to_compare = explode(",", $member_to_compare); + $groups = explode(",", $groups); + foreach ($groups as $g) { + if ($member_to_compare[0] == $g) { + $count_total++; + } + } + } + } + + if ($count_total > 0) { + $profile_id = $ldap_adv_perm['profile']; + $id_grupos = $ldap_adv_perm['group']; + + if (empty($profile_id)) { + @ldap_close ($ds); + return false; + } + + $permissions[$i]["profile"] = $profile_id; + $permissions[$i]["groups"] = $id_grupos; + $permissions[$i]["tags"] = $tags; + } + $i++; + $count_total = 0; + $count_ad_adv_perms = 0; + } + + if ( $check_permissions ) { + $result = check_permission_ldap ($id_user, $password, $user_info, $permissions, $syncronize); + @ldap_close ($ds); + + return $result; + } + + if (!is_user ($id_user)) { + if (($config['ldap_login_user_attr'] != 'name') && ($config['ldap_login_user_attr'] != null)) { + switch ($config['ldap_login_user_attr']) { + case 'email': + $filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")"; + $justthese = array("mail"); + + $sr = ldap_search($ds, $dc, $filter, $justthese); + + $info = ldap_get_entries($ds, $sr); + + if ($info["count"] == 0 && !isset($info[0]["mail"])) { + @ldap_close ($ds); + return false; + } + else { + $info = $info[0]; + } + + $id_user = $info['mail'][0]; + $user_info['fullname'] = $id_user; + + break; + } + } + + $create_user = create_user_and_permisions_ldap($id_user, $password, $user_info, $permissions, $syncronize); + } + + @ldap_close ($ds); + + return $create_user; } /** - * Checks if a user is in the autocreate blacklist. + * Create progile with data obtaint from AD * - * @param string User + * @param string Login + * @param string Password + * @param array user_info + * @param array permiisons * - * @return bool True if the user is in the blacklist, false otherwise. + * @return bool */ -function is_user_blacklisted ($user) { +function create_user_and_permisions_ldap ($id_user, $password, $user_info, + $permissions, $syncronize = false) { global $config; - $blisted_users = explode (',', $config['autocreate_blacklist']); - foreach ($blisted_users as $blisted_user) { - if ($user == $blisted_user) { - return true; + $values = $user_info; + $values["id_user"] = $id_user; + + if ($config['ldap_save_password']) { + $values["password"] = md5 ($password); + } + $values["last_connect"] = 0; + $values["registered"] = get_system_time (); + if ( defined("METACONSOLE") && $syncronize ) + $values['metaconsole_access_node'] = $config['ldap_adv_user_node']; + $user = (@db_process_sql_insert ("tusuario", $values)) !== false; + + if ($user) { + if (!empty($permissions)) { + foreach ($permissions as $permission) { + $id_profile = $permission["profile"]; + $id_groups = $permission["groups"]; + $tags = $permission["tags"]; + + foreach ($id_groups as $id_group) { + $profile = profile_create_user_profile( + $id_user, $id_profile, $id_group, false, $tags); + } + + if ( defined("METACONSOLE") && $syncronize ) { + enterprise_include_once('include/functions_metaconsole.php'); + + unset($values['metaconsole_access_node']); + $values['not_login'] = (int) !$config['ldap_adv_user_node']; + + $servers = metaconsole_get_servers(); + foreach ($servers as $server) { + $perfil_maestro = db_get_row('tperfil', + 'id_perfil', $permission["profile"]); + + if (metaconsole_connect($server) == NOERR ) { + + if (!profile_exist($perfil_maestro['name'])) { + unset($perfil_maestro['id_perfil']); + $id_profile = db_process_sql_insert('tperfil', $perfil_maestro); + } + else { + $id_profile = db_get_value('id_perfil', 'tperfil', 'name', $perfil_maestro['name']); + } + + db_process_sql_insert ("tusuario", $values); + foreach ($id_groups as $id_group) { + $profile = profile_create_user_profile ($id_user, + $id_profile, $id_group, false, $tags); + } + } + + metaconsole_restore_db(); + } + } + + if (!$profile) + return false; + } + } + else { + $profile = profile_create_user_profile( + $id_user, $config['default_remote_profile'], $config['default_remote_group'], false, $config['default_assign_tags']); + + if (!$profile) + return false; + } + } + return true; +} + +/** + * Check if user have right permission in pandora. This + * permission depend of ldap. + * + * @param string Login + * @param string Password + * + * @return string + */ +function check_permission_ldap ($id_user, $password, $user_info, + $permissions, $syncronize = false) { + + global $config; + include_once($config['homedir'] . "/enterprise/include/functions_metaconsole.php"); + + $result_user = users_get_user_by_id($id_user); + $filter = array("id_usuario" => $id_user); + $profiles_user = array(); + $user_profiles = + db_get_all_rows_filter ("tusuario_perfil", $filter); + + foreach ($user_profiles as $user_profile) { + $profiles_user[$user_profile["id_up"]] = + $user_profile["id_perfil"]; + } + + $profiles_user_nodes = array(); + $permissions_nodes = array(); + if ( is_metaconsole() && $syncronize ) { + $servers = metaconsole_get_servers(); + foreach ($servers as $server) { + if ( metaconsole_connect($server) == NOERR ) { + $user_profiles_nodes = + db_get_all_rows_filter ("tusuario_perfil", $filter); + foreach ($user_profiles_nodes as $user_profile_node) { + $profiles_user_nodes[$server['server_name']][$user_profile_node["id_up"]] = + $user_profile_node["id_perfil"]; + } + } + metaconsole_restore_db(); + } + + foreach ($permissions as $key => $permission) { + $perfil_maestro = db_get_row('tperfil', + 'id_perfil', $permission['profile']); + foreach ($servers as $server) { + if (metaconsole_connect($server) == NOERR ) { + if (profile_exist($perfil_maestro['name'])) { + $id_profile = db_get_value('id_perfil', 'tperfil', 'name', $perfil_maestro['name']); + $permissions_nodes[$server['server_name']][$key] = $permission; + $permissions_nodes[$server['server_name']][$key]['profile'] = $id_profile; + } + } + metaconsole_restore_db(); + } } } - return false; + $no_found = array(); + if ($result_user) { + foreach ($permissions as $permission) { + $id_profile = $permission["profile"]; + $id_groups = $permission["groups"]; + $tags = $permission["tags"]; + + foreach ($id_groups as $id_group) { + $filter = array("id_usuario" => $id_user, + "id_perfil"=>$id_profile, + "id_grupo" => $id_group); + //~ Find perfil with advance permissions in + //~ authentication menu. This data depends on + //~ groups where this user it belong. + $result_profiles = + db_get_row_filter ("tusuario_perfil", $filter); + if (!$result_profiles) { + #If not found save in array. + $no_found[] = array("id_perfil"=>$id_profile, + "id_grupo" => $id_group, "tags" =>$tags); + } + else { + #if profile is find, delete from array. + db_process_sql_update("tusuario_perfil", + array("tags" =>$tags), + array('id_usuario' => $id_user, + 'id_up' => $profiles_user[$id_profile])); + + unset($profiles_user[$result_profiles["id_up"]]); + } + } + } + + if (is_metaconsole() && $syncronize) { + $servers = metaconsole_get_servers(); + foreach ($servers as $server) { + foreach ($permissions_nodes[$server['server_name']] as $permission_node) { + + $id_profile = $permission_node["profile"]; + $id_groups = $permission_node["groups"]; + $tags = $permission_node["tags"]; + + foreach ($id_groups as $id_group) { + + $filter = array("id_usuario" => $id_user, + "id_perfil"=>$id_profile, + "id_grupo" => $id_group); + + if (metaconsole_connect($server) == NOERR ) { + $result_profiles = + db_get_row_filter ("tusuario_perfil", $filter); + + if (!$result_profiles) { + #If not found save in array. + $no_found_server[$server['server_name']][] = array("id_perfil" => $id_profile, + "id_grupo" => $id_group, "tags" => $tags); + } + else { + #if profile is find, delete from array. + db_process_sql_update("tusuario_perfil", + array("tags" =>$tags), + array('id_usuario' => $id_user, + 'id_up' => $profiles_user_nodes[$server_name][$id_profile])); + + unset($profiles_user_nodes[$server_name][$result_profiles["id_up"]]); + } + } + } + } + metaconsole_restore_db(); + } + } + + if ( empty($profiles_user) && empty($no_found) ) { + #The permmisions of user not changed + return true; + } + else { + foreach ($profiles_user as $key => $profile_user) { + #The other profiles are deleted + profile_delete_user_profile ($id_user, $key); + } + + if ( is_metaconsole() && $syncronize ) { + foreach ($profiles_user_nodes as $server_name => $profile_users) { + $server = metaconsole_get_connection($server_name); + foreach ($profile_users as $key => $profile_user) { + if ( metaconsole_connect($server) == NOERR ) { + profile_delete_user_profile ($id_user, $key); + } + } + metaconsole_restore_db(); + } + } + + foreach ($no_found as $new_profiles) { + #Add the missing permissions + profile_create_user_profile ($id_user, + $new_profiles["id_perfil"], + $new_profiles["id_grupo"], false, + $new_profiles["tags"]); + } + + if ( is_metaconsole() && $syncronize ) { + $servers = metaconsole_get_servers(); + foreach ($servers as $server) { + if ( metaconsole_connect($server) == NOERR ) { + foreach ($no_found_server[$server['server_name']] as $new_profiles) { + profile_create_user_profile ($id_user, + $new_profiles["id_perfil"], + $new_profiles["id_grupo"], false, + $new_profiles["tags"]); + } + } + metaconsole_restore_db(); + } + } + + return "permissions_changed"; + } + } + else { + return "error_permissions"; + } } /** @@ -770,13 +1321,23 @@ function is_user_blacklisted ($user) { function change_local_user_pass_ldap ($id_user, $password) { $local_user_pass = db_get_value_filter('password', 'tusuario', array('id_user' => $id_user)); + $return = false; if (md5($password) !== $local_user_pass) { $values_update = array(); $values_update['password'] = md5($password); - db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user)); + $return = db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user)); } + return $return; +} + +function delete_user_pass_ldap ($id_user) { + $values_update = array(); + $values_update['password'] = null; + + $return = db_process_sql_update('tusuario', $values_update, array('id_user' => $id_user)); + return; } diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 6dc52ea68d..21d201a6d4 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -23,6 +23,7 @@ class Tree { protected $filter = array(); protected $childrenMethod = "on_demand"; + protected $userGroupsACL; protected $userGroups; protected $strictACL = false; @@ -36,45 +37,54 @@ class Tree { $this->id = $id; $this->rootID = !empty($rootID) ? $rootID : $id; $this->serverID = $serverID; - $this->childrenMethod = $childrenMethod; - $this->access = $access; - - $userGroups = users_get_groups(false, $this->access); + $this->childrenMethod = $childrenMethod; + $this->access = $access; - if (empty($userGroups)) - $this->userGroups = false; - else - $this->userGroups = $userGroups; + $userGroupsACL = users_get_groups(false, $this->access); + $this->userGroupsACL = empty($userGroupsACL) ? false : $userGroupsACL; + $this->userGroups = $this->userGroupsACL; global $config; include_once($config['homedir']."/include/functions_servers.php"); include_once($config['homedir']."/include/functions_modules.php"); require_once($config['homedir']."/include/functions_tags.php"); - if (is_metaconsole()) - enterprise_include_once("meta/include/functions_ui_meta.php"); + if (is_metaconsole()) enterprise_include_once("meta/include/functions_ui_meta.php"); $this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']); $this->acltags = tags_get_user_module_and_tags($config['id_user'], $this->access); } - public function setType($type) { - $this->type = $type; - } - public function setFilter($filter) { + // Filter the user groups + if (!empty($filter['groupID'])) { + $group_id = $filter['groupID']; + $this->userGroups = isset($this->userGroupsACL[$group_id]) + ? array($group_id => $this->userGroupsACL[$group_id]) + : array(); + } + else if (!empty($filter['searchGroup'])) { + $groups = db_get_all_rows_filter('tgrupo', array('nombre' => '%' . $filter['searchGroup'] . '%')); + + // Save the groups which intersect + $userGroupsACL = $this->userGroupsACL; + $this->userGroups = array_reduce($groups, function ($userGroups, $group) use ($userGroupsACL) { + $group_id = $group['id_grupo']; + if (isset($userGroupsACL[$group_id])) { + $userGroups[$group_id] = $userGroupsACL[$group_id]; + } + + return $userGroups; + }, array()); + } + else { + $this->userGroups = $this->userGroupsACL; + } + $this->filter = $filter; } - public function isStrict () { - return $this->strictACL; - } - - public function setStrict ($value) { - $this->strictACL = (bool) $value; - } - protected function getAgentStatusFilter ($status = -1) { if ($status == -1) $status = $this->filter['statusAgent']; @@ -323,7 +333,7 @@ class Tree { case 'group': // ACL Group $user_groups_str = "-1"; - $group_acl = ""; + $group_filter = ""; if (!$this->strictACL) { if (empty($this->userGroups)) { return; @@ -338,7 +348,7 @@ class Tree { // Asking for all groups. else { $user_groups_str = implode(",", array_keys($this->userGroups)); - $group_acl = "AND ta.id_grupo IN ($user_groups_str)"; + $group_filter = "AND ta.id_grupo IN ($user_groups_str)"; } } else { @@ -356,7 +366,7 @@ class Tree { } } } - $group_acl = "AND ta.id_grupo IN ($user_groups_str)"; + $group_filter = "AND ta.id_grupo IN ($user_groups_str)"; } switch ($type) { @@ -390,7 +400,7 @@ class Tree { $module_status_join WHERE ta.disabled = 0 AND ta.id_grupo = $item_for_count - $group_acl + $group_filter $agent_search_filter $agent_status_filter"; $sql = $this->getAgentCountersSql($agent_table); @@ -411,7 +421,7 @@ class Tree { FROM tmetaconsole_agent ta WHERE ta.disabled = 0 AND ta.id_grupo = $item_for_count - $group_acl + $group_filter $agent_search_filter $agent_status_filter"; $sql = $this->getAgentCountersSql($agent_table); @@ -439,7 +449,7 @@ class Tree { $module_status_join WHERE ta.disabled = 0 AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter GROUP BY $group_by_fields @@ -456,7 +466,7 @@ class Tree { FROM tmetaconsole_agent ta WHERE ta.disabled = 0 AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter ORDER BY $order_fields"; @@ -498,7 +508,7 @@ class Tree { ON ta.disabled = 0 AND tam.id_agente = ta.id_agente AND ta.id_grupo = $rootID - $group_acl + $group_filter $agent_search_filter $agent_status_filter WHERE tam.disabled = 0 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 997b5b3955..b88c0ab537 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,8 +22,8 @@ /** * Pandora build version and version */ -$build_version = 'PC171026'; -$pandora_version = 'v7.0NG.714'; +$build_version = 'PC171129'; +$pandora_version = 'v7.0NG.716'; // Do not overwrite default timezone set if defined. $script_tz = @date_default_timezone_get(); diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index ba4efa5535..901cff9eeb 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -462,7 +462,7 @@ define("STATWIN_DEFAULT_CHART_WIDTH", 555); define("STATWIN_DEFAULT_CHART_HEIGHT", 245); /* Dashboard */ -define("DASHBOARD_DEFAULT_COUNT_CELLS", 4); +define("DASHBOARD_DEFAULT_COUNT_CELLS", 1); define("OPTION_TEXT", 1); define("OPTION_SINGLE_SELECT", 2); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index f8edfd1d27..4edfe2c512 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1594,7 +1594,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', case '2c': case '1': default: - $command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg($snmp_community) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; + $command_str = $snmpwalk_bin . ' -m ALL -Oa -v ' . escapeshellarg($snmp_version) . ' -c ' . escapeshellarg(io_safe_output($snmp_community)) . ' ' . escapeshellarg($ip_target) . ' ' . $base_oid . ' 2> ' . $error_redir_dir; break; } diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index 8e87eee5b3..577dfe82f1 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -1039,14 +1039,16 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal $filter = array (); if ($id_alert_agent_module) $filter['id'] = $id_alert_agent_module; - - // Get the modules of the fired alerts that will be deleted to update counts - $filter_get = $filter; - - $filter_get['group'] = 'id_agent_module'; - $filter_get['times_fired'] = '>0'; - - $fired_alert_modules = db_get_all_rows_filter('talert_template_modules', $filter_get, array('id_agent_module', 'COUNT(*) alerts')); + + // Get the id agent to update the fired alert counts + $agent_id = false; + if (isset ($filter['id_agent_module'])){ + $agent_id = modules_get_agentmodule_agent ($filter["id_agent_module"]); + } + else if (isset ($filter['id'])){ + $alert = alerts_get_alert_agent_module($id_alert_agent_module); + $agent_id = modules_get_agentmodule_agent ($alert["id_agent_module"]); + } /* The deletion of actions from talert_template_module_actions, @@ -1054,6 +1056,11 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal a foreing key and delete on cascade. */ if (@db_process_sql_delete ('talert_template_modules', $filter) !== false) { + // Update fired alert count on the agent + // It will only occur if is specified the alert id or the id_agent_module + if ($agent_id !== false) { + db_process_sql(sprintf('UPDATE tagente SET update_alert_count=1 WHERE id_agente = %d', $agent_id)); + } return true; } diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 06f0d090b5..30078c5685 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -343,9 +343,23 @@ function config_update_config () { $error_update[] = __('Base DN'); if (!config_update_value ('ldap_login_attr', get_parameter ('ldap_login_attr'))) $error_update[] = __('Login attribute'); + if (!config_update_value ('ldap_admin_login', get_parameter ('ldap_admin_login'))) + $error_update[] = __('Admin LDAP login'); + if (!config_update_value ('ldap_admin_pass', get_parameter ('ldap_admin_pass'))) + $error_update[] = __('Admin LDAP password'); if (!config_update_value ('fallback_local_auth', get_parameter ('fallback_local_auth'))) $error_update[] = __('Fallback to local authentication'); - + if (!config_update_value ('ldap_login_user_attr', get_parameter ('ldap_login_user_attr'))) + $error_update[] = __('Login user attribute'); + + if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 0) { + if (!config_update_value ('ldap_save_password', get_parameter ('ldap_save_password'))) + $error_update[] = __('Save Password'); + } + else if (isset($config['fallback_local_auth']) && $config['fallback_local_auth'] == 1) { + config_update_value ('ldap_save_password', 1); + } + if (!config_update_value ('rpandora_server', get_parameter ('rpandora_server'))) $error_update[] = __('MySQL host'); if (!config_update_value ('rpandora_port', get_parameter ('rpandora_port'))) @@ -1348,6 +1362,14 @@ function config_process_config () { if (!isset ($config['ldap_login_attr'])) { config_update_value ( 'ldap_login_attr', 'uid'); } + + if (!isset ($config['ldap_admin_login'])) { + config_update_value ( 'ldap_admin_login', ''); + } + + if (!isset ($config['ldap_admin_pass'])) { + config_update_value ( 'ldap_admin_pass', ''); + } if (!isset ($config['fallback_local_auth'])) { config_update_value ( 'fallback_local_auth', '0'); diff --git a/pandora_console/include/functions_cron.php b/pandora_console/include/functions_cron.php index cf131eac8e..efa5f2f342 100644 --- a/pandora_console/include/functions_cron.php +++ b/pandora_console/include/functions_cron.php @@ -30,24 +30,30 @@ function cron_update_module_interval ($module_id, $cron) { $module_interval = db_get_value_filter('module_interval','tagente_modulo',array("id_agente_modulo" => $module_id)); return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . $module_interval . ' WHERE id_agente_modulo = ' . (int) $module_id); } else { - return db_process_sql ('UPDATE tagente_estado SET current_interval = ' . cron_next_execution ($cron) . ' WHERE id_agente_modulo = ' . (int) $module_id); + return db_process_sql ( + 'UPDATE tagente_estado SET current_interval = ' . + cron_next_execution ($cron, $module_interval, $module_id) . + ' WHERE id_agente_modulo = ' . + (int) $module_id) + ; } } // Get the number of seconds left to the next execution of the given cron entry. -function cron_next_execution ($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); - // Get current time - $cur_time = time(); + // Get last execution time + $last_execution = db_get_value('utimestamp', 'tagente_estado', 'id_agente_modulo', $module_id); + $cur_time = ($last_execution !== false) ? $last_execution : time(); // Any day of the way if ($wday == '*') { - $nex_time = cron_next_execution_date ($cron, $cur_time); + $nex_time = cron_next_execution_date ($cron, $cur_time, $module_interval); return $nex_time - $cur_time; } @@ -55,7 +61,7 @@ function cron_next_execution ($cron) { $count = 0; $nex_time = $cur_time; do { - $nex_time = cron_next_execution_date ($cron, $nex_time); + $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)); @@ -80,90 +86,202 @@ function cron_next_execution ($cron) { } // Get the next execution date for the given cron entry in seconds since epoch. -function cron_next_execution_date ($cron, $cur_time = false) { +function cron_next_execution_date ($cron, $cur_time = false, $module_interval = 300) { // Get cron configuration - list ($min, $hour, $mday, $mon, $wday) = explode (" ", $cron); - + $cron_array = explode (" ", $cron); // Months start from 0 - if ($mon != '*') { - $mon -= 1; + if ($cron_array[3] != '*') { + $mon_s = cron_get_interval ($cron_array[3]); + if ($mon_s['up'] !== false) { + $cron_array[3] = $mon_s['down'] - 1 . "-" . $mon_s['up'] - 1; + } else { + $cron_array[3] = $mon_s['down'] - 1; + } } // Get current time - if ($cur_time === false) { - $cur_time = time(); - } - list ($cur_min, $cur_hour, $cur_mday, $cur_mon, $cur_year) = explode (" ", date ("i H d m Y", $cur_time)); + if ($cur_time === false) $cur_time = time(); + + $nex_time = $cur_time + $module_interval; + $nex_time_array = explode (" ", date ("i H d m Y", $nex_time)); + if (cron_is_in_cron($cron_array, $nex_time_array)) return $nex_time; - // Get first next date candidate from cron configuration - $nex_min = $min; - $nex_hour = $hour; - $nex_mday = $mday; - $nex_mon = $mon; - $nex_year = $cur_year; + // Get first next date candidate from next cron configuration + // Initialize some vars + $prev_ovfl = false; + + // Update minutes + $min_s = cron_get_interval ($cron_array[0]); + $nex_time_array[0] = ($min_s['down'] == '*') ? 0 : $min_s['down']; - // Replace wildcards - if ($min == '*') { - if ($hour != '*' || $mday != '*' || $wday != '*' || $mon != '*') { - $nex_min = 0; - } - else { - $nex_min = $cur_min; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time >= $cur_time) { + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; } } - if ($hour == '*') { - if ($mday != '*' || $wday != '*' ||$mon != '*') { - $nex_hour = 0; - } - else { - $nex_hour = $cur_hour; - } - } - if ($mday == '*') { - if ($mon != '*') { - $nex_mday = 1; - } - else { - $nex_mday = $cur_mday; - } - } - if ($mon == '*') { - $nex_mon = $cur_mon; - } - - // Find the next execution date - $count = 0; - do { - $next_time = mktime($nex_hour, $nex_min, 0, $nex_mon, $nex_mday, $nex_year); - if ($next_time > $cur_time) { - return $next_time; - } - if ($min == '*' && $hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') { - list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1MINUTE)); - } - else if ($hour == '*' && $wday == '*' && $mday == '*' && $mon == '*') { - list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1HOUR)); - } - else if ($mday == '*' && $mon == '*') { - list ($nex_min, $nex_hour, $nex_mday, $nex_mon, $nex_year) = explode (" ", date ("i H d m Y", $next_time + SECONDS_1DAY)); - } - else if ($mon == '*') { - $nex_mon = $nex_mon + 1; - if ($nex_mon > 11) { - $nex_mon = 0; - $nex_year++; + + // Check if next hour is in cron + $nex_time_array[1]++; + $nex_time = cron_valid_date($nex_time_array); + + if ($nex_time === false) { + // Update the month day if overflow + $prev_ovfl = true; + $nex_time_array[1] = 0; + $nex_time_array[2]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + // Update the month if overflow + $nex_time_array[2] = 1; + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + #Update the year if overflow + $nex_time_array[3] = 0; + $nex_time_array[4]++; + $nex_time = cron_valid_date($nex_time_array); } } - else { - $nex_year++; - } - $count++; } - while ($count < SECONDS_1DAY); + // Check the hour + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + + // Update the hour if fails + $hour_s = cron_get_interval ($cron_array[1]); + $nex_time_array[1] = ($hour_s['down'] == '*') ? 0 : $hour_s['down']; + + // When an overflow is passed check the hour update again + if ($prev_ovfl) { + $nex_time = cron_valid_date($nex_time_array); + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + } + $prev_ovfl = false; + + // Check if next day is in cron + $nex_time_array[2]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + // Update the month if overflow + $prev_ovfl = true; + $nex_time_array[2] = 1; + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + // Update the year if overflow + $nex_time_array[3] = 0; + $nex_time_array[4]++; + $nex_time = cron_valid_date($nex_time_array); + } + } + // Check the day + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + + // Update the day if fails + $mday_s = cron_get_interval ($cron_array[2]); + $nex_time_array[2] = ($mday_s['down'] == '*') ? 1 : $mday_s['down']; + + // When an overflow is passed check the hour update in the next execution + if ($prev_ovfl) { + $nex_time = cron_valid_date($nex_time_array); + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + } + $prev_ovfl = false; + + // Check if next month is in cron + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + if ($nex_time === false) { + #Update the year if overflow + $prev_ovfl = true; + $nex_time_array[3]++; + $nex_time = cron_valid_date($nex_time_array); + } + + // Check the month + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + + // Update the month if fails + $mon_s = cron_get_interval ($cron_array[3]); + $nex_time_array[3] = ($mon_s['down'] == '*') ? 0 : $mon_s['down']; + + // When an overflow is passed check the hour update in the next execution + if ($prev_ovfl) { + $nex_time = cron_valid_date($nex_time_array); + if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) { + return $nex_time; + } + } + + // Update the year + $nex_time_array[4]++; + $nex_time = cron_valid_date($nex_time_array); + + return ($nex_time !== false) ? $nex_time : $module_interval; +} + +// Get an array with the cron interval +function cron_get_interval ($element) { + # Not a range + if (!preg_match('/(\d+)\-(\d+)/', $element, $capture)) { + return array( + 'down' => $element, + 'up' => false + ); + } + return array( + 'down' => $capture[1], + 'up' => $capture[2] + ); +} + +// Returns if a date is in a cron. Recursive. +function cron_is_in_cron($elems_cron, $elems_curr_time) { - // Something went wrong, default to 5 minutes - return $cur_time + SECONDS_5MINUTES; + $elem_cron = array_shift($elems_cron); + $elem_curr_time = array_shift($elems_curr_time); + + // If there is no elements means that is in cron + if ($elem_cron === null || $elem_curr_time === null) return true; + + // Go to last element if current is a wild card + if ($elem_cron != '*') { + $elem_s = cron_get_interval($elem_cron); + // Check if there is no a range + if (($elem_s['up'] === false) && ($elem_s['down'] != $elem_curr_time)) { + return false; + } + // Check if there is on the range + if ($elem_s['up'] !== false) { + if ($elem_s['down'] < $elem_s['up']) { + if ($elem_curr_time < $elem_s['down'] || $elem_curr_time > $elem_s['up']){ + return false; + } + } else { + if ($elem_curr_time > $elem_s['down'] || $elem_curr_time < $elem_s['up']){ + return false; + } + } + } + } + return cron_is_in_cron($elems_cron, $elems_curr_time); +} + +function cron_valid_date ($da) { + $st = sprintf("%04d:%02d:%02d %02d:%02d:00", $da[4], $da[3], $da[2], $da[1], $da[0]); + $time = strtotime($st); + return $time; } // Check if cron is properly constructed diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 763f246bdf..58c11b1cc9 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2080,7 +2080,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index 5e0ef6c718..1297ea50b2 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -720,6 +720,17 @@ function filemanager_file_explorer($real_directory, $relative_directory, $hash = md5($relative_path . $config['dbpass']); $data[1] = ''.$fileinfo['name'].''; } + + // Notice that uploaded php files could be dangerous + if (pathinfo($fileinfo['realpath'], PATHINFO_EXTENSION) == 'php' && + (is_readable($fileinfo['realpath']) || is_executable($fileinfo['realpath']))) { + $error_message = __('This file could be executed by any user'); + $error_message .= '. ' . __('Make sure it can\'t perform dangerous tasks'); + $data[1] = '' + . $data[1] + . ''; + } + $data[2] = ui_print_timestamp ($fileinfo['last_modified'], true, array ('prominent' => true)); if ($fileinfo['is_dir']) { diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 5d33c49a01..3a063da403 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -232,8 +232,8 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i $projection, $avg_only = false, $uncompressed_module = false, $show_events = false, $show_alerts = false, $show_unknown = false, $baseline = false, $baseline_data = array(), $events = array(), $series_suffix = '', $start_unknown = false, - $percentil = null, $fullscale = false) { - + $percentil = null, $fullscale = false, $force_interval = false,$time_interval = 300, + $max_only = 0, $min_only = 0) { global $config; global $chart_extra_data; global $series_type; @@ -413,10 +413,17 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i } if ($count > 0) { + if ($avg_only) { $chart[$timestamp]['sum'.$series_suffix] = $total; } - else { + else if($max_only){ + $chart[$timestamp]['max'.$series_suffix] = $interval_max; + } + else if($min_only){ + $chart[$timestamp]['min'.$series_suffix] = $interval_min; + } + else{ $chart[$timestamp]['max'.$series_suffix] = $interval_max; $chart[$timestamp]['sum'.$series_suffix] = $total; $chart[$timestamp]['min'.$series_suffix] = $interval_min; @@ -428,7 +435,13 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i if ($avg_only) { $chart[$timestamp]['sum'.$series_suffix] = 0; } - else { + else if($max_only){ + $chart[$timestamp]['max'.$series_suffix] = 0; + } + else if($min_only){ + $chart[$timestamp]['min'.$series_suffix] = 0; + } + else{ $chart[$timestamp]['max'.$series_suffix] = 0; $chart[$timestamp]['sum'.$series_suffix] = 0; $chart[$timestamp]['min'.$series_suffix] = 0; @@ -438,6 +451,12 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i if ($avg_only) { $chart[$timestamp]['sum'.$series_suffix] = $last_known; } + else if ($max_only) { + $chart[$timestamp]['max'.$series_suffix] = $last_known; + } + else if ($min_only) { + $chart[$timestamp]['min'.$series_suffix] = $last_known; + } else { $chart[$timestamp]['max'.$series_suffix] = $last_known; $chart[$timestamp]['sum'.$series_suffix] = $last_known; @@ -502,8 +521,9 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $baseline = 0, $return_data = 0, $show_title = true, $projection = false, $adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '', $show_unknown = false, $percentil = null, $dashboard = false, $vconsole = false, - $type_graph='area', $fullscale = false, $flash_chart = false) { - + $type_graph='area', $fullscale = false, $flash_chart = false, $force_interval = false,$time_interval = 300, + $max_only = 0, $min_only = 0) { + global $config; global $chart; global $color; @@ -529,8 +549,23 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, if ($date == 0) $date = get_system_time(); $datelimit = $date - $period; $search_in_history_db = db_search_in_history_db($datelimit); - $resolution = $config['graph_res'] * 50; //Number of points of the graph - $interval = (int) ($period / $resolution); + + + + if($force_interval){ + $resolution = $period/$time_interval; + } + else{ + $resolution = $config['graph_res'] * 50; //Number of points of the graph + } + + if($force_interval){ + $interval = $time_interval; + } + else{ + $interval = (int) ($period / $resolution); + } + $agent_name = modules_get_agentmodule_agent_name ($agent_module_id); $agent_id = agents_get_agent_id ($agent_name); $module_name = modules_get_agentmodule_name ($agent_module_id); @@ -718,7 +753,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $projection, $avg_only, $uncompressed_module, $show_events, $show_alerts, $show_unknown, $baseline, $baseline_data, $events, $series_suffix, $start_unknown, - $percentil, $fullscale); + $percentil, $fullscale, $force_interval, $time_interval, + $max_only, $min_only); } // Return chart data and don't draw @@ -843,6 +879,19 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $legend['percentil'.$series_suffix] = __('Percentile %dº', $percentil) .$series_suffix_str . " (" . $percentil_value . " " . $unit . ") "; $chart_extra_data['legend_percentil'] = $legend['percentil'.$series_suffix_str]; } + + if($force_interval){ + $legend = array(); + if($avg_only){ + $legend['sum'.$series_suffix] = __('Avg'); + } + elseif ($max_only) { + $legend['min'.$series_suffix] = __('Max'); + } + elseif ($min_only) { + $legend['max'.$series_suffix] = __('Min'); + } + } } function grafico_modulo_sparse ($agent_module_id, $period, $show_events, @@ -853,8 +902,10 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $adapt_key = '', $compare = false, $show_unknown = false, $menu = true, $backgroundColor = 'white', $percentil = null, $dashboard = false, $vconsole = false, $type_graph = 'area', $fullscale = false, - $id_widget_dashboard = false) { - + $id_widget_dashboard = false,$force_interval = 0,$time_interval = 300, + $max_only = 0, $min_only = 0) { + + global $config; global $graphic_type; @@ -884,7 +935,7 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $return_data, $show_title, $projection, $adapt_key, $compare, $series_suffix, $series_suffix_str, $show_unknown, $percentil, $dashboard, $vconsole,$type_graph, - $fullscale, $flash_chart); + $fullscale, $flash_chart,$force_interval,$time_interval,$max_only,$min_only); switch ($compare) { case 'separated': @@ -917,7 +968,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $show_alerts, $avg_only, $date, $unit, $baseline, $return_data, $show_title, $projection, $adapt_key, $compare, '', '', $show_unknown, - $percentil, $dashboard, $vconsole, $type_graph, $fullscale, $flash_chart); + $percentil, $dashboard, $vconsole, $type_graph, $fullscale,$flash_chart, + $force_interval,$time_interval,$max_only,$min_only); + if ($return_data) { return $data_returned; } @@ -1069,6 +1122,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, if(!$fullscale){ $time_format_2 = ''; $temp_range = $period; + $unit_list_aux = array(); if ($projection != false) { if ($period < $prediction_period) @@ -1317,6 +1371,10 @@ function graphic_combined_module ($module_list, $weight_list, $period, $agent_id = agents_get_agent_id ($agent_name); + if(empty($unit_list)){ + $unit_aux = modules_get_unit($agent_module_id); + array_push($unit_list_aux,$unit_aux); + } //Get and process module name $module_name = io_safe_output( modules_get_agentmodule_name ($agent_module_id)); @@ -1500,6 +1558,8 @@ function graphic_combined_module ($module_list, $weight_list, $period, if (!empty($unit_list) && $units_number == $module_number && isset($unit_list[$i])) { $unit = $unit_list[$i]; + }else{ + $unit = $unit_list_aux[$i]; } if ($projection == false or ($projection != false and $i == 0)) { @@ -2107,14 +2167,14 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $height, $color, $module_name_list, $long_index, ui_get_full_url("images/image_problem_area_small.png", false, false, false), "", "", $water_mark, $config['fontpath'], $fixed_font_size, - "", $ttl, $homeurl, $background_color); + "", $ttl, $homeurl, $background_color, 'black'); break; case CUSTOM_GRAPH_VBARS: return vbar_graph($flash_charts, $graph_values, $width, $height, $color, $module_name_list, $long_index, ui_get_full_url("images/image_problem_area_small.png", false, false, false), "", "", $water_mark, $config['fontpath'], $fixed_font_size, - "", $ttl, $homeurl, $background_color, true); + "", $ttl, $homeurl, $background_color, true, false, "black"); break; case CUSTOM_GRAPH_PIE: return ring_graph($flash_charts, $graph_values, $width, $height, @@ -2457,10 +2517,10 @@ function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value require_once("include_graph_dependencies.php"); include_graphs_dependencies($config['homedir'].'/'); $src = ui_get_full_url( - "/include/graphs/fgraph.php?homeurl=../../&graph_type=progressbar" . - "&width=".$width."&homedir=".$config['homedir']."&height=".$height."&progress=".$progress. + "/include/graphs/fgraph.php?graph_type=progressbar" . + "&width=".$width."&height=".$height."&progress=".$progress. "&mode=" . $mode . "&out_of_lim_str=".$out_of_lim_str . - "&title=".$title."&font=".$config['fontpath']."&value_text=". $value_text . + "&title=".$title."&value_text=". $value_text . "&colorRGB=". $colorRGB, false, false, false ); @@ -2492,10 +2552,10 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va include_graphs_dependencies($config['homedir'].'/'); return "" . $title . ""; } @@ -2779,7 +2839,9 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) { return hbar_graph($config['flash_charts'], $data, $width, $height, array(), $legend, "", "", true, "", $water_mark, - $config['fontpath'], $config['font_size'], false); + $config['fontpath'], $config['font_size'], false, 1, $config['homeurl'], + 'white', + 'black'); } /** @@ -2846,7 +2908,9 @@ function graph_db_agentes_modulos($width, $height) { $data, $width, $height, array(), array(), "", "", true, "", $water_mark, - $config['fontpath'], $config['font_size'], false); + $config['fontpath'], $config['font_size'], false, 1, $config['homeurl'], + 'white', + 'black'); } /** @@ -3621,12 +3685,14 @@ function graph_custom_sql_graph ($id, $width, $height, case 'sql_graph_vbar': // vertical bar return vbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", $homeurl, $water_mark, - $config['fontpath'], $config['font_size'], false, $ttl); + $config['fontpath'], $config['font_size'], false, $ttl, "", "white", false, false, "black"); break; case 'sql_graph_hbar': // horizontal bar return hbar_graph($flash_charts, $data, $width, $height, array(), array(), "", "", true, $homeurl, $water_mark, - $config['fontpath'], $config['font_size'], false, $ttl); + $config['fontpath'], $config['font_size'], false, $ttl,$config['homeurl'], + 'white', + 'black'); break; case 'sql_graph_pie': // Pie return pie3d_graph($flash_charts, $data, $width, $height, __("other"), $homeurl, @@ -5743,17 +5809,40 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { $filter_module_group = (!empty($filter) && !empty($filter['module_group'])) ? $filter['module_group'] : false; - $groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null)); + if ($filter['group'] != 0) { + $groups = db_get_all_rows_sql ("SELECT * FROM tgrupo where id_grupo = " . $filter['group'] . " || parent = " . $filter['group']); + $groups_ax = array(); + foreach ($groups as $g) { + $groups_ax[$g['id_grupo']] = $g; + } + + $groups = $groups_ax; + } + else { + $groups = users_get_groups(false, "AR", false, true, (!empty($filter) && isset($filter['group']) ? $filter['group'] : null)); + } + $data_groups = array(); if (!empty($groups)) { $groups_aux = $groups; - $data_groups = groups_get_tree($groups); + + //$data_groups = groups_get_tree($groups); + + $childrens = array(); + $data_groups = groups_get_tree_good($groups, false, $childrens); + foreach ($childrens as $id_c) { + unset($data_groups[$id_c]); + } + $data_groups_keys = array(); + groups_get_tree_keys($data_groups, $data_groups_keys); + $groups_aux = null; } if (!empty($data_groups)) { - $filter = array('id_grupo' => array_keys($data_groups)); + $filter = array('id_grupo' => array_keys($data_groups_keys)); + $fields = array('id_agente', 'id_parent', 'id_grupo', 'alias'); $agents = agents_get_agents($filter, $fields); @@ -5970,7 +6059,6 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { } function iterate_group_array ($groups, &$data_agents) { - $data = array(); foreach ($groups as $id => $group) { @@ -6007,8 +6095,8 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { $tooltip_content = html_print_image("images/groups_small/" . $group['icon'] . ".png", true) . " " . __('Group') . ": " . $group_aux['name'] . ""; $group_aux['tooltip_content'] = $tooltip_content; - if (!isset($group['children'])) - $group_aux['children'] = array(); + $group_aux['children'] = array(); + if (!empty($group['children'])) $group_aux['children'] = iterate_group_array($group['children'], $data_agents); @@ -6016,7 +6104,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { if (!empty($agents)) $group_aux['children'] = array_merge($group_aux['children'], $agents); - + $data[] = $group_aux; } @@ -6031,6 +6119,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { unset($agents[$id]); } } + if (!empty($valid_agents)) return $valid_agents; else @@ -6038,7 +6127,7 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { } $graph_data = array('name' => __('Main node'), 'children' => iterate_group_array($data_groups, $data_agents), 'color' => '#3F3F3F'); - + if (empty($graph_data['children'])) return fs_error_image(); diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 757e5014d5..db046c09be 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -2241,6 +2241,9 @@ function groups_get_tree(&$groups, $parent = false) { if (!empty($children)) { $return[$id]['children'] = $children; } + else { + $return[$id]['children'] = array(); + } } else if ($parent && isset($group['parent']) && $group['parent'] == $parent) { $return[$id] = $group; @@ -2250,6 +2253,9 @@ function groups_get_tree(&$groups, $parent = false) { if (!empty($children)) { $return[$id]['children'] = $children; } + else { + $return[$id]['children'] = array(); + } } else { continue; @@ -2258,6 +2264,55 @@ function groups_get_tree(&$groups, $parent = false) { return $return; } + +function groups_get_tree_good (&$groups, $parent = false, &$childs) { + $return = array(); + + foreach ($groups as $id => $group) { + if ($group['parent'] != 0) { + $childs[$id] = $id; + } + if ($parent === false && (!isset($group['parent']) || $group['parent'] == 0 || !in_array($group['parent'], $groups))) { + $return[$id] = $group; + //unset($groups[$id]); + $children = groups_get_tree_good($groups, $id); + + if (!empty($children)) { + $return[$id]['children'] = $children; + } + else { + $return[$id]['children'] = array(); + } + } + else if ($parent && isset($group['parent']) && $group['parent'] == $parent) { + $return[$id] = $group; + //unset($groups[$id]); + $children = groups_get_tree_good($groups, $id); + + if (!empty($children)) { + $return[$id]['children'] = $children; + } + else { + $return[$id]['children'] = array(); + } + } + else { + continue; + } + } + + return $return; +} + +function groups_get_tree_keys ($groups, &$group_keys) { + foreach ($groups as $id => $group) { + $group_keys[$id] = $id; + if (isset($group['children'])) { + groups_get_tree_keys($groups[$id]['children'], $group_keys); + } + } +} + function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) { global $config; @@ -2289,6 +2344,8 @@ function groups_get_all_hierarchy_group ($id_group, $hierarchy = array()) { return $hierarchy; } + + function group_get_data ($id_user = false, $user_strict = false, $acltags, $returnAllGroup = false, $mode = 'group', $agent_filter = array(), $module_filter = array()) { global $config; if ($id_user == false) { @@ -3036,4 +3093,5 @@ function groups_get_group_deep ($id_group) { return $deep; } + ?> diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index e1417ceec1..b88fb07510 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -254,7 +254,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true, $relative = false, $text_filter = '', $ip_mask = null, $dont_show_subgroups = false, $strict_user = false, $size_canvas = null, - $old_mode = false) { + $old_mode = false, $map_filter = array()) { global $config; $nooverlap = 1; @@ -361,7 +361,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, // Open Graph $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, - $ranksep, $font_size, $size_canvas); + $ranksep, $font_size, $size_canvas, $map_filter); // Parse agents $nodes = array (); @@ -1111,7 +1111,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu } $node = "\n" . $agent['id_node'].' [ parent="' . $agent['id_parent'] . '", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=< -
' . $img_node . '
'.io_safe_output($name).'
>, + '.io_safe_input($name).'>, shape="doublecircle", URL="'.$url.'", tooltip="' . $url_tooltip . '"];' . "\n"; } @@ -1396,7 +1396,7 @@ function networkmap_close_group () { // Opens a graph definition function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, - $ranksep, $font_size, $size_canvas) { + $ranksep, $font_size, $size_canvas, $map_filter = array()) { global $config; @@ -1412,42 +1412,79 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $size = ''; } - - if ($layout == 'radial') { - $overlap = 'true'; - } - - if ($layout == 'flat' || $layout == 'radial' || $layout == 'spring1' || $layout == "spring2") { - if ($nooverlap != '') { - $overlap = 'scalexy'; - } - } - if ($zoom > 0) { $size_x *= $zoom; $size_y *= $zoom; } + $size = $size_x . ',' . $size_y; if (!is_null($size_canvas)) { $size = ($size_canvas['x'] / 100) . "," . ($size_canvas['y'] / 100); } - + + // Graphviz custom values + if (isset($map_filter['node_sep'])) { + $node_sep = $map_filter['node_sep']; + } + else { + $node_sep = 0.25; + } + if (isset($map_filter['rank_sep'])) { + $rank_sep = $map_filter['rank_sep']; + } + else { + if ($layout == "radial") { + $rank_sep = 1.0; + } + else { + $rank_sep = 0.5; + } + } + if (isset($map_filter['mindist'])) { + $mindist = $map_filter['mindist']; + } + else { + $mindist = 1.0; + } + if (isset($map_filter['kval'])) { + $kval = $map_filter['kval']; + } + else { + $kval = 0.3; + } + // BEWARE: graphwiz DONT use single ('), you need double (") $head = "graph networkmap { dpi=100; bgcolor=\"transparent\"; labeljust=l; margin=0; pad=\"0.75,0.75\";"; if ($nooverlap != '') { - $head .= "overlap=\"$overlap\";"; - $head .= "ranksep=\"$ranksep\";"; + $head .= "overlap=\"false\";"; $head .= "outputorder=edgesfirst;"; } + + if ($layout == 'flat' || $layout == 'spring1' || $layout == "spring2") { + if ($nooverlap != '') { + $head .= "overlap=\"scalexy\";"; + } + if ($layout == 'flat') { + $head .= "ranksep=\"$rank_sep\";"; + } + if ($layout == 'spring2') { + $head .= "K=\"$kval\";"; + } + } + if ($layout == 'radial') { + $head .= "ranksep=\"$rank_sep\";"; + } + if ($layout == 'circular') { + $head .= "mindist=\"$mindist\";"; + } $head .= "ratio=fill;"; $head .= "root=0;"; - $head .= "nodesep=\"0.02\";"; + $head .= "nodesep=\"$node_sep\";"; $head .= "size=\"$size\";"; $head .= "\n"; - return $head; } diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 0bbb4dd124..4058294bbe 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -43,7 +43,7 @@ function networkmap_process_networkmap($id = 0) { $networkmap = db_get_row_filter('tmap', array('id' => $id)); - $filter = json_decode($networkmap['filter'], true); + $map_filter = json_decode($networkmap['filter'], true); $pure = (int)get_parameter('pure', 0); @@ -95,181 +95,316 @@ function networkmap_process_networkmap($id = 0) { } $nodes_and_relations = array(); - + if (enterprise_installed() && ($numNodes > 0)) { $nodes_and_relations = get_structure_nodes($id); } else { - // Generate dot file - $graph = networkmap_generate_dot (__('Pandora FMS'), - $id_group, - $simple, - $font_size, - $layout, - $nooverlap, - $zoom, - $ranksep, - $center, - $regen, - $pure, - $id, - $show_snmp_modules, - false, //cut_names - true, // relative - '', - $ip_mask, - $dont_show_subgroups, - false, - null, - $old_mode); - - switch (PHP_OS) { - case "WIN32": - case "WINNT": - case "Windows": - $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; - break; - default: - $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; - break; - } - - if ($simple) { - $filename_dot .= "_simple"; - } - if ($nooverlap) { - $filename_dot .= "_nooverlap"; - } - $filename_dot .= "_" . $id . ".dot"; + if ($map_filter['empty_map']) { + // Open Graph + $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, + $ranksep, $font_size, null); + $graph .= networkmap_create_pandora_node (__('Pandora FMS'), $font_size, $simple); + $graph .= networkmap_close_graph (); - file_put_contents($filename_dot, $graph); + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; + break; + default: + $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; + break; + } + + if ($simple) { + $filename_dot .= "_simple"; + } + if ($nooverlap) { + $filename_dot .= "_nooverlap"; + } + $filename_dot .= "_" . $id . ".dot"; - switch (PHP_OS) { - case "WIN32": - case "WINNT": - case "Windows": - $filename_plain = sys_get_temp_dir() . "\\plain.txt"; - - $cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " . - $filename_dot); - break; - default: - $filename_plain = sys_get_temp_dir() . "/plain.txt"; + file_put_contents($filename_dot, $graph); - $cmd = "$filter -Tplain -o " . $filename_plain . " " . - $filename_dot; - break; - } + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_plain = sys_get_temp_dir() . "\\plain.txt"; + + $cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " . + $filename_dot); + break; + default: + $filename_plain = sys_get_temp_dir() . "/plain.txt"; - system ($cmd); - - unlink($filename_dot); - - $nodes = networkmap_loadfile($id, $filename_plain, - $relation_nodes, $graph); - - unlink($filename_plain); + $cmd = "$filter -Tplain -o " . $filename_plain . " " . + $filename_dot; + break; + } - //Set the position of modules - foreach ($nodes as $key => $node) { - if ($node['type'] == 'module') { - //Search the agent of this module for to get the - //position - foreach ($nodes as $key2 => $node2) { - if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') { - if ($node2['id_agent'] == $node['id_agent']) { - $nodes[$key]['coords'][0] = - $nodes[$key2]['coords'][0] + $node['height'] / 2; - $nodes[$key]['coords'][1] = - $nodes[$key2]['coords'][1] + $node['width'] / 2; + system ($cmd); + + unlink($filename_dot); + + $nodes = networkmap_loadfile($id, $filename_plain, + $relation_nodes, $graph); + + unlink($filename_plain); + + //Set the position of modules + foreach ($nodes as $key => $node) { + if ($node['type'] == 'module') { + //Search the agent of this module for to get the + //position + foreach ($nodes as $key2 => $node2) { + if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') { + if ($node2['id_agent'] == $node['id_agent']) { + $nodes[$key]['coords'][0] = + $nodes[$key2]['coords'][0] + $node['height'] / 2; + $nodes[$key]['coords'][1] = + $nodes[$key2]['coords'][1] + $node['width'] / 2; + } } } } } + + $nodes_and_relations['nodes'] = array(); + $index = 0; + foreach ($nodes as $key => $node) { + $nodes_and_relations['nodes'][$index]['id_map'] = $id; + + $nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0]; + $nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1]; + + if (($node['type'] == 'agent') || ($node['type'] == '')) { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 0; + } + else { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module']; + $nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 1; + } + + $style = array(); + $style['shape'] = 'circle'; + $style['image'] = $node['image']; + $style['width'] = $node['width']; + $style['height'] = $node['height']; + $style['label'] = $node['text']; + $style['id_networkmap'] = $node['networkmap']; + $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); + + $index++; + } + + $nodes_and_relations['relations'] = array(); + + if (enterprise_installed()) { + enterprise_include_once("include/functions_pandora_networkmap.php"); + save_generate_nodes($id, $nodes_and_relations); + } + } + else { + // Generate dot file + $graph = networkmap_generate_dot (__('Pandora FMS'), + $id_group, + $simple, + $font_size, + $layout, + $nooverlap, + $zoom, + $ranksep, + $center, + $regen, + $pure, + $id, + $show_snmp_modules, + false, //cut_names + true, // relative + '', + $ip_mask, + $dont_show_subgroups, + false, + null, + $old_mode, + $map_filter); + + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; + break; + default: + $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; + break; + } + + if ($simple) { + $filename_dot .= "_simple"; + } + if ($nooverlap) { + $filename_dot .= "_nooverlap"; + } + $filename_dot .= "_" . $id . ".dot"; + + file_put_contents($filename_dot, $graph); + + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_plain = sys_get_temp_dir() . "\\plain.txt"; + + $cmd = io_safe_output($config['graphviz_bin_dir'] . "\\$filter.exe -Tplain -o " . $filename_plain . " " . + $filename_dot); + break; + default: + $filename_plain = sys_get_temp_dir() . "/plain.txt"; + + $cmd = "$filter -Tplain -o " . $filename_plain . " " . + $filename_dot; + break; + } + + system ($cmd); + + unlink($filename_dot); + + $nodes = networkmap_loadfile($id, $filename_plain, + $relation_nodes, $graph); + + unlink($filename_plain); + + //Set the position of modules + foreach ($nodes as $key => $node) { + if ($node['type'] == 'module') { + //Search the agent of this module for to get the + //position + foreach ($nodes as $key2 => $node2) { + if ($node2['id_agent'] != 0 && $node2['type'] == 'agent') { + if ($node2['id_agent'] == $node['id_agent']) { + $nodes[$key]['coords'][0] = + $nodes[$key2]['coords'][0] + $node['height'] / 2; + $nodes[$key]['coords'][1] = + $nodes[$key2]['coords'][1] + $node['width'] / 2; + } + } + } + } + } + + $nodes_and_relations['nodes'] = array(); + $index = 0; + $node_center = array(); + foreach ($nodes as $key => $node) { + $nodes_and_relations['nodes'][$index]['id_map'] = $id; + + $children_count = 0; + foreach ($relation_nodes as $relation) { + if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) { + if ($nodes[$relation['id_parent']]['id_agent'] == $node['id_agent']) { + $children_count++; + } + } + else if ($relation['parent_type'] == 'module') { + if ($nodes[$relation['id_parent']]['id_module'] == $node['id_module']) { + $children_count++; + } + } + + } + + if (empty($node_center) || $node_center['counter'] < $children_count) { + $node_center['x'] = (int)$node['coords'][0]; + $node_center['y'] = (int)$node['coords'][1]; + $node_center['counter'] = $children_count; + } + + $nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0]; + $nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1]; + + if (($node['type'] == 'agent') || ($node['type'] == '')) { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 0; + } + else { + $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module']; + $nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent']; + $nodes_and_relations['nodes'][$index]['type'] = 1; + } + + $style = array(); + $style['shape'] = 'circle'; + $style['image'] = $node['image']; + $style['width'] = $node['width']; + $style['height'] = $node['height']; + $style['label'] = $node['text']; + $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); + + $index++; + } + + $nodes_and_relations['relations'] = array(); + $index = 0; + foreach ($relation_nodes as $relation) { + $nodes_and_relations['relations'][$index]['id_map'] = $id; + + if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) { + $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; + $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent']; + $nodes_and_relations['relations'][$index]['parent_type'] = 0; + } + else if ($relation['parent_type'] == 'module') { + $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; + $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module']; + $nodes_and_relations['relations'][$index]['parent_type'] = 1; + } + else { + $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; + $nodes_and_relations['relations'][$index]['parent_type'] = 3; + } + + if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) { + $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent']; + $nodes_and_relations['relations'][$index]['child_type'] = 0; + } + else if ($relation['child_type'] == 'module') { + $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module']; + $nodes_and_relations['relations'][$index]['child_type'] = 1; + } + else { + $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; + $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; + $nodes_and_relations['relations'][$index]['child_type'] = 3; + } + + $index++; + } + + if (enterprise_installed()) { + enterprise_include_once("include/functions_pandora_networkmap.php"); + save_generate_nodes($id, $nodes_and_relations); + } + + $pandorafms_node = $nodes_and_relations['nodes'][0]; + $center = array('x' => $node_center['x'], 'y' => $node_center['y']); + + $networkmap['center_x'] = $center['x']; + $networkmap['center_y'] = $center['y']; + db_process_sql_update('tmap', + array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']), + array('id' => $id)); } - $nodes_and_relations['nodes'] = array(); - $index = 0; - foreach ($nodes as $key => $node) { - $nodes_and_relations['nodes'][$index]['id_map'] = $id; - - $nodes_and_relations['nodes'][$index]['x'] = (int)$node['coords'][0]; - $nodes_and_relations['nodes'][$index]['y'] = (int)$node['coords'][1]; - - if (($node['type'] == 'agent') || ($node['type'] == '')) { - $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_agent']; - $nodes_and_relations['nodes'][$index]['type'] = 0; - } - else { - $nodes_and_relations['nodes'][$index]['source_data'] = $node['id_module']; - $nodes_and_relations['nodes'][$index]['id_agent'] = $node['id_agent']; - $nodes_and_relations['nodes'][$index]['type'] = 1; - } - - $style = array(); - $style['shape'] = 'circle'; - $style['image'] = $node['image']; - $style['width'] = $node['width']; - $style['height'] = $node['height']; - $style['label'] = $node['text']; - $nodes_and_relations['nodes'][$index]['style'] = json_encode($style); - - $index++; - } - - $nodes_and_relations['relations'] = array(); - $index = 0; - foreach ($relation_nodes as $relation) { - $nodes_and_relations['relations'][$index]['id_map'] = $id; - - if (($relation['parent_type'] == 'agent') || ($relation['parent_type'] == '')) { - $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; - $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_agent']; - $nodes_and_relations['relations'][$index]['parent_type'] = 0; - } - else if ($relation['parent_type'] == 'module') { - $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; - $nodes_and_relations['relations'][$index]['id_parent_source_data'] = $nodes[$relation['id_parent']]['id_module']; - $nodes_and_relations['relations'][$index]['parent_type'] = 1; - } - else { - $nodes_and_relations['relations'][$index]['id_parent'] = $relation['id_parent']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; - $nodes_and_relations['relations'][$index]['parent_type'] = 3; - } - - if (($relation['child_type'] == 'agent') || ($relation['child_type'] == '')) { - $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_agent']; - $nodes_and_relations['relations'][$index]['child_type'] = 0; - } - else if ($relation['child_type'] == 'module') { - $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = $nodes[$relation['id_child']]['id_module']; - $nodes_and_relations['relations'][$index]['child_type'] = 1; - } - else { - $nodes_and_relations['relations'][$index]['id_child'] = $relation['id_child']; - $nodes_and_relations['relations'][$index]['id_child_source_data'] = -2; - $nodes_and_relations['relations'][$index]['child_type'] = 3; - } - - $index++; - } - - if (enterprise_installed()) { - enterprise_include_once("include/functions_pandora_networkmap.php"); - save_generate_nodes($id, $nodes_and_relations); - } - - $pandorafms_node = $nodes_and_relations['nodes'][0]; - $center = array('x' => $pandorafms_node['x'], 'y' => $pandorafms_node['y']); - - $networkmap['center_x'] = $center['x']; - $networkmap['center_y'] = $center['y']; - db_process_sql_update('tmap', - array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']), - array('id' => $id)); } return $nodes_and_relations; @@ -342,6 +477,7 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area $item['py'] = (int)$node['y']; $item['z'] = (int)$node['z']; $item['state'] = $node['state']; + $item['deleted'] = $node['deleted']; if ($item['state'] == 'holding_area') { //40 = DEFAULT NODE RADIUS //30 = for to align @@ -374,6 +510,7 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area $item['image_width'] = (int)$image_size[0]; $item['image_height'] = (int)$image_size[1]; } + $item['raw_text'] = $node['style']['label']; $item['text'] = io_safe_output($node['style']['label']); $item['shape'] = $node['style']['shape']; switch ($node['type']) { @@ -398,6 +535,13 @@ function networkmap_db_node_to_js_node($node, &$count, &$count_item_holding_area if (isset($node['id_map'])) { $item['map_id'] = $node['id_map']; } + + if (!isset($node['style']['id_networkmap']) || $node['style']['id_networkmap'] == '' || $node['style']['id_networkmap'] == 0) { + $item['networkmap_id'] = 0; + } + else { + $item['networkmap_id'] = $node['style']['id_networkmap']; + } $count++; @@ -517,8 +661,10 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['id_agent_start'] = (int)$id_source_agent; $item['id_module_end'] = 0; $item['id_agent_end'] = (int)$id_target_agent; + $item['link_color'] = "#999"; $item['target'] = -1; $item['source'] = -1; + $item['deleted'] = $relation['deleted']; if (enterprise_installed()) { $target_and_source = array(); @@ -548,7 +694,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['arrow_end'] = 'module'; $item['status_end'] = modules_get_agentmodule_status((int)$id_target_module, false, false, null); $item['id_module_end'] = (int)$id_target_module; - $text_end = io_safe_output(modules_get_agentmodule_name((int)$id_target_module)); + $text_end = modules_get_agentmodule_name((int)$id_target_module); if (preg_match ("/(.+)_ifOperStatus$/" , (string)$text_end, $matches)) { if ($matches[1]) { $item['text_end'] = $matches[1]; @@ -559,7 +705,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $item['arrow_start'] = 'module'; $item['status_start'] = modules_get_agentmodule_status((int)$id_source_module, false, false, null); $item['id_module_start'] = (int)$id_source_module; - $text_start = io_safe_output(modules_get_agentmodule_name((int)$id_source_module)); + $text_start = modules_get_agentmodule_name((int)$id_source_module); if (preg_match ("/(.+)_ifOperStatus$/" , (string)$text_start, $matches)) { if ($matches[1]) { $item['text_start'] = $matches[1]; @@ -571,14 +717,42 @@ function networkmap_links_to_js_links($relations, $nodes_graph) { $agent2 = 0; if (($relation['parent_type'] == 1) && ($relation['child_type'] == 1)) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + $mod2_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if (($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) || ($mod2_status == AGENT_MODULE_STATUS_CRITICAL_BAD)) { + $item['link_color'] = "#FC4444"; + } + else if (($mod1_status == AGENT_MODULE_STATUS_WARNING) || ($mod2_status == AGENT_MODULE_STATUS_WARNING)) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['child_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_child_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = $relation['id_parent_source_data']; $agent2 = agents_get_agent_id_by_module_id($relation['id_child_source_data']); } else if ($relation['parent_type'] == 1) { + $mod1_status = db_get_value_filter('estado', 'tagente_estado', array('id_agente_modulo' => $relation['id_parent_source_data'])); + + if ($mod1_status == AGENT_MODULE_STATUS_CRITICAL_BAD) { + $item['link_color'] = "#FC4444"; + } + else if ($mod1_status == AGENT_MODULE_STATUS_WARNING) { + $item['link_color'] = "#FAD403"; + } + $agent = agents_get_agent_id_by_module_id($relation['id_parent_source_data']); $agent2 = $relation['id_child_source_data']; } @@ -716,7 +890,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $item = networkmap_db_node_to_js_node( $node, $count, $count_item_holding_area); - + if ($item['deleted']) { + continue; + } echo "networkmap.nodes.push(" . json_encode($item) . ");\n"; $nodes_graph[$item['id']] = $item; } @@ -732,6 +908,9 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das $links_js = networkmap_links_to_js_links($relations, $nodes_graph); foreach ($links_js as $link_js) { + if ($link_js['deleted']) { + continue; + } if ($link_js['target'] == -1) continue; if ($link_js['source'] == -1) @@ -789,6 +968,12 @@ function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_das echo "var set_center_menu = '" . __('Set center') . "';\n"; echo "var refresh_menu = '" . __('Refresh') . "';\n"; echo "var refresh_holding_area_menu = '" . __('Refresh Holding area') . "';\n"; + echo "var ok_button = '" . __('Proceed') . "';\n"; + echo "var message_to_confirm = '" . __('Resetting the map will delete all customizations you have done, including manual relationships between elements, new items, etc.') . "';\n"; + echo "var warning_message = '" . __('WARNING') . "';\n"; + echo "var ok_button = '" . __('Proceed') . "';\n"; + echo "var cancel_button = '" . __('Cancel') . "';\n"; + echo "var restart_map_menu = '" . __('Restart map') . "';\n"; echo "var abort_relationship_interface = '" . __('Abort the interface relationship') . "';\n"; echo "var abort_relationship_menu = '" . __('Abort the action of set relationship') . "';\n"; @@ -874,7 +1059,6 @@ function networkmap_loadfile($id = 0, $file = '', modules_get_agentmodule_agent($ids[$node_id]['id_module']); $text = modules_get_agentmodule_name($data['id_module']); - $text = io_safe_output($text); $text = ui_print_truncate_text($text, 'agent_medium', false, true, false, '...', false); @@ -885,7 +1069,6 @@ function networkmap_loadfile($id = 0, $file = '', $data['id_agent'] = $ids[$node_id]['id_agent']; $text = agents_get_alias($ids[$node_id]['id_agent']); - $text = io_safe_output($text); $text = ui_print_truncate_text($text, 'agent_medium', false, true, false, '...', false); @@ -975,7 +1158,7 @@ function duplicate_networkmap($id) { $values = db_get_row('tmap', 'id', $id); unset($values['id']); $free_name = false; - $values['name'] = io_safe_input(__('Copy of ') . io_safe_output($values['name'])); + $values['name'] = io_safe_input(__('Copy of ')) . $values['name']; $count = 1; while (!$free_name) { $exist = db_get_row_filter('tmap', array('name' => $values['name'])); @@ -1336,7 +1519,6 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = } .link { - stroke: #999; stroke-opacity: .6; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 72ab847d48..c058d94188 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -190,6 +190,9 @@ function reporting_make_reporting_data($report = null, $id_report, $items_label['id_agent_module'] = $content['id_agent_module']; $items_label['modules'] = $modules_to_macro; $items_label['agents'] = $agents_to_macro; + $items_label['visual_format'] = $visual_format; + $metaconsole_on = is_metaconsole(); + $server_name = $content['server_name']; //Metaconsole connection if ($metaconsole_on && $server_name != '') { @@ -232,6 +235,12 @@ function reporting_make_reporting_data($report = null, $id_report, $report, $content); break; + case 'increment': + $report['contents'][] = + reporting_increment( + $report, + $content); + break; case 'general': $report['contents'][] = reporting_general( @@ -290,19 +299,19 @@ function reporting_make_reporting_data($report = null, $id_report, $report['contents'][] = reporting_value( $report, $content, - 'max'); + 'max',$pdf); break; case 'avg_value': $report['contents'][] = reporting_value( $report, $content, - 'avg'); + 'avg',$pdf); break; case 'min_value': $report['contents'][] = reporting_value( $report, $content, - 'min'); + 'min',$pdf); break; case 'sumatory': $report['contents'][] = reporting_value( @@ -776,8 +785,8 @@ function reporting_SLA($report, $content, $type = 'dinamic', } $data = array(); - $data['agent'] = modules_get_agentmodule_agent_alias($sla['id_agent_module']); - $data['module'] = modules_get_agentmodule_name($sla['id_agent_module']); + $data['agent'] = io_safe_output(modules_get_agentmodule_agent_alias($sla['id_agent_module'])); + $data['module'] = io_safe_output(modules_get_agentmodule_name($sla['id_agent_module'])); $data['max'] = $sla['sla_max']; $data['min'] = $sla['sla_min']; $data['sla_limit'] = $sla['sla_limit']; @@ -886,8 +895,8 @@ function reporting_SLA($report, $content, $type = 'dinamic', // Slice graphs calculation if ($show_graphs) { $dataslice = array(); - $dataslice['agent'] = modules_get_agentmodule_agent_alias ($sla['id_agent_module']); - $dataslice['module'] = modules_get_agentmodule_name ($sla['id_agent_module']); + $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'])); $dataslice['sla_value'] = $data['sla_value']; $dataslice['order'] = $data['sla_value']; @@ -1295,7 +1304,9 @@ function reporting_event_top_n($report, $content, $type = 'dinamic', $config['font_size'], true, $ttl, - $config['homeurl']); + $config['homeurl'], + 'white', + 'black'); } $return['resume'] = null; @@ -3752,7 +3763,7 @@ function reporting_agent_configuration($report, $content) { return reporting_check_structure_content($return); } -function reporting_value($report, $content, $type) { +function reporting_value($report, $content, $type,$pdf) { global $config; $return = array(); @@ -3837,8 +3848,14 @@ function reporting_value($report, $content, $type) { $return['agent_name'] = $agent_name; $return['module_name'] = $module_name; + if($pdf){ + $only_image = 1; + } + switch ($type) { case 'max': + if($content['lapse_calc'] == 0){ + $value = reporting_get_agentmodule_data_max( $content['id_agent_module'], $content['period'], $report["datetime"]); if (!$config['simple_module_value']) { @@ -3847,18 +3864,286 @@ function reporting_value($report, $content, $type) { else { $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; } - break; + + } + else{ + + $value = ' + + + + + + + + + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Maximum").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_max( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= + grafico_modulo_sparse( + $content['id_agent_module'], + $content['period'], + false, + 600, + 300, + '', + '', + false, + 0, + true, + $report["datetime"], + '', + 0, + 0, + true, + $only_image, + ui_get_full_url(false, false, false, false), + 2, + false, + '', + $time_compare_overlapped, + true, + true, + 'white', + ($content['style']['percentil'] == 1) ? $config['percentil'] : null, + false, + false, + $config['type_module_charts'], + false, + false, + $content['lapse_calc'], + $content['lapse'], + 1); + } + + $value .= ' + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
+ '.__("Lapse").' + + '.__("Maximum").' +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_max( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; + } + + $value .= ' + +
'; + + $formated_value = $value; + } + + break; case 'min': - $value = reporting_get_agentmodule_data_min( - $content['id_agent_module'], $content['period'], $report["datetime"]); - if (!$config['simple_module_value']) { + if($content['lapse_calc'] == 0){ + $value = reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content['period'], $report["datetime"]); + + if (!$config['simple_module_value']) { + $formated_value = $value; + } + else { + $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; + } + + } + else{ + + $value = ' + + + + + + + + + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Minimum").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= + grafico_modulo_sparse( + $content['id_agent_module'], + $content['period'], + false, + 600, + 300, + '', + '', + false, + 0, + true, + $report["datetime"], + '', + 0, + 0, + true, + $only_image, + ui_get_full_url(false, false, false, false), + 2, + false, + '', + $time_compare_overlapped, + true, + true, + 'white', + ($content['style']['percentil'] == 1) ? $config['percentil'] : null, + false, + false, + $config['type_module_charts'], + false, + false, + $content['lapse_calc'], + $content['lapse'], + 0, + 1); + } + + $value .= ' + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
+ '.__("Lapse").' + + '.__("Minimum").' +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_min( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; + } + + $value .= ' + +
'; + $formated_value = $value; } - else { - $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; - } + break; case 'avg': + if($content['lapse_calc'] == 0){ $value = reporting_get_agentmodule_data_average( $content['id_agent_module'], $content['period'], $report["datetime"]); if (!$config['simple_module_value']) { @@ -3867,7 +4152,138 @@ function reporting_value($report, $content, $type) { else { $formated_value = format_for_graph($value, $config['graph_precision']) . " " . $unit; } - break; + } + else{ + $value = ' + + + + + + + + + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 2 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + + + + + +
+ '.__("Agent").' + + '.__("Module").' + + '.__("Average").' +
+ '.$agent_name.' + + '.$module_name.' + + '.format_for_graph(reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content['period'], $report["datetime"]), $config['graph_precision']) . ' ' . $unit.' +
'; + + } + + $value .= ' +
+ '; + + if($content['visual_format'] == 2 || $content['visual_format'] == 3){ + $value .= + grafico_modulo_sparse( + $content['id_agent_module'], + $content['period'], + false, + 600, + 300, + '', + '', + false, + 1, + true, + $report["datetime"], + '', + 0, + 0, + true, + $only_image, + ui_get_full_url(false, false, false, false), + 2, + false, + '', + $time_compare_overlapped, + true, + true, + 'white', + ($content['style']['percentil'] == 1) ? $config['percentil'] : null, + false, + false, + $config['type_module_charts'], + false, + false, + $content['lapse_calc'], + $content['lapse'] + ); + } + + $value .= ' + +
'; + + if($content['visual_format'] == 1 || $content['visual_format'] == 3){ + + $value .= ' + + + + + + '; + $time_begin = db_get_row_sql('select utimestamp from tagente_datos where id_agente_modulo ='.$content['id_agent_module']); + $date_reference = getdate(); + + for ($i=$date_reference[0]; $i > ($date_reference[0]-$content["period"]); $i -= $content["lapse"]) { + + $value .= ''; + } + else{ + $value .= 'N/A'; + } + + } + + $value .='
+ '.__("Lapse").' + + '.__("Average").' +
'. date("Y-m-d H:i:s", ($i-$content["lapse"]+1)).' to '.date("Y-m-d H:i:s",$i).''; + + if($i>$time_begin['utimestamp']){ + $value .= format_for_graph(reporting_get_agentmodule_data_average( + $content['id_agent_module'], $content["lapse"], $i), $config['graph_precision']) . ' ' . $unit.'
'; + } + + $value .= ' + +
'; + + $formated_value = $value; + + } + break; + case 'sum': $value = reporting_get_agentmodule_data_sum( $content['id_agent_module'], $content['period'], $report["datetime"]); @@ -5571,6 +5987,101 @@ function reporting_availability_graph($report, $content, $pdf=false) { return reporting_check_structure_content($return); } +/** + * reporting_increment + * + * Generates a structure the report. + * + */ +function reporting_increment ($report, $content) { + global $config; + + $return = array(); + $return['type'] = 'increment'; + if (empty($content['name'])) { + $content['name'] = __('Increment'); + } + + $return['title'] = $content['name']; + $return["description"] = $content["description"]; + $return["id_agent_module"] = $content["id_agent_module"]; + $return["id_agent"] = $content["id_agent"]; + + $id_agent_module = $content['id_agent_module']; + $period = (int)$content['period']; + + $return["from"] = time() - $period; + $return["to"] = time(); + + $return["data"] = array(); + + if (defined('METACONSOLE')) { + $sql1 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' + AND utimestamp <= ' . (time() - $period) . ' ORDER BY utimestamp DESC'; + $sql2 = 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'; + + $servers = db_get_all_rows_sql ('SELECT * + FROM tmetaconsole_setup + WHERE disabled = 0'); + + if ($servers === false) + $servers = array(); + + $result = array(); + $count_modules = 0; + foreach ($servers as $server) { + // If connection was good then retrieve all data server + if (metaconsole_connect($server) == NOERR) + $connection = true; + else + $connection = false; + + $old_data = db_get_value_sql ($sql1); + + $last_data = db_get_value_sql ($sql2); + } + } + else { + $old_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' + AND utimestamp <= ' . (time() - $period) . ' ORDER BY utimestamp DESC'); + + $last_data = db_get_value_sql('SELECT datos FROM tagente_datos WHERE id_agente_modulo = ' . $id_agent_module . ' ORDER BY utimestamp DESC'); + } + + if (!defined('METACONSOLE')) { + + } + + if ($old_data === false || $last_data === false) { + $return["data"]['message'] = __('The monitor have no data in this range of dates or monitor type is not numeric'); + $return["data"]['error'] = true; + } + else if (is_numeric($old_data) && is_numeric($last_data)) { + $return["data"]['old'] = $old_data; + $return["data"]['now'] = $last_data; + $increment = $old_data - $last_data; + + if ($increment < 0) { + $return["data"]['inc'] = 'positive'; + $return["data"]["inc_data"] = $last_data - $old_data; + } + else if ($increment == 0) { + $return["data"]['inc'] = 'neutral'; + $return["data"]["inc_data"] = 0; + } + else { + $return["data"]['inc'] = 'negative'; + $return["data"]["inc_data"] = $old_data - $last_data; + } + } + else { + $return["data"]['message'] = __('The monitor type is not numeric'); + $return["data"]['error'] = true; + } + + return reporting_check_structure_content($return); +} + /** * reporting_general * @@ -7249,19 +7760,19 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he if ($links === false) { $urls = array(); $urls['monitor_critical'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; $urls['monitor_warning'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; $urls['monitor_ok'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; $urls['monitor_unknown'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; $urls['monitor_not_init'] = "index.php?" . - "sec=estado&sec2=operation/agentes/status_monitor&" . + "sec=view&sec2=operation/agentes/status_monitor&" . "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; } else { @@ -7361,7 +7872,7 @@ function reporting_get_stats_agents_monitors($data) { else { $urls = array(); $urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - $urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; + $urls['monitor_checks'] = "index.php?sec=view&sec2=operation/agentes/status_monitor&refr=60&status=-1"; } // Agents and modules table diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index cb29812686..eca001e288 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -208,6 +208,9 @@ function reporting_html_print_report($report, $mini = false, $report_info = 1) { case 'avg_value': reporting_html_avg_value($table, $item, $mini); break; + case 'increment': + reporting_html_increment($table, $item); + break; case 'min_value': reporting_html_min_value($table, $item, $mini); break; @@ -2213,6 +2216,69 @@ function reporting_html_value(&$table, $item, $mini, $only_value = false, $check $table->data['data']['cell'] .= '

'; } +function reporting_html_increment(&$table, $item) { + global $config; + + if (isset($item["data"]['error'])) { + $table->colspan['error']['cell'] = 3; + $table->data['error']['cell'] = $item["data"]['message']; + } + else { + $table1 = new stdClass(); + $table1->width = '99%'; + $table1->data = array (); + + $table1->head = array (); + $table1->head[0] = __('Agent'); + $table1->head[1] = __('Module'); + $table1->head[2] = __('From'); + $table1->head[3] = __('To'); + $table1->head[4] = __('From data'); + $table1->head[5] = __('To data'); + $table1->head[6] = __('Increment'); + + $table1->headstyle = array(); + $table1->headstyle[0] = 'text-align: left'; + $table1->headstyle[1] = 'text-align: left'; + $table1->headstyle[2] = 'text-align: left'; + $table1->headstyle[3] = 'text-align: left'; + $table1->headstyle[4] = 'text-align: right'; + $table1->headstyle[5] = 'text-align: right'; + $table1->headstyle[6] = 'text-align: right'; + + $table1->style[0] = 'text-align: left'; + $table1->style[1] = 'text-align: left'; + $table1->style[2] = 'text-align: left'; + $table1->style[3] = 'text-align: left'; + $table1->style[4] = 'text-align: right'; + $table1->style[5] = 'text-align: right'; + $table1->style[6] = 'text-align: right'; + + $table1_row = array(); + $table1_row[0] = agents_get_alias($item['id_agent']); + $table1_row[1] = modules_get_agentmodule_name($item['id_agent_module']); + $table1_row[2] = date("F j, Y, G:i", $item['from']); + $table1_row[3] = date("F j, Y, G:i", $item['to']); + $table1_row[4] = $item["data"]['old']; + $table1_row[5] = $item["data"]['now']; + if ($item["data"]['inc'] == 'negative') { + $table1_row[6] = __('Negative increase: ') . $item["data"]["inc_data"]; + } + else if ($item["data"]['inc'] == 'positive') { + $table1_row[6] = __('Positive increase: ') . $item["data"]["inc_data"]; + } + else { + $table1_row[6] = __('Neutral increase: ') . $item["data"]["inc_data"]; + } + + $table1->data[] = $table1_row; + + $data = array(); + $data[0] = html_print_table($table1, true); + array_push ($table->data, $data); + } +} + function reporting_html_url(&$table, $item, $key) { $table->colspan['data']['cell'] = 3; $table->cellstyle['data']['cell'] = 'text-align: left;'; diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index 9282be345b..dfa3d3d490 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -574,7 +574,8 @@ function reports_get_report_types ($template = false, $not_editor = false) { 'name' => __('Summatory')); $types['historical_data'] = array('optgroup' => __('Modules'), 'name' => __('Historical Data')); - + $types['increment'] = array('optgroup' => __('Modules'), + 'name' => __('Increment')); $types['general'] = array('optgroup' => __('Grouped'), diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index b98d66789b..1f80421fa5 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -196,7 +196,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - $command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir; + $command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg(io_safe_output($community)) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir; } exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc); } @@ -216,7 +216,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } } } @@ -236,7 +236,7 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve } } else { - exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } } @@ -348,7 +348,7 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = ' exec ($snmpget_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } else { - exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); + exec ($snmpget_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -On -c ' . escapeshellarg(io_safe_output($community)) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($target_oid) . ' 2> ' . $error_redir_dir, $output, $rc); } if ($rc != 0) { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index de10fcaf91..e76ba9399f 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -94,22 +94,27 @@ function ui_print_truncate_text($text, $numChars = GENERIC_SIZE_TEXT, $showTextI } } - $text = io_safe_output($text); - if (mb_strlen($text, "UTF-8") > ($numChars)) { + $text_html_decoded = io_safe_output($text); + $text_has_entities = $text != $text_html_decoded; + + if (mb_strlen($text_html_decoded, "UTF-8") > ($numChars)) { // '/2' because [...] is in the middle of the word. $half_length = intval(($numChars - 3) / 2); // Depending on the strange behavior of mb_strimwidth() itself, // the 3rd parameter is not to be $numChars but the length of // original text (just means 'large enough'). - $truncateText2 = mb_strimwidth($text, - (mb_strlen($text, "UTF-8") - $half_length), - mb_strlen($text, "UTF-8"), "", "UTF-8" ); + $truncateText2 = mb_strimwidth($text_html_decoded, + (mb_strlen($text_html_decoded, "UTF-8") - $half_length), + mb_strlen($text_html_decoded, "UTF-8"), "", "UTF-8" ); - $truncateText = mb_strimwidth($text, 0, - ($numChars - $half_length), "", "UTF-8") . $suffix; + $truncateText = mb_strimwidth($text_html_decoded, 0, + ($numChars - $half_length), "", "UTF-8"); - $truncateText = $truncateText . $truncateText2; + // Recover the html entities to avoid XSS attacks + $truncateText = ($text_has_entities) + ? io_safe_input($truncateText) . $suffix . io_safe_input($truncateText2) + : $truncateText . $suffix . $truncateText2; if ($showTextInTitle) { if ($style === null) { @@ -2968,6 +2973,11 @@ function ui_print_agent_autocomplete_input($parameters) { else $metaconsole_enabled = false; } + + $get_only_string_modules = false; + if (isset($parameters['get_only_string_modules'])) { + $get_only_string_modules = true; + } $spinner_image = html_print_image('images/spinner.gif', true, false, true); if (isset($parameters['spinner_image'])) { @@ -3029,7 +3039,10 @@ function ui_print_agent_autocomplete_input($parameters) { $javascript = $parameters['javascript']; } - + $get_order_json = false; + if (isset($parameters['get_order_json'])) { + $get_order_json = true; + } $javascript_is_function_select = false; //Default value if (isset($parameters['javascript_is_function_select'])) { @@ -3116,6 +3129,14 @@ function ui_print_agent_autocomplete_input($parameters) { if (' . ((int) !$metaconsole_enabled) . ') { inputs.push ("force_local_modules=1"); } + + if (' . ((int) $get_order_json) . ') { + inputs.push ("get_order_json=1"); + } + + if (' . ((int) $get_only_string_modules) . ') { + inputs.push ("get_only_string_modules=1"); + } if (' . ((int)$metaconsole_enabled) . ') { if ((' . ((int)$use_input_server) . ') diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 8e3eac823b..957c8c569e 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -152,6 +152,8 @@ function users_get_groups_for_select($id_user, $privilege = "AR", $returnAllGro * @return array A list of the groups the user has certain privileges. */ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo') { + static $group_cache = array(); + if (empty ($id_user)) { global $config; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index e22c3f90dd..f602343597 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -111,6 +111,14 @@ function visual_map_print_item($mode = "read", $layoutData, $border_color = $layoutData['border_color']; $fill_color = $layoutData['fill_color']; $label_position = $layoutData['label_position']; + $show_on_top = $layoutData['show_on_top']; + + if($show_on_top){ + $show_on_top_index = 10; + } + else{ + $show_on_top_index = ''; + } $sizeStyle = ''; $borderStyle = ''; @@ -385,6 +393,9 @@ function visual_map_print_item($mode = "read", $layoutData, case AUTO_SLA_GRAPH: $link = true; break; + case DONUT_GRAPH: + $link = true; + break; default: if (!empty($element_enterprise)) { $link = $element_enterprise['link']; @@ -439,7 +450,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -610,7 +621,7 @@ function visual_map_print_item($mode = "read", $layoutData, // Link to an module if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + 'index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -659,11 +670,11 @@ function visual_map_print_item($mode = "read", $layoutData, $url = $server["server_url"] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = - $config['homeurl'].'/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + $config['homeurl'].'/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } } else { @@ -727,7 +738,7 @@ function visual_map_print_item($mode = "read", $layoutData, else { if (empty($layoutData['id_metaconsole'])) { $url = $config['homeurl'] . - '/index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; + '/index.php?sec=view&sec2=operation/agentes/status_monitor&id_module=' . $layoutData['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( @@ -958,14 +969,14 @@ function visual_map_print_item($mode = "read", $layoutData, else { if ($width == 0 || $height == 0) { if ($layoutData['label_position']=='left') { - $img = '
'.custom_graphs_print( + $img = '
'.custom_graphs_print( $layoutData['id_custom_graph'], 180, 480, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, false, false, true, 1, false, true).'
'; } elseif ($layoutData['label_position']=='right') { - $img = '
'.custom_graphs_print( + $img = '
'.custom_graphs_print( $layoutData['id_custom_graph'], 180, 480, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, @@ -985,14 +996,14 @@ function visual_map_print_item($mode = "read", $layoutData, } else { if ($layoutData['label_position']=='left') { - $img = '
'.custom_graphs_print( + $img = '
'.custom_graphs_print( $layoutData['id_custom_graph'], $height, $width, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, false, false, true, 1, false, true).'
'; } elseif($layoutData['label_position']=='right') { - $img = '
'.custom_graphs_print( + $img = '
'.custom_graphs_print( $layoutData['id_custom_graph'], $height, $width, $period, null, true, 0, $only_image, $layoutData['image'], array(), '', array(), array(), true, @@ -1038,7 +1049,7 @@ function visual_map_print_item($mode = "read", $layoutData, if ($width == 0 || $height == 0) { if ($layoutData['label_position']=='left') { - $img = '
'. + $img = '
'. grafico_modulo_sparse($id_module, $period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', 1, false, '', @@ -1046,7 +1057,7 @@ function visual_map_print_item($mode = "read", $layoutData, null, true, false, $type_graph) . '
'; } elseif($layoutData['label_position']=='right') { - $img = '
' . + $img = '
' . grafico_modulo_sparse($id_module, $period, 0, 300, 180, modules_get_agentmodule_name($id_module),null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', @@ -1064,7 +1075,7 @@ function visual_map_print_item($mode = "read", $layoutData, } else{ if ($layoutData['label_position']=='left') { - $img = '
' . + $img = '
' . grafico_modulo_sparse($id_module, $period, 0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, '', @@ -1073,7 +1084,7 @@ function visual_map_print_item($mode = "read", $layoutData, false, $type_graph) . '
'; } elseif ($layoutData['label_position']=='right') { - $img = '
' . + $img = '
' . grafico_modulo_sparse($id_module, $period, 0, $width, $height, modules_get_agentmodule_name($id_module), null, false, 1, false, 0, modules_get_unit($id_module), 0, 0, true, $only_image, @@ -1137,224 +1148,180 @@ function visual_map_print_item($mode = "read", $layoutData, if ( (get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap') ) { if($width == 0){ - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; } - else { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + else{ + $img = ''; } } else{ - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; } - else { - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; - } - else{ - $img = ''; - } + else{ + $img = ''; } } } else { - if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || - ($is_string == 10) || ($is_string == 33)) { + $color = array(); - $color = array(); - - $color[0] = array('border' => '#000000', - 'color' => $config['graph_color1'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[1] = array('border' => '#000000', - 'color' => $config['graph_color2'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[2] = array('border' => '#000000', - 'color' => $config['graph_color3'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[3] = array('border' => '#000000', - 'color' => $config['graph_color4'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[4] = array('border' => '#000000', - 'color' => $config['graph_color5'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[5] = array('border' => '#000000', - 'color' => $config['graph_color6'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[6] = array('border' => '#000000', - 'color' => $config['graph_color7'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[7] = array('border' => '#000000', - 'color' => $config['graph_color8'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[8] = array('border' => '#000000', - 'color' => $config['graph_color9'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[9] = array('border' => '#000000', - 'color' => $config['graph_color10'], - 'alpha' => CHART_DEFAULT_ALPHA); - $color[11] = array('border' => '#000000', - 'color' => COL_GRAPH9, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[12] = array('border' => '#000000', - 'color' => COL_GRAPH10, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[13] = array('border' => '#000000', - 'color' => COL_GRAPH11, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[14] = array('border' => '#000000', - 'color' => COL_GRAPH12, - 'alpha' => CHART_DEFAULT_ALPHA); - $color[15] = array('border' => '#000000', - 'color' => COL_GRAPH13, - 'alpha' => CHART_DEFAULT_ALPHA); + $color[0] = array('border' => '#000000', + 'color' => $config['graph_color1'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[1] = array('border' => '#000000', + 'color' => $config['graph_color2'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[2] = array('border' => '#000000', + 'color' => $config['graph_color3'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[3] = array('border' => '#000000', + 'color' => $config['graph_color4'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[4] = array('border' => '#000000', + 'color' => $config['graph_color5'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[5] = array('border' => '#000000', + 'color' => $config['graph_color6'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[6] = array('border' => '#000000', + 'color' => $config['graph_color7'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[7] = array('border' => '#000000', + 'color' => $config['graph_color8'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[8] = array('border' => '#000000', + 'color' => $config['graph_color9'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[9] = array('border' => '#000000', + 'color' => $config['graph_color10'], + 'alpha' => CHART_DEFAULT_ALPHA); + $color[11] = array('border' => '#000000', + 'color' => COL_GRAPH9, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[12] = array('border' => '#000000', + 'color' => COL_GRAPH10, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[13] = array('border' => '#000000', + 'color' => COL_GRAPH11, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[14] = array('border' => '#000000', + 'color' => COL_GRAPH12, + 'alpha' => CHART_DEFAULT_ALPHA); + $color[15] = array('border' => '#000000', + 'color' => COL_GRAPH13, + 'alpha' => CHART_DEFAULT_ALPHA); - $module_data = get_bars_module_data($id_module); - $water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', - 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png'); - - if ($width == 0) { - if ($layoutData['label_position']=='left') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $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']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $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'], true) . '
'; - } - } - elseif($layoutData['label_position']=='right') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $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']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $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'], true) . '
'; - } + $module_data = get_bars_module_data($id_module); + $water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png', + 'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png'); + + if ($width == 0 && $height == 0) { + if ($layoutData['label_position']=='left') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $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 { - if ($layoutData['type_graph'] == 'horizontal') { - $img = hbar_graph(true, $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']); - } - else { - $img = vbar_graph(true, $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'], true); - } + $img = '
'. + vbar_graph(true, $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'], true, false, $layoutData['border_color']) . '
'; } } - else{ - if ($layoutData['label_position']=='left') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $module_data, - $width, $width, $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']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $module_data, - $width, $width, $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'], true) . '
'; - } - } - elseif($layoutData['label_position']=='right') { - if ($layoutData['type_graph'] == 'horizontal') { - $img = '
'. - hbar_graph(true, $module_data, - $width, $width, $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']) . '
'; - } - else { - $img = '
'. - vbar_graph(true, $module_data, - $width, $width, $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'], true) . '
'; - } + elseif($layoutData['label_position']=='right') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $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 { - if ($layoutData['type_graph'] == 'horizontal') { - $img = hbar_graph(true, $module_data, - $width, $width, $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']); - } - else { - $img = vbar_graph(true, $module_data, - $width, $width, $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'], true); - } + $img = '
'. + vbar_graph(true, $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'], true, false, $layoutData['border_color']) . '
'; + } + } + else { + if ($layoutData['type_graph'] == 'horizontal') { + $img = hbar_graph(true, $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, + 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'], true, false, $layoutData['border_color']); } } } - else { - if($width == 0){ - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + else{ + if ($layoutData['label_position']=='left') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $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 = ''; + else { + $img = '
'. + vbar_graph(true, $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'], true, false, $layoutData['border_color']) . '
'; } } - else{ - if ($layoutData['id_metaconsole'] != 0) { - $img = ''; + elseif($layoutData['label_position']=='right') { + if ($layoutData['type_graph'] == 'horizontal') { + $img = '
'. + hbar_graph(true, $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 = ''; + else { + $img = '
'. + vbar_graph(true, $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'], true, false, $layoutData['border_color']) . '
'; + } + } + else { + if ($layoutData['type_graph'] == 'horizontal') { + $img = hbar_graph(true, $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, + $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'], true, false, $layoutData['border_color']); } } } @@ -1367,6 +1334,88 @@ function visual_map_print_item($mode = "read", $layoutData, break; + case DONUT_GRAPH: + if (!empty($id_metaconsole)) { + $connection = db_get_row_filter ('tmetaconsole_setup', $id_metaconsole); + if (metaconsole_load_external_db($connection) != NOERR) { + continue; + } + } + + + $is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo', + array ('id_agente' => $layoutData['id_agent'], + 'id_agente_modulo' => $id_module)); + + if (!empty($id_metaconsole)) { + metaconsole_restore_db(); + } + + if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) || + ($is_string == 10) || ($is_string == 33)) { + $no_data = false; + } + else { + $no_data = true; + } + + if ($no_data) { + if($width == 0){ + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; + } + else{ + $img = ''; + } + } + else{ + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; + } + else{ + $img = ''; + } + } + } + else { + $donut_data = get_donut_module_data($layoutData['id_agente_modulo']); + + if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { + if($width == 0){ + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; + } + else{ + $img = ''; + } + } + else{ + if ($layoutData['id_metaconsole'] != 0) { + $img = ''; + } + else{ + $img = ''; + } + } + } + else { + if ($width == 0) { + $img = d3_donut_graph ($layoutData['id'], 300, 300, $donut_data, $layoutData['border_color']); + } + else{ + $img = d3_donut_graph ($layoutData['id'], $width, $width, $donut_data, $layoutData['border_color']); + } + } + } + + //Restore db connection + if ($layoutData['id_metaconsole'] != 0) { + metaconsole_restore_db(); + } + + $z_index = 2 + 1; + break; + case LABEL: $z_index = 4 + 1; break; @@ -1395,10 +1444,10 @@ function visual_map_print_item($mode = "read", $layoutData, else { if ($width == 0 || $height == 0) { if ($layoutData['label_position']=='left') { - $img = '
' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
'; + $img = '
' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
'; } elseif ($layoutData['label_position']=='right') { - $img = '
' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
'; + $img = '
' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true).'
'; } else { $img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], 500, 50, $layoutData['period'], '', true); @@ -1406,10 +1455,10 @@ function visual_map_print_item($mode = "read", $layoutData, } else{ if ($layoutData['label_position']=='left') { - $img = '
' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
'; + $img = '
' . graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
'; } elseif ($layoutData['label_position']=='right') { - $img = '
' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
'; + $img = '
' .graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true).'
'; } else { $img = graph_graphic_moduleevents ($layoutData['id_agent'], $layoutData['id_agente_modulo'], $width, $height, $layoutData['period'], '', true); @@ -1437,6 +1486,9 @@ function visual_map_print_item($mode = "read", $layoutData, case GROUP_ITEM: $class .= "group_item"; break; + case DONUT_GRAPH: + $class .= "donut_graph"; + break; case PERCENTILE_BAR: case PERCENTILE_BUBBLE: case CIRCULAR_PROGRESS_BAR: @@ -1471,6 +1523,10 @@ function visual_map_print_item($mode = "read", $layoutData, break; } + if($show_on_top){ + $z_index = 10; + } + echo '
"; } - + + //for clean link text from bbdd only edit_visualmap + if (get_parameter('action') == 'edit' || get_parameter('operation') == 'edit_visualmap') { + $text = preg_replace("/<\/*a.*?>/", '', $text); + } + switch ($type) { case BOX_ITEM: if ($width == 0 || $width == 0) { @@ -1492,7 +1553,7 @@ function visual_map_print_item($mode = "read", $layoutData, $style .= "border-width: " . $border_width . "px; "; $style .= "border-color: " . $border_color . "; "; $style .= "background-color: " . $fill_color . "; "; - echo "
"; + echo "
"; } else { if (!empty($proportion)) { @@ -1503,7 +1564,7 @@ function visual_map_print_item($mode = "read", $layoutData, $style .= "border-width: " . $border_width . "px; "; $style .= "border-color: " . $border_color . "; "; $style .= "background-color: " . $fill_color . "; "; - echo "
"; + echo "
"; } else { $style = ""; @@ -1513,13 +1574,14 @@ function visual_map_print_item($mode = "read", $layoutData, $style .= "border-width: " . $border_width . "px; "; $style .= "border-color: " . $border_color . "; "; $style .= "background-color: " . $fill_color . "; "; - echo "
"; + echo "
"; } } break; case STATIC_GRAPH: case GROUP_ITEM: - if ($layoutData['image'] != null || $layoutData['show_statistics'] == 1) { + + if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) { $img_style_title = strip_tags($label); @@ -1745,7 +1807,7 @@ function visual_map_print_item($mode = "read", $layoutData, } } else{ - $img = d3_progress_bar($id, $percentile, $width, 50, $border_color, $unit_text, $label, $fill_color); + $img = d3_progress_bar($id, $percentile, $width, 50, $border_color, $unit_text, io_safe_output($label), $fill_color); } echo $img; @@ -1784,10 +1846,10 @@ function visual_map_print_item($mode = "read", $layoutData, } else{ if($width == 0){ - $img = d3_progress_bubble($id, $percentile, 200,200, $border_color, $unit_text, $label, $fill_color); + $img = d3_progress_bubble($id, $percentile, 200,200, $border_color, $unit_text, io_safe_output($label), $fill_color); } else{ - $img = d3_progress_bubble($id, $percentile, $width, $width, $border_color, $unit_text, $label, $fill_color); + $img = d3_progress_bubble($id, $percentile, $width, $width, $border_color, $unit_text, io_safe_output($label), $fill_color); } } @@ -1827,10 +1889,10 @@ function visual_map_print_item($mode = "read", $layoutData, } if($width == 0){ - $img = progress_circular_bar($id, $percentile, 200,200, $border_color, $unit_text, $label, $fill_color); + $img = progress_circular_bar($id, $percentile, 200,200, $border_color, $unit_text, io_safe_output($label), $fill_color); } else{ - $img = progress_circular_bar($id, $percentile, $width, $width, $border_color, $unit_text, $label, $fill_color); + $img = progress_circular_bar($id, $percentile, $width, $width, $border_color, $unit_text, io_safe_output($label), $fill_color); } } @@ -1870,11 +1932,11 @@ function visual_map_print_item($mode = "read", $layoutData, } if($width == 0){ - $img = progress_circular_bar_interior($id, $percentile, 200,200, $border_color, $unit_text, $label, $fill_color); + $img = progress_circular_bar_interior($id, $percentile, 200,200, $border_color, $unit_text, io_safe_output($label), $fill_color); } else{ - $img = progress_circular_bar_interior($id, $percentile, $width, $width, $border_color, $unit_text, $label, $fill_color); + $img = progress_circular_bar_interior($id, $percentile, $width, $width, $border_color, $unit_text, io_safe_output($label), $fill_color); } } @@ -1923,6 +1985,10 @@ function visual_map_print_item($mode = "read", $layoutData, echo io_safe_output($text); } break; + case DONUT_GRAPH: + echo $img; + break; + case SIMPLE_VALUE: case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MIN: @@ -1952,39 +2018,25 @@ function visual_map_print_item($mode = "read", $layoutData, global $config; - if ($type == SIMPLE_VALUE) { - //~ $returnValue_value = explode(' ', $value); - - //~ if ($returnValue_value[1] != "") { - //~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])) . " " . $returnValue_value[1]; - //~ } - //~ else { - //~ $value = remove_right_zeros(number_format($returnValue_value[0], $config['graph_precision'])); - //~ } - - } - else { - // If the value is a string, dont format it - if (!is_string($value)) { - //~ $value = remove_right_zeros(format_for_graph($value, $config['graph_precision'])); - } - } - - if(get_parameter('action') == 'edit'){ - if( (strip_tags($io_safe_output_text) != '_VALUE_') || (strip_tags($io_safe_output_text) != '(_VALUE_)') ) { + $is_image = get_if_module_is_image($layoutData['id_agente_modulo']); + if(get_parameter('action') == 'edit') { + if(!$is_image) { echo $io_safe_output_text; } else { echo ""; } - } else { - if(strrpos(strip_tags($io_safe_output_text),'(_VALUE_)') !== false || (strip_tags($io_safe_output_text) == '(_VALUE_)')) { - echo str_replace(array("(_VALUE_)","(_value_)"), $value, $io_safe_output_text); + } + else { + if(!$is_image) { + $new_text = str_replace(array("(_VALUE_)","(_value_)"), $value, $io_safe_output_text); + $new_text = str_replace(array('_VALUE_','_value_'), $value, $new_text); + + echo $new_text; } - elseif(strrpos(strip_tags($io_safe_output_text),'_VALUE_') !== false || (strip_tags($io_safe_output_text) == '_VALUE_')) { - echo str_replace(array('_VALUE_','_value_'), $value, $io_safe_output_text); - } else { - echo str_replace('>', ' style="width:'.$layoutData['width'].'px">',$value); + else { + $simple_value_img = str_replace('>', ' style="width:'.$layoutData['width'].'px">', $value); + echo $simple_value_img; } } @@ -2074,6 +2126,20 @@ function visual_map_print_item($mode = "read", $layoutData, } } +function get_if_module_is_image ($id_module) { + $sql = 'SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $id_module; + + $result = db_get_sql($sql); + $image = strpos($result, 'data:image'); + + if($image === false){ + return false; + } + else{ + return true; + } +} + function get_bars_module_data ($id_module) { $mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module)); @@ -2089,7 +2155,7 @@ function get_bars_module_data ($id_module) { $color_index = 0; $total = 0; foreach ($values as $val) { - $data = explode(":", $val); + $data = explode(",", $val); $values_to_return[$data[0]] = array('g' =>$data[1]); } @@ -2465,6 +2531,88 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, return $return; } +function get_donut_module_data ($id_module) { + $mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module)); + + if (preg_match("/\r\n/", $mod_values)) { + $values = explode("\r\n", $mod_values); + } + elseif (preg_match("/\n/", $mod_values)) { + $values = explode("\n", $mod_values); + } + + $colors = array(); + $colors[] = "#aa3333"; + $colors[] = "#045FB4"; + $colors[] = "#8181F7"; + $colors[] = "#F78181"; + $colors[] = "#D0A9F5"; + $colors[] = "#BDBDBD"; + $colors[] = "#6AB277"; + + $max_elements = 6; + $values_to_return = array(); + $index = 0; + $total = 0; + foreach ($values as $val) { + if ($index < $max_elements) { + $data = explode(",", $val); + if ($data[1] == 0) { + $data[1] = __('No data'); + } + $values_to_return[$index]['tag_name'] = $data[0] . ": " . $data[1]; + $values_to_return[$index]['color'] = $colors[$index]; + $values_to_return[$index]['value'] = (int)$data[1]; + $total += (int)$data[1]; + $index++; + } + else { + if ($data[1] == 0) { + $data[1] = __('No data'); + } + $data = explode(",", $val); + $values_to_return[$index]['tag_name'] = __('Others') . ": " . $data[1]; + $values_to_return[$index]['color'] = $colors[$index]; + $values_to_return[$index]['value'] += (int)$data[1]; + $total += (int)$data[1]; + } + } + + foreach ($values_to_return as $ind => $donut_data) { + $values_to_return[$ind]['percent'] = ($donut_data['value'] * 100) / $total; + } + + $new_values_to_return = array(); + while (!empty($values_to_return)) { + $first = true; + $max_elem = 0; + $max_elem_array = array(); + $index_to_del = 0; + foreach ($values_to_return as $i => $val) { + if ($first) { + $max_elem = $val['value']; + $max_elem_array = $val; + $index_to_del = $i; + $first = false; + } + else { + if ($val['value'] > $max_elem) { + $max_elem = $val['value']; + $max_elem_array = $val; + $index_to_del = $i; + } + } + } + + $new_values_to_return[] = $max_elem_array; + unset($values_to_return[$index_to_del]); + } + $values_to_return = $new_values_to_return; + + return $values_to_return; +} + + /** * The function to save the new elements of agents make as wizard. * @@ -2764,6 +2912,8 @@ function visual_map_get_image_status_element($layoutData, $status = false) { * @return integer */ function visual_map_get_status_element($layoutData) { + global $config; + enterprise_include_once('include/functions_visual_map.php'); if (enterprise_installed()) { $status = enterprise_visual_map_get_status_element($layoutData); @@ -2781,7 +2931,34 @@ function visual_map_get_status_element($layoutData) { //Linked to other layout ?? - Only if not module defined if ($layoutData['id_layout_linked'] != 0) { - $status = visual_map_get_layout_status ($layoutData['id_layout_linked']); + if ($layoutData['id_layout_linked_weight'] != 0) { + $calculate_weight = true; + } + else { + $calculate_weight = false; + } + $status = visual_map_get_layout_status ($layoutData['id_layout_linked'], 0, 0, $calculate_weight); + + if ($layoutData['id_layout_linked_weight'] > 0) { + $elements_to_compare = db_get_all_rows_sql("SELECT id, element_group FROM tlayout_data WHERE type = 0 AND id_layout = " . $layoutData['id_layout_linked']); + + $childs_group_acl = array(); + foreach ($elements_to_compare as $c) { + if (check_acl ($config['id_user'], $c['element_group'], "VR")) { + $childs_group_acl[] = $c['id']; + } + } + $elements_to_compare = $childs_group_acl; + + $aux_weight = ($status['elements_in_critical'] / count($elements_to_compare)) * 100; + + if ($aux_weight >= $layoutData['id_layout_linked_weight']) { + $status = $status['temp_total']; + } + else { + $status = VISUAL_MAP_STATUS_NORMAL; + } + } } else { switch ($layoutData["type"]) { @@ -3106,6 +3283,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, foreach ($layout_datas as $layout_data) { + $layout_group = $layout_data['element_group']; + if (!check_acl ($config['id_user'], $layout_group, "VR")) { + continue; + } + //Check the items are from disabled or pending delete modules if ($layout_data['id_agente_modulo'] != 0 && (($layout_data['type'] != LABEL) @@ -3133,7 +3315,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, 'proportion_width' => $proportion_width); } - $layout_data['label'] = visual_map_macro($layout_data['label']); + $layout_data['label'] = visual_map_macro($layout_data['label'],$layout_data["id_agente_modulo"]); switch ($layout_data['type']) { case LINE_ITEM: @@ -3172,13 +3354,32 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, * @return array A list of layouts the user can see. */ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) { - if (! is_array ($filter)) + if (! is_array ($filter)){ $filter = array (); - - if ($returnAllGroup) + } else { + if(!empty($filter['name'])){ + $where .= "name LIKE '%".io_safe_output($filter['name'])."%'"; + unset($filter['name']); + } + } + + if ($returnAllGroup) { $groups = users_get_groups ($id_user, 'VR'); - else - $groups = users_get_groups ($id_user, 'VR', false); + } else { + if(!empty($filter['group'])) { + $permissions_group = users_get_groups ($id_user, 'VR', false); + if(empty($permissions_group)){ + $permissions_group = users_get_groups ($id_user, 'VM', false); + } + $groups = array_intersect_key($filter['group'], $permissions_group); + } else { + $groups = users_get_groups ($id_user, 'VR', false); + if(empty($groups)) { + $groups = users_get_groups ($id_user, 'VM', false); + } + } + unset($filter['group']); + } if (!empty($groups)) { if (empty($where)) @@ -3225,7 +3426,9 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter * * @return bool The status of the given layout. True if it's OK, false if not. */ -function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { +function visual_map_get_layout_status ($id_layout = 0, $depth = 0, $elements_in_critical = 0, $calculate_weight = false) { + global $config; + $temp_status = VISUAL_MAP_STATUS_NORMAL; $temp_total = VISUAL_MAP_STATUS_NORMAL; $depth++; // For recursion depth checking @@ -3245,11 +3448,20 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { 'parent_item', 'id_layout_linked', 'id_agent', - 'type')); + 'type', + 'id_layout_linked_weight', + 'id', + 'id_layout', + 'element_group')); if ($result === false) return VISUAL_MAP_STATUS_NORMAL; foreach ($result as $data) { + $layout_group = $data['element_group']; + if (!check_acl ($config['id_user'], $layout_group, "VR")) { + continue; + } + switch ($data['type']) { case GROUP_ITEM: if ($data["id_layout_linked"] == 0) { @@ -3287,12 +3499,39 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { // Other Layout (Recursive!) if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { - $status = visual_map_get_layout_status($data["id_layout_linked"], $depth); + if ($data['id_layout_linked_weight'] > 0) { + $calculate_weight_c = true; + } + else { + $calculate_weight_c = false; + } + $status = visual_map_get_layout_status($data["id_layout_linked"], $depth, 0, $calculate_weight_c); + + $elements_in_child = db_get_all_rows_sql("SELECT id, element_group FROM tlayout_data WHERE type = 0 AND id_layout = " . $data['id_layout_linked']); + $layout_group = $data['element_group']; + + $childs_group_acl = array(); + foreach ($elements_in_child as $c) { + if (check_acl ($config['id_user'], $c['element_group'], "VR")) { + $childs_group_acl[] = $c['id']; + } + } + $elements_in_child = $childs_group_acl; + + if ($calculate_weight_c) { + $aux_weight = ($status['elements_in_critical'] / count($elements_in_child)) * 100; + + if ($aux_weight >= $data['id_layout_linked_weight']) { + $status = $status['temp_total']; + } + else { + $status = VISUAL_MAP_STATUS_NORMAL; + } + } } // Module elseif ($data["id_agente_modulo"] != 0) { $status = modules_get_agentmodule_status($data["id_agente_modulo"]); - } // Agent else { @@ -3306,11 +3545,31 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { break; } - if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) - return VISUAL_MAP_STATUS_CRITICAL_BAD; + if ($calculate_weight) { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD || $status == VISUAL_MAP_STATUS_WARNING) { + $elements_in_critical++; + } + } + else { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) { + return VISUAL_MAP_STATUS_CRITICAL_BAD; + } - if ($status > $temp_total) + } + if ($calculate_weight) { + if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD) { + $temp_total = VISUAL_MAP_STATUS_CRITICAL_BAD; + } + else if ($status == VISUAL_MAP_STATUS_WARNING && $temp_total != VISUAL_MAP_STATUS_CRITICAL_BAD) { + $temp_total = VISUAL_MAP_STATUS_WARNING; + } + } + else if ($status > $temp_total) { $temp_total = $status; + } + } + if ($calculate_weight) { + return array('elements_in_critical' => $elements_in_critical, 'temp_total' => $temp_total); } return $temp_total; @@ -3519,9 +3778,14 @@ function visual_map_type_in_js($type) { } } -function visual_map_macro($label){ +function visual_map_macro($label,$module){ $label = str_replace('_date_',strftime("%x"),$label); $label = str_replace('_time_',strftime("%T"),$label); + $label = str_replace('_agent_',agents_get_alias(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_module_',modules_get_agentmodule_name($module),$label); + $label = str_replace('_agentdescription_',agents_get_description(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_address_',agents_get_address(modules_get_agentmodule_agent($module)),$label); + $label = str_replace('_moduledescription_',modules_get_agentmodule_descripcion($module),$label); return $label; } diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 1333f5e73a..682b78d3e5 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -201,7 +201,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['image_row']['html'] = '' . __('Image') . ' ' . - html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) . + html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', 'none', true) . ''; @@ -246,6 +246,18 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { 'black' => __('Black'), 'transparent' => __('Transparent')), 'background_color', '', '', 0, 'white', true, false, false) . ''; + + $form_items['grid_color_row'] = array(); + $form_items['grid_color_row']['items'] = array('bars_graph'); + $form_items['grid_color_row']['html'] = + '' . + __('Grid color') . + '' . + '' . + html_print_input_text_extended ('grid_color', + '#000000', 'text-grid_color', '', 7, 7, false, + '', 'class="grid_color"', true) . + ''; $form_items['radio_choice_graph'] = array(); $form_items['radio_choice_graph']['items'] = array( @@ -278,7 +290,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row'] = array(); $form_items['agent_row']['items'] = array('static_graph', 'percentile_bar', 'percentile_item', 'module_graph', - 'simple_value', 'datos', 'auto_sla_graph', 'bars_graph', 'donut_graph'); + 'simple_value', 'datos', 'auto_sla_graph'); $form_items['agent_row']['html'] = '' . __('Agent') . ''; $params = array(); @@ -291,6 +303,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $params['use_hidden_input_idagent'] = true; $params['print_hidden_input_idagent'] = true; $params['hidden_input_idagent_name'] = 'id_agent'; + $params['get_order_json'] = true; if (defined('METACONSOLE')) { $params['javascript_ajax_page'] = '../../ajax.php'; $params['disabled_javascript_on_blur_function'] = true; @@ -307,6 +320,39 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['agent_row']['html'] .= '' . ui_print_agent_autocomplete_input($params) . ''; + + $form_items['agent_row_string'] = array(); + $form_items['agent_row_string']['items'] = array('donut_graph', 'bars_graph'); + $form_items['agent_row_string']['html'] = '' . + __('Agent') . ''; + $params = array(); + $params['return'] = true; + $params['show_helptip'] = true; + $params['input_name'] = 'agent_string'; + $params['size'] = 30; + $params['selectbox_id'] = 'module'; + $params['javascript_is_function_select'] = true; + $params['use_hidden_input_idagent'] = true; + $params['print_hidden_input_idagent'] = true; + $params['hidden_input_idagent_name'] = 'id_agent_string'; + $params['get_order_json'] = true; + $params['get_only_string_modules'] = true; + if (defined('METACONSOLE')) { + $params['javascript_ajax_page'] = '../../ajax.php'; + $params['disabled_javascript_on_blur_function'] = true; + + $params['print_input_server'] = true; + $params['print_input_id_server'] = true; + $params['input_server_id'] = 'id_server_name'; + $params['input_id_server_name'] = 'id_server_metaconsole'; + $params['input_server_value'] = ''; + $params['use_input_id_server'] = true; + $params['metaconsole_enabled'] = true; + $params['print_hidden_input_idagent'] = true; + } + $form_items['agent_row_string']['html'] .= '' . + ui_print_agent_autocomplete_input($params) . + ''; $form_items['module_row'] = array(); $form_items['module_row']['items'] = array('static_graph', @@ -318,6 +364,18 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { html_print_select(array(), 'module', '', '', __('Any'), 0, true) . ' '; + $form_items['resume_color_row'] = array(); + $form_items['resume_color_row']['items'] = array('donut_graph'); + $form_items['resume_color_row']['html'] = + '' . + __('Resume data color') . + '' . + '' . + html_print_input_text_extended ('resume_color', + '#000000', 'text-resume_color', '', 7, 7, false, + '', 'class="resume_color"', true) . + ''; + $event_times = array(86400 => __('24h'), 28800 => __('8h'), 7200 => __('2h'), @@ -401,7 +459,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $form_items['percentile_bar_row_1']['html'] = '' . __('Width') . ' ' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . ''; - + + $form_items['height_bars_graph_row'] = array(); + $form_items['height_bars_graph_row']['items'] = array('bars_graph'); + $form_items['height_bars_graph_row']['html'] = '' . + __('Height') . ' + ' . html_print_input_text('bars_graph_height', 0, '', 3, 5, true) . ''; $form_items['percentile_bar_row_2'] = array(); $form_items['percentile_bar_row_2']['items'] = array('percentile_bar', 'percentile_item', 'datos'); @@ -479,7 +542,13 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { '' . __('Show statistics') . ' ' . html_print_checkbox('show_statistics', 1, '', true) . ''; - + + $form_items['show_on_top_row'] = array(); + $form_items['show_on_top_row']['items'] = array('group_item'); + $form_items['show_on_top_row']['html'] = + '' . __('Always show on top') . ' + ' . + html_print_checkbox('show_on_top', 1, '', true) . ''; $form_items['module_graph_size_row'] = array(); $form_items['module_graph_size_row']['items'] = array('module_graph', 'datos'); @@ -596,10 +665,40 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { WHERE id != ' . $visualConsole_id, 'map_linked', '', '', 'None', '0', true) . ''; + $form_items_advance['map_linked_weight'] = array(); + $form_items_advance['map_linked_weight']['items'] = array('static_graph'); + $form_items_advance['map_linked_weight']['html'] = ''. + __('Map linked weight') . '' . + '' . html_print_select(array('10' => '10%', + '20' => '20%', + '30' => '30%', + '40' => '40%', + '50' => '50%', + '60' => '60%', + '70' => '70%', + '80' => '80%', + '90' => '90%', + '100' => '100%'), + 'map_linked_weight', '', '', __('By default'), 0, true) . + ui_print_help_icon ("linked_map_weight", true) . + ''; + $form_items_advance['line_case']['items'] = array('line_item'); $form_items_advance['line_case']['html'] = ' ' . __('Lines haven\'t advanced options') . ''; + $user_groups = users_get_groups($config['id_user']); + $form_items_advance['element_group_row'] = array(); + $form_items_advance['element_group_row']['items'] = array( + 'group_item', 'static_graph', 'percentile_bar', + 'percentile_item', 'module_graph', 'simple_value', + 'icon', 'label', 'datos'); + $form_items_advance['element_group_row']['html'] = ''. + __('Restrict access to group') . '' . + '' . html_print_select($user_groups, 'element_group', '', '', '', 0, true) . + ui_print_help_tip ( + __("If selected, restrict visualization of this item in the visual console to users who have access to selected group. This is also used on calculating child visual consoles."), true) . + ''; //Insert and modify before the buttons to create or update. if (enterprise_installed()) { @@ -644,6 +743,8 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) { $(".line_color").attachColorPicker(); $(".percentile_color").attachColorPicker(); $(".percentile_label_color").attachColorPicker(); + $(".resume_color").attachColorPicker(); + $(".grid_color").attachColorPicker(); $("input[name=radio_choice]").change(function(){ $('#count_items').html(1); @@ -704,7 +805,7 @@ function visual_map_editor_print_toolbox() { visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true); visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); - visual_map_print_button_editor('donut_graph', __('Donut Graph'), 'left', false, 'donut_graph_min', true); + visual_map_print_button_editor('donut_graph', __('Serialized pie graph'), 'left', false, 'donut_graph_min', true); visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true); visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true); visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); @@ -767,6 +868,8 @@ function visual_map_editor_print_hack_translate_strings() { __('No Max value defined.') .''; echo ''; + echo ''; echo ''; echo '