Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop

This commit is contained in:
fbsanchez 2015-09-14 10:51:56 +02:00
commit f2b33dea9d
44 changed files with 513 additions and 125 deletions

View File

@ -41,6 +41,7 @@ SERVER_DB_FILE="$CODEHOME/pandora_server/util/pandora_db.pl"
SERVER_CLI_FILE="$CODEHOME/pandora_server/util/pandora_manage.pl" SERVER_CLI_FILE="$CODEHOME/pandora_server/util/pandora_manage.pl"
SERVER_CONF_FILE="$CODEHOME/pandora_server/conf/pandora_server.conf.new" SERVER_CONF_FILE="$CODEHOME/pandora_server/conf/pandora_server.conf.new"
CONSOLE_DB_FILE="$CODEHOME/pandora_console/pandoradb_data.sql" CONSOLE_DB_FILE="$CODEHOME/pandora_console/pandoradb_data.sql"
CONSOLE_DB_FILE_ORACLE="$CODEHOME/pandora_console/pandoradb.data.oracle.sql"
CONSOLE_FILE="$CODEHOME/pandora_console/include/config_process.php" CONSOLE_FILE="$CODEHOME/pandora_console/include/config_process.php"
CONSOLE_INSTALL_FILE="$CODEHOME/pandora_console/install.php" CONSOLE_INSTALL_FILE="$CODEHOME/pandora_console/install.php"
AGENT_BASE_DIR="$CODEHOME/pandora_agents/" AGENT_BASE_DIR="$CODEHOME/pandora_agents/"
@ -104,8 +105,12 @@ sed -e "s/\s*use constant SATELLITE_BUILD.*/use constant SATELLITE_BUILD \=\> \"
# Pandora Console # Pandora Console
echo "Updating Pandora Console DB version..." echo "Updating Pandora Console DB version..."
sed -e "s/\s*[(]\s*'db_scheme_version'\s*\,.*/('db_scheme_version'\,'$VERSION'),/" "$CONSOLE_DB_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE" sed -e "s/\s*[(]\s*'db_scheme_version'\s*\,.*/('db_scheme_version'\,'$VERSION'),/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE"
sed -e "s/\s*[(]\s*'db_scheme_build'\s*\,.*/('db_scheme_build'\,'PD$BUILD'),/" "$CONSOLE_DB_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE" sed -e "s/\s*[(]\s*'db_scheme_build'\s*\,.*/('db_scheme_build'\,'PD$BUILD'),/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE"
sed -e "s/\s*[(]\s*'db_scheme_version'\s*\,.*/('db_scheme_version'\,'$VERSION');/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE"
sed -e "s/\s*[(]\s*'db_scheme_build'\s*\,.*/('db_scheme_build'\,'PD$BUILD');/" "$CONSOLE_DB_FILE_ORACLE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_DB_FILE_ORACLE"
echo "Updating Pandora Console version..." echo "Updating Pandora Console version..."
sed -e "s/\s*\$pandora_version\s*=.*/\$pandora_version = 'v$VERSION';/" "$CONSOLE_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_FILE" sed -e "s/\s*\$pandora_version\s*=.*/\$pandora_version = 'v$VERSION';/" "$CONSOLE_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_FILE"
sed -e "s/\s*\$build_version\s*=.*/\$build_version = 'PC$BUILD';/" "$CONSOLE_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_FILE" sed -e "s/\s*\$build_version\s*=.*/\$build_version = 'PC$BUILD';/" "$CONSOLE_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$CONSOLE_FILE"
@ -137,4 +142,3 @@ for conf in `find $AGENT_BASE_DIR -name pandora_agent.conf`; do
done done
rm -f "$TEMP_FILE" rm -f "$TEMP_FILE"

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 6.0RC1-150908 Version: 6.0RC1-150914
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0RC1'; use constant AGENT_VERSION => '6.0RC1';
use constant AGENT_BUILD => '150908'; use constant AGENT_BUILD => '150914';
# Commands to retrieve total memory information in kB # Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0RC1 %define version 6.0RC1
%define release 150908 %define release 150914
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 6.0RC1 %define version 6.0RC1
%define release 150908 %define release 150914
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{150908} {150914}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -21,6 +21,8 @@
#include "pandora_module_exec.h" #include "pandora_module_exec.h"
#include "../pandora_strutils.h" #include "../pandora_strutils.h"
#include <windows.h> #include <windows.h>
#include <fstream>
#include <map>
#define BUFSIZE 4096 #define BUFSIZE 4096
@ -39,6 +41,46 @@ Pandora_Module_Exec::Pandora_Module_Exec (string name, string exec)
this->module_exec = "cmd.exe /c \"" + exec + "\""; this->module_exec = "cmd.exe /c \"" + exec + "\"";
this->proc = 0; this->proc = 0;
this->setKind (module_exec_str); this->setKind (module_exec_str);
this->native_encoding = -1;
}
/**
* Creates a Pandora_Module_Exec object.
*
* @param name Module name
* @param exec Command to be executed.
* @param native indicates an output conversion
*/
Pandora_Module_Exec::Pandora_Module_Exec (string name, string exec, string native)
: Pandora_Module (name) {
this->module_exec = "cmd.exe /c \"" + exec + "\"";
this->proc = 0;
this->setKind (module_exec_str);
if (native.c_str () != ""){
getOutputEncoding();
while (native[0] == ' ') { //remove begin whitespaces
native = native.substr( 1, native.length ());
}
if (!native.compare ("ANSI")){
this->native_encoding = GetACP ();
} else if (!native.compare ("OEM")){
this->native_encoding = GetOEMCP ();
} else if (!native.compare ("UTFLE")){
this->native_encoding = 1200; //UTF-16 little-endian code page
} else if (!native.compare ("UTFBE")){
this->native_encoding = 1201; //UTF-16 big-endian code page
} else {
this->native_encoding = -1;
pandoraDebug("module_native %s in %s module is not a properly encoding",
native.c_str (), name.c_str ());
}
} else {
this->output_encoding = "";
this->native_encoding = -1;
}
} }
void void
@ -106,6 +148,9 @@ Pandora_Module_Exec::run () {
to find the GNU W32 tools */ to find the GNU W32 tools */
working_dir = getPandoraInstallDir () + "util\\"; working_dir = getPandoraInstallDir () + "util\\";
/*always change input from UTF-8 to ANSI*/
changeInputEncoding();
/* Create the child process. */ /* Create the child process. */
if (! CreateProcess (NULL, (CHAR *) this->module_exec.c_str (), NULL, if (! CreateProcess (NULL, (CHAR *) this->module_exec.c_str (), NULL,
NULL, TRUE, CREATE_SUSPENDED | CREATE_NO_WINDOW, NULL, NULL, TRUE, CREATE_SUSPENDED | CREATE_NO_WINDOW, NULL,
@ -136,6 +181,11 @@ Pandora_Module_Exec::run () {
output += (char *) buffer; output += (char *) buffer;
} }
/* Change the output encoding */
if (this->native_encoding != -1){
changeOutputEncoding(&output);
}
if (dwRet == WAIT_OBJECT_0) { if (dwRet == WAIT_OBJECT_0) {
break; break;
} else if(this->getTimeout() < GetTickCount() - tickbase) { } else if(this->getTimeout() < GetTickCount() - tickbase) {
@ -186,3 +236,240 @@ Pandora_Module_Exec::run () {
CloseHandle (out_read); CloseHandle (out_read);
} }
UINT Pandora_Module_Exec::getNumberEncoding (string encoding){
map<string,UINT> code_pages;
//Code page from https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
//The key has been copied from .NET Name column
code_pages["IBM037"] = 37;
code_pages["IBM437"] = 437;
code_pages["IBM500"] = 500;
code_pages["ASMO-708"] = 708;
code_pages["ASMO-449+"] = 709; //Name of Information column
//710 not .NET name
code_pages["COD-720"] = 720;
code_pages["IBM737"] = 737;
code_pages["IBM775"] = 775;
code_pages["IBM850"] = 850;
code_pages["IBM852"] = 850;
code_pages["IBM855"] = 855;
code_pages["IBM00858"] = 858;
code_pages["IBM860"] = 860;
code_pages["IBM861"] = 861;
code_pages["DOS-862"] = 862;
code_pages["IBM863"] = 863;
code_pages["IBM864"] = 864;
code_pages["IBM865"] = 865;
code_pages["CP866"] = 866;
code_pages["IBM869"] = 869;
code_pages["IBM870"] = 870;
code_pages["WINDOWS-874"] = 874;
code_pages["CP875"] = 875;
code_pages["SHIFT_JIS"] = 932;
code_pages["GB2312"] = 936;
code_pages["KS_C_5601-1987"] = 949;
code_pages["BIG5"] = 950;
code_pages["IBM1026"] = 1026;
code_pages["IBM1140"] = 1140;
code_pages["IBM1141"] = 1141;
code_pages["IBM1142"] = 1142;
code_pages["IBM1143"] = 1143;
code_pages["IBM1144"] = 1144;
code_pages["IBM1145"] = 1145;
code_pages["IBM1146"] = 1146;
code_pages["IBM1147"] = 1147;
code_pages["IBM1148"] = 1148;
code_pages["IBM1149"] = 1149;
code_pages["UTF-16"] = 1200;
code_pages["UNICODEFFFE"] = 1201;
code_pages["WINDOWS-1250"] = 1250;
code_pages["WINDOWS-1251"] = 1251;
code_pages["WINDOWS-1252"] = 1252;
code_pages["WINDOWS-1253"] = 1253;
code_pages["WINDOWS-1254"] = 1254;
code_pages["WINDOWS-1255"] = 1255;
code_pages["WINDOWS-1256"] = 1256;
code_pages["WINDOWS-1257"] = 1257;
code_pages["WINDOWS-1258"] = 1258;
code_pages["JOHAB"] = 1361;
code_pages["MACINTOSH"] = 10000;
code_pages["X-MAC-JAPANESE"] = 10001;
code_pages["X-MAC-CHINESETRAD"] = 10002;
code_pages["X-MAC-KOREAN"] = 10003;
code_pages["X-MAC-ARABIC"] = 10004;
code_pages["X-MAC-HEBREW"] = 10005;
code_pages["X-MAC-GREEK"] = 10006;
code_pages["X-MAC-CYRILLIC"] = 10007;
code_pages["X-MAC-CHINESESIMP"] = 10008;
code_pages["X-MAC-ROMANIAN"] = 10010;
code_pages["X-MAC-UKRANIAN"] = 10017;
code_pages["X-MAC-THAI"] = 10021;
code_pages["X-MAC-CE"] = 10029;
code_pages["X-MAC-ICELANDIC"] = 10079;
code_pages["X-MAC-TURKISH"] = 10081;
code_pages["X-MAC-CROATIAN"] = 10082;
code_pages["UTF-32"] = 12000;
code_pages["UTF-32BE"] = 12001;
code_pages["X-CHINESE_CNS"] = 20000;
code_pages["X-CP20001"] = 20001;
code_pages["X-CHINESE-ETEN"] = 20002;
code_pages["X-CP20003"] = 20003;
code_pages["X-CP20004"] = 20004;
code_pages["X-CP20005"] = 20005;
code_pages["X-IA5"] = 20105;
code_pages["X-IA5-GERMAN"] = 20106;
code_pages["X-IA5-SWEDISH"] = 20107;
code_pages["X-IA5-NORWEGIAN"] = 20108;
code_pages["US-ASCII"] = 20127;
code_pages["X-IA5-GERMAN"] = 20106;
code_pages["X-CP20261"] = 20261;
code_pages["X-CP20259"] = 20269;
code_pages["IBM273"] = 20273;
code_pages["IBM277"] = 20277;
code_pages["IBM278"] = 20278;
code_pages["IBM280"] = 20280;
code_pages["IBM284"] = 20284;
code_pages["IBM285"] = 20285;
code_pages["IBM290"] = 20290;
code_pages["IBM297"] = 20297;
code_pages["IBM420"] = 20420;
code_pages["IBM423"] = 20423;
code_pages["IBM424"] = 20424;
code_pages["X-EBCDIC-KOREANEXTENDED"]= 20833;
code_pages["IBM-THAI"] = 20838;
code_pages["KOI8-R"] = 20866;
code_pages["IBM871"] = 20871;
code_pages["IBM880"] = 20880;
code_pages["IBM905"] = 20905;
code_pages["IBM00924"] = 20924;
code_pages["EUC-JP"] = 20932;
code_pages["X-CP20936"] = 20936;
code_pages["X-CP20949"] = 20949;
code_pages["CP1025"] = 21025;
//21027 code page is deprecated
code_pages["KOI8-U"] = 21866;
code_pages["ISO-8859-1"] = 28591;
code_pages["ISO-8859-2"] = 28592;
code_pages["ISO-8859-3"] = 28593;
code_pages["ISO-8859-4"] = 28594;
code_pages["ISO-8859-5"] = 28595;
code_pages["ISO-8859-6"] = 28596;
code_pages["ISO-8859-7"] = 28597;
code_pages["ISO-8859-8"] = 28598;
code_pages["ISO-8859-9"] = 28599;
code_pages["ISO-8859-13"] = 28603;
code_pages["ISO-8859-15"] = 28605;
code_pages["X-EUROPA"] = 29001;
code_pages["ISO-8859-8-I"] = 39598;
code_pages["ISO-2022-JP"] = 50220;
code_pages["CSISO2022JP"] = 50221;
code_pages["ISO-2022-JP"] = 50222;
code_pages["ISO-2022-KR"] = 50225;
code_pages["X-CP50227"] = 50227;
//50229 not .NET name
//50930 not .NET name
//50933 not .NET name
//50931 not .NET name
//50935 not .NET name
//50936 not .NET name
//50937 not .NET name
//50939 not .NET name
code_pages["EUC-JP"] = 51932;
code_pages["EUC-CN"] = 51936;
code_pages["EUC-KR"] = 51949;
//51950 not .NET name
code_pages["HZ-GB-2312"] = 52936;
code_pages["X-ISCII-DE"] = 57002;
code_pages["X-ISCII-BE"] = 57003;
code_pages["X-ISCII-TA"] = 57004;
code_pages["X-ISCII-TE"] = 57005;
code_pages["X-ISCII-AS"] = 57006;
code_pages["X-ISCII-OR"] = 57007;
code_pages["X-ISCII-KA"] = 57008;
code_pages["X-ISCII-MA"] = 57009;
code_pages["X-ISCII-GU"] = 57010;
code_pages["X-ISCII-PA"] = 57010;
code_pages["UTF-7"] = 65000;
code_pages["UTF-8"] = 65001;
for (int i = 0; i < encoding.length(); i++){
encoding[i] = toupper(encoding[i]);
}
if (code_pages.count(encoding)){
return code_pages[encoding];
} else{
return 0;
}
}
void Pandora_Module_Exec::getOutputEncoding(){
this->output_encoding = "ISO-8859-1"; //initialize with default encoding
string buffer, filename;
int pos;
filename = Pandora::getPandoraInstallDir ();
filename += "pandora_agent.conf";
ifstream file;
file.open (filename.c_str ());
bool token_found = false;
while (!file.eof () && !token_found) {
/* Set the value from each line */
getline (file, buffer);
/* Ignore blank or commented lines */
if (buffer[0] != '#' && buffer[0] != '\n' && buffer[0] != '\0') {
/*Check if is the encoding line*/
pos = buffer.find("encoding");
if (pos != string::npos){
this->output_encoding = "";
this->output_encoding = buffer.substr(pos+9);
token_found = true;
}
}
}
file.close();
}
void Pandora_Module_Exec::changeInputEncoding(){
int size_wchar = MultiByteToWideChar( CP_UTF8 , 0 , this->module_exec.c_str () , -1, NULL , 0 );
wchar_t* wstr = new wchar_t[size_wchar];
if (size_wchar != 0){
MultiByteToWideChar( CP_UTF8 , 0 , this->module_exec.c_str () , -1, wstr , size_wchar );
char buf[BUFSIZE + 1];
wcstombs(buf, wstr, size_wchar);
buf[size_wchar] = '\0';
this->module_exec = buf;
}
delete[] wstr;
}
void Pandora_Module_Exec::changeOutputEncoding(string * string_change){
//first change: from native encoding to system encoding
UINT cp_output = getNumberEncoding(this->output_encoding);
if (cp_output != 0) {
int size_wchar = MultiByteToWideChar( this->native_encoding , 0 , string_change->c_str() , -1, NULL , 0 );
wchar_t* wstr = new wchar_t[size_wchar];
if (size_wchar != 0){
MultiByteToWideChar( this->native_encoding , 0 , string_change->c_str() , -1, wstr , size_wchar );
//second change: from system encoding to output encoding
int size_schar = WideCharToMultiByte( cp_output, 0, wstr, -1, NULL, 0, NULL, NULL);
char* sstr = new char[size_schar];
if (size_schar != 0){
WideCharToMultiByte( cp_output, 0, wstr, -1, sstr, size_schar, NULL, NULL);
* string_change = sstr;
}
delete[] sstr;
}
delete[] wstr;
} else {
pandoraDebug ("Cannot find code page of encoding: %s", this->output_encoding.c_str ());
}
}

View File

@ -34,9 +34,17 @@ namespace Pandora_Modules {
class Pandora_Module_Exec : public Pandora_Module { class Pandora_Module_Exec : public Pandora_Module {
private: private:
string module_exec; string module_exec;
UINT native_encoding;
string output_encoding;
UINT getNumberEncoding(string encoding);
void getOutputEncoding();
void changeInputEncoding();
void changeOutputEncoding(string * string_change);
public: public:
unsigned char proc; unsigned char proc;
Pandora_Module_Exec (string name, string exec); Pandora_Module_Exec (string name, string exec);
//overloaded constructor for module_exec
Pandora_Module_Exec (string name, string exec, string native);
void run (); void run ();
}; };

View File

@ -118,6 +118,7 @@ using namespace Pandora_Strutils;
#define TOKEN_QUIET ("module_quiet ") #define TOKEN_QUIET ("module_quiet ")
#define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ") #define TOKEN_MODULE_FF_INTERVAL ("module_ff_interval ")
#define TOKEN_MACRO ("module_macro") #define TOKEN_MACRO ("module_macro")
#define TOKEN_NATIVE ("module_native")
string string
parseLine (string line, string token) { parseLine (string line, string token) {
@ -170,6 +171,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical; string module_unit, module_group, module_custom_id, module_str_warning, module_str_critical;
string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags; string module_critical_instructions, module_warning_instructions, module_unknown_instructions, module_tags;
string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval; string module_critical_inverse, module_warning_inverse, module_quiet, module_ff_interval;
string module_native;
string macro; string macro;
Pandora_Module *module; Pandora_Module *module;
bool numeric; bool numeric;
@ -247,6 +249,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module_warning_inverse = ""; module_warning_inverse = "";
module_quiet = ""; module_quiet = "";
module_ff_interval = ""; module_ff_interval = "";
module_native = "";
macro = ""; macro = "";
stringtok (tokens, definition, "\n"); stringtok (tokens, definition, "\n");
@ -489,6 +492,11 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
if (module_quiet == "") { if (module_quiet == "") {
module_quiet = parseLine (line, TOKEN_QUIET); module_quiet = parseLine (line, TOKEN_QUIET);
} }
if (module_native == "") {
module_native = parseLine (line, TOKEN_NATIVE);
}
if (module_ff_interval == "") { if (module_ff_interval == "") {
module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL); module_ff_interval = parseLine (line, TOKEN_MODULE_FF_INTERVAL);
} }
@ -1048,6 +1056,13 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
} }
} }
if (module_native != "") {
pos_macro = module_native.find(macro_name);
if (pos_macro != string::npos){
module_native.replace(pos_macro, macro_name.size(), macro_value);
}
}
if (module_ff_interval != "") { if (module_ff_interval != "") {
pos_macro = module_ff_interval.find(macro_name); pos_macro = module_ff_interval.find(macro_name);
if (pos_macro != string::npos){ if (pos_macro != string::npos){
@ -1061,7 +1076,7 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
/* Create module objects */ /* Create module objects */
if (module_exec != "") { if (module_exec != "") {
module = new Pandora_Module_Exec (module_name, module = new Pandora_Module_Exec (module_name,
module_exec); module_exec, module_native);
if (module_timeout != "") { if (module_timeout != "") {
module->setTimeout (atoi (module_timeout.c_str ())); module->setTimeout (atoi (module_timeout.c_str ()));
} }

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0RC1(Build 150908)") #define PANDORA_VERSION ("6.0RC1(Build 150914)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -1028,7 +1028,7 @@ Pandora_Windows_Service::recvTentacleDataFile (string host,
ZeroMemory (&pi, sizeof (pi)); ZeroMemory (&pi, sizeof (pi));
if (CreateProcess (NULL , (CHAR *)tentacle_cmd.c_str (), NULL, NULL, FALSE, if (CreateProcess (NULL , (CHAR *)tentacle_cmd.c_str (), NULL, NULL, FALSE,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) { CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) {
return; throw Pandora_Exception ();
} }
/* close thread handle, because it won't be used */ /* close thread handle, because it won't be used */
@ -1045,7 +1045,7 @@ Pandora_Windows_Service::recvTentacleDataFile (string host,
TerminateProcess(pi.hProcess, STILL_ACTIVE); TerminateProcess(pi.hProcess, STILL_ACTIVE);
CloseHandle (pi.hProcess); CloseHandle (pi.hProcess);
pandoraLog ("Unable to receive file %s (tentacle timeout)", filename.c_str ()); pandoraLog ("Unable to receive file %s (tentacle timeout)", filename.c_str ());
return; throw Pandora_Exception ();
} }
/* Get the return code of the tentacle client*/ /* Get the return code of the tentacle client*/
@ -1053,7 +1053,7 @@ Pandora_Windows_Service::recvTentacleDataFile (string host,
if (rc != 0) { if (rc != 0) {
CloseHandle (pi.hProcess); CloseHandle (pi.hProcess);
pandoraLog ("Unable to receive file %s", filename.c_str ()); pandoraLog ("Unable to receive file %s", filename.c_str ());
return; throw Pandora_Exception ();
} }
CloseHandle (pi.hProcess); CloseHandle (pi.hProcess);

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0RC1(Build 150908))" VALUE "ProductVersion", "(6.0RC1(Build 150914))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 6.0RC1-150908 Version: 6.0RC1-150914
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0RC1-150908" pandora_version="6.0RC1-150914"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -161,5 +161,5 @@ INSERT INTO `tgis_map_has_tgis_map_con` SELECT * FROM `tgis_map_has_tgis_map_con
DROP TABLE `tgis_map_has_tgis_map_connection`; DROP TABLE `tgis_map_has_tgis_map_connection`;
ALTER TABLE `tmodule_relationship` ALTER TABLE `tmodule_relationship`
ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0, --ADD COLUMN `id_rt` int(10) unsigned NOT NULL DEFAULT 0,
ADD FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE; ADD FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`) ON DELETE CASCADE;

View File

@ -220,7 +220,16 @@ function update_template ($step) {
$wizard_level = (string) get_parameter ('wizard_level'); $wizard_level = (string) get_parameter ('wizard_level');
$priority = (int) get_parameter ('priority'); $priority = (int) get_parameter ('priority');
$id_group = get_parameter ("id_group"); $id_group = get_parameter ("id_group");
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$name_check = db_get_value ('name', 'talert_templates', 'name', $name); $name_check = db_get_value ('name', 'talert_templates', 'name', $name);
break;
case "oracle":
$name_check = db_get_value ('name', 'talert_templates', 'to_char(name)', $name);
break;
}
$values = array ('name' => $name, $values = array ('name' => $name,
'description' => $description, 'description' => $description,
@ -371,7 +380,16 @@ if ($create_template) {
$priority = (int) get_parameter ('priority'); $priority = (int) get_parameter ('priority');
$wizard_level = (string) get_parameter ('wizard_level'); $wizard_level = (string) get_parameter ('wizard_level');
$id_group = get_parameter ("id_group"); $id_group = get_parameter ("id_group");
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$name_check = db_get_value ('name', 'talert_templates', 'name', $name); $name_check = db_get_value ('name', 'talert_templates', 'name', $name);
break;
case "oracle":
$name_check = db_get_value ('name', 'talert_templates', 'to_char(name)', $name);
break;
}
$values = array ('description' => $description, $values = array ('description' => $description,
'value' => $value, 'value' => $value,

View File

@ -85,6 +85,10 @@ if (is_ajax ()) {
return; return;
} }
if ( https_is_running() ) {
header('Content-type: application/json');
}
if ($filter_agents_json != '') { if ($filter_agents_json != '') {
$filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true); $filter['id_agente'] = json_decode(io_safe_output($filter_agents_json), true);
} }

View File

@ -277,43 +277,43 @@ function type_change () {
// type 1-4 - Generic_xxxxxx // type 1-4 - Generic_xxxxxx
if ((document.component.type.value > 0) && (document.component.type.value < 5)) { if ((document.component.type.value > 0) && (document.component.type.value < 5)) {
$("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").css({backgroundColor: '#ddd !important'});
$("input[name=snmp_community]").attr("disabled", true); $("input[name=snmp_community]").attr("disabled", true);
$("input[name=tcp_rcv]").css({backgroundColor: '#ddd'}); $("input[name=tcp_rcv]").css({backgroundColor: '#ddd !important'});
$("input[name=tcp_rcv]").attr("disabled", true); $("input[name=tcp_rcv]").attr("disabled", true);
<?php <?php
if ($id_component_type != MODULE_WMI) { if ($id_component_type != MODULE_WMI) {
?> ?>
$("input[name=snmp_oid]").css({backgroundColor: '#ddd'}); $("input[name=snmp_oid]").css({backgroundColor: '#ddd !important'});
$("input[name=snmp_oid]").attr("disabled", true); $("input[name=snmp_oid]").attr("disabled", true);
$("input[name=tcp_send]").css({backgroundColor: '#ddd'}); $("input[name=tcp_send]").css({backgroundColor: '#ddd !important'});
$("input[name=tcp_send]").attr("disabled", true); $("input[name=tcp_send]").attr("disabled", true);
$("input[name=tcp_port]").css({backgroundColor: '#ddd'}); $("input[name=tcp_port]").css({backgroundColor: '#ddd !important'});
$("input[name=tcp_port]").attr("disabled", true); $("input[name=tcp_port]").attr("disabled", true);
<?php <?php
} }
?> ?>
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd !important'});
$("input[name=snmp3_auth_user]").attr("disabled", true); $("input[name=snmp3_auth_user]").attr("disabled", true);
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd !important'});
$("input[name=snmp3_auth_pass]").attr("disabled", true); $("input[name=snmp3_auth_pass]").attr("disabled", true);
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'}); $("#snmp3_privacy_method").css({backgroundColor: '#ddd !important'});
$("#snmp3_privacy_method").attr("disabled", true); $("#snmp3_privacy_method").attr("disabled", true);
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd !important'});
$("input[name=snmp3_privacy_pass]").attr("disabled", true); $("input[name=snmp3_privacy_pass]").attr("disabled", true);
$("#snmp3_auth_method").css({backgroundColor: '#ddd'}); $("#snmp3_auth_method").css({backgroundColor: '#ddd !important'});
$("#snmp3_auth_method").attr("disabled", true); $("#snmp3_auth_method").attr("disabled", true);
$("#snmp3_security_level").css({backgroundColor: '#ddd'}); $("#snmp3_security_level").css({backgroundColor: '#ddd !important'});
$("#snmp3_security_level").attr("disabled", true); $("#snmp3_security_level").attr("disabled", true);
} }
// type 15-18- SNMP // type 15-18- SNMP
@ -324,9 +324,9 @@ function type_change () {
document.component.snmp_community.disabled=false; document.component.snmp_community.disabled=false;
document.component.snmp_oid.style.background="#fff"; document.component.snmp_oid.style.background="#fff";
document.component.snmp_oid.disabled=false; document.component.snmp_oid.disabled=false;
document.component.tcp_send.style.background="#ddd"; document.component.tcp_send.style.background="#ddd !important";
document.component.tcp_send.disabled=true; document.component.tcp_send.disabled=true;
document.component.tcp_rcv.style.background="#ddd"; document.component.tcp_rcv.style.background="#ddd !important";
document.component.tcp_rcv.disabled=true; document.component.tcp_rcv.disabled=true;
document.component.tcp_port.style.background="#fff"; document.component.tcp_port.style.background="#fff";
document.component.tcp_port.disabled=false; document.component.tcp_port.disabled=false;
@ -350,39 +350,39 @@ function type_change () {
} }
// type 6-7 - ICMP // type 6-7 - ICMP
if ((document.component.type.value == 6) || (document.component.type.value == 7)) { if ((document.component.type.value == 6) || (document.component.type.value == 7)) {
document.component.snmp_oid.style.background="#ddd"; document.component.snmp_oid.style.background="#ddd !important";
document.component.snmp_oid.disabled=true; document.component.snmp_oid.disabled=true;
document.component.snmp_community.style.background="#ddd"; document.component.snmp_community.style.background="#ddd !important";
document.component.snmp_community.disabled=true; document.component.snmp_community.disabled=true;
document.component.snmp_oid.style.background="#ddd"; document.component.snmp_oid.style.background="#ddd !important";
document.component.snmp_oid.disabled=true; document.component.snmp_oid.disabled=true;
document.component.tcp_send.style.background="#ddd"; document.component.tcp_send.style.background="#ddd !important";
document.component.tcp_send.disabled=true; document.component.tcp_send.disabled=true;
document.component.tcp_rcv.style.background="#ddd"; document.component.tcp_rcv.style.background="#ddd !important";
document.component.tcp_rcv.disabled=true; document.component.tcp_rcv.disabled=true;
document.component.tcp_port.style.background="#ddd"; document.component.tcp_port.style.background="#ddd !important";
document.component.tcp_port.disabled=true; document.component.tcp_port.disabled=true;
document.component.snmp_version.style.background="#ddd"; document.component.snmp_version.style.background="#ddd !important";
document.component.snmp_version.disabled=true; document.component.snmp_version.disabled=true;
document.component.snmp3_auth_user.style.background="#ddd"; document.component.snmp3_auth_user.style.background="#ddd !important";
document.component.snmp3_auth_user.disabled=true; document.component.snmp3_auth_user.disabled=true;
document.component.snmp3_auth_pass.background="#ddd"; document.component.snmp3_auth_pass.background="#ddd !important";
document.component.snmp3_auth_pass.disabled=true; document.component.snmp3_auth_pass.disabled=true;
document.component.snmp3_privacy_method.style.background="#ddd"; document.component.snmp3_privacy_method.style.background="#ddd !important";
document.component.snmp3_privacy_method.disabled=true; document.component.snmp3_privacy_method.disabled=true;
document.component.snmp3_privacy_pass.style.background="#ddd"; document.component.snmp3_privacy_pass.style.background="#ddd !important";
document.component.snmp3_privacy_pass.disabled=true; document.component.snmp3_privacy_pass.disabled=true;
document.component.snmp3_auth_method.style.background="#ddd"; document.component.snmp3_auth_method.style.background="#ddd !important";
document.component.snmp3_auth_method.disabled=true; document.component.snmp3_auth_method.disabled=true;
document.component.snmp3_security_level.style.background="#ddd"; document.component.snmp3_security_level.style.background="#ddd !important";
document.component.snmp3_security_level.disabled=true; document.component.snmp3_security_level.disabled=true;
} }
// type 8-11 - TCP // type 8-11 - TCP
if ((document.component.type.value > 7) && (document.component.type.value < 12)) { if ((document.component.type.value > 7) && (document.component.type.value < 12)) {
document.component.snmp_oid.style.background="#ddd"; document.component.snmp_oid.style.background="#ddd !important";
document.component.snmp_oid.disabled=true; document.component.snmp_oid.disabled=true;
document.component.snmp_community.style.background="#ddd"; document.component.snmp_community.style.background="#ddd !important";
document.component.snmp_community.disabled=true; document.component.snmp_community.disabled=true;
document.component.tcp_send.style.background="#fff"; document.component.tcp_send.style.background="#fff";
document.component.tcp_send.disabled=false; document.component.tcp_send.disabled=false;
@ -391,26 +391,26 @@ function type_change () {
document.component.tcp_port.style.background="#fff"; document.component.tcp_port.style.background="#fff";
document.component.tcp_port.disabled=false; document.component.tcp_port.disabled=false;
document.component.snmp_version.style.background="#ddd"; document.component.snmp_version.style.background="#ddd !important";
document.component.snmp_version.disabled=true; document.component.snmp_version.disabled=true;
document.component.snmp3_auth_user.style.background="#ddd"; document.component.snmp3_auth_user.style.background="#ddd !important";
document.component.snmp3_auth_user.disabled=true; document.component.snmp3_auth_user.disabled=true;
document.component.snmp3_auth_pass.background="#ddd"; document.component.snmp3_auth_pass.background="#ddd !important";
document.component.snmp3_auth_pass.disabled=true; document.component.snmp3_auth_pass.disabled=true;
document.component.snmp3_privacy_method.style.background="#ddd"; document.component.snmp3_privacy_method.style.background="#ddd !important";
document.component.snmp3_privacy_method.disabled=true; document.component.snmp3_privacy_method.disabled=true;
document.component.snmp3_privacy_pass.style.background="#ddd"; document.component.snmp3_privacy_pass.style.background="#ddd !important";
document.component.snmp3_privacy_pass.disabled=true; document.component.snmp3_privacy_pass.disabled=true;
document.component.snmp3_auth_method.style.background="#ddd"; document.component.snmp3_auth_method.style.background="#ddd !important";
document.component.snmp3_auth_method.disabled=true; document.component.snmp3_auth_method.disabled=true;
document.component.snmp3_security_level.style.background="#ddd"; document.component.snmp3_security_level.style.background="#ddd !important";
document.component.snmp3_security_level.disabled=true; document.component.snmp3_security_level.disabled=true;
} }
// type 12 - UDP // type 12 - UDP
if (document.component.type.value == 12) { if (document.component.type.value == 12) {
document.component.snmp_oid.style.background="#ddd"; document.component.snmp_oid.style.background="#ddd !important";
document.component.snmp_oid.disabled=true; document.component.snmp_oid.disabled=true;
document.component.snmp_community.style.background="#ddd"; document.component.snmp_community.style.background="#ddd !important";
document.component.snmp_community.disabled=true; document.component.snmp_community.disabled=true;
document.component.tcp_send.style.background="#fff"; document.component.tcp_send.style.background="#fff";
document.component.tcp_send.disabled=false; document.component.tcp_send.disabled=false;
@ -419,19 +419,19 @@ function type_change () {
document.component.tcp_port.style.background="#fff"; document.component.tcp_port.style.background="#fff";
document.component.tcp_port.disabled=false; document.component.tcp_port.disabled=false;
document.component.snmp_version.style.background="#ddd"; document.component.snmp_version.style.background="#ddd !important";
document.component.snmp_version.disabled=true; document.component.snmp_version.disabled=true;
document.component.snmp3_auth_user.style.background="#ddd"; document.component.snmp3_auth_user.style.background="#ddd !important";
document.component.snmp3_auth_user.disabled=true; document.component.snmp3_auth_user.disabled=true;
document.component.snmp3_auth_pass.background="#ddd"; document.component.snmp3_auth_pass.background="#ddd !important";
document.component.snmp3_auth_pass.disabled=true; document.component.snmp3_auth_pass.disabled=true;
document.component.snmp3_privacy_method.style.background="#ddd"; document.component.snmp3_privacy_method.style.background="#ddd !important";
document.component.snmp3_privacy_method.disabled=true; document.component.snmp3_privacy_method.disabled=true;
document.component.snmp3_privacy_pass.style.background="#ddd"; document.component.snmp3_privacy_pass.style.background="#ddd !important";
document.component.snmp3_privacy_pass.disabled=true; document.component.snmp3_privacy_pass.disabled=true;
document.component.snmp3_auth_method.style.background="#ddd"; document.component.snmp3_auth_method.style.background="#ddd !important";
document.component.snmp3_auth_method.disabled=true; document.component.snmp3_auth_method.disabled=true;
document.component.snmp3_security_level.style.background="#ddd"; document.component.snmp3_security_level.style.background="#ddd !important";
document.component.snmp3_security_level.disabled=true; document.component.snmp3_security_level.disabled=true;
} }
} }

View File

@ -273,7 +273,7 @@ function readFields() {
values['module'] = $("select[name=module]").val(); values['module'] = $("select[name=module]").val();
values['process_simple_value'] = $("select[name=process_value]").val(); values['process_simple_value'] = $("select[name=process_value]").val();
values['background'] = $("#background_image").val(); values['background'] = $("#background_image").val();
values['period'] = $("#hidden-period").val(); values['period'] = $("select[name=period]").val();
values['width'] = $("input[name=width]").val(); values['width'] = $("input[name=width]").val();
values['height'] = $("input[name=height]").val(); values['height'] = $("input[name=height]").val();
values['parent'] = $("select[name=parent]").val(); values['parent'] = $("select[name=parent]").val();

View File

@ -32,6 +32,9 @@ ob_clean();
$search_agents = (bool) get_parameter ('search_agents'); $search_agents = (bool) get_parameter ('search_agents');
$get_agents_group = (bool) get_parameter('get_agents_group', false); $get_agents_group = (bool) get_parameter('get_agents_group', false);
$force_local = (bool) get_parameter('force_local', false); $force_local = (bool) get_parameter('force_local', false);
if ( https_is_running() ) {
header('Content-type: application/json');
}
if ($get_agents_group) { if ($get_agents_group) {

View File

@ -34,6 +34,9 @@ $list_modules = (bool) get_parameter('list_modules', 0);
if ($get_plugin_macros) { if ($get_plugin_macros) {
if ( https_is_running() ) {
header('Content-type: application/json');
}
$id_plugin = get_parameter('id_plugin', 0); $id_plugin = get_parameter('id_plugin', 0);
$plugin_macros = db_get_value('macros', 'tplugin', 'id', $plugin_macros = db_get_value('macros', 'tplugin', 'id',
@ -49,6 +52,9 @@ if ($get_plugin_macros) {
if ($search_modules) { if ($search_modules) {
if ( https_is_running() ) {
header('Content-type: application/json');
}
$id_agents = json_decode(io_safe_output(get_parameter('id_agents'))); $id_agents = json_decode(io_safe_output(get_parameter('id_agents')));
$filter = '%' . get_parameter('q', '') . '%'; $filter = '%' . get_parameter('q', '') . '%';
$other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true); $other_filter = json_decode(io_safe_output(get_parameter('other_filter')), true);

View File

@ -45,28 +45,28 @@ switch($action) {
$summary = '<br>'; $summary = '<br>';
if (isset($stats['policies'])) { if (isset($stats['policies'])) {
$summary .= count($stats['policies']) . " x " . $summary .= $stats['policies'] . " x " .
html_print_image($hack_metaconsole . 'images/policies.png',true) . ' '. html_print_image($hack_metaconsole . 'images/policies.png',true) . ' '.
__('Policies') . "<br>"; __('Policies') . "<br>";
} }
if (isset($stats['groups'])) { if (isset($stats['groups'])) {
// TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY // TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY
$summary .= count($stats['groups']) . " x " . $summary .= $stats['groups'] . " x " .
html_print_image($hack_metaconsole . 'images/group.png',true) . ' ' . html_print_image($hack_metaconsole . 'images/group.png',true) . ' ' .
__('Groups') . "<br>"; __('Groups') . "<br>";
} }
if (isset($stats['agents'])) { if (isset($stats['agents'])) {
// TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY // TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY
$summary .= count($stats['agents']) . $summary .= $stats['agents'] .
" x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) . " x " . html_print_image($hack_metaconsole . 'images/bricks.png',true) .
' ' . __('Agents') . "<br>"; ' ' . __('Agents') . "<br>";
} }
if (isset($stats['modules'])) { if (isset($stats['modules'])) {
// TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY // TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY
$summary .= count($stats['modules']) . $summary .= $stats['modules'] .
" x " . html_print_image($hack_metaconsole . 'images/brick.png',true) . " x " . html_print_image($hack_metaconsole . 'images/brick.png',true) .
' ' . __('Modules') . "<br>"; ' ' . __('Modules') . "<br>";
} }

View File

@ -22,7 +22,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC150908'; $build_version = 'PC150914';
$pandora_version = 'v6.0RC1'; $pandora_version = 'v6.0RC1';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -256,7 +256,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
if ($type[0] == 'INSERT') { if ($type[0] == 'INSERT') {
oci_bind_by_name($query, ":table_name", $table_name, 32); oci_bind_by_name($query, ":table_name", $table_name, 32);
oci_bind_by_name($query, ":sql", $sql, -1); oci_bind_by_name($query, ":sql", $sql, -1);
oci_bind_by_name($query, ":out", $id, 32); oci_bind_by_name($query, ":out", $id, 40);
} }
if (!$autocommit) { if (!$autocommit) {
@ -278,6 +278,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
$error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d', $error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d',
htmlentities($e['message'], ENT_QUOTES), $sql, $backtrace[0]['file'], $backtrace[0]['line']); htmlentities($e['message'], ENT_QUOTES), $sql, $backtrace[0]['file'], $backtrace[0]['line']);
db_add_database_debug_trace ($sql, htmlentities($e['message'], ENT_QUOTES)); db_add_database_debug_trace ($sql, htmlentities($e['message'], ENT_QUOTES));
set_error_handler ('db_sql_error_handler'); set_error_handler ('db_sql_error_handler');
trigger_error ($error); trigger_error ($error);
restore_error_handler (); restore_error_handler ();
@ -290,7 +291,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
if ($status !== 'SELECT') { //The query NOT IS a select if ($status !== 'SELECT') { //The query NOT IS a select
if ($rettype == "insert_id") { if ($rettype == "insert_id") {
$result = $result; $result = $id;
} }
elseif ($rettype == "info") { elseif ($rettype == "info") {
//TODO: return debug information of the query $result = pg_result_status($result, PGSQL_STATUS_STRING); //TODO: return debug information of the query $result = pg_result_status($result, PGSQL_STATUS_STRING);

View File

@ -725,12 +725,12 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
} }
if (!$avg_only) { if (!$avg_only) {
$legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], 2), '.0').' '.$unit; $legend['max'.$series_suffix] = __('Max').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['max']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['max']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['max']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['max']['min'], 2), '.0').' '.$unit.'--> Seleccionado';
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit; $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> Seleccionado';
$legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], 2), '.0').' '.$unit; $legend['min'.$series_suffix] = __('Min').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['min']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['min']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['min']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['min']['min'], 2), '.0').' '.$unit.'--> Seleccionado';
} }
else else
$legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit; $legend['sum'.$series_suffix] = __('Avg').$series_suffix_str.': '.__('Last').': '.rtrim(number_format($graph_stats['sum']['last'], 2), '.0').' '.$unit.' ; '.__('Avg').': '.rtrim(number_format($graph_stats['sum']['avg'], 2), '.0').' '.$unit.' ; '.__('Max').': '.rtrim(number_format($graph_stats['sum']['max'], 2), '.0').' '.$unit.' ; '.__('Min').': '.rtrim(number_format($graph_stats['sum']['min'], 2), '.0').' '.$unit.'--> Seleccionado';
//Baseline was replaced by compare graph feature //Baseline was replaced by compare graph feature
/*if ($baseline) { /*if ($baseline) {
$legend['baseline'.$series_suffix] = __('Baseline'); $legend['baseline'.$series_suffix] = __('Baseline');

View File

@ -1775,7 +1775,7 @@ function html_print_checkbox ($name, $value, $checked = false, $return = false,
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.
*/ */
function html_print_image ($src, $return = false, $options = false, function html_print_image ($src, $return = false, $options = false,
$return_src = false, $relative = false) { $return_src = false, $relative = false, $no_in_meta = false) {
global $config; global $config;
@ -1799,7 +1799,10 @@ function html_print_image ($src, $return = false, $options = false,
if (is_metaconsole()) { if (is_metaconsole()) {
if (!$relative) { if (!$relative) {
$working_dir = str_replace("\\", "/", getcwd()); // Windows compatibility $working_dir = str_replace("\\", "/", getcwd()); // Windows compatibility
if (strstr($working_dir, 'enterprise/meta') === false) { if ($no_in_meta){
$src = '../../' . $src;
}
else if (strstr($working_dir, 'enterprise/meta') === false) {
if ($src[0] !== '/') { if ($src[0] !== '/') {
$src = '/' . $src; $src = '/' . $src;
} }

View File

@ -341,9 +341,18 @@ function network_components_create_network_component ($name, $type, $id_group, $
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "oracle": case "oracle":
switch ($type) {
case 8:
case 9:
case 10:
case 11:
case 12:
if (empty($values['tcp_rcv'])) if (empty($values['tcp_rcv']))
$values['tcp_rcv'] = " "; $values['tcp_rcv'] = " ";
return; break;
default:
break;
}
break; break;
} }

View File

@ -1332,7 +1332,24 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s
global $hack_networkmap_mobile; global $hack_networkmap_mobile;
global $config; global $config;
$stats_json = base64_encode(json_encode($stats)); //$stats_json = base64_encode(json_encode($stats));
$summary = array();
if (isset($stats['policies'])) {
$summary['policies'] = count($stats['policies']);
}
if (isset($stats['groups'])) {
// TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY
$summary['groups'] = count($stats['groups']);
}
if (isset($stats['agents'])) {
// TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY
$summary['agents'] = count($stats['agents']);
}
if (isset($stats['modules'])) {
// TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY
$summary['modules'] = count($stats['modules']) ;
}
$stats_json = base64_encode(json_encode($summary));
$img_src = "images/networkmap/pandora_node.png"; $img_src = "images/networkmap/pandora_node.png";
if (defined('METACONSOLE')) { if (defined('METACONSOLE')) {
@ -1343,12 +1360,12 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s
'stats='.$stats_json . '&' . 'stats='.$stats_json . '&' .
'metaconsole=1'; 'metaconsole=1';
$url = ''; $url = '';
$color = "#052938"; $color = '#052938';
} }
else { else {
$url_tooltip = 'ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view'; $url_tooltip = 'ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view';
$url = 'index.php?sec=estado&sec2=operation/agentes/group_view'; $url = 'index.php?sec=estado&sec2=operation/agentes/group_view';
$color = "#373737"; $color = '#373737';
} }
if ($hack_networkmap_mobile) { if ($hack_networkmap_mobile) {
@ -1357,10 +1374,12 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s
'</TD></TR>'; '</TD></TR>';
} }
else { else {
$img = '<TR><TD>' . html_print_image("images/networkmap/pandora_node.png", true, false, false, true) . '</TD></TR>'; $image = html_print_image("images/networkmap/pandora_node.png", true, false, false, true);
$image = str_replace('"',"'",$image);
$img = '<TR><TD>' . $image . '</TD></TR>';
} }
$name = '<TR><TD BGCOLOR="#FFFFFF">' . $name . '</TD></TR>'; $name = "<TR><TD BGCOLOR='#FFFFFF'>" . $name . '</TD></TR>';
$label = '<TABLE BORDER="0">' . $img.$name . '</TABLE>'; $label = "<TABLE BORDER='0'>" . $img.$name . '</TABLE>';
if ($simple == 1) { if ($simple == 1) {
$label = ''; $label = '';
} }
@ -1385,7 +1404,7 @@ function networkmap_open_group ($id) {
$name = groups_get_name ($id); $name = groups_get_name ($id);
$group = 'subgraph cluster_' . $id . $group = 'subgraph cluster_' . $id .
' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0"> ' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER=\'0\'>
<TR><TD>' . html_print_image($img, true) . '</TD><TD>'.$name.'</TD></TR> <TR><TD>' . html_print_image($img, true) . '</TD><TD>'.$name.'</TD></TR>
</TABLE>>; tooltip="'.$name.'"; </TABLE>>; tooltip="'.$name.'";
URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=' URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='

View File

@ -716,6 +716,16 @@ input.cancel, input.default, input.filter, input.pdf {
} }
input:disabled {
background-color: #DDD !important;
}
textarea:disabled {
background-color: #DDD !important;
}
select:disabled {
background-color: #DDD !important;
}
input.next { input.next {
background-image: url(../../images/input_go.png) !important; background-image: url(../../images/input_go.png) !important;
} }

View File

@ -63,7 +63,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '6.0RC1'; $version = '6.0RC1';
$build = '150908'; $build = '150914';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -13,8 +13,10 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// Load global vars // Real start
session_start ();
// Load global vars
if ((! file_exists("../../include/config.php")) || (! is_readable("../../include/config.php"))) { if ((! file_exists("../../include/config.php")) || (! is_readable("../../include/config.php"))) {
exit; exit;
} }
@ -26,14 +28,10 @@ require_once ('../../include/auth/mysql.php');
global $config; global $config;
// Real start
session_start ();
// Check user // Check user
check_login (); check_login ();
$config["id_user"] = $_SESSION["id_usuario"]; $config["id_user"] = $_SESSION["id_usuario"];
if (! check_acl ($config['id_user'], 0, "ER")) { if (! check_acl ($config['id_user'], 0, "ER")) {
db_pandora_audit("ACL Violation","Trying to access event viewer"); db_pandora_audit("ACL Violation","Trying to access event viewer");
require ("general/noaccess.php"); require ("general/noaccess.php");

View File

@ -259,7 +259,7 @@ enterprise_hook('close_meta_frame');
treeController.init({ treeController.init({
recipient: $("div#tree-controller-recipient"), recipient: $("div#tree-controller-recipient"),
detailRecipient: $.fixedBottomBox({ width: 400, height: 500 }), detailRecipient: $.fixedBottomBox({ width: 400, height: window.innerHeight * 0.9 }),
page: parameters['page'], page: parameters['page'],
emptyMessage: "<?php echo __('No data found'); ?>", emptyMessage: "<?php echo __('No data found'); ?>",
tree: data.tree, tree: data.tree,

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0RC1 %define version 6.0RC1
%define release 150908 %define release 150914
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 6.0RC1 %define version 6.0RC1
%define release 150908 %define release 150914
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -64,8 +64,8 @@ INSERT INTO tconfig (token, value) VALUES ('days_compact','0');
INSERT INTO tconfig (token, value) VALUES ('graph_res','5'); INSERT INTO tconfig (token, value) VALUES ('graph_res','5');
INSERT INTO tconfig (token, value) VALUES ('step_compact','1'); INSERT INTO tconfig (token, value) VALUES ('step_compact','1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc'); INSERT INTO tconfig (token, value) VALUES ('db_scheme_first_version','6.0orc');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_version','6.0RC1'); INSERT INTO tconfig (token, value) VALUES('db_scheme_version','6.0RC1');
INSERT INTO tconfig (token, value) VALUES ('db_scheme_build','PD150901'); INSERT INTO tconfig (token, value) VALUES('db_scheme_build','PD150914');
INSERT INTO tconfig (token, value) VALUES ('show_unknown','0'); INSERT INTO tconfig (token, value) VALUES ('show_unknown','0');
INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1'); INSERT INTO tconfig (token, value) VALUES ('show_lastalerts','1');
INSERT INTO tconfig (token, value) VALUES ('style','pandora'); INSERT INTO tconfig (token, value) VALUES ('style','pandora');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 6.0RC1-150908 Version: 6.0RC1-150914
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="6.0RC1-150908" pandora_version="6.0RC1-150914"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0RC1"; my $pandora_version = "6.0RC1";
my $pandora_build = "150908"; my $pandora_build = "150914";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0RC1 %define version 6.0RC1
%define release 150908 %define release 150914
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_server %define name pandorafms_server
%define version 6.0RC1 %define version 6.0RC1
%define release 150908 %define release 150914
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "6.0RC1 PS150908"; my $version = "6.0RC1 PS150914";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "6.0RC1 PS150908"; my $version = "6.0RC1 PS150914";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

View File

@ -10,6 +10,7 @@ use lib '/usr/lib/perl5';
use POSIX qw/strftime/; use POSIX qw/strftime/;
use Socket qw/inet_aton/; use Socket qw/inet_aton/;
use NetAddr::IP;
use PandoraFMS::Tools; use PandoraFMS::Tools;
use PandoraFMS::DB; use PandoraFMS::DB;
@ -1102,14 +1103,6 @@ $DBH = db_connect ('mysql', $CONF{'dbname'}, $CONF{'dbhost'}, $CONF{'dbport'}, $
# 0% # 0%
update_recon_task($DBH, $TASK_ID, 1); update_recon_task($DBH, $TASK_ID, 1);
# Populate ARP caches.
message("Populating ARP caches...");
my $nmap_args = '-nsP --send-ip --max-retries '.$CONF{'icmp_checks'}.' --host-timeout '.$CONF{'networktimeout'}.'s -T'.$CONF{'recon_timing_template'};
my $np = new PandoraFMS::NmapParser;
if ($#SUBNETS >= 0) {
$np->parsescan($CONF{'nmap'}, $nmap_args, @SUBNETS);
}
# Find routers. # Find routers.
message("[1/6] Searching for routers..."); message("[1/6] Searching for routers...");
if (defined($ROUTER) && $ROUTER ne '') { if (defined($ROUTER) && $ROUTER ne '') {
@ -1125,14 +1118,24 @@ if (defined($ROUTER) && $ROUTER ne '') {
} }
} }
else { else {
my @scanned_hosts = $np->all_hosts(); foreach my $subnet (@SUBNETS) {
foreach my $host (@scanned_hosts) { my $net_addr = new NetAddr::IP ($subnet);
next unless defined($host->addr()) and defined($host->status()) and ($host->status() eq 'up'); if (!defined($net_addr)) {
message("Invalid network: $subnet");
exit 1;
}
# Make sure the host is up (nmap gives false positives!). my @hosts = map { (split('/', $_))[0] } $net_addr->hostenum;
next if (pandora_ping(\%CONF, $host->addr(), 1, 1) == 0); foreach my $host (@hosts) {
arp_cache_discovery($host->addr()); # Check if the device has already been visited.
next if (defined($VISITED_DEVICES{$host}));
# Check if the host is up.
next if (pandora_ping(\%CONF, $host, 1, 1) == 0);
arp_cache_discovery($host);
}
} }
} }
update_recon_task($DBH, $TASK_ID, 30); update_recon_task($DBH, $TASK_ID, 30);