Merge branch 'develop' into 1056-pandora-wux-grid-server

This commit is contained in:
daniel 2017-09-04 14:09:08 +02:00
commit a04e02570f
29 changed files with 137 additions and 38 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.711-170901
Version: 7.0NG.711-170904
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.711';
use constant AGENT_BUILD => '170901';
use constant AGENT_BUILD => '170904';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.711
%define release 170901
%define release 170904
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.711
%define release 170901
%define release 170904
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.711"
PI_BUILD="170901"
PI_BUILD="170904"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{170901}
{170904}
ViewReadme
{Yes}

View File

@ -1139,11 +1139,14 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module = new Pandora_Module_Freedisk_Percent (module_name,
module_freedisk_percent);
// Added a description with the memory free
char buffer[100];
unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent);
if (sprintf(buffer, "Free memory %s %dMB",
try {
char buffer[100];
unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent);
if (sprintf(buffer, "Free memory %s %dMB",
module_freedisk_percent.c_str(), memory) > 0) {
module->setDescription(buffer);
module->setDescription(buffer);
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
}
} else if (module_freememory != "") {
module = new Pandora_Module_Freememory (module_name);

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.711(Build 170901)")
#define PANDORA_VERSION ("7.0NG.711(Build 170904)")
string pandora_path;
string pandora_dir;

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.711-170901
Version: 7.0NG.711-170904
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -716,7 +716,7 @@ $servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
$rows = get_proxy_servers(true);
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}

View File

@ -254,6 +254,30 @@ if ($create_modules) {
$values['unit'] = "Bytes";
}
if ($server_to_exec != 0) {
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
$row = db_get_row_sql ($sql);
if ($row['server_type'] = 13) {
if (preg_match ("/Status/", $name_array[1])) {
$module_type = 2;
}
elseif (preg_match ("/Present/", $name_array[1])) {
$module_type = 2;
}
elseif (preg_match("/PromiscuousMode/", $name_array[1])) {
$module_type = 2;
}
// Specific counters (ends in s)
elseif (preg_match("/s$/", $name_array[1])) {
$module_type = 4;
}
else {
$module_type = 4;
}
}
}
$values['id_tipo_modulo'] = $module_type;
if (!empty($ifPhysAddress) && isset($interfaces_ip[$id])) {
@ -281,6 +305,26 @@ if ($create_modules) {
$errors[$result]++;
}
else {
if ($server_to_exec != 0) {
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
$row = db_get_row_sql ($sql);
if ($row['server_type'] = 13) {
$module_type_name = db_get_value_filter("nombre", "ttipo_modulo", array("id_tipo" => $values['id_tipo_modulo']));
$new_module_configuration_data = "
module_begin
module_name " . io_safe_input($name) . "
module_description " . $values['descripcion'] . "
module_type " . $module_type_name . "
module_snmp
module_oid " . $values['snmp_oid'] . "
module_community " . $values['snmp_community'] . "
module_end";
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
}
}
$done++;
}
}
@ -445,6 +489,7 @@ if (!empty($interfaces_list)) {
html_print_input_hidden('snmp3_privacy_method', $snmp3_privacy_method);
html_print_input_hidden('snmp3_privacy_pass', $snmp3_privacy_pass);
html_print_input_hidden('snmp3_security_level', $snmp3_security_level);
html_print_input_hidden('server_to_exec', $server_to_exec);
$table->width = '100%';

View File

@ -29,7 +29,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent); // Host
$plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username
$plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password
$tcp_send = (string) get_parameter ('tcp_send'); // Namespace
$server_to_exec = get_parameter('server_to_exec', true);
$server_to_exec = get_parameter('server_to_exec', 0);
//See if id_agente is set (either POST or GET, otherwise -1
$id_agent = $idAgent;
@ -202,16 +202,16 @@ if ($create_modules) {
$services_values['snmp_community'] = 'Running'; // Key string
$services_values['tcp_port'] = 1; // Field number (Running/Stopped)
$services_values['id_tipo_modulo'] = 2; // Generic boolean
$services_result = wmi_create_wizard_modules($id_agent, $services, 'services', $services_values);
$services_result = wmi_create_wizard_modules($id_agent, $services, 'services', $services_values, 0, 0, $server_to_exec);
// Create Process modules
$processes_values = $values;
$processes_values['tcp_port'] = 0; // Field number (OID)
$processes_values['id_tipo_modulo'] = 2; // Generic boolean
$processes_result = wmi_create_wizard_modules($id_agent, $processes, 'processes', $processes_values);
$processes_result = wmi_create_wizard_modules($id_agent, $processes, 'processes', $processes_values, 0, 0, $server_to_exec);
// Create Space on disk modules
$disks_values = $values;
@ -220,14 +220,14 @@ if ($create_modules) {
$disks_values['id_tipo_modulo'] = 1; // Generic numeric
$disks_values['unit'] = 'Bytes'; // Unit
$disks_result = wmi_create_wizard_modules($id_agent, $disks, 'disks', $disks_values);
$disks_result = wmi_create_wizard_modules($id_agent, $disks, 'disks', $disks_values, 0, 0, $server_to_exec);
// Create modules from component
$components_values = $values;
$components_values['id_agente'] = $id_agent;
$components_result = wmi_create_module_from_components($components, $components_values);
$components_result = wmi_create_module_from_components($components, $components_values, 0, 0, $server_to_exec);
// Errors/Success messages
@ -339,6 +339,7 @@ if ($wmiexplore && !$fail) {
html_print_input_hidden('plugin_user', $plugin_user); // User
html_print_input_hidden('plugin_pass', $plugin_pass); // Password
html_print_input_hidden('tcp_send', $tcp_send); // Namespace
html_print_input_hidden('server_to_exec', $server_to_exec);
$table->width = '98%';

View File

@ -58,7 +58,7 @@ if (isset($_GET["server"])) {
if (enterprise_installed()) {
$table->data[] = array (__('Type'), $server_type);
if ($row["server_type"] == 13) {
if ($row["server_type"] == 13 || $row["server_type"] == 1) {
$table->data[] = array (__('Exec Server'), html_print_checkbox ("exec_proxy", 1, $row["exec_proxy"], true));
if ($row["exec_proxy"]) {
$table->data[] = array (__('Check Exec Server'), '<a id="check_exec_server">' . html_print_image ("images/dot_red.disabled.png", true) . '</a>' . '<div id="check_error_message"></div>');

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC170901';
$build_version = 'PC170904';
$pandora_version = 'v7.0NG.711';
// Do not overwrite default timezone set if defined.

View File

@ -50,7 +50,7 @@ function wmi_compose_query($wmi_client, $user, $password, $host, $namespace = ''
}
function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id_police=0, $module_id=0) {
function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id_police=0, $module_id=0, $server_to_exec = 0) {
$results = array(ERR_GENERIC => array(), NOERR => array());
if (empty($names)) {
@ -84,6 +84,32 @@ function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id
$results[ERR_GENERIC][] = $name;
}
else {
if ($id_police == 0) {
if ($server_to_exec != 0) {
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
$row = db_get_row_sql ($sql);
if ($row['server_type'] = 13) {
$new_module_configuration_data = "
module_begin
module_name " . $name . "
module_description
module_type generic_proc
module_snmp
module_oid " . $values['snmp_oid'] . "
module_community " . $values['snmp_community'] . "
ip_target " . $nc['ip_target'] ."
tcp_send " . $nc['tcp_send'] ."
plugin_user " . $nc['plugin_user'] ."
plugin_pass " . $nc['plugin_pass'] ."
tcp_port " . $nc['tcp_port'] . "
module_end";
config_agents_add_module_in_conf($id_agent, $new_module_configuration_data);
}
}
}
$results[NOERR][] = $name;
}
}
@ -91,7 +117,7 @@ function wmi_create_wizard_modules($id_agent, $names, $wizard_mode, $values, $id
return $results;
}
function wmi_create_module_from_components($components, $values, $id_police=0, $module_id=0) {
function wmi_create_module_from_components($components, $values, $id_police=0, $module_id=0, $server_to_exec = 0) {
$results = array(ERR_GENERIC => array(), NOERR => array(), ERR_EXIST => array());
if (empty($components)) {
@ -155,6 +181,30 @@ function wmi_create_module_from_components($components, $values, $id_police=0, $
$results[ERR_GENERIC][] = $nc["nombre"];
}
else {
if ($id_police == 0) {
if ($server_to_exec != 0) {
$sql = sprintf("SELECT server_type FROM tserver WHERE id_server = %d", $server_to_exec);
$row = db_get_row_sql ($sql);
if ($row['server_type'] = 13) {
$new_module_configuration_data = "
module_begin
module_name " . $nc["nombre"] . "
module_description " . $nc['descripcion'] . "
module_type generic_data
ip_target " . $nc['ip_target'] ."
tcp_send " . $nc['tcp_send'] ."
plugin_user " . $nc['plugin_user'] ."
plugin_pass " . $nc['plugin_pass'] ."
unit Bytes
tcp_port 1
module_end";
config_agents_add_module_in_conf($nc["id_agente"], $new_module_configuration_data);
}
}
}
if(!empty($tags)) {
// Creating tags
$tag_ids = array();

View File

@ -71,7 +71,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.711';
$build = '170901';
$build = '170904';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.711
%define release 170901
%define release 170904
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.711
%define release 170901
%define release 170904
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.711-170901
Version: 7.0NG.711-170904
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.711-170901"
pandora_version="7.0NG.711-170904"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.711";
my $pandora_build = "170901";
my $pandora_build = "170904";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.711
%define release 170901
%define release 170904
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.711
%define release 170901
%define release 170904
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.711"
PI_BUILD="170901"
PI_BUILD="170904"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.711 PS170901";
my $version = "7.0NG.711 PS170904";
# Pandora server configuration
my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.711 PS170901";
my $version = "7.0NG.711 PS170904";
# save program name for logging
my $progname = basename($0);