Merge branch 'develop' into visual-console-agent-link-bug

Conflicts:
	pandora_console/include/ajax/visual_console_builder.ajax.php
This commit is contained in:
Alejandro Gallardo Escobar 2017-11-29 14:00:44 +01:00
commit f49cef9ca4
387 changed files with 61243 additions and 67862 deletions

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager"> <component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" /> <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
@ -27,17 +24,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 8 compileSdkVersion 8
buildToolsVersion "25.0.2" buildToolsVersion "26.0.2"
defaultConfig { defaultConfig {
applicationId "pandroid_event_viewer.pandorafms" applicationId "pandroid_event_viewer.pandorafms"

View File

@ -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")); registerReceiver(onBroadcast, new IntentFilter("eventlist.java"));
this.toggleLoadingLayout(); this.toggleLoadingLayout();

View File

@ -96,10 +96,29 @@ public class Main extends Activity {
Activity.MODE_PRIVATE); Activity.MODE_PRIVATE);
setContentView(R.layout.main); 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 Button buttonSetAsFilterWatcher = (Button) findViewById(R.id.button_set_as_filter_watcher);
final ImageButton buttonSearch = (ImageButton) findViewById(R.id.refresh_icon_button_main); final ImageButton buttonSearch = (ImageButton) findViewById(R.id.refresh_icon_button_main);
final ImageButton buttonDeleteProfile = (ImageButton) findViewById(R.id.button_delete_profile); final ImageButton buttonDeleteProfile = (ImageButton) findViewById(R.id.button_delete_profile);
final ImageButton buttonSaveProfile = (ImageButton) findViewById(R.id.button_save_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. // Check if the user preferences it is set.
if (object.user.length() == 0 || object.password.length() == 0 if (object.user.length() == 0 || object.password.length() == 0
|| object.url.length() == 0) { || object.url.length() == 0) {

View File

@ -63,8 +63,22 @@
android:layout_weight="0" android:layout_weight="0"
android:padding="0dp" android:padding="0dp"
android:src="@drawable/filter_icon_button" android:src="@drawable/filter_icon_button"
android:background="@null" />
<LinearLayout
android:layout_width="2px"
android:layout_height="fill_parent"
android:background="#6D9624" />
<ImageButton
android:id="@+id/settings_icon_button_list"
android:layout_width="58dp"
android:layout_height="match_parent"
android:layout_weight="0"
android:background="@null" android:background="@null"
/> android:tint="@android:color/white"
android:src="@android:drawable/ic_menu_preferences" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@ -64,6 +64,21 @@
android:background="@null" android:background="@null"
android:padding="0dp" android:padding="0dp"
android:src="@drawable/icon_filter_pressed" /> android:src="@drawable/icon_filter_pressed" />
<LinearLayout
android:layout_width="2px"
android:layout_height="fill_parent"
android:background="#6D9624" />
<ImageButton
android:id="@+id/settings_icon_button_main"
android:layout_width="58dp"
android:layout_height="match_parent"
android:layout_weight="0"
android:background="@null"
android:tint="@android:color/white"
android:src="@android:drawable/ic_menu_preferences" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@ -4,7 +4,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.1' classpath 'com.android.tools.build:gradle:3.0.0'
} }
} }

View File

@ -1,6 +1,6 @@
#Tue Apr 18 16:40:24 CEST 2017 #Thu Nov 02 13:39:33 CET 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, AIX version # Version 7.0NG.716, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, FreeBSD Version # Version 7.0NG.716, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, HP-UX Version # Version 7.0NG.716, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.716, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.716, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, Solaris Version # Version 7.0NG.716, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2010 Artica Soluciones Tecnologicas # (c) 2006-2010 Artica Soluciones Tecnologicas
# Version 7.0NG.713 # Version 7.0NG.716
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713, AIX version # Version 7.0NG.716, AIX version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713 # Version 7.0NG.716
# FreeBSD/IPSO version # FreeBSD/IPSO version
# Licenced under GPL licence, 2003-2007 Sancho Lerena # Licenced under GPL licence, 2003-2007 Sancho Lerena

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713, HPUX Version # Version 7.0NG.716, HPUX Version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713 # Version 7.0NG.716
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2010 Artica Soluciones Tecnologicas # (c) 2003-2010 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713 # Version 7.0NG.716
# Licensed under GPL license v2, # Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas # (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713 # Version 7.0NG.716
# Licensed under GPL license v2, # Licensed under GPL license v2,
# please visit http://pandora.sourceforge.net # please visit http://pandora.sourceforge.net

View File

@ -1,6 +1,6 @@
# Fichero de configuracion base de agentes de Pandora # Fichero de configuracion base de agentes de Pandora
# Base config file for Pandora agents # Base config file for Pandora agents
# Version 7.0NG.713, Solaris version # Version 7.0NG.716, Solaris version
# General Parameters # General Parameters
# ================== # ==================

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, AIX version # Version 7.0NG.716, AIX version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.713-171018 Version: 7.0NG.716-171129
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.713-171018" pandora_version="7.0NG.716-171129"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.716, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas # Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, FreeBSD Version # Version 7.0NG.716, FreeBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas # Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, HP-UX Version # Version 7.0NG.716, HP-UX Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.716, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas # Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, GNU/Linux # Version 7.0NG.716, GNU/Linux
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, NetBSD Version # Version 7.0NG.716, NetBSD Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas # Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -1,5 +1,5 @@
# Base config file for Pandora FMS agents # Base config file for Pandora FMS agents
# Version 7.0NG.713, Solaris Version # Version 7.0NG.716, Solaris Version
# Licensed under GPL license v2, # Licensed under GPL license v2,
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas # Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
# http://www.pandorafms.com # http://www.pandorafms.com

