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..aaf29acb8f 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.715, 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..817432efa6 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.715, 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..d0f28e9943 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.715, 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..d9876734df 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.715, 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..c4665aaa94 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.715, 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..8100e76026 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.715, 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..9a5432057a 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.715, 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 bf28b06122..6364dc674e 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 => '171024'; +use constant AGENT_VERSION => '7.0NG.715'; +use constant AGENT_BUILD => '171115'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -1579,6 +1579,9 @@ sub guess_os_version ($) { # AIX } elsif ($os eq 'aix') { $os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/); + # Darwin + } elsif ($os eq 'darwin') { + $os_version = `defaults read loginwindow SystemVersionStampAsString`; # Windows } elsif ($os =~ /win/i) { $os_version = `ver`; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index cc9c730d82..daea7471cf 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 171024 +%define version 7.0NG.715 +%define release 171115 Summary: Pandora FMS Linux agent, PERL version Name: %{name} @@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel Requires: fileutils textutils unzip Requires: util-linux procps grep Requires: /sbin/ip /bin/awk -Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL) +Requires: perl perl(Sys::Syslog) # Required by plugins #Requires: sh-utils sed passwd net-tools rpm AutoReq: 0 diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index d801714fb7..a134b074de 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 171024 +%define version 7.0NG.715 +%define release 171115 Summary: Pandora FMS Linux agent, PERL version Name: %{name} @@ -67,6 +67,7 @@ then fi %post +mkdir -p /var/log/pandora chown pandora:root /var/log/pandora if [ ! -d /etc/pandora ] ; then mkdir -p /etc/pandora @@ -91,6 +92,9 @@ if [ ! -e /etc/pandora/collections ]; then fi cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent +# Enable the service on SystemD +systemctl enable pandora_agent_daemon.service + mkdir -p /var/spool/pandora/data_out chkconfig pandora_agent_daemon on diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index f698cec103..8c40f93404 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="171024" +PI_VERSION="7.0NG.715" +PI_BUILD="171115" 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/Makefile.am b/pandora_agents/win32/Makefile.am index 6e47cafcc1..d41c722ced 100644 --- a/pandora_agents/win32/Makefile.am +++ b/pandora_agents/win32/Makefile.am @@ -3,7 +3,7 @@ if DEBUG PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp PandoraAgent_CXXFLAGS=-g -O0 else -PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc +PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc PandoraAgent_CXXFLAGS=-O2 endif diff --git a/pandora_agents/win32/bin/pandora_agent.conf b/pandora_agents/win32/bin/pandora_agent.conf index c8c32e84d0..90626fedbc 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-2014 Artica Soluciones Tecnologicas -# Version 7.0NG.714 +# Version 7.0NG.715 # 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 686e7fdee9..773d2b4c77 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.715} ApplicationID {17E3D2CF-CA02-406B-8A80-9D31C17BD08F} @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171024} +{171115} ViewReadme {Yes} diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index 296f42f2ea..99b0d47f88 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -248,7 +248,9 @@ Pandora_Module::parseModuleKindFromString (string kind) { } else if (kind == module_inventory_str) { return MODULE_INVENTORY; } else if (kind == module_logevent_str) { - return MODULE_LOGEVENT; + return MODULE_LOGEVENT; + } else if (kind == module_logchannel_str) { + return MODULE_LOGCHANNEL; } else if (kind == module_wmiquery_str) { return MODULE_WMIQUERY; } else if (kind == module_perfcounter_str) { diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index b2606d2442..2fbeb52e41 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -86,6 +86,7 @@ namespace Pandora_Modules { MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of * freememory in the system */ MODULE_LOGEVENT, /**< The module checks for log events */ + MODULE_LOGCHANNEL, /**< The module checks for log events on channel using XML functions*/ MODULE_WMIQUERY, /**< The module runs WQL queries */ MODULE_PERFCOUNTER, /**< The module reads performance counters */ MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */ @@ -126,6 +127,7 @@ namespace Pandora_Modules { const string module_cpuusage_str = "module_cpuusage"; const string module_inventory_str = "module_inventory"; const string module_logevent_str = "module_logevent"; + const string module_logchannel_str = "module_logchannel"; const string module_wmiquery_str = "module_wmiquery"; const string module_perfcounter_str = "module_perfcounter"; const string module_tcpcheck_str = "module_tcpcheck"; diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index db33c1315a..90c82d5457 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -31,6 +31,7 @@ #include "pandora_module_cpuusage.h" #include "pandora_module_inventory.h" #include "pandora_module_logevent.h" +#include "pandora_module_logchannel.h" #include "pandora_module_wmiquery.h" #include "pandora_module_perfcounter.h" #include "pandora_module_tcpcheck.h" @@ -69,6 +70,7 @@ using namespace Pandora_Strutils; #define TOKEN_MIN_FF_EVENT ("module_min_ff_event ") #define TOKEN_DESCRIPTION ("module_description ") #define TOKEN_LOGEVENT ("module_logevent") +#define TOKEN_LOGCHANNEL ("module_logchannel") #define TOKEN_SOURCE ("module_source ") #define TOKEN_EVENTTYPE ("module_eventtype ") #define TOKEN_EVENTCODE ("module_eventcode ") @@ -121,6 +123,7 @@ using namespace Pandora_Strutils; #define TOKEN_MACRO ("module_macro") #define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_ALERT_TEMPLATE ("module_alert_template") +#define TOKEN_USER_SESSION ("module_user_session ") string parseLine (string line, string token) { @@ -157,8 +160,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { string module_freedisk_percent, module_freememory_percent; string module_dsn, module_freememory; string module_logevent, module_source, module_eventtype, module_eventcode; + string module_logchannel; string module_pattern, module_application, module_async; - string module_watchdog, module_start_command; + string module_watchdog, module_start_command, module_user_session; string module_wmiquery, module_wmicolumn; string module_retries, module_startdelay, module_retrydelay; string module_perfcounter, module_tcpcheck; @@ -195,6 +199,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_proc = ""; module_service = ""; module_logevent = ""; + module_logchannel = ""; module_source = ""; module_eventtype = ""; module_eventcode = ""; @@ -253,6 +258,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_ff_interval = ""; module_native_encoding = ""; module_alert_template = ""; + module_user_session = ""; macro = ""; stringtok (tokens, definition, "\n"); @@ -342,6 +348,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_logevent == "") { module_logevent = parseLine (line, TOKEN_LOGEVENT); } + if (module_logchannel == "") { + module_logchannel = parseLine (line, TOKEN_LOGCHANNEL); + } if (module_source == "") { module_source = parseLine (line, TOKEN_SOURCE); } @@ -507,6 +516,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_alert_template == "") { module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE); module_alert_template.erase (0,1); + } + + if (module_user_session == "") { + module_user_session = parseLine (line, TOKEN_USER_SESSION); } if (macro == "") { @@ -724,6 +737,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } + if (module_logchannel != "") { + pos_macro = module_logchannel.find(macro_name); + if (pos_macro != string::npos){ + module_logchannel.replace(pos_macro, macro_name.size(), macro_value); + } + } + if (module_source != "") { pos_macro = module_source.find(macro_name); if (pos_macro != string::npos){ @@ -1085,6 +1105,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_alert_template.replace(pos_macro, macro_name.size(), macro_value); } } + + if (module_user_session != "") { + pos_macro = module_user_session.find(macro_name); + if (pos_macro != string::npos){ + module_user_session.replace(pos_macro, macro_name.size(), macro_value); + } + } } } } @@ -1121,6 +1148,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_proc->setRetries (atoi(module_retries.c_str ())); module_proc->setStartDelay (atoi(module_startdelay.c_str ())); module_proc->setRetryDelay (atoi(module_retrydelay.c_str ())); + module_proc->setUserSession (is_enabled(module_user_session)); } } } else if (module_service != "") { @@ -1142,7 +1170,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { try { char buffer[100]; unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent); - if (sprintf(buffer, "Free memory %s %dMB", + if (sprintf(buffer, "Free space on drive %s %dMB", module_freedisk_percent.c_str(), memory) > 0) { module->setDescription(buffer); } @@ -1173,6 +1201,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_eventcode, module_pattern, module_application); + } + else if (module_logchannel != "") { + module = new Pandora_Module_Logchannel (module_name, + module_source, + module_eventtype, + module_eventcode, + module_pattern); } else if (module_wmiquery != "") { module = new Pandora_Module_WMIQuery (module_name, module_wmiquery, module_wmicolumn); diff --git a/pandora_agents/win32/modules/pandora_module_list.cc b/pandora_agents/win32/modules/pandora_module_list.cc index 516b2296c8..305ee901d7 100644 --- a/pandora_agents/win32/modules/pandora_module_list.cc +++ b/pandora_agents/win32/modules/pandora_module_list.cc @@ -30,12 +30,13 @@ #include "pandora_module_cpuusage.h" #include "pandora_module_inventory.h" #include "pandora_module_logevent.h" +#include "pandora_module_logchannel.h" #include "pandora_module_wmiquery.h" #include "pandora_module_perfcounter.h" #include "pandora_module_tcpcheck.h" #include "pandora_module_regexp.h" #include "pandora_module_plugin.h" -#include "pandora_module_ping.h" +#include "pandora_module_ping.h" #include "pandora_module_snmpget.h" #include @@ -226,12 +227,13 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) Pandora_Module_Freememory *module_freememory; Pandora_Module_Freememory_Percent *module_freememory_percent; Pandora_Module_Logevent *module_logevent; + Pandora_Module_Logchannel *module_logchannel; Pandora_Module_WMIQuery *module_wmiquery; Pandora_Module_Perfcounter *module_perfcounter; Pandora_Module_Tcpcheck *module_tcpcheck; Pandora_Module_Regexp *module_regexp; Pandora_Module_Plugin *module_plugin; - Pandora_Module_Ping *module_ping; + Pandora_Module_Ping *module_ping; Pandora_Module_SNMPGet *module_snmpget; module = Pandora_Module_Factory::getModuleFromDefinition (definition); @@ -288,6 +290,10 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) module_logevent = (Pandora_Module_Logevent *) module; modules->push_back (module_logevent); break; + case MODULE_LOGCHANNEL: + module_logchannel = (Pandora_Module_Logchannel *) module; + modules->push_back (module_logchannel); + break; case MODULE_WMIQUERY: module_wmiquery = (Pandora_Module_WMIQuery *) module; modules->push_back (module_wmiquery); @@ -315,7 +321,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) case MODULE_SNMPGET: module_snmpget = (Pandora_Module_SNMPGet *) module; modules->push_back (module_snmpget); - break; + break; default: break; } diff --git a/pandora_agents/win32/modules/pandora_module_logchannel.cc b/pandora_agents/win32/modules/pandora_module_logchannel.cc new file mode 100755 index 0000000000..2c7c056565 --- /dev/null +++ b/pandora_agents/win32/modules/pandora_module_logchannel.cc @@ -0,0 +1,582 @@ +/* Pandora logchannel module. This module checks for log events that match a given + pattern using XML functions provided by wevtapi. + + Copyright (C) 2017 Artica ST. + Written by Fermin Hernandez. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "pandora_module_logchannel.h" +#include "../windows/pandora_wmi.h" +#include "../pandora_windows_service.h" +#include "pandora_module_logchannel.h" +#include "pandora_strutils.h" + +using namespace Pandora; +using namespace Pandora_Modules; +using namespace Pandora_Strutils; + +// Pointers to Wevtapi.dll functions +static HINSTANCE WINEVENT = NULL; +static EvtQueryT EvtQueryF = NULL; +static EvtNextT EvtNextF = NULL; +static EvtSeekT EvtSeekF = NULL; +static EvtCreateRenderContextT EvtCreateRenderContextF = NULL; +static EvtRenderT EvtRenderF = NULL; +static EvtCloseT EvtCloseF = NULL; +static EvtFormatMessageT EvtFormatMessageF = NULL; +static EvtOpenPublisherMetadataT EvtOpenPublisherMetadataF = NULL; +static EvtCreateBookmarkT EvtCreateBookmarkF = NULL; +static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL; + +/** + * Creates a Pandora_Module_Logchannel object. + * + * @param name Module name. + * @param service_name Service internal name to check. + */ +Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern) + : Pandora_Module (name) { + int i; + vector query; + vector::iterator query_it; + string upper_type = type; + + // Convert the type string to uppercase + for (i = 0; i < type.length(); i++) { + upper_type[i] = toupper(type[i]); + } + + // Set the type filter + int type_number = -1; + if (upper_type.compare("ERROR") == 0) { + type_number = EVENTLOG_ERROR_TYPE; + } else if (upper_type.compare("WARNING") == 0) { + type_number = EVENTLOG_WARNING_TYPE; + } else if (upper_type.compare("INFORMATION") == 0) { + type_number = EVENTLOG_INFORMATION_TYPE; + } else if (upper_type.compare("AUDIT SUCCESS") == 0) { + type_number = EVENTLOG_AUDIT_SUCCESS; + } else if (upper_type.compare("AUDIT FAILURE") == 0) { + type_number = EVENTLOG_AUDIT_FAILURE; + } + // Append type to log query + if (type_number != -1) { + wstringstream ss; + ss << L"*[System[Level='" << type_number << L"']]"; + query.push_back(ss.str()); + } + + // Set the id + int id_number = strtoul (id.c_str (), NULL, 0); + if (id_number != 0) { + wstringstream ss; + ss << L"*[System[EventID='" << id_number << L"']]"; + query.push_back(ss.str()); + } + + // Fill the filter + if (query.size() == 0) { + this->filter = L"*"; + } else { + int i = 0; + // Add filters with and + wstring item_query; + while (query.size() > 1) { + item_query = query.back(); + query.pop_back(); + this->filter += item_query + L" and "; + } + // Append the last value without the and + item_query = query.back(); + this->filter += item_query; + } + + this->source = source; + this->pattern = pattern; + if (! pattern.empty ()) { + // Compile the regular expression + if (regcomp (&this->regexp, pattern.c_str (), REG_EXTENDED) != 0) { + pandoraLog ("Invalid regular expression %s", pattern.c_str ()); + } + } + this->bookmark_xml = L""; + this->setKind (module_logchannel_str); + + // Load Wevtapi.dll and some functions + if (WINEVENT == NULL) { + WINEVENT = LoadLibrary("Wevtapi.dll"); + if (WINEVENT == NULL) { + + // Log to the bedug log, since this is not an error + pandoraLog ("Library Wevtapi.dll not available"); + return; + } + + EvtQueryF = (EvtQueryT) GetProcAddress (WINEVENT, "EvtQuery"); + if (EvtQueryF == NULL) { + pandoraLog ("Error loading function EvtQuery from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtNextF = (EvtNextT) GetProcAddress (WINEVENT, "EvtNext"); + if (EvtNextF == NULL) { + pandoraLog ("Error loading function EvtNext from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtSeekF = (EvtSeekT) GetProcAddress (WINEVENT, "EvtSeek"); + if (EvtSeekF == NULL) { + pandoraLog ("Error loading function EvtSeek from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtCreateRenderContextF = (EvtCreateRenderContextT) GetProcAddress (WINEVENT, "EvtCreateRenderContext"); + if (EvtCreateRenderContextF == NULL) { + pandoraLog ("Error loading function EvtCreateRenderContext from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtRenderF = (EvtRenderT) GetProcAddress (WINEVENT, "EvtRender"); + if (EvtRenderF == NULL) { + pandoraLog ("Error loading function EvtRender from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtCloseF = (EvtCloseT) GetProcAddress (WINEVENT, "EvtClose"); + if (EvtCloseF == NULL) { + pandoraLog ("Error loading function EvtClose from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtFormatMessageF = (EvtFormatMessageT) GetProcAddress (WINEVENT, "EvtFormatMessage"); + if (EvtFormatMessageF == NULL) { + pandoraLog ("Error loading function EvtFormatMessage from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtOpenPublisherMetadataF = (EvtOpenPublisherMetadataT) GetProcAddress (WINEVENT, "EvtOpenPublisherMetadata"); + if (EvtOpenPublisherMetadataF == NULL) { + pandoraLog ("Error loading function EvtOpenPublisherMetadata from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtCreateBookmarkF = (EvtCreateBookmarkT) GetProcAddress (WINEVENT, "EvtCreateBookmark"); + if (EvtCreateBookmarkF == NULL) { + pandoraLog ("Error loading function EvtCreateBookmark from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtUpdateBookmarkF = (EvtUpdateBookmarkT) GetProcAddress (WINEVENT, "EvtUpdateBookmark"); + if (EvtUpdateBookmarkF == NULL) { + pandoraLog ("Error loading function EvtUpdateBookmark from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + } +} + +void +Pandora_Module_Logchannel::run () { + list event_list; + list::iterator event; + SYSTEMTIME system_time; + + // Run + try { + Pandora_Module::run (); + } catch (Interval_Not_Fulfilled e) { + return; + } + + // Initialize log event query + this->initializeLogChannel(); + + // Read events on a list + this->getLogEvents (event_list); + + // Return if no data stored on list + if (event_list.size () < 1) return; + + for (event = event_list.begin (); event != event_list.end(); ++event) { + // Store the data + this->setOutput (event->message, &(event->timestamp)); + } +} + +/** + * Fill the first bookmark of events. + */ +void +Pandora_Module_Logchannel::initializeLogChannel () { + EVT_HANDLE hEvents[1]; + EVT_HANDLE hResults; + EVT_HANDLE hBookmark; + DWORD dwReturned = 0; + + // Check whether the first bookmark is set + if (!this->bookmark_xml.empty()) return; + + // Open the event log with a query + hResults = EvtQueryF ( + NULL, + strAnsiToUnicode (this->source.c_str()).c_str(), + this->filter.c_str(), + EvtOpenChannelPath | EvtQueryForwardDirection + ); + if (hResults == NULL) { + pandoraDebug ("Could not open event log channel. Error: '%d'", GetLastError()); + return; + } + + // Put the events on the last event + if (!EvtSeekF(hResults, 0, NULL, 0, EvtSeekRelativeToLast)) { + pandoraDebug("Cannot positionate the event at first. 'Error %d'.", GetLastError()); + EvtCloseF(hResults); + return; + } + // Read next event to positionate the bookmark + if (!EvtNextF(hResults, 1, hEvents, INFINITE, 0, &dwReturned)) { + if (GetLastError() != ERROR_NO_MORE_ITEMS) { + pandoraDebug ("EvtNext (initializeLogChannel) error: %d", GetLastError()); + EvtCloseF(hResults); + return; + } + } + // If no events read, do not use bookmark to read all events + if (dwReturned == 0) { + pandoraDebug("No events found positionating bookmark."); + EvtCloseF(hResults); + return; + } + // Create the bookmar + pandoraDebug("Creating bookmark to channel %s", this->source.c_str()); + hBookmark = EvtCreateBookmarkF(NULL); + if (hBookmark == NULL) { + pandoraDebug("EvtCreateBookmark (initializeLogChannel) failed %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hEvents[0]); + return; + } + if (!EvtUpdateBookmarkF(hBookmark, hEvents[0])) { + pandoraDebug("EvtUpdateBookmarkF (initializeLogChannel) failed %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hEvents[0]); + EvtCloseF(hBookmark); + return; + } + // Save the bookmark like an XML. + this->updateBookmarkXML(hBookmark); + + // Clean tasks + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); +} + +/** + * Update the bookmark XML. Returns false if fails + */ +bool +Pandora_Module_Logchannel::updateBookmarkXML (EVT_HANDLE hBookmark) { + LPWSTR pBookmarkXml = NULL; + DWORD dwBufferSize = 0; + DWORD dwBufferUsed = 0; + DWORD dwPropertyCount = 0; + DWORD status = 0; + + if (!EvtRenderF(NULL, hBookmark, EvtRenderBookmark, dwBufferSize, pBookmarkXml, &dwBufferUsed, &dwPropertyCount)){ + if (ERROR_INSUFFICIENT_BUFFER == (status = GetLastError())){ + dwBufferSize = dwBufferUsed; + pBookmarkXml = (LPWSTR)malloc(dwBufferSize); + if (pBookmarkXml){ + EvtRenderF(NULL, hBookmark, EvtRenderBookmark, dwBufferSize, pBookmarkXml, &dwBufferUsed, &dwPropertyCount); + } + else{ + pandoraDebug("Error loading the bookmark. Cannot load enough memory"); + this->cleanBookmark(); + free(pBookmarkXml); + return false; + } + } + if (ERROR_SUCCESS != (status = GetLastError())){ + pandoraDebug("EvtRender (updateBookmarkXML) failed with %d\n", GetLastError()); + this->cleanBookmark(); + free(pBookmarkXml); + return false; + } + } + this->bookmark_xml = pBookmarkXml; + free(pBookmarkXml); + return true; +} + +/** + * Clean the bookmark XML. + */ +void +Pandora_Module_Logchannel::cleanBookmark () { + this->bookmark_xml = L""; +} + +/** + * Reads available events from the event log. + */ +void +Pandora_Module_Logchannel::getLogEvents (list &event_list) { + EVT_HANDLE hResults = NULL; + EVT_HANDLE hBookmark = NULL; + EVT_HANDLE hEvents[1]; + EVT_HANDLE hContext = NULL; + PEVT_VARIANT pRenderedValues = NULL; + EVT_HANDLE hProviderMetadata = NULL; + LPWSTR pwsMessage = NULL; + LPWSTR ppValues[] = {L"Event/System/Provider/@Name", L"Event/System/TimeCreated/@SystemTime"}; + DWORD count = sizeof(ppValues)/sizeof(LPWSTR); + DWORD dwReturned = 0; + DWORD dwBufferSize = 0; + DWORD dwBufferUsed = 0; + DWORD dwPropertyCount = 0; + DWORD status = ERROR_SUCCESS; + SYSTEMTIME eventTime; + FILETIME lft, ft; + bool update_bookmark = false; + + // An empty bookmark XML means that log cannot be open + if (this->bookmark_xml.empty()) return; + + // Open the event log with a query + hResults = EvtQueryF ( + NULL, + strAnsiToUnicode (this->source.c_str()).c_str(), + this->filter.c_str(), + EvtOpenChannelPath | EvtQueryForwardDirection + ); + if (hResults == NULL) { + pandoraDebug ("Could not open event log channel '%s'. Error: '%d'", this->source.c_str(), GetLastError()); + EvtCloseF(hResults); + this->cleanBookmark(); + return; + } + + // Seek on the bookmark + hBookmark = EvtCreateBookmarkF(this->bookmark_xml.c_str()); + if (hBookmark == NULL) { + pandoraDebug("Cannot read the string bookmark. Error: %d.", GetLastError()); + EvtCloseF(hResults); + this->cleanBookmark(); + return; + } + if (!EvtSeekF(hResults, 1, hBookmark, 0, EvtSeekRelativeToBookmark)) { + pandoraDebug("Cannot positionate the event at bookmark. Error %d.", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + this->cleanBookmark(); + return; + } + + // Read events one by one + hEvents[0] = NULL; + while (EvtNextF(hResults, 1, hEvents, INFINITE, 0, &dwReturned)) { + hContext = EvtCreateRenderContextF(count, (LPCWSTR*)ppValues, EvtRenderContextValues); + if (NULL == hContext) { + pandoraDebug ("EvtCreateRenderContext error: %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + this->cleanBookmark(); + return; + } + + // Reinitialize the buffers + dwBufferSize = 0; + dwBufferUsed = 0; + if (! EvtRenderF(hContext, hEvents[0], EvtRenderEventValues, dwBufferSize, pRenderedValues, &dwBufferUsed, &dwPropertyCount)) { + if ((status = GetLastError()) == ERROR_INSUFFICIENT_BUFFER) { + dwBufferSize = dwBufferUsed; + pRenderedValues = (PEVT_VARIANT)malloc(dwBufferSize); + if (pRenderedValues) { + EvtRenderF(hContext, hEvents[0], EvtRenderEventValues, dwBufferSize, pRenderedValues, &dwBufferUsed, &dwPropertyCount); + } + else { + pandoraDebug ("EvtRender error: %d", status); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + this->cleanBookmark(); + return; + } + } + + if ((status = GetLastError()) != ERROR_SUCCESS) { + pandoraDebug ("EvtRender error getting buffer size: %d", status); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + this->cleanBookmark(); + return; + } + } + + // Get the SYSTEMTIME of log + ULONGLONG ullTimeStamp = pRenderedValues[1].FileTimeVal; + ft.dwHighDateTime = (DWORD)((ullTimeStamp >> 32) & 0xFFFFFFFF); + ft.dwLowDateTime = (DWORD)(ullTimeStamp & 0xFFFFFFFF); + // Time format conversions + if (!FileTimeToLocalFileTime(&ft, &lft)){ + pandoraDebug("UTC FILETIME to LOCAL FILETIME error: %d.", GetLastError()); + } else if (!FileTimeToSystemTime(&lft, &eventTime)){ + pandoraDebug("FILETIME to SYSTEMTIME error: %d.", GetLastError()); + } + + // Get the handle to the provider's metadata that contains the message strings + hProviderMetadata = EvtOpenPublisherMetadataF(NULL, pRenderedValues[0].StringVal, NULL, 0, 0); + if (hProviderMetadata == NULL) { + pandoraDebug ("EvtOpenPublisherMetadata error: %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + free(pRenderedValues); + this->cleanBookmark(); + return; + } + + // Read the event message + pwsMessage = GetMessageString(hProviderMetadata, hEvents[0], EvtFormatMessageEvent); + if (pwsMessage == NULL) { + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + free(pRenderedValues); + EvtCloseF(hProviderMetadata); + this->cleanBookmark(); + return; + } + + // Check the regex and save the message if pass the regex + if (this->pattern.empty () || regexec (&this->regexp, strUnicodeToAnsi(pwsMessage).c_str (), 0, NULL, 0) == 0){ + // Save the event message + LogChannelList event_item; + event_item.message = strUnicodeToAnsi(pwsMessage); + event_item.timestamp= eventTime; + event_list.push_back (event_item); + } + + // Clean up some used vars + EvtCloseF(hContext); + free(pRenderedValues); + EvtCloseF(hProviderMetadata); + free(pwsMessage); + + // Update the bookmark + if (!EvtUpdateBookmarkF(hBookmark, hEvents[0])) { + pandoraDebug("EvtUpdateBookmarkF (getLogEvents) failed %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + this->cleanBookmark(); + return; + } + + // Cleanup current event and read the next log + EvtCloseF(hEvents[0]); + hEvents[0] = NULL; + + // Information token to update bookmark + update_bookmark = true; + } + status = GetLastError(); + if (status != ERROR_NO_MORE_ITEMS) { + pandoraDebug ("EvtNext getLogEvents error: %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + this->cleanBookmark(); + return; + } + + // Update bookmark if there is new events + if (update_bookmark) this->updateBookmarkXML(hBookmark); + + // Clean handlers + EvtCloseF(hResults); + EvtCloseF(hBookmark); +} + +// Gets the specified message string from the event. If the event does not +// contain the specified message, the function returns NULL. +// See http://msdn.microsoft.com/en-us/library/windows/desktop/dd996923(v=vs.85).aspx +LPWSTR +Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId) { + LPWSTR pBuffer = NULL; + DWORD dwBufferSize = 0; + DWORD dwBufferUsed = 0; + DWORD status = 0; + + if (!EvtFormatMessageF(hMetadata, hEvent, 0, 0, NULL, FormatId, dwBufferSize, pBuffer, &dwBufferUsed)) { + status = GetLastError(); + if (ERROR_INSUFFICIENT_BUFFER == status) { + // An event can contain one or more keywords. The function returns keywords + // as a list of keyword strings. To process the list, you need to know the + // size of the buffer, so you know when you have read the last string, or you + // can terminate the list of strings with a second null terminator character + // as this example does. + if ((EvtFormatMessageKeyword == FormatId)) { + pBuffer[dwBufferSize-1] = L'\0'; + } + else { + dwBufferSize = dwBufferUsed; + } + pBuffer = (LPWSTR)malloc(dwBufferSize * sizeof(WCHAR)); + + if (pBuffer) { + EvtFormatMessageF(hMetadata, hEvent, 0, 0, NULL, FormatId, dwBufferSize, pBuffer, &dwBufferUsed); + + // Add the second null terminator character. + if ((EvtFormatMessageKeyword == FormatId)) { + pBuffer[dwBufferUsed-1] = L'\0'; + } + } + else { + return NULL; + } + } + else { + pandoraDebug ("EvtFormatMessage error: %d", status); + return NULL; + } + } + + return pBuffer; +} \ No newline at end of file diff --git a/pandora_agents/win32/modules/pandora_module_logchannel.h b/pandora_agents/win32/modules/pandora_module_logchannel.h new file mode 100755 index 0000000000..14617037c6 --- /dev/null +++ b/pandora_agents/win32/modules/pandora_module_logchannel.h @@ -0,0 +1,76 @@ +/* Pandora logchannel module. This module checks for log events that match a given + pattern using XML functions provided by wevtapi. + + Copyright (C) 2017 Artica ST. + Written by Fermin Hernandez. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __PANDORA_MODULE_LOGCHANNEL_H__ +#define __PANDORA_MODULE_LOGCHANNEL_H__ + +#include "pandora_module.h" +#include "boost/regex.h" +#include "../windows/winevt.h" + +// Log event read buffer size +#define BUFFER_SIZE 1024 + +// Types for pointers to Wevtapi.dll functions +typedef EVT_HANDLE WINAPI (*EvtQueryT) (EVT_HANDLE Session, LPCWSTR Path, LPCWSTR Query, DWORD Flags); +typedef WINBOOL WINAPI (*EvtNextT) (EVT_HANDLE ResultSet, DWORD EventArraySize, EVT_HANDLE* EventArray, DWORD Timeout, DWORD Flags, PDWORD Returned); +typedef WINBOOL WINAPI (*EvtSeekT) (EVT_HANDLE ResultSet, LONGLONG Position, EVT_HANDLE Bookmark, DWORD Timeout, DWORD Flags); +typedef EVT_HANDLE WINAPI (*EvtCreateRenderContextT) (DWORD ValuePathsCount, LPCWSTR *ValuePaths, DWORD Flags); +typedef WINBOOL WINAPI (*EvtRenderT) (EVT_HANDLE Context, EVT_HANDLE Fragment, DWORD Flags, DWORD BufferSize, PVOID Buffer, PDWORD BufferUsed, PDWORD PropertyCount); +typedef WINBOOL WINAPI (*EvtCloseT) (EVT_HANDLE Object); +typedef WINBOOL WINAPI (*EvtFormatMessageT) (EVT_HANDLE PublisherMetadata, EVT_HANDLE Event, DWORD MessageId, DWORD ValueCount, PEVT_VARIANT Values, DWORD Flags, DWORD BufferSize, LPWSTR Buffer, PDWORD BufferUsed); +typedef EVT_HANDLE WINAPI (*EvtOpenPublisherMetadataT) (EVT_HANDLE Session, LPCWSTR PublisherIdentity, LPCWSTR LogFilePath, LCID Locale, DWORD Flags); +typedef EVT_HANDLE WINAPI (*EvtCreateBookmarkT) (LPCWSTR BookmarkXml); +typedef WINBOOL WINAPI (*EvtUpdateBookmarkT) (EVT_HANDLE Bookmark, EVT_HANDLE Event); + +namespace Pandora_Modules { + + /** + * This module checks for log events that match a given + * pattern. Events can be filtered by source and type. + */ + + class Pandora_Module_Logchannel : public Pandora_Module { + struct LogChannelList { + string message; + SYSTEMTIME timestamp; + }; + private: + regex_t regexp; + string source; + string pattern; + wstring filter; + wstring bookmark_xml; + HANDLE messages_dll; + + void initializeLogChannel (); + bool updateBookmarkXML (EVT_HANDLE hBookmark); + void getLogEvents (list &event_list); + void cleanBookmark (); + LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId); + + public: + Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern); + void run (); + }; +} + +#endif diff --git a/pandora_agents/win32/modules/pandora_module_proc.cc b/pandora_agents/win32/modules/pandora_module_proc.cc index e8eed1f97d..1c06e1001d 100644 --- a/pandora_agents/win32/modules/pandora_module_proc.cc +++ b/pandora_agents/win32/modules/pandora_module_proc.cc @@ -48,6 +48,7 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name) this->setKind (module_proc_str); this->watchdog = false; + this->user_session = false; this->start_command = ""; this->retries = 3; this->start_delay = 5000; @@ -95,6 +96,11 @@ Pandora_Module_Proc::getRetryDelay () const { return this->retry_delay; } +bool +Pandora_Module_Proc::getUserSession () const { + return this->user_session; +} + void Pandora_Module_Proc::setWatchdog (bool watchdog) { this->watchdog = watchdog; @@ -131,6 +137,11 @@ Pandora_Module_Proc::setRetryDelay (int mseconds) { this->retry_delay = mseconds; } +void +Pandora_Module_Proc::setUserSession (bool usession) { + this->user_session = usession; +} + void async_run (Pandora_Module_Proc *module) { HANDLE *processes = NULL; @@ -156,7 +167,7 @@ async_run (Pandora_Module_Proc *module) { } Sleep (module->getRetryDelay ()); - Pandora_Wmi::runProgram (module->getStartCommand ()); + Pandora_Wmi::runProgram (module->getStartCommand (), NULL, module->getUserSession()); Sleep (module->getStartDelay ()); counter++; continue; diff --git a/pandora_agents/win32/modules/pandora_module_proc.h b/pandora_agents/win32/modules/pandora_module_proc.h index edab85cb88..0286efcf5c 100644 --- a/pandora_agents/win32/modules/pandora_module_proc.h +++ b/pandora_agents/win32/modules/pandora_module_proc.h @@ -32,6 +32,7 @@ namespace Pandora_Modules { string process_name; HANDLE thread; bool watchdog; + bool user_session; string start_command; int retries; int start_delay; @@ -46,12 +47,14 @@ namespace Pandora_Modules { int getRetries () const; int getStartDelay () const; int getRetryDelay () const; + bool getUserSession () const; void setWatchdog (bool watchdog); void setStartCommand (string command); void setRetries (int retries); void setStartDelay (int mseconds); void setRetryDelay (int mseconds); + void setUserSession (bool usession); void run (); }; diff --git a/pandora_agents/win32/modules/pandora_module_service.cc b/pandora_agents/win32/modules/pandora_module_service.cc index c3f2259773..11abf8b2fa 100644 --- a/pandora_agents/win32/modules/pandora_module_service.cc +++ b/pandora_agents/win32/modules/pandora_module_service.cc @@ -124,7 +124,6 @@ async_run (Pandora_Module_Service *module) { // If time out and polling, // check the service status actively if (result == WAIT_TIMEOUT && polling) { - pandoraLog("Timeout. Polling"); module->execute_async_service(prev_res, module, modules); } continue; diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 4739e3f7e0..3c34513f8d 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 171024)") +#define PANDORA_VERSION ("7.0NG.715(Build 171115)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index aa68c94355..dcc5aacebe 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 171024))" + VALUE "ProductVersion", "(7.0NG.715(Build 171115))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_agents/win32/windows/pandora_wmi.cc b/pandora_agents/win32/windows/pandora_wmi.cc index e4763cc433..fb572bddcb 100644 --- a/pandora_agents/win32/windows/pandora_wmi.cc +++ b/pandora_agents/win32/windows/pandora_wmi.cc @@ -369,16 +369,16 @@ Pandora_Wmi::getOSName () { dhGetValue (L"%s", &name, quickfix, L".Caption"); - if (name != NULL) { - // Remove the (R) character. - for (int i = 0; i < strlen(name); i++) { - if ((unsigned char)name[i] == 0xAE) { - name[i] = ' '; - } - } - ret = name; - dhFreeString (name); - } + if (name != NULL) { + // Remove the (R) character. + for (int i = 0; i < strlen(name); i++) { + if ((unsigned char)name[i] == 0xAE) { + name[i] = ' '; + } + } + ret = name; + dhFreeString (name); + } } NEXT_THROW (quickfix); } catch (string errstr) { @@ -411,12 +411,12 @@ Pandora_Wmi::getOSVersion () { L".CSDVersion"); if (version != NULL) { - // Remove the (R) character. - for (int i = 0; i < strlen(version); i++) { - if ((unsigned char)version[i] == 0xAE) { - version[i] = ' '; - } - } + // Remove the (R) character. + for (int i = 0; i < strlen(version); i++) { + if ((unsigned char)version[i] == 0xAE) { + version[i] = ' '; + } + } ret = version; dhFreeString (version); } @@ -501,7 +501,7 @@ Pandora_Wmi::getSystemName () { * @param flags Process creation flags */ bool -Pandora_Wmi::runProgram (string command, DWORD flags) { +Pandora_Wmi::runProgram (string command, DWORD flags, BOOL user_session) { PROCESS_INFORMATION process_info; STARTUPINFO startup_info; bool success; @@ -514,11 +514,75 @@ Pandora_Wmi::runProgram (string command, DWORD flags) { startup_info.cb = sizeof (startup_info); ZeroMemory (&process_info, sizeof (process_info)); - pandoraDebug ("Start process \"%s\".", command.c_str ()); - cmd = strdup (command.c_str ()); - success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags, - NULL, NULL, &startup_info, &process_info); - pandoraFree (cmd); + if (user_session) { + DWORD sessionId = WTSGetActiveConsoleSessionId(); + startup_info.cb = sizeof(STARTUPINFO); + startup_info.hStdError = 0; + startup_info.hStdInput = 0; + startup_info.hStdOutput = 0; + if ( + startup_info.hStdError != 0 + || startup_info.hStdInput != 0 + || startup_info.hStdOutput != 0 + ) { + startup_info.dwFlags |= STARTF_USESTDHANDLES; + } + + HANDLE procHandle = GetCurrentProcess(); + HANDLE token, userToken; + + // Tray to open the process + if (OpenProcessToken(procHandle, TOKEN_DUPLICATE, &token) == 0) { + pandoraDebug ("Open Process Token fails with error %d.", GetLastError()); + return false; + } + + // Duplicate token + if (DuplicateTokenEx(token, + MAXIMUM_ALLOWED, + 0, + SecurityImpersonation, + TokenPrimary, + &userToken) == 0) { + pandoraDebug ("Duplicate token fails with error %d.", GetLastError()); + return false; + } + + // Set Token Information + if (SetTokenInformation(userToken, + (TOKEN_INFORMATION_CLASS)TokenSessionId, + &sessionId, + sizeof(sessionId)) == 0) { + // Error 1314 will be thrown if agent is not running as service. + if (GetLastError() != 1314) { + pandoraDebug ("Set token information fails with error %d.", GetLastError()); + return false; + } + } + + LPSTR command_exec = (LPSTR)command.c_str(); + + // Create Process As User + // Changed inherit and command + success = CreateProcessAsUser( + userToken, + 0, + command_exec, + 0, + 0, + FALSE, + flags, + 0, + NULL, + &startup_info, + &process_info); + } else { + pandoraDebug ("Start process \"%s\".", command.c_str ()); + cmd = strdup (command.c_str ()); + success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags, + NULL, NULL, &startup_info, &process_info); + pandoraFree (cmd); + } if (success) { pandoraDebug ("The process \"%s\" was started.", command.c_str ()); @@ -949,7 +1013,7 @@ getIPs(VARIANT *ip_array){ if (V_VT(&pvArray[i]) == VT_BSTR) { if (i > 0) { ret += " , "; - } + } LPSTR szStringA; ret += Pandora_Strutils::strUnicodeToAnsi( V_BSTR(&pvArray[i])); } diff --git a/pandora_agents/win32/windows/pandora_wmi.h b/pandora_agents/win32/windows/pandora_wmi.h index 601499f4a1..de4f3db81b 100644 --- a/pandora_agents/win32/windows/pandora_wmi.h +++ b/pandora_agents/win32/windows/pandora_wmi.h @@ -53,7 +53,7 @@ namespace Pandora_Wmi { string getOSBuild (); string getSystemName (); string getSystemAddress (); - bool runProgram (string command, DWORD flags = 0); + bool runProgram (string command, DWORD flags = 0, BOOL user_session = false); bool startService (string service_name); bool stopService (string service_name); void runWMIQuery (string wmi_query, diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a2605921f1..ab941d8b0d 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.714-171024 +Version: 7.0NG.715-171115 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 8958951091..7295cd6288 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-171024" +pandora_version="7.0NG.715-171115" 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 cb6fe8cd42..6e6cf9a92e 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -66,11 +66,14 @@ function mainAgentsModules() { $modulegroup = get_parameter('modulegroup', 0); $refr = get_parameter('refresh', 0); // By default 30 seconds + $recursion = get_parameter('recursion', 0); $group_id = (int)get_parameter('group_id', 0); $offset = (int)get_parameter('offset', 0); $hor_offset = (int)get_parameter('hor_offset', 0); $block = $config['block_size']; - $agents_id = (array)get_parameter('id_agents2', -1); + if(get_parameter('modulegroup') != null){ + $agents_id = (array)get_parameter('id_agents2', -1); + } $selection_a_m = (int)get_parameter('selection_agent_module'); $modules_selected = (array)get_parameter('module', 0); $update_item = (string)get_parameter('edit_item',''); @@ -139,6 +142,8 @@ function mainAgentsModules() { $filter_groups_label = ''.__('Group').''; $filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;'); + $filter_recursion_label = ''.__('Recursion').''; + $filter_recursion = html_print_checkbox('recursion', 1, 0, true); //groups module $filter_module_groups_label = ''.__('Module group').''; $filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", @@ -245,12 +250,12 @@ function mainAgentsModules() { if($config['pure'] != 1){ echo '
'; + . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">'; echo ''; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -375,9 +380,14 @@ function mainAgentsModules() { } if ($group_id > 0) { - $filter_groups['id_grupo'] = $group_id; + if($recursion){ + $filter_groups['id_grupo'] = array_merge($group_id, + groups_get_id_recursive($group_id, true)); + } + else{ + $filter_groups['id_grupo'] = $group_id; + } } - $agents = agents_get_agents ($filter_groups); $nagents = count($agents); @@ -675,12 +685,14 @@ $ignored_params['refresh']=''; } $("#group_id").change (function () { + jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", "get_agents_group_json" : 1, "id_group" : this.value, "privilege" : "AW", - "keys_prefix" : "_" + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') }, function (data, status) { $("#id_agents2").html(''); @@ -699,7 +711,34 @@ $ignored_params['refresh']=''; "json" ); }); - + + $("#checkbox-recursion").change (function () { + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "id_group" : $("#group_id").val(), + "privilege" : "AW", + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') + }, + function (data, status) { + $("#id_agents2").html(''); + $("#module").html(''); + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + $("#id_agents2").append (option); + }); + }, + "json" + ); + }); + $("#modulegroup").change (function () { jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", 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 index 90f8cde128..e707f322b3 100644 --- a/pandora_console/extras/mr/9.sql +++ b/pandora_console/extras/mr/9.sql @@ -10,4 +10,6 @@ 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'; + COMMIT; \ No newline at end of file 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 18b93b8eac..8142f190f4 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', 4); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 8); 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', '708'); +INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '714'); -- --------------------------------------------------------------------- -- 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,7 @@ 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 `id_layout_linked_weight` int(10) NOT NULL default '0'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` @@ -1269,6 +1279,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` 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( " $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. @@ -900,6 +906,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 3c5406c46c..cc5349182e 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -181,7 +181,7 @@ $order_collation = ""; switch ($config["dbtype"]) { case "mysql": $order_collation = ""; - //$order_collation = "COLLATE utf8_general_ci"; + $order_collation = "COLLATE utf8_general_ci"; break; case "postgresql": case "oracle": @@ -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; @@ -540,10 +540,6 @@ if ($agents !== false) { } echo ''; echo ""; - if ($agent['quiet']) { - html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); - echo " "; - } if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $main_tab = 'main'; @@ -562,8 +558,10 @@ if ($agents !== false) { ""; echo ""; - $in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); - + $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . ' AND tplanned_downtime.executed = 1'); + if ($agent["disabled"]) { ui_print_help_tip(__('Disabled')); @@ -571,6 +569,11 @@ if ($agents !== false) { echo ""; } } + + if ($agent['quiet']) { + echo " "; + html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } if ($in_planned_downtime) { ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png'); diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 1fbf08bf80..b22bc0f626 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -45,10 +45,10 @@ echo ""; -echo ""; -echo ""; +echo ""; echo ''; // Check if there is at least one server of each type available to assign that // kind of modules. If not, do not show server type in combo @@ -119,7 +119,7 @@ if (($policy_page) || (isset($agent))) { // Create module/type combo echo ''; if (!$policy_page) { - echo ''; } - echo ''; - echo ''; echo ''; 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 f66aa17296..9b9b96ffaf 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) { $table_simple->data[4][1] .= '
'.__('Inverse interval').''; $table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy); if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[4][2] = ' '; + $table_simple->data[4][2] = ''; $table_simple->colspan[4][2] = 2; $table_simple->rowspan[4][2] = 3; } @@ -1323,8 +1323,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "legend_normal") .attr("x", 72) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#82B92E"); //legend Warning text @@ -1343,8 +1343,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "legend_warning") .attr("x", 168) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#ffd731"); //legend Critical text @@ -1363,8 +1363,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "legend_critical") .attr("x", 258) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#fc4444"); //styles for number and axes @@ -1382,8 +1382,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "warning_rect") .attr("x", 3) .attr("y", 0) - .attr("width", 300) - .attr("height", 200) + .attr("width", '300px') + .attr("height", '200px') .style("fill", "#82B92E"); //controls the inverse warning 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_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index 6009d1b9b8..b1cd1b220c 100755 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -600,7 +600,7 @@ $(document).ready (function () { var params = { "page" : "operation/agentes/ver_agente", "get_agent_modules_json" : 1, - "get_id_and_name" : 1, + "get_distinct_name" : 1, "indexed" : 0, "privilege" : "AW" }; diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 1550e0be93..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,12 +740,13 @@ $(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", "get_agent_modules_json" : 1, - "get_id_and_name" : 1, + "get_distinct_name" : 1, "indexed" : 0 }; @@ -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/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index 83b21b225b..b9cc96a468 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -473,8 +473,8 @@ $next_row++; .attr("id", "legend_normal") .attr("x", 72) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#82B92E"); //legend Warning text diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 0593021bdc..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: @@ -911,6 +927,9 @@ You can of course remove the warnings, that's why we include the source and do n elseif(check_acl ($config['id_user'], 0, "RM")) html_print_select_groups($config['id_user'], "RM", true, 'combo_group', $group, ''); + + echo "   ".__('Recursion').html_print_checkbox('recursion', 1, 0, true); + ?> @@ -1577,6 +1596,78 @@ You can of course remove the warnings, that's why we include the source and do n ?> + + + + + + + + + + + + + + + + + + + + +
" . $filter_groups_label . "" . $filter_groups . "" . $filter_groups ."   ". $filter_recursion_label . $filter_recursion. "" . $filter_module_groups_label . "
"; echo __('Search') . ' ' . html_print_input_text ('search_string', $search_string, '', 15, 255, true); echo ""; +echo ""; html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"'); echo "
'; + echo ''; echo __('Show in hierachy mode'); if ($checked == "true") { $checked = true; @@ -130,12 +130,12 @@ if (($policy_page) || (isset($agent))) { html_print_checkbox ('status_hierachy_mode', "", $checked, false, false, "onChange=change_mod_filter();"); echo ''; + echo ''; echo __("Type"); html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' ); html_print_input_hidden ('edit_module', 1); echo ''; + echo ''; echo ''; echo '
+ + + +
+ + + +
+ '; + 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); + + ?> +
@@ -2001,7 +2092,38 @@ $(document).ready (function () { "get_agents_group_json" : 1, "id_group" : this.value, "privilege" : "AW", - "keys_prefix" : "_" + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') + }, + function (data, status) { + $("#id_agents").html(''); + $("#id_agents2").html(''); + $("#module").html(''); + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + $("#id_agents2").append (option); + }); + }, + "json" + ); + } + ); + + $("#checkbox-recursion").change ( + function () { + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "id_group" : $("#combo_group").val(), + "privilege" : "AW", + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') }, function (data, status) { $("#id_agents").html(''); @@ -2177,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() { @@ -2658,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(); @@ -2729,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(); @@ -2850,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; @@ -2859,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; @@ -2868,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 4dd13e9af0..e52994b810 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1,3 +1,37 @@ + + head[$next] = '' . - __('Op.') . ''; + __('Op.') . ''.html_print_checkbox('all_delete', 0, false, true, false, + 'check_all_checkboxes();'); //$table->size = array (); $table->size[$next] = '10%'; @@ -703,9 +738,13 @@ switch ($action) { $data[$next] .= ''; $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_hidden ('action','delete_report', true); - $data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, '', + $data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, 'margin-right: 10px;', true, array ('title' => __('Delete'))); + + $data[$next] .= html_print_checkbox_extended ('massive_report_check', $report['id_report'], false, false, '', 'class="check_delete"', true); + $data[$next] .= ''; + } } @@ -733,8 +772,19 @@ switch ($action) { else echo '
'; html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); - echo "
"; + echo ""; + echo '
'; + + foreach ($reports as $report) { + echo ''; + } + + echo ''; + html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete" style="margin-left:5px;"'); + echo '
'; + echo ""; + } enterprise_hook('close_meta_frame'); @@ -1019,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); @@ -1354,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); @@ -2059,3 +2127,4 @@ switch ($activeTab) { enterprise_hook('close_meta_frame'); ?> + diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index 056d44e61d..8d9edddd88 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -201,7 +201,23 @@ echo ""; \ No newline at end of file + diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index c36529b7f7..ba88a64434 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -10,48 +10,29 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -$ttl = 1; -$homeurl = ''; - -if (isset($_GET['homeurl'])) { - $homeurl = $_GET['homeurl']; -} -else $homeurl = ''; - -$homeurl = ((bool)filter_var($homeurl, FILTER_VALIDATE_URL) == 1) ? '' : $homeurl; - -if (isset($_GET['ttl'])) { - $ttl = $_GET['ttl']; -} -else $ttl_param = 1; - -if (isset($_GET['graph_type'])) { - $graph_type = $_GET['graph_type']; -} -else $graph_type = ''; - -//$graph_type = get_parameter('graph_type', ''); -//$ttl_param = get_parameter('ttl', 1); -//$homeurl_param = get_parameter('homeurl', ''); - // Turn on output buffering. // The entire buffer will be discarded later so that any accidental output // does not corrupt images generated by fgraph. -ob_start (); +ob_start(); + +global $config; + +if (empty($config['homedir'])) { + require_once ('../../include/config.php'); + global $config; +} + +include_once($config['homedir'] . '/include/functions.php'); + +$ttl = get_parameter('ttl', 1); +$graph_type = get_parameter('graph_type', ''); if (!empty($graph_type)) { - $homedir = $_GET['homedir']; - if ($homedir != null) { - $config['homedir'] = $homedir; - } - - include_once($homeurl . 'include/functions.php'); - include_once($homeurl . 'include/functions_html.php'); - - include_once($homeurl . 'include/graphs/functions_gd.php'); - include_once($homeurl . 'include/graphs/functions_utils.php'); - include_once($homeurl . 'include/graphs/functions_d3.php'); - include_once($homeurl . 'include/graphs/functions_flot.php'); + include_once($config['homedir'] . '/include/functions_html.php'); + include_once($config['homedir'] . '/include/graphs/functions_gd.php'); + include_once($config['homedir'] . '/include/graphs/functions_utils.php'); + include_once($config['homedir'] . '/include/graphs/functions_d3.php'); + include_once($config['homedir'] . '/include/graphs/functions_flot.php'); } // Clean the output buffer and turn off output buffering @@ -61,13 +42,12 @@ switch($graph_type) { case 'histogram': $width = get_parameter('width'); $height = get_parameter('height'); - $font = get_parameter('font'); $data = json_decode(io_safe_output(get_parameter('data')), true); $max = get_parameter('max'); $title = get_parameter('title'); $mode = get_parameter ('mode', 1); - gd_histogram ($width, $height, $mode, $data, $max, $font, $title); + gd_histogram ($width, $height, $mode, $data, $max, $config['fontpath'], $title); break; case 'progressbar': $width = get_parameter('width'); @@ -77,7 +57,6 @@ switch($graph_type) { $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); $out_of_lim_image = get_parameter('out_of_lim_image', false); - $font = get_parameter('font'); $title = get_parameter('title'); $mode = get_parameter('mode', 1); @@ -87,7 +66,7 @@ switch($graph_type) { $value_text = get_parameter('value_text', ''); $colorRGB = get_parameter('colorRGB', ''); - gd_progress_bar ($width, $height, $progress, $title, $font, + gd_progress_bar ($width, $height, $progress, $title, $config['fontpath'], $out_of_lim_str, $out_of_lim_image, $mode, $fontsize, $value_text, $colorRGB); break; @@ -99,7 +78,6 @@ switch($graph_type) { $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); $out_of_lim_image = get_parameter('out_of_lim_image', false); - $font = get_parameter('font'); $title = get_parameter('title'); $mode = get_parameter('mode', 1); @@ -109,7 +87,7 @@ switch($graph_type) { $value_text = get_parameter('value_text', ''); $colorRGB = get_parameter('colorRGB', ''); - gd_progress_bubble ($width, $height, $progress, $title, $font, + gd_progress_bubble ($width, $height, $progress, $title, $config['fontpath'], $out_of_lim_str, $out_of_lim_image, $mode, $fontsize, $value_text, $colorRGB); break; @@ -178,7 +156,7 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', - $from_ux = false, $from_wux = false) { + $from_ux = false, $from_wux = false, $tick_color = 'white') { setup_watermark($water_mark, $water_mark_file, $water_mark_url); if (empty($chart_data)) { @@ -188,9 +166,26 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_vcolumn_chart ($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, - $homedir,$font,$font_size, $from_ux, $from_wux); + $homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor, + $tick_color); } else { + foreach ($chart_data as $key => $value) { + if(strlen($key) > 20){ + + if(strpos($key, ' - ') != -1){ + $key_temp = explode(" - ",$key); + $key_temp[0] = $key_temp[0]." \n"; + $key_temp[1]= '...'.substr($key_temp[1],-15); + $key2 = $key_temp[0].$key_temp[1]; + io_safe_output($key2); + } + $chart_data[$key2]['g'] = $chart_data[$key]['g']; + unset($chart_data[$key]); + } + + } + $graph = array(); $graph['data'] = $chart_data; $graph['width'] = $width; @@ -626,7 +621,8 @@ function polar_graph($flash_chart, $chart_data, $width, $height, function hbar_graph($flash_chart, $chart_data, $width, $height, $color, $legend, $long_index, $no_data_image, $xaxisname = "", $yaxisname = "", $water_mark = "", $font = '', $font_size = '', - $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') { + $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', + $tick_color = "white") { setup_watermark($water_mark, $water_mark_file, $water_mark_url); @@ -636,9 +632,25 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_hcolumn_chart( - $chart_data, $width, $height, $water_mark_url, $font, $font_size); + $chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color); } else { + + foreach ($chart_data as $key => $value) { + if(strlen($key) > 40){ + if(strpos($key, ' - ') != -1){ + $key_temp = explode(" - ",$key); + $key_temp[0] = $key_temp[0]." \n"; + $key_temp[1]= '...'.substr($key_temp[1],-20); + $key2 = $key_temp[0].$key_temp[1]; + io_safe_output($key2); + } + $chart_data[$key2]['g'] = $chart_data[$key]['g']; + unset($chart_data[$key]); + } + } + + $graph = array(); $graph['data'] = $chart_data; $graph['width'] = $width; @@ -752,7 +764,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, function ring_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '', $ttl = 1, $legend_position = false, - $colors = '', $hide_labels = false) { + $colors = '', $hide_labels = false,$background_color = 'white') { if (empty($chart_data)) { return graph_nodata_image($width, $height, 'pie'); @@ -768,7 +780,7 @@ function ring_graph($flash_chart, $chart_data, $width, return flot_custom_pie_chart ($flash_chart, $chart_data, $width, $height, $colors, $module_name_list, $long_index, $no_data, false, '', $water_mark, $font, $font_size, - $unit, $ttl, $homeurl, $background_color, $legend_position); + $unit, $ttl, $homeurl, $background_color, $legend_position,$background_color); } else { $total_modules = $chart_data['total_modules']; diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index e036a9855e..6fe97ae606 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -119,7 +119,8 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat function pandoraFlotPieCustom(graph_id, values, labels, width, font_size, font, water_mark, separator, legend_position, height, - colors,legend) { + colors,legend,background_color) { + font = font.split("/").pop().split(".").shift(); var labels = labels.split(separator); var legend = legend.split(separator); @@ -211,8 +212,24 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, $('.legend>table').css('right',($('.legend>div').height()*-1)); } //$('.legend>table').css('border',"1px solid #E2E2E2"); - $('.legend>table').css('background-color',"transparent"); + if(background_color == 'transparent'){ + $('.legend>table').css('background-color',""); + $('.legend>div').css('background-color',""); + $('.legend>table').css('color',"#aaa"); + } + else if (background_color == 'white') { + $('.legend>table').css('background-color',"white"); + $('.legend>table').css('color',"black"); + } + else if (background_color == 'black') { + $('.legend>table').css('background-color',"black"); + $('.legend>table').css('color',"#aaa"); + } + + $('.legend').over(function(){ + return false; + }); var pielegends = $('#'+graph_id+' .pieLabelBackground'); pielegends.each(function () { @@ -309,7 +326,8 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, } function pandoraFlotHBars(graph_id, values, labels, water_mark, - maxvalue, water_mark, separator, separator2, font, font_size) { + maxvalue, water_mark, separator, separator2, font, font_size, background_color, + tick_color) { var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27']; values = values.split(separator2); @@ -330,8 +348,6 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, }; } - - var labels_total=new Array(); labels = labels.split(separator); i = 0; @@ -355,20 +371,22 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, grid: { hoverable: true, borderWidth: 1, - backgroundColor: { colors: ["#FFF", "#FFF"] } + tickColor: tick_color, + backgroundColor: { colors: [background_color, background_color] } }, xaxis: { + color: tick_color, axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, axisLabelFontFamily: font+'Font', tickFormatter: xFormatter, }, yaxis: { + color: tick_color, axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, axisLabelFontFamily: font+'Font', ticks: yFormatter, - color: '', }, legend: { show: false @@ -494,7 +512,7 @@ function showTooltip(x, y, color, contents) { }).appendTo("body").fadeIn(200); } -function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size , from_ux, from_wux) { +function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size , from_ux, from_wux, background_color, tick_color) { values = values.split(separator2); legend = legend.split(separator); font = font.split("/").pop().split(".").shift(); @@ -548,6 +566,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, } }, xaxis: { + color:tick_color, axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, axisLabelFontFamily: font+'Font', @@ -557,6 +576,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, labelHeight: 50, }, yaxis: { + color:tick_color, axisLabelUseCanvas: true, axisLabelFontSizePixels: font_size, axisLabelFontFamily: font+'Font', @@ -585,7 +605,8 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, grid: { hoverable: true, borderWidth: 1, - backgroundColor: { colors: ["#FFF", "#FFF"] } + tickColor: tick_color, + backgroundColor: { colors: [background_color, background_color] } } }; @@ -608,16 +629,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, $('#' + graph_id).VUseTooltip(); $('#' + graph_id).css("margin-left","auto"); $('#' + graph_id).css("margin-right","auto"); - //~ $('#' + graph_id).find('div.legend-tooltip').tooltip({ track: true }); - /* - $('#'+graph_id+' .xAxis .tickLabel') - .css('transform', 'rotate(-45deg)') - .css('max-width','100px') - .find('div') - .css('position', 'relative') - .css('top', '+10px') - .css('left', '-30px'); - */ + if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) $('#'+graph_id+' .xAxis .tickLabel') .find('div') @@ -638,7 +650,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, } format.push([i, - '
' + '
' + label + '
']); } diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index f181492b7a..3a1cf73bbd 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -24,10 +24,16 @@ function include_javascript_d3 ($return = false) { if (!$is_include_javascript) { $is_include_javascript = true; - $output .= ''; - $output .= ''; - + if (is_metaconsole()) { + $output .= ''; + $output .= ''; + } + else { + $output .= ''; + $output .= ''; + } } + if (!$return) echo $output; @@ -309,4 +315,97 @@ function ux_console_phases_donut ($phases, $id, $return = false) { return $output; } + +function d3_progress_bar ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "progress_bar_" . $id; + $recipient_name_to_js = "#progress_bar_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function d3_progress_bubble ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "progress_bubble_" . $id; + $recipient_name_to_js = "#progress_bubble_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function progress_circular_bar ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "circular_progress_bar_" . $id; + $recipient_name_to_js = "#circular_progress_bar_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function progress_circular_bar_interior ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "circular_progress_bar_interior_" . $id; + $recipient_name_to_js = "#circular_progress_bar_interior_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function d3_donut_graph ($id, $width, $height, $module_data, $resume_color) { + global $config; + + $module_data = json_encode($module_data); + + $recipient_name = "donut_graph_" . $id; + $recipient_name_to_js = "#donut_graph_" . $id; + + $output = "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + $output .= ""; + + return $output; +} + ?> diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 319e69cab0..4f8943ed8f 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -666,7 +666,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values, $return .= "pandoraFlotPieCustom('$graph_id', '$values', '$labels', '$width', $font_size, '$fontpath', $water_mark, - '$separator', '$legend_position', '$height', '$colors','$legend')"; + '$separator', '$legend_position', '$height', '$colors','$legend','$background_color')"; $return .= ""; @@ -674,7 +674,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values, } // Returns a 3D column chart -function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7) { +function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7, $background_color = "white", $tick_color = "white") { global $config; include_javascript_dependencies_flot_graph(); @@ -755,7 +755,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = $return .= ""; @@ -763,7 +763,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = } // Returns a 3D column chart -function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux) { +function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux, $background_color = 'white', $tick_color = 'white') { global $config; include_javascript_dependencies_flot_graph(); @@ -847,14 +847,14 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon if ($from_ux) { if($from_wux){ - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true)"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color', '$tick_color')"; } else{ - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false)"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false, '$background_color', '$tick_color')"; } } else { - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false)"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color', '$tick_color')"; } $return .= ""; @@ -866,9 +866,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ global $config; include_javascript_dependencies_flot_graph(); - - $height+= 20; - + $stacked_str = 'stack: stack,'; // Get a unique identifier to graph @@ -876,10 +874,10 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ // Set some containers to legend, graph, timestamp tooltip, etc. if ($stat_win) { - $return = "
"; + $return = "
"; } else { - $return = "
"; + $return = "
"; } $return .= ""; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index f5368ca4c5..fcbd67f00a 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -695,9 +695,12 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $MyData->setSerieDescription("Xaxis", $xaxisname); $MyData->setAbscissa("Xaxis"); + /* Create the pChart object */ $myPicture = new pImage($width,$height,$MyData); + + /* Turn of Antialiasing */ $myPicture->Antialias = $antialiasing; @@ -705,7 +708,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, //$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0)); /* Turn on shadow computing */ - $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); + $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>120,"G"=>120,"B"=>120,"Alpha"=>10)); + + $pdf = get_parameter('pdf',false); + + if($pdf == true){ + $font_size = $font_size+1; + } + + /* Set the default font */ $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size)); @@ -721,15 +732,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, switch($graph_type) { case "vbar": $scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE, - "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, - "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); - $margin_left = 40; - $margin_right = 0; + "GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, + "Mode"=>SCALE_MODE_START0, "LabelRotation" => 45); + $margin_left = 40+50; + $margin_right = 90; $margin_top = 10; - $margin_bottom = 3 * $max_chars; + $margin_bottom = (3 * $max_chars)+80; break; case "hbar": - $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, + $scaleSettings = array("GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE, "CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, "LabelValuesRotation" => 30); $margin_left = $font_size * $max_chars; @@ -743,19 +754,112 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $myPicture->setGraphArea($margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom); $myPicture->drawScale($scaleSettings); - /* - if (isset($legend)) { - /* Write the chart legend - $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); - $myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10)); - } - */ + /* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); - /* Draw the chart */ - $settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette); + /* Draw the chart */ + $settings = array("ForceTransparency"=>"-1", "Gradient"=>FALSE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette); + + /* goes through a series of colors and assigns them to the bars, when it ends it starts from the beginning */ + + for ($i=0,$j=1; $i < count($settings['OverrideColors']); $i++) { + + switch ($j) { + case 1: + $settings['OverrideColors'][$i]['R'] = 43; + $settings['OverrideColors'][$i]['G'] = 98; + $settings['OverrideColors'][$i]['B'] = 201; + $j++; + break; + + case 2: + $settings['OverrideColors'][$i]['R'] = 243; + $settings['OverrideColors'][$i]['G'] = 86; + $settings['OverrideColors'][$i]['B'] = 157; + $j++; + break; + + case 3: + $settings['OverrideColors'][$i]['R'] = 191; + $settings['OverrideColors'][$i]['G'] = 191; + $settings['OverrideColors'][$i]['B'] = 191; + $j++; + break; + + case 4: + $settings['OverrideColors'][$i]['R'] = 251; + $settings['OverrideColors'][$i]['G'] = 183; + $settings['OverrideColors'][$i]['B'] = 50; + $j++; + break; + + case 5: + $settings['OverrideColors'][$i]['R'] = 157; + $settings['OverrideColors'][$i]['G'] = 117; + $settings['OverrideColors'][$i]['B'] = 177; + $j++; + break; + + case 6: + $settings['OverrideColors'][$i]['R'] = 39; + $settings['OverrideColors'][$i]['G'] = 172; + $settings['OverrideColors'][$i]['B'] = 151; + $j++; + break; + + case 7: + $settings['OverrideColors'][$i]['R'] = 171; + $settings['OverrideColors'][$i]['G'] = 42; + $settings['OverrideColors'][$i]['B'] = 46; + $j++; + break; + + case 8: + $settings['OverrideColors'][$i]['R'] = 185; + $settings['OverrideColors'][$i]['G'] = 218; + $settings['OverrideColors'][$i]['B'] = 87; + $j++; + break; + + case 9: + $settings['OverrideColors'][$i]['R'] = 60; + $settings['OverrideColors'][$i]['G'] = 182; + $settings['OverrideColors'][$i]['B'] = 203; + $j++; + break; + + case 10: + $settings['OverrideColors'][$i]['R'] = 105; + $settings['OverrideColors'][$i]['G'] = 65; + $settings['OverrideColors'][$i]['B'] = 179; + $j++; + break; + + case 11: + $settings['OverrideColors'][$i]['R'] = 228; + $settings['OverrideColors'][$i]['G'] = 35; + $settings['OverrideColors'][$i]['B'] = 102; + $j++; + break; + + case 12: + $settings['OverrideColors'][$i]['R'] = 252; + $settings['OverrideColors'][$i]['G'] = 130; + $settings['OverrideColors'][$i]['B'] = 53; + $j = 1; + break; + + + default: + + break; + + } + + } + $myPicture->drawBarChart($settings); // Paint the water mark at the last moment to show it in front diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 95a914104f..b315fae318 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -724,12 +724,13 @@ function sunburst (recipient, data, width, height) { .on("mousemove", move_tooltip); function computeTextRotation(d) { - var angle = x(d.x + d.dx / 2) - Math.PI / 2; - return angle / Math.PI * 180; + var ang = (x(d.x + d.dx / 2) - Math.PI / 2) / Math.PI * 180; + return (ang > 90) ? 180 + ang : ang; } var text = g.append("text") - .attr("x", function(d) { return y(d.y); }) + .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")rotate(" + computeTextRotation(d) + ")"; }) + .attr("x", function (d) { return computeTextRotation(d) > 180 ? -40 : -30; }) .attr("dx", "6") // margin .attr("dy", ".35em") // vertical-align .attr("opacity", function(d) { @@ -741,7 +742,6 @@ function sunburst (recipient, data, width, height) { .text(function(d) { return d.name; }) - .attr("transform", function(d) { return "rotate(" + computeTextRotation(d) + ")"; }) .style("font-size", "10px") // Makes svg elements invisible to events .style("pointer-events", "none"); @@ -768,8 +768,8 @@ function sunburst (recipient, data, width, height) { var arcText = d3.select(this.parentNode).select("text"); // fade in the text element and recalculate positions arcText - .attr("transform", function() { return "rotate(" + computeTextRotation(e) + ")" }) - .attr("x", function(d) { return y(d.y); }) + .attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")rotate(" + computeTextRotation(d) + ")"; }) + .attr("x", function (d) { return computeTextRotation(d) > 180 ? -40 : -30; }) .transition().duration(250) .attr("opacity", 1); } @@ -1037,19 +1037,19 @@ function createGauges(data, width, height, font_size, no_data_image, font) { label = label.replace(/(/g,'\('); label = label.replace(/)/g,'\)'); - minimun_warning = Math.round(parseFloat( data[key].min_warning ),2); - maximun_warning = Math.round(parseFloat( data[key].max_warning ),2); - minimun_critical = Math.round(parseFloat( data[key].min_critical ),2); - maximun_critical = Math.round(parseFloat( data[key].max_critical ),2); + minimun_warning = round_with_decimals(parseFloat( data[key].min_warning )); + maximun_warning = round_with_decimals(parseFloat( data[key].max_warning )); + minimun_critical = round_with_decimals(parseFloat( data[key].min_critical )); + maximun_critical = round_with_decimals(parseFloat( data[key].max_critical )); - mininum = Math.round(parseFloat(data[key].min),2); - maxinum = Math.round(parseFloat(data[key].max),2); + mininum = round_with_decimals(parseFloat(data[key].min)); + maxinum = round_with_decimals(parseFloat(data[key].max)); critical_inverse = parseInt(data[key].critical_inverse); warning_inverse = parseInt(data[key].warning_inverse); - valor = Math.round(parseFloat(data[key].value),2); - + valor = round_with_decimals(data[key].value); + if (isNaN(valor)) valor = null; createGauge(nombre, label, valor, mininum, maxinum, @@ -1281,7 +1281,7 @@ function Gauge(placeholderName, configuration, font) { var pointerContainer = this.body.select(".pointerContainer"); - pointerContainer.selectAll("text").text(Math.round(value)); + pointerContainer.selectAll("text").text(round_with_decimals(value)); var pointer = pointerContainer.selectAll("path"); pointer.transition() @@ -1492,4 +1492,601 @@ function print_phases_donut (recipient, phases) { polyline.exit() .remove(); } +} + +function round_with_decimals (value, multiplier = 1) { + if ((value * multiplier) == 0) return 0; + if ((value * multiplier) >= 1) { + return Math.round(value * multiplier) / multiplier; + } + return round_with_decimals (value, multiplier * 10); +} + +function progress_bar_d3 (recipient, percentile, width, height, color, unit, label, label_color) { + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height); + + var progress_back = circle.append('rect') + .attr('fill', '#000000') + .attr('fill-opacity', 0.5) + .attr('height', 20) + .attr('width', width) + .attr('rx', 10) + .attr('ry', 10) + .attr('x', 0); + + var progress_front = circle.append('rect') + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('height', 20) + .attr('width', 0) + .attr('rx', 10) + .attr('ry', 10) + .attr('x', 0); + + var labelText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", 20) + .html(label) + .attr('dy', '15') + .attr('text-anchor', 'middle'); + + var numberText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', '#FFFFFF') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", 14) + .attr('text-anchor', 'middle') + .attr('dy', '-10'); + + function updateProgress(bar_progress) { + var percent_value = Number(bar_progress * 100); + numberText.text(percent_value.toFixed() + " " + unit); + progress_front.attr('width', (width * bar_progress)); + } + + var bar_progress = startPercent; + + (function loops() { + updateProgress(bar_progress); + + if (count > 0) { + count--; + bar_progress += step; + setTimeout(loops, 30); + } + })(); +} + +function progress_bubble_d3 (recipient, percentile, width, height, color, unit, label, label_color) { + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var numberSize = 0; + var textSize = 0; + var unitSize = 0; + var yPosText = 0; + var yPosNumber = 0; + if (width >= 500) { + numberSize = 100; + textSize = 50; + unitSize = 50; + yPosNumber = '15'; + yPosText = '-100'; + } + else if (width >= 400) { + numberSize = 80; + textSize = 40; + unitSize = 40; + yPosNumber = '15'; + yPosText = '-80'; + } + else if (width >= 300) { + numberSize = 60; + textSize = 30; + unitSize = 30; + yPosNumber = '15'; + yPosText = '-45'; + } + else if (width >= 200) { + numberSize = 40; + textSize = 20; + unitSize = 20; + yPosNumber = '50'; + yPosText = '-30'; + } + else if (width >= 100) { + numberSize = 20; + textSize = 10; + unitSize = 10; + yPosNumber = '5'; + yPosText = '-20'; + } + else { + numberSize = 10; + textSize = 8; + unitSize = 8; + yPosNumber = '5'; + yPosText = '-10'; + } + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height); + + var progress_back = circle.append('circle') + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', '#000000') + .attr('fill-opacity', 0) + .attr('r', width/2); + + var progress_front = circle.append('circle') + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('r', 0); + + var labelText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", textSize) + .html(label) + .attr('dy', -(width/3)) + .attr('text-anchor', 'middle'); + + var numberText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", numberSize) + .attr('text-anchor', 'middle') + .attr('dy', width/3); + + function updateProgress(bar_progress) { + var percent_value = Number(bar_progress * 100); + numberText.text(percent_value.toFixed() + " " + unit); + progress_front.attr('r', ((width/2) * bar_progress)); + } + + var bar_progress = startPercent; + + (function loops() { + updateProgress(bar_progress); + + if (count > 0) { + count--; + bar_progress += step; + setTimeout(loops, 30); + } + })(); +} + +function print_circular_progress_bar (recipient, percentile, width, height, color, unit, label, label_color) { + var twoPi = Math.PI * 2; + var radius = (width / 2); + var border = 20; + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var numberSize = 0; + var textSize = 0; + var unitSize = 0; + var yPosText = 0; + var yPosUnit = 0; + var yPosNumber = 0; + if (width >= 500) { + numberSize = 100; + textSize = 50; + unitSize = 50; + yPosNumber = '15'; + yPosText = '-100'; + yPosUnit = '100'; + } + else if (width >= 400) { + numberSize = 80; + textSize = 40; + unitSize = 40; + yPosNumber = '15'; + yPosText = '-80'; + yPosUnit = '80'; + } + else if (width >= 300) { + numberSize = 60; + textSize = 30; + unitSize = 30; + yPosNumber = '15'; + yPosText = '-45'; + yPosUnit = '60'; + } + else if (width >= 200) { + numberSize = 40; + textSize = 20; + unitSize = 20; + yPosNumber = '10'; + yPosText = '-30'; + yPosUnit = '40'; + } + else if (width >= 100) { + numberSize = 20; + textSize = 10; + unitSize = 10; + yPosNumber = '5'; + yPosText = '-15'; + yPosUnit = '20'; + } + else { + numberSize = 8; + textSize = 4; + unitSize = 4; + yPosNumber = '2'; + yPosText = '-5'; + yPosUnit = '5'; + } + + var arc = d3.svg.arc() + .startAngle(0) + .innerRadius(radius) + .outerRadius(radius - border); + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height) + .append("g") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")"); + + var meter = circle.append("g") + .attr('class', 'progress-meter'); + + meter.append("path") + .attr('fill', '#000000') + .attr('fill-opacity', 0.5) + .attr('d', arc.endAngle(twoPi)); + + var foreground = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('stroke', color) + .attr('stroke-opacity', 1); + + var front = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1); + + var labelText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", textSize) + .html(label) + .attr('text-anchor', 'middle') + .attr('dy', yPosText); + + var numberText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", numberSize) + .attr('text-anchor', 'middle') + .attr('dy', yPosNumber); + + var percentText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", unitSize) + .text(unit) + .attr('text-anchor', 'middle') + .attr('dy', yPosUnit); + + function updateProgress(progress) { + foreground.attr('d', arc.endAngle(twoPi * progress)); + front.attr('d', arc.endAngle(twoPi * progress)); + var percent_value = Number(progress * 100); + numberText.text(percent_value.toFixed()); + } + + var progress = startPercent; + + (function loops() { + updateProgress(progress); + + if (count > 0) { + count--; + progress += step; + setTimeout(loops, 30); + } + })(); +} + +function print_interior_circular_progress_bar (recipient, percentile, width, height, color, unit, label, label_color) { + var twoPi = Math.PI * 2; + var radius = (width / 2) - 20; + var radius2 = (width / 2); + var border = 20; + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var numberSize = 0; + var textSize = 0; + var unitSize = 0; + var yPosText = 0; + var yPosUnit = 0; + var yPosNumber = 0; + if (width >= 500) { + numberSize = 100; + textSize = 50; + unitSize = 50; + yPosNumber = '15'; + yPosText = '-100'; + yPosUnit = '100'; + } + else if (width >= 400) { + numberSize = 80; + textSize = 40; + unitSize = 40; + yPosNumber = '15'; + yPosText = '-80'; + yPosUnit = '80'; + } + else if (width >= 300) { + numberSize = 60; + textSize = 30; + unitSize = 30; + yPosNumber = '15'; + yPosText = '-45'; + yPosUnit = '60'; + } + else if (width >= 200) { + numberSize = 40; + textSize = 20; + unitSize = 20; + yPosNumber = '10'; + yPosText = '-30'; + yPosUnit = '40'; + } + else if (width >= 100) { + numberSize = 20; + textSize = 10; + unitSize = 10; + yPosNumber = '5'; + yPosText = '-15'; + yPosUnit = '20'; + } + else { + numberSize = 8; + textSize = 4; + unitSize = 4; + yPosNumber = '2'; + yPosText = '-5'; + yPosUnit = '5'; + } + + var arc = d3.svg.arc() + .startAngle(0) + .innerRadius(radius) + .outerRadius(radius - border); + + var arc2 = d3.svg.arc() + .startAngle(0) + .innerRadius(radius2) + .outerRadius(radius2 - border); + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height) + .append("g") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")"); + + var meter = circle.append("g") + .attr('class', 'progress-meter'); + + meter.append("path") + .attr('fill', '#000000') + .attr('fill-opacity', 0.5) + .attr('d', arc.endAngle(twoPi)); + + var meter = circle.append("g") + .attr('class', 'progress-meter'); + + meter.append("path") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('d', arc2.endAngle(twoPi)); + + var foreground = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('stroke', color) + .attr('stroke-opacity', 1); + + var front = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1); + + var labelText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", textSize) + .html(label) + .attr('text-anchor', 'middle') + .attr('dy', yPosText); + + var numberText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", numberSize) + .attr('text-anchor', 'middle') + .attr('dy', yPosNumber); + + var percentText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", unitSize) + .text(unit) + .attr('text-anchor', 'middle') + .attr('dy', yPosUnit); + + function updateProgress(progress) { + foreground.attr('d', arc.endAngle(twoPi * progress)); + front.attr('d', arc.endAngle(twoPi * progress)); + var percent_value = Number(progress * 100); + numberText.text(percent_value.toFixed()); + } + + var progress = startPercent; + + (function loops() { + updateProgress(progress); + + if (count > 0) { + count--; + progress += step; + setTimeout(loops, 30); + } + })(); +} + +function print_donut_graph (recipient, width, height, module_data, resume_color) { + var svg = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height) + .append("g"); + + svg.append("g") + .attr("class", "slices"); + + var radius = 120; + var increment_y = 60; + var increment_y_padding = 25; + var decrement_x_padding = 150; + if (width >= 500) { + radius = 180; + increment_y = 60; + increment_y_padding = 20; + decrement_x_padding = 40; + } + else if (width >= 400) { + radius = 140; + increment_y = 40; + increment_y_padding = 20; + decrement_x_padding = 40; + } + else if (width >= 300) { + radius = 100; + increment_y = 40; + increment_y_padding = 15; + decrement_x_padding = 40; + } + else if (width >= 200) { + radius = 50; + increment_y = 40; + increment_y_padding = 15; + decrement_x_padding = 25; + } + else if (width >= 100) { + radius = 20; + increment_y = 20; + increment_y_padding = 8; + decrement_x_padding = 25; + } + else { + radius = 10; + increment_y = 10; + increment_y_padding = 3; + decrement_x_padding = 5; + } + + var arc = d3.svg.arc() + .outerRadius(radius * 0.8) + .innerRadius(radius * 0.4); + + var key = function(d){ return d.data.label; }; + + var pie = d3.layout.pie() + .sort(null) + .value(function(d) { + return parseFloat(d.percent); + }); + + jQuery.each(module_data, function (key, m_d) { + svg.append("g") + .append("rect") + .attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")") + .attr('fill', m_d.color) + .attr('x', -20) + .attr('y', -10) + .attr('width', 20) + .attr('height', 10); + + svg.append("g") + .append("text") + .attr('fill', resume_color) + .attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding)) + 10) + "," + (((height / 2) - radius) - increment_y) + ")") + .text(m_d.tag_name) + .style("font-family", "smallfontFont") + .style("font-size", "7pt"); + + increment_y -= increment_y_padding; + }); + + function donutData (){ + return module_data.map(function(m_data){ + return { label: m_data.tag_name, percent: m_data.percent, color : m_data.color} + }); + } + + print_phases(donutData()); + + function print_phases(data) { + var slice = svg.select(".slices").selectAll("path.slice") + .data(pie(data), key); + + slice.enter() + .insert("path") + .style("fill", function(d) { + return d.data.color; + }) + .attr("class", "slice") + .attr("transform", "translate(" + width / 2 + "," + (height - radius) + ")"); + + slice.transition() + .duration(0) + .attrTween("d", function(d) { + this._current = this._current || d; + var interpolate = d3.interpolate(this._current, d); + this._current = interpolate(0); + return function(t) { + return arc(interpolate(t)); + }; + }); + + slice.exit().remove(); + } } \ No newline at end of file diff --git a/pandora_console/include/help/en/help_alert_config.php b/pandora_console/include/help/en/help_alert_config.php index fec6b2a7bf..569242a5dc 100644 --- a/pandora_console/include/help/en/help_alert_config.php +++ b/pandora_console/include/help/en/help_alert_config.php @@ -58,6 +58,8 @@ Apart from the defined module macros, the following macros are also available:
  • _id_alert_ : Numerical ID of the alert (unique), used to correlate on third party software
  • _policy_ : Name of the policy the module belongs to (if applies).
  • _interval_ : Execution interval of the module.
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _target_ip_ : IP address of the target of the module.
  • _target_port_ : Port number of the target of the module.
  • _plugin_parameters_ : Plug-in Parameters of the module.
  • diff --git a/pandora_console/include/help/en/help_alert_macros.php b/pandora_console/include/help/en/help_alert_macros.php index 5382c502ab..bd303e9657 100644 --- a/pandora_console/include/help/en/help_alert_macros.php +++ b/pandora_console/include/help/en/help_alert_macros.php @@ -54,6 +54,8 @@ Besides the defined module macros, the following macros are available:
  • _target_ip_: IP address for the module’s target.
  • _target_port_: Port number for the module’s target.
  • _plugin_parameters_: Module’s Plugin parameters.
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_: Group’s contact information. Configured when the group is created.
  • _groupcustomid_: Group’s custom ID.
  • _groupother_: Other information about the group. Configured when the group is created.
  • diff --git a/pandora_console/include/help/es/help_alert_config.php b/pandora_console/include/help/es/help_alert_config.php index 5ab70b784e..056de9bcc3 100644 --- a/pandora_console/include/help/es/help_alert_config.php +++ b/pandora_console/include/help/es/help_alert_config.php @@ -63,6 +63,8 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _target_ip_ : Dirección IP del objetivo del módulo.
  • _target_port_ : Puerto del objetivo del módulo.
  • _plugin_parameters_ : Parámetros del Plug-in del módulo.
  • +
  • _server_ip_ : Ip del servidor al que el agente está asignado.
  • +
  • _server_name_ : Nombre del servidor al que el agente está asignado.
  • _groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.
  • _groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.
  • _email_tag_ : Emails asociados a los tags de módulos.
  • diff --git a/pandora_console/include/help/es/help_alert_macros.php b/pandora_console/include/help/es/help_alert_macros.php index 74efb4582b..19bc0b6f71 100644 --- a/pandora_console/include/help/es/help_alert_macros.php +++ b/pandora_console/include/help/es/help_alert_macros.php @@ -54,6 +54,8 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _target_ip_: Dirección IP del objetivo del módulo.
  • _target_port_: Puerto del objetivo del módulo.
  • _plugin_parameters_: Parámetros del plugin del módulo.
  • +
  • _server_ip_ : Ip del servidor al que el agente está asignado.
  • +
  • _server_name_ : Nombre del servidor al que el agente está asignado.
  • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
  • _groupcustomid_: ID personalizado del grupo.
  • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
  • diff --git a/pandora_console/include/help/ja/help_alert_config.php b/pandora_console/include/help/ja/help_alert_config.php index 592ed64ee3..fa6a68ffa2 100644 --- a/pandora_console/include/help/ja/help_alert_config.php +++ b/pandora_console/include/help/ja/help_alert_config.php @@ -62,6 +62,8 @@ email アクションを設定するには、_field1_ (送信先アドレス)、
  • _target_ip_ : モジュールの対象IPアドレス
  • _target_port_ : モジュールの対象ポート
  • _plugin_parameters_ : モジュールのプラグインパラメータ
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_ : グループコンタクト情報。グループの作成時に設定されます。
  • _groupother_ : グループに関するその他情報。グループの作成時に設定されます。
  • _email_tag_ : モジュールタグに関連付けられた Email。
  • diff --git a/pandora_console/include/help/ja/help_alert_macros.php b/pandora_console/include/help/ja/help_alert_macros.php index c9729e6bfd..86e3a04c96 100644 --- a/pandora_console/include/help/ja/help_alert_macros.php +++ b/pandora_console/include/help/ja/help_alert_macros.php @@ -54,6 +54,8 @@
  • _target_ip_ : モジュールの対象IPアドレス
  • _target_port_ : モジュールの対象ポート
  • _plugin_parameters_ : モジュールのプラグインパラメータ
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_ : グループコンタクト情報。グループの作成時に設定されます。
  • _groupcustomid_: グループカスタムID
  • _groupother_ : グループに関するその他情報。グループの作成時に設定されます。
  • diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index a9c36700a8..6b4cd0d415 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -240,10 +240,11 @@ function update_node_name(id_db_node) { jQuery.each(graph.nodes, function (i, element) { if (element.id_db == id_db_node) { - graph.nodes[i].text = name; + graph.nodes[i]['text'] = data['text']; + graph.nodes[i]['raw_text'] = data['raw_text']; - $("#id_node_" + i + networkmap_id + " title").html(name); - $("#id_node_" + i + networkmap_id + " tspan").html(name); + $("#id_node_" + i + networkmap_id + " title").html(data['raw_text']); + $("#id_node_" + i + networkmap_id + " tspan").html(data['raw_text']); } }); @@ -307,7 +308,12 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -342,7 +348,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -365,7 +377,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -400,7 +418,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -425,7 +449,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -460,7 +490,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); } @@ -618,6 +654,30 @@ function add_new_link(new_link) { graph.links.push(new_link); } +function move_to_networkmap (node) { + var params = []; + params.push("get_networkmap_from_fictional=1"); + params.push("id=" + node.id_db); + params.push("id_map=" + node.map_id); + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + + jQuery.ajax ({ + data: params.join ("&"), + dataType: 'json', + type: 'POST', + url: action="ajax.php", + success: function (data) { + if (data['correct']) { + window.location="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" + data['id_networkmap']; + } + else { + edit_node(node, true); + } + } + }); +} + + function edit_node(data_node, dblClick) { if (enterprise_installed) { var flag_edit_node = true; @@ -664,7 +724,6 @@ function edit_node(data_node, dblClick) { $("#node_options-node_name-2 input") .attr("onclick", "update_node_name(" + node_selected.id_db + ");"); - $("#node_details-0-1").html('' + node_selected["text"] + ''); var params = []; params.push("get_agent_info=1"); params.push("id_agent=" + node_selected["id_agent"]); @@ -676,11 +735,19 @@ function edit_node(data_node, dblClick) { type: 'POST', url: action = "ajax.php", success: function (data) { - var adressess = ""; - for (adress in data['adressess']) { - adressess += adress + "
    "; + $("#node_details-0-1").html('' + data['alias'] + ''); + + var addresses = ""; + if (data['adressess'] instanceof Array) { + for (var i; i < data['adressess'].length; i++) { + addresses += data['adressess'][i] + "
    "; + } + } else { + for (address in data['adressess']) { + addresses += address + "
    "; + } } - $("#node_details-1-1").html(adressess); + $("#node_details-1-1").html(addresses); $("#node_details-2-1").html(data["os"]); $("#node_details-3-1").html(data["group"]); @@ -693,7 +760,7 @@ function edit_node(data_node, dblClick) { $("#dialog_node_edit") .dialog("option", "title", - dialog_node_edit_title.replace("%s", node_selected.text)); + dialog_node_edit_title.replace("%s", node_selected['text'])); // It doesn't eval the possible XSS so it's ok $("#dialog_node_edit").dialog("open"); if (node_selected.id_agent == undefined || node_selected.id_agent == -2) { @@ -701,7 +768,7 @@ function edit_node(data_node, dblClick) { $("#node_options-fictional_node_name") .css("display", ""); $("input[name='edit_name_fictional_node']") - .val(node_selected.text); + .val(node_selected.text); // It doesn't eval the possible XSS so it's ok $("#node_options-fictional_node_networkmap_link") .css("display", ""); $("#edit_networkmap_to_link") @@ -715,7 +782,7 @@ function edit_node(data_node, dblClick) { } else { $("input[name='edit_name_node']") - .val(node_selected.text); + .val(node_selected.text); // It doesn't eval the possible XSS so it's ok $("#node_options-fictional_node_name") .css("display", "none"); $("#node_options-fictional_node_networkmap_link") @@ -866,9 +933,9 @@ function load_interfaces(selected_links) { }); $("#relations_table-template_row-node_source", template_relation_row) - .html(link_each.source.text); + .html(link_each.source['raw_text']); $("#relations_table-template_row-node_target", template_relation_row) - .html(link_each.target.text); + .html(link_each.target['raw_text']); $("#relations_table-template_row-edit", template_relation_row) .attr("align", "center"); $("#relations_table-template_row-edit .delete_icon", template_relation_row) @@ -3173,7 +3240,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3207,7 +3280,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3235,7 +3314,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3273,7 +3358,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3303,7 +3394,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3341,7 +3438,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); diff --git a/pandora_console/include/javascript/pandora_snmp_browser.js b/pandora_console/include/javascript/pandora_snmp_browser.js index 12f2f62296..fd202ad4dc 100644 --- a/pandora_console/include/javascript/pandora_snmp_browser.js +++ b/pandora_console/include/javascript/pandora_snmp_browser.js @@ -29,25 +29,25 @@ function snmpBrowse () { var ajax_url = $('#hidden-ajax_url').val(); // Prepare the AJAX call - var params = [ - "target_ip=" + target_ip, - "community=" + community, - "starting_oid=" + starting_oid, - "snmp_browser_version=" + snmp_version, - "server_to_exec=" + server_to_exec, - "snmp3_browser_auth_user=" + snmp3_auth_user, - "snmp3_browser_security_level=" + snmp3_security_level, - "snmp3_browser_auth_method=" + snmp3_auth_method, - "snmp3_browser_auth_pass=" + snmp3_auth_pass, - "snmp3_browser_privacy_method=" + snmp3_privacy_method, - "snmp3_browser_privacy_pass=" + snmp3_privacy_pass, - "action=" + "snmptree", - "page=operation/snmpconsole/snmp_browser" - ]; + + var params = {}; + params["target_ip"] = target_ip; + params["community"] = community; + params["starting_oid"] = starting_oid; + params["snmp_browser_version"] = snmp_version; + params["server_to_exec"] = server_to_exec; + params["snmp3_browser_auth_user"] = snmp3_auth_user; + params["snmp3_browser_security_level"] = snmp3_security_level; + params["snmp3_browser_auth_method"] = snmp3_auth_method; + params["snmp3_browser_auth_pass"] = snmp3_auth_pass; + params["snmp3_browser_privacy_method"] = snmp3_privacy_method; + params["snmp3_browser_privacy_pass"] = snmp3_privacy_pass; + params["action"] = "snmptree"; + params["page"] = "operation/snmpconsole/snmp_browser"; // Browse! jQuery.ajax ({ - data: params.join ("&"), + data: params, type: 'POST', url: action= ajax_url, async: true, diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index fcf084085b..beb53d61d7 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -769,6 +769,12 @@ input.graph_min { input.graph_min[disabled] { background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat center !important; } +input.bars_graph_min { + background: #fefefe url(../../images/icono-barras-arriba.png) no-repeat center !important; +} +input.bars_graph_min[disabled] { + background: #fefefe url(../../images/icono-barras-arriba.disabled.png) no-repeat center !important; +} input.percentile_min { background: #fefefe url(../../images/chart_bar.png) no-repeat center !important; } @@ -787,6 +793,12 @@ input.auto_sla_graph_min { input.auto_sla_graph_min[disabled] { background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat center !important; } +input.donut_graph_min { + background: #fefefe url(../../images/icono-quesito.png) no-repeat center !important; +} +input.donut_graph_min[disabled] { + background: #fefefe url(../../images/icono-quesito.disabled.png) no-repeat center !important; +} input.binary_min { background: #fefefe url(../../images/binary.png) no-repeat center !important; } @@ -2399,29 +2411,61 @@ span#plugin_description { font-size: 14pt !important; line-height: 14pt; } +.visual_font_size_18pt, .visual_font_size_18pt > em , .visual_font_size_18pt > strong, .visual_font_size_18pt > strong > span, .visual_font_size_18pt > span, .visual_font_size_18pt > strong > em, .visual_font_size_18pt > em > strong, .visual_font_size_18pt em span, .visual_font_size_18pt span em { + font-size: 18pt !important; + line-height: 18pt; +} + .visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em { font-size: 24pt !important; line-height: 24pt; } +.visual_font_size_28pt, .visual_font_size_28pt > em, .visual_font_size_28pt > strong, .visual_font_size_28pt > strong > span , .visual_font_size_28pt > span, .visual_font_size_28pt > strong > em, .visual_font_size_28pt > em > strong, .visual_font_size_28pt em span, .visual_font_size_28pt span em { + font-size: 28pt !important; + line-height: 28pt; +} .visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em { font-size: 36pt !important; line-height: 36pt; } +.visual_font_size_48pt, .visual_font_size_48pt > em, .visual_font_size_48pt > strong, .visual_font_size_48pt > strong > span, .visual_font_size_48pt > span, .visual_font_size_48pt > strong > em, .visual_font_size_48pt > em > strong, .visual_font_size_48pt em span, .visual_font_size_48pt span em { + font-size: 48pt !important; + line-height: 48pt; +} +.visual_font_size_60pt, .visual_font_size_60pt > em, .visual_font_size_60pt > strong, .visual_font_size_60pt > strong > span, .visual_font_size_60pt > span, .visual_font_size_60pt > strong > em, .visual_font_size_60pt > em > strong, .visual_font_size_60pt em span, .visual_font_size_60pt span em { + font-size: 60pt !important; + line-height: 60pt; +} .visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em { font-size: 72pt !important; line-height: 72pt; } +.visual_font_size_84pt, .visual_font_size_84pt > em, .visual_font_size_84pt > strong, .visual_font_size_84pt > strong > span, .visual_font_size_84pt > span, .visual_font_size_84pt > strong > em, .visual_font_size_84pt > em > strong, .visual_font_size_84pt em span, .visual_font_size_84pt span em { + font-size: 84pt !important; + line-height: 84pt; +} + .visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em { font-size: 96pt !important; line-height: 96pt; } +.visual_font_size_116pt, .visual_font_size_116pt > em, .visual_font_size_116pt > strong, .visual_font_size_116pt > strong > span, .visual_font_size_116pt > span, .visual_font_size_116pt > strong > em, .visual_font_size_116pt > em > strong, .visual_font_size_116pt em span, .visual_font_size_116pt span em { + font-size: 116pt !important; + line-height: 116pt; +} + .visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em { font-size: 128pt !important; line-height: 128pt; } +.visual_font_size_140pt, .visual_font_size_140pt > em, .visual_font_size_140pt > strong, .visual_font_size_140pt > strong > span, .visual_font_size_140pt > span, .visual_font_size_140pt > strong > em, .visual_font_size_140pt > em > strong, .visual_font_size_140pt em span, .visual_font_size_140pt span em { + font-size: 140pt !important; + line-height: 140pt; +} + .visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em { font-size: 154pt !important; line-height: 154pt; diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index 3dca8bdbf9..b7e4cec6ca 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -541,7 +541,7 @@ a:focus, input:focus, button:focus { outline: 0; } -DIV.login_links { +/*DIV.login_links { margin: 10px 0px 0px; color: #FFF; text-align: center; @@ -651,7 +651,7 @@ input.login { } input.login_user { - /* Browser without multibackground support */ + color: #373737 !important; padding-left: 8px; width: 179px; @@ -660,12 +660,14 @@ input.login_user { } input.login_password { - /* Browser without multibackground support */ + padding-left: 8px; width: 179px; color: #222; height: 20px; } +*/ + .databox_error { width: 657px !important; height: 400px; @@ -2318,7 +2320,7 @@ ul.operation li a:hover { -o-transition-property: background-color; -o-transition-duration: 0.5s; -o-transition-timing-function: ease-out; - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .submenu_not_selected:hover{ transition-property: background-color; @@ -2333,11 +2335,11 @@ ul.operation li a:hover { -o-transition-property: background-color; -o-transition-duration: 0.5s; -o-transition-timing-function: ease-out; - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .submenu_selected:hover{ - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .sub_subMenu{ @@ -2365,7 +2367,7 @@ ul.operation li a:hover { -moz-transition-timing-function: ease-out; -o-transition-property: background-color; -o-transition-duration: 0.5s; - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .submenu_text { @@ -2373,7 +2375,7 @@ ul.operation li a:hover { } .menu li.selected { - box-shadow: inset 4px 0 #82b92e; + box-shadow: inset 4px 0 #b1b1b1; } li.links a:hover { @@ -2393,7 +2395,7 @@ li.links a:hover { } .operation .selected { - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .menu li, .menu .li.not_selected { @@ -2455,29 +2457,59 @@ span#plugin_description { font-size: 14pt !important; line-height: 14pt; } +.visual_font_size_18pt, .visual_font_size_18pt > em , .visual_font_size_18pt > strong, .visual_font_size_18pt > strong > span, .visual_font_size_18pt > span, .visual_font_size_18pt > strong > em, .visual_font_size_18pt > em > strong, .visual_font_size_18pt em span, .visual_font_size_18pt span em { + font-size: 18pt !important; + line-height: 18pt; +} .visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em { font-size: 24pt !important; line-height: 24pt; } +.visual_font_size_28pt, .visual_font_size_28pt > em, .visual_font_size_28pt > strong, .visual_font_size_28pt > strong > span , .visual_font_size_28pt > span, .visual_font_size_28pt > strong > em, .visual_font_size_28pt > em > strong, .visual_font_size_28pt em span, .visual_font_size_28pt span em { + font-size: 28pt !important; + line-height: 28pt; +} .visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em { font-size: 36pt !important; line-height: 36pt; } +.visual_font_size_48pt, .visual_font_size_48pt > em, .visual_font_size_48pt > strong, .visual_font_size_48pt > strong > span, .visual_font_size_48pt > span, .visual_font_size_48pt > strong > em, .visual_font_size_48pt > em > strong, .visual_font_size_48pt em span, .visual_font_size_48pt span em { + font-size: 48pt !important; + line-height: 48pt; +} +.visual_font_size_60pt, .visual_font_size_60pt > em, .visual_font_size_60pt > strong, .visual_font_size_60pt > strong > span, .visual_font_size_60pt > span, .visual_font_size_60pt > strong > em, .visual_font_size_60pt > em > strong, .visual_font_size_60pt em span, .visual_font_size_60pt span em { + font-size: 60pt !important; + line-height: 60pt; +} .visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em { font-size: 72pt !important; line-height: 72pt; } +.visual_font_size_84pt, .visual_font_size_84pt > em, .visual_font_size_84pt > strong, .visual_font_size_84pt > strong > span, .visual_font_size_84pt > span, .visual_font_size_84pt > strong > em, .visual_font_size_84pt > em > strong, .visual_font_size_84pt em span, .visual_font_size_84pt span em { + font-size: 84pt !important; + line-height: 84pt; +} .visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em { font-size: 96pt !important; line-height: 96pt; } +.visual_font_size_116pt, .visual_font_size_116pt > em, .visual_font_size_116pt > strong, .visual_font_size_116pt > strong > span, .visual_font_size_116pt > span, .visual_font_size_116pt > strong > em, .visual_font_size_116pt > em > strong, .visual_font_size_116pt em span, .visual_font_size_116pt span em { + font-size: 116pt !important; + line-height: 116pt; +} + .visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em { font-size: 128pt !important; line-height: 128pt; } +.visual_font_size_140pt, .visual_font_size_140pt > em, .visual_font_size_140pt > strong, .visual_font_size_140pt > strong > span, .visual_font_size_140pt > span, .visual_font_size_140pt > strong > em, .visual_font_size_140pt > em > strong, .visual_font_size_140pt em span, .visual_font_size_140pt span em { + font-size: 140pt !important; + line-height: 140pt; +} + .visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em { font-size: 154pt !important; line-height: 154pt; @@ -2485,7 +2517,7 @@ span#plugin_description { .visual_font_size_196pt, .visual_font_size_196pt > em, .visual_font_size_196pt > strong, .visual_font_size_196pt > strong > span, .visual_font_size_196pt > span, .visual_font_size_196pt > strong > em, .visual_font_size_196pt > em > strong, .visual_font_size_196pt em span, .visual_font_size_196pt span em { font-size: 196pt !important; - line-height: 196pt; + line-height: 196pt; } @@ -3439,11 +3471,386 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px; } .rowPair:hover, .rowOdd:hover{ - background-color: #eee; + background-color: #6E6E6E; } .databox.data > tbody > tr:hover{ - background-color: #eee; + background-color: #6E6E6E; } .checkselected{ background-color: #eee; -} \ No newline at end of file +} + +#login_help_dialog *{ + color: #222222; +} + +.introjs-tooltip *{ + color: #222222; +} + +.dd_widget_content *{ + color: #222222; +} + +#dialog_add_new_widget *{ + color: #222222; +} + +.widget_configuration_form table tbody tr td:first-child{ + color: #222222; +} + +.widget_configuration_form .container *{ + color: #222222; +} +.widget_configuration_form b{ + color: #222222; +} + +form[action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'] *{ + color: #222222; +} + +form[action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'] input{ + color: white; +} + +form[action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'] select{ + color: white; +} +.notify { + color: black; +} +.notify *{ + color: black; +} +#login_logout *{ + color: #222222; +} + +/*modal windows login*/ +div.content_alert{ + width: 98%; + margin-top: 20px; +} + +div.icon_message_alert{ + float: left; + width: 25%; + text-align: center; + +} + +div.icon_message_alert img{ + width: 85px; +} + +div.content_message_alert{ + width: 75%; + float: right; +} + +div.content_message_alert *{ + color: black; +} + +div.text_message_alert{ + width: 100%; + margin-top: 10px; +} + +div.text_message_alert h1{ + margin: 0px; +} + +div.text_message_alert p{ + margin: 0px; + font-size: 10.3pt; + line-height: 14pt; +} + +div.button_message_alert{ + width: 100%; +} + +div.button_message_alert input{ + float: right; + width: 87px; + height: 33px; + color: #82b92e; + border: 1px solid #82b92e; + font-weight: bold; + margin-right: 20px; + margin-top: 20px; + font-size: 10pt; +} + +div.form_message_alert{ + width: 90%; + clear: both; + padding-top: 20px; + padding-left: 40px; +} + +div.form_message_alert ul li{ + display: inline-block; + padding: 10px; +} + +div.form_message_alert ul li input{ + border: none; + background-color: #dadada !important; + border-radius: 0px; + height: 17px; + width: 145px; + padding-left: 5px; +} + +div.form_message_alert ul li label{ + font-size: 10pt; + padding-right: 20px; +} + +div.form_message_alert h4{ + margin: 0px; + margin-bottom: 10px; +} + +div.button_message_alert_form input{ + float: right; + width: 87px; + height: 33px; + color: #82b92e; + border: 1px solid #82b92e; + font-weight: bold; + font-size: 10pt; + margin-right: 25px; +} + +.ui-dialog .ui-dialog-titlebar { + background-color: #82b92e !important; +} + +/* + styles header login +*/ +div#header_login{ + width: 100%; + height: 65px; + background-color: rgba(255, 255, 255, 0.06); +} + +div#icon_custom_pandora{ + float: left; + margin-top: 5px; + margin-left: 4%; +} + +div#list_icon_docs_support{ + float: right; + margin-top: 8px; + margin-right: 4%; +} + +div#list_icon_docs_support ul{ + margin-top: 5px; +} + +div#list_icon_docs_support ul li{ + display: inline-block; + color:white; + vertical-align: middle; + margin-right: 5px; + font-size: 10pt; +} + +li#li_margin_left{ + margin-left: 30px; +} + +/* + styles login form +*/ + +div.container_login{ + margin-top: 10%; + margin-left: 5%; + margin-right: 5%; + +} + +div.login_page { + width: 35%; + min-height: 600px; + float:left; +} + +div.login_page form { + border-right:1px solid #868686; + padding-top: 30px; + padding-bottom: 50px; + min-width: 400px; + max-height: 600px; +} + +div.login_logo_icon { + margin-bottom: 40px; + text-align: center; +} + +div.login_logo_icon img{ + margin: 0 auto; + width: 150px; +} +div.login_double_auth_code, +div.login_nick, +div.login_pass { + margin: 0 auto; + width: 70%; + height: 40px; + background-color: rgba(255, 255, 255, 0.20) !important; + margin-bottom: 25px; + min-width: 260px; +} + +div.login_nick img, +div.login_pass img{ + vertical-align: middle; + margin: 3px; +} + + +div.login_nick input, +div.login_pass input{ + background-color: rgba(255, 255, 255, 0.00) !important; + border:0px !important; + color:white !important; + border-radius: 0px; + width: 89%; + height: 40px; + font-size: 9pt; + padding: 0px !important; +} + + +div.login_nick input:focus, +div.login_pass input:focus{ + outline: none; +} + +div.login_nick input:-webkit-autofill, +div.login_nick input:-webkit-autofill:hover, +div.login_nick input:-webkit-autofill:focus, +div.login_nick input:-webkit-autofill:active, +div.login_pass input:-webkit-autofill, +div.login_pass input:-webkit-autofill:hover, +div.login_pass input:-webkit-autofill:focus, +div.login_pass input:-webkit-autofill:active { + transition: background-color 10000s ease-in-out 0s; + -webkit-box-shadow: 0 0 0px 0px transparent inset !important; + -webkit-text-fill-color: white !important; + border:0px; + width: 89%; +} + +div.login_nick input::-webkit-input-placeholder, +div.login_pass input::-webkit-input-placeholder { + color:white; +} + +div.login_pass img, +div.login_nick img{ + width: 30px; +} + +div.login_pass div, +div.login_nick div{ + float: left; + width: 11%; +} + +div.login_button{ + margin: 0 auto; + width: 70%; + height: 40px; + background-color: rgb(25, 25, 25); + border: 1px solid white; + min-width: 260px; +} + +div.login_button input { + width: 100%; + background-color: rgb(25, 25, 25) !important; + text-align: center; + border:0px; + border-radius: 0px; + height: 40px; + padding: 0px; + font-size: 9pt; + color: white; +} + +div.login_data { + width: 65%; + min-height: 600px; + float:left; +} + +div.text_banner_login{ + width: 100%; + margin-bottom: 60px; + color: white; + text-align: center; +} + +div.text_banner_login span{ + width: 100%; +} + +span.span1{ + font-size: 3vw; + font-family: 'lato-thin'; + color: white; +} + +span.span2{ + font-size: 3vw; + font-family: 'lato-bolder'; + color: white; +} + +div.img_banner_login{ + width: 100%; + text-align: center; +} + +div.img_banner_login img{ + max-width: 70%; + min-width: 70%; + max-height: 50%; + min-height: 50%; +} + +@media all and (max-width: 1200px) { + span.span1{ + font-size: 30pt; + } + span.span2{ + font-size: 30pt; + } +} + +.new_task p, .new_task h3, .new_task h2, .new_task a, .new_task strong{ + color: #222222; +} +.item p { + color: #222222; +} + +.item span { + color: #222222; +} + +.widget_config_advice, .widget_config_advice *{ + color: black; +} diff --git a/pandora_console/include/styles/pandora_green_old.css b/pandora_console/include/styles/pandora_green_old.css index e983e6047d..a99a9a275d 100644 --- a/pandora_console/include/styles/pandora_green_old.css +++ b/pandora_console/include/styles/pandora_green_old.css @@ -2435,53 +2435,97 @@ span#plugin_description { #tinymce { text-align: left; } + .visual_font_size_4pt, .visual_font_size_4pt > em, .visual_font_size_4pt > strong, .visual_font_size_4pt > strong > span, .visual_font_size_4pt > span, .visual_font_size_4pt > strong > em, .visual_font_size_4pt > em > strong, .visual_font_size_4pt em span, .visual_font_size_4pt span em { font-size: 4pt !important; line-height: 4pt; } + .visual_font_size_6pt, .visual_font_size_6pt > em, .visual_font_size_6pt > strong, .visual_font_size_6pt > strong > span, .visual_font_size_6pt > span, .visual_font_size_6pt > strong > em, .visual_font_size_6pt > em > strong, .visual_font_size_6pt em span, .visual_font_size_6pt span em { font-size: 6pt !important; line-height: 6pt; } + .visual_font_size_8pt, .visual_font_size_8pt > em, .visual_font_size_8pt > strong, .visual_font_size_8pt > strong > span , .visual_font_size_8pt > span, .visual_font_size_8pt > strong > em, .visual_font_size_8pt > em > strong, .visual_font_size_8pt em span, .visual_font_size_8pt span em { font-size: 8pt !important; line-height: 8pt; } + .visual_font_size_10pt, .visual_font_size_10pt > em , .visual_font_size_10pt > strong, .visual_font_size_10pt > strong > em, .visual_font_size_10pt > em > strong, .visual_font_size_10pt em span, .visual_font_size_10pt span em { font-size: 10pt !important; line-height: 10pt; } + .visual_font_size_12pt, .visual_font_size_12pt > em , .visual_font_size_12pt > strong, .visual_font_size_12pt > strong > em, .visual_font_size_12pt > em > strong, .visual_font_size_12pt em span, .visual_font_size_12pt span em { font-size: 12pt !important; line-height: 12pt; } + .visual_font_size_14pt, .visual_font_size_14pt > em , .visual_font_size_14pt > strong, .visual_font_size_14pt > strong > span, .visual_font_size_14pt > span, .visual_font_size_14pt > strong > em, .visual_font_size_14pt > em > strong, .visual_font_size_14pt em span, .visual_font_size_14pt span em { font-size: 14pt !important; line-height: 14pt; } + +.visual_font_size_18pt, .visual_font_size_18pt > em , .visual_font_size_18pt > strong, .visual_font_size_18pt > strong > span, .visual_font_size_18pt > span, .visual_font_size_18pt > strong > em, .visual_font_size_18pt > em > strong, .visual_font_size_18pt em span, .visual_font_size_18pt span em { + font-size: 18pt !important; + line-height: 18pt; +} + .visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em { font-size: 24pt !important; line-height: 24pt; } + +.visual_font_size_28pt, .visual_font_size_28pt > em, .visual_font_size_28pt > strong, .visual_font_size_28pt > strong > span , .visual_font_size_28pt > span, .visual_font_size_28pt > strong > em, .visual_font_size_28pt > em > strong, .visual_font_size_28pt em span, .visual_font_size_28pt span em { + font-size: 28pt !important; + line-height: 28pt; +} + .visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em { font-size: 36pt !important; line-height: 36pt; } + +.visual_font_size_48pt, .visual_font_size_48pt > em, .visual_font_size_48pt > strong, .visual_font_size_48pt > strong > span, .visual_font_size_48pt > span, .visual_font_size_48pt > strong > em, .visual_font_size_48pt > em > strong, .visual_font_size_48pt em span, .visual_font_size_48pt span em { + font-size: 48pt !important; + line-height: 48pt; +} + +.visual_font_size_60pt, .visual_font_size_60pt > em, .visual_font_size_60pt > strong, .visual_font_size_60pt > strong > span, .visual_font_size_60pt > span, .visual_font_size_60pt > strong > em, .visual_font_size_60pt > em > strong, .visual_font_size_60pt em span, .visual_font_size_60pt span em { + font-size: 60pt !important; + line-height: 60pt; +} + .visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em { font-size: 72pt !important; line-height: 72pt; } +.visual_font_size_84pt, .visual_font_size_84pt > em, .visual_font_size_84pt > strong, .visual_font_size_84pt > strong > span, .visual_font_size_84pt > span, .visual_font_size_84pt > strong > em, .visual_font_size_84pt > em > strong, .visual_font_size_84pt em span, .visual_font_size_84pt span em { + font-size: 84pt !important; + line-height: 84pt; +} + .visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em { font-size: 96pt !important; line-height: 96pt; } +.visual_font_size_116pt, .visual_font_size_116pt > em, .visual_font_size_116pt > strong, .visual_font_size_116pt > strong > span, .visual_font_size_116pt > span, .visual_font_size_116pt > strong > em, .visual_font_size_116pt > em > strong, .visual_font_size_116pt em span, .visual_font_size_116pt span em { + font-size: 116pt !important; + line-height: 116pt; +} + .visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em { font-size: 128pt !important; line-height: 128pt; } +.visual_font_size_140pt, .visual_font_size_140pt > em, .visual_font_size_140pt > strong, .visual_font_size_140pt > strong > span, .visual_font_size_140pt > span, .visual_font_size_140pt > strong > em, .visual_font_size_140pt > em > strong, .visual_font_size_140pt em span, .visual_font_size_140pt span em { + font-size: 140pt !important; + line-height: 140pt; +} + .visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em { font-size: 154pt !important; line-height: 154pt; diff --git a/pandora_console/install.php b/pandora_console/install.php index 246db73a87..d65278627b 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -70,8 +70,8 @@
    '; $data[0] .= ''; - if ($agent['quiet']) { - $data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . " "; - } $data[0] .= ' '.$agent["alias"].''; $data[0] .= ''; + + if ($agent['quiet']) { + $data[0] .= " "; + $data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } + + if ($in_planned_downtime) { + $data[0] .= ui_print_help_tip (__('Agent in planned downtime'), true, 'images/minireloj-16.png'); + $data[0] .= ""; + } + $data[0] .= '
    '; $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt'); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 80a891b38e..ae7bcef432 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -74,7 +74,12 @@ $table_agent->data = array(); $data = array(); $agent_name = ui_print_agent_name($agent["id_agente"], true, 500, "font-size: medium;font-weight:bold", true); -$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); +$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents + ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . + ' AND tplanned_downtime.executed = 1'); + if ($agent['disabled']) { if ($in_planned_downtime) { @@ -620,7 +625,7 @@ $data[0][0] .= __('Events (24h)') . '' . '
    ' . - graph_graphic_agentevents ($id_agente, 450, 15, SECONDS_1DAY, '', true, true) . + graph_graphic_agentevents ($id_agente, 450, 40, SECONDS_1DAY, '', true, true) . '
    ' . ''; diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index ff1d7bf9e3..e33d499fe8 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -38,8 +38,8 @@ $start_date = get_parameter ("start_date", date("Y-m-d")); $draw_events = get_parameter ("draw_events", 0); $modules = get_parameter('modules', array()); $filter = get_parameter('filter', 0); -$combined = (bool)get_parameter('combined', 1); - +$combined = get_parameter('combined', 1); +$option_type = get_parameter('option_type', 0); //---------------------------------------------------------------------- // Get modules of agent sorted as: @@ -159,7 +159,6 @@ $table->data[0][1] = html_print_select($list_modules, 'modules[]', $table->rowspan[2][0] = 7; $table->data[2][0] = ""; - $table->data[2][1] = __('Begin date'); $table->data[2][2] = html_print_input_text ("start_date", substr ($start_date, 0, 10),'', 10, 40, true); $table->data[2][2] .= html_print_image ("images/calendar_view_day.png", true, array ("onclick" => "scwShow(scwID('text-start_date'),this);")); @@ -174,12 +173,17 @@ $table->data[5][2] = __('Show alerts') . ui_print_help_tip(__('the combined graph does not show the alerts into this graph'), true); $table->data[5][3] = html_print_checkbox ("draw_alerts", 1, (bool) $draw_alerts, true); $table->data[6][2] = __('Show as one combined graph'); -$table->data[6][3] = - html_print_radio_button('combined', 1, __('one combined graph'), - $combined, true); -$table->data[6][3] .= - html_print_radio_button('combined', 0, __('several graphs for each module'), - $combined, true); +$graph_option_one_or_several = array(0 => __('several graphs for each module'), 1 => __('One combined graph')); +$table->data[6][3] = html_print_select($graph_option_one_or_several, 'combined', $combined, '', '', 1, true); + +$table->data[7][2] = __('Chart type'); +if ($combined == 1) { + $graph_option_type = array(0 => __('Area'), 1 => __('Area stack'), 2 => __('Line'), 3 => __('Line stack')); +} +else { + $graph_option_type = array(0 => __('Area'), 2 => __('Line')); +} +$table->data[7][3] = html_print_select($graph_option_type, 'option_type', $option_type, '', '', 1, true); $htmlForm = '
    '; $htmlForm .= html_print_table($table, true); @@ -321,6 +325,39 @@ echo "
    "; // Load graphs $(document).ready(function() { + $('#combined').change(function () { + if ($('#combined').val() == 1) { + $('#option_type').empty(); + $('#option_type').append($('