merge develop

This commit is contained in:
daniel 2018-03-22 13:21:48 +01:00
commit 98355f985a
44 changed files with 415 additions and 105 deletions

View File

@ -65,7 +65,7 @@ $PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \
$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \ $PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \ $PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
$PANDHOME_ENT/pandora_plugins/UX/pandora_ux.pl \ $PANDHOME_ENT/pandora_plugins/UX/pandora_ux.pl \
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl " $PANDHOME_ENT/pandora_server/util/plugin/vmware-plugin.pl "
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm" PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
# Update version in spec files # Update version in spec files

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.720-180321 Version: 7.0NG.720-180322
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.720'; use constant AGENT_VERSION => '7.0NG.720';
use constant AGENT_BUILD => '180321'; use constant AGENT_BUILD => '180322';
# 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;

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.720" PI_VERSION="7.0NG.720"
PI_BUILD="180321" PI_BUILD="180322"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -215,6 +215,7 @@ sub print_log (@) {
$output .= "<source><![CDATA[" . $Module_name . "]]></source>\n"; $output .= "<source><![CDATA[" . $Module_name . "]]></source>\n";
$output .= "<data><![CDATA["; $output .= "<data><![CDATA[";
foreach my $line (@data) { foreach my $line (@data) {
$line =~ s/\]\]/]]]]><![CDATA[/g;
$output .= $line; $output .= $line;
} }
$output .= "]]></data>"; $output .= "]]></data>";
@ -229,6 +230,7 @@ sub print_log (@) {
$output .= "<type><![CDATA[async_string]]></type>\n"; $output .= "<type><![CDATA[async_string]]></type>\n";
$output .= "<datalist>\n"; $output .= "<datalist>\n";
foreach my $line (@data) { foreach my $line (@data) {
$line =~ s/\]\]/]]]]><![CDATA[/g;
$output .= "<data><value><![CDATA[$line]]></value></data>\n"; $output .= "<data><value><![CDATA[$line]]></value></data>\n";
} }
$output .= "</datalist>\n"; $output .= "</datalist>\n";

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{180321} {180322}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -532,6 +532,7 @@ Pandora_Module::getXml () {
try { try {
data_clean = strreplace (this->getDataOutput (data), data_clean = strreplace (this->getDataOutput (data),
"%", "%%" ); "%", "%%" );
data_clean = strreplace (data_clean, "]]>", "]]><![CDATA[");
} catch (Module_Exception e) { } catch (Module_Exception e) {
continue; continue;
} }
@ -542,6 +543,7 @@ Pandora_Module::getXml () {
data = data_list->front (); data = data_list->front ();
try { try {
data_clean = strreplace (this->getDataOutput (data), "%", "%%" ); data_clean = strreplace (this->getDataOutput (data), "%", "%%" );
data_clean = strreplace (data_clean, "]]>", "]]><![CDATA[");
module_xml += data_clean; module_xml += data_clean;
} catch (Module_Exception e) { } catch (Module_Exception e) {

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.720-180321 Version: 7.0NG.720-180322
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -122,7 +122,7 @@ function pandora_realtime_graphs () {
echo '</form>'; echo '</form>';
// Define a custom action to save the OID selected in the SNMP browser to the form // Define a custom action to save the OID selected in the SNMP browser to the form
html_print_input_hidden ('custom_action', urlencode (base64_encode('&nbsp;<a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/hand_point.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false); html_print_input_hidden ('custom_action', urlencode (base64_encode('&nbsp;<a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
html_print_input_hidden ('incremental_base', '0'); html_print_input_hidden ('incremental_base', '0');
echo '<script type="text/javascript" src="extensions/realtime_graphs/realtime_graphs.js"></script>'; echo '<script type="text/javascript" src="extensions/realtime_graphs/realtime_graphs.js"></script>';

View File

@ -0,0 +1,17 @@
START TRANSACTION;
UPDATE `tagente` SET `id_os` = 100 WHERE `id_os` = 21 and (select `id_os` from `tconfig_os` WHERE `id_os` = 21 and `name` = 'Cluster');
DELETE FROM `tconfig_os` where `id_os` = 21 and `name` = 'Cluster';
SET @st_oum721 = (SELECT IF(
(SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled') > 0,
"ALTER TABLE tuser_task_scheduled ADD (id_grupo int(10) unsigned NOT NULL Default 0)",
"0"
));
PREPARE pr_oum721 FROM @st_oum721;
EXECUTE pr_oum721;
DEALLOCATE PREPARE pr_oum721;
COMMIT;

View File

@ -1368,6 +1368,7 @@ END IF;
SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled'); SET @vv2 = (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = 'tuser_task_scheduled');
IF @vv2>0 THEN IF @vv2>0 THEN
ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL; ALTER TABLE tuser_task_scheduled MODIFY args TEXT NOT NULL;
ALTER TABLE tuser_task_scheduled ADD (id_grupo int(10) unsigned NOT NULL Default 0);
END IF; END IF;
END; END;
// //

View File

@ -555,7 +555,7 @@ if ($id_agente) {
$help_header = 'plugins_tab'; $help_header = 'plugins_tab';
break; break;
case "module": case "module":
$type_module_t = (int) get_parameter ('moduletype', ''); $type_module_t = get_parameter ('moduletype', '');
$tab_description = '- '. __('Modules'); $tab_description = '- '. __('Modules');
if($type_module_t == 'webux'){ if($type_module_t == 'webux'){
$help_header = 'wux_console'; $help_header = 'wux_console';

View File

@ -27,7 +27,7 @@ html_print_input_hidden ('ajax_url', ui_get_full_url("ajax.php"), false);
html_print_input_hidden ('search_matches_translation', __("Search matches"), false); html_print_input_hidden ('search_matches_translation', __("Search matches"), false);
// Define a custom action to save the OID selected in the SNMP browser to the form // Define a custom action to save the OID selected in the SNMP browser to the form
html_print_input_hidden ('custom_action', urlencode (base64_encode('&nbsp;<a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/hand_point.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false); html_print_input_hidden ('custom_action', urlencode (base64_encode('&nbsp;<a href="javascript:setOID()"><img src="' . ui_get_full_url("images") . '/input_filter.disabled.png" title="' . __("Use this OID") . '" style="vertical-align: middle;"></img></a>')), false);
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');

View File

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

View File

@ -10143,4 +10143,147 @@ function api_set_metaconsole_synch($keys) {
} }
function api_set_apply_module_template($id_template, $id_agent, $thrash3, $thrash4) {
if (isset ($id_template)) {
// Take agent data
$row = db_get_row ("tagente", "id_agente", $id_agent);
if ($row !== false) {
$intervalo = $row["intervalo"];
$nombre_agente = $row["nombre"];
$direccion_agente =$row["direccion"];
$ultima_act = $row["ultimo_contacto"];
$ultima_act_remota =$row["ultimo_contacto_remoto"];
$comentarios = $row["comentarios"];
$id_grupo = $row["id_grupo"];
$id_os= $row["id_os"];
$os_version = $row["os_version"];
$agent_version = $row["agent_version"];
$disabled= $row["disabled"];
}
else {
return;
}
$id_np = $id_template;
$name_template = db_get_value ('name', 'tnetwork_profile', 'id_np', $id_np);
$npc = db_get_all_rows_field_filter ("tnetwork_profile_component", "id_np", $id_np);
if ($npc === false) {
$npc = array ();
}
$success_count = $error_count = 0;
$modules_already_added = array();
foreach ($npc as $row) {
$nc = db_get_all_rows_field_filter ("tnetwork_component", "id_nc", $row["id_nc"]);
if ($nc === false) {
$nc = array ();
}
foreach ($nc as $row2) {
// Insert each module from tnetwork_component into agent
$values = array(
'id_agente' => $id_agent,
'id_tipo_modulo' => $row2["type"],
'descripcion' => __('Created by template ').$name_template. ' . '.$row2["description"],
'max' => $row2["max"],
'min' => $row2["min"],
'module_interval' => $row2["module_interval"],
'tcp_port' => $row2["tcp_port"],
'tcp_send' => $row2["tcp_send"],
'tcp_rcv' => $row2["tcp_rcv"],
'snmp_community' => $row2["snmp_community"],
'snmp_oid' => $row2["snmp_oid"],
'ip_target' => $direccion_agente,
'id_module_group' => $row2["id_module_group"],
'id_modulo' => $row2["id_modulo"],
'plugin_user' => $row2["plugin_user"],
'plugin_pass' => $row2["plugin_pass"],
'plugin_parameter' => $row2["plugin_parameter"],
'unit' => $row2["unit"],
'max_timeout' => $row2["max_timeout"],
'max_retries' => $row2["max_retries"],
'id_plugin' => $row2['id_plugin'],
'post_process' => $row2['post_process'],
'dynamic_interval' => $row2['dynamic_interval'],
'dynamic_max' => $row2['dynamic_max'],
'dynamic_min' => $row2['dynamic_min'],
'dynamic_two_tailed' => $row2['dynamic_two_tailed'],
'min_warning' => $row2['min_warning'],
'max_warning' => $row2['max_warning'],
'str_warning' => $row2['str_warning'],
'min_critical' => $row2['min_critical'],
'max_critical' => $row2['max_critical'],
'str_critical' => $row2['str_critical'],
'critical_inverse' => $row2['critical_inverse'],
'warning_inverse' => $row2['warning_inverse'],
'critical_instructions' => $row2['critical_instructions'],
'warning_instructions' => $row2['warning_instructions'],
'unknown_instructions' => $row2['unknown_instructions'],
'id_category' => $row2['id_category'],
'macros' => $row2['macros'],
'each_ff' => $row2['each_ff'],
'min_ff_event' => $row2['min_ff_event'],
'min_ff_event_normal' => $row2['min_ff_event_normal'],
'min_ff_event_warning' => $row2['min_ff_event_warning'],
'min_ff_event_critical' => $row2['min_ff_event_critical']
);
$name = $row2["name"];
// Put tags in array if the component has to add them later
if(!empty($row2["tags"])) {
$tags = explode(',', $row2["tags"]);
}
else {
$tags = array();
}
// Check if this module exists in the agent
$module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agent));
if ($module_name_check !== false) {
$modules_already_added[] = $row2["name"];
$error_count++;
}
else {
$id_agente_modulo = modules_create_agent_module($id_agent, $name, $values);
if ($id_agente_modulo === false) {
$error_count++;
}
else {
if(!empty($tags)) {
// Creating tags
$tag_ids = array();
foreach ($tags as $tag_name) {
$tag_id = tags_get_id($tag_name);
//If tag exists in the system we store to create it
$tag_ids[] = $tag_id;
}
tags_insert_module_tag ($id_agente_modulo, $tag_ids);
}
$success_count++;
}
}
}
}
if ($error_count > 0) {
if (empty($modules_already_added))
ui_print_error_message(__('Error adding modules') . sprintf(' (%s)', $error_count));
else
ui_print_error_message(__('Error adding modules. The following errors already exists: ') . implode(', ', $modules_already_added));
}
if ($success_count > 0)
ui_print_success_message(__('Modules successfully added'));
}
}
?> ?>

View File

@ -1087,21 +1087,14 @@ function modules_get_agentmodule_descripcion ($id_agente_modulo) {
* *
* @return string Module type of the given agent module. * @return string Module type of the given agent module.
*/ */
function modules_get_agentmodule_type ($id_agentmodule, $metaconsole = false, $id_server = null) { function modules_get_agentmodule_type ($id_agentmodule) {
$return = db_get_value (
if ($metaconsole) { 'id_tipo_modulo',
$server = db_get_row('tmetaconsole_setup', 'id', $id_server); 'tagente_modulo',
'id_agente_modulo',
$return = db_get_value ('id_tipo_modulo', (int) $id_agentmodule
'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule); );
metaconsole_restore_db();
}
else {
$return = db_get_value ('id_tipo_modulo',
'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
}
return (int) $return; return (int) $return;
} }
@ -2318,10 +2311,10 @@ function modules_change_relation_lock ($id_relation) {
*/ */
function modules_get_first_date($id_agent_module, $datelimit = 0) { function modules_get_first_date($id_agent_module, $datelimit = 0) {
global $config; global $config;
//check datatype string or normal //check datatype string or normal
$table = "tagente_datos"; $table = "tagente_datos";
$module_type_str = modules_get_type_name ($id_agent_module); $module_type_str = modules_get_agentmodule_type($id_agent_module);
if (strstr ($module_type_str, 'string') !== false) { if (strstr ($module_type_str, 'string') !== false) {
$table = "tagente_datos_string"; $table = "tagente_datos_string";
} }

View File

@ -383,7 +383,7 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = '
else { else {
$snmptranslate_bin = $config['snmptranslate']; $snmptranslate_bin = $config['snmptranslate'];
} }
exec ($snmptranslate_bin . " -Td " . escapeshellarg($oid), exec ($snmptranslate_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . " -Td " . escapeshellarg($oid),
$translate_output); $translate_output);
foreach ($translate_output as $line) { foreach ($translate_output as $line) {
if (preg_match ('/SYNTAX\s+(.*)/', $line, $matches) == 1) { if (preg_match ('/SYNTAX\s+(.*)/', $line, $matches) == 1) {
@ -399,13 +399,18 @@ function snmp_browser_get_oid ($target_ip, $community, $target_oid, $version = '
$oid_data['display_hint'] = $matches[1]; $oid_data['display_hint'] = $matches[1];
} }
} }
// Parse the description // Parse the description. First search for it in custom values
$translate_output = implode ('', $translate_output); $custom_data = db_get_row('ttrap_custom_values', 'oid', $oid);
if (preg_match ('/DESCRIPTION\s+\"(.*)\"/', $translate_output, $matches) == 1) { if ($custom_data === false) {
$oid_data['description'] = $matches[1]; $translate_output = implode ('', $translate_output);
if (preg_match ('/DESCRIPTION\s+\"(.*)\"/', $translate_output, $matches) == 1) {
$oid_data['description'] = $matches[1];
}
} else {
$oid_data['description'] = $custom_data['description'];
} }
$full_value = explode (':', trim ($full_oid[1])); $full_value = explode (':', trim ($full_oid[1]));
if (! isset ($full_value[1])) { if (! isset ($full_value[1])) {
$oid_data['value'] = trim ($full_oid[1]); $oid_data['value'] = trim ($full_oid[1]);
@ -482,26 +487,26 @@ function snmp_browser_print_oid ($oid = array(), $custom_action = '',
$table->data[$i][1] = $oid['status']; $table->data[$i][1] = $oid['status'];
$i++; $i++;
} }
$closer = '<a href="javascript:" onClick="hideOIDData();">'; $closer = '<a href="javascript:" onClick="hideOIDData();">';
$closer .= html_print_image ("images/blade.png", true, array ("title" => __('Close'), "style" => 'vertical-align: middle;'), false); $closer .= html_print_image ("images/blade.png", true, array ("title" => __('Close'), "style" => 'vertical-align: middle;'), false);
$closer .= '</a>'; $closer .= '</a>';
$table->head[0] = $closer;
$table->head[1] = __('OID Information');
// Add a span for custom actions // Add a span for custom actions
if ($custom_action != '') { if ($custom_action != '') {
$output .= '<span id="snmp_custom_action">' . $closer . $custom_action . '</span>'; $table->head[0] = '<span id="snmp_custom_action">' . $closer . $custom_action . '</span>';
} else {
$table->head[0] = $closer;
} }
$table->head[1] = __('OID Information');
$output .= html_print_table($table, true); $output .= html_print_table($table, true);
$url = "index.php?" . $url = "index.php?" .
"sec=gmodules&" . "sec=gmodules&" .
"sec2=godmode/modules/manage_network_components"; "sec2=godmode/modules/manage_network_components";
$output .= '<form style="text-align: center;" method="post" action="' . $url . '">'; $output .= '<form style="text-align: center; margin: 10px" method="post" action="' . $url . '">';
$output .= html_print_input_hidden('create_network_from_snmp_browser', 1, true); $output .= html_print_input_hidden('create_network_from_snmp_browser', 1, true);
$output .= html_print_input_hidden('id_component_type', 2, true); $output .= html_print_input_hidden('id_component_type', 2, true);
$output .= html_print_input_hidden('type', 17, true); $output .= html_print_input_hidden('type', 17, true);
@ -519,7 +524,7 @@ function snmp_browser_print_oid ($oid = array(), $custom_action = '',
$output .= html_print_input_hidden('snmp_community', $community, true); $output .= html_print_input_hidden('snmp_community', $community, true);
$output .= html_print_input_hidden('snmp_version', $snmp_version, true); $output .= html_print_input_hidden('snmp_version', $snmp_version, true);
$output .= html_print_submit_button(__('Create network component'), $output .= html_print_submit_button(__('Create network component'),
'', false, '', true); '', false, 'class="sub add"', true);
$output .= '</form>'; $output .= '</form>';
if ($return) { if ($return) {
@ -672,7 +677,7 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
$output .= '<div id="search_results" style="display: none; padding: 5px; background-color: #EAEAEA; border: 1px solid #E2E2E2; border-radius: 4px;"></div>'; $output .= '<div id="search_results" style="display: none; padding: 5px; background-color: #EAEAEA; border: 1px solid #E2E2E2; border-radius: 4px;"></div>';
$output .= '<div id="spinner" style="position: absolute; top:0; left:0px; display:none; padding: 5px;">' . html_print_image ("images/spinner.gif", true) . '</div>'; $output .= '<div id="spinner" style="position: absolute; top:0; left:0px; display:none; padding: 5px;">' . html_print_image ("images/spinner.gif", true) . '</div>';
$output .= '<div id="snmp_browser" style="height: 100%; overflow: auto; background-color: #F4F5F4; border: 1px solid #E2E2E2; border-radius: 4px; padding: 5px;"></div>'; $output .= '<div id="snmp_browser" style="height: 100%; overflow: auto; background-color: #F4F5F4; border: 1px solid #E2E2E2; border-radius: 4px; padding: 5px;"></div>';
$output .= '<div id="snmp_data" style="margin: 5px;"></div>'; $output .= '<div class="databox" id="snmp_data" style="margin: 5px;"></div>';
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';
$output .= '</div>'; $output .= '</div>';

View File

@ -961,9 +961,15 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
if (!defined('METACONSOLE')) { if (!defined('METACONSOLE')) {
if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) { if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) {
$data[$index['validate']] = ''; $data[$index['validate']] = '';
$data[$index['validate']] .= html_print_checkbox (
$data[$index['validate']] .= html_print_checkbox ("validate[]", $alert["id"], false, true); "validate[]",
$alert["id"],
false,
true,
false,
'',
true);
} }
} }

View File

@ -735,7 +735,17 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'icon', 'label', 'datos'); 'icon', 'label', 'datos');
$form_items_advance['element_group_row']['html'] = '<td align="left">'. $form_items_advance['element_group_row']['html'] = '<td align="left">'.
__('Restrict access to group') . '</td>' . __('Restrict access to group') . '</td>' .
'<td align="left">' . html_print_select($user_groups, 'element_group', '', '', '', 0, true) . '<td align="left">' .
html_print_select_groups(
$config['id_user'],
"VR",
true,
'element_group',
__('All'),
'',
'',
0,
true) .
ui_print_help_tip ( ui_print_help_tip (
__("If selected, restrict visualization of this item in the visual console to users who have access to selected group. This is also used on calculating child visual consoles."), true) . __("If selected, restrict visualization of this item in the visual console to users who have access to selected group. This is also used on calculating child visual consoles."), true) .
'</td>'; '</td>';

View File

@ -522,7 +522,7 @@ function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
if ($legend_position != 'hidden') { if ($legend_position != 'hidden') {
// This is a hardcore adjustment to match most of the graphs, please don't alter // This is a hardcore adjustment to match most of the graphs, please don't alter
$legend_with_aprox = 32 + (4.5 * $max_chars); $legend_with_aprox = 32 + (9.5 * $max_chars);
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10)); $PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
} }

View File

@ -2334,7 +2334,7 @@ var digitPattern = [
digit.select("path:nth-child(5)").classed("lit", function(d) { return digitPattern[4][d]; }); digit.select("path:nth-child(5)").classed("lit", function(d) { return digitPattern[4][d]; });
digit.select("path:nth-child(6)").classed("lit", function(d) { return digitPattern[5][d]; }); digit.select("path:nth-child(6)").classed("lit", function(d) { return digitPattern[5][d]; });
digit.select("path:nth-child(7)").classed("lit", function(d) { return digitPattern[6][d]; }); digit.select("path:nth-child(7)").classed("lit", function(d) { return digitPattern[6][d]; });
separator.classed("lit", seconds & 1); separator.classed("lit", seconds);
setTimeout(tick, 1000 - now % 1000); setTimeout(tick, 1000 - now % 1000);
})(); })();

View File

@ -203,8 +203,9 @@ function hideOIDData() {
// Empty previous OID data // Empty previous OID data
$("#snmp_data").empty(); $("#snmp_data").empty();
$("#snmp_data").css('display', 'none'); $("#snmp_data").css('display', 'none');
$(".forced_title_layer").css('display', 'none');
} }
// Search the SNMP tree for a matching string // Search the SNMP tree for a matching string

View File

@ -4619,4 +4619,11 @@ form ul.form_flex li ul li{
.events_bar { .events_bar {
margin:0 auto; margin:0 auto;
} }
#snmp_data {
background: #f9faf9;
}
#snmp_data .databox {
border: 0px;
}

View File

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

View File

@ -78,19 +78,22 @@ else {
$data[1] = html_print_image('images/delete.png', true); $data[1] = html_print_image('images/delete.png', true);
} }
$custom_value = db_get_value_filter('description', $custom_value = db_get_all_rows_sql("select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields
'tagent_custom_data', array( INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = ".$field['id_field']." and tagent_custom_data.id_agent = ".$id_agente);
'id_field' => $field['id_field'],
'id_agent' => $id_agente)); if ($custom_value[0]['description'] === false || $custom_value[0]['description'] == '') {
$custom_value[0]['description'] = '<i>-'.__('empty').'-</i>';
if ($custom_value === false || $custom_value == '') {
$custom_value = '<i>-'.__('empty').'-</i>';
} }
else { else {
$custom_value = ui_bbcode_to_html($custom_value); $custom_value[0]['description'] = ui_bbcode_to_html($custom_value[0]['description']);
} }
$data[2] = $custom_value; if($custom_value[0]['is_password_type']){
$data[2] = '&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;';
}
else{
$data[2] = $custom_value[0]['description'];
}
array_push ($table->data, $data); array_push ($table->data, $data);
} }

View File

@ -44,12 +44,16 @@ if (is_ajax ()) {
$get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip"); $get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip");
$get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip"); $get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip");
$get_agent_id = (bool) get_parameter ("get_agent_id"); $get_agent_id = (bool) get_parameter ("get_agent_id");
$cluster_mode = (bool) get_parameter ("cluster_mode",0);
$agent_alias = get_parameter('alias', '');
$agents_inserted = get_parameter('agents_inserted', array());
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
if ($get_agents_group_json) { if ($get_agents_group_json) {
$id_group = (int) get_parameter('id_group'); $id_group = (int) get_parameter('id_group');
$recursion = get_parameter ('recursion'); $recursion = get_parameter ('recursion');
$id_os = get_parameter('id_os', ''); $id_os = get_parameter('id_os', '');
$agent_name = get_parameter('name', ''); $agent_name = get_parameter('name', '');
$privilege = (string) get_parameter ('privilege', "AR"); $privilege = (string) get_parameter ('privilege', "AR");
// Is is possible add keys prefix to avoid auto sorting in js object conversion // Is is possible add keys prefix to avoid auto sorting in js object conversion
$keys_prefix = (string) get_parameter ('keys_prefix', ''); $keys_prefix = (string) get_parameter ('keys_prefix', '');
@ -75,6 +79,8 @@ if (is_ajax ()) {
$filter['id_os'] = $id_os; $filter['id_os'] = $id_os;
if (!empty($agent_name)) if (!empty($agent_name))
$filter['nombre'] = '%' . $agent_name . '%'; $filter['nombre'] = '%' . $agent_name . '%';
if (!empty($agent_alias))
$filter['alias'] = '%' . $agent_alias . '%';
switch ($status_agents) { switch ($status_agents) {
case AGENT_STATUS_NORMAL: case AGENT_STATUS_NORMAL:
@ -98,6 +104,43 @@ if (is_ajax ()) {
} }
$filter['order'] = "alias ASC"; $filter['order'] = "alias ASC";
if($cluster_mode){
$agent_id_os = db_get_all_rows_sql('select id_os from tconfig_os where id_os != 100');
foreach ($agent_id_os as $key => $value) {
$agent_id_os_array[] = $agent_id_os[$key]['id_os'];
}
$filter['id_os'] = $agent_id_os_array;
if($agents_inserted[0] != ''){
$agents_id_list = '';
foreach($agents_inserted as $elem) {
if ($elem === end($agents_inserted)) {
$agents_id_list .= $elem;
}
else{
$agents_id_list .= $elem.',';
}
}
$agent_id_agente = db_get_all_rows_sql('select id_agente from tagente where id_agente not in ('.$agents_id_list.')');
foreach ($agent_id_agente as $key => $value) {
$agent_id_agente_array[] = $agent_id_agente[$key]['id_agente'];
}
$filter['id_agente'] = $agent_id_agente_array;
}
}
// Build fields // Build fields
$fields = array('id_agente', 'alias'); $fields = array('id_agente', 'alias');

View File

@ -275,7 +275,7 @@ if ($id_agent != 0) {
} }
$text_module = (string) get_parameter('module_search', ''); $text_module = (string) get_parameter('module_search', '');
$id_agent_module = get_parameter('module_search_hidden', 0); $id_agent_module = get_parameter('module_search_hidden', get_parameter('id_agent_module',0));
if ($id_agent_module != 0) { if ($id_agent_module != 0) {
$text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module); $text_module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($text_module == false) { if ($text_module == false) {

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.720-180321 Version: 7.0NG.720-180322
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

@ -31,7 +31,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.720"; my $pandora_version = "7.0NG.720";
my $pandora_build = "180321"; my $pandora_build = "180322";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

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

View File

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

View File

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

View File

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

View File

@ -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.720 PS180321"; my $version = "7.0NG.720 PS180322";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -195,7 +195,6 @@ sub help_screen{
<critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add snmp network module to policy'); <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add snmp network module to policy');
help_screen_line('--create_policy_plugin_module', "<policy_name> <module_name> <module_type> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> <module_group> <min> \n\t <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max>\n\t <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add plug-in module to policy'); help_screen_line('--create_policy_plugin_module', "<policy_name> <module_name> <module_type> \n\t <module_port> <plugin_name> <user> <password> <parameters> [<description> <module_group> <min> \n\t <max> <post_process> <interval> <warning_min> <warning_max> <critical_min> <critical_max>\n\t <history_data> <ff_threshold> <warning_str> <critical_str>\n\t <unknown_events> <each_ff> <ff_threshold_normal>\n\t <ff_threshold_warning> <ff_threshold_critical>\n\t <critical_instructions> <warning_instructions> <unknown_instructions>\n\t <warning_inverse> <critical_inverse>]", 'Add plug-in module to policy');
help_screen_line('--create_policy_data_module_from_local_component', '<policy_name> <component_name>'); help_screen_line('--create_policy_data_module_from_local_component', '<policy_name> <component_name>');
help_screen_line('--create_policy_web_module_from_local_component', '<policy_name> <component_name>');
help_screen_line('--add_collection_to_policy', "<policy_name> <collection_name>"); help_screen_line('--add_collection_to_policy', "<policy_name> <collection_name>");
help_screen_line('--validate_policy_alerts', '<policy_name>', 'Validate the alerts of a given policy'); help_screen_line('--validate_policy_alerts', '<policy_name>', 'Validate the alerts of a given policy');
help_screen_line('--get_policy_modules', '<policy_name>', 'Get the modules of a policy'); help_screen_line('--get_policy_modules', '<policy_name>', 'Get the modules of a policy');
@ -5834,10 +5833,6 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 2, 2); param_check($ltotal, 2, 2);
cli_create_policy_data_module_from_local_component(); cli_create_policy_data_module_from_local_component();
} }
elsif ($param eq '--create_policy_web_module_from_local_component') {
param_check($ltotal, 2, 2);
cli_create_policy_web_module_from_local_component();
}
elsif ($param eq '--create_policy') { elsif ($param eq '--create_policy') {
param_check($ltotal, 3, 2); param_check($ltotal, 3, 2);
cli_create_policy(); cli_create_policy();
@ -6072,6 +6067,7 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 3, 2); param_check($ltotal, 3, 2);
cli_export_visual_console(); cli_export_visual_console();
} }
<<<<<<< HEAD
elsif ($param eq '--migration_agent_queue') { elsif ($param eq '--migration_agent_queue') {
param_check($ltotal, 4, 1); param_check($ltotal, 4, 1);
cli_migration_agent_queue(); cli_migration_agent_queue();
@ -6080,6 +6076,12 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 1, 0); param_check($ltotal, 1, 0);
cli_migration_agent(); cli_migration_agent();
} }
=======
elsif ($param eq '--apply_module_template') {
param_check($ltotal, 2, 2);
cli_apply_module_template();
}
>>>>>>> origin/develop
else { else {
print_log "[ERROR] Invalid option '$param'.\n\n"; print_log "[ERROR] Invalid option '$param'.\n\n";
$param = ''; $param = '';
@ -6289,25 +6291,6 @@ sub cli_create_policy_data_module_from_local_component() {
enterprise_hook('pandora_create_policy_data_module_from_local_component',[$conf, $component, $policy_id, $dbh]); enterprise_hook('pandora_create_policy_data_module_from_local_component',[$conf, $component, $policy_id, $dbh]);
} }
##############################################################################
# Create policy web module from local component.
# Related option: --create_policy_web_module_from_local_component
##############################################################################
sub cli_create_policy_web_module_from_local_component() {
my ($policy_name, $component_name) = @ARGV[2..3];
my $policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
exist_check($policy_id,'policy',$policy_name);
my $lc_id = pandora_get_local_component_id($dbh, $component_name);
exist_check($lc_id,'local component',$component_name);
# Get local component web
my $component = get_db_single_row ($dbh, 'SELECT * FROM tlocal_component WHERE id = ?', $lc_id);
enterprise_hook('pandora_create_policy_web_module_from_local_component',[$conf, $component, $policy_id, $dbh]);
}
############################################################################## ##############################################################################
# Create local component. # Create local component.
# Related option: --create_local_component # Related option: --create_local_component
@ -6451,6 +6434,7 @@ sub cli_add_tag_to_module() {
print "\n$result\n"; print "\n$result\n";
} }
<<<<<<< HEAD
############################################################################## ##############################################################################
# Only meta migrate agent # Only meta migrate agent
############################################################################## ##############################################################################
@ -6490,3 +6474,96 @@ sub cli_migration_agent() {
print "\n0\n"; print "\n0\n";
} }
} }
=======
sub cli_apply_module_template() {
my ($id_template, $id_agent) = @ARGV[2..3];
my @row = get_db_rows ($dbh,"select * from tagente where id_agente = ".$id_agent);
return if (scalar (@row) == 0);
my $name_template = get_db_value ($dbh,'select name from tnetwork_profile where id_np = '.$id_template);
my @npc = get_db_rows($dbh,"select * from tnetwork_profile_component where id_np = ".$id_template);
foreach my $component (@npc) {
my @template_values = get_db_rows ($dbh,"SELECT * FROM tnetwork_component where id_nc = ".$component->{'id_nc'});
return if (scalar (@template_values) == 0);
foreach my $element (@template_values) {
my $agent_values;
$agent_values->{'id_agente'} = $id_agent;
$agent_values->{'id_tipo_modulo'} = $element->{"type"};
$agent_values->{'descripcion'} = 'Created by template '.$name_template.' '.$element->{"description"};
$agent_values->{'max'} = $element->{"max"};
$agent_values->{'min'} = $element->{"min"};
$agent_values->{'module_interval'} = $element->{"module_interval"};
$agent_values->{'tcp_port'} = $element->{"tcp_port"};
$agent_values->{'tcp_send'} = $element->{"tcp_send"};
$agent_values->{'tcp_rcv'} = $element->{"tcp_rcv"};
$agent_values->{'snmp_community'} = $element->{"snmp_community"};
$agent_values->{'snmp_oid'} = $element->{"snmp_oid"};
$agent_values->{'ip_target'} = $row[0]->{"direccion"};
$agent_values->{'id_module_group'} = $element->{"id_module_group"};
$agent_values->{'id_modulo'} = $element->{"id_modulo"};
$agent_values->{'plugin_user'} = $element->{"plugin_user"};
$agent_values->{'plugin_pass'} = $element->{"plugin_pass"};
$agent_values->{'plugin_parameter'} = $element->{"plugin_parameter"};
$agent_values->{'unit'} = $element->{"unit"};
$agent_values->{'max_timeout'} = $element->{"max_timeout"};
$agent_values->{'max_retries'} = $element->{"max_retries"};
$agent_values->{'id_plugin'} = $element->{"id_plugin"};
$agent_values->{'post_process'} = $element->{"post_process"};
$agent_values->{'dynamic_interval'} = $element->{"dynamic_interval"};
$agent_values->{'dynamic_max'} = $element->{"dynamic_max"};
$agent_values->{'dynamic_min'} = $element->{"dynamic_min"};
$agent_values->{'dynamic_two_tailed'} = $element->{"dynamic_two_tailed"};
$agent_values->{'min_warning'} = $element->{"min_warning"};
$agent_values->{'max_warning'} = $element->{"max_warning"};
$agent_values->{'str_warning'} = $element->{"str_warning"};
$agent_values->{'min_critical'} = $element->{"min_critical"};
$agent_values->{'max_critical'} = $element->{"max_critical"};
$agent_values->{'str_critical'} = $element->{"str_critical"};
$agent_values->{'critical_inverse'} = $element->{"critical_inverse"};
$agent_values->{'warning_inverse'} = $element->{"warning_inverse"};
$agent_values->{'critical_instructions'} = $element->{"critical_instructions"};
$agent_values->{'warning_instructions'} = $element->{"warning_instructions"};
$agent_values->{'unknown_instructions'} = $element->{"unknown_instructions"};
$agent_values->{'id_category'} = $element->{"id_category"};
$agent_values->{'macros'} = $element->{"macros"};
$agent_values->{'each_ff'} = $element->{"each_ff"};
$agent_values->{'min_ff_event'} = $element->{"min_ff_event"};
$agent_values->{'min_ff_event_normal'} = $element->{"min_ff_event_normal"};
$agent_values->{'min_ff_event_warning'} = $element->{"min_ff_event_warning"};
$agent_values->{'min_ff_event_critical'} = $element->{"min_ff_event_critical"};
$agent_values->{'nombre'} = $element->{"name"};
my @tags;
if($element->{"tags"} ne '') {
@tags = split(',', $element->{"tags"});
}
my $module_name_check = get_db_value ($dbh,'select id_agente_modulo from tagente_modulo where delete_pending = 0 and nombre ="'.$agent_values->{'nombre'}.'" and id_agente = '.$id_agent);
if (!defined($module_name_check)) {
my $id_agente_modulo = pandora_create_module_from_hash(\%conf,$agent_values,$dbh);
if ($id_agente_modulo != -1) {
foreach my $tag_name (@tags) {
my $tag_id = get_db_value($dbh,'select id_tag from ttag where name = "'.$tag_name.'"');
db_do($dbh,'insert into ttag_module (id_tag,id_agente_modulo) values ("'.$tag_id.'","'.$id_agente_modulo.'")');
}
}
}
}
}
}
>>>>>>> origin/develop