View File

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.713'; use constant AGENT_VERSION => '7.0NG.716';
use constant AGENT_BUILD => '171018'; use constant AGENT_BUILD => '171129';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;
@ -1579,6 +1579,9 @@ sub guess_os_version ($) {
# AIX # AIX
} elsif ($os eq 'aix') { } elsif ($os eq 'aix') {
$os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/); $os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/);
# Darwin
} elsif ($os eq 'darwin') {
$os_version = `defaults read loginwindow SystemVersionStampAsString`;
# Windows # Windows
} elsif ($os =~ /win/i) { } elsif ($os =~ /win/i) {
$os_version = `ver`; $os_version = `ver`;

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.713 %define version 7.0NG.716
%define release 171018 %define release 171129
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel
Requires: fileutils textutils unzip Requires: fileutils textutils unzip
Requires: util-linux procps grep Requires: util-linux procps grep
Requires: /sbin/ip /bin/awk Requires: /sbin/ip /bin/awk
Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL) Requires: perl perl(Sys::Syslog)
# Required by plugins # Required by plugins
#Requires: sh-utils sed passwd net-tools rpm #Requires: sh-utils sed passwd net-tools rpm
AutoReq: 0 AutoReq: 0

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.713 %define version 7.0NG.716
%define release 171018 %define release 171129
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}
@ -67,6 +67,7 @@ then
fi fi
%post %post
mkdir -p /var/log/pandora
chown pandora:root /var/log/pandora chown pandora:root /var/log/pandora
if [ ! -d /etc/pandora ] ; then if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora mkdir -p /etc/pandora
@ -91,6 +92,9 @@ if [ ! -e /etc/pandora/collections ]; then
fi fi
cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent 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 mkdir -p /var/spool/pandora/data_out
chkconfig pandora_agent_daemon on chkconfig pandora_agent_daemon on

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.713" PI_VERSION="7.0NG.716"
PI_BUILD="171018" PI_BUILD="171129"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -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=<<EO_HELP;
Pandora FMS plugin for route parse
Usage: $0 -t target [options]
OPTIONS
-c n number of tests (n)
--no-ping 1 disable ping mode
--no-mtr 1 disable mtr mode
-s 1 symmetric routing (1) *default
asymmetric routing (0)
*Warning* in ping mode, the maximum number of steps detected is 9
EO_HELP
################################################################################
# Imported methods
################################################################################
################################################################################
# Mix hashses
################################################################################
sub merge_hashes {
my $_h1 = shift;
my $_h2 = shift;
my %ret = (%{$_h1}, %{$_h2});
return \%ret;
}
################################################################################
# Check if a value is in an array
################################################################################
sub in_array($$){
my ($array, $value) = @_;
if (empty($value)) {
return 0;
}
my %params = map { $_ => 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 .= "<module>\n";
$xml_module .= "\t<name><![CDATA[" . $data->{name} . "]]></name>\n";
$xml_module .= "\t<type>" . $data->{type} . "</type>\n";
if (ref ($data->{value}) eq "ARRAY") {
$xml_module .= "\t<datalist>\n";
foreach (@{$data->{value}}) {
$xml_module .= "\t<data><![CDATA[" . $data->{value} . "]]></data>\n";
}
$xml_module .= "\t</datalist>\n";
}
else {
$xml_module .= "\t<data><![CDATA[" . $data->{value} . "]]></data>\n";
}
if ( !(empty($data->{desc}))) {
$xml_module .= "\t<description><![CDATA[" . $data->{desc} . "]]></description>\n";
}
if ( !(empty ($data->{unit})) ) {
$xml_module .= "\t<unit><![CDATA[" . $data->{unit} . "]]></unit>\n";
}
if (! (empty($data->{interval})) ) {
$xml_module .= "\t<module_interval><![CDATA[" . $data->{interval} . "]]></module_interval>\n";
}
if (! (empty($data->{tags})) ) {
$xml_module .= "\t<tags>" . $data->{tags} . "</tags>\n";
}
if (! (empty($data->{module_group})) ) {
$xml_module .= "\t<module_group>" . $data->{module_group} . "</module_group>\n";
}
if (! (empty($data->{module_parent})) ) {
$xml_module .= "\t<module_parent>" . $data->{module_parent} . "</module_parent>\n";
}
if (! (empty($data->{wmin})) ) {
$xml_module .= "\t<min_warning><![CDATA[" . $data->{wmin} . "]]></min_warning>\n";
}
if (! (empty($data->{wmax})) ) {
$xml_module .= "\t<max_warning><![CDATA[" . $data->{wmax} . "]]></max_warning>\n";
}
if (! (empty ($data->{cmin})) ) {
$xml_module .= "\t<min_critical><![CDATA[" . $data->{cmin} . "]]></min_critical>\n";
}
if (! (empty ($data->{cmax})) ){
$xml_module .= "\t<max_critical><![CDATA[" . $data->{cmax} . "]]></max_critical>\n";
}
if (! (empty ($data->{wstr}))) {
$xml_module .= "\t<str_warning><![CDATA[" . $data->{wstr} . "]]></str_warning>\n";
}
if (! (empty ($data->{cstr}))) {
$xml_module .= "\t<str_critical><![CDATA[" . $data->{cstr} . "]]></str_critical>\n";
}
if (! (empty ($data->{cinv}))) {
$xml_module .= "\t<critical_inverse><![CDATA[" . $data->{cinv} . "]]></critical_inverse>\n";
}
if (! (empty ($data->{winv}))) {
$xml_module .= "\t<warning_inverse><![CDATA[" . $data->{winv} . "]]></warning_inverse>\n";
}
if (! (empty ($data->{max}))) {
$xml_module .= "\t<max><![CDATA[" . $data->{max} . "]]></max>\n";
}
if (! (empty ($data->{min}))) {
$xml_module .= "\t<min><![CDATA[" . $data->{min} . "]]></min>\n";
}
if (! (empty ($data->{post_process}))) {
$xml_module .= "\t<post_process><![CDATA[" . $data->{post_process} . "]]></post_process>\n";
}
if (! (empty ($data->{disabled}))) {
$xml_module .= "\t<disabled><![CDATA[" . $data->{disabled} . "]]></disabled>\n";
}
if (! (empty ($data->{min_ff_event}))) {
$xml_module .= "\t<min_ff_event><![CDATA[" . $data->{min_ff_event} . "]]></min_ff_event>\n";
}
if (! (empty ($data->{status}))) {
$xml_module .= "\t<status><![CDATA[" . $data->{status} . "]]></status>\n";
}
if (! (empty ($data->{timestamp}))) {
$xml_module .= "\t<timestamp><![CDATA[" . $data->{timestamp} . "]]></timestamp>\n";
}
if (! (empty ($data->{custom_id}))) {
$xml_module .= "\t<custom_id><![CDATA[" . $data->{custom_id} . "]]></custom_id>\n";
}
if (! (empty ($data->{critical_instructions}))) {
$xml_module .= "\t<critical_instructions><![CDATA[" . $data->{critical_instructions} . "]]></critical_instructions>\n";
}
if (! (empty ($data->{warning_instructions}))) {
$xml_module .= "\t<warning_instructions><![CDATA[" . $data->{warning_instructions} . "]]></warning_instructions>\n";
}
if (! (empty ($data->{unknown_instructions}))) {
$xml_module .= "\t<unknown_instructions><![CDATA[" . $data->{unknown_instructions} . "]]></unknown_instructions>\n";
}
if (! (empty ($data->{quiet}))) {
$xml_module .= "\t<quiet><![CDATA[" . $data->{quiet} . "]]></quiet>\n";
}
if (! (empty ($data->{module_ff_interval}))) {
$xml_module .= "\t<module_ff_interval><![CDATA[" . $data->{module_ff_interval} . "]]></module_ff_interval>\n";
}
if (! (empty ($data->{crontab}))) {
$xml_module .= "\t<crontab><![CDATA[" . $data->{crontab} . "]]></crontab>\n";
}
if (! (empty ($data->{min_ff_event_normal}))) {
$xml_module .= "\t<min_ff_event_normal><![CDATA[" . $data->{min_ff_event_normal} . "]]></min_ff_event_normal>\n";
}
if (! (empty ($data->{min_ff_event_warning}))) {
$xml_module .= "\t<min_ff_event_warning><![CDATA[" . $data->{min_ff_event_warning} . "]]></min_ff_event_warning>\n";
}
if (! (empty ($data->{min_ff_event_critical}))) {
$xml_module .= "\t<min_ff_event_critical><![CDATA[" . $data->{min_ff_event_critical} . "]]></min_ff_event_critical>\n";
}
if (! (empty ($data->{ff_timeout}))) {
$xml_module .= "\t<ff_timeout><![CDATA[" . $data->{ff_timeout} . "]]></ff_timeout>\n";
}
if (! (empty ($data->{each_ff}))) {
$xml_module .= "\t<each_ff><![CDATA[" . $data->{each_ff} . "]]></each_ff>\n";
}
if (! (empty ($data->{parent_unlink}))) {
$xml_module .= "\t<module_parent_unlink><![CDATA[" . $data->{parent_unlink} . "]]></module_parent_unlink>\n";
}
if (! (empty ($data->{alerts}))) {
foreach my $alert (@{$data->{alerts}}){
$xml_module .= "\t<alert_template><![CDATA[" . $alert . "]]></alert_template>\n";
}
}
if (defined ($config->{global_alerts})){
foreach my $alert (@{$config->{global_alerts}}){
$xml_module .= "\t<alert_template><![CDATA[" . $alert . "]]></alert_template>\n";
}
}
$xml_module .= "</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<min){min=met; gw=\$3\\\";\\\"\$4}} END {print gw}"`);
$gw->{'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<min){min=met; gw=\$3\\\";\\\"\$4}} END {print gw}"`);
$gw->{'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, $_);
}

View File

@ -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_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 PandoraAgent_CXXFLAGS=-g -O0
else 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 PandoraAgent_CXXFLAGS=-O2
endif endif

View File

@ -1,6 +1,6 @@
# Base config file for Pandora FMS Windows Agent # Base config file for Pandora FMS Windows Agent
# (c) 2006-2014 Artica Soluciones Tecnologicas # (c) 2006-2014 Artica Soluciones Tecnologicas
# Version 7.0NG.713 # Version 7.0NG.716
# This program is Free Software, you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public Licence as published by the Free Software

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.713} {Pandora FMS Windows Agent v7.0NG.716}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{171018} {171129}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -248,7 +248,9 @@ Pandora_Module::parseModuleKindFromString (string kind) {
} else if (kind == module_inventory_str) { } else if (kind == module_inventory_str) {
return MODULE_INVENTORY; return MODULE_INVENTORY;
} else if (kind == module_logevent_str) { } 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) { } else if (kind == module_wmiquery_str) {
return MODULE_WMIQUERY; return MODULE_WMIQUERY;
} else if (kind == module_perfcounter_str) { } else if (kind == module_perfcounter_str) {

View File

@ -86,6 +86,7 @@ namespace Pandora_Modules {
MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of
* freememory in the system */ * freememory in the system */
MODULE_LOGEVENT, /**< The module checks for log events */ 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_WMIQUERY, /**< The module runs WQL queries */
MODULE_PERFCOUNTER, /**< The module reads performance counters */ MODULE_PERFCOUNTER, /**< The module reads performance counters */
MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */ 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_cpuusage_str = "module_cpuusage";
const string module_inventory_str = "module_inventory"; const string module_inventory_str = "module_inventory";
const string module_logevent_str = "module_logevent"; const string module_logevent_str = "module_logevent";
const string module_logchannel_str = "module_logchannel";
const string module_wmiquery_str = "module_wmiquery"; const string module_wmiquery_str = "module_wmiquery";
const string module_perfcounter_str = "module_perfcounter"; const string module_perfcounter_str = "module_perfcounter";
const string module_tcpcheck_str = "module_tcpcheck"; const string module_tcpcheck_str = "module_tcpcheck";

View File

@ -31,6 +31,7 @@
#include "pandora_module_cpuusage.h" #include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h" #include "pandora_module_inventory.h"
#include "pandora_module_logevent.h" #include "pandora_module_logevent.h"
#include "pandora_module_logchannel.h"
#include "pandora_module_wmiquery.h" #include "pandora_module_wmiquery.h"
#include "pandora_module_perfcounter.h" #include "pandora_module_perfcounter.h"
#include "pandora_module_tcpcheck.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_MIN_FF_EVENT ("module_min_ff_event ")
#define TOKEN_DESCRIPTION ("module_description ") #define TOKEN_DESCRIPTION ("module_description ")
#define TOKEN_LOGEVENT ("module_logevent") #define TOKEN_LOGEVENT ("module_logevent")
#define TOKEN_LOGCHANNEL ("module_logchannel")
#define TOKEN_SOURCE ("module_source ") #define TOKEN_SOURCE ("module_source ")
#define TOKEN_EVENTTYPE ("module_eventtype ") #define TOKEN_EVENTTYPE ("module_eventtype ")
#define TOKEN_EVENTCODE ("module_eventcode ") #define TOKEN_EVENTCODE ("module_eventcode ")
@ -121,6 +123,7 @@ using namespace Pandora_Strutils;
#define TOKEN_MACRO ("module_macro") #define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_NATIVE_ENCODING ("module_native_encoding")
#define TOKEN_ALERT_TEMPLATE ("module_alert_template") #define TOKEN_ALERT_TEMPLATE ("module_alert_template")
#define TOKEN_USER_SESSION ("module_user_session ")
string string
parseLine (string line, string token) { parseLine (string line, string token) {
@ -157,8 +160,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_freedisk_percent, module_freememory_percent; string module_freedisk_percent, module_freememory_percent;
string module_dsn, module_freememory; string module_dsn, module_freememory;
string module_logevent, module_source, module_eventtype, module_eventcode; string module_logevent, module_source, module_eventtype, module_eventcode;
string module_logchannel;
string module_pattern, module_application, module_async; 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_wmiquery, module_wmicolumn;
string module_retries, module_startdelay, module_retrydelay; string module_retries, module_startdelay, module_retrydelay;
string module_perfcounter, module_tcpcheck; string module_perfcounter, module_tcpcheck;
@ -195,6 +199,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_proc = ""; module_proc = "";
module_service = ""; module_service = "";
module_logevent = ""; module_logevent = "";
module_logchannel = "";
module_source = ""; module_source = "";
module_eventtype = ""; module_eventtype = "";
module_eventcode = ""; module_eventcode = "";
@ -253,6 +258,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_ff_interval = ""; module_ff_interval = "";
module_native_encoding = ""; module_native_encoding = "";
module_alert_template = ""; module_alert_template = "";
module_user_session = "";
macro = ""; macro = "";
stringtok (tokens, definition, "\n"); stringtok (tokens, definition, "\n");
@ -342,6 +348,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_logevent == "") { if (module_logevent == "") {
module_logevent = parseLine (line, TOKEN_LOGEVENT); module_logevent = parseLine (line, TOKEN_LOGEVENT);
} }
if (module_logchannel == "") {
module_logchannel = parseLine (line, TOKEN_LOGCHANNEL);
}
if (module_source == "") { if (module_source == "") {
module_source = parseLine (line, TOKEN_SOURCE); module_source = parseLine (line, TOKEN_SOURCE);
} }
@ -507,6 +516,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_alert_template == "") { if (module_alert_template == "") {
module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE); module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE);
module_alert_template.erase (0,1); module_alert_template.erase (0,1);
}
if (module_user_session == "") {
module_user_session = parseLine (line, TOKEN_USER_SESSION);
} }
if (macro == "") { 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 != "") { if (module_source != "") {
pos_macro = module_source.find(macro_name); pos_macro = module_source.find(macro_name);
if (pos_macro != string::npos){ 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); 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->setRetries (atoi(module_retries.c_str ()));
module_proc->setStartDelay (atoi(module_startdelay.c_str ())); module_proc->setStartDelay (atoi(module_startdelay.c_str ()));
module_proc->setRetryDelay (atoi(module_retrydelay.c_str ())); module_proc->setRetryDelay (atoi(module_retrydelay.c_str ()));
module_proc->setUserSession (is_enabled(module_user_session));
} }
} }
} else if (module_service != "") { } else if (module_service != "") {
@ -1142,7 +1170,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
try { try {
char buffer[100]; char buffer[100];
unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent); 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_freedisk_percent.c_str(), memory) > 0) {
module->setDescription(buffer); module->setDescription(buffer);
} }
@ -1173,6 +1201,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_eventcode, module_eventcode,
module_pattern, module_pattern,
module_application); 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 != "") { } else if (module_wmiquery != "") {
module = new Pandora_Module_WMIQuery (module_name, module = new Pandora_Module_WMIQuery (module_name,
module_wmiquery, module_wmicolumn); module_wmiquery, module_wmicolumn);

View File

@ -30,12 +30,13 @@
#include "pandora_module_cpuusage.h" #include "pandora_module_cpuusage.h"
#include "pandora_module_inventory.h" #include "pandora_module_inventory.h"
#include "pandora_module_logevent.h" #include "pandora_module_logevent.h"
#include "pandora_module_logchannel.h"
#include "pandora_module_wmiquery.h" #include "pandora_module_wmiquery.h"
#include "pandora_module_perfcounter.h" #include "pandora_module_perfcounter.h"
#include "pandora_module_tcpcheck.h" #include "pandora_module_tcpcheck.h"
#include "pandora_module_regexp.h" #include "pandora_module_regexp.h"
#include "pandora_module_plugin.h" #include "pandora_module_plugin.h"
#include "pandora_module_ping.h" #include "pandora_module_ping.h"
#include "pandora_module_snmpget.h" #include "pandora_module_snmpget.h"
#include <fstream> #include <fstream>
@ -226,12 +227,13 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
Pandora_Module_Freememory *module_freememory; Pandora_Module_Freememory *module_freememory;
Pandora_Module_Freememory_Percent *module_freememory_percent; Pandora_Module_Freememory_Percent *module_freememory_percent;
Pandora_Module_Logevent *module_logevent; Pandora_Module_Logevent *module_logevent;
Pandora_Module_Logchannel *module_logchannel;
Pandora_Module_WMIQuery *module_wmiquery; Pandora_Module_WMIQuery *module_wmiquery;
Pandora_Module_Perfcounter *module_perfcounter; Pandora_Module_Perfcounter *module_perfcounter;
Pandora_Module_Tcpcheck *module_tcpcheck; Pandora_Module_Tcpcheck *module_tcpcheck;
Pandora_Module_Regexp *module_regexp; Pandora_Module_Regexp *module_regexp;
Pandora_Module_Plugin *module_plugin; Pandora_Module_Plugin *module_plugin;
Pandora_Module_Ping *module_ping; Pandora_Module_Ping *module_ping;
Pandora_Module_SNMPGet *module_snmpget; Pandora_Module_SNMPGet *module_snmpget;
module = Pandora_Module_Factory::getModuleFromDefinition (definition); module = Pandora_Module_Factory::getModuleFromDefinition (definition);
@ -288,6 +290,10 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
module_logevent = (Pandora_Module_Logevent *) module; module_logevent = (Pandora_Module_Logevent *) module;
modules->push_back (module_logevent); modules->push_back (module_logevent);
break; break;
case MODULE_LOGCHANNEL:
module_logchannel = (Pandora_Module_Logchannel *) module;
modules->push_back (module_logchannel);
break;
case MODULE_WMIQUERY: case MODULE_WMIQUERY:
module_wmiquery = (Pandora_Module_WMIQuery *) module; module_wmiquery = (Pandora_Module_WMIQuery *) module;
modules->push_back (module_wmiquery); modules->push_back (module_wmiquery);
@ -315,7 +321,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition)
case MODULE_SNMPGET: case MODULE_SNMPGET:
module_snmpget = (Pandora_Module_SNMPGet *) module; module_snmpget = (Pandora_Module_SNMPGet *) module;
modules->push_back (module_snmpget); modules->push_back (module_snmpget);
break; break;
default: default:
break; break;
} }

