diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 10b3bf4b4e..9d4896d2c1 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.714-171025 +Version: 7.0NG.714-171031 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 4217b2dd1e..8a9f5187f4 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.714-171025" +pandora_version="7.0NG.714-171031" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index d7bfa6bbca..8d48365a14 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.714'; -use constant AGENT_BUILD => '171025'; +use constant AGENT_BUILD => '171031'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; @@ -1579,6 +1579,9 @@ sub guess_os_version ($) { # AIX } elsif ($os eq 'aix') { $os_version = "$2.$1" if (`uname -rv` =~ /\s*(\d)\s+(\d)\s*/); + # Darwin + } elsif ($os eq 'darwin') { + $os_version = `defaults read loginwindow SystemVersionStampAsString`; # Windows } elsif ($os =~ /win/i) { $os_version = `ver`; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 54cc1ea457..a8e50d570d 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.714 -%define release 171025 +%define release 171031 Summary: Pandora FMS Linux agent, PERL version Name: %{name} @@ -24,7 +24,7 @@ Requires(preun): chkconfig /bin/rm /usr/sbin/userdel Requires: fileutils textutils unzip Requires: util-linux procps grep Requires: /sbin/ip /bin/awk -Requires: perl perl(Sys::Syslog) perl(IO::Socket::SSL) +Requires: perl perl(Sys::Syslog) # Required by plugins #Requires: sh-utils sed passwd net-tools rpm AutoReq: 0 diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 2f10142e0e..7c920391e9 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.714 -%define release 171025 +%define release 171031 Summary: Pandora FMS Linux agent, PERL version Name: %{name} @@ -67,6 +67,7 @@ then fi %post +mkdir -p /var/log/pandora chown pandora:root /var/log/pandora if [ ! -d /etc/pandora ] ; then mkdir -p /etc/pandora @@ -91,6 +92,9 @@ if [ ! -e /etc/pandora/collections ]; then fi cp -aRf /usr/share/pandora_agent/pandora_agent_logrotate /etc/logrotate.d/pandora_agent +# Enable the service on SystemD +systemctl enable pandora_agent_daemon.service + mkdir -p /var/spool/pandora/data_out chkconfig pandora_agent_daemon on diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 13d0edace0..2ea278fd66 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.714" -PI_BUILD="171025" +PI_BUILD="171031" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/plugins/route_parser b/pandora_agents/unix/plugins/route_parser new file mode 100644 index 0000000000..0c5c5c7fae Binary files /dev/null and b/pandora_agents/unix/plugins/route_parser differ diff --git a/pandora_agents/win32/Makefile.am b/pandora_agents/win32/Makefile.am index 6e47cafcc1..d41c722ced 100644 --- a/pandora_agents/win32/Makefile.am +++ b/pandora_agents/win32/Makefile.am @@ -3,7 +3,7 @@ if DEBUG PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc debug_new.cpp PandoraAgent_CXXFLAGS=-g -O0 else -PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc +PandoraAgent_SOURCES = misc/pandora_file.cc modules/pandora_data.cc modules/pandora_module_factory.cc modules/pandora_module.cc modules/pandora_module_list.cc modules/pandora_module_plugin.cc modules/pandora_module_inventory.cc modules/pandora_module_freememory.cc modules/pandora_module_exec.cc modules/pandora_module_perfcounter.cc modules/pandora_module_proc.cc modules/pandora_module_tcpcheck.cc modules/pandora_module_freememory_percent.cc modules/pandora_module_freedisk.cc modules/pandora_module_freedisk_percent.cc modules/pandora_module_logevent.cc modules/pandora_module_logchannel.cc modules/pandora_module_service.cc modules/pandora_module_cpuusage.cc modules/pandora_module_wmiquery.cc modules/pandora_module_regexp.cc modules/pandora_module_ping.cc modules/pandora_module_snmpget.cc udp_server/udp_server.cc main.cc pandora_strutils.cc pandora.cc windows_service.cc pandora_agent_conf.cc windows/pandora_windows_info.cc windows/pandora_wmi.cc pandora_windows_service.cc misc/md5.c misc/sha256.cc windows/wmi/disphelper.c ssh/libssh2/channel.c ssh/libssh2/mac.c ssh/libssh2/session.c ssh/libssh2/comp.c ssh/libssh2/misc.c ssh/libssh2/sftp.c ssh/libssh2/crypt.c ssh/libssh2/packet.c ssh/libssh2/userauth.c ssh/libssh2/hostkey.c ssh/libssh2/publickey.c ssh/libssh2/kex.c ssh/libssh2/scp.c ssh/pandora_ssh_client.cc ssh/pandora_ssh_test.cc ftp/pandora_ftp_client.cc ftp/pandora_ftp_test.cc PandoraAgent_CXXFLAGS=-O2 endif diff --git a/pandora_agents/win32/bin/util/mtr.exe b/pandora_agents/win32/bin/util/mtr.exe new file mode 100644 index 0000000000..3646ca89aa Binary files /dev/null and b/pandora_agents/win32/bin/util/mtr.exe differ diff --git a/pandora_agents/win32/bin/util/route_parser.exe b/pandora_agents/win32/bin/util/route_parser.exe new file mode 100644 index 0000000000..4da75a272a Binary files /dev/null and b/pandora_agents/win32/bin/util/route_parser.exe differ diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 898b87abad..3964a08708 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{171025} +{171031} ViewReadme {Yes} diff --git a/pandora_agents/win32/modules/pandora_module.cc b/pandora_agents/win32/modules/pandora_module.cc index 296f42f2ea..99b0d47f88 100644 --- a/pandora_agents/win32/modules/pandora_module.cc +++ b/pandora_agents/win32/modules/pandora_module.cc @@ -248,7 +248,9 @@ Pandora_Module::parseModuleKindFromString (string kind) { } else if (kind == module_inventory_str) { return MODULE_INVENTORY; } else if (kind == module_logevent_str) { - return MODULE_LOGEVENT; + return MODULE_LOGEVENT; + } else if (kind == module_logchannel_str) { + return MODULE_LOGCHANNEL; } else if (kind == module_wmiquery_str) { return MODULE_WMIQUERY; } else if (kind == module_perfcounter_str) { diff --git a/pandora_agents/win32/modules/pandora_module.h b/pandora_agents/win32/modules/pandora_module.h index b2606d2442..2fbeb52e41 100644 --- a/pandora_agents/win32/modules/pandora_module.h +++ b/pandora_agents/win32/modules/pandora_module.h @@ -86,6 +86,7 @@ namespace Pandora_Modules { MODULE_FREEMEMORY_PERCENT, /**< The module checks the amount of * freememory in the system */ MODULE_LOGEVENT, /**< The module checks for log events */ + MODULE_LOGCHANNEL, /**< The module checks for log events on channel using XML functions*/ MODULE_WMIQUERY, /**< The module runs WQL queries */ MODULE_PERFCOUNTER, /**< The module reads performance counters */ MODULE_TCPCHECK, /**< The module checks whether a tcp port is open */ @@ -126,6 +127,7 @@ namespace Pandora_Modules { const string module_cpuusage_str = "module_cpuusage"; const string module_inventory_str = "module_inventory"; const string module_logevent_str = "module_logevent"; + const string module_logchannel_str = "module_logchannel"; const string module_wmiquery_str = "module_wmiquery"; const string module_perfcounter_str = "module_perfcounter"; const string module_tcpcheck_str = "module_tcpcheck"; diff --git a/pandora_agents/win32/modules/pandora_module_factory.cc b/pandora_agents/win32/modules/pandora_module_factory.cc index db33c1315a..90c82d5457 100644 --- a/pandora_agents/win32/modules/pandora_module_factory.cc +++ b/pandora_agents/win32/modules/pandora_module_factory.cc @@ -31,6 +31,7 @@ #include "pandora_module_cpuusage.h" #include "pandora_module_inventory.h" #include "pandora_module_logevent.h" +#include "pandora_module_logchannel.h" #include "pandora_module_wmiquery.h" #include "pandora_module_perfcounter.h" #include "pandora_module_tcpcheck.h" @@ -69,6 +70,7 @@ using namespace Pandora_Strutils; #define TOKEN_MIN_FF_EVENT ("module_min_ff_event ") #define TOKEN_DESCRIPTION ("module_description ") #define TOKEN_LOGEVENT ("module_logevent") +#define TOKEN_LOGCHANNEL ("module_logchannel") #define TOKEN_SOURCE ("module_source ") #define TOKEN_EVENTTYPE ("module_eventtype ") #define TOKEN_EVENTCODE ("module_eventcode ") @@ -121,6 +123,7 @@ using namespace Pandora_Strutils; #define TOKEN_MACRO ("module_macro") #define TOKEN_NATIVE_ENCODING ("module_native_encoding") #define TOKEN_ALERT_TEMPLATE ("module_alert_template") +#define TOKEN_USER_SESSION ("module_user_session ") string parseLine (string line, string token) { @@ -157,8 +160,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { string module_freedisk_percent, module_freememory_percent; string module_dsn, module_freememory; string module_logevent, module_source, module_eventtype, module_eventcode; + string module_logchannel; string module_pattern, module_application, module_async; - string module_watchdog, module_start_command; + string module_watchdog, module_start_command, module_user_session; string module_wmiquery, module_wmicolumn; string module_retries, module_startdelay, module_retrydelay; string module_perfcounter, module_tcpcheck; @@ -195,6 +199,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_proc = ""; module_service = ""; module_logevent = ""; + module_logchannel = ""; module_source = ""; module_eventtype = ""; module_eventcode = ""; @@ -253,6 +258,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_ff_interval = ""; module_native_encoding = ""; module_alert_template = ""; + module_user_session = ""; macro = ""; stringtok (tokens, definition, "\n"); @@ -342,6 +348,9 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_logevent == "") { module_logevent = parseLine (line, TOKEN_LOGEVENT); } + if (module_logchannel == "") { + module_logchannel = parseLine (line, TOKEN_LOGCHANNEL); + } if (module_source == "") { module_source = parseLine (line, TOKEN_SOURCE); } @@ -507,6 +516,10 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { if (module_alert_template == "") { module_alert_template = parseLine (line, TOKEN_ALERT_TEMPLATE); module_alert_template.erase (0,1); + } + + if (module_user_session == "") { + module_user_session = parseLine (line, TOKEN_USER_SESSION); } if (macro == "") { @@ -724,6 +737,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { } } + if (module_logchannel != "") { + pos_macro = module_logchannel.find(macro_name); + if (pos_macro != string::npos){ + module_logchannel.replace(pos_macro, macro_name.size(), macro_value); + } + } + if (module_source != "") { pos_macro = module_source.find(macro_name); if (pos_macro != string::npos){ @@ -1085,6 +1105,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_alert_template.replace(pos_macro, macro_name.size(), macro_value); } } + + if (module_user_session != "") { + pos_macro = module_user_session.find(macro_name); + if (pos_macro != string::npos){ + module_user_session.replace(pos_macro, macro_name.size(), macro_value); + } + } } } } @@ -1121,6 +1148,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_proc->setRetries (atoi(module_retries.c_str ())); module_proc->setStartDelay (atoi(module_startdelay.c_str ())); module_proc->setRetryDelay (atoi(module_retrydelay.c_str ())); + module_proc->setUserSession (is_enabled(module_user_session)); } } } else if (module_service != "") { @@ -1142,7 +1170,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { try { char buffer[100]; unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent); - if (sprintf(buffer, "Free memory %s %dMB", + if (sprintf(buffer, "Free space on drive %s %dMB", module_freedisk_percent.c_str(), memory) > 0) { module->setDescription(buffer); } @@ -1173,6 +1201,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) { module_eventcode, module_pattern, module_application); + } + else if (module_logchannel != "") { + module = new Pandora_Module_Logchannel (module_name, + module_source, + module_eventtype, + module_eventcode, + module_pattern); } else if (module_wmiquery != "") { module = new Pandora_Module_WMIQuery (module_name, module_wmiquery, module_wmicolumn); diff --git a/pandora_agents/win32/modules/pandora_module_list.cc b/pandora_agents/win32/modules/pandora_module_list.cc index 516b2296c8..305ee901d7 100644 --- a/pandora_agents/win32/modules/pandora_module_list.cc +++ b/pandora_agents/win32/modules/pandora_module_list.cc @@ -30,12 +30,13 @@ #include "pandora_module_cpuusage.h" #include "pandora_module_inventory.h" #include "pandora_module_logevent.h" +#include "pandora_module_logchannel.h" #include "pandora_module_wmiquery.h" #include "pandora_module_perfcounter.h" #include "pandora_module_tcpcheck.h" #include "pandora_module_regexp.h" #include "pandora_module_plugin.h" -#include "pandora_module_ping.h" +#include "pandora_module_ping.h" #include "pandora_module_snmpget.h" #include @@ -226,12 +227,13 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) Pandora_Module_Freememory *module_freememory; Pandora_Module_Freememory_Percent *module_freememory_percent; Pandora_Module_Logevent *module_logevent; + Pandora_Module_Logchannel *module_logchannel; Pandora_Module_WMIQuery *module_wmiquery; Pandora_Module_Perfcounter *module_perfcounter; Pandora_Module_Tcpcheck *module_tcpcheck; Pandora_Module_Regexp *module_regexp; Pandora_Module_Plugin *module_plugin; - Pandora_Module_Ping *module_ping; + Pandora_Module_Ping *module_ping; Pandora_Module_SNMPGet *module_snmpget; module = Pandora_Module_Factory::getModuleFromDefinition (definition); @@ -288,6 +290,10 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) module_logevent = (Pandora_Module_Logevent *) module; modules->push_back (module_logevent); break; + case MODULE_LOGCHANNEL: + module_logchannel = (Pandora_Module_Logchannel *) module; + modules->push_back (module_logchannel); + break; case MODULE_WMIQUERY: module_wmiquery = (Pandora_Module_WMIQuery *) module; modules->push_back (module_wmiquery); @@ -315,7 +321,7 @@ Pandora_Modules::Pandora_Module_List::parseModuleDefinition (string definition) case MODULE_SNMPGET: module_snmpget = (Pandora_Module_SNMPGet *) module; modules->push_back (module_snmpget); - break; + break; default: break; } diff --git a/pandora_agents/win32/modules/pandora_module_logchannel.cc b/pandora_agents/win32/modules/pandora_module_logchannel.cc new file mode 100755 index 0000000000..2c7c056565 --- /dev/null +++ b/pandora_agents/win32/modules/pandora_module_logchannel.cc @@ -0,0 +1,582 @@ +/* Pandora logchannel module. This module checks for log events that match a given + pattern using XML functions provided by wevtapi. + + Copyright (C) 2017 Artica ST. + Written by Fermin Hernandez. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "pandora_module_logchannel.h" +#include "../windows/pandora_wmi.h" +#include "../pandora_windows_service.h" +#include "pandora_module_logchannel.h" +#include "pandora_strutils.h" + +using namespace Pandora; +using namespace Pandora_Modules; +using namespace Pandora_Strutils; + +// Pointers to Wevtapi.dll functions +static HINSTANCE WINEVENT = NULL; +static EvtQueryT EvtQueryF = NULL; +static EvtNextT EvtNextF = NULL; +static EvtSeekT EvtSeekF = NULL; +static EvtCreateRenderContextT EvtCreateRenderContextF = NULL; +static EvtRenderT EvtRenderF = NULL; +static EvtCloseT EvtCloseF = NULL; +static EvtFormatMessageT EvtFormatMessageF = NULL; +static EvtOpenPublisherMetadataT EvtOpenPublisherMetadataF = NULL; +static EvtCreateBookmarkT EvtCreateBookmarkF = NULL; +static EvtUpdateBookmarkT EvtUpdateBookmarkF = NULL; + +/** + * Creates a Pandora_Module_Logchannel object. + * + * @param name Module name. + * @param service_name Service internal name to check. + */ +Pandora_Module_Logchannel::Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern) + : Pandora_Module (name) { + int i; + vector query; + vector::iterator query_it; + string upper_type = type; + + // Convert the type string to uppercase + for (i = 0; i < type.length(); i++) { + upper_type[i] = toupper(type[i]); + } + + // Set the type filter + int type_number = -1; + if (upper_type.compare("ERROR") == 0) { + type_number = EVENTLOG_ERROR_TYPE; + } else if (upper_type.compare("WARNING") == 0) { + type_number = EVENTLOG_WARNING_TYPE; + } else if (upper_type.compare("INFORMATION") == 0) { + type_number = EVENTLOG_INFORMATION_TYPE; + } else if (upper_type.compare("AUDIT SUCCESS") == 0) { + type_number = EVENTLOG_AUDIT_SUCCESS; + } else if (upper_type.compare("AUDIT FAILURE") == 0) { + type_number = EVENTLOG_AUDIT_FAILURE; + } + // Append type to log query + if (type_number != -1) { + wstringstream ss; + ss << L"*[System[Level='" << type_number << L"']]"; + query.push_back(ss.str()); + } + + // Set the id + int id_number = strtoul (id.c_str (), NULL, 0); + if (id_number != 0) { + wstringstream ss; + ss << L"*[System[EventID='" << id_number << L"']]"; + query.push_back(ss.str()); + } + + // Fill the filter + if (query.size() == 0) { + this->filter = L"*"; + } else { + int i = 0; + // Add filters with and + wstring item_query; + while (query.size() > 1) { + item_query = query.back(); + query.pop_back(); + this->filter += item_query + L" and "; + } + // Append the last value without the and + item_query = query.back(); + this->filter += item_query; + } + + this->source = source; + this->pattern = pattern; + if (! pattern.empty ()) { + // Compile the regular expression + if (regcomp (&this->regexp, pattern.c_str (), REG_EXTENDED) != 0) { + pandoraLog ("Invalid regular expression %s", pattern.c_str ()); + } + } + this->bookmark_xml = L""; + this->setKind (module_logchannel_str); + + // Load Wevtapi.dll and some functions + if (WINEVENT == NULL) { + WINEVENT = LoadLibrary("Wevtapi.dll"); + if (WINEVENT == NULL) { + + // Log to the bedug log, since this is not an error + pandoraLog ("Library Wevtapi.dll not available"); + return; + } + + EvtQueryF = (EvtQueryT) GetProcAddress (WINEVENT, "EvtQuery"); + if (EvtQueryF == NULL) { + pandoraLog ("Error loading function EvtQuery from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtNextF = (EvtNextT) GetProcAddress (WINEVENT, "EvtNext"); + if (EvtNextF == NULL) { + pandoraLog ("Error loading function EvtNext from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtSeekF = (EvtSeekT) GetProcAddress (WINEVENT, "EvtSeek"); + if (EvtSeekF == NULL) { + pandoraLog ("Error loading function EvtSeek from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtCreateRenderContextF = (EvtCreateRenderContextT) GetProcAddress (WINEVENT, "EvtCreateRenderContext"); + if (EvtCreateRenderContextF == NULL) { + pandoraLog ("Error loading function EvtCreateRenderContext from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtRenderF = (EvtRenderT) GetProcAddress (WINEVENT, "EvtRender"); + if (EvtRenderF == NULL) { + pandoraLog ("Error loading function EvtRender from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtCloseF = (EvtCloseT) GetProcAddress (WINEVENT, "EvtClose"); + if (EvtCloseF == NULL) { + pandoraLog ("Error loading function EvtClose from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtFormatMessageF = (EvtFormatMessageT) GetProcAddress (WINEVENT, "EvtFormatMessage"); + if (EvtFormatMessageF == NULL) { + pandoraLog ("Error loading function EvtFormatMessage from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtOpenPublisherMetadataF = (EvtOpenPublisherMetadataT) GetProcAddress (WINEVENT, "EvtOpenPublisherMetadata"); + if (EvtOpenPublisherMetadataF == NULL) { + pandoraLog ("Error loading function EvtOpenPublisherMetadata from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtCreateBookmarkF = (EvtCreateBookmarkT) GetProcAddress (WINEVENT, "EvtCreateBookmark"); + if (EvtCreateBookmarkF == NULL) { + pandoraLog ("Error loading function EvtCreateBookmark from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + EvtUpdateBookmarkF = (EvtUpdateBookmarkT) GetProcAddress (WINEVENT, "EvtUpdateBookmark"); + if (EvtUpdateBookmarkF == NULL) { + pandoraLog ("Error loading function EvtUpdateBookmark from Wevtapi.dll"); + FreeLibrary (WINEVENT); + WINEVENT = NULL; + return; + } + } +} + +void +Pandora_Module_Logchannel::run () { + list event_list; + list::iterator event; + SYSTEMTIME system_time; + + // Run + try { + Pandora_Module::run (); + } catch (Interval_Not_Fulfilled e) { + return; + } + + // Initialize log event query + this->initializeLogChannel(); + + // Read events on a list + this->getLogEvents (event_list); + + // Return if no data stored on list + if (event_list.size () < 1) return; + + for (event = event_list.begin (); event != event_list.end(); ++event) { + // Store the data + this->setOutput (event->message, &(event->timestamp)); + } +} + +/** + * Fill the first bookmark of events. + */ +void +Pandora_Module_Logchannel::initializeLogChannel () { + EVT_HANDLE hEvents[1]; + EVT_HANDLE hResults; + EVT_HANDLE hBookmark; + DWORD dwReturned = 0; + + // Check whether the first bookmark is set + if (!this->bookmark_xml.empty()) return; + + // Open the event log with a query + hResults = EvtQueryF ( + NULL, + strAnsiToUnicode (this->source.c_str()).c_str(), + this->filter.c_str(), + EvtOpenChannelPath | EvtQueryForwardDirection + ); + if (hResults == NULL) { + pandoraDebug ("Could not open event log channel. Error: '%d'", GetLastError()); + return; + } + + // Put the events on the last event + if (!EvtSeekF(hResults, 0, NULL, 0, EvtSeekRelativeToLast)) { + pandoraDebug("Cannot positionate the event at first. 'Error %d'.", GetLastError()); + EvtCloseF(hResults); + return; + } + // Read next event to positionate the bookmark + if (!EvtNextF(hResults, 1, hEvents, INFINITE, 0, &dwReturned)) { + if (GetLastError() != ERROR_NO_MORE_ITEMS) { + pandoraDebug ("EvtNext (initializeLogChannel) error: %d", GetLastError()); + EvtCloseF(hResults); + return; + } + } + // If no events read, do not use bookmark to read all events + if (dwReturned == 0) { + pandoraDebug("No events found positionating bookmark."); + EvtCloseF(hResults); + return; + } + // Create the bookmar + pandoraDebug("Creating bookmark to channel %s", this->source.c_str()); + hBookmark = EvtCreateBookmarkF(NULL); + if (hBookmark == NULL) { + pandoraDebug("EvtCreateBookmark (initializeLogChannel) failed %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hEvents[0]); + return; + } + if (!EvtUpdateBookmarkF(hBookmark, hEvents[0])) { + pandoraDebug("EvtUpdateBookmarkF (initializeLogChannel) failed %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hEvents[0]); + EvtCloseF(hBookmark); + return; + } + // Save the bookmark like an XML. + this->updateBookmarkXML(hBookmark); + + // Clean tasks + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); +} + +/** + * Update the bookmark XML. Returns false if fails + */ +bool +Pandora_Module_Logchannel::updateBookmarkXML (EVT_HANDLE hBookmark) { + LPWSTR pBookmarkXml = NULL; + DWORD dwBufferSize = 0; + DWORD dwBufferUsed = 0; + DWORD dwPropertyCount = 0; + DWORD status = 0; + + if (!EvtRenderF(NULL, hBookmark, EvtRenderBookmark, dwBufferSize, pBookmarkXml, &dwBufferUsed, &dwPropertyCount)){ + if (ERROR_INSUFFICIENT_BUFFER == (status = GetLastError())){ + dwBufferSize = dwBufferUsed; + pBookmarkXml = (LPWSTR)malloc(dwBufferSize); + if (pBookmarkXml){ + EvtRenderF(NULL, hBookmark, EvtRenderBookmark, dwBufferSize, pBookmarkXml, &dwBufferUsed, &dwPropertyCount); + } + else{ + pandoraDebug("Error loading the bookmark. Cannot load enough memory"); + this->cleanBookmark(); + free(pBookmarkXml); + return false; + } + } + if (ERROR_SUCCESS != (status = GetLastError())){ + pandoraDebug("EvtRender (updateBookmarkXML) failed with %d\n", GetLastError()); + this->cleanBookmark(); + free(pBookmarkXml); + return false; + } + } + this->bookmark_xml = pBookmarkXml; + free(pBookmarkXml); + return true; +} + +/** + * Clean the bookmark XML. + */ +void +Pandora_Module_Logchannel::cleanBookmark () { + this->bookmark_xml = L""; +} + +/** + * Reads available events from the event log. + */ +void +Pandora_Module_Logchannel::getLogEvents (list &event_list) { + EVT_HANDLE hResults = NULL; + EVT_HANDLE hBookmark = NULL; + EVT_HANDLE hEvents[1]; + EVT_HANDLE hContext = NULL; + PEVT_VARIANT pRenderedValues = NULL; + EVT_HANDLE hProviderMetadata = NULL; + LPWSTR pwsMessage = NULL; + LPWSTR ppValues[] = {L"Event/System/Provider/@Name", L"Event/System/TimeCreated/@SystemTime"}; + DWORD count = sizeof(ppValues)/sizeof(LPWSTR); + DWORD dwReturned = 0; + DWORD dwBufferSize = 0; + DWORD dwBufferUsed = 0; + DWORD dwPropertyCount = 0; + DWORD status = ERROR_SUCCESS; + SYSTEMTIME eventTime; + FILETIME lft, ft; + bool update_bookmark = false; + + // An empty bookmark XML means that log cannot be open + if (this->bookmark_xml.empty()) return; + + // Open the event log with a query + hResults = EvtQueryF ( + NULL, + strAnsiToUnicode (this->source.c_str()).c_str(), + this->filter.c_str(), + EvtOpenChannelPath | EvtQueryForwardDirection + ); + if (hResults == NULL) { + pandoraDebug ("Could not open event log channel '%s'. Error: '%d'", this->source.c_str(), GetLastError()); + EvtCloseF(hResults); + this->cleanBookmark(); + return; + } + + // Seek on the bookmark + hBookmark = EvtCreateBookmarkF(this->bookmark_xml.c_str()); + if (hBookmark == NULL) { + pandoraDebug("Cannot read the string bookmark. Error: %d.", GetLastError()); + EvtCloseF(hResults); + this->cleanBookmark(); + return; + } + if (!EvtSeekF(hResults, 1, hBookmark, 0, EvtSeekRelativeToBookmark)) { + pandoraDebug("Cannot positionate the event at bookmark. Error %d.", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + this->cleanBookmark(); + return; + } + + // Read events one by one + hEvents[0] = NULL; + while (EvtNextF(hResults, 1, hEvents, INFINITE, 0, &dwReturned)) { + hContext = EvtCreateRenderContextF(count, (LPCWSTR*)ppValues, EvtRenderContextValues); + if (NULL == hContext) { + pandoraDebug ("EvtCreateRenderContext error: %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + this->cleanBookmark(); + return; + } + + // Reinitialize the buffers + dwBufferSize = 0; + dwBufferUsed = 0; + if (! EvtRenderF(hContext, hEvents[0], EvtRenderEventValues, dwBufferSize, pRenderedValues, &dwBufferUsed, &dwPropertyCount)) { + if ((status = GetLastError()) == ERROR_INSUFFICIENT_BUFFER) { + dwBufferSize = dwBufferUsed; + pRenderedValues = (PEVT_VARIANT)malloc(dwBufferSize); + if (pRenderedValues) { + EvtRenderF(hContext, hEvents[0], EvtRenderEventValues, dwBufferSize, pRenderedValues, &dwBufferUsed, &dwPropertyCount); + } + else { + pandoraDebug ("EvtRender error: %d", status); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + this->cleanBookmark(); + return; + } + } + + if ((status = GetLastError()) != ERROR_SUCCESS) { + pandoraDebug ("EvtRender error getting buffer size: %d", status); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + this->cleanBookmark(); + return; + } + } + + // Get the SYSTEMTIME of log + ULONGLONG ullTimeStamp = pRenderedValues[1].FileTimeVal; + ft.dwHighDateTime = (DWORD)((ullTimeStamp >> 32) & 0xFFFFFFFF); + ft.dwLowDateTime = (DWORD)(ullTimeStamp & 0xFFFFFFFF); + // Time format conversions + if (!FileTimeToLocalFileTime(&ft, &lft)){ + pandoraDebug("UTC FILETIME to LOCAL FILETIME error: %d.", GetLastError()); + } else if (!FileTimeToSystemTime(&lft, &eventTime)){ + pandoraDebug("FILETIME to SYSTEMTIME error: %d.", GetLastError()); + } + + // Get the handle to the provider's metadata that contains the message strings + hProviderMetadata = EvtOpenPublisherMetadataF(NULL, pRenderedValues[0].StringVal, NULL, 0, 0); + if (hProviderMetadata == NULL) { + pandoraDebug ("EvtOpenPublisherMetadata error: %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + free(pRenderedValues); + this->cleanBookmark(); + return; + } + + // Read the event message + pwsMessage = GetMessageString(hProviderMetadata, hEvents[0], EvtFormatMessageEvent); + if (pwsMessage == NULL) { + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + EvtCloseF(hContext); + free(pRenderedValues); + EvtCloseF(hProviderMetadata); + this->cleanBookmark(); + return; + } + + // Check the regex and save the message if pass the regex + if (this->pattern.empty () || regexec (&this->regexp, strUnicodeToAnsi(pwsMessage).c_str (), 0, NULL, 0) == 0){ + // Save the event message + LogChannelList event_item; + event_item.message = strUnicodeToAnsi(pwsMessage); + event_item.timestamp= eventTime; + event_list.push_back (event_item); + } + + // Clean up some used vars + EvtCloseF(hContext); + free(pRenderedValues); + EvtCloseF(hProviderMetadata); + free(pwsMessage); + + // Update the bookmark + if (!EvtUpdateBookmarkF(hBookmark, hEvents[0])) { + pandoraDebug("EvtUpdateBookmarkF (getLogEvents) failed %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + EvtCloseF(hEvents[0]); + this->cleanBookmark(); + return; + } + + // Cleanup current event and read the next log + EvtCloseF(hEvents[0]); + hEvents[0] = NULL; + + // Information token to update bookmark + update_bookmark = true; + } + status = GetLastError(); + if (status != ERROR_NO_MORE_ITEMS) { + pandoraDebug ("EvtNext getLogEvents error: %d", GetLastError()); + EvtCloseF(hResults); + EvtCloseF(hBookmark); + this->cleanBookmark(); + return; + } + + // Update bookmark if there is new events + if (update_bookmark) this->updateBookmarkXML(hBookmark); + + // Clean handlers + EvtCloseF(hResults); + EvtCloseF(hBookmark); +} + +// Gets the specified message string from the event. If the event does not +// contain the specified message, the function returns NULL. +// See http://msdn.microsoft.com/en-us/library/windows/desktop/dd996923(v=vs.85).aspx +LPWSTR +Pandora_Module_Logchannel::GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId) { + LPWSTR pBuffer = NULL; + DWORD dwBufferSize = 0; + DWORD dwBufferUsed = 0; + DWORD status = 0; + + if (!EvtFormatMessageF(hMetadata, hEvent, 0, 0, NULL, FormatId, dwBufferSize, pBuffer, &dwBufferUsed)) { + status = GetLastError(); + if (ERROR_INSUFFICIENT_BUFFER == status) { + // An event can contain one or more keywords. The function returns keywords + // as a list of keyword strings. To process the list, you need to know the + // size of the buffer, so you know when you have read the last string, or you + // can terminate the list of strings with a second null terminator character + // as this example does. + if ((EvtFormatMessageKeyword == FormatId)) { + pBuffer[dwBufferSize-1] = L'\0'; + } + else { + dwBufferSize = dwBufferUsed; + } + pBuffer = (LPWSTR)malloc(dwBufferSize * sizeof(WCHAR)); + + if (pBuffer) { + EvtFormatMessageF(hMetadata, hEvent, 0, 0, NULL, FormatId, dwBufferSize, pBuffer, &dwBufferUsed); + + // Add the second null terminator character. + if ((EvtFormatMessageKeyword == FormatId)) { + pBuffer[dwBufferUsed-1] = L'\0'; + } + } + else { + return NULL; + } + } + else { + pandoraDebug ("EvtFormatMessage error: %d", status); + return NULL; + } + } + + return pBuffer; +} \ No newline at end of file diff --git a/pandora_agents/win32/modules/pandora_module_logchannel.h b/pandora_agents/win32/modules/pandora_module_logchannel.h new file mode 100755 index 0000000000..14617037c6 --- /dev/null +++ b/pandora_agents/win32/modules/pandora_module_logchannel.h @@ -0,0 +1,76 @@ +/* Pandora logchannel module. This module checks for log events that match a given + pattern using XML functions provided by wevtapi. + + Copyright (C) 2017 Artica ST. + Written by Fermin Hernandez. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __PANDORA_MODULE_LOGCHANNEL_H__ +#define __PANDORA_MODULE_LOGCHANNEL_H__ + +#include "pandora_module.h" +#include "boost/regex.h" +#include "../windows/winevt.h" + +// Log event read buffer size +#define BUFFER_SIZE 1024 + +// Types for pointers to Wevtapi.dll functions +typedef EVT_HANDLE WINAPI (*EvtQueryT) (EVT_HANDLE Session, LPCWSTR Path, LPCWSTR Query, DWORD Flags); +typedef WINBOOL WINAPI (*EvtNextT) (EVT_HANDLE ResultSet, DWORD EventArraySize, EVT_HANDLE* EventArray, DWORD Timeout, DWORD Flags, PDWORD Returned); +typedef WINBOOL WINAPI (*EvtSeekT) (EVT_HANDLE ResultSet, LONGLONG Position, EVT_HANDLE Bookmark, DWORD Timeout, DWORD Flags); +typedef EVT_HANDLE WINAPI (*EvtCreateRenderContextT) (DWORD ValuePathsCount, LPCWSTR *ValuePaths, DWORD Flags); +typedef WINBOOL WINAPI (*EvtRenderT) (EVT_HANDLE Context, EVT_HANDLE Fragment, DWORD Flags, DWORD BufferSize, PVOID Buffer, PDWORD BufferUsed, PDWORD PropertyCount); +typedef WINBOOL WINAPI (*EvtCloseT) (EVT_HANDLE Object); +typedef WINBOOL WINAPI (*EvtFormatMessageT) (EVT_HANDLE PublisherMetadata, EVT_HANDLE Event, DWORD MessageId, DWORD ValueCount, PEVT_VARIANT Values, DWORD Flags, DWORD BufferSize, LPWSTR Buffer, PDWORD BufferUsed); +typedef EVT_HANDLE WINAPI (*EvtOpenPublisherMetadataT) (EVT_HANDLE Session, LPCWSTR PublisherIdentity, LPCWSTR LogFilePath, LCID Locale, DWORD Flags); +typedef EVT_HANDLE WINAPI (*EvtCreateBookmarkT) (LPCWSTR BookmarkXml); +typedef WINBOOL WINAPI (*EvtUpdateBookmarkT) (EVT_HANDLE Bookmark, EVT_HANDLE Event); + +namespace Pandora_Modules { + + /** + * This module checks for log events that match a given + * pattern. Events can be filtered by source and type. + */ + + class Pandora_Module_Logchannel : public Pandora_Module { + struct LogChannelList { + string message; + SYSTEMTIME timestamp; + }; + private: + regex_t regexp; + string source; + string pattern; + wstring filter; + wstring bookmark_xml; + HANDLE messages_dll; + + void initializeLogChannel (); + bool updateBookmarkXML (EVT_HANDLE hBookmark); + void getLogEvents (list &event_list); + void cleanBookmark (); + LPWSTR GetMessageString(EVT_HANDLE hMetadata, EVT_HANDLE hEvent, EVT_FORMAT_MESSAGE_FLAGS FormatId); + + public: + Pandora_Module_Logchannel (string name, string source, string type, string id, string pattern); + void run (); + }; +} + +#endif diff --git a/pandora_agents/win32/modules/pandora_module_proc.cc b/pandora_agents/win32/modules/pandora_module_proc.cc index e8eed1f97d..1c06e1001d 100644 --- a/pandora_agents/win32/modules/pandora_module_proc.cc +++ b/pandora_agents/win32/modules/pandora_module_proc.cc @@ -48,6 +48,7 @@ Pandora_Module_Proc::Pandora_Module_Proc (string name, string process_name) this->setKind (module_proc_str); this->watchdog = false; + this->user_session = false; this->start_command = ""; this->retries = 3; this->start_delay = 5000; @@ -95,6 +96,11 @@ Pandora_Module_Proc::getRetryDelay () const { return this->retry_delay; } +bool +Pandora_Module_Proc::getUserSession () const { + return this->user_session; +} + void Pandora_Module_Proc::setWatchdog (bool watchdog) { this->watchdog = watchdog; @@ -131,6 +137,11 @@ Pandora_Module_Proc::setRetryDelay (int mseconds) { this->retry_delay = mseconds; } +void +Pandora_Module_Proc::setUserSession (bool usession) { + this->user_session = usession; +} + void async_run (Pandora_Module_Proc *module) { HANDLE *processes = NULL; @@ -156,7 +167,7 @@ async_run (Pandora_Module_Proc *module) { } Sleep (module->getRetryDelay ()); - Pandora_Wmi::runProgram (module->getStartCommand ()); + Pandora_Wmi::runProgram (module->getStartCommand (), NULL, module->getUserSession()); Sleep (module->getStartDelay ()); counter++; continue; diff --git a/pandora_agents/win32/modules/pandora_module_proc.h b/pandora_agents/win32/modules/pandora_module_proc.h index edab85cb88..0286efcf5c 100644 --- a/pandora_agents/win32/modules/pandora_module_proc.h +++ b/pandora_agents/win32/modules/pandora_module_proc.h @@ -32,6 +32,7 @@ namespace Pandora_Modules { string process_name; HANDLE thread; bool watchdog; + bool user_session; string start_command; int retries; int start_delay; @@ -46,12 +47,14 @@ namespace Pandora_Modules { int getRetries () const; int getStartDelay () const; int getRetryDelay () const; + bool getUserSession () const; void setWatchdog (bool watchdog); void setStartCommand (string command); void setRetries (int retries); void setStartDelay (int mseconds); void setRetryDelay (int mseconds); + void setUserSession (bool usession); void run (); }; diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index f7562bd0da..10c9f9a9a0 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.714(Build 171025)") +#define PANDORA_VERSION ("7.0NG.714(Build 171031)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 7a3ba2e871..59e5f0f15d 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.714(Build 171025))" + VALUE "ProductVersion", "(7.0NG.714(Build 171031))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_agents/win32/windows/pandora_wmi.cc b/pandora_agents/win32/windows/pandora_wmi.cc index e4763cc433..fb572bddcb 100644 --- a/pandora_agents/win32/windows/pandora_wmi.cc +++ b/pandora_agents/win32/windows/pandora_wmi.cc @@ -369,16 +369,16 @@ Pandora_Wmi::getOSName () { dhGetValue (L"%s", &name, quickfix, L".Caption"); - if (name != NULL) { - // Remove the (R) character. - for (int i = 0; i < strlen(name); i++) { - if ((unsigned char)name[i] == 0xAE) { - name[i] = ' '; - } - } - ret = name; - dhFreeString (name); - } + if (name != NULL) { + // Remove the (R) character. + for (int i = 0; i < strlen(name); i++) { + if ((unsigned char)name[i] == 0xAE) { + name[i] = ' '; + } + } + ret = name; + dhFreeString (name); + } } NEXT_THROW (quickfix); } catch (string errstr) { @@ -411,12 +411,12 @@ Pandora_Wmi::getOSVersion () { L".CSDVersion"); if (version != NULL) { - // Remove the (R) character. - for (int i = 0; i < strlen(version); i++) { - if ((unsigned char)version[i] == 0xAE) { - version[i] = ' '; - } - } + // Remove the (R) character. + for (int i = 0; i < strlen(version); i++) { + if ((unsigned char)version[i] == 0xAE) { + version[i] = ' '; + } + } ret = version; dhFreeString (version); } @@ -501,7 +501,7 @@ Pandora_Wmi::getSystemName () { * @param flags Process creation flags */ bool -Pandora_Wmi::runProgram (string command, DWORD flags) { +Pandora_Wmi::runProgram (string command, DWORD flags, BOOL user_session) { PROCESS_INFORMATION process_info; STARTUPINFO startup_info; bool success; @@ -514,11 +514,75 @@ Pandora_Wmi::runProgram (string command, DWORD flags) { startup_info.cb = sizeof (startup_info); ZeroMemory (&process_info, sizeof (process_info)); - pandoraDebug ("Start process \"%s\".", command.c_str ()); - cmd = strdup (command.c_str ()); - success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags, - NULL, NULL, &startup_info, &process_info); - pandoraFree (cmd); + if (user_session) { + DWORD sessionId = WTSGetActiveConsoleSessionId(); + startup_info.cb = sizeof(STARTUPINFO); + startup_info.hStdError = 0; + startup_info.hStdInput = 0; + startup_info.hStdOutput = 0; + if ( + startup_info.hStdError != 0 + || startup_info.hStdInput != 0 + || startup_info.hStdOutput != 0 + ) { + startup_info.dwFlags |= STARTF_USESTDHANDLES; + } + + HANDLE procHandle = GetCurrentProcess(); + HANDLE token, userToken; + + // Tray to open the process + if (OpenProcessToken(procHandle, TOKEN_DUPLICATE, &token) == 0) { + pandoraDebug ("Open Process Token fails with error %d.", GetLastError()); + return false; + } + + // Duplicate token + if (DuplicateTokenEx(token, + MAXIMUM_ALLOWED, + 0, + SecurityImpersonation, + TokenPrimary, + &userToken) == 0) { + pandoraDebug ("Duplicate token fails with error %d.", GetLastError()); + return false; + } + + // Set Token Information + if (SetTokenInformation(userToken, + (TOKEN_INFORMATION_CLASS)TokenSessionId, + &sessionId, + sizeof(sessionId)) == 0) { + // Error 1314 will be thrown if agent is not running as service. + if (GetLastError() != 1314) { + pandoraDebug ("Set token information fails with error %d.", GetLastError()); + return false; + } + } + + LPSTR command_exec = (LPSTR)command.c_str(); + + // Create Process As User + // Changed inherit and command + success = CreateProcessAsUser( + userToken, + 0, + command_exec, + 0, + 0, + FALSE, + flags, + 0, + NULL, + &startup_info, + &process_info); + } else { + pandoraDebug ("Start process \"%s\".", command.c_str ()); + cmd = strdup (command.c_str ()); + success = CreateProcess (NULL, cmd, NULL, NULL, FALSE, flags, + NULL, NULL, &startup_info, &process_info); + pandoraFree (cmd); + } if (success) { pandoraDebug ("The process \"%s\" was started.", command.c_str ()); @@ -949,7 +1013,7 @@ getIPs(VARIANT *ip_array){ if (V_VT(&pvArray[i]) == VT_BSTR) { if (i > 0) { ret += " , "; - } + } LPSTR szStringA; ret += Pandora_Strutils::strUnicodeToAnsi( V_BSTR(&pvArray[i])); } diff --git a/pandora_agents/win32/windows/pandora_wmi.h b/pandora_agents/win32/windows/pandora_wmi.h index 601499f4a1..de4f3db81b 100644 --- a/pandora_agents/win32/windows/pandora_wmi.h +++ b/pandora_agents/win32/windows/pandora_wmi.h @@ -53,7 +53,7 @@ namespace Pandora_Wmi { string getOSBuild (); string getSystemName (); string getSystemAddress (); - bool runProgram (string command, DWORD flags = 0); + bool runProgram (string command, DWORD flags = 0, BOOL user_session = false); bool startService (string service_name); bool stopService (string service_name); void runWMIQuery (string wmi_query, diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a1d78610d1..67a1519e82 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.714-171025 +Version: 7.0NG.714-171031 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index a3d80eec1a..48c5d593d7 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.714-171025" +pandora_version="7.0NG.714-171031" package_pear=0 package_pandora=1 diff --git a/pandora_console/extensions/agents_alerts.php b/pandora_console/extensions/agents_alerts.php index 97f1bc7589..f5cad20d74 100755 --- a/pandora_console/extensions/agents_alerts.php +++ b/pandora_console/extensions/agents_alerts.php @@ -546,9 +546,11 @@ ui_require_jquery_file('pandora'); }); $('#group_id').change(function(){ - var regx = /&group_id=\d*/g; - var url = location.href.replace(regx, ""); - location.href = url+"&group_id="+$("#group_id").val(); + if(location.href.indexOf("extensions/agents_modules") == -1){ + var regx = /&group_id=\d*/g; + var url = location.href.replace(regx, ""); + location.href = url+"&group_id="+$("#group_id").val(); + } }); }); diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index cb6fe8cd42..6e6cf9a92e 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -66,11 +66,14 @@ function mainAgentsModules() { $modulegroup = get_parameter('modulegroup', 0); $refr = get_parameter('refresh', 0); // By default 30 seconds + $recursion = get_parameter('recursion', 0); $group_id = (int)get_parameter('group_id', 0); $offset = (int)get_parameter('offset', 0); $hor_offset = (int)get_parameter('hor_offset', 0); $block = $config['block_size']; - $agents_id = (array)get_parameter('id_agents2', -1); + if(get_parameter('modulegroup') != null){ + $agents_id = (array)get_parameter('id_agents2', -1); + } $selection_a_m = (int)get_parameter('selection_agent_module'); $modules_selected = (array)get_parameter('module', 0); $update_item = (string)get_parameter('edit_item',''); @@ -139,6 +142,8 @@ function mainAgentsModules() { $filter_groups_label = ''.__('Group').''; $filter_groups = html_print_select_groups(false, "AR", true, 'group_id', $group_id, '', '', '', true, false, true, '', false , 'width: auto;'); + $filter_recursion_label = ''.__('Recursion').''; + $filter_recursion = html_print_checkbox('recursion', 1, 0, true); //groups module $filter_module_groups_label = ''.__('Module group').''; $filter_module_groups = html_print_select_from_sql ("SELECT * FROM tmodule_group ORDER BY name", @@ -245,12 +250,12 @@ function mainAgentsModules() { if($config['pure'] != 1){ echo '
'; + . ui_get_url_refresh (array ('offset' => $offset, 'hor_offset' => $offset, 'group_id' => $group_id, 'modulegroup' => $modulegroup)).'">'; echo ''; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -375,9 +380,14 @@ function mainAgentsModules() { } if ($group_id > 0) { - $filter_groups['id_grupo'] = $group_id; + if($recursion){ + $filter_groups['id_grupo'] = array_merge($group_id, + groups_get_id_recursive($group_id, true)); + } + else{ + $filter_groups['id_grupo'] = $group_id; + } } - $agents = agents_get_agents ($filter_groups); $nagents = count($agents); @@ -675,12 +685,14 @@ $ignored_params['refresh']=''; } $("#group_id").change (function () { + jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", "get_agents_group_json" : 1, "id_group" : this.value, "privilege" : "AW", - "keys_prefix" : "_" + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') }, function (data, status) { $("#id_agents2").html(''); @@ -699,7 +711,34 @@ $ignored_params['refresh']=''; "json" ); }); - + + $("#checkbox-recursion").change (function () { + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "id_group" : $("#group_id").val(), + "privilege" : "AW", + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') + }, + function (data, status) { + $("#id_agents2").html(''); + $("#module").html(''); + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + $("#id_agents2").append (option); + }); + }, + "json" + ); + }); + $("#modulegroup").change (function () { jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", diff --git a/pandora_console/extras/mr/8.sql b/pandora_console/extras/mr/8.sql new file mode 100644 index 0000000000..591574e07b --- /dev/null +++ b/pandora_console/extras/mr/8.sql @@ -0,0 +1,9 @@ +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'; +COMMIT; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 22bcc52766..a7f25b24b9 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -725,6 +725,9 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `module_free_text` TEXT, `each_agent` tinyint(1) default 1, `historical_db` tinyint(1) UNSIGNED NOT NULL default 0, + `lapse_calc` tinyint(1) UNSIGNED NOT NULL default '0', + `lapse` int(11) UNSIGNED NOT NULL default '300', + `visual_format` tinyint(1) UNSIGNED NOT NULL default '0', PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -1183,6 +1186,7 @@ ALTER TABLE tusuario ADD COLUMN `id_filter` int(10) UNSIGNED NULL DEFAULT NULL; ALTER TABLE tusuario ADD CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter(`id_filter`) ON DELETE SET NULL; ALTER TABLE tusuario ADD COLUMN `session_time` int(10) signed NOT NULL default '0'; alter table tusuario add autorefresh_white_list text not null default ''; +ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL default '30'; -- --------------------------------------------------------------------- -- Table `tagente_modulo` @@ -1269,6 +1273,9 @@ UPDATE treport_custom_sql SET `sql` = 'select t1.alias as agent_n -- --------------------------------------------------------------------- ALTER TABLE treport_content ADD COLUMN `historical_db` tinyint(1) NOT NULL DEFAULT '0'; +ALTER TABLE treport_content ADD COLUMN `lapse_calc` tinyint(1) default '0'; +ALTER TABLE treport_content ADD COLUMN `lapse` int(11) default '300'; +ALTER TABLE treport_content ADD COLUMN `visual_format` tinyint(1) default '0'; -- --------------------------------------------------------------------- -- Table `tmodule_relationship` diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 46e95a7026..e228c1eca4 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -191,7 +191,7 @@ config_check(); $_GET['refr'] = null; } - $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); + $select = db_process_sql("SELECT autorefresh_white_list,time_autorefresh FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); $autorefresh_list = json_decode($select[0]['autorefresh_white_list']); if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { @@ -261,7 +261,13 @@ config_check(); if ($check_minor_release_available) { if (users_is_admin($config['id_user'])) { - set_pandora_error_for_header('There are one or more minor releases waiting for update', 'minor release/s available'); + + if($config['language'] == 'es'){ + set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. '.__('Sobre actualización de revisión menor').'', 'Revisión/es menor/es disponible/s'); + } + else{ + set_pandora_error_for_header('There are one or more minor releases waiting for update. '.__('About minor release update').'', 'minor release/s available'); + } } } echo ''; @@ -389,7 +395,15 @@ config_check(); $("#combo_refr").toggle (); $("#combo_refr").css('padding-right', '9px'); href = $("a.autorefresh").attr ("href"); - $(document).attr ("location", href + "30"); + + var refresh = ''; + $(document).attr ("location", href + refresh); + + '; echo ""; - if ($agent['quiet']) { - html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); - echo " "; - } if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $main_tab = 'main'; @@ -562,8 +558,10 @@ if ($agents !== false) { ""; echo ""; - $in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); - + $in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . ' AND tplanned_downtime.executed = 1'); + if ($agent["disabled"]) { ui_print_help_tip(__('Disabled')); @@ -571,6 +569,11 @@ if ($agents !== false) { echo ""; } } + + if ($agent['quiet']) { + echo " "; + html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } if ($in_planned_downtime) { ui_print_help_tip (__('Agent in planned downtime'), false, 'images/minireloj-16.png'); diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index 1fbf08bf80..b22bc0f626 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -45,10 +45,10 @@ echo ""; -echo ""; -echo ""; +echo ""; echo ''; // Check if there is at least one server of each type available to assign that // kind of modules. If not, do not show server type in combo @@ -119,7 +119,7 @@ if (($policy_page) || (isset($agent))) { // Create module/type combo echo ''; if (!$policy_page) { - echo ''; } - echo ''; - echo ''; echo ''; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index f66aa17296..9b9b96ffaf 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -291,7 +291,7 @@ if (modules_is_string_type($id_module_type) || $edit) { $table_simple->data[4][1] .= '
'.__('Inverse interval').''; $table_simple->data[4][1] .= html_print_checkbox ("warning_inverse", 1, $warning_inverse, true, $disabledBecauseInPolicy); if (!modules_is_string_type($id_module_type) || $edit) { - $table_simple->data[4][2] = ' '; + $table_simple->data[4][2] = ''; $table_simple->colspan[4][2] = 2; $table_simple->rowspan[4][2] = 3; } @@ -1323,8 +1323,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "legend_normal") .attr("x", 72) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#82B92E"); //legend Warning text @@ -1343,8 +1343,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "legend_warning") .attr("x", 168) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#ffd731"); //legend Critical text @@ -1363,8 +1363,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "legend_critical") .attr("x", 258) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#fc4444"); //styles for number and axes @@ -1382,8 +1382,8 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er .attr("id", "warning_rect") .attr("x", 3) .attr("y", 0) - .attr("width", 300) - .attr("height", 200) + .attr("width", '300px') + .attr("height", '200px') .style("fill", "#82B92E"); //controls the inverse warning diff --git a/pandora_console/godmode/massive/massive_delete_modules.php b/pandora_console/godmode/massive/massive_delete_modules.php index 6009d1b9b8..b1cd1b220c 100755 --- a/pandora_console/godmode/massive/massive_delete_modules.php +++ b/pandora_console/godmode/massive/massive_delete_modules.php @@ -600,7 +600,7 @@ $(document).ready (function () { var params = { "page" : "operation/agentes/ver_agente", "get_agent_modules_json" : 1, - "get_id_and_name" : 1, + "get_distinct_name" : 1, "indexed" : 0, "privilege" : "AW" }; diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index 1550e0be93..f37a39e10d 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -503,6 +503,10 @@ $table->data['edit3'][2] = __('SMNP community'); $table->data['edit3'][3] = html_print_input_text ('snmp_community', '', '', 10, 100, true); +$table->data['edit15'][2] = __('SNMP OID'); +$table->data['edit15'][3] = html_print_input_text ('snmp_oid', '', + '', 80, 80, true); + $target_ip_values = array(); $target_ip_values['auto'] = __('Auto'); $target_ip_values['force_pri'] = __('Force primary key'); @@ -736,12 +740,13 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); var params = { "page" : "operation/agentes/ver_agente", "get_agent_modules_json" : 1, - "get_id_and_name" : 1, + "get_distinct_name" : 1, "indexed" : 0 }; @@ -800,7 +805,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").show (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").show (); } function clean_lists() { @@ -829,7 +835,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); $('input[type=checkbox]').attr('checked', false); $('input[type=checkbox]').attr('disabled', true); @@ -877,7 +884,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); } } } @@ -919,7 +927,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").show (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").show (); } else { $(".select_agents_row_2").css('display', ''); @@ -942,7 +951,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); } } } @@ -1026,7 +1036,8 @@ $(document).ready (function () { "tr#delete_table-edit11, " + "tr#delete_table-edit12, " + "tr#delete_table-edit13, " + - "tr#delete_table-edit14").hide (); + "tr#delete_table-edit14, " + + "tr#delete_table-edit15").hide (); jQuery.post ("ajax.php", {"page" : "operation/agentes/ver_agente", @@ -1158,8 +1169,8 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu /* List of fields which can be updated */ $fields = array ('dynamic_interval', 'dynamic_max', 'dynamic_min', 'dynamic_two_tailed', 'min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', - 'module_interval', 'disabled', 'post_process', 'unit_select', - 'snmp_community', 'tcp_send', 'custom_string_1', + 'module_interval', 'disabled', 'post_process', 'unit', + 'snmp_community','snmp_oid','tcp_send', 'custom_string_1', 'plugin_parameter', 'custom_string_2', 'custom_string_3', 'min', 'max', 'id_module_group', 'plugin_user', 'plugin_pass', 'id_export', 'history_data', 'critical_inverse', diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index 83b21b225b..b9cc96a468 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -473,8 +473,8 @@ $next_row++; .attr("id", "legend_normal") .attr("x", 72) .attr("y", -30) - .attr("width", 10) - .attr("height", 10) + .attr("width", '10px') + .attr("height", '10px') .style("fill", "#82B92E"); //legend Warning text diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 0593021bdc..b1dffe8e5b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -112,6 +112,10 @@ $netflow_filter = 0; $max_values = 0; $resolution = 0; +$lapse_calc = 0; +$lapse = 300; +$visual_format = 0; + //Others $filter_search = ""; @@ -148,6 +152,7 @@ switch ($action) { case 'network_interfaces_report': case 'availability': case 'event_report_log': + case 'increment': case 'availability_graph': case 'agent_module': $get_data_editor = true; @@ -195,12 +200,6 @@ switch ($action) { $name = $item['name']; switch ($type) { - case 'avg_value': - $period = $item['period']; - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); - break; case 'event_report_log': $period = $item['period']; $description = $item['description']; @@ -282,6 +281,13 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); break; + case 'increment': + $description = $item['description']; + $idAgentModule = $item['id_agent_module']; + $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); + $period = $item['period']; + break; + case 'SLA_services': $description = $item['description']; $period = $item['period']; @@ -312,6 +318,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'max_value': $description = $item['description']; @@ -319,6 +328,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'min_value': $description = $item['description']; @@ -326,6 +338,9 @@ switch ($action) { $idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule)); $idAgentModule = $item['id_agent_module']; $period = $item['period']; + $lapse = $item['lapse']; + $lapse_calc = $item['lapse_calc']; + $visual_format = $item['visual_format']; break; case 'sumatory': $description = $item['description']; @@ -593,6 +608,7 @@ switch ($action) { case 'MTTR': case 'simple_baseline_graph': case 'event_report_log': + case 'increment': $label = (isset($style['label'])) ? $style['label'] : ''; break; default: @@ -911,6 +927,9 @@ You can of course remove the warnings, that's why we include the source and do n elseif(check_acl ($config['id_user'], 0, "RM")) html_print_select_groups($config['id_user'], "RM", true, 'combo_group', $group, ''); + + echo "   ".__('Recursion').html_print_checkbox('recursion', 1, 0, true); + ?> @@ -1577,6 +1596,78 @@ You can of course remove the warnings, that's why we include the source and do n ?> + + + + + + + + + + + + + + + + + + + + +
" . $filter_groups_label . "" . $filter_groups . "" . $filter_groups ."   ". $filter_recursion_label . $filter_recursion. "" . $filter_module_groups_label . "
"; echo __('Search') . ' ' . html_print_input_text ('search_string', $search_string, '', 15, 255, true); echo ""; +echo ""; html_print_submit_button (__('Filter'), 'filter', false, 'class="sub search"'); echo "
'; + echo ''; echo __('Show in hierachy mode'); if ($checked == "true") { $checked = true; @@ -130,12 +130,12 @@ if (($policy_page) || (isset($agent))) { html_print_checkbox ('status_hierachy_mode', "", $checked, false, false, "onChange=change_mod_filter();"); echo ''; + echo ''; echo __("Type"); html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' ); html_print_input_hidden ('edit_module', 1); echo ''; + echo ''; echo ''; echo '
+ + + +
+ + + +
+ '; + html_print_radio_button ('visual_format', 1, '', $visual_format_table,'',!$lapse_calc); + echo (''); + echo __('Graph only').''; + html_print_radio_button ('visual_format', 2, '', $visual_format_graph,'',!$lapse_calc); + echo (''); + echo __('Graph and table').''; + html_print_radio_button ('visual_format', 3, '', $visual_format_both,'',!$lapse_calc); + + ?> +
@@ -2001,7 +2092,38 @@ $(document).ready (function () { "get_agents_group_json" : 1, "id_group" : this.value, "privilege" : "AW", - "keys_prefix" : "_" + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') + }, + function (data, status) { + $("#id_agents").html(''); + $("#id_agents2").html(''); + $("#module").html(''); + jQuery.each (data, function (id, value) { + // Remove keys_prefix from the index + id = id.substring(1); + + option = $("") + .attr ("value", value["id_agente"]) + .html (value["alias"]); + $("#id_agents").append (option); + $("#id_agents2").append (option); + }); + }, + "json" + ); + } + ); + + $("#checkbox-recursion").change ( + function () { + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_group_json" : 1, + "id_group" : $("#combo_group").val(), + "privilege" : "AW", + "keys_prefix" : "_", + "recursion" : $('#checkbox-recursion').is(':checked') }, function (data, status) { $("#id_agents").html(''); @@ -2177,6 +2299,19 @@ $(document).ready (function () { } }); + $("#checkbox-lapse_calc").change(function () { + + if($(this).is(":checked")){ + $( "#lapse_select" ).prop( "disabled", false ); + $("[name=visual_format]").prop( "disabled", false ); + } + else{ + $( "#lapse_select" ).prop( "disabled", true ); + $("[name=visual_format]").prop( "disabled", true ); + } + + }); + }); function create_custom_graph() { @@ -2658,6 +2793,9 @@ function chooseType() { $("#row_show_in_two_columns").hide(); $("#row_show_in_same_row").hide(); $("#row_historical_db_check").hide(); + $("#row_lapse_calc").hide(); + $("#row_lapse").hide(); + $("#row_visual_format").hide(); $("#row_show_in_landscape").hide(); $('#row_hide_notinit_agents').hide(); $("#row_module_group").hide(); @@ -2729,6 +2867,13 @@ function chooseType() { $("#row_source").show(); $("#row_historical_db_check").hide(); break; + + case 'increment': + $("#row_description").show(); + $("#row_agent").show(); + $("#row_module").show(); + $("#row_period").show(); + break; case 'simple_graph': $("#row_time_compare_overlapped").show(); @@ -2850,6 +2995,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; @@ -2859,6 +3007,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; @@ -2868,6 +3019,9 @@ function chooseType() { $("#row_module").show(); $("#row_period").show(); $("#row_show_in_two_columns").show(); + $("#row_lapse_calc").show(); + $("#row_lapse").show(); + $("#row_visual_format").show(); $("#row_historical_db_check").hide(); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 4dd13e9af0..e52994b810 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1,3 +1,37 @@ + + head[$next] = '' . - __('Op.') . ''; + __('Op.') . ''.html_print_checkbox('all_delete', 0, false, true, false, + 'check_all_checkboxes();'); //$table->size = array (); $table->size[$next] = '10%'; @@ -703,9 +738,13 @@ switch ($action) { $data[$next] .= ''; $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_hidden ('action','delete_report', true); - $data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, '', + $data[$next] .= html_print_input_image ('delete', 'images/cross.png', 1, 'margin-right: 10px;', true, array ('title' => __('Delete'))); + + $data[$next] .= html_print_checkbox_extended ('massive_report_check', $report['id_report'], false, false, '', 'class="check_delete"', true); + $data[$next] .= ''; + } } @@ -733,8 +772,19 @@ switch ($action) { else echo '
'; html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); - echo "
"; + echo ""; + echo '
'; + + foreach ($reports as $report) { + echo ''; + } + + echo ''; + html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete" style="margin-left:5px;"'); + echo '
'; + echo ""; + } enterprise_hook('close_meta_frame'); @@ -1019,6 +1069,15 @@ switch ($action) { $values['period'] = get_parameter('period'); $good_format = true; break; + case 'min_value': + case 'max_value': + case 'avg_value': + $values['period'] = get_parameter('period'); + $values['lapse_calc'] = get_parameter('lapse_calc'); + $values['lapse'] = get_parameter('lapse'); + $values['visual_format'] = get_parameter('visual_format'); + $good_format = true; + break; default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0); @@ -1354,6 +1413,15 @@ switch ($action) { $values['period'] = get_parameter('period'); $good_format = true; break; + case 'min_value': + case 'max_value': + case 'avg_value': + $values['period'] = get_parameter('period'); + $values['lapse_calc'] = get_parameter('lapse_calc'); + $values['lapse'] = get_parameter('lapse'); + $values['visual_format'] = get_parameter('visual_format'); + $good_format = true; + break; default: $values['period'] = get_parameter('period'); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0); @@ -2059,3 +2127,4 @@ switch ($activeTab) { enterprise_hook('close_meta_frame'); ?> + diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index 056d44e61d..8d9edddd88 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -201,7 +201,23 @@ echo ""; \ No newline at end of file +?> \ No newline at end of file diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index c36529b7f7..74a2ea251d 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -188,9 +188,25 @@ function vbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_vcolumn_chart ($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, - $homedir,$font,$font_size, $from_ux, $from_wux); + $homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor); } else { + foreach ($chart_data as $key => $value) { + if(strlen($key) > 25){ + + if(strpos($key, ' - ') != -1){ + $key_temp = explode(" - ",$key); + $key_temp[0] = $key_temp[0]." \n"; + $key_temp[1]= '...'.substr($key_temp[1],-15); + $key2 = $key_temp[0].$key_temp[1]; + io_safe_output($key2); + } + $chart_data[$key2]['g'] = $chart_data[$key]['g']; + unset($chart_data[$key]); + } + + } + $graph = array(); $graph['data'] = $chart_data; $graph['width'] = $width; @@ -636,9 +652,25 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, if ($flash_chart) { return flot_hcolumn_chart( - $chart_data, $width, $height, $water_mark_url, $font, $font_size); + $chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor); } else { + + foreach ($chart_data as $key => $value) { + if(strlen($key) > 40){ + if(strpos($key, ' - ') != -1){ + $key_temp = explode(" - ",$key); + $key_temp[0] = $key_temp[0]." \n"; + $key_temp[1]= '...'.substr($key_temp[1],-20); + $key2 = $key_temp[0].$key_temp[1]; + io_safe_output($key2); + } + $chart_data[$key2]['g'] = $chart_data[$key]['g']; + unset($chart_data[$key]); + } + } + + $graph = array(); $graph['data'] = $chart_data; $graph['width'] = $width; @@ -752,7 +784,7 @@ function pie_graph($graph_type, $flash_chart, $chart_data, $width, function ring_graph($flash_chart, $chart_data, $width, $height, $others_str = "other", $homedir="", $water_mark = "", $font = '', $font_size = '', $ttl = 1, $legend_position = false, - $colors = '', $hide_labels = false) { + $colors = '', $hide_labels = false,$background_color = 'white') { if (empty($chart_data)) { return graph_nodata_image($width, $height, 'pie'); @@ -768,7 +800,7 @@ function ring_graph($flash_chart, $chart_data, $width, return flot_custom_pie_chart ($flash_chart, $chart_data, $width, $height, $colors, $module_name_list, $long_index, $no_data, false, '', $water_mark, $font, $font_size, - $unit, $ttl, $homeurl, $background_color, $legend_position); + $unit, $ttl, $homeurl, $background_color, $legend_position,$background_color); } else { $total_modules = $chart_data['total_modules']; diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index e036a9855e..10b98be29b 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -119,7 +119,8 @@ function pandoraFlotPie(graph_id, values, labels, nseries, width, font_size, wat function pandoraFlotPieCustom(graph_id, values, labels, width, font_size, font, water_mark, separator, legend_position, height, - colors,legend) { + colors,legend,background_color) { + font = font.split("/").pop().split(".").shift(); var labels = labels.split(separator); var legend = legend.split(separator); @@ -211,8 +212,24 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, $('.legend>table').css('right',($('.legend>div').height()*-1)); } //$('.legend>table').css('border',"1px solid #E2E2E2"); - $('.legend>table').css('background-color',"transparent"); + if(background_color == 'transparent'){ + $('.legend>table').css('background-color',""); + $('.legend>div').css('background-color',""); + $('.legend>table').css('color',"#aaa"); + } + else if (background_color == 'white') { + $('.legend>table').css('background-color',"white"); + $('.legend>table').css('color',"black"); + } + else if (background_color == 'black') { + $('.legend>table').css('background-color',"black"); + $('.legend>table').css('color',"#aaa"); + } + + $('.legend').over(function(){ + return false; + }); var pielegends = $('#'+graph_id+' .pieLabelBackground'); pielegends.each(function () { @@ -309,7 +326,7 @@ function pandoraFlotPieCustom(graph_id, values, labels, width, } function pandoraFlotHBars(graph_id, values, labels, water_mark, - maxvalue, water_mark, separator, separator2, font, font_size) { + maxvalue, water_mark, separator, separator2, font, font_size, background_color) { var colors_data = ['#FC4444','#FFA631','#FAD403','#5BB6E5','#F2919D','#80BA27']; values = values.split(separator2); @@ -355,7 +372,7 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, grid: { hoverable: true, borderWidth: 1, - backgroundColor: { colors: ["#FFF", "#FFF"] } + backgroundColor: { colors: [background_color, background_color] } }, xaxis: { axisLabelUseCanvas: true, @@ -494,7 +511,7 @@ function showTooltip(x, y, color, contents) { }).appendTo("body").fadeIn(200); } -function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size , from_ux, from_wux) { +function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, water_mark, maxvalue, water_mark, separator, separator2, font, font_size , from_ux, from_wux, background_color) { values = values.split(separator2); legend = legend.split(separator); font = font.split("/").pop().split(".").shift(); @@ -585,7 +602,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, grid: { hoverable: true, borderWidth: 1, - backgroundColor: { colors: ["#FFF", "#FFF"] } + backgroundColor: { colors: [background_color, background_color] } } }; @@ -608,16 +625,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, $('#' + graph_id).VUseTooltip(); $('#' + graph_id).css("margin-left","auto"); $('#' + graph_id).css("margin-right","auto"); - //~ $('#' + graph_id).find('div.legend-tooltip').tooltip({ track: true }); - /* - $('#'+graph_id+' .xAxis .tickLabel') - .css('transform', 'rotate(-45deg)') - .css('max-width','100px') - .find('div') - .css('position', 'relative') - .css('top', '+10px') - .css('left', '-30px'); - */ + if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) $('#'+graph_id+' .xAxis .tickLabel') .find('div') @@ -638,7 +646,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, } format.push([i, - '
' + '
' + label + '
']); } diff --git a/pandora_console/include/graphs/functions_d3.php b/pandora_console/include/graphs/functions_d3.php index f181492b7a..e4e53f2f1d 100644 --- a/pandora_console/include/graphs/functions_d3.php +++ b/pandora_console/include/graphs/functions_d3.php @@ -24,10 +24,16 @@ function include_javascript_d3 ($return = false) { if (!$is_include_javascript) { $is_include_javascript = true; - $output .= ''; - $output .= ''; - + if (is_metaconsole()) { + $output .= ''; + $output .= ''; + } + else { + $output .= ''; + $output .= ''; + } } + if (!$return) echo $output; @@ -309,4 +315,97 @@ function ux_console_phases_donut ($phases, $id, $return = false) { return $output; } + +function d3_progress_bar ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "progress_bar_" . $id; + $recipient_name_to_js = "#progress_bar_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function d3_progress_bubble ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "progress_bubble_" . $id; + $recipient_name_to_js = "#progress_bubble_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function progress_circular_bar ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "circular_progress_bar_" . $id; + $recipient_name_to_js = "#circular_progress_bar_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function progress_circular_bar_interior ($id, $percentile, $width, $height, $color, $unit = "%", $text = "", $fill_color = "#FFFFFF") { + global $config; + + $recipient_name = "circular_progress_bar_interior_" . $id; + $recipient_name_to_js = "#circular_progress_bar_interior_" . $id; + + $output = ""; + + $output .= "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + return $output; +} + +function d3_donut_graph ($id, $width, $height, $module_data) { + global $config; + + $module_data = json_encode($module_data); + + $recipient_name = "donut_graph_" . $id; + $recipient_name_to_js = "#donut_graph_" . $id; + + $output = "
"; + $output .= include_javascript_d3(true); + $output .= ""; + + $output .= ""; + + return $output; +} + ?> diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 319e69cab0..58b193b0e7 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -666,7 +666,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values, $return .= "pandoraFlotPieCustom('$graph_id', '$values', '$labels', '$width', $font_size, '$fontpath', $water_mark, - '$separator', '$legend_position', '$height', '$colors','$legend')"; + '$separator', '$legend_position', '$height', '$colors','$legend','$background_color')"; $return .= ""; @@ -674,7 +674,7 @@ function flot_custom_pie_chart ($flash_charts, $graph_values, } // Returns a 3D column chart -function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7) { +function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = '', $font_size = 7, $background_color = "white") { global $config; include_javascript_dependencies_flot_graph(); @@ -755,7 +755,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = $return .= ""; @@ -763,7 +763,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = } // Returns a 3D column chart -function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux) { +function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark, $homedir, $font, $font_size, $from_ux, $from_wux, $background_color = 'white') { global $config; include_javascript_dependencies_flot_graph(); @@ -847,14 +847,14 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon if ($from_ux) { if($from_wux){ - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true)"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, true, '$background_color')"; } else{ - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false)"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, true, false, '$background_color')"; } } else { - $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false)"; + $return .= "pandoraFlotVBars('$graph_id', '$values', '$labels', '$labels', '$legend', '$colors', false, $max, '$water_mark', '$separator', '$separator2','$font',$font_size, false, false, '$background_color')"; } $return .= ""; @@ -866,9 +866,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ global $config; include_javascript_dependencies_flot_graph(); - - $height+= 20; - + $stacked_str = 'stack: stack,'; // Get a unique identifier to graph @@ -876,10 +874,10 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $ // Set some containers to legend, graph, timestamp tooltip, etc. if ($stat_win) { - $return = "
"; + $return = "
"; } else { - $return = "
"; + $return = "
"; } $return .= ""; diff --git a/pandora_console/include/graphs/functions_pchart.php b/pandora_console/include/graphs/functions_pchart.php index f5368ca4c5..a265f43ede 100644 --- a/pandora_console/include/graphs/functions_pchart.php +++ b/pandora_console/include/graphs/functions_pchart.php @@ -695,9 +695,12 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $MyData->setSerieDescription("Xaxis", $xaxisname); $MyData->setAbscissa("Xaxis"); + /* Create the pChart object */ $myPicture = new pImage($width,$height,$MyData); + + /* Turn of Antialiasing */ $myPicture->Antialias = $antialiasing; @@ -705,7 +708,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, //$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0)); /* Turn on shadow computing */ - $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); + $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>120,"G"=>120,"B"=>120,"Alpha"=>10)); + + $pdf = get_parameter('pdf',false); + + if($pdf == true){ + $font_size = $font_size+1; + } + + /* Set the default font */ $myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size)); @@ -721,15 +732,15 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, switch($graph_type) { case "vbar": $scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE, - "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, - "Mode"=>SCALE_MODE_START0, "LabelRotation" => 60); - $margin_left = 40; - $margin_right = 0; + "GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE, + "Mode"=>SCALE_MODE_START0, "LabelRotation" => 45); + $margin_left = 40+50; + $margin_right = 90; $margin_top = 10; - $margin_bottom = 3 * $max_chars; + $margin_bottom = (3 * $max_chars)+40; break; case "hbar": - $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE, + $scaleSettings = array("GridR"=>1000,"GridG"=>1000,"GridB"=>1000,"DrawSubTicks"=>TRUE, "CycleBackground"=>TRUE, "Mode"=>SCALE_MODE_START0, "Pos"=>SCALE_POS_TOPBOTTOM, "LabelValuesRotation" => 30); $margin_left = $font_size * $max_chars; @@ -743,19 +754,112 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font, $myPicture->setGraphArea($margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom); $myPicture->drawScale($scaleSettings); - /* - if (isset($legend)) { - /* Write the chart legend - $size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); - $myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10)); - } - */ + /* Turn on shadow computing */ $myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); - /* Draw the chart */ - $settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette); + /* Draw the chart */ + $settings = array("ForceTransparency"=>"-1", "Gradient"=>FALSE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette); + + /* goes through a series of colors and assigns them to the bars, when it ends it starts from the beginning */ + + for ($i=0,$j=1; $i < count($settings['OverrideColors']); $i++) { + + switch ($j) { + case 1: + $settings['OverrideColors'][$i]['R'] = 43; + $settings['OverrideColors'][$i]['G'] = 98; + $settings['OverrideColors'][$i]['B'] = 201; + $j++; + break; + + case 2: + $settings['OverrideColors'][$i]['R'] = 243; + $settings['OverrideColors'][$i]['G'] = 86; + $settings['OverrideColors'][$i]['B'] = 157; + $j++; + break; + + case 3: + $settings['OverrideColors'][$i]['R'] = 191; + $settings['OverrideColors'][$i]['G'] = 191; + $settings['OverrideColors'][$i]['B'] = 191; + $j++; + break; + + case 4: + $settings['OverrideColors'][$i]['R'] = 251; + $settings['OverrideColors'][$i]['G'] = 183; + $settings['OverrideColors'][$i]['B'] = 50; + $j++; + break; + + case 5: + $settings['OverrideColors'][$i]['R'] = 157; + $settings['OverrideColors'][$i]['G'] = 117; + $settings['OverrideColors'][$i]['B'] = 177; + $j++; + break; + + case 6: + $settings['OverrideColors'][$i]['R'] = 39; + $settings['OverrideColors'][$i]['G'] = 172; + $settings['OverrideColors'][$i]['B'] = 151; + $j++; + break; + + case 7: + $settings['OverrideColors'][$i]['R'] = 171; + $settings['OverrideColors'][$i]['G'] = 42; + $settings['OverrideColors'][$i]['B'] = 46; + $j++; + break; + + case 8: + $settings['OverrideColors'][$i]['R'] = 185; + $settings['OverrideColors'][$i]['G'] = 218; + $settings['OverrideColors'][$i]['B'] = 87; + $j++; + break; + + case 9: + $settings['OverrideColors'][$i]['R'] = 60; + $settings['OverrideColors'][$i]['G'] = 182; + $settings['OverrideColors'][$i]['B'] = 203; + $j++; + break; + + case 10: + $settings['OverrideColors'][$i]['R'] = 105; + $settings['OverrideColors'][$i]['G'] = 65; + $settings['OverrideColors'][$i]['B'] = 179; + $j++; + break; + + case 11: + $settings['OverrideColors'][$i]['R'] = 228; + $settings['OverrideColors'][$i]['G'] = 35; + $settings['OverrideColors'][$i]['B'] = 102; + $j++; + break; + + case 12: + $settings['OverrideColors'][$i]['R'] = 252; + $settings['OverrideColors'][$i]['G'] = 130; + $settings['OverrideColors'][$i]['B'] = 53; + $j = 1; + break; + + + default: + + break; + + } + + } + $myPicture->drawBarChart($settings); // Paint the water mark at the last moment to show it in front diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 79dfceb21d..121e41aaef 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -1500,4 +1500,590 @@ function round_with_decimals (value, multiplier = 1) { return Math.round(value * multiplier) / multiplier; } return round_with_decimals (value, multiplier * 10); +} + +function progress_bar_d3 (recipient, percentile, width, height, color, unit, label, label_color) { + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height); + + var progress_back = circle.append('rect') + .attr('fill', '#000000') + .attr('fill-opacity', 0.5) + .attr('height', 20) + .attr('width', width) + .attr('rx', 10) + .attr('ry', 10) + .attr('x', 0); + + var progress_front = circle.append('rect') + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('height', 20) + .attr('width', 0) + .attr('rx', 10) + .attr('ry', 10) + .attr('x', 0); + + var labelText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", 20) + .html(label) + .attr('dy', '15') + .attr('text-anchor', 'middle'); + + var numberText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', '#FFFFFF') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", 14) + .attr('text-anchor', 'middle') + .attr('dy', '-10'); + + function updateProgress(bar_progress) { + var percent_value = Number(bar_progress * 100); + numberText.text(percent_value.toFixed()); + progress_front.attr('width', (width * bar_progress)); + } + + var bar_progress = startPercent; + + (function loops() { + updateProgress(bar_progress); + + if (count > 0) { + count--; + bar_progress += step; + setTimeout(loops, 30); + } + })(); +} + +function progress_bubble_d3 (recipient, percentile, width, height, color, unit, label, label_color) { + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var numberSize = 0; + var textSize = 0; + var unitSize = 0; + var yPosText = 0; + var yPosNumber = 0; + if (width >= 500) { + numberSize = 100; + textSize = 50; + unitSize = 50; + yPosNumber = '15'; + yPosText = '-100'; + } + else if (width >= 400) { + numberSize = 80; + textSize = 40; + unitSize = 40; + yPosNumber = '15'; + yPosText = '-80'; + } + else if (width >= 300) { + numberSize = 60; + textSize = 30; + unitSize = 30; + yPosNumber = '15'; + yPosText = '-45'; + } + else if (width >= 200) { + numberSize = 40; + textSize = 20; + unitSize = 20; + yPosNumber = '50'; + yPosText = '-30'; + } + else if (width >= 100) { + numberSize = 20; + textSize = 10; + unitSize = 10; + yPosNumber = '5'; + yPosText = '-20'; + } + else { + numberSize = 10; + textSize = 8; + unitSize = 8; + yPosNumber = '5'; + yPosText = '-10'; + } + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height); + + var progress_back = circle.append('circle') + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', '#000000') + .attr('fill-opacity', 0) + .attr('r', width/2); + + var progress_front = circle.append('circle') + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('r', 0); + + var labelText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", textSize) + .html(label) + .attr('dy', -(width/3)) + .attr('text-anchor', 'middle'); + + var numberText = circle.append("text") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", numberSize) + .attr('text-anchor', 'middle') + .attr('dy', width/2); + + function updateProgress(bar_progress) { + var percent_value = Number(bar_progress * 100); + numberText.text(percent_value.toFixed() + " %"); + progress_front.attr('r', ((width/2) * bar_progress)); + } + + var bar_progress = startPercent; + + (function loops() { + updateProgress(bar_progress); + + if (count > 0) { + count--; + bar_progress += step; + setTimeout(loops, 30); + } + })(); +} + +function print_circular_progress_bar (recipient, percentile, width, height, color, unit, label, label_color) { + var twoPi = Math.PI * 2; + var radius = (width / 2); + var border = 20; + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var numberSize = 0; + var textSize = 0; + var unitSize = 0; + var yPosText = 0; + var yPosUnit = 0; + var yPosNumber = 0; + if (width >= 500) { + numberSize = 100; + textSize = 50; + unitSize = 50; + yPosNumber = '15'; + yPosText = '-100'; + yPosUnit = '100'; + } + else if (width >= 400) { + numberSize = 80; + textSize = 40; + unitSize = 40; + yPosNumber = '15'; + yPosText = '-80'; + yPosUnit = '80'; + } + else if (width >= 300) { + numberSize = 60; + textSize = 30; + unitSize = 30; + yPosNumber = '15'; + yPosText = '-45'; + yPosUnit = '60'; + } + else if (width >= 200) { + numberSize = 40; + textSize = 20; + unitSize = 20; + yPosNumber = '10'; + yPosText = '-30'; + yPosUnit = '40'; + } + else if (width >= 100) { + numberSize = 20; + textSize = 10; + unitSize = 10; + yPosNumber = '5'; + yPosText = '-15'; + yPosUnit = '20'; + } + else { + numberSize = 8; + textSize = 4; + unitSize = 4; + yPosNumber = '2'; + yPosText = '-5'; + yPosUnit = '5'; + } + + var arc = d3.svg.arc() + .startAngle(0) + .innerRadius(radius) + .outerRadius(radius - border); + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height) + .append("g") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")"); + + var meter = circle.append("g") + .attr('class', 'progress-meter'); + + meter.append("path") + .attr('fill', '#000000') + .attr('fill-opacity', 0.5) + .attr('d', arc.endAngle(twoPi)); + + var foreground = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('stroke', color) + .attr('stroke-opacity', 1); + + var front = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1); + + var labelText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", textSize) + .html(label) + .attr('text-anchor', 'middle') + .attr('dy', yPosText); + + var numberText = circle.append("text") + .attr('fill', '#000000') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", numberSize) + .attr('text-anchor', 'middle') + .attr('dy', yPosNumber); + + var percentText = circle.append("text") + .attr('fill', '#000000') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", unitSize) + .text(unit) + .attr('text-anchor', 'middle') + .attr('dy', yPosUnit); + + function updateProgress(progress) { + foreground.attr('d', arc.endAngle(twoPi * progress)); + front.attr('d', arc.endAngle(twoPi * progress)); + var percent_value = Number(progress * 100); + numberText.text(percent_value.toFixed()); + } + + var progress = startPercent; + + (function loops() { + updateProgress(progress); + + if (count > 0) { + count--; + progress += step; + setTimeout(loops, 30); + } + })(); +} + +function print_interior_circular_progress_bar (recipient, percentile, width, height, color, unit, label, label_color) { + var twoPi = Math.PI * 2; + var radius = (width / 2) - 20; + var radius2 = (width / 2); + var border = 20; + var startPercent = 0; + var endPercent = parseInt(percentile) / 100; + var count = Math.abs((endPercent - startPercent) / 0.01); + var step = endPercent < startPercent ? -0.01 : 0.01; + + var numberSize = 0; + var textSize = 0; + var unitSize = 0; + var yPosText = 0; + var yPosUnit = 0; + var yPosNumber = 0; + if (width >= 500) { + numberSize = 100; + textSize = 50; + unitSize = 50; + yPosNumber = '15'; + yPosText = '-100'; + yPosUnit = '100'; + } + else if (width >= 400) { + numberSize = 80; + textSize = 40; + unitSize = 40; + yPosNumber = '15'; + yPosText = '-80'; + yPosUnit = '80'; + } + else if (width >= 300) { + numberSize = 60; + textSize = 30; + unitSize = 30; + yPosNumber = '15'; + yPosText = '-45'; + yPosUnit = '60'; + } + else if (width >= 200) { + numberSize = 40; + textSize = 20; + unitSize = 20; + yPosNumber = '10'; + yPosText = '-30'; + yPosUnit = '40'; + } + else if (width >= 100) { + numberSize = 20; + textSize = 10; + unitSize = 10; + yPosNumber = '5'; + yPosText = '-15'; + yPosUnit = '20'; + } + else { + numberSize = 8; + textSize = 4; + unitSize = 4; + yPosNumber = '2'; + yPosText = '-5'; + yPosUnit = '5'; + } + + var arc = d3.svg.arc() + .startAngle(0) + .innerRadius(radius) + .outerRadius(radius - border); + + var arc2 = d3.svg.arc() + .startAngle(0) + .innerRadius(radius2) + .outerRadius(radius2 - border); + + var circle = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height) + .append("g") + .attr("transform", "translate(" + (width/2) + ", " + (height/2) + ")"); + + var meter = circle.append("g") + .attr('class', 'progress-meter'); + + meter.append("path") + .attr('fill', '#000000') + .attr('fill-opacity', 0.5) + .attr('d', arc.endAngle(twoPi)); + + var meter = circle.append("g") + .attr('class', 'progress-meter'); + + meter.append("path") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('d', arc2.endAngle(twoPi)); + + var foreground = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1) + .attr('stroke', color) + .attr('stroke-opacity', 1); + + var front = circle.append("path") + .attr('fill', color) + .attr('fill-opacity', 1); + + var labelText = circle.append("text") + .attr('fill', label_color) + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", textSize) + .html(label) + .attr('text-anchor', 'middle') + .attr('dy', yPosText); + + var numberText = circle.append("text") + .attr('fill', '#000000') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", numberSize) + .attr('text-anchor', 'middle') + .attr('dy', yPosNumber); + + var percentText = circle.append("text") + .attr('fill', '#000000') + .style("font-family", "arial") + .style("font-weight", "bold") + .style("font-size", unitSize) + .text(unit) + .attr('text-anchor', 'middle') + .attr('dy', yPosUnit); + + function updateProgress(progress) { + foreground.attr('d', arc.endAngle(twoPi * progress)); + front.attr('d', arc.endAngle(twoPi * progress)); + var percent_value = Number(progress * 100); + numberText.text(percent_value.toFixed()); + } + + var progress = startPercent; + + (function loops() { + updateProgress(progress); + + if (count > 0) { + count--; + progress += step; + setTimeout(loops, 30); + } + })(); +} + +function print_donut_graph (recipient, width, height, module_data) { + var svg = d3.select(recipient) + .append("svg") + .attr("width", width) + .attr("height", height) + .append("g"); + + svg.append("g") + .attr("class", "slices"); + + var radius = 120; + var increment_y = 60; + var increment_y_padding = 25; + var text_size = 15; + var decrement_x_padding = 150; + if (width >= 500) { + radius = 160; + increment_y = 60; + text_size = 25; + increment_y_padding = 25; + decrement_x_padding = 75; + } + else if (width >= 400) { + radius = 120; + increment_y = 60; + text_size = 22; + increment_y_padding = 25; + decrement_x_padding = 75; + } + else if (width >= 300) { + radius = 80; + increment_y = 40; + text_size = 14; + increment_y_padding = 20; + decrement_x_padding = 60; + } + else if (width >= 200) { + radius = 50; + increment_y = 40; + text_size = 14; + increment_y_padding = 15; + decrement_x_padding = 45; + } + else if (width >= 100) { + radius = 20; + increment_y = 20; + text_size = 10; + increment_y_padding = 8; + decrement_x_padding = 25; + } + else { + radius = 10; + increment_y = 10; + text_size = 4; + increment_y_padding = 3; + decrement_x_padding = 5; + } + + var arc = d3.svg.arc() + .outerRadius(radius * 0.8) + .innerRadius(radius * 0.4); + + var key = function(d){ return d.data.label; }; + + var pie = d3.layout.pie() + .sort(null) + .value(function(d) { + return parseFloat(d.percent); + }); + + jQuery.each(module_data, function (key, m_d) { + svg.append("g") + .append("text") + .attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")") + .text(m_d.tag_name) + .style("font-family", "Verdana") + .style("font-size", text_size + "px"); + + increment_y -= increment_y_padding; + }); + + function donutData (){ + return module_data.map(function(m_data){ + return { label: m_data.tag_name, percent: m_data.percent, color : m_data.color} + }); + } + + print_phases(donutData()); + + function print_phases(data) { + var slice = svg.select(".slices").selectAll("path.slice") + .data(pie(data), key); + + slice.enter() + .insert("path") + .style("fill", function(d) { + return d.data.color; + }) + .attr("class", "slice") + .attr("transform", "translate(" + width / 2 + "," + (height - radius) + ")"); + + slice.transition() + .duration(0) + .attrTween("d", function(d) { + this._current = this._current || d; + var interpolate = d3.interpolate(this._current, d); + this._current = interpolate(0); + return function(t) { + return arc(interpolate(t)); + }; + }); + + slice.exit().remove(); + } } \ No newline at end of file diff --git a/pandora_console/include/help/en/help_alert_config.php b/pandora_console/include/help/en/help_alert_config.php index fec6b2a7bf..569242a5dc 100644 --- a/pandora_console/include/help/en/help_alert_config.php +++ b/pandora_console/include/help/en/help_alert_config.php @@ -58,6 +58,8 @@ Apart from the defined module macros, the following macros are also available:
  • _id_alert_ : Numerical ID of the alert (unique), used to correlate on third party software
  • _policy_ : Name of the policy the module belongs to (if applies).
  • _interval_ : Execution interval of the module.
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _target_ip_ : IP address of the target of the module.
  • _target_port_ : Port number of the target of the module.
  • _plugin_parameters_ : Plug-in Parameters of the module.
  • diff --git a/pandora_console/include/help/en/help_alert_macros.php b/pandora_console/include/help/en/help_alert_macros.php index 5382c502ab..bd303e9657 100644 --- a/pandora_console/include/help/en/help_alert_macros.php +++ b/pandora_console/include/help/en/help_alert_macros.php @@ -54,6 +54,8 @@ Besides the defined module macros, the following macros are available:
  • _target_ip_: IP address for the module’s target.
  • _target_port_: Port number for the module’s target.
  • _plugin_parameters_: Module’s Plugin parameters.
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_: Group’s contact information. Configured when the group is created.
  • _groupcustomid_: Group’s custom ID.
  • _groupother_: Other information about the group. Configured when the group is created.
  • diff --git a/pandora_console/include/help/es/help_alert_config.php b/pandora_console/include/help/es/help_alert_config.php index 5ab70b784e..056de9bcc3 100644 --- a/pandora_console/include/help/es/help_alert_config.php +++ b/pandora_console/include/help/es/help_alert_config.php @@ -63,6 +63,8 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _target_ip_ : Dirección IP del objetivo del módulo.
  • _target_port_ : Puerto del objetivo del módulo.
  • _plugin_parameters_ : Parámetros del Plug-in del módulo.
  • +
  • _server_ip_ : Ip del servidor al que el agente está asignado.
  • +
  • _server_name_ : Nombre del servidor al que el agente está asignado.
  • _groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.
  • _groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.
  • _email_tag_ : Emails asociados a los tags de módulos.
  • diff --git a/pandora_console/include/help/es/help_alert_macros.php b/pandora_console/include/help/es/help_alert_macros.php index 74efb4582b..19bc0b6f71 100644 --- a/pandora_console/include/help/es/help_alert_macros.php +++ b/pandora_console/include/help/es/help_alert_macros.php @@ -54,6 +54,8 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _target_ip_: Dirección IP del objetivo del módulo.
  • _target_port_: Puerto del objetivo del módulo.
  • _plugin_parameters_: Parámetros del plugin del módulo.
  • +
  • _server_ip_ : Ip del servidor al que el agente está asignado.
  • +
  • _server_name_ : Nombre del servidor al que el agente está asignado.
  • _groupcontact_: Información de contacto del grupo. Se configura al crear el grupo.
  • _groupcustomid_: ID personalizado del grupo.
  • _groupother_: Otra información sobre el grupo. Se configura al crear el grupo.
  • diff --git a/pandora_console/include/help/ja/help_alert_config.php b/pandora_console/include/help/ja/help_alert_config.php index 592ed64ee3..fa6a68ffa2 100644 --- a/pandora_console/include/help/ja/help_alert_config.php +++ b/pandora_console/include/help/ja/help_alert_config.php @@ -62,6 +62,8 @@ email アクションを設定するには、_field1_ (送信先アドレス)、
  • _target_ip_ : モジュールの対象IPアドレス
  • _target_port_ : モジュールの対象ポート
  • _plugin_parameters_ : モジュールのプラグインパラメータ
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_ : グループコンタクト情報。グループの作成時に設定されます。
  • _groupother_ : グループに関するその他情報。グループの作成時に設定されます。
  • _email_tag_ : モジュールタグに関連付けられた Email。
  • diff --git a/pandora_console/include/help/ja/help_alert_macros.php b/pandora_console/include/help/ja/help_alert_macros.php index c9729e6bfd..86e3a04c96 100644 --- a/pandora_console/include/help/ja/help_alert_macros.php +++ b/pandora_console/include/help/ja/help_alert_macros.php @@ -54,6 +54,8 @@
  • _target_ip_ : モジュールの対象IPアドレス
  • _target_port_ : モジュールの対象ポート
  • _plugin_parameters_ : モジュールのプラグインパラメータ
  • +
  • _server_ip_ : Ip of server assigned to agent.
  • +
  • _server_name_ : Name of server assigned to agent.
  • _groupcontact_ : グループコンタクト情報。グループの作成時に設定されます。
  • _groupcustomid_: グループカスタムID
  • _groupother_ : グループに関するその他情報。グループの作成時に設定されます。
  • diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index a9c36700a8..fd519519ad 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -307,7 +307,12 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -342,7 +347,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -365,7 +376,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -400,7 +417,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -425,7 +448,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -460,7 +489,13 @@ function change_shape(id_db_node) { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); } @@ -618,6 +653,30 @@ function add_new_link(new_link) { graph.links.push(new_link); } +function move_to_networkmap (node) { + var params = []; + params.push("get_networkmap_from_fictional=1"); + params.push("id=" + node.id_db); + params.push("id_map=" + node.map_id); + params.push("page=enterprise/operation/agentes/pandora_networkmap.view"); + + jQuery.ajax ({ + data: params.join ("&"), + dataType: 'json', + type: 'POST', + url: action="ajax.php", + success: function (data) { + if (data['correct']) { + window.location="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=" + data['id_networkmap']; + } + else { + edit_node(node, true); + } + } + }); +} + + function edit_node(data_node, dblClick) { if (enterprise_installed) { var flag_edit_node = true; @@ -3173,7 +3232,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3207,7 +3272,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3235,7 +3306,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3273,7 +3350,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3303,7 +3386,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); @@ -3341,7 +3430,13 @@ function draw_elements_graph() { }) .on("click", selected_node) .on("dblclick", function (d) { - edit_node(d, true); + if (d.type == 3) { + move_to_networkmap(d); + } + else { + edit_node(d, true); + } + }) .on("contextmenu", function (d) { show_menu("node", d); }); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index fcf084085b..beb53d61d7 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -769,6 +769,12 @@ input.graph_min { input.graph_min[disabled] { background: #fefefe url(../../images/chart_curve.disabled.png) no-repeat center !important; } +input.bars_graph_min { + background: #fefefe url(../../images/icono-barras-arriba.png) no-repeat center !important; +} +input.bars_graph_min[disabled] { + background: #fefefe url(../../images/icono-barras-arriba.disabled.png) no-repeat center !important; +} input.percentile_min { background: #fefefe url(../../images/chart_bar.png) no-repeat center !important; } @@ -787,6 +793,12 @@ input.auto_sla_graph_min { input.auto_sla_graph_min[disabled] { background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat center !important; } +input.donut_graph_min { + background: #fefefe url(../../images/icono-quesito.png) no-repeat center !important; +} +input.donut_graph_min[disabled] { + background: #fefefe url(../../images/icono-quesito.disabled.png) no-repeat center !important; +} input.binary_min { background: #fefefe url(../../images/binary.png) no-repeat center !important; } @@ -2399,29 +2411,61 @@ span#plugin_description { font-size: 14pt !important; line-height: 14pt; } +.visual_font_size_18pt, .visual_font_size_18pt > em , .visual_font_size_18pt > strong, .visual_font_size_18pt > strong > span, .visual_font_size_18pt > span, .visual_font_size_18pt > strong > em, .visual_font_size_18pt > em > strong, .visual_font_size_18pt em span, .visual_font_size_18pt span em { + font-size: 18pt !important; + line-height: 18pt; +} + .visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em { font-size: 24pt !important; line-height: 24pt; } +.visual_font_size_28pt, .visual_font_size_28pt > em, .visual_font_size_28pt > strong, .visual_font_size_28pt > strong > span , .visual_font_size_28pt > span, .visual_font_size_28pt > strong > em, .visual_font_size_28pt > em > strong, .visual_font_size_28pt em span, .visual_font_size_28pt span em { + font-size: 28pt !important; + line-height: 28pt; +} .visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em { font-size: 36pt !important; line-height: 36pt; } +.visual_font_size_48pt, .visual_font_size_48pt > em, .visual_font_size_48pt > strong, .visual_font_size_48pt > strong > span, .visual_font_size_48pt > span, .visual_font_size_48pt > strong > em, .visual_font_size_48pt > em > strong, .visual_font_size_48pt em span, .visual_font_size_48pt span em { + font-size: 48pt !important; + line-height: 48pt; +} +.visual_font_size_60pt, .visual_font_size_60pt > em, .visual_font_size_60pt > strong, .visual_font_size_60pt > strong > span, .visual_font_size_60pt > span, .visual_font_size_60pt > strong > em, .visual_font_size_60pt > em > strong, .visual_font_size_60pt em span, .visual_font_size_60pt span em { + font-size: 60pt !important; + line-height: 60pt; +} .visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em { font-size: 72pt !important; line-height: 72pt; } +.visual_font_size_84pt, .visual_font_size_84pt > em, .visual_font_size_84pt > strong, .visual_font_size_84pt > strong > span, .visual_font_size_84pt > span, .visual_font_size_84pt > strong > em, .visual_font_size_84pt > em > strong, .visual_font_size_84pt em span, .visual_font_size_84pt span em { + font-size: 84pt !important; + line-height: 84pt; +} + .visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em { font-size: 96pt !important; line-height: 96pt; } +.visual_font_size_116pt, .visual_font_size_116pt > em, .visual_font_size_116pt > strong, .visual_font_size_116pt > strong > span, .visual_font_size_116pt > span, .visual_font_size_116pt > strong > em, .visual_font_size_116pt > em > strong, .visual_font_size_116pt em span, .visual_font_size_116pt span em { + font-size: 116pt !important; + line-height: 116pt; +} + .visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em { font-size: 128pt !important; line-height: 128pt; } +.visual_font_size_140pt, .visual_font_size_140pt > em, .visual_font_size_140pt > strong, .visual_font_size_140pt > strong > span, .visual_font_size_140pt > span, .visual_font_size_140pt > strong > em, .visual_font_size_140pt > em > strong, .visual_font_size_140pt em span, .visual_font_size_140pt span em { + font-size: 140pt !important; + line-height: 140pt; +} + .visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em { font-size: 154pt !important; line-height: 154pt; diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index 3dca8bdbf9..eb21ec4233 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -541,7 +541,7 @@ a:focus, input:focus, button:focus { outline: 0; } -DIV.login_links { +/*DIV.login_links { margin: 10px 0px 0px; color: #FFF; text-align: center; @@ -651,7 +651,7 @@ input.login { } input.login_user { - /* Browser without multibackground support */ + color: #373737 !important; padding-left: 8px; width: 179px; @@ -660,12 +660,14 @@ input.login_user { } input.login_password { - /* Browser without multibackground support */ + padding-left: 8px; width: 179px; color: #222; height: 20px; } +*/ + .databox_error { width: 657px !important; height: 400px; @@ -2318,7 +2320,7 @@ ul.operation li a:hover { -o-transition-property: background-color; -o-transition-duration: 0.5s; -o-transition-timing-function: ease-out; - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .submenu_not_selected:hover{ transition-property: background-color; @@ -2333,11 +2335,11 @@ ul.operation li a:hover { -o-transition-property: background-color; -o-transition-duration: 0.5s; -o-transition-timing-function: ease-out; - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .submenu_selected:hover{ - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .sub_subMenu{ @@ -2365,7 +2367,7 @@ ul.operation li a:hover { -moz-transition-timing-function: ease-out; -o-transition-property: background-color; -o-transition-duration: 0.5s; - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .submenu_text { @@ -2373,7 +2375,7 @@ ul.operation li a:hover { } .menu li.selected { - box-shadow: inset 4px 0 #82b92e; + box-shadow: inset 4px 0 #b1b1b1; } li.links a:hover { @@ -2393,7 +2395,7 @@ li.links a:hover { } .operation .selected { - background-color: #585858 !important; + background-color: #b1b1b1 !important; } .menu li, .menu .li.not_selected { @@ -2455,29 +2457,59 @@ span#plugin_description { font-size: 14pt !important; line-height: 14pt; } +.visual_font_size_18pt, .visual_font_size_18pt > em , .visual_font_size_18pt > strong, .visual_font_size_18pt > strong > span, .visual_font_size_18pt > span, .visual_font_size_18pt > strong > em, .visual_font_size_18pt > em > strong, .visual_font_size_18pt em span, .visual_font_size_18pt span em { + font-size: 18pt !important; + line-height: 18pt; +} .visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em { font-size: 24pt !important; line-height: 24pt; } +.visual_font_size_28pt, .visual_font_size_28pt > em, .visual_font_size_28pt > strong, .visual_font_size_28pt > strong > span , .visual_font_size_28pt > span, .visual_font_size_28pt > strong > em, .visual_font_size_28pt > em > strong, .visual_font_size_28pt em span, .visual_font_size_28pt span em { + font-size: 28pt !important; + line-height: 28pt; +} .visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em { font-size: 36pt !important; line-height: 36pt; } +.visual_font_size_48pt, .visual_font_size_48pt > em, .visual_font_size_48pt > strong, .visual_font_size_48pt > strong > span, .visual_font_size_48pt > span, .visual_font_size_48pt > strong > em, .visual_font_size_48pt > em > strong, .visual_font_size_48pt em span, .visual_font_size_48pt span em { + font-size: 48pt !important; + line-height: 48pt; +} +.visual_font_size_60pt, .visual_font_size_60pt > em, .visual_font_size_60pt > strong, .visual_font_size_60pt > strong > span, .visual_font_size_60pt > span, .visual_font_size_60pt > strong > em, .visual_font_size_60pt > em > strong, .visual_font_size_60pt em span, .visual_font_size_60pt span em { + font-size: 60pt !important; + line-height: 60pt; +} .visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em { font-size: 72pt !important; line-height: 72pt; } +.visual_font_size_84pt, .visual_font_size_84pt > em, .visual_font_size_84pt > strong, .visual_font_size_84pt > strong > span, .visual_font_size_84pt > span, .visual_font_size_84pt > strong > em, .visual_font_size_84pt > em > strong, .visual_font_size_84pt em span, .visual_font_size_84pt span em { + font-size: 84pt !important; + line-height: 84pt; +} .visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em { font-size: 96pt !important; line-height: 96pt; } +.visual_font_size_116pt, .visual_font_size_116pt > em, .visual_font_size_116pt > strong, .visual_font_size_116pt > strong > span, .visual_font_size_116pt > span, .visual_font_size_116pt > strong > em, .visual_font_size_116pt > em > strong, .visual_font_size_116pt em span, .visual_font_size_116pt span em { + font-size: 116pt !important; + line-height: 116pt; +} + .visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em { font-size: 128pt !important; line-height: 128pt; } +.visual_font_size_140pt, .visual_font_size_140pt > em, .visual_font_size_140pt > strong, .visual_font_size_140pt > strong > span, .visual_font_size_140pt > span, .visual_font_size_140pt > strong > em, .visual_font_size_140pt > em > strong, .visual_font_size_140pt em span, .visual_font_size_140pt span em { + font-size: 140pt !important; + line-height: 140pt; +} + .visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em { font-size: 154pt !important; line-height: 154pt; @@ -2485,7 +2517,7 @@ span#plugin_description { .visual_font_size_196pt, .visual_font_size_196pt > em, .visual_font_size_196pt > strong, .visual_font_size_196pt > strong > span, .visual_font_size_196pt > span, .visual_font_size_196pt > strong > em, .visual_font_size_196pt > em > strong, .visual_font_size_196pt em span, .visual_font_size_196pt span em { font-size: 196pt !important; - line-height: 196pt; + line-height: 196pt; } @@ -3439,11 +3471,375 @@ color:#82b92e;font-family:Nunito;font-size:10pt;position:relative;top:6px; } .rowPair:hover, .rowOdd:hover{ - background-color: #eee; + background-color: #3f3f3f; } .databox.data > tbody > tr:hover{ - background-color: #eee; + background-color: #3f3f3f; } .checkselected{ background-color: #eee; +} + +#login_help_dialog *{ + color: #222222; +} + +.introjs-tooltip *{ + color: #222222; +} + +.dd_widget_content *{ + color: #222222; +} + +#dialog_add_new_widget *{ + color: #222222; +} + +.widget_configuration_form table tbody tr td:first-child{ + color: #222222; +} + +.widget_configuration_form .container *{ + color: #222222; +} +.widget_configuration_form b{ + color: #222222; +} + +form[action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'] *{ + color: #222222; +} + +form[action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'] input{ + color: white; +} + +form[action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'] select{ + color: white; +} +.notify { + color: black; +} +.notify *{ + color: black; +} +#login_logout *{ + color: #222222; +} + +/*modal windows login*/ +div.content_alert{ + width: 98%; + margin-top: 20px; +} + +div.icon_message_alert{ + float: left; + width: 25%; + text-align: center; + +} + +div.icon_message_alert img{ + width: 85px; +} + +div.content_message_alert{ + + width: 75%; + float: right; +} + +div.text_message_alert{ + width: 100%; + margin-top: 10px; +} + +div.text_message_alert h1{ + margin: 0px; +} + +div.text_message_alert p{ + margin: 0px; + font-size: 10.3pt; + line-height: 14pt; +} + +div.button_message_alert{ + width: 100%; +} + +div.button_message_alert input{ + float: right; + width: 87px; + height: 33px; + color: #82b92e; + border: 1px solid #82b92e; + font-weight: bold; + margin-right: 20px; + margin-top: 20px; + font-size: 10pt; +} + +div.form_message_alert{ + width: 90%; + clear: both; + padding-top: 20px; + padding-left: 40px; +} + +div.form_message_alert ul li{ + display: inline-block; + padding: 10px; +} + +div.form_message_alert ul li input{ + border: none; + background-color: #dadada !important; + border-radius: 0px; + height: 17px; + width: 145px; + padding-left: 5px; +} + +div.form_message_alert ul li label{ + font-size: 10pt; + padding-right: 20px; +} + +div.form_message_alert h4{ + margin: 0px; + margin-bottom: 10px; +} + +div.button_message_alert_form input{ + float: right; + width: 87px; + height: 33px; + color: #82b92e; + border: 1px solid #82b92e; + font-weight: bold; + font-size: 10pt; + margin-right: 25px; +} + +.ui-dialog .ui-dialog-titlebar { + background-color: #82b92e !important; +} + +/* + styles header login +*/ +div#header_login{ + width: 100%; + height: 65px; + background-color: rgba(255, 255, 255, 0.06); +} + +div#icon_custom_pandora{ + float: left; + margin-top: 5px; + margin-left: 4%; +} + +div#list_icon_docs_support{ + float: right; + margin-top: 8px; + margin-right: 4%; +} + +div#list_icon_docs_support ul{ + margin-top: 5px; +} + +div#list_icon_docs_support ul li{ + display: inline-block; + color:white; + vertical-align: middle; + margin-right: 5px; + font-size: 10pt; +} + +li#li_margin_left{ + margin-left: 30px; +} + +/* + styles login form +*/ + +div.container_login{ + margin-top: 10%; + margin-left: 5%; + margin-right: 5%; + +} + +div.login_page { + width: 35%; + min-height: 600px; + float:left; +} + +div.login_page form { + border-right:1px solid #868686; + padding-top: 30px; + padding-bottom: 50px; + min-width: 400px; + max-height: 600px; +} + +div.login_logo_icon { + margin-bottom: 40px; + text-align: center; +} + +div.login_logo_icon img{ + margin: 0 auto; + width: 150px; +} +div.login_double_auth_code, +div.login_nick, +div.login_pass { + margin: 0 auto; + width: 70%; + height: 40px; + background-color: rgba(255, 255, 255, 0.20) !important; + margin-bottom: 25px; + min-width: 260px; +} + +div.login_nick img, +div.login_pass img{ + vertical-align: middle; + margin: 3px; +} + + +div.login_nick input, +div.login_pass input{ + background-color: rgba(255, 255, 255, 0.00) !important; + border:0px !important; + color:white !important; + border-radius: 0px; + width: 89%; + height: 40px; + font-size: 9pt; + padding: 0px !important; +} + + +div.login_nick input:focus, +div.login_pass input:focus{ + outline: none; +} + +div.login_nick input:-webkit-autofill, +div.login_nick input:-webkit-autofill:hover, +div.login_nick input:-webkit-autofill:focus, +div.login_nick input:-webkit-autofill:active, +div.login_pass input:-webkit-autofill, +div.login_pass input:-webkit-autofill:hover, +div.login_pass input:-webkit-autofill:focus, +div.login_pass input:-webkit-autofill:active { + transition: background-color 10000s ease-in-out 0s; + -webkit-box-shadow: 0 0 0px 0px transparent inset !important; + -webkit-text-fill-color: white !important; + border:0px; + width: 89%; +} + +div.login_nick input::-webkit-input-placeholder, +div.login_pass input::-webkit-input-placeholder { + color:white; +} + +div.login_pass img, +div.login_nick img{ + width: 30px; +} + +div.login_pass div, +div.login_nick div{ + float: left; + width: 11%; +} + +div.login_button{ + margin: 0 auto; + width: 70%; + height: 40px; + background-color: rgb(25, 25, 25); + border: 1px solid white; + min-width: 260px; +} + +div.login_button input { + width: 100%; + background-color: rgb(25, 25, 25) !important; + text-align: center; + border:0px; + border-radius: 0px; + height: 40px; + padding: 0px; + font-size: 9pt; + color: white; +} + +div.login_data { + width: 65%; + min-height: 600px; + float:left; +} + +div.text_banner_login{ + width: 100%; + margin-bottom: 60px; + color: white; + text-align: center; +} + +div.text_banner_login span{ + width: 100%; +} + +span.span1{ + font-size: 3vw; + font-family: 'lato-thin'; + color: white; +} + +span.span2{ + font-size: 3vw; + font-family: 'lato-bolder'; + color: white; +} + +div.img_banner_login{ + width: 100%; + text-align: center; +} + +div.img_banner_login img{ + max-width: 70%; + min-width: 70%; + max-height: 50%; + min-height: 50%; +} + +@media all and (max-width: 1200px) { + span.span1{ + font-size: 30pt; + } + span.span2{ + font-size: 30pt; + } +} + +.new_task p, .new_task h3, .new_task h2, .new_task a{ + color: #222222; +} +.item p { + color: #222222; } \ No newline at end of file diff --git a/pandora_console/include/styles/pandora_green_old.css b/pandora_console/include/styles/pandora_green_old.css index e983e6047d..a99a9a275d 100644 --- a/pandora_console/include/styles/pandora_green_old.css +++ b/pandora_console/include/styles/pandora_green_old.css @@ -2435,53 +2435,97 @@ span#plugin_description { #tinymce { text-align: left; } + .visual_font_size_4pt, .visual_font_size_4pt > em, .visual_font_size_4pt > strong, .visual_font_size_4pt > strong > span, .visual_font_size_4pt > span, .visual_font_size_4pt > strong > em, .visual_font_size_4pt > em > strong, .visual_font_size_4pt em span, .visual_font_size_4pt span em { font-size: 4pt !important; line-height: 4pt; } + .visual_font_size_6pt, .visual_font_size_6pt > em, .visual_font_size_6pt > strong, .visual_font_size_6pt > strong > span, .visual_font_size_6pt > span, .visual_font_size_6pt > strong > em, .visual_font_size_6pt > em > strong, .visual_font_size_6pt em span, .visual_font_size_6pt span em { font-size: 6pt !important; line-height: 6pt; } + .visual_font_size_8pt, .visual_font_size_8pt > em, .visual_font_size_8pt > strong, .visual_font_size_8pt > strong > span , .visual_font_size_8pt > span, .visual_font_size_8pt > strong > em, .visual_font_size_8pt > em > strong, .visual_font_size_8pt em span, .visual_font_size_8pt span em { font-size: 8pt !important; line-height: 8pt; } + .visual_font_size_10pt, .visual_font_size_10pt > em , .visual_font_size_10pt > strong, .visual_font_size_10pt > strong > em, .visual_font_size_10pt > em > strong, .visual_font_size_10pt em span, .visual_font_size_10pt span em { font-size: 10pt !important; line-height: 10pt; } + .visual_font_size_12pt, .visual_font_size_12pt > em , .visual_font_size_12pt > strong, .visual_font_size_12pt > strong > em, .visual_font_size_12pt > em > strong, .visual_font_size_12pt em span, .visual_font_size_12pt span em { font-size: 12pt !important; line-height: 12pt; } + .visual_font_size_14pt, .visual_font_size_14pt > em , .visual_font_size_14pt > strong, .visual_font_size_14pt > strong > span, .visual_font_size_14pt > span, .visual_font_size_14pt > strong > em, .visual_font_size_14pt > em > strong, .visual_font_size_14pt em span, .visual_font_size_14pt span em { font-size: 14pt !important; line-height: 14pt; } + +.visual_font_size_18pt, .visual_font_size_18pt > em , .visual_font_size_18pt > strong, .visual_font_size_18pt > strong > span, .visual_font_size_18pt > span, .visual_font_size_18pt > strong > em, .visual_font_size_18pt > em > strong, .visual_font_size_18pt em span, .visual_font_size_18pt span em { + font-size: 18pt !important; + line-height: 18pt; +} + .visual_font_size_24pt, .visual_font_size_24pt > em, .visual_font_size_24pt > strong, .visual_font_size_24pt > strong > span , .visual_font_size_24pt > span, .visual_font_size_24pt > strong > em, .visual_font_size_24pt > em > strong, .visual_font_size_24pt em span, .visual_font_size_24pt span em { font-size: 24pt !important; line-height: 24pt; } + +.visual_font_size_28pt, .visual_font_size_28pt > em, .visual_font_size_28pt > strong, .visual_font_size_28pt > strong > span , .visual_font_size_28pt > span, .visual_font_size_28pt > strong > em, .visual_font_size_28pt > em > strong, .visual_font_size_28pt em span, .visual_font_size_28pt span em { + font-size: 28pt !important; + line-height: 28pt; +} + .visual_font_size_36pt, .visual_font_size_36pt > em, .visual_font_size_36pt > strong, .visual_font_size_36pt > strong > span, .visual_font_size_36pt > span, .visual_font_size_36pt > strong > em, .visual_font_size_36pt > em > strong, .visual_font_size_36pt em span, .visual_font_size_36pt span em { font-size: 36pt !important; line-height: 36pt; } + +.visual_font_size_48pt, .visual_font_size_48pt > em, .visual_font_size_48pt > strong, .visual_font_size_48pt > strong > span, .visual_font_size_48pt > span, .visual_font_size_48pt > strong > em, .visual_font_size_48pt > em > strong, .visual_font_size_48pt em span, .visual_font_size_48pt span em { + font-size: 48pt !important; + line-height: 48pt; +} + +.visual_font_size_60pt, .visual_font_size_60pt > em, .visual_font_size_60pt > strong, .visual_font_size_60pt > strong > span, .visual_font_size_60pt > span, .visual_font_size_60pt > strong > em, .visual_font_size_60pt > em > strong, .visual_font_size_60pt em span, .visual_font_size_60pt span em { + font-size: 60pt !important; + line-height: 60pt; +} + .visual_font_size_72pt, .visual_font_size_72pt > em, .visual_font_size_72pt > strong, .visual_font_size_72pt > strong > span, .visual_font_size_72pt > span, .visual_font_size_72pt > strong > em, .visual_font_size_72pt > em > strong, .visual_font_size_72pt em span, .visual_font_size_72pt span em { font-size: 72pt !important; line-height: 72pt; } +.visual_font_size_84pt, .visual_font_size_84pt > em, .visual_font_size_84pt > strong, .visual_font_size_84pt > strong > span, .visual_font_size_84pt > span, .visual_font_size_84pt > strong > em, .visual_font_size_84pt > em > strong, .visual_font_size_84pt em span, .visual_font_size_84pt span em { + font-size: 84pt !important; + line-height: 84pt; +} + .visual_font_size_96pt, .visual_font_size_96pt > em, .visual_font_size_96pt > strong, .visual_font_size_96pt > strong > span, .visual_font_size_96pt > span, .visual_font_size_96pt > strong > em, .visual_font_size_96pt > em > strong, .visual_font_size_96pt em span, .visual_font_size_96pt span em { font-size: 96pt !important; line-height: 96pt; } +.visual_font_size_116pt, .visual_font_size_116pt > em, .visual_font_size_116pt > strong, .visual_font_size_116pt > strong > span, .visual_font_size_116pt > span, .visual_font_size_116pt > strong > em, .visual_font_size_116pt > em > strong, .visual_font_size_116pt em span, .visual_font_size_116pt span em { + font-size: 116pt !important; + line-height: 116pt; +} + .visual_font_size_128pt, .visual_font_size_128pt > em, .visual_font_size_128pt > strong, .visual_font_size_128pt > strong > span, .visual_font_size_128pt > span, .visual_font_size_128pt > strong > em, .visual_font_size_128pt > em > strong, .visual_font_size_128pt em span, .visual_font_size_128pt span em { font-size: 128pt !important; line-height: 128pt; } +.visual_font_size_140pt, .visual_font_size_140pt > em, .visual_font_size_140pt > strong, .visual_font_size_140pt > strong > span, .visual_font_size_140pt > span, .visual_font_size_140pt > strong > em, .visual_font_size_140pt > em > strong, .visual_font_size_140pt em span, .visual_font_size_140pt span em { + font-size: 140pt !important; + line-height: 140pt; +} + .visual_font_size_154pt, .visual_font_size_154pt > em, .visual_font_size_154pt > strong, .visual_font_size_154pt > strong > span, .visual_font_size_154pt > span, .visual_font_size_154pt > strong > em, .visual_font_size_154pt > em > strong, .visual_font_size_154pt em span, .visual_font_size_154pt span em { font-size: 154pt !important; line-height: 154pt; diff --git a/pandora_console/install.php b/pandora_console/install.php index e23846f4ab..942ec21efb 100755 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
    '; $data[0] .= ''; - if ($agent['quiet']) { - $data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . " "; - } $data[0] .= ' '.$agent["alias"].''; $data[0] .= ''; + + if ($agent['quiet']) { + $data[0] .= " "; + $data[0] .= html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")); + } + + if ($in_planned_downtime) { + $data[0] .= ui_print_help_tip (__('Agent in planned downtime'), true, 'images/minireloj-16.png'); + $data[0] .= ""; + } + $data[0] .= '
    '; $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt'); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 80a891b38e..78f3dd06a4 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -74,7 +74,12 @@ $table_agent->data = array(); $data = array(); $agent_name = ui_print_agent_name($agent["id_agente"], true, 500, "font-size: medium;font-weight:bold", true); -$in_planned_downtime = db_get_value_filter('id', 'tplanned_downtime_agents', array('id_agent' => $agent["id_agente"])); +$in_planned_downtime = db_get_sql('SELECT executed FROM tplanned_downtime + INNER JOIN tplanned_downtime_agents + ON tplanned_downtime.id = tplanned_downtime_agents.id_downtime + WHERE tplanned_downtime_agents.id_agent = '. $agent["id_agente"] . + ' AND tplanned_downtime.executed = 1'); + if ($agent['disabled']) { if ($in_planned_downtime) { diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index ff1d7bf9e3..e33d499fe8 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -38,8 +38,8 @@ $start_date = get_parameter ("start_date", date("Y-m-d")); $draw_events = get_parameter ("draw_events", 0); $modules = get_parameter('modules', array()); $filter = get_parameter('filter', 0); -$combined = (bool)get_parameter('combined', 1); - +$combined = get_parameter('combined', 1); +$option_type = get_parameter('option_type', 0); //---------------------------------------------------------------------- // Get modules of agent sorted as: @@ -159,7 +159,6 @@ $table->data[0][1] = html_print_select($list_modules, 'modules[]', $table->rowspan[2][0] = 7; $table->data[2][0] = ""; - $table->data[2][1] = __('Begin date'); $table->data[2][2] = html_print_input_text ("start_date", substr ($start_date, 0, 10),'', 10, 40, true); $table->data[2][2] .= html_print_image ("images/calendar_view_day.png", true, array ("onclick" => "scwShow(scwID('text-start_date'),this);")); @@ -174,12 +173,17 @@ $table->data[5][2] = __('Show alerts') . ui_print_help_tip(__('the combined graph does not show the alerts into this graph'), true); $table->data[5][3] = html_print_checkbox ("draw_alerts", 1, (bool) $draw_alerts, true); $table->data[6][2] = __('Show as one combined graph'); -$table->data[6][3] = - html_print_radio_button('combined', 1, __('one combined graph'), - $combined, true); -$table->data[6][3] .= - html_print_radio_button('combined', 0, __('several graphs for each module'), - $combined, true); +$graph_option_one_or_several = array(0 => __('several graphs for each module'), 1 => __('One combined graph')); +$table->data[6][3] = html_print_select($graph_option_one_or_several, 'combined', $combined, '', '', 1, true); + +$table->data[7][2] = __('Chart type'); +if ($combined == 1) { + $graph_option_type = array(0 => __('Area'), 1 => __('Area stack'), 2 => __('Line'), 3 => __('Line stack')); +} +else { + $graph_option_type = array(0 => __('Area'), 2 => __('Line')); +} +$table->data[7][3] = html_print_select($graph_option_type, 'option_type', $option_type, '', '', 1, true); $htmlForm = '
    '; $htmlForm .= html_print_table($table, true); @@ -321,6 +325,39 @@ echo "
    "; // Load graphs $(document).ready(function() { + $('#combined').change(function () { + if ($('#combined').val() == 1) { + $('#option_type').empty(); + $('#option_type').append($('