mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge branch 'develop' into 'ent-4669-fallo-escritura-notificacion-serialize-precision'
# Conflicts: # pandora_console/include/class/ConsoleSupervisor.php
This commit is contained in:
commit
84611c7d29
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.738-190918
|
Version: 7.0NG.738-190926
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.738-190918"
|
pandora_version="7.0NG.738-190926"
|
||||||
|
|
||||||
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
|
||||||
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
|||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.738';
|
use constant AGENT_VERSION => '7.0NG.738';
|
||||||
use constant AGENT_BUILD => '190918';
|
use constant AGENT_BUILD => '190926';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
@ -239,6 +239,15 @@ my $tentacle_pid = undef;
|
|||||||
# PID of udp_server
|
# PID of udp_server
|
||||||
my $udp_server_pid = undef;
|
my $udp_server_pid = undef;
|
||||||
|
|
||||||
|
# BrokerFlag
|
||||||
|
my $BrokerFlag = 0;
|
||||||
|
|
||||||
|
# Global loop counter.
|
||||||
|
my $LoopCounter = 0;
|
||||||
|
|
||||||
|
# Define a max value for loopCounter to avoid overflow.
|
||||||
|
use constant MAX_LOOP_COUNTER => 1000000000;
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Print usage information and exit.
|
# Print usage information and exit.
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -1385,6 +1394,7 @@ sub sleep_agent {
|
|||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$LoopCounter = ($LoopCounter + 1) % MAX_LOOP_COUNTER;
|
||||||
return $iter_base_time;
|
return $iter_base_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1699,6 +1709,14 @@ sub exec_module {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check module interval
|
# Check module interval
|
||||||
|
if ($BrokerFlag > 0) {
|
||||||
|
if ($LoopCounter == 0) {
|
||||||
|
$module->{'counter'} = $module->{'intensive_interval'};
|
||||||
|
} else {
|
||||||
|
$module->{'counter'} = (($LoopCounter -1 ) % $module->{'intensive_interval'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (++($module->{'counter'}) < $module->{'intensive_interval'}) {
|
if (++($module->{'counter'}) < $module->{'intensive_interval'}) {
|
||||||
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
|
$ThreadSem->up () if (defined ($ThreadSem) && $Conf{'agent_threads'} > 1);
|
||||||
return;
|
return;
|
||||||
@ -2985,7 +3003,6 @@ while (1) {
|
|||||||
@BrokerPid = ();
|
@BrokerPid = ();
|
||||||
my @broker_agents = read_config ('broker_agent');
|
my @broker_agents = read_config ('broker_agent');
|
||||||
foreach my $broker_agent (@broker_agents) {
|
foreach my $broker_agent (@broker_agents) {
|
||||||
|
|
||||||
# Create broker conf file if it does not exist
|
# Create broker conf file if it does not exist
|
||||||
if (! -e "$ConfDir/${broker_agent}.conf") {
|
if (! -e "$ConfDir/${broker_agent}.conf") {
|
||||||
write_broker_conf($broker_agent);
|
write_broker_conf($broker_agent);
|
||||||
@ -2995,6 +3012,8 @@ while (1) {
|
|||||||
|
|
||||||
# Broker agent
|
# Broker agent
|
||||||
if ($main_agent == 0) {
|
if ($main_agent == 0) {
|
||||||
|
# Mark broker flag.
|
||||||
|
$BrokerFlag = 1;
|
||||||
|
|
||||||
# Set the configuration file
|
# Set the configuration file
|
||||||
$ConfFile = "${broker_agent}.conf";
|
$ConfFile = "${broker_agent}.conf";
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.738"
|
PI_VERSION="7.0NG.738"
|
||||||
PI_BUILD="190918"
|
PI_BUILD="190926"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
@ -163,6 +163,14 @@ uninstall () {
|
|||||||
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
|
rm -Rf $PANDORA_BASE$PANDORA_REVENT_BIN 2> /dev/null
|
||||||
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
|
rm -f $DESTDIR/etc/logrotate.d/pandora_agent
|
||||||
|
|
||||||
|
# Remove systemd service if exists
|
||||||
|
if [ $(systemctl --v | grep systemd | wc -l) != 0 ]
|
||||||
|
then
|
||||||
|
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
|
||||||
|
rm -f $PANDORA_AGENT_SERVICE
|
||||||
|
systemctl reset-failed
|
||||||
|
fi
|
||||||
|
|
||||||
#Test if exist Pandora Server in this machine
|
#Test if exist Pandora Server in this machine
|
||||||
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
|
if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ]
|
||||||
then
|
then
|
||||||
@ -465,6 +473,22 @@ install () {
|
|||||||
else
|
else
|
||||||
RCDIRS="/etc/rc2.d /etc/rc3.d"
|
RCDIRS="/etc/rc2.d /etc/rc3.d"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create systemd service
|
||||||
|
if [ $(systemctl --v | grep systemd | wc -l) != 0 ]
|
||||||
|
then
|
||||||
|
echo "Creating systemd service for pandora_agent_daemon"
|
||||||
|
|
||||||
|
PANDORA_AGENT_SERVICE="/etc/systemd/system/pandora_agent_daemon.service"
|
||||||
|
EXEC_START='ExecStart='$PANDORA_BASE$PANDORA_BIN' '$PANDORA_BASE$PANDORA_CFG
|
||||||
|
|
||||||
|
rm -f $PANDORA_AGENT_SERVICE
|
||||||
|
cp pandora_agent_daemon.service $PANDORA_AGENT_SERVICE
|
||||||
|
|
||||||
|
sed -i "s|^ExecStart=.*$|$EXEC_START|g" $PANDORA_AGENT_SERVICE
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
[ "$RCDIRS" ] && for RCDIR in $RCDIRS
|
[ "$RCDIRS" ] && for RCDIR in $RCDIRS
|
||||||
do
|
do
|
||||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{190918}
|
{190926}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
@ -1423,48 +1423,48 @@ Pandora_Module::evaluatePreconditions () {
|
|||||||
output += (char *) buffer;
|
output += (char *) buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
double_output = Pandora_Strutils::strtodouble (output);
|
double_output = Pandora_Strutils::strtodouble (output);
|
||||||
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
} catch (Pandora_Strutils::Invalid_Conversion e) {
|
||||||
double_output = 0;
|
double_output = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dwRet == WAIT_OBJECT_0) {
|
||||||
|
break;
|
||||||
|
} else if(this->getTimeout() < GetTickCount() - tickbase) {
|
||||||
|
/* STILL_ACTIVE */
|
||||||
|
TerminateProcess(pi.hThread, STILL_ACTIVE);
|
||||||
|
pandoraLog ("evaluatePreconditions: %s timed out (retcode: %d)", this->module_name.c_str (), STILL_ACTIVE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwRet == WAIT_OBJECT_0) {
|
GetExitCodeProcess (pi.hProcess, &retval);
|
||||||
break;
|
|
||||||
} else if(this->getTimeout() < GetTickCount() - tickbase) {
|
|
||||||
/* STILL_ACTIVE */
|
|
||||||
TerminateProcess(pi.hThread, STILL_ACTIVE);
|
|
||||||
pandoraLog ("evaluatePreconditions: %s timed out (retcode: %d)", this->module_name.c_str (), STILL_ACTIVE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GetExitCodeProcess (pi.hProcess, &retval);
|
if (retval != 0) {
|
||||||
|
if (! TerminateJobObject (job, 0)) {
|
||||||
if (retval != 0) {
|
pandoraLog ("evaluatePreconditions: TerminateJobObject failed. (error %d)",
|
||||||
if (! TerminateJobObject (job, 0)) {
|
GetLastError ());
|
||||||
pandoraLog ("evaluatePreconditions: TerminateJobObject failed. (error %d)",
|
}
|
||||||
GetLastError ());
|
if (retval != STILL_ACTIVE) {
|
||||||
|
pandoraLog ("evaluatePreconditions: %s did not executed well (retcode: %d)",
|
||||||
|
this->module_name.c_str (), retval);
|
||||||
|
}
|
||||||
|
/* Close job, process and thread handles. */
|
||||||
|
CloseHandle (job);
|
||||||
|
CloseHandle (pi.hProcess);
|
||||||
|
CloseHandle (pi.hThread);
|
||||||
|
CloseHandle (new_stdout);
|
||||||
|
CloseHandle (out_read);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
if (retval != STILL_ACTIVE) {
|
|
||||||
pandoraLog ("evaluatePreconditions: %s did not executed well (retcode: %d)",
|
|
||||||
this->module_name.c_str (), retval);
|
|
||||||
}
|
|
||||||
/* Close job, process and thread handles. */
|
/* Close job, process and thread handles. */
|
||||||
CloseHandle (job);
|
CloseHandle (job);
|
||||||
CloseHandle (pi.hProcess);
|
CloseHandle (pi.hProcess);
|
||||||
CloseHandle (pi.hThread);
|
CloseHandle (pi.hThread);
|
||||||
CloseHandle (new_stdout);
|
|
||||||
CloseHandle (out_read);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close job, process and thread handles. */
|
|
||||||
CloseHandle (job);
|
|
||||||
CloseHandle (pi.hProcess);
|
|
||||||
CloseHandle (pi.hThread);
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseHandle (new_stdout);
|
CloseHandle (new_stdout);
|
||||||
CloseHandle (out_read);
|
CloseHandle (out_read);
|
||||||
|
|
||||||
@ -1693,4 +1693,18 @@ Pandora_Module::getAsync () {
|
|||||||
return this->async;
|
return this->async;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current exections
|
||||||
|
*/
|
||||||
|
long
|
||||||
|
Pandora_Module::getExecutions () {
|
||||||
|
return this->executions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set current execution (global) used for brokers.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Pandora_Module::setExecutions (long executions) {
|
||||||
|
this->executions = executions;
|
||||||
|
}
|
||||||
|
@ -234,6 +234,8 @@ namespace Pandora_Modules {
|
|||||||
int getTimeout ();
|
int getTimeout ();
|
||||||
string getSave ();
|
string getSave ();
|
||||||
bool getAsync ();
|
bool getAsync ();
|
||||||
|
void setExecutions(long executions=0);
|
||||||
|
long getExecutions();
|
||||||
|
|
||||||
virtual string getXml ();
|
virtual string getXml ();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.738(Build 190918)")
|
#define PANDORA_VERSION ("7.0NG.738(Build 190926)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
@ -1849,7 +1849,7 @@ Pandora_Windows_Service::sendBufferedXml (string path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Pandora_Windows_Service::pandora_run_broker (string config) {
|
Pandora_Windows_Service::pandora_run_broker (string config, long executions) {
|
||||||
Pandora_Agent_Conf *conf = NULL;
|
Pandora_Agent_Conf *conf = NULL;
|
||||||
string server_addr;
|
string server_addr;
|
||||||
unsigned char data_flag = 0;
|
unsigned char data_flag = 0;
|
||||||
@ -1877,6 +1877,9 @@ Pandora_Windows_Service::pandora_run_broker (string config) {
|
|||||||
|
|
||||||
module = this->broker_modules->getCurrentValue ();
|
module = this->broker_modules->getCurrentValue ();
|
||||||
|
|
||||||
|
/* Keep executions matching main agent */
|
||||||
|
module->setExecutions(executions);
|
||||||
|
|
||||||
/* Check preconditions */
|
/* Check preconditions */
|
||||||
if (module->evaluatePreconditions () == 0) {
|
if (module->evaluatePreconditions () == 0) {
|
||||||
pandoraDebug ("Preconditions not matched for module %s", module->getName ().c_str ());
|
pandoraDebug ("Preconditions not matched for module %s", module->getName ().c_str ());
|
||||||
@ -2074,7 +2077,7 @@ Pandora_Windows_Service::pandora_run (int forced_run) {
|
|||||||
check_broker_agents(all_conf);
|
check_broker_agents(all_conf);
|
||||||
for (i=0;i<num;i++){
|
for (i=0;i<num;i++){
|
||||||
pandora_init_broker(all_conf[i]);
|
pandora_init_broker(all_conf[i]);
|
||||||
pandora_run_broker(all_conf[i]);
|
pandora_run_broker(all_conf[i], execution_number);
|
||||||
}
|
}
|
||||||
delete []all_conf;
|
delete []all_conf;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace Pandora {
|
|||||||
int checkConfig (string file);
|
int checkConfig (string file);
|
||||||
void purgeDiskCollections ();
|
void purgeDiskCollections ();
|
||||||
void pandora_init_broker (string file_conf);
|
void pandora_init_broker (string file_conf);
|
||||||
void pandora_run_broker (string config);
|
void pandora_run_broker (string config, long executions=0);
|
||||||
int count_broker_agents();
|
int count_broker_agents();
|
||||||
void check_broker_agents(string *all_conf);
|
void check_broker_agents(string *all_conf);
|
||||||
int launchTentacleProxy();
|
int launchTentacleProxy();
|
||||||
|
@ -11,7 +11,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.738(Build 190918))"
|
VALUE "ProductVersion", "(7.0NG.738(Build 190926))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.738-190918
|
Version: 7.0NG.738-190926
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.738-190918"
|
pandora_version="7.0NG.738-190926"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -1,7 +1,23 @@
|
|||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE `tdatabase` MODIFY `last_error` text;
|
||||||
|
ALTER TABLE `tdatabase` MODIFY `host` VARCHAR(255) DEFAULT '';
|
||||||
|
ALTER TABLE `tdatabase` ADD COLUMN `label` VARCHAR(255) DEFAULT '';
|
||||||
|
ALTER TABLE `tdatabase` MODIFY `os_user` VARCHAR(255) DEFAULT '';
|
||||||
|
ALTER TABLE `tdatabase` MODIFY `db_port` INT UNSIGNED NOT NULL DEFAULT 3306;
|
||||||
|
ALTER TABLE `tdatabase` MODIFY `os_port` INT UNSIGNED NOT NULL DEFAULT 22;
|
||||||
|
ALTER TABLE `tdatabase` ADD COLUMN `ssh_key` TEXT;
|
||||||
|
ALTER TABLE `tdatabase` ADD COLUMN `ssh_pubkey` TEXT;
|
||||||
|
|
||||||
|
UPDATE `tdatabase` set `label`=`host`;
|
||||||
|
|
||||||
UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `width` = 0 && image NOT LIKE '%dot%' && ((`type` IN (0,5)) ||
|
UPDATE `tlayout_data` SET `height` = 70 , `width` = 70 WHERE `height` = 0 && `width` = 0 && image NOT LIKE '%dot%' && ((`type` IN (0,5)) ||
|
||||||
(`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') ||
|
(`type` = 10 && `image` IS NOT NULL && `image` != '' && `image` != 'none') ||
|
||||||
(`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0));
|
(`type` = 11 && `image` IS NOT NULL && `image` != '' && `image` != 'none' && `show_statistics` = 0));
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||||
|
ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
@ -726,7 +726,7 @@ render_info_data(
|
|||||||
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS Licence Information').'</th></tr>';
|
echo "<tr><th style='background-color:#b1b1b1;font-weight:bold;font-style:italic;border-radius:2px;' align=center colspan='2'>".__(' Pandora FMS Licence Information').'</th></tr>';
|
||||||
|
|
||||||
render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key');
|
render_row(html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:40px; width:450px;"', true), 'Customer key');
|
||||||
render_row($license['expiry_date'], 'Expires');
|
render_row($license['expiry_date'], $license['expiry_caption']);
|
||||||
render_row($license['limit'].' agents', 'Platform Limit');
|
render_row($license['limit'].' agents', 'Platform Limit');
|
||||||
render_row($license['count'].' agents', 'Current Platform Count');
|
render_row($license['count'].' agents', 'Current Platform Count');
|
||||||
render_row($license['count_enabled'].' agents', 'Current Platform Count (enabled: items)');
|
render_row($license['count_enabled'].' agents', 'Current Platform Count (enabled: items)');
|
||||||
|
@ -219,14 +219,17 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
|
|||||||
-- Table `tdatabase`
|
-- Table `tdatabase`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
CREATE TABLE IF NOT EXISTS `tdatabase` (
|
CREATE TABLE IF NOT EXISTS `tdatabase` (
|
||||||
`id` int(10) unsigned NOT NULL auto_increment,
|
`id` INT(10) unsigned NOT NULL auto_increment,
|
||||||
`host` varchar(100) default '',
|
`host` VARCHAR(255) default '',
|
||||||
`os_port` int(4) unsigned default '22',
|
`label` VARCHAR(255) default '',
|
||||||
`os_user` varchar(100) default '',
|
`os_port` INT UNSIGNED NOT NULL DEFAULT 22,
|
||||||
`db_port` int(4) unsigned default '3306',
|
`os_user` VARCHAR(255) default '',
|
||||||
|
`db_port` INT UNSIGNED NOT NULL DEFAULT 3306,
|
||||||
`status` tinyint(1) unsigned default '0',
|
`status` tinyint(1) unsigned default '0',
|
||||||
`action` tinyint(1) unsigned default '0',
|
`action` tinyint(1) unsigned default '0',
|
||||||
`last_error` varchar(255) default '',
|
`ssh_key` TEXT,
|
||||||
|
`ssh_pubkey` TEXT,
|
||||||
|
`last_error` TEXT,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
||||||
|
|
||||||
@ -798,6 +801,7 @@ ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) D
|
|||||||
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
||||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
|
||||||
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
|
||||||
|
ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
-- Table `treport_content_sla_com_temp` (treport_content_sla_combined_template)
|
||||||
@ -1454,6 +1458,7 @@ ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
|
|||||||
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
|
||||||
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
|
||||||
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
|
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
|
||||||
|
ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
-- Table `tmodule_relationship`
|
-- Table `tmodule_relationship`
|
||||||
|
@ -1,15 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
// Pandora FMS - http://pandorafms.com
|
/**
|
||||||
// ==================================================
|
* Manage database HA cluster.
|
||||||
// Copyright (c) 2005-2018 Artica Soluciones Tecnologicas
|
*
|
||||||
// Please see http://pandorafms.org for full contribution list
|
* @category Manager
|
||||||
// This program is free software; you can redistribute it and/or
|
* @package Pandora FMS
|
||||||
// modify it under the terms of the GNU General Public License
|
* @subpackage Database HA cluster
|
||||||
// as published by the Free Software Foundation; version 2
|
* @version 1.0.0
|
||||||
// This program is distributed in the hope that it will be useful,
|
* @license See below
|
||||||
// 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.
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2007-2012 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||||
|
* You cannnot redistribute it without written permission of copyright holder.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
@ -24,8 +34,6 @@ if (! check_acl($config['id_user'], 0, 'PM')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui_require_css_file('firts_task');
|
ui_require_css_file('firts_task');
|
||||||
?>
|
|
||||||
<?php
|
|
||||||
ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]);
|
ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clusters defined yet.') ]);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -44,8 +52,9 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (check_acl($config['id_user'], 0, 'AW')) {
|
if (check_acl($config['id_user'], 0, 'PM')) {
|
||||||
echo "<div id='create_master_window'></div>";
|
echo "<div id='create_master_window'></div>";
|
||||||
|
echo "<div id='msg'></div>";
|
||||||
?>
|
?>
|
||||||
<input style="margin-bottom:20px;" onclick="show_create_ha_cluster();" type="submit" class="button_task" value="<?php echo __('Add new node'); ?>" />
|
<input style="margin-bottom:20px;" onclick="show_create_ha_cluster();" type="submit" class="button_task" value="<?php echo __('Add new node'); ?>" />
|
||||||
<?php
|
<?php
|
||||||
@ -53,35 +62,3 @@ ui_print_info_message(['no_close' => true, 'message' => __('There are no HA clus
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
|
||||||
function show_create_ha_cluster() {
|
|
||||||
var params = {};
|
|
||||||
params["dialog_master"] = 1;
|
|
||||||
params["page"] = "enterprise/include/ajax/HA_cluster.ajax";
|
|
||||||
jQuery.ajax ({
|
|
||||||
data: params,
|
|
||||||
dataType: "html",
|
|
||||||
type: "POST",
|
|
||||||
url: "ajax.php",
|
|
||||||
success: function (data) {
|
|
||||||
$("#create_master_window").dialog ({
|
|
||||||
title: '<?php echo __('Add master node'); ?>',
|
|
||||||
resizable: true,
|
|
||||||
draggable: true,
|
|
||||||
modal: true,
|
|
||||||
close: function() {
|
|
||||||
|
|
||||||
},
|
|
||||||
overlay: {
|
|
||||||
opacity: 0.5,
|
|
||||||
background: "black"
|
|
||||||
},
|
|
||||||
width: 800,
|
|
||||||
height: 600
|
|
||||||
}).empty()
|
|
||||||
.html(data)
|
|
||||||
.show ();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
@ -29,599 +29,43 @@
|
|||||||
// Begin.
|
// Begin.
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Check access.
|
require_once $config['homedir'].'/include/class/CredentialStore.class.php';
|
||||||
check_login();
|
|
||||||
|
|
||||||
if (! check_acl($config['id_user'], 0, 'PM')) {
|
$ajaxPage = 'godmode/groups/credential_store';
|
||||||
db_pandora_audit(
|
|
||||||
'ACL Violation',
|
|
||||||
'Trying to access event viewer'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
// Control call flow.
|
||||||
|
try {
|
||||||
|
// User access and validation is being processed on class constructor.
|
||||||
|
$cs = new CredentialStore($ajaxPage);
|
||||||
|
} catch (Exception $e) {
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
return ['error' => 'noaccess'];
|
echo json_encode(['error' => '[CredentialStore]'.$e->getMessage() ]);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo '[CredentialStore]'.$e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
include 'general/noaccess.php';
|
// Stop this execution, but continue 'globally'.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required files.
|
// AJAX controller.
|
||||||
ui_require_css_file('credential_store');
|
|
||||||
require_once $config['homedir'].'/include/functions_credential_store.php';
|
|
||||||
require_once $config['homedir'].'/include/functions_io.php';
|
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
$draw = get_parameter('draw', 0);
|
$method = get_parameter('method');
|
||||||
$filter = get_parameter('filter', []);
|
|
||||||
$get_key = get_parameter('get_key', 0);
|
|
||||||
$new_form = get_parameter('new_form', 0);
|
|
||||||
$new_key = get_parameter('new_key', 0);
|
|
||||||
$update_key = get_parameter('update_key', 0);
|
|
||||||
$delete_key = get_parameter('delete_key', 0);
|
|
||||||
|
|
||||||
if ($new_form) {
|
if (method_exists($cs, $method) === true) {
|
||||||
echo print_inputs();
|
if ($cs->ajaxMethod($method) === true) {
|
||||||
exit;
|
$cs->{$method}();
|
||||||
}
|
|
||||||
|
|
||||||
if ($delete_key) {
|
|
||||||
$identifier = get_parameter('identifier', null);
|
|
||||||
|
|
||||||
if (empty($identifier)) {
|
|
||||||
ajax_msg('error', __('identifier cannot be empty'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (db_process_sql_delete(
|
|
||||||
'tcredential_store',
|
|
||||||
['identifier' => $identifier]
|
|
||||||
) === false
|
|
||||||
) {
|
|
||||||
ajax_msg('error', $config['dbconnection']->error, true);
|
|
||||||
} else {
|
} else {
|
||||||
ajax_msg('result', $identifier, true);
|
$cs->error('Unavailable method.');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$cs->error('Method not found. ['.$method.']');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update_key) {
|
// Stop any execution.
|
||||||
$data = get_parameter('values', null);
|
|
||||||
|
|
||||||
if ($data === null || !is_array($data)) {
|
|
||||||
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = [];
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
if ($key == 'identifier') {
|
|
||||||
$identifier = base64_decode($value);
|
|
||||||
} else if ($key == 'product') {
|
|
||||||
$product = base64_decode($value);
|
|
||||||
} else {
|
|
||||||
$values[$key] = base64_decode($value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($identifier)) {
|
|
||||||
ajax_msg('error', __('identifier cannot be empty'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($product)) {
|
|
||||||
ajax_msg('error', __('product cannot be empty'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (db_process_sql_update(
|
|
||||||
'tcredential_store',
|
|
||||||
$values,
|
|
||||||
['identifier' => $identifier]
|
|
||||||
) === false
|
|
||||||
) {
|
|
||||||
ajax_msg('error', $config['dbconnection']->error);
|
|
||||||
} else {
|
|
||||||
ajax_msg('result', $identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($new_key) {
|
|
||||||
$data = get_parameter('values', null);
|
|
||||||
|
|
||||||
if ($data === null || !is_array($data)) {
|
|
||||||
echo json_encode(['error' => __('Invalid parameters, please retry')]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$values = [];
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
$values[$key] = base64_decode($value);
|
|
||||||
if ($key == 'identifier') {
|
|
||||||
$values[$key] = preg_replace('/\s+/', '-', trim($values[$key]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$identifier = $values['identifier'];
|
|
||||||
|
|
||||||
if (empty($identifier)) {
|
|
||||||
ajax_msg('error', __('identifier cannot be empty'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($values['product'])) {
|
|
||||||
ajax_msg('error', __('product cannot be empty'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (db_process_sql_insert('tcredential_store', $values) === false) {
|
|
||||||
ajax_msg('error', $config['dbconnection']->error);
|
|
||||||
} else {
|
|
||||||
ajax_msg('result', $identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($get_key) {
|
|
||||||
$identifier = get_parameter('identifier', null);
|
|
||||||
|
|
||||||
$key = get_key($identifier);
|
|
||||||
echo print_inputs($key);
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($draw) {
|
|
||||||
// Datatables offset, limit and order.
|
|
||||||
$start = get_parameter('start', 0);
|
|
||||||
$length = get_parameter('length', $config['block_size']);
|
|
||||||
$order = get_datatable_order(true);
|
|
||||||
try {
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
$fields = [
|
|
||||||
'cs.*',
|
|
||||||
'tg.nombre as `group`',
|
|
||||||
];
|
|
||||||
|
|
||||||
// Retrieve data.
|
|
||||||
$data = credentials_get_all(
|
|
||||||
// Fields.
|
|
||||||
$fields,
|
|
||||||
// Filter.
|
|
||||||
$filter,
|
|
||||||
// Offset.
|
|
||||||
$start,
|
|
||||||
// Limit.
|
|
||||||
$length,
|
|
||||||
// Order.
|
|
||||||
$order['direction'],
|
|
||||||
// Sort field.
|
|
||||||
$order['field']
|
|
||||||
);
|
|
||||||
|
|
||||||
// Retrieve counter.
|
|
||||||
$count = credentials_get_all(
|
|
||||||
'count',
|
|
||||||
$filter
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($data) {
|
|
||||||
$data = array_reduce(
|
|
||||||
$data,
|
|
||||||
function ($carry, $item) {
|
|
||||||
// Transforms array of arrays $data into an array
|
|
||||||
// of objects, making a post-process of certain fields.
|
|
||||||
$tmp = (object) $item;
|
|
||||||
$tmp->username = io_safe_output($tmp->username);
|
|
||||||
|
|
||||||
if (empty($tmp->group)) {
|
|
||||||
$tmp->group = __('All');
|
|
||||||
} else {
|
|
||||||
$tmp->group = io_safe_output($tmp->group);
|
|
||||||
}
|
|
||||||
|
|
||||||
$carry[] = $tmp;
|
|
||||||
return $carry;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Datatables format: RecordsTotal && recordsfiltered.
|
|
||||||
echo json_encode(
|
|
||||||
[
|
|
||||||
'data' => $data,
|
|
||||||
'recordsTotal' => $count,
|
|
||||||
'recordsFiltered' => $count,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
// Capture output.
|
|
||||||
$response = ob_get_clean();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return json_encode(['error' => $e->getMessage()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not valid, show error with issue.
|
|
||||||
json_decode($response);
|
|
||||||
if (json_last_error() == JSON_ERROR_NONE) {
|
|
||||||
// If valid dump.
|
|
||||||
echo $response;
|
|
||||||
} else {
|
|
||||||
echo json_encode(
|
|
||||||
['error' => $response]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
} else {
|
||||||
|
// Run.
|
||||||
|
$cs->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Datatables list.
|
|
||||||
try {
|
|
||||||
$columns = [
|
|
||||||
'group',
|
|
||||||
'identifier',
|
|
||||||
'product',
|
|
||||||
'username',
|
|
||||||
'options',
|
|
||||||
];
|
|
||||||
|
|
||||||
$column_names = [
|
|
||||||
__('Group'),
|
|
||||||
__('Identifier'),
|
|
||||||
__('Product'),
|
|
||||||
__('User'),
|
|
||||||
[
|
|
||||||
'text' => __('Options'),
|
|
||||||
'class' => 'action_buttons',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$table_id = 'keystore';
|
|
||||||
// Load datatables user interface.
|
|
||||||
ui_print_datatable(
|
|
||||||
[
|
|
||||||
'id' => $table_id,
|
|
||||||
'class' => 'info_table',
|
|
||||||
'style' => 'width: 100%',
|
|
||||||
'columns' => $columns,
|
|
||||||
'column_names' => $column_names,
|
|
||||||
'ajax_url' => 'godmode/groups/credential_store',
|
|
||||||
'ajax_postprocess' => 'process_datatables_item(item)',
|
|
||||||
'no_sortable_columns' => [-1],
|
|
||||||
'order' => [
|
|
||||||
'field' => 'identifier',
|
|
||||||
'direction' => 'asc',
|
|
||||||
],
|
|
||||||
'search_button_class' => 'sub filter float-right',
|
|
||||||
'form' => [
|
|
||||||
'inputs' => [
|
|
||||||
[
|
|
||||||
'label' => __('Group'),
|
|
||||||
'type' => 'select',
|
|
||||||
'id' => 'filter_id_group',
|
|
||||||
'name' => 'filter_id_group',
|
|
||||||
'options' => users_get_groups_for_select(
|
|
||||||
$config['id_user'],
|
|
||||||
'AR',
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'label' => __('Free search'),
|
|
||||||
'type' => 'text',
|
|
||||||
'class' => 'mw250px',
|
|
||||||
'id' => 'free_search',
|
|
||||||
'name' => 'free_search',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auxiliar div.
|
|
||||||
$new = '<div id="new_key" style="display: none"><form id="form_new">';
|
|
||||||
$new .= '</form></div>';
|
|
||||||
$details = '<div id="info_key" style="display: none"><form id="form_update">';
|
|
||||||
$details .= '</form></div>';
|
|
||||||
$aux = '<div id="aux" style="display: none"></div>';
|
|
||||||
|
|
||||||
|
|
||||||
echo $new.$details.$aux;
|
|
||||||
|
|
||||||
// Create button.
|
|
||||||
echo '<div class="w100p flex-content-right">';
|
|
||||||
html_print_submit_button(
|
|
||||||
__('Add key'),
|
|
||||||
'create',
|
|
||||||
false,
|
|
||||||
'class="sub next"'
|
|
||||||
);
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function process_datatables_item(item) {
|
|
||||||
item.options = '<a href="javascript:" onclick="display_key(\'';
|
|
||||||
item.options += item.identifier;
|
|
||||||
item.options += '\')" ><?php echo html_print_image('images/eye.png', true, ['title' => __('Show')]); ?></a>';
|
|
||||||
|
|
||||||
item.options += '<a href="javascript:" onclick="delete_key(\'';
|
|
||||||
item.options += item.identifier;
|
|
||||||
item.options += '\')" ><?php echo html_print_image('images/cross.png', true, ['title' => __('Delete')]); ?></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function handle_response(data) {
|
|
||||||
var title = "<?php echo __('Success'); ?>";
|
|
||||||
var text = '';
|
|
||||||
var failed = 0;
|
|
||||||
try {
|
|
||||||
data = JSON.parse(data);
|
|
||||||
text = data['result'];
|
|
||||||
} catch (err) {
|
|
||||||
title = "<?php echo __('Failed'); ?>";
|
|
||||||
text = err.message;
|
|
||||||
failed = 1;
|
|
||||||
}
|
|
||||||
if (!failed && data['error'] != undefined) {
|
|
||||||
title = "<?php echo __('Failed'); ?>";
|
|
||||||
text = data['error'];
|
|
||||||
failed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#aux').empty();
|
|
||||||
$('#aux').html(text);
|
|
||||||
$('#aux').dialog({
|
|
||||||
width: 450,
|
|
||||||
position: {
|
|
||||||
my: 'center',
|
|
||||||
at: 'center',
|
|
||||||
of: window,
|
|
||||||
collision: 'fit'
|
|
||||||
},
|
|
||||||
title: title,
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: 'OK',
|
|
||||||
click: function(e) {
|
|
||||||
if (!failed) {
|
|
||||||
dt_<?php echo $table_id; ?>.draw(0);
|
|
||||||
$(".ui-dialog-content").dialog("close");
|
|
||||||
cleanupDOM();
|
|
||||||
} else {
|
|
||||||
$(this).dialog('close');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete_key(id) {
|
|
||||||
$('#aux').empty();
|
|
||||||
$('#aux').text('<?php echo __('Are you sure?'); ?>');
|
|
||||||
$('#aux').dialog({
|
|
||||||
title: '<?php echo __('Delete'); ?> ' + id,
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
|
||||||
text: '<?php echo __('Cancel'); ?>',
|
|
||||||
click: function(e) {
|
|
||||||
$(this).dialog('close');
|
|
||||||
cleanupDOM();
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: 'Delete',
|
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
|
||||||
click: function(e) {
|
|
||||||
$.ajax({
|
|
||||||
method: 'post',
|
|
||||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
|
||||||
data: {
|
|
||||||
page: 'godmode/groups/credential_store',
|
|
||||||
delete_key: 1,
|
|
||||||
identifier: id
|
|
||||||
},
|
|
||||||
datatype: "json",
|
|
||||||
success: function (data) {
|
|
||||||
handle_response(data);
|
|
||||||
},
|
|
||||||
error: function(e) {
|
|
||||||
handle_response(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function display_key(id) {
|
|
||||||
$('#form_update').empty();
|
|
||||||
$('#form_update').html('Loading...');
|
|
||||||
$.ajax({
|
|
||||||
method: 'post',
|
|
||||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
|
||||||
data: {
|
|
||||||
page: 'godmode/groups/credential_store',
|
|
||||||
get_key: 1,
|
|
||||||
identifier: id
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
$('#info_key').dialog({
|
|
||||||
width: 580,
|
|
||||||
height: 400,
|
|
||||||
position: {
|
|
||||||
my: 'center',
|
|
||||||
at: 'center',
|
|
||||||
of: window,
|
|
||||||
collision: 'fit'
|
|
||||||
},
|
|
||||||
title: id,
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
|
||||||
text: '<?php echo __('Cancel'); ?>',
|
|
||||||
click: function(e) {
|
|
||||||
$(this).dialog('close');
|
|
||||||
cleanupDOM();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: 'Update',
|
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
|
||||||
click: function(e) {
|
|
||||||
var values = {};
|
|
||||||
|
|
||||||
$('#form_update :input').each(function() {
|
|
||||||
values[this.name] = btoa($(this).val());
|
|
||||||
});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
method: 'post',
|
|
||||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
|
||||||
data: {
|
|
||||||
page: 'godmode/groups/credential_store',
|
|
||||||
update_key: 1,
|
|
||||||
values: values
|
|
||||||
},
|
|
||||||
datatype: "json",
|
|
||||||
success: function (data) {
|
|
||||||
handle_response(data);
|
|
||||||
},
|
|
||||||
error: function(e) {
|
|
||||||
handle_response(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
$('#form_update').html(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanupDOM() {
|
|
||||||
$('#div-identifier').empty();
|
|
||||||
$('#div-product').empty();
|
|
||||||
$('#div-username').empty();
|
|
||||||
$('#div-password').empty();
|
|
||||||
$('#div-extra_1').empty();
|
|
||||||
$('#div-extra_2').empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculate_inputs() {
|
|
||||||
if ($('#product :selected').val() == "CUSTOM") {
|
|
||||||
$('#div-username label').text('<?php echo __('User'); ?>');
|
|
||||||
$('#div-password label').text('<?php echo __('Password'); ?>');
|
|
||||||
$('#div-extra_1').hide();
|
|
||||||
$('#div-extra_2').hide();
|
|
||||||
} else if ($('#product :selected').val() == "AWS") {
|
|
||||||
$('#div-username label').text('<?php echo __('Access key ID'); ?>');
|
|
||||||
$('#div-password label').text('<?php echo __('Secret access key'); ?>');
|
|
||||||
$('#div-extra_1').hide();
|
|
||||||
$('#div-extra_2').hide();
|
|
||||||
} else if ($('#product :selected').val() == "AZURE") {
|
|
||||||
$('#div-username label').text('<?php echo __('Client ID'); ?>');
|
|
||||||
$('#div-password label').text('<?php echo __('Application secret'); ?>');
|
|
||||||
$('#div-extra_1 label').text('<?php echo __('Tenant or domain name'); ?>');
|
|
||||||
$('#div-extra_2 label').text('<?php echo __('Subscription id'); ?>');
|
|
||||||
$('#div-extra_1').show();
|
|
||||||
$('#div-extra_2').show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function add_key() {
|
|
||||||
// Clear form.
|
|
||||||
$('#form_update').empty();
|
|
||||||
$('#form_update').html('Loading...');
|
|
||||||
$.ajax({
|
|
||||||
method: 'post',
|
|
||||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
|
||||||
data: {
|
|
||||||
page: 'godmode/groups/credential_store',
|
|
||||||
new_form: 1
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
$('#form_new').html(data);
|
|
||||||
$('#id_group').val(0);
|
|
||||||
// By default CUSTOM.
|
|
||||||
$('#product').val('CUSTOM');
|
|
||||||
calculate_inputs();
|
|
||||||
|
|
||||||
$('#product').on('change', function() {
|
|
||||||
calculate_inputs()
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show form.
|
|
||||||
$('#new_key').dialog({
|
|
||||||
width: 580,
|
|
||||||
height: 400,
|
|
||||||
position: {
|
|
||||||
my: 'center',
|
|
||||||
at: 'center',
|
|
||||||
of: window,
|
|
||||||
collision: 'fit'
|
|
||||||
},
|
|
||||||
title: "<?php echo __('Register new key into keystore'); ?>",
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel',
|
|
||||||
text: "<?php echo __('Cancel'); ?>",
|
|
||||||
click: function(e) {
|
|
||||||
$(this).dialog('close');
|
|
||||||
cleanupDOM();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
class: 'ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next',
|
|
||||||
text: 'OK',
|
|
||||||
click: function(e) {
|
|
||||||
var values = {};
|
|
||||||
$('#form_new :input').each(function() {
|
|
||||||
values[this.name] = btoa($(this).val());
|
|
||||||
});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
method: 'post',
|
|
||||||
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
|
||||||
data: {
|
|
||||||
page: 'godmode/groups/credential_store',
|
|
||||||
new_key: 1,
|
|
||||||
values: values
|
|
||||||
},
|
|
||||||
datatype: "json",
|
|
||||||
success: function (data) {
|
|
||||||
handle_response(data);
|
|
||||||
},
|
|
||||||
error: function(e) {
|
|
||||||
handle_response(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
$("#submit-create").on('click', function(){
|
|
||||||
add_key();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
@ -153,6 +153,7 @@ $checks_in_ok_status = true;
|
|||||||
$unknown_checks = true;
|
$unknown_checks = true;
|
||||||
$agent_max_value = true;
|
$agent_max_value = true;
|
||||||
$agent_min_value = true;
|
$agent_min_value = true;
|
||||||
|
$uncompressed_module = true;
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'new':
|
case 'new':
|
||||||
@ -427,6 +428,7 @@ switch ($action) {
|
|||||||
);
|
);
|
||||||
$idAgentModule = $item['id_agent_module'];
|
$idAgentModule = $item['id_agent_module'];
|
||||||
$period = $item['period'];
|
$period = $item['period'];
|
||||||
|
$uncompressed_module = $item['uncompressed_module'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'historical_data':
|
case 'historical_data':
|
||||||
@ -810,7 +812,6 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$urlForm = $config['homeurl'].'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action='.$actionParameter.'&id_report='.$idReport;
|
$urlForm = $config['homeurl'].'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action='.$actionParameter.'&id_report='.$idReport;
|
||||||
|
|
||||||
echo '<form action="'.$urlForm.'" method="post">';
|
echo '<form action="'.$urlForm.'" method="post">';
|
||||||
@ -2792,6 +2793,23 @@ $class = 'databox filters';
|
|||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_uncompressed_module" style="" class="datos">
|
||||||
|
<td style="font-weight:bold;">
|
||||||
|
<?php
|
||||||
|
echo __('Uncompress module').ui_print_help_tip(
|
||||||
|
__('Use uncompressed module data.'),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td style="">
|
||||||
|
<?php
|
||||||
|
html_print_checkbox('uncompressed_module', 1, $item['uncompressed_module'], false, false, '', false);
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -4524,6 +4542,7 @@ function chooseType() {
|
|||||||
$('#row_select_fields').hide();
|
$('#row_select_fields').hide();
|
||||||
$("#row_select_fields2").hide();
|
$("#row_select_fields2").hide();
|
||||||
$("#row_select_fields3").hide();
|
$("#row_select_fields3").hide();
|
||||||
|
$("#row_uncompressed_module").hide();
|
||||||
|
|
||||||
// SLA list default state.
|
// SLA list default state.
|
||||||
$("#sla_list").hide();
|
$("#sla_list").hide();
|
||||||
@ -4732,6 +4751,7 @@ function chooseType() {
|
|||||||
$("#row_module").show();
|
$("#row_module").show();
|
||||||
$("#row_period").show();
|
$("#row_period").show();
|
||||||
$("#row_historical_db_check").hide();
|
$("#row_historical_db_check").hide();
|
||||||
|
$("#row_uncompressed_module").show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'historical_data':
|
case 'historical_data':
|
||||||
|
@ -1908,6 +1908,11 @@ switch ($action) {
|
|||||||
$values['id_agent'] = get_parameter('group');
|
$values['id_agent'] = get_parameter('group');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($values['type'] == 'sumatory') {
|
||||||
|
$values['uncompressed_module'] = get_parameter('uncompressed_module', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$values['header_definition'] = get_parameter('header');
|
$values['header_definition'] = get_parameter('header');
|
||||||
$values['column_separator'] = get_parameter('field');
|
$values['column_separator'] = get_parameter('field');
|
||||||
$values['line_separator'] = get_parameter('line');
|
$values['line_separator'] = get_parameter('line');
|
||||||
@ -2464,6 +2469,10 @@ switch ($action) {
|
|||||||
$values['id_agent'] = get_parameter('group');
|
$values['id_agent'] = get_parameter('group');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($values['type'] == 'sumatory') {
|
||||||
|
$values['uncompressed_module'] = get_parameter('uncompressed_module', 0);
|
||||||
|
}
|
||||||
|
|
||||||
$values['header_definition'] = get_parameter('header');
|
$values['header_definition'] = get_parameter('header');
|
||||||
$values['column_separator'] = get_parameter('field');
|
$values['column_separator'] = get_parameter('field');
|
||||||
$values['line_separator'] = get_parameter('line');
|
$values['line_separator'] = get_parameter('line');
|
||||||
|
@ -107,7 +107,7 @@ $table->data = [];
|
|||||||
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
|
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
|
||||||
$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:50px; width:450px;"', true);
|
$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="height:50px; width:450px;"', true);
|
||||||
|
|
||||||
$table->data[1][0] = '<strong>'.__('Expires').'</strong>';
|
$table->data[1][0] = '<strong>'.__($license['expiry_caption']).'</strong>';
|
||||||
$table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true);
|
$table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true);
|
||||||
|
|
||||||
$table->data[2][0] = '<strong>'.__('Platform Limit').'</strong>';
|
$table->data[2][0] = '<strong>'.__('Platform Limit').'</strong>';
|
||||||
|
@ -58,6 +58,16 @@ global $config;
|
|||||||
|
|
||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
|
if (is_ajax()) {
|
||||||
|
enterprise_include_once('include/functions_cron.php');
|
||||||
|
|
||||||
|
$test_address = get_parameter('test_address', '');
|
||||||
|
|
||||||
|
$res = enterprise_hook('send_email_attachment', [$test_address, __('This is an email test sent from Pandora FMS. If you can read this, your configuration works.'), __('Testing Pandora FMS email'), null]);
|
||||||
|
|
||||||
|
echo $res;
|
||||||
|
}
|
||||||
|
|
||||||
$table = new StdClass();
|
$table = new StdClass();
|
||||||
$table->class = 'databox filters';
|
$table->class = 'databox filters';
|
||||||
$table->id = 'setup_general';
|
$table->id = 'setup_general';
|
||||||
@ -68,6 +78,12 @@ $table->size[0] = '30%';
|
|||||||
$table->style[0] = 'font-weight:bold';
|
$table->style[0] = 'font-weight:bold';
|
||||||
$table->size[1] = '70%';
|
$table->size[1] = '70%';
|
||||||
|
|
||||||
|
$table_mail_conf = new stdClass();
|
||||||
|
$table_mail_conf->width = '100%';
|
||||||
|
$table_mail_conf->class = 'databox filters';
|
||||||
|
$table_mail_conf->data = [];
|
||||||
|
$table_mail_conf->style[0] = 'font-weight: bold';
|
||||||
|
|
||||||
// Current config["language"] could be set by user, not taken from global setup !
|
// Current config["language"] could be set by user, not taken from global setup !
|
||||||
$current_system_lang = db_get_sql(
|
$current_system_lang = db_get_sql(
|
||||||
'SELECT `value` FROM tconfig WHERE `token` = "language"'
|
'SELECT `value` FROM tconfig WHERE `token` = "language"'
|
||||||
@ -330,6 +346,49 @@ echo '<legend>'.__('General options').'</legend>';
|
|||||||
html_print_input_hidden('update_config', 1);
|
html_print_input_hidden('update_config', 1);
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
|
$encryption = [
|
||||||
|
'ssl' => 'SSL/TLS',
|
||||||
|
'sslv2' => 'SSLv2',
|
||||||
|
'sslv3' => 'SSLv3',
|
||||||
|
'tls' => 'STARTTLS',
|
||||||
|
];
|
||||||
|
|
||||||
|
echo '</fieldset>';
|
||||||
|
|
||||||
|
echo '<fieldset>';
|
||||||
|
echo '<legend>'.__('Mail configuration').'</legend>';
|
||||||
|
|
||||||
|
$table_mail_conf->data[0][0] = __('From address');
|
||||||
|
$table_mail_conf->data[0][1] = html_print_input_text('email_from_dir', $config['email_from_dir'], '', 30, 100, true);
|
||||||
|
|
||||||
|
$table_mail_conf->data[1][0] = __('From name');
|
||||||
|
$table_mail_conf->data[1][2] = html_print_input_text('email_from_name', $config['email_from_name'], '', 30, 100, true);
|
||||||
|
|
||||||
|
$table_mail_conf->data[2][0] = __('SMTP Server');
|
||||||
|
$table_mail_conf->data[2][1] = html_print_input_text('email_smtpServer', $config['email_smtpServer'], '', 30, 100, true);
|
||||||
|
|
||||||
|
$table_mail_conf->data[3][0] = __('SMTP Port');
|
||||||
|
$table_mail_conf->data[3][1] = html_print_input_text('email_smtpPort', $config['email_smtpPort'], '', 30, 100, true);
|
||||||
|
|
||||||
|
$table_mail_conf->data[4][0] = __('Encryption');
|
||||||
|
$table_mail_conf->data[4][1] = html_print_select($encryption, 'email_encryption', $config['email_encryption'], '', __('none'), 0, true);
|
||||||
|
|
||||||
|
$table_mail_conf->data[5][0] = __('Email user');
|
||||||
|
$table_mail_conf->data[5][1] = html_print_input_text('email_username', $config['email_username'], '', 30, 100, true);
|
||||||
|
|
||||||
|
$table_mail_conf->data[6][0] = __('Email password');
|
||||||
|
$table_mail_conf->data[6][1] = html_print_input_password('email_password', io_output_password($config['email_password']), '', 30, 100, true);
|
||||||
|
|
||||||
|
$uniqid = uniqid();
|
||||||
|
|
||||||
|
$table_mail_conf->data[7][0] = html_print_button(__('Email test'), 'email_test_dialog', false, "show_email_test('$uniqid');", 'class="sub next"', true).ui_print_help_tip(__('Check the current saved email configuration by sending a test email to a desired account.'), true);
|
||||||
|
|
||||||
|
print_email_test_modal_window($uniqid);
|
||||||
|
|
||||||
|
html_print_input_hidden('update_config', 1);
|
||||||
|
html_print_table($table_mail_conf);
|
||||||
|
|
||||||
|
|
||||||
echo '</fieldset>';
|
echo '</fieldset>';
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
@ -337,6 +396,25 @@ html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"'
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
|
// Print the modal window for the summary of each alerts group
|
||||||
|
function print_email_test_modal_window($id)
|
||||||
|
{
|
||||||
|
// Email config table.
|
||||||
|
$table_mail_test = new stdClass();
|
||||||
|
$table_mail_test->width = '100%';
|
||||||
|
$table_mail_test->class = 'databox filters';
|
||||||
|
$table_mail_test->data = [];
|
||||||
|
$table_mail_test->style[0] = 'font-weight: bold';
|
||||||
|
$table_mail_test->colspan[1][0] = 2;
|
||||||
|
|
||||||
|
$table_mail_test->data[0][0] = __('Address').ui_print_help_tip(__('Email address to which the test email will be sent. Please check your inbox after email is sent.'), true);
|
||||||
|
$table_mail_test->data[0][1] = html_print_input_text('email_test_address', '', '', 40, 100, true);
|
||||||
|
|
||||||
|
$table_mail_test->data[1][0] = html_print_button(__('Send'), 'email_test', false, '', 'class="sub next"', true).'  <span id="email_test_sent_message" style="display:none;">Email sent</span><span id="email_test_failure_message" style="display:none;">Email could not been sent</span>';
|
||||||
|
|
||||||
|
echo '<div id="email_test_'.$id.'" title="'.__('Check mail configuration').'" style="display:none">'.html_print_table($table_mail_test, true).'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -375,6 +453,40 @@ function show_timezone () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function show_email_test(id) {
|
||||||
|
$('#email_test_sent_message').hide();
|
||||||
|
$('#email_test_failure_message').hide();
|
||||||
|
|
||||||
|
$("#email_test_"+id).dialog({
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
height: 175,
|
||||||
|
width: 450,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function perform_email_test () {
|
||||||
|
var test_address = $('#text-email_test_address').val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "ajax.php",
|
||||||
|
data: "page=godmode/setup/setup_general&test_address="+test_address,
|
||||||
|
dataType: "html",
|
||||||
|
success: function(data) {
|
||||||
|
$('#email_test_sent_message').show();
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$('#email_test_failure_message').show();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready (function () {
|
$(document).ready (function () {
|
||||||
|
|
||||||
$("#zone").attr("hidden", true);
|
$("#zone").attr("hidden", true);
|
||||||
@ -431,5 +543,7 @@ $(document).ready (function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('input#button-email_test').click(perform_email_test);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
BIN
pandora_console/images/console/background/fondo-keep-alive.jpg
Normal file
BIN
pandora_console/images/console/background/fondo-keep-alive.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 229 KiB |
BIN
pandora_console/images/console/icons/status.png
Normal file
BIN
pandora_console/images/console/icons/status.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/console/icons/status_bad.png
Normal file
BIN
pandora_console/images/console/icons/status_bad.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
pandora_console/images/console/icons/status_ok.png
Normal file
BIN
pandora_console/images/console/icons/status_ok.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
pandora_console/images/console/icons/status_warning.png
Normal file
BIN
pandora_console/images/console/icons/status_warning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
@ -873,18 +873,20 @@ class ConsoleSupervisor
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
$remote_config_dir = io_safe_output($config['remote_config']);
|
||||||
|
|
||||||
if (enterprise_installed()
|
if (enterprise_installed()
|
||||||
&& isset($config['license_nms'])
|
&& isset($config['license_nms'])
|
||||||
&& $config['license_nms'] != 1
|
&& $config['license_nms'] != 1
|
||||||
) {
|
) {
|
||||||
if (is_readable($config['remote_config']) !== true) {
|
if (is_readable($remote_config_dir) !== true) {
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG',
|
||||||
'title' => __('Remote configuration directory is not readable'),
|
'title' => __('Remote configuration directory is not readable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
'Remote configuration directory %s is not readable. Please, adjust configuration.',
|
||||||
$config['remote_config']
|
$remote_config_dir
|
||||||
),
|
),
|
||||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||||
]
|
]
|
||||||
@ -896,14 +898,14 @@ class ConsoleSupervisor
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_writable($config['remote_config'].'/conf') !== true) {
|
if (is_writable($remote_config_dir.'/conf') !== true) {
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.CONF',
|
||||||
'title' => __('Remote configuration directory is not writable'),
|
'title' => __('Remote configuration directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
'Remote configuration directory %s is not writable. Please, adjust configuration.',
|
||||||
$config['remote_config'].'/conf'
|
$remote_config_dir.'/conf'
|
||||||
),
|
),
|
||||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||||
]
|
]
|
||||||
@ -914,14 +916,14 @@ class ConsoleSupervisor
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_writable($config['remote_config'].'/collections') !== true) {
|
if (is_writable($remote_config_dir.'/collections') !== true) {
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.COLLECTIONS',
|
||||||
'title' => __('Remote collections directory is not writable'),
|
'title' => __('Remote collections directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'Collections directory %s is not writable. Please, adjust configuration.',
|
'Collections directory %s is not writable. Please, adjust configuration.',
|
||||||
$config['remote_config'].'/collections'
|
$remote_config_dir.'/collections'
|
||||||
),
|
),
|
||||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||||
]
|
]
|
||||||
@ -932,14 +934,14 @@ class ConsoleSupervisor
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_writable($config['remote_config'].'/md5') !== true) {
|
if (is_writable($remote_config_dir.'/md5') !== true) {
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
'type' => 'NOTIF.PERMISSIONS.REMOTE_CONFIG.MD5',
|
||||||
'title' => __('Remote md5 directory is not writable'),
|
'title' => __('Remote md5 directory is not writable'),
|
||||||
'message' => __(
|
'message' => __(
|
||||||
'MD5 directory %s is not writable. Please, adjust configuration.',
|
'MD5 directory %s is not writable. Please, adjust configuration.',
|
||||||
$config['remote_config'].'/md5'
|
$remote_config_dir.'/md5'
|
||||||
),
|
),
|
||||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'),
|
||||||
]
|
]
|
||||||
@ -957,7 +959,7 @@ class ConsoleSupervisor
|
|||||||
$MAX_BADXML_FILES_DATA_IN = 150;
|
$MAX_BADXML_FILES_DATA_IN = 150;
|
||||||
|
|
||||||
$filecount = $this->countFiles(
|
$filecount = $this->countFiles(
|
||||||
$config['remote_config'],
|
$remote_config_dir,
|
||||||
'',
|
'',
|
||||||
$MAX_FILES_DATA_IN
|
$MAX_FILES_DATA_IN
|
||||||
);
|
);
|
||||||
@ -970,7 +972,7 @@ class ConsoleSupervisor
|
|||||||
'message' => __(
|
'message' => __(
|
||||||
'There are more than %d files in %s. Consider checking DataServer performance',
|
'There are more than %d files in %s. Consider checking DataServer performance',
|
||||||
$MAX_FILES_DATA_IN,
|
$MAX_FILES_DATA_IN,
|
||||||
$config['remote_config']
|
$remote_config_dir
|
||||||
),
|
),
|
||||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||||
]
|
]
|
||||||
@ -980,7 +982,7 @@ class ConsoleSupervisor
|
|||||||
}
|
}
|
||||||
|
|
||||||
$filecount = $this->countFiles(
|
$filecount = $this->countFiles(
|
||||||
$config['remote_config'],
|
$remote_config_dir,
|
||||||
'/^.*BADXML$/',
|
'/^.*BADXML$/',
|
||||||
$MAX_BADXML_FILES_DATA_IN
|
$MAX_BADXML_FILES_DATA_IN
|
||||||
);
|
);
|
||||||
@ -993,7 +995,7 @@ class ConsoleSupervisor
|
|||||||
'message' => __(
|
'message' => __(
|
||||||
'There are more than %d files in %s. Consider checking software agents.',
|
'There are more than %d files in %s. Consider checking software agents.',
|
||||||
$MAX_BADXML_FILES_DATA_IN,
|
$MAX_BADXML_FILES_DATA_IN,
|
||||||
$config['remote_config']
|
$remote_config_dir
|
||||||
),
|
),
|
||||||
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'),
|
||||||
]
|
]
|
||||||
@ -1266,7 +1268,8 @@ class ConsoleSupervisor
|
|||||||
$PHPSerialize_precision = ini_get('serialize_precision');
|
$PHPSerialize_precision = ini_get('serialize_precision');
|
||||||
|
|
||||||
// PhantomJS status.
|
// PhantomJS status.
|
||||||
$result_ejecution = exec($config['phantomjs_bin'].'/phantomjs --version');
|
$phantomjs_dir = io_safe_output($config['phantomjs_bin']);
|
||||||
|
$result_ejecution = exec($phantomjs_dir.'/phantomjs --version');
|
||||||
|
|
||||||
// PHP version checks.
|
// PHP version checks.
|
||||||
$php_version = phpversion();
|
$php_version = phpversion();
|
||||||
@ -1452,7 +1455,8 @@ class ConsoleSupervisor
|
|||||||
'title' => sprintf(
|
'title' => sprintf(
|
||||||
__("Not recommended '%s' value in PHP configuration"),
|
__("Not recommended '%s' value in PHP configuration"),
|
||||||
'serialize_precision'
|
'serialize_precision'
|
||||||
), 'message' => sprintf(
|
),
|
||||||
|
'message' => sprintf(
|
||||||
__('Recommended value is: %s'),
|
__('Recommended value is: %s'),
|
||||||
sprintf('-1')
|
sprintf('-1')
|
||||||
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
).'<br><br>'.__('Please, change it on your PHP configuration file (php.ini) or contact with administrator'),
|
||||||
@ -2061,8 +2065,10 @@ class ConsoleSupervisor
|
|||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (($config['fontpath'] == '')
|
$fontpath = io_safe_output($config['fontpath']);
|
||||||
|| (file_exists($config['fontpath']) === false)
|
|
||||||
|
if (($fontpath == '')
|
||||||
|
|| (file_exists($fontpath) === false)
|
||||||
) {
|
) {
|
||||||
$this->notify(
|
$this->notify(
|
||||||
[
|
[
|
||||||
|
1203
pandora_console/include/class/CredentialStore.class.php
Normal file
1203
pandora_console/include/class/CredentialStore.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC190918';
|
$build_version = 'PC190926';
|
||||||
$pandora_version = 'v7.0NG.738';
|
$pandora_version = 'v7.0NG.738';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
@ -630,3 +630,21 @@ define('DEFAULT_NODE_COLOR', COL_NOTINIT);
|
|||||||
define('DEFAULT_NODE_IMAGE', 'images/networkmap/unknown.png');
|
define('DEFAULT_NODE_IMAGE', 'images/networkmap/unknown.png');
|
||||||
|
|
||||||
define('NODE_IMAGE_PADDING', 5);
|
define('NODE_IMAGE_PADDING', 5);
|
||||||
|
|
||||||
|
// Pandora Database HA constants.
|
||||||
|
define('HA_ACTION_NONE', 0);
|
||||||
|
define('HA_ACTION_DEPLOY', 1);
|
||||||
|
define('HA_ACTION_RECOVER', 2);
|
||||||
|
define('HA_ACTION_PROMOTE', 3);
|
||||||
|
define('HA_ACTION_DEMOTE', 4);
|
||||||
|
define('HA_ACTION_DISABLE', 5);
|
||||||
|
define('HA_ACTION_ENABLE', 6);
|
||||||
|
define('HA_ACTION_CLEANUP', 7);
|
||||||
|
define('HA_ACTION_RESYNC', 8);
|
||||||
|
|
||||||
|
define('HA_UNINITIALIZED', 0);
|
||||||
|
define('HA_ONLINE', 1);
|
||||||
|
define('HA_PENDING', 2);
|
||||||
|
define('HA_PROCESSING', 3);
|
||||||
|
define('HA_DISABLED', 4);
|
||||||
|
define('HA_FAILED', 5);
|
||||||
|
@ -3789,11 +3789,20 @@ function series_type_graph_array($data, $show_elements_graph)
|
|||||||
} else if (strpos($key, 'percentil') !== false) {
|
} else if (strpos($key, 'percentil') !== false) {
|
||||||
$data_return['series_type'][$key] = 'percentil';
|
$data_return['series_type'][$key] = 'percentil';
|
||||||
if ($show_elements_graph['percentil']) {
|
if ($show_elements_graph['percentil']) {
|
||||||
$data_return['legend'][$key] = __('Percentil').' '.$config['percentil'].'º '.__('of module').' ';
|
|
||||||
if ($show_elements_graph['unit']) {
|
if ($show_elements_graph['unit']) {
|
||||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': ';
|
$name_legend = __('Percentil').' ';
|
||||||
|
$name_legend .= $config['percentil'].'º ';
|
||||||
|
$name_legend .= __('of module').' ';
|
||||||
|
$name_legend .= $value['agent_alias'].' / ';
|
||||||
|
$name_legend .= $value['module_name'].' / ';
|
||||||
|
$name_legend .= __('Unit ').' ';
|
||||||
|
$name_legend .= $show_elements_graph['unit'].': ';
|
||||||
} else {
|
} else {
|
||||||
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
|
$name_legend = __('Percentil').' ';
|
||||||
|
$name_legend .= $config['percentil'].'º ';
|
||||||
|
$name_legend .= __('of module').' ';
|
||||||
|
$name_legend .= $value['agent_alias'].' / ';
|
||||||
|
$name_legend .= $value['module_name'].': ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data_return['legend'][$key] .= $name_legend;
|
$data_return['legend'][$key] .= $name_legend;
|
||||||
|
@ -68,6 +68,57 @@ function agents_get_agent_id_by_module_id($id_agente_modulo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for agent data anywhere.
|
||||||
|
*
|
||||||
|
* Note: This method matches with server (perl) locate_agent.
|
||||||
|
* Do not change order!
|
||||||
|
*
|
||||||
|
* @param string $field Alias, name or IP address of searchable agent.
|
||||||
|
*
|
||||||
|
* @return array Agent of false if not found.
|
||||||
|
*/
|
||||||
|
function agents_locate_agent(string $field)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$table = 'tagente';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
$table = 'tmetaconsole_agent';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alias.
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT *
|
||||||
|
FROM %s
|
||||||
|
WHERE alias = "%s"',
|
||||||
|
$table,
|
||||||
|
$field
|
||||||
|
);
|
||||||
|
$agent = db_get_row_sql($sql);
|
||||||
|
|
||||||
|
if ($agent !== false) {
|
||||||
|
return $agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Addr.
|
||||||
|
$agent = agents_get_agent_with_ip($field);
|
||||||
|
if ($agent !== false) {
|
||||||
|
return $agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name.
|
||||||
|
$sql = sprintf(
|
||||||
|
'SELECT *
|
||||||
|
FROM %s
|
||||||
|
WHERE nombre = "%s"',
|
||||||
|
$table,
|
||||||
|
$field
|
||||||
|
);
|
||||||
|
return db_get_row_sql($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get agent id from an agent alias.
|
* Get agent id from an agent alias.
|
||||||
*
|
*
|
||||||
|
@ -325,6 +325,34 @@ function config_update_config()
|
|||||||
if (!config_update_value('unique_ip', get_parameter('unique_ip'))) {
|
if (!config_update_value('unique_ip', get_parameter('unique_ip'))) {
|
||||||
$error_update[] = __('unique_ip');
|
$error_update[] = __('unique_ip');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_smtpServer', get_parameter('email_smtpServer'))) {
|
||||||
|
$error_update[] = __('Server SMTP');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_from_dir', get_parameter('email_from_dir'))) {
|
||||||
|
$error_update[] = __('From dir');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_from_name', get_parameter('email_from_name'))) {
|
||||||
|
$error_update[] = __('From name');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_smtpPort', (int) get_parameter('email_smtpPort'))) {
|
||||||
|
$error_update[] = __('Port SMTP');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_encryption', get_parameter('email_encryption'))) {
|
||||||
|
$error_update[] = __('Encryption');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_username', get_parameter('email_username'))) {
|
||||||
|
$error_update[] = __('Email user');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config_update_value('email_password', get_parameter('email_password'))) {
|
||||||
|
$error_update[] = __('Email password');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'enterprise':
|
case 'enterprise':
|
||||||
@ -419,34 +447,6 @@ function config_update_config()
|
|||||||
if (!config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist))) {
|
if (!config_update_value('inventory_changes_blacklist', implode(',', $inventory_changes_blacklist))) {
|
||||||
$error_update[] = __('Inventory changes blacklist');
|
$error_update[] = __('Inventory changes blacklist');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config_update_value('email_from_dir', get_parameter('email_from_dir'))) {
|
|
||||||
$error_update[] = __('From dir');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_update_value('email_from_name', get_parameter('email_from_name'))) {
|
|
||||||
$error_update[] = __('From name');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_update_value('email_smtpServer', get_parameter('email_smtpServer'))) {
|
|
||||||
$error_update[] = __('Server SMTP');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_update_value('email_smtpPort', (int) get_parameter('email_smtpPort'))) {
|
|
||||||
$error_update[] = __('Port SMTP');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_update_value('email_encryption', get_parameter('email_encryption'))) {
|
|
||||||
$error_update[] = __('Encryption');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_update_value('email_username', get_parameter('email_username'))) {
|
|
||||||
$error_update[] = __('Email user');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config_update_value('email_password', get_parameter('email_password'))) {
|
|
||||||
$error_update[] = __('Email password');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1500,7 +1500,7 @@ function config_process_config()
|
|||||||
|
|
||||||
if (!isset($config['remote_config'])) {
|
if (!isset($config['remote_config'])) {
|
||||||
if ($is_windows) {
|
if ($is_windows) {
|
||||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in';
|
$default = 'C:\PandoraFMS\Pandora_Server\data_in';
|
||||||
} else {
|
} else {
|
||||||
$default = '/var/spool/pandora/data_in';
|
$default = '/var/spool/pandora/data_in';
|
||||||
}
|
}
|
||||||
@ -1510,7 +1510,7 @@ function config_process_config()
|
|||||||
|
|
||||||
if (!isset($config['phantomjs_bin'])) {
|
if (!isset($config['phantomjs_bin'])) {
|
||||||
if ($is_windows) {
|
if ($is_windows) {
|
||||||
$default = 'C:\\PandoraFMS\\phantomjs';
|
$default = 'C:\PandoraFMS\Pandora_Server\bin';
|
||||||
} else {
|
} else {
|
||||||
$default = '/usr/bin';
|
$default = '/usr/bin';
|
||||||
}
|
}
|
||||||
@ -1760,7 +1760,13 @@ function config_process_config()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['auditdir'])) {
|
if (!isset($config['auditdir'])) {
|
||||||
config_update_value('auditdir', '/var/www/html/pandora_console');
|
$auditdir = '/var/www/html/pandora_console';
|
||||||
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
|
// Windows.
|
||||||
|
$auditdir = $config['homedir'];
|
||||||
|
}
|
||||||
|
|
||||||
|
config_update_value('auditdir', $auditdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['elasticsearch_ip'])) {
|
if (!isset($config['elasticsearch_ip'])) {
|
||||||
@ -1794,6 +1800,7 @@ function config_process_config()
|
|||||||
/*
|
/*
|
||||||
* Parse the ACL IP list for access API
|
* Parse the ACL IP list for access API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$temp_list_ACL_IPs_for_API = [];
|
$temp_list_ACL_IPs_for_API = [];
|
||||||
if (isset($config['list_ACL_IPs_for_API'])) {
|
if (isset($config['list_ACL_IPs_for_API'])) {
|
||||||
if (!empty($config['list_ACL_IPs_for_API'])) {
|
if (!empty($config['list_ACL_IPs_for_API'])) {
|
||||||
@ -1804,13 +1811,16 @@ function config_process_config()
|
|||||||
$config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API;
|
$config['list_ACL_IPs_for_API'] = $temp_list_ACL_IPs_for_API;
|
||||||
$keysConfig = array_keys($config);
|
$keysConfig = array_keys($config);
|
||||||
|
|
||||||
// This is not set here. The first time, when no
|
/*
|
||||||
// setup is done, update_manager extension manage it
|
* This is not set here. The first time, when no
|
||||||
// the first time make a conenction and disable itself
|
* setup is done, update_manager extension manage it
|
||||||
// Not Managed here !
|
* the first time make a conenction and disable itself
|
||||||
// if (!isset ($config["autoupdate"])) {
|
* Not Managed here !
|
||||||
// config_update_value ('autoupdate', true);.
|
* if (!isset ($config["autoupdate"])) {
|
||||||
// }
|
* config_update_value ('autoupdate', true);.
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
include_once $config['homedir'].'/include/auth/mysql.php';
|
include_once $config['homedir'].'/include/auth/mysql.php';
|
||||||
include_once $config['homedir'].'/include/functions_io.php';
|
include_once $config['homedir'].'/include/functions_io.php';
|
||||||
|
|
||||||
@ -1819,10 +1829,16 @@ function config_process_config()
|
|||||||
// user, and should be in pandora root. By default, Pandora adds
|
// user, and should be in pandora root. By default, Pandora adds
|
||||||
// /attachment to this, so by default is the pandora console home
|
// /attachment to this, so by default is the pandora console home
|
||||||
// dir.
|
// dir.
|
||||||
|
$attachment_store_path = $config['homedir'].'/attachment';
|
||||||
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
|
// Windows.
|
||||||
|
$attachment_store_path = $config['homedir'].'\attachment';
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($config['attachment_store'])) {
|
if (!isset($config['attachment_store'])) {
|
||||||
config_update_value(
|
config_update_value(
|
||||||
'attachment_store',
|
'attachment_store',
|
||||||
io_safe_input($config['homedir']).'/attachment'
|
$attachment_store_path
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Fixed when the user moves the pandora console to another dir
|
// Fixed when the user moves the pandora console to another dir
|
||||||
@ -1830,16 +1846,23 @@ function config_process_config()
|
|||||||
if (!is_dir($config['attachment_store'])) {
|
if (!is_dir($config['attachment_store'])) {
|
||||||
config_update_value(
|
config_update_value(
|
||||||
'attachment_store',
|
'attachment_store',
|
||||||
$config['homedir'].'/attachment'
|
$attachment_store_path
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['fontpath'])) {
|
if (!isset($config['fontpath'])) {
|
||||||
$home = str_replace('\\', '/', $config['homedir']);
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
|
// Windows.
|
||||||
|
$fontpath = $config['homedir'].'\include\fonts\smallfont.ttf';
|
||||||
|
} else {
|
||||||
|
$home = str_replace('\\', '/', $config['homedir']);
|
||||||
|
$fontpath = $home.'/include/fonts/smallfont.ttf';
|
||||||
|
}
|
||||||
|
|
||||||
config_update_value(
|
config_update_value(
|
||||||
'fontpath',
|
'fontpath',
|
||||||
$home.'/include/fonts/smallfont.ttf'
|
$fontpath
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2077,7 +2100,7 @@ function config_process_config()
|
|||||||
|
|
||||||
if (!isset($config['netflow_path'])) {
|
if (!isset($config['netflow_path'])) {
|
||||||
if ($is_windows) {
|
if ($is_windows) {
|
||||||
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in\\netflow';
|
$default = 'C:\PandoraFMS\Pandora_Server\data_in\netflow';
|
||||||
} else {
|
} else {
|
||||||
$default = '/var/spool/pandora/data_in/netflow';
|
$default = '/var/spool/pandora/data_in/netflow';
|
||||||
}
|
}
|
||||||
@ -2639,6 +2662,10 @@ function config_process_config()
|
|||||||
config_update_value('zoom_graph', 1);
|
config_update_value('zoom_graph', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($config['percentil'])) {
|
||||||
|
config_update_value('percentil', 95);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($config['render_proc_ok'])) {
|
if (!isset($config['render_proc_ok'])) {
|
||||||
config_update_value('render_proc_ok', __('Ok'));
|
config_update_value('render_proc_ok', __('Ok'));
|
||||||
}
|
}
|
||||||
|
@ -24,422 +24,8 @@
|
|||||||
* 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.
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
|
*
|
||||||
|
* Moved to CredentialStore.class.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Begin.
|
// Deprecated.
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an array with all the credentials matching filter and ACL.
|
|
||||||
*
|
|
||||||
* @param array $fields Fields array or 'count' keyword to retrieve count.
|
|
||||||
* @param array $filter Filters to be applied.
|
|
||||||
* @param integer $offset Offset (pagination).
|
|
||||||
* @param integer $limit Limit (pagination).
|
|
||||||
* @param string $order Sort order.
|
|
||||||
* @param string $sort_field Sort field.
|
|
||||||
*
|
|
||||||
* @return array With all results or false if error.
|
|
||||||
* @throws Exception On error.
|
|
||||||
*/
|
|
||||||
function credentials_get_all(
|
|
||||||
$fields,
|
|
||||||
array $filter,
|
|
||||||
$offset=null,
|
|
||||||
$limit=null,
|
|
||||||
$order=null,
|
|
||||||
$sort_field=null
|
|
||||||
) {
|
|
||||||
$sql_filters = [];
|
|
||||||
$order_by = '';
|
|
||||||
$pagination = '';
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
if (!is_array($filter)) {
|
|
||||||
error_log('[credential_get_all] Filter must be an array.');
|
|
||||||
throw new Exception('[credential_get_all] Filter must be an array.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$count = false;
|
|
||||||
if (!is_array($fields) && $fields == 'count') {
|
|
||||||
$fields = ['cs.*'];
|
|
||||||
$count = true;
|
|
||||||
} else if (!is_array($fields)) {
|
|
||||||
error_log('[credential_get_all] Fields must be an array or "count".');
|
|
||||||
throw new Exception('[credential_get_all] Fields must be an array or "count".');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['product']) && !empty($filter['product'])) {
|
|
||||||
$sql_filters[] = sprintf(' AND cs.product = "%s"', $filter['product']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['free_search']) && !empty($filter['free_search'])) {
|
|
||||||
$sql_filters[] = vsprintf(
|
|
||||||
' AND (lower(cs.username) like lower("%%%s%%")
|
|
||||||
OR cs.identifier like "%%%s%%"
|
|
||||||
OR lower(cs.product) like lower("%%%s%%"))',
|
|
||||||
array_fill(0, 3, $filter['free_search'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['filter_id_group']) && $filter['filter_id_group'] > 0) {
|
|
||||||
$propagate = db_get_value(
|
|
||||||
'propagate',
|
|
||||||
'tgrupo',
|
|
||||||
'id_grupo',
|
|
||||||
$filter['filter_id_group']
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$propagate) {
|
|
||||||
$sql_filters[] = sprintf(
|
|
||||||
' AND cs.id_group = %d ',
|
|
||||||
$filter['filter_id_group']
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$groups = [ $filter['filter_id_group'] ];
|
|
||||||
$childrens = groups_get_childrens($id_group, null, true);
|
|
||||||
if (!empty($childrens)) {
|
|
||||||
foreach ($childrens as $child) {
|
|
||||||
$groups[] = (int) $child['id_grupo'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$filter['filter_id_group'] = $groups;
|
|
||||||
$sql_filters[] = sprintf(
|
|
||||||
' AND cs.id_group IN (%s) ',
|
|
||||||
join(',', $filter['filter_id_group'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($filter['group_list']) && is_array($filter['group_list'])) {
|
|
||||||
$sql_filters[] = sprintf(
|
|
||||||
' AND cs.id_group IN (%s) ',
|
|
||||||
join(',', $filter['group_list'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($order)) {
|
|
||||||
$dir = 'asc';
|
|
||||||
if ($order == 'desc') {
|
|
||||||
$dir = 'desc';
|
|
||||||
};
|
|
||||||
|
|
||||||
if (in_array(
|
|
||||||
$sort_field,
|
|
||||||
[
|
|
||||||
'group',
|
|
||||||
'identifier',
|
|
||||||
'product',
|
|
||||||
'username',
|
|
||||||
'options',
|
|
||||||
]
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
$order_by = sprintf(
|
|
||||||
'ORDER BY `%s` %s',
|
|
||||||
$sort_field,
|
|
||||||
$dir
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($limit) && $limit > 0
|
|
||||||
&& isset($offset) && $offset >= 0
|
|
||||||
) {
|
|
||||||
$pagination = sprintf(
|
|
||||||
' LIMIT %d OFFSET %d ',
|
|
||||||
$limit,
|
|
||||||
$offset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = sprintf(
|
|
||||||
'SELECT %s
|
|
||||||
FROM tcredential_store cs
|
|
||||||
LEFT JOIN tgrupo tg
|
|
||||||
ON tg.id_grupo = cs.id_group
|
|
||||||
WHERE 1=1
|
|
||||||
%s
|
|
||||||
%s
|
|
||||||
%s',
|
|
||||||
join(',', $fields),
|
|
||||||
join(' ', $sql_filters),
|
|
||||||
$order_by,
|
|
||||||
$pagination
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($count) {
|
|
||||||
$sql = sprintf('SELECT count(*) as n FROM ( %s ) tt', $sql);
|
|
||||||
|
|
||||||
return db_get_value_sql($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
return db_get_all_rows_sql($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves target key from keystore or false in case of error.
|
|
||||||
*
|
|
||||||
* @param string $identifier Key identifier.
|
|
||||||
*
|
|
||||||
* @return array Key or false if error.
|
|
||||||
*/
|
|
||||||
function get_key($identifier)
|
|
||||||
{
|
|
||||||
return db_get_row_filter(
|
|
||||||
'tcredential_store',
|
|
||||||
[ 'identifier' => $identifier ]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minor function to dump json message as ajax response.
|
|
||||||
*
|
|
||||||
* @param string $type Type: result || error.
|
|
||||||
* @param string $msg Message.
|
|
||||||
* @param boolean $delete Deletion messages.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function ajax_msg($type, $msg, $delete=false)
|
|
||||||
{
|
|
||||||
$msg_err = 'Failed while saving: %s';
|
|
||||||
$msg_ok = 'Successfully saved into keystore ';
|
|
||||||
|
|
||||||
if ($delete) {
|
|
||||||
$msg_err = 'Failed while removing: %s';
|
|
||||||
$msg_ok = 'Successfully deleted ';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($type == 'error') {
|
|
||||||
echo json_encode(
|
|
||||||
[
|
|
||||||
$type => ui_print_error_message(
|
|
||||||
__(
|
|
||||||
$msg_err,
|
|
||||||
$msg
|
|
||||||
),
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
echo json_encode(
|
|
||||||
[
|
|
||||||
$type => ui_print_success_message(
|
|
||||||
__(
|
|
||||||
$msg_ok,
|
|
||||||
$msg
|
|
||||||
),
|
|
||||||
'',
|
|
||||||
true
|
|
||||||
),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates inputs for new/update forms.
|
|
||||||
*
|
|
||||||
* @param array $values Values or null.
|
|
||||||
*
|
|
||||||
* @return string Inputs.
|
|
||||||
*/
|
|
||||||
function print_inputs($values=null)
|
|
||||||
{
|
|
||||||
if (!is_array($values)) {
|
|
||||||
$values = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = '';
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => __('Identifier'),
|
|
||||||
'name' => 'identifier',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $values['identifier'],
|
|
||||||
'disabled' => (bool) $values['identifier'],
|
|
||||||
'return' => true,
|
|
||||||
'script' => 'alert(\'puta\')',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => __('Group'),
|
|
||||||
'name' => 'id_group',
|
|
||||||
'id' => 'id_group',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'select_groups',
|
|
||||||
'selected' => $values['id_group'],
|
|
||||||
'return' => true,
|
|
||||||
'class' => 'w50p',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => __('Product'),
|
|
||||||
'name' => 'product',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'select',
|
|
||||||
'script' => 'calculate_inputs()',
|
|
||||||
'fields' => [
|
|
||||||
'CUSTOM' => __('Custom'),
|
|
||||||
'AWS' => __('Aws'),
|
|
||||||
'AZURE' => __('Azure'),
|
|
||||||
// 'GOOGLE' => __('Google'),
|
|
||||||
],
|
|
||||||
'selected' => $values['product'],
|
|
||||||
'disabled' => (bool) $values['product'],
|
|
||||||
'return' => true,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$user_label = __('Username');
|
|
||||||
$pass_label = __('Password');
|
|
||||||
$extra_1_label = __('Extra');
|
|
||||||
$extra_2_label = __('Extra (2)');
|
|
||||||
$extra1 = true;
|
|
||||||
$extra2 = true;
|
|
||||||
|
|
||||||
// Remember to update credential_store.php also.
|
|
||||||
switch ($values['product']) {
|
|
||||||
case 'AWS':
|
|
||||||
$user_label = __('Access key ID');
|
|
||||||
$pass_label = __('Secret access key');
|
|
||||||
$extra1 = false;
|
|
||||||
$extra2 = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'AZURE':
|
|
||||||
$user_label = __('Account ID');
|
|
||||||
$pass_label = __('Application secret');
|
|
||||||
$extra_1_label = __('Tenant or domain name');
|
|
||||||
$extra_2_label = __('Subscription id');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'GOOGLE':
|
|
||||||
// Need further investigation.
|
|
||||||
case 'CUSTOM':
|
|
||||||
$user_label = __('Account ID');
|
|
||||||
$pass_label = __('Password');
|
|
||||||
$extra1 = false;
|
|
||||||
$extra2 = false;
|
|
||||||
default:
|
|
||||||
// Use defaults.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => $user_label,
|
|
||||||
'name' => 'username',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $values['username'],
|
|
||||||
'return' => true,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => $pass_label,
|
|
||||||
'name' => 'password',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'password',
|
|
||||||
'value' => $values['password'],
|
|
||||||
'return' => true,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if ($extra1) {
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => $extra_1_label,
|
|
||||||
'name' => 'extra_1',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $values['extra_1'],
|
|
||||||
'return' => true,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($extra2) {
|
|
||||||
$return .= html_print_input(
|
|
||||||
[
|
|
||||||
'label' => $extra_2_label,
|
|
||||||
'name' => 'extra_2',
|
|
||||||
'input_class' => 'flex-row',
|
|
||||||
'type' => 'text',
|
|
||||||
'value' => $values['extra_2'],
|
|
||||||
'return' => true,
|
|
||||||
'display' => $extra2,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve all identifiers available for current user.
|
|
||||||
*
|
|
||||||
* @param string $product Target product.
|
|
||||||
*
|
|
||||||
* @return array Of account identifiers.
|
|
||||||
*/
|
|
||||||
function credentials_list_accounts($product)
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
check_login();
|
|
||||||
|
|
||||||
include_once $config['homedir'].'/include/functions_users.php';
|
|
||||||
|
|
||||||
static $user_groups;
|
|
||||||
|
|
||||||
if (!isset($user_groups)) {
|
|
||||||
$user_groups = users_get_groups(
|
|
||||||
$config['id_user'],
|
|
||||||
'AR'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Always add group 'ALL' because 'ALL' group credentials
|
|
||||||
// must be available for all users.
|
|
||||||
if (is_array($user_groups)) {
|
|
||||||
$user_groups = ([0] + array_keys($user_groups));
|
|
||||||
} else {
|
|
||||||
$user_groups = [0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$creds = credentials_get_all(
|
|
||||||
['identifier'],
|
|
||||||
[
|
|
||||||
'product' => $product,
|
|
||||||
'group_list' => $user_groups,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($creds === false) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret = array_reduce(
|
|
||||||
$creds,
|
|
||||||
function ($carry, $item) {
|
|
||||||
$carry[$item['identifier']] = $item['identifier'];
|
|
||||||
return $carry;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
@ -46,6 +46,25 @@ function db_select_engine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connects to target DB.
|
||||||
|
*
|
||||||
|
* @param array $setup Database definition.
|
||||||
|
*
|
||||||
|
* @return mixed Dbconnection or null.
|
||||||
|
*/
|
||||||
|
function get_dbconnection(array $setup)
|
||||||
|
{
|
||||||
|
return mysqli_connect(
|
||||||
|
$setup['dbhost'],
|
||||||
|
$setup['dbuser'],
|
||||||
|
$setup['dbpass'],
|
||||||
|
$setup['dbname'],
|
||||||
|
$setup['dbport']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function db_connect($host=null, $db=null, $user=null, $pass=null, $port=null, $critical=true, $charset=null)
|
function db_connect($host=null, $db=null, $user=null, $pass=null, $port=null, $critical=true, $charset=null)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -2739,6 +2739,10 @@ function events_get_agent(
|
|||||||
$date = time_w_fixed_tz($date);
|
$date = time_w_fixed_tz($date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_metaconsole() && $events_group === false) {
|
||||||
|
$id_server = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($date)) {
|
if (empty($date)) {
|
||||||
$date = get_system_time();
|
$date = get_system_time();
|
||||||
}
|
}
|
||||||
|
@ -302,6 +302,15 @@ function grafico_modulo_sparse_data(
|
|||||||
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
$array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||||
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
$array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||||
|
|
||||||
|
if ($params['percentil']) {
|
||||||
|
$array_data['percentil'.$series_suffix]['agent_module_id'] = $agent_module_id;
|
||||||
|
$array_data['percentil'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type'];
|
||||||
|
$array_data['percentil'.$series_suffix]['agent_name'] = $data_module_graph['agent_name'];
|
||||||
|
$array_data['percentil'.$series_suffix]['module_name'] = $data_module_graph['module_name'];
|
||||||
|
$array_data['percentil'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias'];
|
||||||
|
$array_data['percentil'.$series_suffix]['unit'] = $data_module_graph['unit'];
|
||||||
|
}
|
||||||
|
|
||||||
// This is for a specific type of report that consists in passing
|
// This is for a specific type of report that consists in passing
|
||||||
// an interval and doing the average sum and avg.
|
// an interval and doing the average sum and avg.
|
||||||
if ($params['force_interval'] != '') {
|
if ($params['force_interval'] != '') {
|
||||||
@ -378,12 +387,6 @@ function grafico_modulo_sparse_data(
|
|||||||
$array_data['sum1']['data'] = $acum_array_data;
|
$array_data['sum1']['data'] = $acum_array_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($params['percentil']) {
|
|
||||||
$percentil_value = $array_data['percentil'.$series_suffix]['data'][0][1];
|
|
||||||
} else {
|
|
||||||
$percentil_value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$events = [];
|
$events = [];
|
||||||
if (isset($array_data['sum'.$series_suffix]['max'])) {
|
if (isset($array_data['sum'.$series_suffix]['max'])) {
|
||||||
$max = $array_data['sum'.$series_suffix]['max'];
|
$max = $array_data['sum'.$series_suffix]['max'];
|
||||||
@ -1471,8 +1474,6 @@ function graphic_combined_module(
|
|||||||
$min = $array_data['sum'.$i]['min'];
|
$min = $array_data['sum'.$i]['min'];
|
||||||
$avg = $array_data['sum'.$i]['avg'];
|
$avg = $array_data['sum'.$i]['avg'];
|
||||||
|
|
||||||
$percentil_value = $array_data['percentil'.$i]['data'][0][1];
|
|
||||||
|
|
||||||
if ($config['fixed_graph'] == false) {
|
if ($config['fixed_graph'] == false) {
|
||||||
$water_mark = [
|
$water_mark = [
|
||||||
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
'file' => $config['homedir'].'/images/logo_vertical_water.png',
|
||||||
|
@ -98,6 +98,23 @@ function hd($var, $file='', $oneline=false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encapsulation (ob) for debug print function.
|
||||||
|
*
|
||||||
|
* @param mixed $var Variable to be dumped.
|
||||||
|
* @param string $file Target file path.
|
||||||
|
* @param boolean $oneline Show in oneline.
|
||||||
|
*
|
||||||
|
* @return string Dump string.
|
||||||
|
*/
|
||||||
|
function obhd($var, $file='', $oneline=false)
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
hd($var, $file, $oneline);
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function debug()
|
function debug()
|
||||||
{
|
{
|
||||||
$args_num = func_num_args();
|
$args_num = func_num_args();
|
||||||
@ -1458,6 +1475,14 @@ function html_print_input_password(
|
|||||||
$attr['class'] = $class;
|
$attr['class'] = $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disabled === false) {
|
||||||
|
// Trick to avoid password completion on most browsers.
|
||||||
|
if ($autocomplete !== 'on') {
|
||||||
|
$disabled = true;
|
||||||
|
$attr['onfocus'] = "this.removeAttribute('readonly');";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete);
|
return html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1570,6 +1595,7 @@ function html_print_input_image($name, $src, $value, $style='', $return=false, $
|
|||||||
'onkeypress',
|
'onkeypress',
|
||||||
'onkeydown',
|
'onkeydown',
|
||||||
'onkeyup',
|
'onkeyup',
|
||||||
|
'class',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($attrs as $attribute) {
|
foreach ($attrs as $attribute) {
|
||||||
@ -3152,7 +3178,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||||||
((isset($data['return']) === true) ? $data['return'] : false),
|
((isset($data['return']) === true) ? $data['return'] : false),
|
||||||
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
((isset($data['disabled']) === true) ? $data['disabled'] : false),
|
||||||
((isset($data['required']) === true) ? $data['required'] : false),
|
((isset($data['required']) === true) ? $data['required'] : false),
|
||||||
((isset($data['class']) === true) ? $data['class'] : '')
|
((isset($data['class']) === true) ? $data['class'] : ''),
|
||||||
|
((isset($data['autocomplete']) === true) ? $data['autocomplete'] : 'off')
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ function ___($string /*, variable arguments */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* json_encode for multibyte characters.
|
* json_encode for multibyte characters.
|
||||||
*
|
*
|
||||||
* @param string Text string to be encoded.
|
* @param string Text string to be encoded.
|
||||||
@ -528,7 +528,7 @@ function io_json_mb_encode($string, $encode_options=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Prepare the given password to be stored in the Pandora FMS Database,
|
* Prepare the given password to be stored in the Pandora FMS Database,
|
||||||
* encrypting it if necessary.
|
* encrypting it if necessary.
|
||||||
*
|
*
|
||||||
@ -541,16 +541,22 @@ function io_input_password($password)
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
enterprise_include_once('include/functions_crypto.php');
|
enterprise_include_once('include/functions_crypto.php');
|
||||||
$ciphertext = enterprise_hook('openssl_encrypt_decrypt', ['encrypt', io_safe_output($password)]);
|
$ciphertext = enterprise_hook(
|
||||||
|
'openssl_encrypt_decrypt',
|
||||||
|
[
|
||||||
|
'encrypt',
|
||||||
|
io_safe_input($password),
|
||||||
|
]
|
||||||
|
);
|
||||||
if ($ciphertext === ENTERPRISE_NOT_HOOK) {
|
if ($ciphertext === ENTERPRISE_NOT_HOOK) {
|
||||||
return $password;
|
return io_safe_input($password);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ciphertext;
|
return $ciphertext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Process the given password read from the Pandora FMS Database,
|
* Process the given password read from the Pandora FMS Database,
|
||||||
* decrypting it if necessary.
|
* decrypting it if necessary.
|
||||||
*
|
*
|
||||||
@ -563,10 +569,17 @@ function io_output_password($password)
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
enterprise_include_once('include/functions_crypto.php');
|
enterprise_include_once('include/functions_crypto.php');
|
||||||
$plaintext = enterprise_hook('openssl_encrypt_decrypt', ['decrypt', io_safe_output($password)]);
|
$plaintext = enterprise_hook(
|
||||||
|
'openssl_encrypt_decrypt',
|
||||||
|
[
|
||||||
|
'decrypt',
|
||||||
|
$password,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
if ($plaintext === ENTERPRISE_NOT_HOOK) {
|
||||||
return $password;
|
return io_safe_output($password);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $plaintext;
|
return io_safe_output($plaintext);
|
||||||
}
|
}
|
||||||
|
@ -4903,7 +4903,8 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
$value = reporting_get_agentmodule_data_sum(
|
$value = reporting_get_agentmodule_data_sum(
|
||||||
$content['id_agent_module'],
|
$content['id_agent_module'],
|
||||||
$content['period'],
|
$content['period'],
|
||||||
$report['datetime']
|
$report['datetime'],
|
||||||
|
$content['uncompressed_module']
|
||||||
);
|
);
|
||||||
if (!$config['simple_module_value']) {
|
if (!$config['simple_module_value']) {
|
||||||
$formated_value = $value;
|
$formated_value = $value;
|
||||||
@ -10725,17 +10726,19 @@ function reporting_get_agentmodule_data_min($id_agent_module, $period=0, $date=0
|
|||||||
* @param int Agent module id to get the sumatory.
|
* @param int Agent module id to get the sumatory.
|
||||||
* @param int Period of time to check (in seconds)
|
* @param int Period of time to check (in seconds)
|
||||||
* @param int Top date to check the values. Default current time.
|
* @param int Top date to check the values. Default current time.
|
||||||
|
* @param boolean Show uncompressed data from module
|
||||||
*
|
*
|
||||||
* @return float The sumatory of the module values in the interval.
|
* @return float The sumatory of the module values in the interval.
|
||||||
*/
|
*/
|
||||||
function reporting_get_agentmodule_data_sum(
|
function reporting_get_agentmodule_data_sum(
|
||||||
$id_agent_module,
|
$id_agent_module,
|
||||||
$period=0,
|
$period=0,
|
||||||
$date=0
|
$date=0,
|
||||||
|
$uncompressed_module=true
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// Initialize variables
|
// Initialize variables.
|
||||||
if (empty($date)) {
|
if (empty($date)) {
|
||||||
$date = get_system_time();
|
$date = get_system_time();
|
||||||
}
|
}
|
||||||
@ -10757,18 +10760,21 @@ function reporting_get_agentmodule_data_sum(
|
|||||||
$id_module_type
|
$id_module_type
|
||||||
);
|
);
|
||||||
$module_interval = modules_get_interval($id_agent_module);
|
$module_interval = modules_get_interval($id_agent_module);
|
||||||
$uncompressed_module = is_module_uncompressed($module_name);
|
// Check if module must be compressed.
|
||||||
|
if (!$uncompressed_module) {
|
||||||
|
$uncompressed_module = is_module_uncompressed($module_name);
|
||||||
|
}
|
||||||
|
|
||||||
// Wrong module type
|
// Wrong module type
|
||||||
if (is_module_data_string($module_name)) {
|
if (is_module_data_string($module_name)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incremental modules are treated differently
|
// Incremental modules are treated differently.
|
||||||
$module_inc = is_module_inc($module_name);
|
$module_inc = is_module_inc($module_name);
|
||||||
|
|
||||||
if ($uncompressed_module) {
|
if (!$uncompressed_module) {
|
||||||
// Get module data
|
// Get module data.
|
||||||
$interval_data = db_get_all_rows_sql(
|
$interval_data = db_get_all_rows_sql(
|
||||||
'
|
'
|
||||||
SELECT * FROM tagente_datos
|
SELECT * FROM tagente_datos
|
||||||
@ -10792,7 +10798,7 @@ function reporting_get_agentmodule_data_sum(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set initial conditions
|
// Set initial conditions.
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$partial_total = 0;
|
$partial_total = 0;
|
||||||
$count_sum = 0;
|
$count_sum = 0;
|
||||||
@ -10801,18 +10807,9 @@ function reporting_get_agentmodule_data_sum(
|
|||||||
$partial_total = 0;
|
$partial_total = 0;
|
||||||
$count_sum = 0;
|
$count_sum = 0;
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
if (!$uncompressed_module) {
|
||||||
case 'mysql':
|
$total += $data['datos'];
|
||||||
case 'postgresql':
|
} else if (!$module_inc) {
|
||||||
// Do none
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'oracle':
|
|
||||||
$data['datos'] = oracle_format_float_to_php($data['datos']);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$module_inc) {
|
|
||||||
foreach ($data['data'] as $val) {
|
foreach ($data['data'] as $val) {
|
||||||
if (is_numeric($val['datos'])) {
|
if (is_numeric($val['datos'])) {
|
||||||
$partial_total += $val['datos'];
|
$partial_total += $val['datos'];
|
||||||
@ -10824,7 +10821,7 @@ function reporting_get_agentmodule_data_sum(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$total += ($partial_total / $count_sum);
|
$total += $partial_total;
|
||||||
} else {
|
} else {
|
||||||
$last = end($data['data']);
|
$last = end($data['data']);
|
||||||
$total += $last['datos'];
|
$total += $last['datos'];
|
||||||
|
@ -2679,6 +2679,7 @@ function get_shape_status_set($type)
|
|||||||
case STATUS_MODULE_UNKNOWN:
|
case STATUS_MODULE_UNKNOWN:
|
||||||
case STATUS_AGENT_UNKNOWN:
|
case STATUS_AGENT_UNKNOWN:
|
||||||
case STATUS_AGENT_DOWN:
|
case STATUS_AGENT_DOWN:
|
||||||
|
case STATUS_AGENT_NO_MONITORS:
|
||||||
$return = ['class' => 'status_rounded_rectangles'];
|
$return = ['class' => 'status_rounded_rectangles'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class gettext_reader {
|
|||||||
* @param boolean enable_cache Enable or disable caching of strings (default on)
|
* @param boolean enable_cache Enable or disable caching of strings (default on)
|
||||||
*/
|
*/
|
||||||
function gettext_reader($Reader, $enable_cache = true) {
|
function gettext_reader($Reader, $enable_cache = true) {
|
||||||
$machine = @shell_exec('uname -m');
|
$machine = php_uname("m");
|
||||||
|
|
||||||
$enabled64Bits = false;
|
$enabled64Bits = false;
|
||||||
if (preg_match('/64/', $machine)) {
|
if (preg_match('/64/', $machine)) {
|
||||||
|
@ -1890,6 +1890,16 @@ function load_modal(settings) {
|
|||||||
width = settings.onshow.width;
|
width = settings.onshow.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settings.target.html("Loading modal...");
|
||||||
|
settings.target
|
||||||
|
.dialog({
|
||||||
|
title: "Loading",
|
||||||
|
close: false,
|
||||||
|
width: 200,
|
||||||
|
buttons: []
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: settings.url,
|
url: settings.url,
|
||||||
@ -1898,6 +1908,9 @@ function load_modal(settings) {
|
|||||||
data: data,
|
data: data,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
settings.target.html(data);
|
settings.target.html(data);
|
||||||
|
if (settings.onload != undefined) {
|
||||||
|
settings.onload(data);
|
||||||
|
}
|
||||||
settings.target.dialog({
|
settings.target.dialog({
|
||||||
resizable: true,
|
resizable: true,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
@ -1915,7 +1928,9 @@ function load_modal(settings) {
|
|||||||
text: settings.modal.cancel,
|
text: settings.modal.cancel,
|
||||||
click: function() {
|
click: function() {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
settings.cleanup();
|
if (typeof settings.cleanup == "function") {
|
||||||
|
settings.cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1925,6 +1940,9 @@ function load_modal(settings) {
|
|||||||
click: function() {
|
click: function() {
|
||||||
if (AJAX_RUNNING) return;
|
if (AJAX_RUNNING) return;
|
||||||
AJAX_RUNNING = 1;
|
AJAX_RUNNING = 1;
|
||||||
|
if (settings.onsubmit.preaction != undefined) {
|
||||||
|
settings.onsubmit.preaction();
|
||||||
|
}
|
||||||
var formdata = new FormData();
|
var formdata = new FormData();
|
||||||
if (settings.extradata) {
|
if (settings.extradata) {
|
||||||
settings.extradata.forEach(function(item) {
|
settings.extradata.forEach(function(item) {
|
||||||
@ -1952,7 +1970,9 @@ function load_modal(settings) {
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
data: formdata,
|
data: formdata,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
settings.ajax_callback(data);
|
if (settings.ajax_callback != undefined) {
|
||||||
|
settings.ajax_callback(data);
|
||||||
|
}
|
||||||
AJAX_RUNNING = 0;
|
AJAX_RUNNING = 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -10,3 +10,33 @@
|
|||||||
#new_key select {
|
#new_key select {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul.wizard li > label:not(.p-switch) {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
form.top-action-buttons ul.wizard {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.wizard li {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
form.modal ul.wizard li {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
width: 90%;
|
||||||
|
margin: 0 auto;
|
||||||
|
justify-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
form.modal ul.wizard li * {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.wizard li.flex-indep {
|
||||||
|
flex: 1;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
@ -452,6 +452,9 @@ select:-internal-list-box {
|
|||||||
.mw120px {
|
.mw120px {
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
}
|
}
|
||||||
|
.mw180px {
|
||||||
|
min-width: 180px;
|
||||||
|
}
|
||||||
.mw250px {
|
.mw250px {
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
}
|
}
|
||||||
@ -3182,6 +3185,7 @@ table#policy_modules td * {
|
|||||||
|
|
||||||
#news_board {
|
#news_board {
|
||||||
min-width: 530px;
|
min-width: 530px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#right_column_logon_ok {
|
#right_column_logon_ok {
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
table {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.header_table {
|
table.header_table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -72,6 +69,7 @@ table.table_beauty tbody tr td {
|
|||||||
|
|
||||||
table.databox {
|
table.databox {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
th.title_table_pdf {
|
th.title_table_pdf {
|
||||||
|
@ -13,27 +13,27 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
-webkit-box-orient: initial;
|
-webkit-box-orient: initial;
|
||||||
-webkit-box-direction: initial;
|
-webkit-box-direction: initial;
|
||||||
-ms-flex-direction: initial;
|
-ms-flex-direction: initial;
|
||||||
flex-direction: initial;
|
flex-direction: initial;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
-ms-flex-align: center;
|
-ms-flex-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
-webkit-user-select: text;
|
-webkit-user-select: text;
|
||||||
-moz-user-select: text;
|
-moz-user-select: text;
|
||||||
-ms-user-select: text;
|
-ms-user-select: text;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visual-console-item.is-editing {
|
.visual-console-item.is-editing {
|
||||||
border: 2px dashed #b2b2b2;
|
border: 2px dashed #b2b2b2;
|
||||||
-webkit-transform: translateX(-2px) translateY(-2px);
|
-webkit-transform: translateX(-2px) translateY(-2px);
|
||||||
transform: translateX(-2px) translateY(-2px);
|
transform: translateX(-2px) translateY(-2px);
|
||||||
cursor: move;
|
cursor: move;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visual-console-item.is-editing > .resize-draggable {
|
.visual-console-item.is-editing > .resize-draggable {
|
||||||
@ -60,17 +60,17 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
-webkit-box-direction: normal;
|
-webkit-box-direction: normal;
|
||||||
-ms-flex-direction: column;
|
-ms-flex-direction: column;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
-webkit-box-pack: center;
|
-webkit-box-pack: center;
|
||||||
-ms-flex-pack: center;
|
-ms-flex-pack: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
-ms-flex-line-pack: center;
|
-ms-flex-line-pack: center;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
-ms-flex-align: center;
|
-ms-flex-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visual-console-item .digital-clock > span {
|
.visual-console-item .digital-clock > span {
|
||||||
@ -89,7 +89,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.visual-console-item .digital-clock > span.timezone {
|
.visual-console-item .digital-clock > span.timezone {
|
||||||
font-size: 25px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Analog clock */
|
/* Analog clock */
|
||||||
@ -100,18 +100,17 @@
|
|||||||
|
|
||||||
.visual-console-item .analogic-clock .hour-hand {
|
.visual-console-item .analogic-clock .hour-hand {
|
||||||
-webkit-animation: rotate-hour 43200s infinite linear;
|
-webkit-animation: rotate-hour 43200s infinite linear;
|
||||||
animation: rotate-hour 43200s infinite linear;
|
animation: rotate-hour 43200s infinite linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visual-console-item .analogic-clock .minute-hand {
|
.visual-console-item .analogic-clock .minute-hand {
|
||||||
-webkit-animation: rotate-minute 3600s infinite linear;
|
-webkit-animation: rotate-minute 3600s infinite linear;
|
||||||
animation: rotate-minute 3600s infinite linear;
|
animation: rotate-minute 3600s infinite linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visual-console-item .analogic-clock .second-hand {
|
.visual-console-item .analogic-clock .second-hand {
|
||||||
-webkit-animation: rotate-second 60s infinite linear;
|
-webkit-animation: rotate-second 60s infinite linear;
|
||||||
animation: rotate-second 60s infinite linear;
|
animation: rotate-second 60s infinite linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*# sourceMappingURL=vc.main.css.map*/
|
/*# sourceMappingURL=vc.main.css.map*/
|
@ -61,6 +61,7 @@ page.onConsoleMessage = function(msg) {
|
|||||||
page.onError = function(msg) {
|
page.onError = function(msg) {
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
page.close();
|
page.close();
|
||||||
|
phantom.exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
page.onCallback = function(st) {
|
page.onCallback = function(st) {
|
||||||
@ -74,4 +75,9 @@ page.onCallback = function(st) {
|
|||||||
phantom.exit();
|
phantom.exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
page.open(url, "POST", post_data, function(status) {});
|
page.open(url, "POST", post_data, function(status) {
|
||||||
|
if (status == "fail") {
|
||||||
|
console.out("Failed to generate chart.");
|
||||||
|
phantom.exit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -129,7 +129,7 @@
|
|||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.738';
|
$version = '7.0NG.738';
|
||||||
$build = '190918';
|
$build = '190926';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -17,7 +17,6 @@ global $config;
|
|||||||
check_login();
|
check_login();
|
||||||
|
|
||||||
enterprise_hook('open_meta_frame');
|
enterprise_hook('open_meta_frame');
|
||||||
|
|
||||||
$id_report = (int) get_parameter('id');
|
$id_report = (int) get_parameter('id');
|
||||||
|
|
||||||
if (! $id_report) {
|
if (! $id_report) {
|
||||||
@ -125,7 +124,7 @@ if (!defined('METACONSOLE')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Page header for metaconsole
|
// Page header for metaconsole
|
||||||
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
|
if (is_metaconsole()) {
|
||||||
// Bread crumbs
|
// Bread crumbs
|
||||||
ui_meta_add_breadcrumb(['link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder', 'text' => __('Reporting')]);
|
ui_meta_add_breadcrumb(['link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder', 'text' => __('Reporting')]);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
%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
|
||||||
|
@ -1455,6 +1455,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
|
|||||||
`current_month` TINYINT(1) DEFAULT '1',
|
`current_month` TINYINT(1) DEFAULT '1',
|
||||||
`failover_mode` tinyint(1) DEFAULT '1',
|
`failover_mode` tinyint(1) DEFAULT '1',
|
||||||
`failover_type` tinyint(1) DEFAULT '1',
|
`failover_type` tinyint(1) DEFAULT '1',
|
||||||
|
`uncompressed_module` TINYINT DEFAULT '0',
|
||||||
PRIMARY KEY(`id_rc`),
|
PRIMARY KEY(`id_rc`),
|
||||||
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
@ -2438,14 +2439,17 @@ CREATE TABLE IF NOT EXISTS `tdashboard` (
|
|||||||
-- Table `tdatabase`
|
-- Table `tdatabase`
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
CREATE TABLE IF NOT EXISTS `tdatabase` (
|
CREATE TABLE IF NOT EXISTS `tdatabase` (
|
||||||
`id` int(10) unsigned NOT NULL auto_increment,
|
`id` INT(10) unsigned NOT NULL auto_increment,
|
||||||
`host` varchar(100) default '',
|
`host` VARCHAR(255) default '',
|
||||||
`os_port` int(4) unsigned default '22',
|
`label` VARCHAR(255) default '',
|
||||||
`os_user` varchar(100) default '',
|
`os_port` INT UNSIGNED NOT NULL DEFAULT 22,
|
||||||
`db_port` int(4) unsigned default '3306',
|
`os_user` VARCHAR(255) default '',
|
||||||
|
`db_port` INT UNSIGNED NOT NULL DEFAULT 3306,
|
||||||
`status` tinyint(1) unsigned default '0',
|
`status` tinyint(1) unsigned default '0',
|
||||||
`action` tinyint(1) unsigned default '0',
|
`action` tinyint(1) unsigned default '0',
|
||||||
`last_error` varchar(255) default '',
|
`ssh_key` TEXT,
|
||||||
|
`ssh_pubkey` TEXT,
|
||||||
|
`last_error` TEXT,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8 ;
|
||||||
|
|
||||||
@ -2998,6 +3002,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
|
|||||||
`current_month` TINYINT(1) DEFAULT '1',
|
`current_month` TINYINT(1) DEFAULT '1',
|
||||||
`failover_mode` tinyint(1) DEFAULT '1',
|
`failover_mode` tinyint(1) DEFAULT '1',
|
||||||
`failover_type` tinyint(1) DEFAULT '1',
|
`failover_type` tinyint(1) DEFAULT '1',
|
||||||
|
`uncompressed_module` TINYINT DEFAULT '0',
|
||||||
PRIMARY KEY(`id_rc`)
|
PRIMARY KEY(`id_rc`)
|
||||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
@ -1317,7 +1317,8 @@ UPDATE `tnotification_source` SET `enabled`=1 WHERE `description` = 'System 
|
|||||||
--
|
--
|
||||||
INSERT INTO `tlayout`
|
INSERT INTO `tlayout`
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0);
|
(1, 'Demo visual console', 0, 'fondo.jpg', 1080, 1920, 'white', 0),
|
||||||
|
(2,'Demo visual console 2',0,'fondo-keep-alive.jpg',1080,1920,'#FFF',0);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table `tlayout_data`
|
-- Dumping data for table `tlayout_data`
|
||||||
@ -1420,5 +1421,20 @@ VALUES
|
|||||||
(94,1,580,904,0,0,'<p style="text-align: center; overflow: hidden;"><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;"><strong><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Office 7 -&nbsp;</span></strong></span><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Rack 2</span></p>','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
|
(94,1,580,904,0,0,'<p style="text-align: center; overflow: hidden;"><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;"><strong><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Office 7 -&nbsp;</span></strong></span><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Rack 2</span></p>','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
(95,1,132,907,0,0,'<p style="text-align: center; overflow: hidden;"><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;"><strong><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Office 7 -&nbsp;</span></strong></span><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Rack 1</span></p>','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
|
(95,1,132,907,0,0,'<p style="text-align: center; overflow: hidden;"><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;"><strong><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Office 7 -&nbsp;</span></strong></span><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Rack 1</span></p>','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
(96,1,733,20,0,0,'<p style="overflow: hidden;"><span class="visual_font_size_48pt"><strong><span style="color: #ffffff; font-family: opensans;">OFFICE RACKS</span></strong></span></p>','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
|
(96,1,733,20,0,0,'<p style="overflow: hidden;"><span class="visual_font_size_48pt"><strong><span style="color: #ffffff; font-family: opensans;">OFFICE RACKS</span></strong></span></p>','white',4,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
(97,1,1479,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60)
|
(97,1,1479,260,174,29,'','rack_server_rack',0,3600,1,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,'0.000','0.000',0,0,'analogic_1','time','Europe/Madrid',0,60),
|
||||||
|
(98,2,709,103,0,400,'','white',19,3600,0,0,0,0,1,0,0,0,0,'line','down','','#FFFFFF',0,0,'default',0,0.000,0.000,0,0,'digital_1','timedate','Europe/Madrid',0,0),
|
||||||
|
(99,2,178,481,111,111,'','status',0,3600,11556,430,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(100,2,542,481,111,111,'','status',0,3600,13,2,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(101,2,905,481,111,111,'','status',0,3600,114,11,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(102,2,1276,481,111,111,'','status',0,3600,7,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(103,2,1631,482,111,111,'','status',0,3600,11547,1,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(104,2,157,393,0,0,'<p style=\"line-height: 18px;\"><span class=\"visual_font_size_28pt\" style=\"line-height: 18px; color: #ffffff;\">Backups</span></p>\n<p style=\"line-height: 18px;\"> </p>','white',
|
||||||
|
4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(105,2,512,382,96,172,'<p style="overflow: hidden;"><span class="visual_font_size_28pt" style="font-family: opensans; color: #ffffff;">DB Status</span></p>
<p style="overflow: hidden;">&nbsp;</p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(106,2,886,382,0,0,'<p style=\"line-height: 18px; overflow: hidden;\"><span class=\"visual_font_size_28pt\" style=\"color: #ffffff; font-family: opensans;\">Disk slave</span></p>\n<p style=\"line-height: 18px; overflow: hidden;\"> </p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(107,2,1251,382,0,0,'<p style=\"line-height: 18px; overflow: hidden;\"><span class=\"visual_font_size_28pt\" style=\"color: #ffffff; font-family: opensans;\">Disk /var</span></p>\n<p style=\"line-height: 18px; overflow: hidden;\"> </p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(108,2,1547,382,0,0,'<p style="line-height: 18px; overflow: hidden;"><span class="visual_font_size_28pt" style="color: #ffffff; font-family: opensans;">Authentification</span></p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(109,2,126,820,0,0,'<p style="line-height: 18px; overflow: hidden;"><strong><span class="visual_font_size_36pt" style="font-family: opensans; color: #ffffff;">Processing</span></strong></p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(110,2,755,820,0,0,'<p style="line-height: 18px; overflow: hidden;"><strong><span class="visual_font_size_36pt" style="font-family: opensans; color: #ffffff;">Network</span></strong></p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0),
|
||||||
|
(111,2,1281,820,0,0,'<p style="line-height: 18px; overflow: hidden;"><strong><span class="visual_font_size_36pt" style="color: #ffffff; font-family: opensans;">Storage</span></strong></p>','white',4,3600,0,0,0,0,1,0,0,0,0,'line','down','','',0,0,'default',0,0.000,0.000,0,0,'analogic_1','time','Europe/Madrid',0,0)
|
||||||
;
|
;
|
@ -1,10 +1,10 @@
|
|||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.738-190918
|
Version: 7.0NG.738-190926
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
Installed-Size: 640
|
Installed-Size: 640
|
||||||
Maintainer: ÁRTICA ST <info@artica.es>
|
Maintainer: ÁRTICA ST <info@artica.es>
|
||||||
Homepage: http://pandorafms.org/
|
Homepage: http://pandorafms.org/
|
||||||
Depends: perl (>= 5.8), libdbi-perl, libdbd-mysql-perl, libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libxml-twig-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, libwww-perl, libsocket6-perl, libio-socket-inet6-perl, snmp-mibs-downloader, libjson-perl, libnet-telnet-perl, libencode-locale-perl, libgeo-ip-perl
|
Depends: perl (>= 5.8), libdbi-perl, libdbd-mysql-perl, libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libxml-twig-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, libwww-perl, libsocket6-perl, libio-socket-inet6-perl, libio-socket-ssl-perl, snmp-mibs-downloader, libjson-perl, libnet-telnet-perl, libencode-locale-perl, libgeo-ip-perl
|
||||||
Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. This is the server package. Server makes the remote checks and process information transfer by Pandora FMS agents to the server.
|
Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. This is the server package. Server makes the remote checks and process information transfer by Pandora FMS agents to the server.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.738-190918"
|
pandora_version="7.0NG.738-190926"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
@ -365,9 +365,11 @@ sub pandora_server_tasks ($) {
|
|||||||
|
|
||||||
# COMMON TASKS (master and non-master)
|
# COMMON TASKS (master and non-master)
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# Rotate Log File
|
|
||||||
if (($counter % 30) == 0) {
|
if (($counter % 30) == 0) {
|
||||||
|
# Update configuration options from the console.
|
||||||
|
pandora_get_sharedconfig ($pa_config, $dbh);
|
||||||
|
|
||||||
|
# Rotate the log file.
|
||||||
pandora_rotate_logfile($pa_config);
|
pandora_rotate_logfile($pa_config);
|
||||||
|
|
||||||
# Set event storm protection
|
# Set event storm protection
|
||||||
|
@ -226,8 +226,9 @@ recon_threads 1
|
|||||||
dataserver_threads 1
|
dataserver_threads 1
|
||||||
|
|
||||||
# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities
|
# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities
|
||||||
|
# If not set, the MTA configuration specified in the Pandora FMS Console will be used.
|
||||||
|
|
||||||
mta_address localhost
|
#mta_address localhost
|
||||||
|
|
||||||
# mta_port, this is the mail server port (default 25)
|
# mta_port, this is the mail server port (default 25)
|
||||||
|
|
||||||
@ -250,6 +251,10 @@ mta_address localhost
|
|||||||
|
|
||||||
#mta_from Pandora FMS <pandora@mydomain.com>
|
#mta_from Pandora FMS <pandora@mydomain.com>
|
||||||
|
|
||||||
|
# SMTP encryption protocol (none, ssl, starttls)
|
||||||
|
|
||||||
|
#mta_encryption none
|
||||||
|
|
||||||
# Set 1 if want eMail deliver alert in separate mail (default).
|
# Set 1 if want eMail deliver alert in separate mail (default).
|
||||||
# Set 0 if want eMail deliver shared mail by all destination.
|
# Set 0 if want eMail deliver shared mail by all destination.
|
||||||
mail_in_separate 1
|
mail_in_separate 1
|
||||||
|
@ -214,6 +214,7 @@ recon_threads 2
|
|||||||
dataserver_threads 2
|
dataserver_threads 2
|
||||||
|
|
||||||
# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities
|
# mta_address: External Mailer (MTA) IP Address to be used by Pandora FMS internal email capabilities
|
||||||
|
# If not set, the MTA configuration specified in the Pandora FMS Console will be used.
|
||||||
|
|
||||||
#mta_address localhost
|
#mta_address localhost
|
||||||
|
|
||||||
@ -235,6 +236,10 @@ dataserver_threads 2
|
|||||||
# probably you need to change it to avoid problems with your antispam
|
# probably you need to change it to avoid problems with your antispam
|
||||||
#mta_from pandora@sampledomain.com
|
#mta_from pandora@sampledomain.com
|
||||||
|
|
||||||
|
# SMTP encryption protocol (none, ssl, starttls)
|
||||||
|
|
||||||
|
#mta_encryption none
|
||||||
|
|
||||||
# xprobe2: Optional package to detect OS types using advanced TCP/IP
|
# xprobe2: Optional package to detect OS types using advanced TCP/IP
|
||||||
# fingerprinting tecniques, much more accurates than stadard nmap.
|
# fingerprinting tecniques, much more accurates than stadard nmap.
|
||||||
# If not provided, nmap is used insted xprobe2
|
# If not provided, nmap is used insted xprobe2
|
||||||
|
@ -45,7 +45,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 = "7.0NG.738";
|
my $pandora_version = "7.0NG.738";
|
||||||
my $pandora_build = "190918";
|
my $pandora_build = "190926";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
@ -187,6 +187,33 @@ sub pandora_get_sharedconfig ($$) {
|
|||||||
[$dbh]
|
[$dbh]
|
||||||
);
|
);
|
||||||
$pa_config->{'rb_product_name'} = 'Pandora FMS' unless (defined ($pa_config->{'rb_product_name'}) && $pa_config->{'rb_product_name'} ne '');
|
$pa_config->{'rb_product_name'} = 'Pandora FMS' unless (defined ($pa_config->{'rb_product_name'}) && $pa_config->{'rb_product_name'} ne '');
|
||||||
|
|
||||||
|
# Mail transport agent configuration. Local configuration takes precedence.
|
||||||
|
if ($pa_config->{"mta_local"} eq 0) {
|
||||||
|
$pa_config->{"mta_address"} = pandora_get_tconfig_token ($dbh, 'email_smtpServer', '');
|
||||||
|
$pa_config->{"mta_from"} = '"' . pandora_get_tconfig_token ($dbh, 'email_from_name', 'Pandora FMS') . '" <' .
|
||||||
|
pandora_get_tconfig_token ($dbh, 'email_from_dir', 'pandora@pandorafms.org') . '>';
|
||||||
|
$pa_config->{"mta_pass"} = pandora_get_tconfig_token ($dbh, 'email_password', '');
|
||||||
|
$pa_config->{"mta_port"} = pandora_get_tconfig_token ($dbh, 'email_smtpPort', '');
|
||||||
|
$pa_config->{"mta_user"} = pandora_get_tconfig_token ($dbh, 'email_username', '');
|
||||||
|
$pa_config->{"mta_encryption"} = pandora_get_tconfig_token ($dbh, 'email_encryption', '');
|
||||||
|
|
||||||
|
# Auto-negotiate the auth mechanism, since it cannot be set from the console.
|
||||||
|
# Do not include PLAIN, it generates the following error:
|
||||||
|
# 451 4.5.0 SMTP protocol violation, see RFC 2821
|
||||||
|
$pa_config->{"mta_auth"} = 'DIGEST-MD5 CRAM-MD5 LOGIN';
|
||||||
|
|
||||||
|
# Fix the format of mta_encryption.
|
||||||
|
if ($pa_config->{"mta_encryption"} eq 'tls') {
|
||||||
|
$pa_config->{"mta_encryption"} = 'starttls';
|
||||||
|
}
|
||||||
|
elsif ($pa_config->{"mta_encryption"} =~ m/^ssl/) {
|
||||||
|
$pa_config->{"mta_encryption"} = 'ssl';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$pa_config->{"mta_encryption"} = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -303,12 +330,14 @@ sub pandora_load_config {
|
|||||||
$pa_config->{"dynamic_constant"} = 10; # 7.0
|
$pa_config->{"dynamic_constant"} = 10; # 7.0
|
||||||
|
|
||||||
# Internal MTA for alerts, each server need its own config.
|
# Internal MTA for alerts, each server need its own config.
|
||||||
$pa_config->{"mta_address"} = '127.0.0.1'; # Introduced on 2.0
|
$pa_config->{"mta_address"} = ''; # Introduced on 2.0
|
||||||
$pa_config->{"mta_port"} = '25'; # Introduced on 2.0
|
$pa_config->{"mta_port"} = ''; # Introduced on 2.0
|
||||||
$pa_config->{"mta_user"} = ''; # Introduced on 2.0
|
$pa_config->{"mta_user"} = ''; # Introduced on 2.0
|
||||||
$pa_config->{"mta_pass"} = ''; # Introduced on 2.0
|
$pa_config->{"mta_pass"} = ''; # Introduced on 2.0
|
||||||
$pa_config->{"mta_auth"} = 'none'; # Introduced on 2.0 (Support LOGIN PLAIN CRAM-MD5 DIGEST-MD)
|
$pa_config->{"mta_auth"} = 'none'; # Introduced on 2.0 (Support LOGIN PLAIN CRAM-MD5 DIGEST-MD)
|
||||||
$pa_config->{"mta_from"} = 'pandora@localhost'; # Introduced on 2.0
|
$pa_config->{"mta_from"} = 'pandora@localhost'; # Introduced on 2.0
|
||||||
|
$pa_config->{"mta_encryption"} = 'none'; # 7.0 739
|
||||||
|
$pa_config->{"mta_local"} = 0; # 7.0 739
|
||||||
$pa_config->{"mail_in_separate"} = 1; # 1: eMail deliver alert mail in separate mails.
|
$pa_config->{"mail_in_separate"} = 1; # 1: eMail deliver alert mail in separate mails.
|
||||||
# 0: eMail deliver 1 mail with all destination.
|
# 0: eMail deliver 1 mail with all destination.
|
||||||
|
|
||||||
@ -328,6 +357,14 @@ sub pandora_load_config {
|
|||||||
# Xprobe2 for recon OS fingerprinting and tcpscan (optional)
|
# Xprobe2 for recon OS fingerprinting and tcpscan (optional)
|
||||||
$pa_config->{"xprobe2"} = "/usr/bin/xprobe2";
|
$pa_config->{"xprobe2"} = "/usr/bin/xprobe2";
|
||||||
|
|
||||||
|
# Winexe allows to exec commands on remote windows systems (optional)
|
||||||
|
$pa_config->{"winexe"} = "/usr/bin/winexe";
|
||||||
|
|
||||||
|
# PsExec allows to exec commands on remote windows systems from windows servers (optional)
|
||||||
|
$pa_config->{"psexec"} = 'C:\PandoraFMS\Pandora_Server\bin\PsExec.exe';
|
||||||
|
|
||||||
|
# plink allows to exec commands on remote linux systems from windows servers (optional)
|
||||||
|
$pa_config->{"plink"} = 'C:\PandoraFMS\Pandora_Server\bin\plink.exe';
|
||||||
|
|
||||||
# Snmpget for snmpget system command (optional)
|
# Snmpget for snmpget system command (optional)
|
||||||
$pa_config->{"snmpget"} = "/usr/bin/snmpget";
|
$pa_config->{"snmpget"} = "/usr/bin/snmpget";
|
||||||
@ -582,6 +619,7 @@ sub pandora_load_config {
|
|||||||
}
|
}
|
||||||
elsif ($parametro =~ m/^mta_address\s(.*)/i) {
|
elsif ($parametro =~ m/^mta_address\s(.*)/i) {
|
||||||
$pa_config->{'mta_address'}= clean_blank($1);
|
$pa_config->{'mta_address'}= clean_blank($1);
|
||||||
|
$pa_config->{'mta_local'}=1;
|
||||||
}
|
}
|
||||||
elsif ($parametro =~ m/^mta_port\s(.*)/i) {
|
elsif ($parametro =~ m/^mta_port\s(.*)/i) {
|
||||||
$pa_config->{'mta_port'}= clean_blank($1);
|
$pa_config->{'mta_port'}= clean_blank($1);
|
||||||
@ -592,6 +630,9 @@ sub pandora_load_config {
|
|||||||
elsif ($parametro =~ m/^mta_from\s(.*)/i) {
|
elsif ($parametro =~ m/^mta_from\s(.*)/i) {
|
||||||
$pa_config->{'mta_from'}= clean_blank($1);
|
$pa_config->{'mta_from'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
|
elsif ($parametro =~ m/^mta_encryption\s(.*)/i) {
|
||||||
|
$pa_config->{'mta_encryption'}= clean_blank($1);
|
||||||
|
}
|
||||||
elsif ($parametro =~ m/^mail_in_separate\s+([0-9]*)/i) {
|
elsif ($parametro =~ m/^mail_in_separate\s+([0-9]*)/i) {
|
||||||
$pa_config->{'mail_in_separate'}= clean_blank($1);
|
$pa_config->{'mail_in_separate'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
@ -805,6 +846,15 @@ sub pandora_load_config {
|
|||||||
elsif ($parametro =~ m/^xprobe2\s(.*)/i) {
|
elsif ($parametro =~ m/^xprobe2\s(.*)/i) {
|
||||||
$pa_config->{'xprobe2'}= clean_blank($1);
|
$pa_config->{'xprobe2'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
|
elsif ($parametro =~ m/^winexe\s(.*)/i) {
|
||||||
|
$pa_config->{'winexe'}= clean_blank($1);
|
||||||
|
}
|
||||||
|
elsif ($parametro =~ m/^psexec\s(.*)/i) {
|
||||||
|
$pa_config->{'psexec'}= clean_blank($1);
|
||||||
|
}
|
||||||
|
elsif ($parametro =~ m/^plink\s(.*)/i) {
|
||||||
|
$pa_config->{'plink'}= clean_blank($1);
|
||||||
|
}
|
||||||
elsif ($parametro =~ m/^snmpget\s(.*)/i) {
|
elsif ($parametro =~ m/^snmpget\s(.*)/i) {
|
||||||
$pa_config->{'snmpget'}= clean_blank($1);
|
$pa_config->{'snmpget'}= clean_blank($1);
|
||||||
}
|
}
|
||||||
@ -1004,7 +1054,7 @@ sub pandora_load_config {
|
|||||||
$pa_config->{'console_pass'}= safe_input(clean_blank($1));
|
$pa_config->{'console_pass'}= safe_input(clean_blank($1));
|
||||||
}
|
}
|
||||||
elsif ($parametro =~ m/^encryption_passphrase\s(.*)/i) { # 6.0
|
elsif ($parametro =~ m/^encryption_passphrase\s(.*)/i) { # 6.0
|
||||||
$pa_config->{'encryption_passphrase'}= safe_input(clean_blank($1));
|
$pa_config->{'encryption_passphrase'} = clean_blank($1);
|
||||||
}
|
}
|
||||||
elsif ($parametro =~ m/^unknown_interval\s+([0-9]*)/i) { # > 5.1SP2
|
elsif ($parametro =~ m/^unknown_interval\s+([0-9]*)/i) { # > 5.1SP2
|
||||||
$pa_config->{'unknown_interval'}= clean_blank($1);
|
$pa_config->{'unknown_interval'}= clean_blank($1);
|
||||||
|
@ -3155,11 +3155,20 @@ sub pandora_get_config_value ($$) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
## Get credential from credential store
|
## Get credential from credential store
|
||||||
##########################################################################
|
##########################################################################
|
||||||
sub pandora_get_credential ($$) {
|
sub pandora_get_credential ($$$) {
|
||||||
my ($dbh, $identifier) = @_;
|
my ($pa_config, $dbh, $identifier) = @_;
|
||||||
|
|
||||||
my $key = get_db_single_row($dbh, 'SELECT * FROM tcredential_store WHERE identifier = ?', $identifier);
|
my $key = get_db_single_row($dbh, 'SELECT * FROM tcredential_store WHERE identifier = ?', $identifier);
|
||||||
|
|
||||||
|
$key->{'username'} = pandora_output_password(
|
||||||
|
$pa_config,
|
||||||
|
safe_output($key->{'username'})
|
||||||
|
);
|
||||||
|
$key->{'password'} = pandora_output_password(
|
||||||
|
$pa_config,
|
||||||
|
safe_output($key->{'password'})
|
||||||
|
);
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,6 +343,9 @@ sub exec_recon_script ($$$) {
|
|||||||
sub PandoraFMS::Recon::Base::guess_os($$) {
|
sub PandoraFMS::Recon::Base::guess_os($$) {
|
||||||
my ($self, $device) = @_;
|
my ($self, $device) = @_;
|
||||||
|
|
||||||
|
$DEVNULL = '/dev/null' if (!defined($DEVNULL));
|
||||||
|
$DEVNULL = '/NUL' if ($^O =~ /win/i && !defined($DEVNULL));
|
||||||
|
|
||||||
# OS detection disabled. Use the device type.
|
# OS detection disabled. Use the device type.
|
||||||
if ($self->{'os_detection'} == 0) {
|
if ($self->{'os_detection'} == 0) {
|
||||||
my $device_type = $self->get_device_type($device);
|
my $device_type = $self->get_device_type($device);
|
||||||
@ -354,17 +357,20 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Use xprobe2 if available
|
# Use xprobe2 if available
|
||||||
if (-e $self->{pa_config}->{xprobe2}) {
|
if (-x $self->{'pa_config'}->{'xprobe2'}) {
|
||||||
my $output = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL | grep 'Running OS' | head -1`;
|
my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`;
|
||||||
if ($? == 0) {
|
if ($? == 0) {
|
||||||
|
my ($output) = $a =~ /Running OS:(.*)/;
|
||||||
return pandora_get_os($self->{'dbh'}, $output);
|
return pandora_get_os($self->{'dbh'}, $output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use nmap by default
|
# Use nmap by default
|
||||||
if (-e $self->{pa_config}->{nmap}) {
|
if (-x $self->{'pa_config'}->{'nmap'}) {
|
||||||
my $output = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL | grep 'Aggressive OS guesses'`;
|
my $return = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL`;
|
||||||
return OS_OTHER if ($? != 0);
|
return OS_OTHER if ($? != 0);
|
||||||
|
|
||||||
|
my ($output) = $return =~ /Aggressive OS guesses:\s*(.*)/;
|
||||||
return pandora_get_os($self->{'dbh'}, $output);
|
return pandora_get_os($self->{'dbh'}, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +383,11 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
|
|||||||
sub PandoraFMS::Recon::Base::tcp_scan ($$) {
|
sub PandoraFMS::Recon::Base::tcp_scan ($$) {
|
||||||
my ($self, $host) = @_;
|
my ($self, $host) = @_;
|
||||||
|
|
||||||
my $open_ports = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host | grep open | wc -l`;
|
my $r = `"$self->{pa_config}->{nmap}" -p$self->{recon_ports} $host`;
|
||||||
|
|
||||||
|
# Same as ""| grep open | wc -l" but multi-OS;
|
||||||
|
my $open_ports = () = $r =~ /open/gm;
|
||||||
|
|
||||||
return $open_ports;
|
return $open_ports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
|||||||
|
|
||||||
# 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 = "7.0NG.738";
|
my $pandora_version = "7.0NG.738";
|
||||||
my $pandora_build = "190918";
|
my $pandora_build = "190926";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
@ -36,7 +36,7 @@ use constant {
|
|||||||
DISCOVERY_DEPLOY_AGENTS => 9,
|
DISCOVERY_DEPLOY_AGENTS => 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
# /dev/null
|
# $DEVNULL
|
||||||
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
my $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';
|
||||||
|
|
||||||
# Some useful OIDs.
|
# Some useful OIDs.
|
||||||
@ -852,7 +852,7 @@ sub get_routes($) {
|
|||||||
$self->{'routes'} = [];
|
$self->{'routes'} = [];
|
||||||
|
|
||||||
# Parse route's output.
|
# Parse route's output.
|
||||||
my @output = `route -n 2>/dev/null`;
|
my @output = `route -n 2>$DEVNULL`;
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
chomp($line);
|
chomp($line);
|
||||||
if ($line =~ /^0\.0\.0\.0\s+(\d+\.\d+\.\d+\.\d+).*/) {
|
if ($line =~ /^0\.0\.0\.0\s+(\d+\.\d+\.\d+\.\d+).*/) {
|
||||||
@ -1220,7 +1220,7 @@ sub snmp_responds_v3($$) {
|
|||||||
sub local_arp($) {
|
sub local_arp($) {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my @output = `arp -an 2>/dev/null`;
|
my @output = `arp -an 2>$DEVNULL`;
|
||||||
foreach my $line (@output) {
|
foreach my $line (@output) {
|
||||||
next unless ($line =~ m/\((\S+)\) at ([0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+)/);
|
next unless ($line =~ m/\((\S+)\) at ([0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+)/);
|
||||||
$self->add_mac(parse_mac($2), $1);
|
$self->add_mac(parse_mac($2), $1);
|
||||||
@ -1286,7 +1286,7 @@ sub ping ($$$) {
|
|||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
|
|
||||||
# Note: There is no timeout option.
|
# Note: There is no timeout option.
|
||||||
`$ping_command -s -n $host 56 $packets >/dev/null 2>&1`;
|
`$ping_command -s -n $host 56 $packets >$DEVNULL 2>&1`;
|
||||||
return 1 if ($? == 0);
|
return 1 if ($? == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1299,7 +1299,7 @@ sub ping ($$$) {
|
|||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
|
|
||||||
# Note: There is no timeout option for ping6.
|
# Note: There is no timeout option for ping6.
|
||||||
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
`$ping_command -q -n -c $packets $host >$DEVNULL 2>&1`;
|
||||||
return 1 if ($? == 0);
|
return 1 if ($? == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1312,7 +1312,7 @@ sub ping ($$$) {
|
|||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
|
|
||||||
# Note: There is no timeout option for ping6.
|
# Note: There is no timeout option for ping6.
|
||||||
`$ping_command -q -n -c $packets $host >/dev/null 2>&1`;
|
`$ping_command -q -n -c $packets $host >$DEVNULL 2>&1`;
|
||||||
if ($? == 0) {
|
if ($? == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1324,7 +1324,7 @@ sub ping ($$$) {
|
|||||||
# Assume Linux by default.
|
# Assume Linux by default.
|
||||||
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
|
my $ping_command = $host =~ /\d+:|:\d+/ ? "ping6" : "ping";
|
||||||
for (my $i = 0; $i < $retries; $i++) {
|
for (my $i = 0; $i < $retries; $i++) {
|
||||||
`$ping_command -q -W $timeout -n -c $packets $host >/dev/null 2>&1`;
|
`$ping_command -q -W $timeout -n -c $packets $host >$DEVNULL 2>&1`;
|
||||||
return 1 if ($? == 0);
|
return 1 if ($? == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1529,99 +1529,101 @@ sub app_scan($) {
|
|||||||
$self->{'task_data'}
|
$self->{'task_data'}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$dbObj->is_connected()) {
|
if (defined($dbObj)) {
|
||||||
call('message', 'Cannot connect to target ' . $target, 3);
|
if (!$dbObj->is_connected()) {
|
||||||
$global_percent += $global_step;
|
call('message', 'Cannot connect to target ' . $target, 3);
|
||||||
$self->{'c_network_percent'} = 90;
|
$global_percent += $global_step;
|
||||||
# Update progress
|
$self->{'c_network_percent'} = 90;
|
||||||
$self->call('update_progress', $global_percent + (90 / (scalar @targets)));
|
# Update progress
|
||||||
$self->{'summary'}->{'not_alive'} += 1;
|
$self->call('update_progress', $global_percent + (90 / (scalar @targets)));
|
||||||
push @modules, {
|
$self->{'summary'}->{'not_alive'} += 1;
|
||||||
name => $type . ' connection',
|
push @modules, {
|
||||||
type => 'generic_proc',
|
name => $type . ' connection',
|
||||||
data => 0,
|
type => 'generic_proc',
|
||||||
description => $type . ' availability'
|
data => 0,
|
||||||
};
|
description => $type . ' availability'
|
||||||
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
my $dbObjCfg = $dbObj->get_config();
|
my $dbObjCfg = $dbObj->get_config();
|
||||||
|
|
||||||
$self->{'summary'}->{'discovered'} += 1;
|
$self->{'summary'}->{'discovered'} += 1;
|
||||||
$self->{'summary'}->{'alive'} += 1;
|
$self->{'summary'}->{'alive'} += 1;
|
||||||
|
|
||||||
push @modules, {
|
push @modules, {
|
||||||
name => $type . ' connection',
|
name => $type . ' connection',
|
||||||
type => 'generic_proc',
|
type => 'generic_proc',
|
||||||
data => 1,
|
data => 1,
|
||||||
description => $type . ' availability'
|
description => $type . ' availability'
|
||||||
};
|
};
|
||||||
|
|
||||||
# Analyze.
|
# Analyze.
|
||||||
$self->{'step'} = STEP_STATISTICS;
|
$self->{'step'} = STEP_STATISTICS;
|
||||||
$self->{'c_network_percent'} = 30;
|
$self->{'c_network_percent'} = 30;
|
||||||
$self->call('update_progress', $global_percent + (30 / (scalar @targets)));
|
$self->call('update_progress', $global_percent + (30 / (scalar @targets)));
|
||||||
$self->{'c_network_name'} = $dbObj->get_host();
|
$self->{'c_network_name'} = $dbObj->get_host();
|
||||||
|
|
||||||
# Retrieve connection statistics.
|
# Retrieve connection statistics.
|
||||||
# Retrieve uptime statistics
|
# Retrieve uptime statistics
|
||||||
# Retrieve query stats
|
# Retrieve query stats
|
||||||
# Retrieve connections
|
# Retrieve connections
|
||||||
# Retrieve innodb
|
# Retrieve innodb
|
||||||
# Retrieve cache
|
# Retrieve cache
|
||||||
$self->{'c_network_percent'} = 50;
|
$self->{'c_network_percent'} = 50;
|
||||||
$self->call('update_progress', $global_percent + (50 / (scalar @targets)));
|
$self->call('update_progress', $global_percent + (50 / (scalar @targets)));
|
||||||
push @modules, $dbObj->get_statistics();
|
push @modules, $dbObj->get_statistics();
|
||||||
|
|
||||||
# Custom queries.
|
# Custom queries.
|
||||||
$self->{'step'} = STEP_CUSTOM_QUERIES;
|
$self->{'step'} = STEP_CUSTOM_QUERIES;
|
||||||
$self->{'c_network_percent'} = 80;
|
$self->{'c_network_percent'} = 80;
|
||||||
$self->call('update_progress', $global_percent + (80 / (scalar @targets)));
|
$self->call('update_progress', $global_percent + (80 / (scalar @targets)));
|
||||||
push @modules, $dbObj->execute_custom_queries();
|
push @modules, $dbObj->execute_custom_queries();
|
||||||
|
|
||||||
if (defined($dbObjCfg->{'scan_databases'})
|
if (defined($dbObjCfg->{'scan_databases'})
|
||||||
&& $dbObjCfg->{'scan_databases'} == 1) {
|
&& "$dbObjCfg->{'scan_databases'}" eq "1") {
|
||||||
# Skip database scan in Oracle tasks
|
# Skip database scan in Oracle tasks
|
||||||
next if $self->{'type'} == DISCOVERY_APP_ORACLE;
|
next if $self->{'type'} == DISCOVERY_APP_ORACLE;
|
||||||
|
|
||||||
my $__data = $dbObj->scan_databases();
|
my $__data = $dbObj->scan_databases();
|
||||||
|
|
||||||
if (ref($__data) eq "ARRAY") {
|
if (ref($__data) eq "ARRAY") {
|
||||||
if (defined($dbObjCfg->{'agent_per_database'})
|
if (defined($dbObjCfg->{'agent_per_database'})
|
||||||
&& $dbObjCfg->{'agent_per_database'} == 1) {
|
&& $dbObjCfg->{'agent_per_database'} == 1) {
|
||||||
# Agent per database detected.
|
# Agent per database detected.
|
||||||
push @data, @{$__data};
|
push @data, @{$__data};
|
||||||
} else {
|
} else {
|
||||||
# Merge modules into engine agent.
|
# Merge modules into engine agent.
|
||||||
my @_modules = map {
|
my @_modules = map {
|
||||||
map { $_ } @{$_->{'module_data'}}
|
map { $_ } @{$_->{'module_data'}}
|
||||||
} @{$__data};
|
} @{$__data};
|
||||||
|
|
||||||
push @modules, @_modules;
|
push @modules, @_modules;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Put engine agent at the beginning of the list.
|
||||||
|
my $version = $dbObj->get_version();
|
||||||
|
unshift @data,{
|
||||||
|
'agent_data' => {
|
||||||
|
'agent_name' => $dbObj->get_agent_name(),
|
||||||
|
'os' => $type,
|
||||||
|
'os_version' => (defined($version) ? $version : 'Discovery'),
|
||||||
|
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
||||||
|
'id_group' => $self->{'task_data'}->{'id_group'},
|
||||||
|
'address' => $dbObj->get_host(),
|
||||||
|
'description' => '',
|
||||||
|
},
|
||||||
|
'module_data' => \@modules,
|
||||||
|
};
|
||||||
|
|
||||||
|
$self->call('create_agents', \@data);
|
||||||
|
|
||||||
|
# Destroy item.
|
||||||
|
undef($dbObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
# Put engine agent at the beginning of the list.
|
|
||||||
my $version = $dbObj->get_version();
|
|
||||||
unshift @data,{
|
|
||||||
'agent_data' => {
|
|
||||||
'agent_name' => $dbObj->get_agent_name(),
|
|
||||||
'os' => $type,
|
|
||||||
'os_version' => (defined($version) ? $version : 'Discovery'),
|
|
||||||
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
|
||||||
'id_group' => $self->{'task_data'}->{'id_group'},
|
|
||||||
'address' => $dbObj->get_host(),
|
|
||||||
'description' => '',
|
|
||||||
},
|
|
||||||
'module_data' => \@modules,
|
|
||||||
};
|
|
||||||
|
|
||||||
$self->call('create_agents', \@data);
|
|
||||||
|
|
||||||
# Destroy item.
|
|
||||||
undef($dbObj);
|
|
||||||
|
|
||||||
$global_percent += $global_step;
|
$global_percent += $global_step;
|
||||||
$self->{'c_network_percent'} = 100;
|
$self->{'c_network_percent'} = 100;
|
||||||
$self->call('update_progress', $global_percent);
|
$self->call('update_progress', $global_percent);
|
||||||
@ -1674,7 +1676,7 @@ sub deploy_scan($) {
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
sub scan($) {
|
sub scan($) {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my ($progress, $step);
|
my ($progress, $step) = 1, 0;
|
||||||
|
|
||||||
# 1%
|
# 1%
|
||||||
$self->call('update_progress', 1);
|
$self->call('update_progress', 1);
|
||||||
@ -1697,7 +1699,7 @@ sub scan($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Find devices.
|
# Find devices.
|
||||||
$self->call('message', "[1/5] Scanning the network...", 3);
|
$self->call('message', "[1/4] Scanning the network...", 3);
|
||||||
$self->{'step'} = STEP_SCANNING;
|
$self->{'step'} = STEP_SCANNING;
|
||||||
$self->call('update_progress', $progress);
|
$self->call('update_progress', $progress);
|
||||||
$self->scan_subnet();
|
$self->scan_subnet();
|
||||||
@ -1713,7 +1715,7 @@ sub scan($) {
|
|||||||
$self->call('delete_connections');
|
$self->call('delete_connections');
|
||||||
|
|
||||||
# Connectivity from address forwarding tables.
|
# Connectivity from address forwarding tables.
|
||||||
$self->call('message', "[1/4] Finding address forwarding table connectivity...", 3);
|
$self->call('message', "[2/4] Finding address forwarding table connectivity...", 3);
|
||||||
$self->{'step'} = STEP_AFT;
|
$self->{'step'} = STEP_AFT;
|
||||||
($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%.
|
($progress, $step) = (50, 20.0 / scalar(@hosts)); # From 50% to 70%.
|
||||||
for (my $i = 0; defined($hosts[$i]); $i++) {
|
for (my $i = 0; defined($hosts[$i]); $i++) {
|
||||||
@ -1831,7 +1833,7 @@ sub snmp_get_command {
|
|||||||
my ($self, $device, $oid, $community, $vlan) = @_;
|
my ($self, $device, $oid, $community, $vlan) = @_;
|
||||||
$vlan = defined($vlan) ? "\@" . $vlan : '';
|
$vlan = defined($vlan) ? "\@" . $vlan : '';
|
||||||
|
|
||||||
my $command = "snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
my $command = "snmpwalk -M$DEVNULL -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v$self->{'snmp_version'} -On -Oe ";
|
||||||
if ($self->{'snmp_version'} eq "3") {
|
if ($self->{'snmp_version'} eq "3") {
|
||||||
if ($self->{'community'}) { # Context
|
if ($self->{'community'}) { # Context
|
||||||
$command .= " -N $self->{'community'} ";
|
$command .= " -N $self->{'community'} ";
|
||||||
@ -1847,7 +1849,7 @@ sub snmp_get_command {
|
|||||||
$command .= " -c$community$vlan ";
|
$command .= " -c$community$vlan ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "$command $device $oid 2>/dev/null";
|
return "$command $device $oid 2>$DEVNULL";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,9 @@ $VERSION = '0.79_16';
|
|||||||
|
|
||||||
'tz' => '', # only to override automatic detection
|
'tz' => '', # only to override automatic detection
|
||||||
'port' => 25, # change it if you always use a non-standard port
|
'port' => 25, # change it if you always use a non-standard port
|
||||||
'debug' => 0 # prints stuff to STDERR
|
'debug' => 0, # prints stuff to STDERR
|
||||||
|
'encryption' => 'none', # no, ssl or starttls
|
||||||
|
'timeout' => 5, # timeout for socket reads/writes in seconds
|
||||||
);
|
);
|
||||||
|
|
||||||
# *******************************************************************
|
# *******************************************************************
|
||||||
@ -54,7 +56,8 @@ use vars qw(
|
|||||||
$auth_support
|
$auth_support
|
||||||
);
|
);
|
||||||
|
|
||||||
use Socket;
|
use IO::Socket::INET;
|
||||||
|
use IO::Select;
|
||||||
use Time::Local; # for automatic time zone detection
|
use Time::Local; # for automatic time zone detection
|
||||||
use Sys::Hostname; # for use of hostname in HELO
|
use Sys::Hostname; # for use of hostname in HELO
|
||||||
|
|
||||||
@ -62,6 +65,12 @@ use Sys::Hostname; # for use of hostname in HELO
|
|||||||
|
|
||||||
$auth_support = 'DIGEST-MD5 CRAM-MD5 PLAIN LOGIN';
|
$auth_support = 'DIGEST-MD5 CRAM-MD5 PLAIN LOGIN';
|
||||||
|
|
||||||
|
# IO::Socket object.
|
||||||
|
my $S;
|
||||||
|
|
||||||
|
# IO::Select object.
|
||||||
|
my $Sel;
|
||||||
|
|
||||||
# use MIME::QuotedPrint if available and configured in %mailcfg
|
# use MIME::QuotedPrint if available and configured in %mailcfg
|
||||||
eval("use MIME::QuotedPrint");
|
eval("use MIME::QuotedPrint");
|
||||||
$mailcfg{'mime'} &&= (!$@);
|
$mailcfg{'mime'} &&= (!$@);
|
||||||
@ -178,9 +187,9 @@ sub sendmail {
|
|||||||
local $_;
|
local $_;
|
||||||
|
|
||||||
my (%mail, $k,
|
my (%mail, $k,
|
||||||
$smtp, $server, $port, $connected, $localhost,
|
$smtp, $server, $port, $localhost,
|
||||||
$fromaddr, $recip, @recipients, $to, $header,
|
$fromaddr, $recip, @recipients, $to, $header,
|
||||||
%esmtp, @wanted_methods,
|
%esmtp, @wanted_methods, $encryption
|
||||||
);
|
);
|
||||||
use vars qw($server_reply);
|
use vars qw($server_reply);
|
||||||
# -------- a few internal subs ----------
|
# -------- a few internal subs ----------
|
||||||
@ -191,7 +200,7 @@ sub sendmail {
|
|||||||
$error .= "Server said: $server_reply\n";
|
$error .= "Server said: $server_reply\n";
|
||||||
print STDERR "Server said: $server_reply\n" if $^W;
|
print STDERR "Server said: $server_reply\n" if $^W;
|
||||||
}
|
}
|
||||||
close S;
|
close $S if defined($S);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,31 +209,40 @@ sub sendmail {
|
|||||||
for $i (0..$#_) {
|
for $i (0..$#_) {
|
||||||
# accept references, so we don't copy potentially big data
|
# accept references, so we don't copy potentially big data
|
||||||
my $data = ref($_[$i]) ? $_[$i] : \$_[$i];
|
my $data = ref($_[$i]) ? $_[$i] : \$_[$i];
|
||||||
if ($mailcfg{'debug'} > 5) {
|
if ($mailcfg{'debug'} > 9) {
|
||||||
if (length($$data) < 500) {
|
if (length($$data) < 500) {
|
||||||
print ">", $$data;
|
print STDERR ">", $$data;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print "> [...", length($$data), " bytes sent ...]\n";
|
print STDERR "> [...", length($$data), " bytes sent ...]\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print(S $$data) || return 0;
|
my @sockets = $Sel->can_write($mailcfg{'timeout'});
|
||||||
|
return 0 if (!@sockets);
|
||||||
|
syswrite($sockets[0], $$data) || return 0;
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub socket_read {
|
sub socket_read {
|
||||||
|
my $buffer;
|
||||||
$server_reply = "";
|
$server_reply = "";
|
||||||
do {
|
|
||||||
$_ = <S>;
|
while (my @sockets = $Sel->can_read($mailcfg{'timeout'})) {
|
||||||
$server_reply .= $_;
|
return if (!@sockets);
|
||||||
#chomp $_;
|
# 16kByte is the maximum size of an SSL frame and because sysread
|
||||||
print "<$_" if $mailcfg{'debug'} > 5;
|
# returns data from only a single SSL frame you can guarantee that
|
||||||
if (/^[45]/ or !$_) {
|
# there are no pending data.
|
||||||
chomp $server_reply;
|
sysread($sockets[0], $buffer, 65535) || return;
|
||||||
return; # return false
|
$server_reply .= $buffer;
|
||||||
}
|
last if ($buffer =~ m/\n$/);
|
||||||
} while (/^[\d]+-/);
|
}
|
||||||
|
|
||||||
|
print STDERR "<$server_reply" if $mailcfg{'debug'} > 9;
|
||||||
|
if ($server_reply =~ /^[45]/) {
|
||||||
|
chomp $server_reply;
|
||||||
|
return; # return false
|
||||||
|
}
|
||||||
chomp $server_reply;
|
chomp $server_reply;
|
||||||
return $server_reply;
|
return $server_reply;
|
||||||
}
|
}
|
||||||
@ -260,13 +278,15 @@ sub sendmail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$smtp = $mail{'Smtp'} || $mail{'Server'};
|
$smtp = $mail{'Smtp'} || $mail{'Server'};
|
||||||
unshift @{$mailcfg{'smtp'}}, $smtp if ($smtp and $mailcfg{'smtp'}->[0] ne $smtp);
|
$mailcfg{'smtp'}->[0] = $smtp if ($smtp and $mailcfg{'smtp'}->[0] ne $smtp);
|
||||||
|
|
||||||
|
$encryption = $mail{'Encryption'} || $mail{'Encryption'};
|
||||||
|
|
||||||
# delete non-header keys, so we don't send them later as mail headers
|
# delete non-header keys, so we don't send them later as mail headers
|
||||||
# I like this syntax, but it doesn't seem to work with AS port 5.003_07:
|
# I like this syntax, but it doesn't seem to work with AS port 5.003_07:
|
||||||
# delete @mail{'Smtp', 'Server'};
|
# delete @mail{'Smtp', 'Server'};
|
||||||
# so instead:
|
# so instead:
|
||||||
delete $mail{'Smtp'}; delete $mail{'Server'};
|
delete $mail{'Smtp'}; delete $mail{'Server'}; delete $mail{'Encryption'};
|
||||||
|
|
||||||
$mailcfg{'port'} = $mail{'Port'} || $mailcfg{'port'} || 25;
|
$mailcfg{'port'} = $mail{'Port'} || $mailcfg{'port'} || 25;
|
||||||
delete $mail{'Port'};
|
delete $mail{'Port'};
|
||||||
@ -343,48 +363,36 @@ sub sendmail {
|
|||||||
$localhost = hostname() || 'localhost';
|
$localhost = hostname() || 'localhost';
|
||||||
|
|
||||||
foreach $server ( @{$mailcfg{'smtp'}} ) {
|
foreach $server ( @{$mailcfg{'smtp'}} ) {
|
||||||
# open socket needs to be inside this foreach loop on Linux,
|
print STDERR "- trying $server\n" if $mailcfg{'debug'} > 9;
|
||||||
# otherwise all servers fail if 1st one fails !??! why?
|
|
||||||
unless ( socket S, AF_INET, SOCK_STREAM, scalar(getprotobyname 'tcp') ) {
|
|
||||||
return fail("socket failed ($!)")
|
|
||||||
}
|
|
||||||
|
|
||||||
print "- trying $server\n" if $mailcfg{'debug'} > 1;
|
|
||||||
|
|
||||||
$server =~ s/\s+//go; # remove spaces just in case of a typo
|
$server =~ s/\s+//go; # remove spaces just in case of a typo
|
||||||
# extract port if server name like "mail.domain.com:2525"
|
# extract port if server name like "mail.domain.com:2525"
|
||||||
$port = ($server =~ s/:(\d+)$//o) ? $1 : $mailcfg{'port'};
|
$port = ($server =~ s/:(\d+)$//o) ? $1 : $mailcfg{'port'};
|
||||||
$smtp = $server; # save $server for use outside foreach loop
|
$smtp = $server; # save $server for use outside foreach loop
|
||||||
|
|
||||||
my $smtpaddr = inet_aton $server;
|
# load IO::Socket SSL if needed
|
||||||
unless ($smtpaddr) {
|
if ($encryption ne 'none') {
|
||||||
$error .= "$server not found\n";
|
eval "require IO::Socket::SSL" || return fail("IO::Socket::SSL is not available");
|
||||||
next; # next server
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $retried = 0; # reset retries for each server
|
my $retried = 0; # reset retries for each server
|
||||||
while ( ( not $connected = connect S, pack_sockaddr_in($port, $smtpaddr) )
|
if ($encryption ne 'ssl') {
|
||||||
and ( $retried < $mailcfg{'retries'} )
|
$S = new IO::Socket::INET(PeerPort => $port, PeerAddr => $server, Proto => 'tcp');
|
||||||
) {
|
|
||||||
$retried++;
|
|
||||||
$error .= "connect to $server failed ($!)\n";
|
|
||||||
print "- connect to $server failed ($!)\n" if $mailcfg{'debug'} > 1;
|
|
||||||
print "retrying in $mailcfg{'delay'} seconds...\n" if $mailcfg{'debug'} > 1;
|
|
||||||
sleep $mailcfg{'delay'};
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if ( $connected ) {
|
$S = new IO::Socket::SSL(PeerPort => $port, PeerAddr => $server, Proto => 'tcp', SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE(), Domain => AF_INET);
|
||||||
print "- connected to $server\n" if $mailcfg{'debug'} > 3;
|
}
|
||||||
|
if ( $S ) {
|
||||||
|
print STDERR "- connected to $server\n" if $mailcfg{'debug'} > 9;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$error .= "connect to $server failed\n";
|
$error .= "connect to $server failed\n";
|
||||||
print "- connect to $server failed, next server...\n" if $mailcfg{'debug'} > 1;
|
print STDERR "- connect to $server failed, next server...\n" if $mailcfg{'debug'} > 9;
|
||||||
next; # next server
|
next; # next server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ( $connected ) {
|
unless ( $S ) {
|
||||||
return fail("connect to $smtp failed ($!) no (more) retries!")
|
return fail("connect to $smtp failed ($!) no (more) retries!")
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -397,7 +405,8 @@ sub sendmail {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
my($oldfh) = select(S); $| = 1; select($oldfh);
|
$Sel = new IO::Select() || return fail("IO::Select error");
|
||||||
|
$Sel->add($S);
|
||||||
|
|
||||||
socket_read()
|
socket_read()
|
||||||
|| return fail("Connection error from $smtp on port $port ($_)");
|
|| return fail("Connection error from $smtp on port $port ($_)");
|
||||||
@ -418,8 +427,37 @@ sub sendmail {
|
|||||||
|| return fail("send HELO error (lost connection?)");
|
|| return fail("send HELO error (lost connection?)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($auth) {
|
# STARTTLS
|
||||||
warn "AUTH requested\n" if ($mailcfg{debug} > 4);
|
if ($encryption eq 'starttls') {
|
||||||
|
defined($esmtp{'STARTTLS'})
|
||||||
|
|| return fail('STARTTLS not supported');
|
||||||
|
socket_write("STARTTLS$CRLF") || return fail("send STARTTLS error");
|
||||||
|
socket_read()
|
||||||
|
|| return fail('STARTTLS error');
|
||||||
|
IO::Socket::SSL->start_SSL($S, SSL_hostname => $server, SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE())
|
||||||
|
|| return fail("start_SSL failed");
|
||||||
|
|
||||||
|
# The client SHOULD send an EHLO command as the
|
||||||
|
# first command after a successful TLS negotiation.
|
||||||
|
socket_write("EHLO $localhost$CRLF")
|
||||||
|
|| return fail("send EHLO error (lost connection?)");
|
||||||
|
my $ehlo = socket_read();
|
||||||
|
if ($ehlo) {
|
||||||
|
# The server MUST discard any knowledge
|
||||||
|
# obtained from the client.
|
||||||
|
%esmtp = ();
|
||||||
|
|
||||||
|
# parse EHLO response
|
||||||
|
map {
|
||||||
|
s/^\d+[- ]//;
|
||||||
|
my ($k, $v) = split /\s+/, $_, 2;
|
||||||
|
$esmtp{$k} = $v || 1 if $k;
|
||||||
|
} split(/\n/, $ehlo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined($auth) && $auth->{'user'} ne '') {
|
||||||
|
warn "AUTH requested\n" if ($mailcfg{debug} > 9);
|
||||||
# reduce wanted methods to those supported
|
# reduce wanted methods to those supported
|
||||||
my @methods = grep {$esmtp{'AUTH'}=~/(^|\s)$_(\s|$)/i}
|
my @methods = grep {$esmtp{'AUTH'}=~/(^|\s)$_(\s|$)/i}
|
||||||
grep {$auth_support =~ /(^|\s)$_(\s|$)/i}
|
grep {$auth_support =~ /(^|\s)$_(\s|$)/i}
|
||||||
@ -480,9 +518,9 @@ sub sendmail {
|
|||||||
my $challenge = socket_read()
|
my $challenge = socket_read()
|
||||||
|| return fail("AUTH DIGEST-MD5 failed: $server_reply");
|
|| return fail("AUTH DIGEST-MD5 failed: $server_reply");
|
||||||
$challenge =~ s/^\d+\s+//; $challenge =~ s/[\r\n]+$//;
|
$challenge =~ s/^\d+\s+//; $challenge =~ s/[\r\n]+$//;
|
||||||
warn "\nCHALLENGE=", decode_base64($challenge), "\n" if ($mailcfg{debug} > 10);
|
warn "\nCHALLENGE=", decode_base64($challenge), "\n" if ($mailcfg{debug} > 9);
|
||||||
my $response = _digest_md5($auth->{user}, $auth->{password}, decode_base64($challenge), $auth->{realm});
|
my $response = _digest_md5($auth->{user}, $auth->{password}, decode_base64($challenge), $auth->{realm});
|
||||||
warn "\nRESPONSE=$response\n" if ($mailcfg{debug} > 10);
|
warn "\nRESPONSE=$response\n" if ($mailcfg{debug} > 9);
|
||||||
socket_write(encode_base64($response, ""), $CRLF)
|
socket_write(encode_base64($response, ""), $CRLF)
|
||||||
|| return fail("AUTH DIGEST-MD5 failed: $server_reply");
|
|| return fail("AUTH DIGEST-MD5 failed: $server_reply");
|
||||||
my $status = socket_read()
|
my $status = socket_read()
|
||||||
@ -562,7 +600,7 @@ sub sendmail {
|
|||||||
socket_write("QUIT$CRLF")
|
socket_write("QUIT$CRLF")
|
||||||
|| return fail("send QUIT error");
|
|| return fail("send QUIT error");
|
||||||
socket_read();
|
socket_read();
|
||||||
close S;
|
close $S;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} # end sub sendmail
|
} # end sub sendmail
|
||||||
|
@ -140,6 +140,7 @@ our @EXPORT = qw(
|
|||||||
generate_agent_name_hash
|
generate_agent_name_hash
|
||||||
long_to_ip
|
long_to_ip
|
||||||
ip_to_long
|
ip_to_long
|
||||||
|
get_enabled_servers
|
||||||
);
|
);
|
||||||
|
|
||||||
# ID of the different servers
|
# ID of the different servers
|
||||||
@ -518,8 +519,15 @@ sub pandora_sendmail {
|
|||||||
Smtp => $pa_config->{"mta_address"},
|
Smtp => $pa_config->{"mta_address"},
|
||||||
Port => $pa_config->{"mta_port"},
|
Port => $pa_config->{"mta_port"},
|
||||||
From => $pa_config->{"mta_from"},
|
From => $pa_config->{"mta_from"},
|
||||||
|
Encryption => $pa_config->{"mta_encryption"},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Set the timeout.
|
||||||
|
$PandoraFMS::Sendmail::mailcfg{'timeout'} = $pa_config->{"tcp_timeout"};
|
||||||
|
|
||||||
|
# Enable debugging.
|
||||||
|
$PandoraFMS::Sendmail::mailcfg{'debug'} = $pa_config->{"verbosity"};
|
||||||
|
|
||||||
if (defined($content_type)) {
|
if (defined($content_type)) {
|
||||||
$mail{'Content-Type'} = $content_type;
|
$mail{'Content-Type'} = $content_type;
|
||||||
}
|
}
|
||||||
@ -535,15 +543,12 @@ sub pandora_sendmail {
|
|||||||
$mail{auth} = {user=>$pa_config->{"mta_user"}, password=>$pa_config->{"mta_pass"}, method=>$pa_config->{"mta_auth"}, required=>1 };
|
$mail{auth} = {user=>$pa_config->{"mta_user"}, password=>$pa_config->{"mta_pass"}, method=>$pa_config->{"mta_auth"}, required=>1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendmail %mail) {
|
eval {
|
||||||
return;
|
if (!sendmail(%mail)) {
|
||||||
}
|
logger ($pa_config, "[ERROR] Sending email to $to_address with subject $subject", 1);
|
||||||
else {
|
logger ($pa_config, "ERROR Code: $Mail::Sendmail::error", 5) if (defined($Mail::Sendmail::error));
|
||||||
logger ($pa_config, "[ERROR] Sending email to $to_address with subject $subject", 1);
|
|
||||||
if (defined($Mail::Sendmail::error)){
|
|
||||||
logger ($pa_config, "ERROR Code: $Mail::Sendmail::error", 5);
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -619,7 +624,7 @@ sub logger ($$;$) {
|
|||||||
$message = safe_output ($message);
|
$message = safe_output ($message);
|
||||||
|
|
||||||
$level = 1 unless defined ($level);
|
$level = 1 unless defined ($level);
|
||||||
return if ($level > $pa_config->{'verbosity'});
|
return if (!defined ($pa_config->{'verbosity'}) || $level > $pa_config->{'verbosity'});
|
||||||
|
|
||||||
if (!defined($pa_config->{'log_file'})) {
|
if (!defined($pa_config->{'log_file'})) {
|
||||||
print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n";
|
print strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " [V". $level ."] " . $message . "\n";
|
||||||
@ -989,7 +994,8 @@ sub load_average {
|
|||||||
$load_average = ((split(/\s+/, `/sbin/sysctl -n vm.loadavg`))[1]);
|
$load_average = ((split(/\s+/, `/sbin/sysctl -n vm.loadavg`))[1]);
|
||||||
} elsif ($OSNAME eq "MSWin32") {
|
} elsif ($OSNAME eq "MSWin32") {
|
||||||
# Windows hasn't got load average.
|
# Windows hasn't got load average.
|
||||||
$load_average = undef;
|
$load_average = `powershell "(Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average).average"`;
|
||||||
|
chop($load_average);
|
||||||
}
|
}
|
||||||
# by default LINUX calls
|
# by default LINUX calls
|
||||||
else {
|
else {
|
||||||
@ -2049,6 +2055,25 @@ sub long_to_ip {
|
|||||||
return inet_ntoa pack("N", ($ip_long));
|
return inet_ntoa pack("N", ($ip_long));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Returns a list with enabled servers.
|
||||||
|
###############################################################################
|
||||||
|
sub get_enabled_servers {
|
||||||
|
my $conf = shift;
|
||||||
|
|
||||||
|
if (ref($conf) ne "HASH") {
|
||||||
|
return ();
|
||||||
|
}
|
||||||
|
|
||||||
|
my @server_list = map {
|
||||||
|
if ($_ =~ /server$/i && $conf->{$_} > 0) {
|
||||||
|
$_
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
} keys %{$conf};
|
||||||
|
|
||||||
|
return @server_list;
|
||||||
|
}
|
||||||
# End of function declaration
|
# End of function declaration
|
||||||
# End of defined Code
|
# End of defined Code
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
@ -27,7 +27,7 @@ Requires: perl(DBI) perl(DBD::mysql)
|
|||||||
Requires: perl(HTTP::Request::Common) perl(LWP::Simple) perl(LWP::UserAgent)
|
Requires: perl(HTTP::Request::Common) perl(LWP::Simple) perl(LWP::UserAgent)
|
||||||
Requires: perl(XML::Simple) perl(XML::Twig) net-snmp-utils
|
Requires: perl(XML::Simple) perl(XML::Twig) net-snmp-utils
|
||||||
Requires: perl(NetAddr::IP) net-snmp net-tools
|
Requires: perl(NetAddr::IP) net-snmp net-tools
|
||||||
Requires: perl(IO::Socket::INET6) perl(Net::Telnet)
|
Requires: perl(IO::Socket::INET6) perl(IO::Socket::SSL) perl(Net::Telnet)
|
||||||
Requires: nmap sudo perl(JSON)
|
Requires: nmap sudo perl(JSON)
|
||||||
Requires: perl(Time::HiRes) perl(Encode::Locale)
|
Requires: perl(Time::HiRes) perl(Encode::Locale)
|
||||||
Requires: perl perl(Sys::Syslog) perl(HTML::Entities) perl(Geo::IP)
|
Requires: perl perl(Sys::Syslog) perl(HTML::Entities) perl(Geo::IP)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190918
|
%define release 190926
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
@ -24,7 +24,7 @@ Provides: %{name}-%{version}
|
|||||||
Requires: perl-DBI perl-DBD-mysql perl-libwww-perl
|
Requires: perl-DBI perl-DBD-mysql perl-libwww-perl
|
||||||
Requires: perl-NetAddr-IP net-snmp net-tools perl-XML-Twig
|
Requires: perl-NetAddr-IP net-snmp net-tools perl-XML-Twig
|
||||||
Requires: nmap sudo perl-HTML-Tree perl-XML-Simple perl-Net-Telnet
|
Requires: nmap sudo perl-HTML-Tree perl-XML-Simple perl-Net-Telnet
|
||||||
Requires: perl-IO-Socket-INET6 perl-Socket6 snmp-mibs perl-JSON
|
Requires: perl-IO-Socket-INET6 perl-Socket6 perl-IO-Socket-SSL snmp-mibs perl-JSON
|
||||||
Requires: perl-Encode-Locale perl-Geo-IP
|
Requires: perl-Encode-Locale perl-Geo-IP
|
||||||
|
|
||||||
%description
|
%description
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.738"
|
PI_VERSION="7.0NG.738"
|
||||||
PI_BUILD="190918"
|
PI_BUILD="190926"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
|||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.738 PS190918";
|
my $version = "7.0NG.738 PS190926";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
|||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.738 PS190918";
|
my $version = "7.0NG.738 PS190926";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user