View File

@ -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 <string>
#include <sstream>
#include <iostream>
#include <time.h>
#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<wstring> query;
vector<wstring>::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<LogChannelList> event_list;
list<LogChannelList>::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<LogChannelList> &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;
}

View File

@ -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<LogChannelList> &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

View File

@ -48,6 +48,7 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name)
this->setKind (module_proc_str); this->setKind (module_proc_str);
this->watchdog = false; this->watchdog = false;
this->user_session = false;
this->start_command = ""; this->start_command = "";
this->retries = 3; this->retries = 3;
this->start_delay = 5000; this->start_delay = 5000;
@ -95,6 +96,11 @@ Pandora_Module_Proc::getRetryDelay () const {
return this->retry_delay; return this->retry_delay;
} }
bool
Pandora_Module_Proc::getUserSession () const {
return this->user_session;
}
void void
Pandora_Module_Proc::setWatchdog (bool watchdog) { Pandora_Module_Proc::setWatchdog (bool watchdog) {
this->watchdog = watchdog; this->watchdog = watchdog;
@ -131,6 +137,11 @@ Pandora_Module_Proc::setRetryDelay (int mseconds) {
this->retry_delay = mseconds; this->retry_delay = mseconds;
} }
void
Pandora_Module_Proc::setUserSession (bool usession) {
this->user_session = usession;
}
void void
async_run (Pandora_Module_Proc *module) { async_run (Pandora_Module_Proc *module) {
HANDLE *processes = NULL; HANDLE *processes = NULL;
@ -156,7 +167,7 @@ async_run (Pandora_Module_Proc *module) {
} }
Sleep (module->getRetryDelay ()); Sleep (module->getRetryDelay ());
Pandora_Wmi::runProgram (module->getStartCommand ()); Pandora_Wmi::runProgram (module->getStartCommand (), NULL, module->getUserSession());
Sleep (module->getStartDelay ()); Sleep (module->getStartDelay ());
counter++; counter++;
continue; continue;

View File

@ -32,6 +32,7 @@ namespace Pandora_Modules {
string process_name; string process_name;
HANDLE thread; HANDLE thread;
bool watchdog; bool watchdog;
bool user_session;
string start_command; string start_command;
int retries; int retries;
int start_delay; int start_delay;
@ -46,12 +47,14 @@ namespace Pandora_Modules {
int getRetries () const; int getRetries () const;
int getStartDelay () const; int getStartDelay () const;
int getRetryDelay () const; int getRetryDelay () const;
bool getUserSession () const;
void setWatchdog (bool watchdog); void setWatchdog (bool watchdog);
void setStartCommand (string command); void setStartCommand (string command);
void setRetries (int retries); void setRetries (int retries);
void setStartDelay (int mseconds); void setStartDelay (int mseconds);
void setRetryDelay (int mseconds); void setRetryDelay (int mseconds);
void setUserSession (bool usession);
void run (); void run ();
}; };

View File

@ -124,7 +124,6 @@ async_run (Pandora_Module_Service *module) {
// If time out and polling, // If time out and polling,
// check the service status actively // check the service status actively
if (result == WAIT_TIMEOUT && polling) { if (result == WAIT_TIMEOUT && polling) {
pandoraLog("Timeout. Polling");
module->execute_async_service(prev_res, module, modules); module->execute_async_service(prev_res, module, modules);
} }
continue; continue;

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.713(Build 171018)") #define PANDORA_VERSION ("7.0NG.716(Build 171129)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.713(Build 171018))" VALUE "ProductVersion", "(7.0NG.716(Build 171129))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -369,16 +369,16 @@ Pandora_Wmi::getOSName () {
dhGetValue (L"%s", &name, quickfix, dhGetValue (L"%s", &name, quickfix,
L".Caption"); L".Caption");
if (name != NULL) { if (name != NULL) {
// Remove the (R) character. // Remove the (R) character.
for (int i = 0; i < strlen(name); i++) { for (int i = 0; i < strlen(name); i++) {
if ((unsigned char)name[i] == 0xAE) { if ((unsigned char)name[i] == 0xAE) {
name[i] = ' '; name[i] = ' ';
} }
} }
ret = name; ret = name;
dhFreeString (name); dhFreeString (name);
} }
} NEXT_THROW (quickfix); } NEXT_THROW (quickfix);
} catch (string errstr) { } catch (string errstr) {
@ -411,12 +411,12 @@ Pandora_Wmi::getOSVersion () {
L".CSDVersion"); L".CSDVersion");
if (version != NULL) { if (version != NULL) {
// Remove the (R) character. // Remove the (R) character.
for (int i = 0; i < strlen(version); i++) { for (int i = 0; i < strlen(version); i++) {
if ((unsigned char)version[i] == 0xAE) { if ((unsigned char)version[i] == 0xAE) {
version[i] = ' '; version[i] = ' ';
} }
} }
ret = version; ret = version;
dhFreeString (version); dhFreeString (version);
} }
@ -501,7 +501,7 @@ Pandora_Wmi::getSystemName () {
* @param flags Process creation flags * @param flags Process creation flags
*/ */
bool bool
Pandora_Wmi::runProgram (string command, DWORD flags) { Pandora_Wmi::runProgram (string command, DWORD flags, BOOL user_session) {
PROCESS_INFORMATION process_info; PROCESS_INFORMATION process_info;
STARTUPINFO startup_info; STARTUPINFO startup_info;
bool success; bool success;
@ -514,11 +514,75 @@ Pandora_Wmi::runProgram (string command, DWORD flags) {
startup_info.cb = sizeof (startup_info); startup_info.cb = sizeof (startup_info);
ZeroMemory (&process_info, sizeof (process_info)); ZeroMemory (&process_info, sizeof (process_info));
pandoraDebug ("Start process \"%s\".", command.c_str ()); if (user_session) {
cmd = strdup (command.c_str ()); DWORD sessionId = WTSGetActiveConsoleSessionId();
success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags, startup_info.cb = sizeof(STARTUPINFO);
NULL, NULL, &startup_info, &process_info); startup_info.hStdError = 0;
pandoraFree (cmd); 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) { if (success) {
pandoraDebug ("The process \"%s\" was started.", command.c_str ()); 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 (V_VT(&pvArray[i]) == VT_BSTR) {
if (i > 0) { if (i > 0) {
ret += " , "; ret += " , ";
} }
LPSTR szStringA; LPSTR szStringA;
ret += Pandora_Strutils::strUnicodeToAnsi( V_BSTR(&pvArray[i])); ret += Pandora_Strutils::strUnicodeToAnsi( V_BSTR(&pvArray[i]));
} }

View File

@ -53,7 +53,7 @@ namespace Pandora_Wmi {
string getOSBuild (); string getOSBuild ();
string getSystemName (); string getSystemName ();
string getSystemAddress (); 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 startService (string service_name);
bool stopService (string service_name); bool stopService (string service_name);
void runWMIQuery (string wmi_query, void runWMIQuery (string wmi_query,

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.713-171018 Version: 7.0NG.716-171129
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.713-171018" pandora_version="7.0NG.716-171129"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -546,9 +546,11 @@ ui_require_jquery_file('pandora');
}); });
$('#group_id').change(function(){ $('#group_id').change(function(){
var regx = /&group_id=\d*/g; if(location.href.indexOf("extensions/agents_modules") == -1){
var url = location.href.replace(regx, ""); var regx = /&group_id=\d*/g;
location.href = url+"&group_id="+$("#group_id").val(); var url = location.href.replace(regx, "");
location.href = url+"&group_id="+$("#group_id").val();
}
}); });
}); });

View File

@ -66,11 +66,14 @@ function mainAgentsModules() {
$modulegroup = get_parameter('modulegroup', 0); $modulegroup = get_parameter('modulegroup', 0);
$refr = get_parameter('refresh', 0); // By default 30 seconds $refr = get_parameter('refresh', 0); // By default 30 seconds
$recursion = get_parameter('recursion', 0);
$group_id = (int)get_parameter('group_id', 0); $group_id = (int)get_parameter('group_id', 0);
$offset = (int)get_parameter('offset', 0); $offset = (int)get_parameter('offset', 0);
$hor_offset = (int)get_parameter('hor_offset', 0); $hor_offset = (int)get_parameter('hor_offset', 0);
$block = $config['block_size']; $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'); $selection_a_m = (int)get_parameter('selection_agent_module');
$modules_selected = (array)get_parameter('module', 0); $modules_selected = (array)get_parameter('module', 0);
$update_item = (string)get_parameter('edit_item',''); $update_item = (string)get_parameter('edit_item','');
@ -139,6 +142,8 @@ function mainAgentsModules() {
$filter_groups_label = '<b>'.__('Group').'</b>'; $filter_groups_label = '<b>'.__('Group').'</b>';
$filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;'); $filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;');
$filter_recursion_label = '<b>'.__('Recursion').'</b>';
$filter_recursion = html_print_checkbox('recursion', 1, 0, true);
//groups module //groups module
$filter_module_groups_label = '<b>'.__('Module group').'</b>'; $filter_module_groups_label = '<b>'.__('Module group').'</b>';
$filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", $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){ if($config['pure'] != 1){
echo '<form method="post" action="' echo '<form method="post" action="'
. ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset,'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">'; . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">';
echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">'; echo '<table class="databox filters" cellpadding="0" cellspacing="0" border="0" style="width:100%;">';
echo "<tr>"; echo "<tr>";
echo "<td>" . $filter_groups_label . "</td>"; echo "<td>" . $filter_groups_label . "</td>";
echo "<td>" . $filter_groups . "</td>"; echo "<td>" . $filter_groups ."&nbsp;&nbsp;&nbsp;". $filter_recursion_label . $filter_recursion. "</td>";
echo "<td></td>"; echo "<td></td>";
echo "<td></td>"; echo "<td></td>";
echo "<td>" . $filter_module_groups_label . "</td>"; echo "<td>" . $filter_module_groups_label . "</td>";
@ -375,9 +380,14 @@ function mainAgentsModules() {
} }
if ($group_id > 0) { 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); $agents = agents_get_agents ($filter_groups);
$nagents = count($agents); $nagents = count($agents);
@ -675,12 +685,14 @@ $ignored_params['refresh']='';
} }
$("#group_id").change (function () { $("#group_id").change (function () {
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente", {"page" : "operation/agentes/ver_agente",
"get_agents_group_json" : 1, "get_agents_group_json" : 1,
"id_group" : this.value, "id_group" : this.value,
"privilege" : "AW", "privilege" : "AW",
"keys_prefix" : "_" "keys_prefix" : "_",
"recursion" : $('#checkbox-recursion').is(':checked')
}, },
function (data, status) { function (data, status) {
$("#id_agents2").html(''); $("#id_agents2").html('');
@ -699,7 +711,34 @@ $ignored_params['refresh']='';
"json" "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 = $("<option></option>")
.attr ("value", value["id_agente"])
.html (value["alias"]);
$("#id_agents").append (option);
$("#id_agents2").append (option);
});
},
"json"
);
});
$("#modulegroup").change (function () { $("#modulegroup").change (function () {
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente", {"page" : "operation/agentes/ver_agente",

View File

@ -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&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.',
`fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;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;

View File

@ -0,0 +1,24 @@
START TRANSACTION;
SET @st_oum708 = (SELECT IF(
(SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0,
"ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL",
"SELECT 1"
));
PREPARE pr_oum708 FROM @st_oum708;
EXECUTE pr_oum708;
DEALLOCATE PREPARE pr_oum708;
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
alter table tlayout_data add column element_group int(10) not null default 0;
alter table tlayout_data add column id_layout_linked_weight int(10) not null default 0;
ALTER TABLE tlayout_data ADD COLUMN show_on_top tinyint(1) default 0;
ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0;
COMMIT;

View File

@ -725,6 +725,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`module_free_text` TEXT, `module_free_text` TEXT,
`each_agent` tinyint(1) default 1, `each_agent` tinyint(1) default 1,
`historical_db` tinyint(1) UNSIGNED NOT NULL default 0, `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`) PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) 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&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket'; UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria&#x20;IMS&#x20;API&#x20;path\",\"Integria&#x20;IMS&#x20;API&#x20;pass\",\"Integria&#x20;IMS&#x20;user\",\"Integria&#x20;IMS&#x20;user&#x20;pass\",\"Ticket&#x20;title\",\"Ticket&#x20;group&#x20;ID\",\"Ticket&#x20;priority\",\"Email&#x20;copy\",\"Ticket&#x20;owner\",\"Ticket&#x20;description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very&#x20;Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria&#x20;IMS&#x20;Ticket';
UPDATE `talert_commands` SET `description` = 'This&#x20;alert&#x20;send&#x20;an&#x20;email&#x20;using&#x20;internal&#x20;Pandora&#x20;FMS&#x20;Server&#x20;SMTP&#x20;capabilities&#x20;&#40;defined&#x20;in&#x20;each&#x20;server,&#x20;using:&#x0d;&#x0a;_field1_&#x20;as&#x20;destination&#x20;email&#x20;address,&#x20;and&#x0d;&#x0a;_field2_&#x20;as&#x20;subject&#x20;for&#x20;message.&#x20;&#x0d;&#x0a;_field3_&#x20;as&#x20;text&#x20;of&#x20;message.&#x20;&#x0d;&#x0a;_field4_&#x20;as&#x20;content&#x20;type&#x20;&#40;text/plain&#x20;or&#x20;html/text&#41;.', `fields_descriptions` = '[\"Destination&#x20;address\",\"Subject\",\"Text\",\"Content&#x20;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` -- 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 ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000'); 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 ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 4); INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 9);
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager'; UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise'; 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', '716');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tplanned_downtime_agents` -- 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 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 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 autorefresh_white_list text not null default '';
ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagente_modulo` -- 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 `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 COLUMN (alias varchar(600) not null default '');
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0'; 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; UPDATE tagente SET tagente.alias = tagente.nombre;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1231,6 +1240,9 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF';
ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; ALTER TABLE tlayout_data ADD `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 `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 `show_statistics` tinyint(2) NOT NULL default '0';
ALTER TABLE tlayout_data ADD COLUMN `element_group` int(10) NOT NULL default '0';
ALTER TABLE tlayout_data ADD COLUMN `id_layout_linked_weight` int(10) NOT NULL default '0';
ALTER TABLE tlayout_data ADD COLUMN `show_on_top` tinyint(1) NOT NULL default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tagent_custom_fields` -- Table `tagent_custom_fields`
@ -1248,6 +1260,8 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
-- Table `tgraph` -- Table `tgraph`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0'; ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tnetflow_filter` -- Table `tnetflow_filter`
@ -1269,6 +1283,9 @@ UPDATE treport_custom_sql SET `sql` = 'select&#x20;t1.alias&#x20;as&#x20;agent_n
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; 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` -- Table `tmodule_relationship`
@ -1295,6 +1312,7 @@ ALTER TABLE tmetaconsole_agent ADD COLUMN `cascade_protection_module` int(10) de
ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT NULL default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT ''; ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0'; ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.nombre; UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.nombre;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1326,6 +1344,10 @@ SET @vv1 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema =
IF @vv1>0 THEN IF @vv1>0 THEN
ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT ""; ALTER TABLE tbackup ADD COLUMN `filepath` varchar(512) NOT NULL DEFAULT "";
END IF; END IF;
SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled');
IF @vv2>0 THEN
ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL;
END IF;
END; END;
// //
delimiter ; delimiter ;
@ -1440,3 +1462,7 @@ INSERT INTO tmodule VALUES (8, 'Wux module');
INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'); INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');
-- ---------------------------------------------------------------------
-- Table `tdashboard`
-- ---------------------------------------------------------------------
ALTER TABLE `tdashboard` ADD COLUMN `cells_slideshow` TINYINT(1) NOT NULL default 0;

View File

@ -191,7 +191,7 @@ config_check();
$_GET['refr'] = null; $_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']); $autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
@ -261,7 +261,13 @@ config_check();
if ($check_minor_release_available) { if ($check_minor_release_available) {
if (users_is_admin($config['id_user'])) { 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. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29">'.__('Sobre actualización de revisión menor').'</a>', 'Revisión/es menor/es disponible/s');
}
else{
set_pandora_error_for_header('There are one or more minor releases waiting for update. <a style="font-size:8pt;font-style:italic;" target="blank" href="http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29">'.__('About minor release update').'</a>', 'minor release/s available');
}
} }
} }
echo '<div id="alert_messages" style="display: none"></div>'; echo '<div id="alert_messages" style="display: none"></div>';
@ -389,7 +395,15 @@ config_check();
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px'); $("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + "30"); <?php
if($select[0]['time_autorefresh']){
?>
var refresh = '<?php echo $select[0]["time_autorefresh"] ?>';
$(document).attr ("location", href + refresh);
<?php
}
?>
<?php <?php
} }
} }

View File

@ -252,25 +252,6 @@ foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name']; $modules_values[$m['id_module']] = $m['name'];
} }
$table->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'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[3][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($modules_values, "cascade_protection_module", $cascade_protection_module, "", "", 0, true);
$table->data[4][0] = __('Group'); $table->data[4][0] = __('Group');
$table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true); $table->data[4][1] = html_print_select_groups(false, "AR", false, 'grupo', $grupo, '', '', 0, true);
$table->data[4][1] .= ' <span id="group_preview">'; $table->data[4][1] .= ' <span id="group_preview">';
@ -320,52 +301,87 @@ $table->class = "databox filters";
$table->head = array (); $table->head = array ();
$table->style = array (); $table->style = array ();
$table->style[0] = 'font-weight: bold; '; $table->style[0] = 'font-weight: bold; ';
$table->style[2] = 'font-weight: bold;'; $table->style[4] = 'font-weight: bold;';
$table->data = array (); $table->data = array ();
// Custom ID // Custom ID
$table->data[0][0] = __('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[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'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
$table->data[1][1] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . 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] .= "&nbsp;&nbsp;" . __('Module') . "&nbsp;" . html_print_select ($safe_mode_modules, "safe_mode_module", $safe_mode_module, "", "", 0, true);
}
// Learn mode / Normal mode // Learn mode / Normal mode
$table->data[1][0] = __('Module definition') . $table->data[3][0] = __('Module definition') .
ui_print_help_icon("module_definition", true); 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();', html_print_radio_button_extended ("modo", 1, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true); '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();', html_print_radio_button_extended ("modo", 0, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true); '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();', html_print_radio_button_extended ("modo", 2, '', $modo, false, 'show_modules_not_learning_mode_context_help();',
'style="margin-right: 40px;"', true); 'style="margin-right: 40px;"', true);
// Status (Disabled / Enabled) // Status (Disabled / Enabled)
$table->data[2][0] = __('Status'); $table->data[4][0] = __('Status');
$table->data[2][1] = __('Disabled') . ' ' . $table->data[4][1] = __('Disabled') . ' ' .
html_print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true); 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); html_print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
// Remote configuration // Remote configuration
$table->data[3][0] = __('Remote configuration'); $table->data[5][0] = __('Remote configuration');
if (!$new_agent) { if (!$new_agent) {
$table->data[3][1] = '<em>' . __('Not available') . '</em>'; $table->data[5][1] = '<em>' . __('Not available') . '</em>';
if (isset($filename)) { if (isset($filename)) {
if (file_exists ($filename['md5'])) { 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 // Delete remote configuration
$table->data[3][1] .= '<a href="index.php?' . $table->data[5][1] .= '<a href="index.php?' .
'sec=gagente&amp;' . 'sec=gagente&amp;' .
'sec2=godmode/agentes/configurar_agente&amp;' . 'sec2=godmode/agentes/configurar_agente&amp;' .
'tab=main&amp;' . 'tab=main&amp;' .
'disk_conf_delete=1&amp;' . 'disk_conf_delete=1&amp;' .
'id_agente=' . $id_agente . '">'; 'id_agente=' . $id_agente . '">';
$table->data[3][1] .= html_print_image( $table->data[5][1] .= html_print_image(
"images/cross.png", true, "images/cross.png", true,
array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).'</a>'; array ('title' => __('Delete remote configuration file'), 'style' => 'vertical-align: middle;')).'</a>';
$table->data[3][1] .= '</a>' . $table->data[5][1] .= '</a>' .
ui_print_help_tip( ui_print_help_tip(
__('Delete this conf file implies that for restore you must reactive remote config in the local agent.'), __('Delete this conf file implies that for restore you must reactive remote config in the local agent.'),
true); true);
@ -373,7 +389,7 @@ if (!$new_agent) {
} }
} }
else else
$table->data[3][1] = '<em>' . __('Not available') . '</em>'; $table->data[5][1] = '<em>' . __('Not available') . '</em>';
$listIcons = gis_get_array_list_icons(); $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.";")); array("id" => "icon_warning", "style" => "display:".$display_icons.";"));
if ($config['activate_gis']) { if ($config['activate_gis']) {
$table->data[1][2] = __('Ignore new GIS data:'); $table->data[3][2] = __('Ignore new GIS data:');
$table->data[1][3] = __('Yes') . ' ' . $table->data[3][3] = __('Yes') . ' ' .
html_print_radio_button_extended ("update_gis_data", 0, '', html_print_radio_button_extended ("update_gis_data", 0, '',
$update_gis_data, false, '', 'style="margin-right: 40px;"', true); $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, '', html_print_radio_button_extended ("update_gis_data", 1, '',
$update_gis_data, false, '', 'style="margin-right: 40px;"', true); $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
} }
$table->data[2][2] = __('Url address'); $table->data[4][2] = __('Url address');
$table->data[2][3] = html_print_input_text ('url_description', $table->data[4][3] = html_print_input_text ('url_description',
$url_description, '', 45, 255, true); $url_description, '', 45, 255, true);
$table->data[3][2] = __('Quiet'); $table->data[5][2] = __('Quiet');
$table->data[3][3] = ui_print_help_tip( $table->data[5][3] = ui_print_help_tip(
__('The agent still runs but the alerts and events will be stop'), true); __('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')); ui_toggle(html_print_table ($table, true), __('Advanced options'));
unset($table); unset($table);
@ -582,6 +598,26 @@ ui_require_jquery_file('bgiframe');
$("#cascade_protection_module").attr("disabled", 'disabled'); $("#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( paint_qrcode(
"<?php "<?php

View File

@ -35,12 +35,12 @@ $use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public'); $snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1'); $snmp_version = get_parameter('snmp_version', '1');
$server_to_exec = get_parameter('server_to_exec', 0); $server_to_exec = get_parameter('server_to_exec', 0);
$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_security_level = get_parameter('snmp3_security_level');
$snmp3_auth_method = get_parameter('snmp3_auth_method'); $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_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'));
$tcp_port = (string) get_parameter ('tcp_port'); $tcp_port = (string) get_parameter ('tcp_port');
//See if id_agente is set (either POST or GET, otherwise -1 //See if id_agente is set (either POST or GET, otherwise -1

View File

@ -32,12 +32,12 @@ $use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public'); $snmp_community = (string) get_parameter ('snmp_community', 'public');
$server_to_exec = get_parameter('server_to_exec', 0); $server_to_exec = get_parameter('server_to_exec', 0);
$snmp_version = get_parameter('snmp_version', '1'); $snmp_version = get_parameter('snmp_version', '1');
$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_security_level = get_parameter('snmp3_security_level');
$snmp3_auth_method = get_parameter('snmp3_auth_method'); $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_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'));
$tcp_port = (string) get_parameter ('tcp_port'); $tcp_port = (string) get_parameter ('tcp_port');
//See if id_agente is set (either POST or GET, otherwise -1 //See if id_agente is set (either POST or GET, otherwise -1
@ -542,7 +542,7 @@ if (!empty($interfaces_list)) {
$table->data[0][1] = ''; $table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>'; $table->data[0][2] = '<b>'.__('Modules').'</b>';
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:200px;'); $table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
$table->data[1][1] = html_print_image('images/darrowright.png', true); $table->data[1][1] = html_print_image('images/darrowright.png', true);
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;'); $table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true); $table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);

View File

@ -135,6 +135,8 @@ $id_os = 9; // Windows
$custom_id = ""; $custom_id = "";
$cascade_protection = 0; $cascade_protection = 0;
$cascade_protection_modules = 0; $cascade_protection_modules = 0;
$safe_mode = 0;
$safe_mode_module = 0;
$icon_path = ''; $icon_path = '';
$update_gis_data = 0; $update_gis_data = 0;
$unit = ""; $unit = "";
@ -166,6 +168,8 @@ if ($create_agent) {
$custom_id = (string) get_parameter_post ("custom_id",''); $custom_id = (string) get_parameter_post ("custom_id",'');
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
$cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0); $cascade_protection_module = (int) get_parameter_post("cascade_protection_module", 0);
$safe_mode = (int) get_parameter_post ("safe_mode", 0);
$safe_mode_module = (int) get_parameter_post ("safe_mode_module", 0);
$icon_path = (string) get_parameter_post ("icon_path",''); $icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0); $update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$url_description = (string) get_parameter("url_description"); $url_description = (string) get_parameter("url_description");
@ -707,6 +711,7 @@ if ($update_agent) { // if modified some agent paramenter
$custom_id = (string) get_parameter_post ("custom_id", ""); $custom_id = (string) get_parameter_post ("custom_id", "");
$cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $cascade_protection = (int) get_parameter_post ("cascade_protection", 0);
$cascade_protection_module = (int) get_parameter ("cascade_protection_module", 0); $cascade_protection_module = (int) get_parameter ("cascade_protection_module", 0);
$safe_mode_module = (int) get_parameter ("safe_mode_module", 0);
$icon_path = (string) get_parameter_post ("icon_path",''); $icon_path = (string) get_parameter_post ("icon_path",'');
$update_gis_data = (int) get_parameter_post("update_gis_data", 0); $update_gis_data = (int) get_parameter_post("update_gis_data", 0);
$url_description = (string) get_parameter("url_description"); $url_description = (string) get_parameter("url_description");
@ -782,7 +787,8 @@ if ($update_agent) { // if modified some agent paramenter
'update_gis_data' => $update_gis_data, 'update_gis_data' => $update_gis_data,
'url_address' => $url_description, 'url_address' => $url_description,
'url_address' => $url_description, 'url_address' => $url_description,
'quiet' => $quiet); 'quiet' => $quiet,
'safe_mode_module' => $safe_mode_module);
if ($config['metaconsole_agent_cache'] == 1) { if ($config['metaconsole_agent_cache'] == 1) {
$values['update_module_count'] = 1; // Force an update of the agent cache. $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"]; $update_gis_data = $agent["update_gis_data"];
$url_description = $agent["url_address"]; $url_description = $agent["url_address"];
$quiet = $agent["quiet"]; $quiet = $agent["quiet"];
$safe_mode_module = $agent["safe_mode_module"];
$safe_mode = ($safe_mode_module) ? 1 : 0;
} }
$update_module = (bool) get_parameter ('update_module'); $update_module = (bool) get_parameter ('update_module');

View File

@ -181,7 +181,7 @@ $order_collation = "";
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$order_collation = ""; $order_collation = "";
//$order_collation = "COLLATE utf8_general_ci"; $order_collation = "COLLATE utf8_general_ci";
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
@ -201,13 +201,13 @@ switch ($sortField) {
switch ($sort) { switch ($sort) {
case 'up': case 'up':
$selectRemoteUp = $selected; $selectRemoteUp = $selected;
$order = array('field' => 'remote ' . $order_collation, $order = array('field' => 'remote ',
'field2' => 'nombre ' . $order_collation, 'field2' => 'nombre ' . $order_collation,
'order' => 'ASC'); 'order' => 'ASC');
break; break;
case 'down': case 'down':
$selectRemoteDown = $selected; $selectRemoteDown = $selected;
$order = array('field' => 'remote ' . $order_collation, $order = array('field' => 'remote ',
'field2' => 'nombre ' . $order_collation, 'field2' => 'nombre ' . $order_collation,
'order' => 'DESC'); 'order' => 'DESC');
break; break;
@ -540,10 +540,6 @@ if ($agents !== false) {
} }
echo '<span class="left">'; echo '<span class="left">';
echo "<strong>"; echo "<strong>";
if ($agent['quiet']) {
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
echo "&nbsp;";
}
if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
$main_tab = 'main'; $main_tab = 'main';
@ -562,8 +558,10 @@ if ($agents !== false) {
"</a>"; "</a>";
echo "</strong>"; echo "</strong>";
$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 ($agent["disabled"]) {
ui_print_help_tip(__('Disabled')); ui_print_help_tip(__('Disabled'));
@ -571,6 +569,11 @@ if ($agents !== false) {
echo "</em>"; echo "</em>";
} }
} }
if ($agent['quiet']) {
echo "&nbsp;";
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
}
if ($in_planned_downtime) { if ($in_planned_downtime) {
ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png'); ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png');

View File

@ -45,10 +45,10 @@ echo "<tr><td class='datos' style='width:20%; font-weight: bold;'>";
echo __('Search') . ' ' . echo __('Search') . ' ' .
html_print_input_text ('search_string', $search_string, '', 15, 255, true); html_print_input_text ('search_string', $search_string, '', 15, 255, true);
echo "</td>"; echo "</td>";
echo "<td class='datos' style='width:20%'>"; echo "<td class='datos' style='width:10%'>";
html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"'); html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"');
echo "</td>"; echo "</td>";
echo "<td class='datos' style='width:20%'></td>"; echo "<td class='datos' style='width:10%'></td>";
echo '</form>'; echo '</form>';
// Check if there is at least one server of each type available to assign that // 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 // 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 // Create module/type combo
echo '<form id="create_module_type" method="post" action="'.$url.'">'; echo '<form id="create_module_type" method="post" action="'.$url.'">';
if (!$policy_page) { if (!$policy_page) {
echo '<td class="datos" style="font-weight: bold;">'; echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __('Show in hierachy mode'); echo __('Show in hierachy mode');
if ($checked == "true") { if ($checked == "true") {
$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();"); html_print_checkbox ('status_hierachy_mode', "", $checked, false, false, "onChange=change_mod_filter();");
echo '</td>'; echo '</td>';
} }
echo '<td class="datos" style="font-weight: bold;">'; echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __("Type"); echo __("Type");
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' ); html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
html_print_input_hidden ('edit_module', 1); html_print_input_hidden ('edit_module', 1);
echo '</td>'; echo '</td>';
echo '<td class="datos">'; echo '<td class="datos" style="width:10%;">';
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">'; echo '<input align="right" name="updbutton" type="submit" class="sub next" value="'.__('Create').'">';
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';

View File

@ -111,12 +111,12 @@ if (is_ajax ()) {
else else
$snmp_community = (string) get_parameter ('snmp_community'); $snmp_community = (string) get_parameter ('snmp_community');
$snmp_version = get_parameter('snmp_version'); $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_security_level = get_parameter('snmp3_security_level');
$snmp3_auth_method = get_parameter('snmp3_auth_method'); $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_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'); $snmp_port = get_parameter('snmp_port');
$snmpwalk = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmpwalk = get_snmpwalk($ip_target, $snmp_version, $snmp_community,

View File

@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>'; $table_simple->data[4][1] .= '<br /><em>'.__('Inverse interval').'</em>';
$table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy); $table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy);
if (!modules_is_string_type($id_module_type) || $edit) { if (!modules_is_string_type($id_module_type) || $edit) {
$table_simple->data[4][2] = '<svg id="svg_dinamic" width="350" height="200" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"> </svg>'; $table_simple->data[4][2] = '<svg id="svg_dinamic" width="350px" height="200px" style="padding:40px; padding-left: 100px; margin-bottom: 60px;"></svg>';
$table_simple->colspan[4][2] = 2; $table_simple->colspan[4][2] = 2;
$table_simple->rowspan[4][2] = 3; $table_simple->rowspan[4][2] = 3;
} }
@ -590,8 +590,7 @@ $table_advanced->colspan[10][1] = 6;
if (isset($id_agente) && $moduletype == MODULE_DATA) { if (isset($id_agente) && $moduletype == MODULE_DATA) {
$has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"])); $has_remote_conf = enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]));
if ($has_remote_conf) { if ($has_remote_conf) {
$table_advanced->data[11][0] = __('Cron from') . $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6; $table_advanced->colspan[11][1] = 6;
@ -600,8 +599,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
$table_advanced->colspan[12][1] = 6; $table_advanced->colspan[12][1] = 6;
} }
else { else {
$table_advanced->data[11][0] = __('Cron from') . $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, true);
$table_advanced->colspan[11][1] = 6; $table_advanced->colspan[11][1] = 6;
@ -611,8 +609,7 @@ if (isset($id_agente) && $moduletype == MODULE_DATA) {
} }
} }
else { else {
$table_advanced->data[11][0] = __('Cron from') . $table_advanced->data[11][0] = __('Cron from') . ui_print_help_icon ('cron', true);
ui_print_help_tip (__('If cron is set the module interval is ignored and the module runs on the specified date and time'), true);
$table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy); $table_advanced->data[11][1] = html_print_extended_select_for_cron ($hour_from, $minute_from, $mday_from, $month_from, $wday_from, true, $disabledBecauseInPolicy);
$table_advanced->colspan[11][1] = 6; $table_advanced->colspan[11][1] = 6;
@ -1323,8 +1320,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_normal") .attr("id", "legend_normal")
.attr("x", 72) .attr("x", 72)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#82B92E"); .style("fill", "#82B92E");
//legend Warning text //legend Warning text
@ -1343,8 +1340,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_warning") .attr("id", "legend_warning")
.attr("x", 168) .attr("x", 168)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#ffd731"); .style("fill", "#ffd731");
//legend Critical text //legend Critical text
@ -1363,8 +1360,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "legend_critical") .attr("id", "legend_critical")
.attr("x", 258) .attr("x", 258)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#fc4444"); .style("fill", "#fc4444");
//styles for number and axes //styles for number and axes
@ -1382,8 +1379,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
.attr("id", "warning_rect") .attr("id", "warning_rect")
.attr("x", 3) .attr("x", 3)
.attr("y", 0) .attr("y", 0)
.attr("width", 300) .attr("width", '300px')
.attr("height", 200) .attr("height", '200px')
.style("fill", "#82B92E"); .style("fill", "#82B92E");
//controls the inverse warning //controls the inverse warning

View File

@ -398,12 +398,12 @@ function snmpBrowserWindow () {
$('#text-target_ip').val($('#text-ip_target').val()); $('#text-target_ip').val($('#text-ip_target').val());
$('#text-community').val($('#text-snmp_community').val()); $('#text-community').val($('#text-snmp_community').val());
$('#snmp_browser_version').val($('#snmp_version').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_security_level').val($('#snmp3_security_level').val());
$('#snmp3_browser_auth_method').val($('#snmp3_auth_method').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_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 ({ $("#snmp_browser_container").show().dialog ({
title: '', title: '',

View File

@ -165,8 +165,26 @@ if (is_ajax ()) {
$rfield = $editor_type_chkbx; $rfield = $editor_type_chkbx;
$rfield .= html_print_textarea ('field'.$i.'_recovery_value', 1, 1, '', 'class="fields_recovery"', true); $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 = "<div style=\"padding: 4px 0px;\"><b><small>";
$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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
$editor_type_chkbx .= __('Text/html') . "&nbsp;&nbsp;";
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', true);
$editor_type_chkbx .= "</small></b></div>";
$ffield = $editor_type_chkbx;
$editor_type_chkbx = "<div style=\"padding: 4px 0px;\"><b><small>";
$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 .= "&nbsp;&nbsp;&nbsp;&nbsp;";
$editor_type_chkbx .= __('Text/html') . "&nbsp;&nbsp;";
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
$editor_type_chkbx .= "</small></b></div>";
$rfield = $editor_type_chkbx;
// Select type // Select type
else { }else {
$fields_value_select = array(); $fields_value_select = array();
$fv = explode(';', $field_value); $fv = explode(';', $field_value);

View File

@ -305,8 +305,33 @@ $(document).ready (function () {
// Replace the old column with the new // Replace the old column with the new
$table_macros_field.replaceWith(field_row); $table_macros_field.replaceWith(field_row);
if (old_value != '' || old_recovery_value != '') { if (old_value != '' || old_recovery_value != '') {
$("[name=field" + i + "_value]").val(old_value); var inputType = $("[name=field" + i + "_value]").attr('type')
$("[name=field" + i + "_recovery_value]").val(old_recovery_value); 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 { else {
$("[name=field" + i + "_value]") $("[name=field" + i + "_value]")

View File

@ -600,7 +600,7 @@ $(document).ready (function () {
var params = { var params = {
"page" : "operation/agentes/ver_agente", "page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1, "get_agent_modules_json" : 1,
"get_id_and_name" : 1, "get_distinct_name" : 1,
"indexed" : 0, "indexed" : 0,
"privilege" : "AW" "privilege" : "AW"
}; };

View File

@ -503,6 +503,10 @@ $table->data['edit3'][2] = __('SMNP community');
$table->data['edit3'][3] = html_print_input_text ('snmp_community', '', $table->data['edit3'][3] = html_print_input_text ('snmp_community', '',
'', 10, 100, true); '', 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 = array();
$target_ip_values['auto'] = __('Auto'); $target_ip_values['auto'] = __('Auto');
$target_ip_values['force_pri'] = __('Force primary key'); $target_ip_values['force_pri'] = __('Force primary key');
@ -736,12 +740,13 @@ $(document).ready (function () {
"tr#delete_table-edit11, " + "tr#delete_table-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "tr#delete_table-edit13, " +
"tr#delete_table-edit14").hide (); "tr#delete_table-edit14, " +
"tr#delete_table-edit15").hide ();
var params = { var params = {
"page" : "operation/agentes/ver_agente", "page" : "operation/agentes/ver_agente",
"get_agent_modules_json" : 1, "get_agent_modules_json" : 1,
"get_id_and_name" : 1, "get_distinct_name" : 1,
"indexed" : 0 "indexed" : 0
}; };
@ -800,7 +805,8 @@ $(document).ready (function () {
"tr#delete_table-edit11, " + "tr#delete_table-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "tr#delete_table-edit13, " +
"tr#delete_table-edit14").show (); "tr#delete_table-edit14, " +
"tr#delete_table-edit15").show ();
} }
function clean_lists() { function clean_lists() {
@ -829,7 +835,8 @@ $(document).ready (function () {
"tr#delete_table-edit11, " + "tr#delete_table-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "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('checked', false);
$('input[type=checkbox]').attr('disabled', true); $('input[type=checkbox]').attr('disabled', true);
@ -877,7 +884,8 @@ $(document).ready (function () {
"tr#delete_table-edit11, " + "tr#delete_table-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "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-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "tr#delete_table-edit13, " +
"tr#delete_table-edit14").show (); "tr#delete_table-edit14, " +
"tr#delete_table-edit15").show ();
} }
else { else {
$(".select_agents_row_2").css('display', ''); $(".select_agents_row_2").css('display', '');
@ -942,7 +951,8 @@ $(document).ready (function () {
"tr#delete_table-edit11, " + "tr#delete_table-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "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-edit11, " +
"tr#delete_table-edit12, " + "tr#delete_table-edit12, " +
"tr#delete_table-edit13, " + "tr#delete_table-edit13, " +
"tr#delete_table-edit14").hide (); "tr#delete_table-edit14, " +
"tr#delete_table-edit15").hide ();
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "operation/agentes/ver_agente", {"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 */ /* List of fields which can be updated */
$fields = array ('dynamic_interval', 'dynamic_max', 'dynamic_min', 'dynamic_two_tailed', 'min_warning', 'max_warning', 'str_warning', $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', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event',
'module_interval', 'disabled', 'post_process', 'unit_select', 'module_interval', 'disabled', 'post_process', 'unit',
'snmp_community', 'tcp_send', 'custom_string_1', 'snmp_community','snmp_oid','tcp_send', 'custom_string_1',
'plugin_parameter', 'custom_string_2', 'custom_string_3', 'min', 'plugin_parameter', 'custom_string_2', 'custom_string_3', 'min',
'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'max', 'id_module_group', 'plugin_user', 'plugin_pass',
'id_export', 'history_data', 'critical_inverse', 'id_export', 'history_data', 'critical_inverse',

View File

@ -129,7 +129,7 @@ else {
} }
$snmp_version = (string) get_parameter('snmp_version'); $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_pass = io_input_password((string) get_parameter('snmp3_auth_pass'));
$snmp3_auth_method = (string) get_parameter('snmp3_auth_method'); $snmp3_auth_method = (string) get_parameter('snmp3_auth_method');
$snmp3_privacy_method = (string) get_parameter('snmp3_privacy_method'); $snmp3_privacy_method = (string) get_parameter('snmp3_privacy_method');

View File

@ -473,8 +473,8 @@ $next_row++;
.attr("id", "legend_normal") .attr("id", "legend_normal")
.attr("x", 72) .attr("x", 72)
.attr("y", -30) .attr("y", -30)
.attr("width", 10) .attr("width", '10px')
.attr("height", 10) .attr("height", '10px')
.style("fill", "#82B92E"); .style("fill", "#82B92E");
//legend Warning text //legend Warning text

View File

@ -46,6 +46,9 @@ $delete_layout = (bool) get_parameter ('delete_layout');
$refr = (int) get_parameter('refr', $config['vc_refr']); $refr = (int) get_parameter('refr', $config['vc_refr']);
$offset = (int) get_parameter('offset', 0); $offset = (int) get_parameter('offset', 0);
$pagination = (int) get_parameter ("pagination", $config["block_size"]); $pagination = (int) get_parameter ("pagination", $config["block_size"]);
$search = (string) get_parameter("search","");
$ag_group = (int)get_parameter("ag_group",0);
$recursion = get_parameter("recursion",0);
if ($delete_layout || $copy_layout) { if ($delete_layout || $copy_layout) {
// Visual console required // Visual console required
@ -199,6 +202,50 @@ if ($delete_layout || $copy_layout) {
} }
} }
if ($ag_group > 0) {
$ag_groups = array();
$ag_groups = (array)$ag_group;
if ($recursion) {
$ag_groups = groups_get_id_recursive($ag_group, true);
}
}
echo "<table class='databox filters' width='100%' style='font-weight: bold; margin-bottom: 10px;'>
<tr>";
if(!is_metaconsole()){
echo "<form method='post'
action='index.php?sec=network&amp;sec2=godmode/reporting/map_builder'>";
} else {
echo "<form method='post'
action='index.php?sec=screen&sec2=screens/screens&action=visualmap'>";
}
echo "<td style='width:33%;'>";
echo __('Search') . '&nbsp;';
html_print_input_text ("search", $search, '', 50);
echo "</td>";
echo "<td style='width:25%;'>";
echo __('Group') . '&nbsp;';
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl ($config['id_user'], 0, "AW"))
$return_all_group = false;
else
$return_all_group = true;
html_print_select_groups(false, "AR", $return_all_group, "ag_group", $ag_group, 'this.form.submit();', '', 0, false, false, true, '', false);
echo "<td style='width:25%;'>";
echo __('Group Recursion') . '&nbsp;';
html_print_checkbox ("recursion", 1, $recursion, false, false, 'this.form.submit()');
echo "</td><td style='width:22%;'>";
echo "<input name='search_visual_console' type='submit' class='sub search' value='".__('Search')."'>";
echo "</form>";
echo "</td>";
echo "</tr></table>";
$table = new stdClass(); $table = new stdClass();
$table->width = '100%'; $table->width = '100%';
$table->class = 'databox data'; $table->class = 'databox data';
@ -228,31 +275,69 @@ $table->align[4] = 'left';
// or has "VR" privileges, otherwise show only maps of user group // or has "VR" privileges, otherwise show only maps of user group
$filters['offset'] = $offset; $filters['offset'] = $offset;
$filters['limit'] = $pagination; $filters['limit'] = $pagination;
if(!empty($search)){
$filters['name'] = io_safe_input($search);
}
if($ag_group){
$filters['group'] = array_flip($ag_groups);
}
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
$url = 'index.php?sec=network&amp;sec2=godmode/reporting/map_builder&pagination='.$pagination; $url = 'index.php?sec=network&amp;sec2=godmode/reporting/map_builder&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
} }
else { else {
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pagination='.$pagination; $url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&recursion='.$recursion.'&ag_group='.$ag_group.'&search='.$search.'&pagination='.$pagination;
} }
if ($own_info['is_admin'] || $vconsoles_read) { if ($own_info['is_admin'] || $vconsoles_read) {
$maps = visual_map_get_user_layouts (0,false,$filters); if($ag_group){
$total_maps = count(visual_map_get_user_layouts()); $maps = visual_map_get_user_layouts (0,false,$filters,false);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts(0,false,$filters,false));
}else{
$maps = visual_map_get_user_layouts (0,false,$filters);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts(0,false,$filters));
}
} }
else { else {
$maps = visual_map_get_user_layouts ($config['id_user'], false, $maps = visual_map_get_user_layouts ($config['id_user'], false,
$filters, false); $filters, false);
unset($filters['offset']);
unset($filters['limit']);
$total_maps = count(visual_map_get_user_layouts ($config['id_user'], false, $total_maps = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false)); $filters, false));
} }
if (!$maps && !is_metaconsole()) { if (!$maps && !is_metaconsole()) {
require_once ($config['homedir'] . "/general/firts_task/map_builder.php"); $total = count(visual_map_get_user_layouts ($config['id_user'], false,
false, false));
if(!$total){
require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
} else {
ui_print_info_message(
array(
'no_close'=>false,
'message'=> __('No available data to show')));
}
} }
elseif (!$maps && is_metaconsole()) { elseif (!$maps && is_metaconsole()) {
ui_print_info_message( $total = count(visual_map_get_user_layouts ($config['id_user'], false,
array( false, false));
'no_close'=>true, if(!$total){
'message'=> __('There are no visual console defined yet.'))); ui_print_info_message(
array(
'no_close'=>true,
'message'=> __('There are no visual console defined yet.')));
}else{
ui_print_info_message(
array(
'no_close'=>false,
'message'=> __('No available data to show')));
}
} }
else { else {
ui_pagination ($total_maps, $url, $offset, $pagination); ui_pagination ($total_maps, $url, $offset, $pagination);

View File

@ -112,6 +112,10 @@ $netflow_filter = 0;
$max_values = 0; $max_values = 0;
$resolution = 0; $resolution = 0;
$lapse_calc = 0;
$lapse = 300;
$visual_format = 0;
//Others //Others
$filter_search = ""; $filter_search = "";
@ -148,6 +152,7 @@ switch ($action) {
case 'network_interfaces_report': case 'network_interfaces_report':
case 'availability': case 'availability':
case 'event_report_log': case 'event_report_log':
case 'increment':
case 'availability_graph': case 'availability_graph':
case 'agent_module': case 'agent_module':
$get_data_editor = true; $get_data_editor = true;
@ -195,12 +200,6 @@ switch ($action) {
$name = $item['name']; $name = $item['name'];
switch ($type) { 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': case 'event_report_log':
$period = $item['period']; $period = $item['period'];
$description = $item['description']; $description = $item['description'];
@ -282,6 +281,13 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
break; 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': case 'SLA_services':
$description = $item['description']; $description = $item['description'];
$period = $item['period']; $period = $item['period'];
@ -312,6 +318,9 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
$period = $item['period']; $period = $item['period'];
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
break; break;
case 'max_value': case 'max_value':
$description = $item['description']; $description = $item['description'];
@ -319,6 +328,9 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
$period = $item['period']; $period = $item['period'];
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
break; break;
case 'min_value': case 'min_value':
$description = $item['description']; $description = $item['description'];
@ -326,6 +338,9 @@ switch ($action) {
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
$period = $item['period']; $period = $item['period'];
$lapse = $item['lapse'];
$lapse_calc = $item['lapse_calc'];
$visual_format = $item['visual_format'];
break; break;
case 'sumatory': case 'sumatory':
$description = $item['description']; $description = $item['description'];
@ -593,6 +608,7 @@ switch ($action) {
case 'MTTR': case 'MTTR':
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'event_report_log': case 'event_report_log':
case 'increment':
$label = (isset($style['label'])) ? $style['label'] : ''; $label = (isset($style['label'])) ? $style['label'] : '';
break; break;
default: 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")) elseif(check_acl ($config['id_user'], 0, "RM"))
html_print_select_groups($config['id_user'], html_print_select_groups($config['id_user'],
"RM", true, 'combo_group', $group, ''); "RM", true, 'combo_group', $group, '');
echo "&nbsp;&nbsp;&nbsp;".__('Recursion').html_print_checkbox('recursion', 1, 0, true);
?> ?>
</td> </td>
</tr> </tr>
@ -1577,6 +1596,78 @@ You can of course remove the warnings, that's why we include the source and do n
?> ?>
</td> </td>
</tr> </tr>
<!-- advanced elements -->
<!-- <tr id="advanced_expansion">
<td colspan="2" style="cursor:pointer;" onclick="if($('.advanced_elements').css('display') == 'none'){$('.advanced_elements').css('display','table-row');}else{$('.advanced_elements').css('display','none');}">
+ ADVANCED
</td>
</tr> -->
<tr id="row_lapse_calc" style="" class="datos advanced_elements">
<td style="font-weight:bold;">
<?php echo __('Calculate for custom intervals'); ?>
</td>
<td style="">
<?php
html_print_checkbox('lapse_calc',1,$lapse_calc);?>
</td>
</tr>
<tr id="row_lapse" style="" class="datos advanced_elements">
<td style="font-weight:bold;">
<?php
echo __('Time lapse intervals');
ui_print_help_tip(__('Lapses of time in which the period is divided to make more precise calculations
'));
?>
</td>
<td style="">
<?php
html_print_extended_select_for_time('lapse', $lapse,
'', '', '0', 10,'','','','',!$lapse_calc);
?>
</td>
</tr>
<tr id="row_visual_format" style="" class="datos advanced_elements">
<td style="font-weight:bold;" colspan="2">
<?php
if($visual_format == 1){
$visual_format_table = true;
$visual_format_graph = false;
$visual_format_both = false;
}
elseif ($visual_format == 2) {
$visual_format_table = false;
$visual_format_graph = true;
$visual_format_both = false;
}
elseif ($visual_format == 3) {
$visual_format_table = false;
$visual_format_graph = false;
$visual_format_both = true;
}
echo __('Table only').'<span style="margin-left:10px;"></span>';
html_print_radio_button ('visual_format', 1, '', $visual_format_table,'',!$lapse_calc);
echo ('<span style="margin:30px;"></span>');
echo __('Graph only').'<span style="margin-left:10px;"></span>';
html_print_radio_button ('visual_format', 2, '', $visual_format_graph,'',!$lapse_calc);
echo ('<span style="margin:30px;"></span>');
echo __('Graph and table').'<span style="margin-left:10px;"></span>';
html_print_radio_button ('visual_format', 3, '', $visual_format_both,'',!$lapse_calc);
?>
</td>
</tr>
</tbody> </tbody>
</table> </table>
@ -2001,7 +2092,38 @@ $(document).ready (function () {
"get_agents_group_json" : 1, "get_agents_group_json" : 1,
"id_group" : this.value, "id_group" : this.value,
"privilege" : "AW", "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 = $("<option></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) { function (data, status) {
$("#id_agents").html(''); $("#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() { function create_custom_graph() {
@ -2658,6 +2793,9 @@ function chooseType() {
$("#row_show_in_two_columns").hide(); $("#row_show_in_two_columns").hide();
$("#row_show_in_same_row").hide(); $("#row_show_in_same_row").hide();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
$("#row_lapse_calc").hide();
$("#row_lapse").hide();
$("#row_visual_format").hide();
$("#row_show_in_landscape").hide(); $("#row_show_in_landscape").hide();
$('#row_hide_notinit_agents').hide(); $('#row_hide_notinit_agents').hide();
$("#row_module_group").hide(); $("#row_module_group").hide();
@ -2729,6 +2867,13 @@ function chooseType() {
$("#row_source").show(); $("#row_source").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
case 'increment':
$("#row_description").show();
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
break;
case 'simple_graph': case 'simple_graph':
$("#row_time_compare_overlapped").show(); $("#row_time_compare_overlapped").show();
@ -2850,6 +2995,9 @@ function chooseType() {
$("#row_module").show(); $("#row_module").show();
$("#row_period").show(); $("#row_period").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_lapse_calc").show();
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
@ -2859,6 +3007,9 @@ function chooseType() {
$("#row_module").show(); $("#row_module").show();
$("#row_period").show(); $("#row_period").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_lapse_calc").show();
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
@ -2868,6 +3019,9 @@ function chooseType() {
$("#row_module").show(); $("#row_module").show();
$("#row_period").show(); $("#row_period").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_lapse_calc").show();
$("#row_lapse").show();
$("#row_visual_format").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;

View File

@ -1,3 +1,37 @@
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").prop("checked")) {
$(".check_delete").prop("checked", true);
$('.check_delete').each(function(){
$('.massive_report_form_elements').prop("disabled", false);
});
}
else {
$(".check_delete").prop("checked", false);
$('.check_delete').each(function(){
$('.massive_report_form_elements').prop("disabled", true);
});
}
}
$( document ).ready(function() {
$('.check_delete').click(function(){
$('.check_delete').each(function(){
if($(this).prop( "checked" )){
$('#hidden-id_report_'+$(this).val()).prop("disabled", false);
}
else{
$('#hidden-id_report_'+$(this).val()).prop("disabled", true);
}
});
});
});
</script>
<?php <?php
// Pandora FMS - http://pandorafms.com // Pandora FMS - http://pandorafms.com
// ================================================== // ==================================================
@ -564,7 +598,8 @@ switch ($action) {
$next++; $next++;
if(!defined('METACONSOLE')) if(!defined('METACONSOLE'))
$table->head[$next] = '<span title="Operations">' . $table->head[$next] = '<span title="Operations">' .
__('Op.') . '</span>'; __('Op.') . '</span>'.html_print_checkbox('all_delete', 0, false, true, false,
'check_all_checkboxes();');
//$table->size = array (); //$table->size = array ();
$table->size[$next] = '10%'; $table->size[$next] = '10%';
@ -703,9 +738,13 @@ switch ($action) {
$data[$next] .= '<form method="post" style="display:inline;" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">'; $data[$next] .= '<form method="post" style="display:inline;" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $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_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'))); true, array ('title' => __('Delete')));
$data[$next] .= html_print_checkbox_extended ('massive_report_check', $report['id_report'], false, false, '', 'class="check_delete"', true);
$data[$next] .= '</form>'; $data[$next] .= '</form>';
} }
} }
@ -733,8 +772,19 @@ switch ($action) {
else else
echo '<div class="action-buttons" style="width: 100%;">'; echo '<div class="action-buttons" style="width: 100%;">';
html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>";
echo "</form>"; echo "</form>";
echo '<form style="display:inline;" id="massive_report_form" method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=delete">';
foreach ($reports as $report) {
echo '<input class="massive_report_form_elements" id="hidden-id_report_'.$report['id_report'].'" name="id_report[]" type="hidden" disabled value="'.$report['id_report'].'">';
}
echo '<input id="hidden-action" name="action" type="hidden" value="delete_report">';
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete" style="margin-left:5px;"');
echo '</form>';
echo "</div>";
} }
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
@ -1019,6 +1069,15 @@ switch ($action) {
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$good_format = true; $good_format = true;
break; 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: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
@ -1354,6 +1413,15 @@ switch ($action) {
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$good_format = true; $good_format = true;
break; 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: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
@ -2059,3 +2127,4 @@ switch ($activeTab) {
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>

View File

@ -201,7 +201,23 @@ echo "</form>";
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
var metaconsole = null;
function is_metaconsole() {
if (metaconsole === null)
metaconsole = $("input[name='metaconsole']").val();
if (metaconsole != 0)
return true;
else
return false;
}
var url_hack_metaconsole = '';
if (is_metaconsole()) {
url_hack_metaconsole = '../../';
}
$("#modsize").click(function(event){ $("#modsize").click(function(event){
event.preventDefault(); event.preventDefault();
@ -260,7 +276,7 @@ $(document).ready (function () {
} }
else{ else{
original_image=new Image(); original_image=new Image();
original_image.src='images/console/background/'+$('#background').val(); original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val();
if (parseInt(original_image.width) < 1024){ if (parseInt(original_image.width) < 1024){
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px'); alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
$('input[name=width]').val('1024'); $('input[name=width]').val('1024');
@ -310,7 +326,7 @@ $(document).ready (function () {
var size_changer_state = false; var size_changer_state = false;
$("#background").change(function() { $("#background").change(function() {
$('#imagen2').attr('src','images/console/background/'+$('#background').val()); $('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('#imagen2').width(230); $('#imagen2').width(230);
$('#imagen2').show(); $('#imagen2').show();
}); });
@ -323,7 +339,7 @@ $(document).ready (function () {
$("#background").mouseout(function() { $("#background").mouseout(function() {
if(size_changer_state){ if(size_changer_state){
$('#imagen').attr('src','images/console/background/'+$('#background').val()); $('#imagen').attr('src',url_hack_metaconsole + 'images/console/background/'+$('#background').val());
$('input[name=width]').val($('#imagen').width()); $('input[name=width]').val($('#imagen').width());
$('input[name=height]').val($('#imagen').height()); $('input[name=height]').val($('#imagen').height());
$('#preimagew').html($('#imagen').width()); $('#preimagew').html($('#imagen').width());

View File

@ -180,6 +180,7 @@ ui_require_javascript_file ('encode_decode_base64');
tinyMCE.init({ tinyMCE.init({
mode : "exact", mode : "exact",
elements: "text-label", elements: "text-label",
convert_urls: false,
theme : "advanced", theme : "advanced",
<?php <?php
if ($config['style'] == 'pandora_legacy') { if ($config['style'] == 'pandora_legacy') {
@ -196,11 +197,18 @@ ui_require_javascript_file ('encode_decode_base64');
"10pt=.visual_font_size_10pt, " + "10pt=.visual_font_size_10pt, " +
"12pt=.visual_font_size_12pt, " + "12pt=.visual_font_size_12pt, " +
"14pt=.visual_font_size_14pt, " + "14pt=.visual_font_size_14pt, " +
"18pt=.visual_font_size_18pt, " +
"24pt=.visual_font_size_24pt, " + "24pt=.visual_font_size_24pt, " +
"28pt=.visual_font_size_28pt, " +
"36pt=.visual_font_size_36pt, " + "36pt=.visual_font_size_36pt, " +
"48pt=.visual_font_size_48pt, " +
"60pt=.visual_font_size_60pt, " +
"72pt=.visual_font_size_72pt, " + "72pt=.visual_font_size_72pt, " +
"84pt=.visual_font_size_84pt, " +
"96pt=.visual_font_size_96pt, " + "96pt=.visual_font_size_96pt, " +
"116pt=.visual_font_size_116pt, " +
"128pt=.visual_font_size_128pt, " + "128pt=.visual_font_size_128pt, " +
"140pt=.visual_font_size_140pt, " +
"154pt=.visual_font_size_154pt, " + "154pt=.visual_font_size_154pt, " +
"196pt=.visual_font_size_196pt", "196pt=.visual_font_size_196pt",
theme_advanced_toolbar_location : "top", theme_advanced_toolbar_location : "top",

View File

@ -602,11 +602,18 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
"10pt=.visual_font_size_10pt, " + "10pt=.visual_font_size_10pt, " +
"12pt=.visual_font_size_12pt, " + "12pt=.visual_font_size_12pt, " +
"14pt=.visual_font_size_14pt, " + "14pt=.visual_font_size_14pt, " +
"18pt=.visual_font_size_18pt, " +
"24pt=.visual_font_size_24pt, " + "24pt=.visual_font_size_24pt, " +
"28pt=.visual_font_size_28pt, " +
"36pt=.visual_font_size_36pt, " + "36pt=.visual_font_size_36pt, " +
"48pt=.visual_font_size_48pt, " +
"60pt=.visual_font_size_60pt, " +
"72pt=.visual_font_size_72pt, " + "72pt=.visual_font_size_72pt, " +
"84pt=.visual_font_size_84pt, " +
"96pt=.visual_font_size_96pt, " + "96pt=.visual_font_size_96pt, " +
"116pt=.visual_font_size_116pt, " +
"128pt=.visual_font_size_128pt, " + "128pt=.visual_font_size_128pt, " +
"140pt=.visual_font_size_140pt, " +
"154pt=.visual_font_size_154pt, " + "154pt=.visual_font_size_154pt, " +
"196pt=.visual_font_size_196pt", "196pt=.visual_font_size_196pt",
theme_advanced_toolbar_location : "top", theme_advanced_toolbar_location : "top",

View File

@ -205,11 +205,7 @@ switch ($activeTab) {
// If the background is changed the size is reseted // If the background is changed the size is reseted
$background_now = $visualConsole['background']; $background_now = $visualConsole['background'];
/*if ($background_now != $background && $background) {
$sizeBackground = getimagesize($config['homedir'] . '/images/console/background/' . $background);
$values['width'] = $sizeBackground[0];
$values['height'] = $sizeBackground[1];
}*/
$values['width'] = $width; $values['width'] = $width;
$values['height'] = $height; $values['height'] = $height;
switch ($action) { switch ($action) {
@ -237,33 +233,31 @@ switch ($activeTab) {
break; break;
case 'save': case 'save':
if (!defined('METACONSOLE')) { if ($values['name'] != "" && $values['background'])
if ($values['name'] != "" && $values['background']) $idVisualConsole = db_process_sql_insert('tlayout', $values);
$idVisualConsole = db_process_sql_insert('tlayout', $values); else
else $idVisualConsole = false;
$idVisualConsole = false;
if ($idVisualConsole !== false) {
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole");
$action = 'edit';
$statusProcessInDB = array('flag' => true,
'message' => ui_print_success_message(__('Successfully created.'), '', true));
if ($idVisualConsole !== false) { // Return the updated visual console
db_pandora_audit( "Visual console builder", "Create visual console #$idVisualConsole"); $visualConsole = db_get_row_filter('tlayout',
$action = 'edit'; array('id' => $idVisualConsole));
$statusProcessInDB = array('flag' => true, // Update the ACL
'message' => ui_print_success_message(__('Successfully created.'), '', true)); //$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
// Return the updated visual console $vconsole_manage = $vconsole_manage_new;
$visualConsole = db_get_row_filter('tlayout',
array('id' => $idVisualConsole));
// Update the ACL
//$vconsole_read = $vconsole_read_new;
$vconsole_write = $vconsole_write_new;
$vconsole_manage = $vconsole_manage_new;
}
else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true));
}
} }
break; else {
db_pandora_audit( "Visual console builder", "Fail try to create visual console");
$statusProcessInDB = array('flag' => false,
'message' => ui_print_error_message(__('Could not be created.'), '', true));
}
break;
} }
break; break;
@ -419,6 +413,8 @@ switch ($activeTab) {
$value_show = get_parameter ("value_show", 'percent'); $value_show = get_parameter ("value_show", 'percent');
$label_type = get_parameter ("label_type", 'agent_module'); $label_type = get_parameter ("label_type", 'agent_module');
$enable_link = get_parameter ("enable_link", 'enable_link'); $enable_link = get_parameter ("enable_link", 'enable_link');
$show_on_top = get_parameter ("show_on_top", 0);
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent // This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
$item_per_agent = get_parameter ("item_per_agent", 0); $item_per_agent = get_parameter ("item_per_agent", 0);
$id_server = (int)get_parameter('servers', 0); $id_server = (int)get_parameter('servers', 0);

View File

@ -144,7 +144,7 @@ $table->data["staticgraph_modulegraph"][1] .= '&nbsp;&nbsp;&nbsp;' .
'leaguegothic' => 'League Gothic' 'leaguegothic' => 'League Gothic'
); );
$fonts = array('4pt' => '4pt','6pt' => '6pt','8pt' => '8pt','10pt' => '10pt','12pt' => '12pt','14pt' => '14pt','24pt' => '24pt','36pt' => '36pt','72pt' => '72pt','96pt' => '96pt','128pt' => '128pt','154pt' => '154pt','196pt' => '196pt'); $fonts = array('4pt' => '4pt','6pt' => '6pt','8pt' => '8pt','10pt' => '10pt','12pt' => '12pt','14pt' => '14pt','18pt' => '18pt','24pt' => '24pt','28pt' => '28pt','36pt' => '36pt','48pt' => '48pt','60pt' => '60pt','72pt' => '72pt','84pt' => '84pt','96pt' => '96pt','116pt' => '116pt','128pt' => '128pt','140pt' => '140pt','154pt' => '154pt','196pt' => '196pt');
/* /*
$fontf = array('andale mono,times' => 'Andale Mono', $fontf = array('andale mono,times' => 'Andale Mono',

View File

@ -106,6 +106,18 @@ if (is_ajax ()) {
$row['name'] = __('Login attribute'); $row['name'] = __('Login attribute');
$row['control'] = html_print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true); $row['control'] = html_print_input_text ('ldap_login_attr', $config['ldap_login_attr'], '', 60, 100, true);
$table->data['ldap_login_attr'] = $row; $table->data['ldap_login_attr'] = $row;
// Admin LDAP login
$row = array();
$row['name'] = __('Admin LDAP login');
$row['control'] = html_print_input_text ('ldap_admin_login', $config['ldap_admin_login'], '', 60, 100, true);
$table->data['ldap_admin_login'] = $row;
// Admin LDAP password
$row = array();
$row['name'] = __('Admin LDAP password');
$row['control'] = html_print_input_password ('ldap_admin_pass', $config['ldap_admin_pass'], $alt = '', 60, 100, true);
$table->data['ldap_admin_pass'] = $row;
break; break;
case 'pandora': case 'pandora':

View File

@ -313,7 +313,7 @@ foreach ($listIcons as $index => $value)
$table_gis->data[$row][0] = __('Default icon in GIS') . $table_gis->data[$row][0] = __('Default icon in GIS') .
ui_print_help_tip(__('Agent icon for GIS Maps. If set to "none", group icon will be used'), true); ui_print_help_tip(__('Agent icon for GIS Maps. If set to "none", group icon will be used'), true);
$table_gis->data[$row][1] = html_print_select($arraySelectIcon, $table_gis->data[$row][1] = html_print_select($arraySelectIcon,
"gis_default_icon", $config["gis_default_icon"], "", __('None'), "gis_default_icon", $config["gis_default_icon"], "", __('Agent icon group'),
'', true); '', true);
$table_gis->data[$row][1] .= "&nbsp;" . $table_gis->data[$row][1] .= "&nbsp;" .
html_print_button(__("View"), 'gis_icon_preview', false, '', '', true); html_print_button(__("View"), 'gis_icon_preview', false, '', '', true);
@ -934,6 +934,23 @@ tinyMCE.init({
}); });
$(document).ready (function () { $(document).ready (function () {
var comfort = 0;
if(comfort == 0){
$(':input,:radio,:checkbox,:file').change(function(){
$('#submit-update_button').css({'position':'fixed','right':'80px','bottom':'55px'});
var comfort = 1;
});
$("*").keydown(function(){
$('#submit-update_button').css({'position':'fixed','right':'80px','bottom':'55px'});
var comfort = 1;
});
$('#form_setup').after('<br>');
}
$("#form_setup #text-graph_color1").attachColorPicker(); $("#form_setup #text-graph_color1").attachColorPicker();
$("#form_setup #text-graph_color2").attachColorPicker(); $("#form_setup #text-graph_color2").attachColorPicker();
$("#form_setup #text-graph_color3").attachColorPicker(); $("#form_setup #text-graph_color3").attachColorPicker();

View File

@ -58,7 +58,14 @@ $baseurl = ui_get_full_url(false, false, false, false);
var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n"; var text1_mr_file = "<?php echo __('There are new database changes available to apply. Do you want to start the DB update process?'); ?>\n";
var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n"; var text2_mr_file = "<?php echo __('We recommend launching '); ?>\n";
var text3_mr_file = "<?php echo __('planned downtime'); ?>\n"; var text3_mr_file = "<?php echo __('planned downtime'); ?>\n";
var text4_mr_file = "<?php echo __(' to this process'); ?>\n"; var text4_mr_file = "<?php
if($config['language'] == 'es'){
echo __(' to this process').'<br><br><a style=\"font-size:10pt;font-style:italic;\" target=\"blank\" href=\"http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Actualizacion#Versi.C3.B3n_7.0NG_.28_Rolling_Release_.29\">'.__('About minor release update').'</a>';
}
else{
echo __(' to this process').'<br><br><a style=\"font-size:10pt;font-style:italic;\" target=\"blank\" href=\"http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Anexo_Upgrade#Version_7.0NG_.28_Rolling_Release_.29\">'.__('About minor release update').'</a>';
}
?>";
var text1_package_file = "<?php echo __('There is a new update available'); ?>\n"; var text1_package_file = "<?php echo __('There is a new update available'); ?>\n";
var text2_package_file = "<?php echo __('There is a new update available to apply. Do you want to start the update process?'); ?>\n"; var text2_package_file = "<?php echo __('There is a new update available to apply. Do you want to start the update process?'); ?>\n";
var applying_mr = "<?php echo __('Applying DB MR'); ?>\n"; var applying_mr = "<?php echo __('Applying DB MR'); ?>\n";

View File

@ -565,7 +565,7 @@ $values = array (
'Tactical view'=>__('Tactical view'), 'Tactical view'=>__('Tactical view'),
'Alert detail' => __('Alert detail'), 'Alert detail' => __('Alert detail'),
'Other'=>__('Other')); 'Other'=>__('Other'));
if (enterprise_installed()) { if (enterprise_installed() && !is_metaconsole()) {
$values['Dashboard'] = __('Dashboard'); $values['Dashboard'] = __('Dashboard');
} }
$table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false); $table->data[12][1] = html_print_select($values, 'section', io_safe_output($user_info["section"]), 'show_data_section();', '', -1, true, false, false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 700 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 695 B

After

Width:  |  Height:  |  Size: 1.3 KiB

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