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

This commit is contained in:
daniel 2017-09-01 10:51:54 +02:00
commit d74a3f74b4
59 changed files with 909 additions and 264 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.710-170816 Version: 7.0NG.711-170901
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.710-170816" pandora_version="7.0NG.711-170901"
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

@ -40,8 +40,8 @@ my $Sem = undef;
# Semaphore used to control the number of threads # Semaphore used to control the number of threads
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.710'; use constant AGENT_VERSION => '7.0NG.711';
use constant AGENT_BUILD => '170816'; use constant AGENT_BUILD => '170901';
# 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

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.710 %define version 7.0NG.711
%define release 170816 %define release 170901
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
#Pandora FMS Linux Agent #Pandora FMS Linux Agent
# #
%define name pandorafms_agent_unix %define name pandorafms_agent_unix
%define version 7.0NG.710 %define version 7.0NG.711
%define release 170816 %define release 170901
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -9,8 +9,8 @@
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.710" PI_VERSION="7.0NG.711"
PI_BUILD="170816" PI_BUILD="170901"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -3,7 +3,7 @@ AllowLanguageSelection
{Yes} {Yes}
AppName AppName
{Pandora FMS Windows Agent v7.0NG.710} {Pandora FMS Windows Agent v7.0NG.711}
ApplicationID ApplicationID
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F} {17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{170816} {170901}
ViewReadme ViewReadme
{Yes} {Yes}

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.710(Build 170816)") #define PANDORA_VERSION ("7.0NG.711(Build 170901)")
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.710(Build 170816))" VALUE "ProductVersion", "(7.0NG.711(Build 170901))"
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.710-170816 Version: 7.0NG.711-170901
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.710-170816" pandora_version="7.0NG.711-170901"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1,9 +1,21 @@
START TRANSACTION; START TRANSACTION;
ALTER TABLE tagente MODIFY COLUMN cascade_protection_module int(10) unsigned NOT NULL default '0'; ALTER TABLE tagente MODIFY COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0';
CREATE TABLE IF NOT EXISTS treset_pass_history (
id int(10) unsigned NOT NULL auto_increment,
id_user varchar(60) NOT NULL,
reset_moment datetime NOT NULL,
success tinyint(1) NOT NULL,
PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE tevent_response ADD COLUMN server_to_exec int(10) unsigned NOT NULL DEFAULT 0;
INSERT INTO tmodule VALUES (8, 'Wux module'); INSERT INTO tmodule VALUES (8, 'Wux module');
INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'); INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');
COMMIT; COMMIT;

View File

@ -1215,7 +1215,7 @@ ALTER TABLE tnetwork_component ADD COLUMN `dynamic_two_tailed` tinyint(1) unsign
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD `transactional_agent` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0; ALTER TABLE tagente ADD `remote` tinyint(1) NOT NULL default 0;
ALTER TABLE tagente ADD `cascade_protection_module` int(10) unsigned default '0'; ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT NULL default '0';
ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default ''); ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default '');
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0'; ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0';
@ -1417,6 +1417,16 @@ ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default
ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) BINARY NOT NULL default ''; ALTER TABLE tserver_export_data MODIFY `module_name` varchar(600) BINARY NOT NULL default '';
-- ---------------------------------------------------------------------
-- Table `tserver`
-- ---------------------------------------------------------------------
ALTER TABLE tserver ADD COLUMN exec_proxy tinyint(1) UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tevent_response`
-- ---------------------------------------------------------------------
ALTER TABLE tevent_response ADD COLUMN server_to_exec int(10) unsigned NOT NULL DEFAULT 0;
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
-- Table `tmodule` -- Table `tmodule`
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
@ -1428,3 +1438,4 @@ INSERT INTO tmodule VALUES (8, 'Wux module');
-- --------------------------------------------------------------------- -- ---------------------------------------------------------------------
INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'); INSERT INTO ttipo_modulo VALUES (25,'web_analysis', 8, 'Web analysis data', 'module-wux.png');

View File

@ -193,32 +193,51 @@ config_check();
$select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'"); $select = db_process_sql("SELECT autorefresh_white_list FROM tusuario WHERE id_user = '" . $config['id_user'] . "'");
$autorefresh_list = json_decode($select[0]['autorefresh_white_list']); $autorefresh_list = json_decode($select[0]['autorefresh_white_list']);
if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) { if ($autorefresh_list !== null && array_search($_GET['sec2'], $autorefresh_list) !== false) {
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh'))); $do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ($_GET['refr']) { if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)'; $do_refresh = false;
}
} }
if ($do_refresh) {
$autorefresh_img = html_print_image("images/header_refresh.png", true, array("class" => 'bot', "alt" => 'lightning', 'title' => __('Configure autorefresh')));
$ignored_params['refr'] = ''; if ($_GET['refr']) {
$values = get_refresh_time_array(); $autorefresh_txt .= ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
$autorefresh_additional = '<span id="combo_refr" style="display: none;">'; }
$autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
$autorefresh_additional .= '</span>'; $ignored_params['refr'] = '';
unset ($values); $values = get_refresh_time_array();
$autorefresh_additional = '<span id="combo_refr" style="display: none;">';
$autorefresh_link_open_img = $autorefresh_additional .= html_print_select ($values, 'ref', '', '', __('Select'), '0', true, false, false);
'<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">'; $autorefresh_additional .= '</span>';
unset ($values);
if ($_GET['refr']) {
$autorefresh_link_open_txt = $autorefresh_link_open_img =
'<a class="white autorefresh autorefresh_txt" href="' . ui_get_url_refresh ($ignored_params) . '">'; '<a class="white autorefresh" href="' . ui_get_url_refresh ($ignored_params) . '">';
if ($_GET['refr']) {
$autorefresh_link_open_txt =
'<a class="white autorefresh autorefresh_txt" href="' . ui_get_url_refresh ($ignored_params) . '">';
}
else {
$autorefresh_link_open_txt = '<a>';
}
$autorefresh_link_close = '</a>';
} }
else { else {
$autorefresh_link_open_txt = '<a>'; $autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
}
$autorefresh_link_close = '</a>'; $ignored_params['refr'] = false;
$autorefresh_link_open_img = '';
$autorefresh_link_open_txt = '';
$autorefresh_link_close = '';
}
} }
else { else {
$autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh'))); $autorefresh_img = html_print_image("images/header_refresh_disabled.png", true, array("class" => 'bot autorefresh_disabled', "alt" => 'lightning', 'title' => __('Disabled autorefresh')));
@ -357,17 +376,25 @@ config_check();
$(document).ready (function () { $(document).ready (function () {
<?php <?php
if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) { if (($autorefresh_list !== null) && (array_search($_GET['sec2'], $autorefresh_list) !== false) && (!isset($_GET["refr"]))) {
$do_refresh = true;
if ($_GET['sec2'] == 'operation/agentes/pandora_networkmap') {
if ((!isset($_GET['tab'])) || ($_GET['tab'] != 'view')) {
$do_refresh = false;
}
}
if ($do_refresh) {
?> ?>
$("a.autorefresh_txt").toggle (); $("a.autorefresh_txt").toggle ();
$("#combo_refr").toggle (); $("#combo_refr").toggle ();
$("#combo_refr").css('padding-right', '9px'); $("#combo_refr").css('padding-right', '9px');
href = $("a.autorefresh").attr ("href"); href = $("a.autorefresh").attr ("href");
$(document).attr ("location", href + "30"); $(document).attr ("location", href + "30");
<?php <?php
}
} }
?> ?>
if (fixed_header) { if (fixed_header) {
$('div#head').addClass('fixed_header'); $('div#head').addClass('fixed_header');
$('div#page') $('div#page')

View File

@ -232,7 +232,7 @@ if(!$new_agent){
if ($id_agente) { if ($id_agente) {
$table->data[2][2] = $table->data[2][2] =
"<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" . "<a id='qr_code_agent_view' href='javascript: show_dialog_qrcode(null, \"" .
ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente) . "\" );'></a>"; ui_get_full_url('mobile/index.php?page=agent&id=' . $id_agente) . "\" );'></a>";
} }
else { else {
$table->data[2][2] = __("Only it is show when<br />the agent is saved."); $table->data[2][2] = __("Only it is show when<br />the agent is saved.");
@ -261,6 +261,9 @@ $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent'; $params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent; $params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); $params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$table->data[3][1] = ui_print_agent_autocomplete_input($params); $table->data[3][1] = ui_print_agent_autocomplete_input($params);
$table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true); $table->data[3][1] .= html_print_checkbox ("cascade_protection", 1, $cascade_protection, true).__('Cascade protection'). "&nbsp;" . ui_print_help_icon("cascade_protection", true);
@ -579,40 +582,9 @@ ui_require_jquery_file('bgiframe');
} }
}); });
$("#text-id_parent").on("autocompletechange", function () {
agent_name = $("#text-id_parent").val();
var params = {};
params["get_agent_modules_json_by_name"] = 1;
params["agent_name"] = agent_name;
params["page"] = "include/ajax/module";
jQuery.ajax ({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
success: function (data) {
$('#cascade_protection_module').empty();
$('#cascade_protection_module')
.append ($('<option></option>')
.html("Any")
.prop("value", 0)
.prop("selected", 'selected'));
jQuery.each (data, function (i, val) {
$('#cascade_protection_module')
.append ($('<option></option>')
.html(val['name'])
.prop("value", val['id_module'])
.prop("selected", 'selected'));
});
}
});
});
paint_qrcode( paint_qrcode(
"<?php "<?php
echo ui_get_full_url('index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agente); echo ui_get_full_url('mobile/index.php?page=agent&id=' . $id_agente);
?>", ?>",
"#qr_code_agent_view", 128, 128); "#qr_code_agent_view", 128, 128);
$("#text-agente").prop('disabled', true); $("#text-agente").prop('disabled', true);

View File

@ -34,6 +34,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent'); $use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public'); $snmp_community = (string) get_parameter ('snmp_community', 'public');
$snmp_version = get_parameter('snmp_version', '1'); $snmp_version = get_parameter('snmp_version', '1');
$server_to_exec = get_parameter('server_to_exec', 0);
$snmp3_auth_user = get_parameter('snmp3_auth_user'); $snmp3_auth_user = get_parameter('snmp3_auth_user');
$snmp3_security_level = get_parameter('snmp3_security_level'); $snmp3_security_level = get_parameter('snmp3_security_level');
$snmp3_auth_method = get_parameter('snmp3_auth_method'); $snmp3_auth_method = get_parameter('snmp3_auth_method');
@ -87,7 +88,8 @@ if ($snmpwalk) {
// OID Used is for DISKS // OID Used is for DISKS
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.2.3.1.3", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.2.3.1.3", $tcp_port,
$server_to_exec);
if (empty($snmpis)) { if (empty($snmpis)) {
$fail = true; $fail = true;
@ -120,7 +122,8 @@ if ($snmpwalk) {
// OID Used is for PROCESSES // OID Used is for PROCESSES
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.4.2.1.2", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.25.4.2.1.2", $tcp_port,
$server_to_exec);
if ($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
@ -158,7 +161,8 @@ if ($snmpwalk) {
// OID Used is for SENSOR TEMPERATURES // OID Used is for SENSOR TEMPERATURES
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.16.2.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.16.2.1", $tcp_port,
$server_to_exec);
if ($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
@ -196,7 +200,8 @@ if ($snmpwalk) {
// OID Used is for DEVICES // OID Used is for DEVICES
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.15.1.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.4.1.2021.13.15.1.1", $tcp_port,
$server_to_exec);
if ($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
@ -706,6 +711,19 @@ $table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, tr
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>'; $table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true); $table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[1][2] = '<b>' . __('Server to execute command') . '</b>';
$table->data[1][3] = html_print_select ($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c'; $snmp_versions['2c'] = 'v. 2c';

View File

@ -30,6 +30,7 @@ check_login ();
$ip_target = (string) get_parameter ('ip_target', $ipAgent); $ip_target = (string) get_parameter ('ip_target', $ipAgent);
$use_agent = get_parameter ('use_agent'); $use_agent = get_parameter ('use_agent');
$snmp_community = (string) get_parameter ('snmp_community', 'public'); $snmp_community = (string) get_parameter ('snmp_community', 'public');
$server_to_exec = get_parameter('server_to_exec', 0);
$snmp_version = get_parameter('snmp_version', '1'); $snmp_version = get_parameter('snmp_version', '1');
$snmp3_auth_user = get_parameter('snmp3_auth_user'); $snmp3_auth_user = get_parameter('snmp3_auth_user');
$snmp3_security_level = get_parameter('snmp3_security_level'); $snmp3_security_level = get_parameter('snmp3_security_level');
@ -53,16 +54,19 @@ if ($snmpwalk) {
// OID Used is for SNMP MIB-2 Interfaces // OID Used is for SNMP MIB-2 Interfaces
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.2", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.2", $tcp_port,
$server_to_exec);
// ifXTable is also used // ifXTable is also used
$ifxitems = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $ifxitems = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.31.1.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.31.1.1", $tcp_port,
$server_to_exec);
// Get the interfaces IPV4/IPV6 // Get the interfaces IPV4/IPV6
$snmp_int_ip = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmp_int_ip = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.4.34.1.3", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1.4.34.1.3", $tcp_port,
$server_to_exec);
// Build a [<interface id>] => [<interface ip>] array // Build a [<interface id>] => [<interface ip>] array
if (!empty($snmp_int_ip)) { if (!empty($snmp_int_ip)) {
@ -345,6 +349,19 @@ $table->data[0][3] = html_print_input_text ('tcp_port', $tcp_port, '', 5, 20, tr
$table->data[1][0] = '<b>' . __('Use agent ip') . '</b>'; $table->data[1][0] = '<b>' . __('Use agent ip') . '</b>';
$table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true); $table->data[1][1] = html_print_checkbox ('use_agent', 1, $use_agent, true);
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[1][2] = '<b>' . __('Server to execute command') . '</b>';
$table->data[1][3] = html_print_select ($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
$snmp_versions['1'] = 'v. 1'; $snmp_versions['1'] = 'v. 1';
$snmp_versions['2'] = 'v. 2'; $snmp_versions['2'] = 'v. 2';
$snmp_versions['2c'] = 'v. 2c'; $snmp_versions['2c'] = 'v. 2c';

View File

@ -29,6 +29,7 @@ $ip_target = (string) get_parameter ('ip_target', $ipAgent); // Host
$plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username $plugin_user = (string) get_parameter ('plugin_user', 'Administrator'); // Username
$plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password $plugin_pass = io_safe_output(get_parameter('plugin_pass', '')); // Password
$tcp_send = (string) get_parameter ('tcp_send'); // Namespace $tcp_send = (string) get_parameter ('tcp_send'); // Namespace
$server_to_exec = get_parameter('server_to_exec', true);
//See if id_agente is set (either POST or GET, otherwise -1 //See if id_agente is set (either POST or GET, otherwise -1
$id_agent = $idAgent; $id_agent = $idAgent;
@ -53,7 +54,18 @@ if ($wmiexplore) {
$wmi_processes = $wmi_command . ' "select Name from Win32_Process"'; $wmi_processes = $wmi_command . ' "select Name from Win32_Process"';
$processes_name_field = 1; $processes_name_field = 1;
exec($wmi_processes, $output); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " '" . $wmi_processes . "'", $output, $rc);
}
else {
exec($wmi_processes, $output);
}
}
else {
exec($wmi_processes, $output);
}
$fail = false; $fail = false;
if (preg_match('/^Failed/', $output[0])) { if (preg_match('/^Failed/', $output[0])) {
@ -79,7 +91,18 @@ if ($wmiexplore) {
$services_name_field = 0; $services_name_field = 0;
$services_check_field = 1; $services_check_field = 1;
exec($wmi_services, $output); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " '" . $wmi_services . "'", $output, $rc);
}
else {
exec($wmi_services, $output);
}
}
else {
exec($wmi_services, $output);
}
foreach ($output as $index => $row) { foreach ($output as $index => $row) {
// First and second rows are Class and column names, ignore it // First and second rows are Class and column names, ignore it
@ -98,7 +121,18 @@ if ($wmiexplore) {
$wmi_disks = $wmi_command . ' "Select DeviceID from Win32_LogicalDisk"'; $wmi_disks = $wmi_command . ' "Select DeviceID from Win32_LogicalDisk"';
$disks_name_field = 0; $disks_name_field = 0;
exec($wmi_disks, $output); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " '" . $wmi_disks . "'", $output, $rc);
}
else {
exec($wmi_disks, $output);
}
}
else {
exec($wmi_disks, $output);
}
foreach ($output as $index => $row) { foreach ($output as $index => $row) {
// First and second rows are Class and column names, ignore it // First and second rows are Class and column names, ignore it
@ -267,6 +301,19 @@ $table->data[1][3] = html_print_input_password ('plugin_pass', $plugin_pass, '',
$table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>'; $table->data[1][3] .= '<div id="spinner_modules" style="float: left; display: none;">' . html_print_image("images/spinner.gif", true) . '</div>';
html_print_input_hidden('wmiexplore', 1); html_print_input_hidden('wmiexplore', 1);
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[2][0] = '<b>' . __('Server to execute command') . '</b>';
$table->data[2][1] = html_print_select ($servers_to_exec, 'server_to_exec', $server_to_exec, '', '', '', true);
html_print_table($table); html_print_table($table);
echo "<div style='text-align:right; width:".$table->width."'>"; echo "<div style='text-align:right; width:".$table->width."'>";

View File

@ -53,6 +53,7 @@ else {
$event_response['modal_width'] = 0; $event_response['modal_width'] = 0;
$event_response['modal_height'] = 0; $event_response['modal_height'] = 0;
$event_response['params'] = ''; $event_response['params'] = '';
$event_response['server_to_exec'] = '';
} }
$table = new stdClass(); $table = new stdClass();
@ -117,11 +118,25 @@ $data[3] = html_print_select($types,'type',$event_response['type'],'','','',true
$table->data[3] = $data; $table->data[3] = $data;
$data = array(); $data = array();
$table->colspan[4][1] = 3;
$data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon ("response_macros", true); $data[0] = '<span id="command_label" class="labels">'.__('Command').'</span><span id="url_label" style="display:none;" class="labels">'.__('URL').'</span>'.ui_print_help_icon ("response_macros", true);
$data[1] = html_print_input_text('target', $event_response['target'], $data[1] = html_print_input_text('target', $event_response['target'],
'', 100, 255, true); '', 100, 255, true);
$types = array('url' => __('URL'), 'command' => __('Command'));
$servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$data[2] = '<div id="server_to_exec_label" style="display:none;" class="labels">' . __('Server to execute command') . '</div>';
$data[3] = '<div id="server_to_exec_value" style="display:none;">' . html_print_select($servers_to_exec, 'server_to_exec', $event_response['server_to_exec'], '', '', '', true) . '</div>';
$table->data[4] = $data; $table->data[4] = $data;
if ($event_response_id == 0) { if ($event_response_id == 0) {
@ -158,9 +173,13 @@ $('#type').change(function() {
$('#new_window option[value="0"]') $('#new_window option[value="0"]')
.prop('selected', true); .prop('selected', true);
$('#new_window').attr('disabled','disabled'); $('#new_window').attr('disabled','disabled');
$('#server_to_exec_label').css('display','');
$('#server_to_exec_value').css('display','');
break; break;
case 'url': case 'url':
$('#new_window').removeAttr('disabled'); $('#new_window').removeAttr('disabled');
$('#server_to_exec_label').css('display','none');
$('#server_to_exec_value').css('display','none');
break; break;
} }
}); });

View File

@ -40,6 +40,17 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) { if($values['new_window'] == 1) {
$values['modal_width'] = 0; $values['modal_width'] = 0;
@ -67,6 +78,17 @@ switch($action) {
$values['modal_height'] = get_parameter('modal_height'); $values['modal_height'] = get_parameter('modal_height');
$values['new_window'] = get_parameter('new_window'); $values['new_window'] = get_parameter('new_window');
$values['params'] = get_parameter('params'); $values['params'] = get_parameter('params');
if (enterprise_installed()) {
if ($values['type'] == 'command') {
$values['server_to_exec'] = get_parameter('server_to_exec');
}
else {
$values['server_to_exec'] = 0;
}
}
else {
$values['server_to_exec'] = 0;
}
if($values['new_window'] == 1) { if($values['new_window'] == 1) {
$values['modal_width'] = 0; $values['modal_width'] = 0;

View File

@ -48,7 +48,7 @@ if (is_ajax ()) {
return; return;
} }
function process_manage_delete ($module_name, $id_agents) { function process_manage_delete ($module_name, $id_agents, $module_status = 'all') {
global $config; global $config;
@ -217,6 +217,20 @@ function process_manage_delete ($module_name, $id_agents) {
} }
} }
if (($module_status == 'unknown') && ($module_name[0] == "0") && (is_array($module_name)) && (count($module_name) == 1)) {
$modules_to_delete = array();
foreach ($modules as $mod_id) {
$mod_status = (int)db_get_value_filter ('estado', 'tagente_estado', array('id_agente_modulo' => $mod_id));
// Unknown, not init and no data modules
if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) {
$modules_to_delete[$mod_id] = $mod_id;
}
}
$modules = $modules_to_delete;
}
$count_deleted_modules = count($modules); $count_deleted_modules = count($modules);
if ($config['dbtype'] == "oracle") { if ($config['dbtype'] == "oracle") {
$success = db_process_sql(sprintf("DELETE FROM tagente_modulo WHERE id_agente_modulo IN (%s)", implode(",", $modules))); $success = db_process_sql(sprintf("DELETE FROM tagente_modulo WHERE id_agente_modulo IN (%s)", implode(",", $modules)));
@ -251,6 +265,7 @@ $agents_id = get_parameter('id_agents');
$modules_select = get_parameter('module'); $modules_select = get_parameter('module');
$selection_mode = get_parameter('selection_mode', 'modules'); $selection_mode = get_parameter('selection_mode', 'modules');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$modules_selection_mode = get_parameter('modules_selection_mode');
if ($delete) { if ($delete) {
switch ($selection_mode) { switch ($selection_mode) {
@ -299,7 +314,7 @@ if ($delete) {
$module_name = array(); $module_name = array();
} }
foreach ($module_name as $mod_name) { foreach ($module_name as $mod_name) {
$result = process_manage_delete ($mod_name['nombre'], $id_agent['id_agente']); $result = process_manage_delete ($mod_name['nombre'], $id_agent['id_agente'], $modules_selection_mode);
$count ++; $count ++;
$success += (int)$result; $success += (int)$result;
} }
@ -319,7 +334,7 @@ if ($delete) {
$module_name = array(); $module_name = array();
} }
else { else {
$result = process_manage_delete (array(0 => 0), $id_agent); $result = process_manage_delete (array(0 => 0), $id_agent, $modules_selection_mode);
} }
$success += (int)$result; $success += (int)$result;
} }
@ -330,7 +345,8 @@ if ($delete) {
} }
if (!$force) { if (!$force) {
$result = process_manage_delete ($modules_, $agents_); $result = false;
$result = process_manage_delete ($modules_, $agents_, $modules_selection_mode);
} }
if ($result) { if ($result) {

View File

@ -147,10 +147,15 @@ if ($update_agents) {
$result = db_process_sql_update ('tagente', $result = db_process_sql_update ('tagente',
$values, $values,
array ('id_agente' => $id_agent)); array ('id_agente' => $id_agent));
if($group_old || $result){ if($group_old || $result){
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups if ($group_old && $group_old != null) {
WHERE id_group = ".$group_old); $tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$group_old);
}
else {
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups");
}
if($tpolicy_group_old){ if($tpolicy_group_old){
foreach ($tpolicy_group_old as $key => $value) { foreach ($tpolicy_group_old as $key => $value) {
@ -164,9 +169,13 @@ if ($update_agents) {
} }
} }
} }
if ($values['id_grupo'] && $values['id_grupo'] != null) {
$tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups $tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
WHERE id_group = ".$values['id_grupo']); WHERE id_group = ".$values['id_grupo']);
}
else {
$tpolicy_group_new = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups");
}
if($tpolicy_group_new){ if($tpolicy_group_new){
foreach ($tpolicy_group_new as $key => $value) { foreach ($tpolicy_group_new as $key => $value) {
@ -328,6 +337,8 @@ $params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent'; $params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent; $params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent); $params['value'] = db_get_value ("alias","tagente","id_agente",$id_parent);
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$table->data[0][1] = ui_print_agent_autocomplete_input($params); $table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][1] .= "<b>" . __('Cascade protection'). "</b>&nbsp;" . $table->data[0][1] .= "<b>" . __('Cascade protection'). "</b>&nbsp;" .
@ -557,38 +568,6 @@ $(document).ready (function () {
} }
}); });
$("#text-id_parent").on("autocompletechange", function () {
agent_name = $("#text-id_parent").val();
var params = {};
params["get_agent_modules_json_by_name"] = 1;
params["agent_name"] = agent_name;
params["page"] = "include/ajax/module";
jQuery.ajax ({
data: params,
dataType: "json",
type: "POST",
url: "ajax.php",
success: function (data) {
$('#cascade_protection_module').empty();
$('#cascade_protection_module')
.append ($('<option></option>')
.html("Any")
.prop("value", 0)
.prop("selected", 'selected'));
jQuery.each (data, function (i, val) {
$('#cascade_protection_module')
.append ($('<option></option>')
.html(val['name'])
.prop("value", val['id_module'])
.prop("selected", 'selected'));
});
}
});
});
$("#form_agent").submit(function() { $("#form_agent").submit(function() {
var get_parameters_count = window.location.href.slice( var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length; window.location.href.indexOf('?') + 1).split('&').length;

View File

@ -40,6 +40,7 @@ $agents_id = get_parameter('id_agents');
$modules_select = get_parameter('module'); $modules_select = get_parameter('module');
$selection_mode = get_parameter('selection_mode', 'modules'); $selection_mode = get_parameter('selection_mode', 'modules');
$recursion = get_parameter('recursion'); $recursion = get_parameter('recursion');
$modules_selection_mode = get_parameter('modules_selection_mode');
$update = (bool) get_parameter_post ('update'); $update = (bool) get_parameter_post ('update');
@ -105,7 +106,7 @@ if ($update) {
$module_name = array(); $module_name = array();
foreach ($module_name as $mod_name) { foreach ($module_name as $mod_name) {
$result = process_manage_edit($mod_name['nombre'], $id_agent); $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode);
$count++; $count++;
$success += (int)$result; $success += (int)$result;
} }
@ -127,7 +128,7 @@ if ($update) {
$module_name = array(); $module_name = array();
foreach($module_name as $mod_name) { foreach($module_name as $mod_name) {
$result = process_manage_edit($mod_name['nombre'], $id_agent); $result = process_manage_edit($mod_name['nombre'], $id_agent, $modules_selection_mode);
$count++; $count++;
$success += (int)$result; $success += (int)$result;
} }
@ -146,7 +147,7 @@ if ($update) {
foreach ($modules_ as $module_) { foreach ($modules_ as $module_) {
$result = process_manage_edit ($module_, $agent_); $result = process_manage_edit ($module_, $agent_, $modules_selection_mode);
$count++; $count++;
$success += (int)$result; $success += (int)$result;
@ -1112,7 +1113,7 @@ function disabled_status () {
/* ]]> */ /* ]]> */
</script> </script>
<?php <?php
function process_manage_edit ($module_name, $agents_select = null) { function process_manage_edit ($module_name, $agents_select = null, $module_status = 'all') {
if (is_int ($module_name) && $module_name < 0) { if (is_int ($module_name) && $module_name < 0) {
ui_print_error_message(__('No modules selected')); ui_print_error_message(__('No modules selected'));
@ -1230,6 +1231,19 @@ function process_manage_edit ($module_name, $agents_select = null) {
if ($modules === false) if ($modules === false)
return false; return false;
if (($module_status == 'unknown') && ($module_name == "0")) {
$modules_to_delete = array();
foreach ($modules as $mod_id) {
$mod_status = (int)db_get_value_filter ('estado', 'tagente_estado', array('id_agente_modulo' => $mod_id));
// Unknown, not init and no data modules
if ($mod_status == 3 || $mod_status == 4 || $mod_status == 5) {
$modules_to_delete[$mod_id] = $mod_id;
}
}
$modules = $modules_to_delete;
}
foreach ($modules as $module) { foreach ($modules as $module) {
$result = modules_update_agent_module( $result = modules_update_agent_module(

View File

@ -33,21 +33,40 @@ if (isset($_GET["server"])) {
$id_server= get_parameter_get ("server"); $id_server= get_parameter_get ("server");
// Headers // Headers
ui_print_page_header (__('Update Server'), "images/gm_servers.png", false, "servers", true); ui_print_page_header (__('Update Server'), "images/gm_servers.png", false, "servers", true);
$sql = sprintf("SELECT name, ip_address, description FROM tserver WHERE id_server = %d",$id_server); $sql = sprintf("SELECT name, ip_address, description, server_type, exec_proxy FROM tserver WHERE id_server = %d",$id_server);
$row = db_get_row_sql ($sql); $row = db_get_row_sql ($sql);
echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">'; echo '<form name="servers" method="POST" action="index.php?sec=gservers&sec2=godmode/servers/modificar_server&update=1">';
html_print_input_hidden ("server",$id_server); html_print_input_hidden ("server",$id_server);
$server_type = __('Standard');
if ($row["server_type"] == 13) {
$server_type = __('Satellite');
}
$exec_server_enable = __("No");
if ($row["exec_proxy"] == 1) {
$exec_server_enable = __('Yes');
}
$table->cellpadding=4; $table->cellpadding=4;
$table->cellspacing=4; $table->cellspacing=4;
$table->width='100%'; $table->width='100%';
$table->class="databox filters"; $table->class="databox filters";
$table->data[] = array (__('Name'),$row["name"]); $table->data[] = array (__('Name'), $row["name"]);
$table->data[] = array (__('IP Address'),html_print_input_text ('address',$row["ip_address"],'',50,0,true)); $table->data[] = array (__('IP Address'), html_print_input_text ('address',$row["ip_address"],'',50,0,true));
$table->data[] = array (__('Description'),html_print_input_text ('description',$row["description"],'',50,0,true)); $table->data[] = array (__('Description'), html_print_input_text ('description',$row["description"],'',50,0,true));
html_print_table ($table);
if (enterprise_installed()) {
$table->data[] = array (__('Type'), $server_type);
if ($row["server_type"] == 13) {
$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>');
}
}
}
html_print_table ($table);
echo '<div class="action-buttons" style="width: 100%">'; echo '<div class="action-buttons" style="width: 100%">';
echo '<input type="submit" class="sub upd" value="'.__('Update').'">'; echo '<input type="submit" class="sub upd" value="'.__('Update').'">';
@ -105,8 +124,9 @@ else {
$address = get_parameter_post ("address"); $address = get_parameter_post ("address");
$description = get_parameter_post ("description"); $description = get_parameter_post ("description");
$id_server = get_parameter_post ("server"); $id_server = get_parameter_post ("server");
$exec_proxy = get_parameter_post ("exec_proxy");
$values = array('ip_address' => $address, 'description' => $description); $values = array('ip_address' => $address, 'description' => $description, 'exec_proxy' => $exec_proxy);
$result = db_process_sql_update('tserver', $values, array('id_server' => $id_server)); $result = db_process_sql_update('tserver', $values, array('id_server' => $id_server));
if ($result !== false) { if ($result !== false) {
ui_print_success_message(__('Server updated successfully')); ui_print_success_message(__('Server updated successfully'));
@ -141,3 +161,38 @@ else {
require($config['homedir'] . '/godmode/servers/servers.build_table.php'); require($config['homedir'] . '/godmode/servers/servers.build_table.php');
} }
?> ?>
<script language="javascript" type="text/javascript">
$(document).ready (function () {
$("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif");
check_process("<?php echo $id_server;?>");
});
});
function check_process (id_server) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['check_exec_server'] = 1;
parameters['id_server'] = id_server;
jQuery.post(
"ajax.php",
parameters,
function (data) {
if (data['correct']) {
$("#check_exec_server img").attr("src", "images/dot_green.png");
}
else {
$("#check_exec_server img").attr("src", "images/dot_red.png");
$("#check_error_message").empty();
$("#check_error_message").append("<span>" + data['message'] + "</span>");
}
},
"json"
);
}
</script>

View File

@ -122,19 +122,64 @@ if ($perform_event_response) {
global $config; global $config;
$command = get_parameter('target',''); $command = get_parameter('target','');
$response_id = get_parameter ('response_id');
switch (PHP_OS) {
case "FreeBSD": $event_response = db_get_row('tevent_response','id',$response_id);
$timeout_bin = '/usr/local/bin/gtimeout';
break; if (enterprise_installed()) {
case "NetBSD": if ($event_response['server_to_exec'] != 0 && $event_response['type'] == 'command') {
$timeout_bin = '/usr/pkg/bin/gtimeout'; $commandExclusions = array ('vi', 'vim', 'nano');
break;
default: $server_data = db_get_row('tserver','id_server', $event_response['server_to_exec']);
$timeout_bin = '/usr/bin/timeout';
break; if (in_array(strtolower($command),$commandExclusions)) {
echo "Only stdin/stdout commands are supported";
}
else {
switch (PHP_OS) {
case "FreeBSD":
$timeout_bin = '/usr/local/bin/gtimeout';
break;
case "NetBSD":
$timeout_bin = '/usr/pkg/bin/gtimeout';
break;
default:
$timeout_bin = '/usr/bin/timeout';
break;
}
echo system("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $timeout_bin . " 90 " . io_safe_output($command) . " 2>&1\"", $ret_val);
}
}
else {
switch (PHP_OS) {
case "FreeBSD":
$timeout_bin = '/usr/local/bin/gtimeout';
break;
case "NetBSD":
$timeout_bin = '/usr/pkg/bin/gtimeout';
break;
default:
$timeout_bin = '/usr/bin/timeout';
break;
}
echo system($timeout_bin . ' 90 '.io_safe_output($command).' 2>&1');
}
}
else {
switch (PHP_OS) {
case "FreeBSD":
$timeout_bin = '/usr/local/bin/gtimeout';
break;
case "NetBSD":
$timeout_bin = '/usr/pkg/bin/gtimeout';
break;
default:
$timeout_bin = '/usr/bin/timeout';
break;
}
echo system($timeout_bin . ' 90 '.io_safe_output($command).' 2>&1');
} }
echo system($timeout_bin . ' 9 '.io_safe_output($command).' 2>&1');
return; return;
} }
@ -162,7 +207,7 @@ if ($dialogue_event_response) {
echo "<br><div id='response_out' style='text-align:left'></div>"; echo "<br><div id='response_out' style='text-align:left'></div>";
echo "<br><div id='re_exec_command' style='display:none;'>"; echo "<br><div id='re_exec_command' style='display:none;'>";
html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\');', "class='sub next'"); html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
echo "</div>"; echo "</div>";
break; break;
case 'url': case 'url':

View File

@ -22,8 +22,8 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC170816'; $build_version = 'PC170901';
$pandora_version = 'v7.0NG.710'; $pandora_version = 'v7.0NG.711';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.
$script_tz = @date_default_timezone_get(); $script_tz = @date_default_timezone_get();

View File

@ -1506,7 +1506,7 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
$snmp3_auth_user = '', $snmp3_security_level = '', $snmp3_auth_user = '', $snmp3_security_level = '',
$snmp3_auth_method = '', $snmp3_auth_pass = '', $snmp3_auth_method = '', $snmp3_auth_pass = '',
$snmp3_privacy_method = '', $snmp3_privacy_pass = '', $snmp3_privacy_method = '', $snmp3_privacy_pass = '',
$quick_print = 0, $base_oid = "", $snmp_port = '') { $quick_print = 0, $base_oid = "", $snmp_port = '', $server_to_exec = 0) {
global $config; global $config;
@ -1598,7 +1598,18 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
break; break;
} }
exec($command_str, $output, $rc); if (enterprise_installed()) {
if ($server_to_exec != 0) {
$server_data = db_get_row('tserver','id_server', $server_to_exec);
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command_str . "\"", $output, $rc);
}
else {
exec($command_str, $output, $rc);
}
}
else {
exec($command_str, $output, $rc);
}
// Parse the output of snmpwalk // Parse the output of snmpwalk
$snmpwalk = array(); $snmpwalk = array();

View File

@ -2350,6 +2350,8 @@ function events_page_general ($event) {
} }
$table_general->data[] = $data; $table_general->data[] = $data;
$event["owner_user"] = $event["id_usuario"];
$data = array(); $data = array();
$data[0] = __('Owner'); $data[0] = __('Owner');
if (empty($event["owner_user"])) { if (empty($event["owner_user"])) {

View File

@ -138,7 +138,7 @@ function snmp_browser_print_tree ($tree, $id = 0, $depth = 0, $last = 0, $last_a
* *
* @return array The SNMP tree. * @return array The SNMP tree.
*/ */
function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $version = '2c', $snmp3_auth_user = '', $snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '', $snmp3_privacy_method = '', $snmp3_privacy_pass = '') { function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $version = '2c', $snmp3_auth_user = '', $snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '', $snmp3_privacy_method = '', $snmp3_privacy_pass = '', $server_to_exec = 0) {
global $config; global $config;
if ($target_ip == '') { if ($target_ip == '') {
@ -173,27 +173,73 @@ function snmp_browser_get_tree ($target_ip, $community, $starting_oid = '.', $ve
$error_redir_dir = '/dev/null'; $error_redir_dir = '/dev/null';
break; break;
} }
if ($server_to_exec != 0) {
$sql = sprintf("SELECT ip_address FROM tserver WHERE id_server = %d", $server_to_exec);
$server_data = db_get_row_sql($sql);
$oid_tree = array('__LEAVES__' => array()); if (enterprise_installed()) {
if ($version == "3") { enterprise_include_once ('include/functions_satellite.php');
switch ($snmp3_security_level) {
case "authPriv": $oid_tree = array('__LEAVES__' => array());
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); if ($version == "3") {
break; switch ($snmp3_security_level) {
case "authNoPriv": case "authPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); $command = $snmpwalk_bin . " -m ALL -v 3 -u " . escapeshellarg($snmp3_auth_user) . " -A " . escapeshellarg($snmp3_auth_pass) . " -l " . escapeshellarg($snmp3_security_level) . " -a " . escapeshellarg($snmp3_auth_method) . " -x " . escapeshellarg($snmp3_privacy_method) . " -X " . escapeshellarg($snmp3_privacy_pass) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
break; break;
case "noAuthNoPriv": case "authNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -l ' . escapeshellarg($snmp3_security_level) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); $command = $snmpwalk_bin . " -m ALL -v 3 -u " . escapeshellarg($snmp3_auth_user) . " -A " . escapeshellarg($snmp3_auth_pass) . " -l " . escapeshellarg($snmp3_security_level) . " -a " . escapeshellarg($snmp3_auth_method) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
break; break;
case "noAuthNoPriv":
$command = $snmpwalk_bin . " -m ALL -v 3 -u " . escapeshellarg($snmp3_auth_user) . " -l " . escapeshellarg($snmp3_security_level) . " " . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
break;
}
}
else {
$command = $snmpwalk_bin . " -m ALL -M +" . escapeshellarg($config['homedir'] . "/attachment/mibs") . " -Cc -c " . escapeshellarg($community) . " -v " . escapeshellarg($version) . " " . escapeshellarg($target_ip) . " " . escapeshellarg($starting_oid) . " 2> " . $error_redir_dir;
}
exec("ssh pandora_exec_proxy@" . $server_data['ip_address'] . " \"" . $command . "\"", $output, $rc);
}
else {
$oid_tree = array('__LEAVES__' => array());
if ($version == "3") {
switch ($snmp3_security_level) {
case "authPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "authNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "noAuthNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -l ' . escapeshellarg($snmp3_security_level) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
}
}
else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
} }
} }
else { else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc); $oid_tree = array('__LEAVES__' => array());
if ($version == "3") {
switch ($snmp3_security_level) {
case "authPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' -x ' . escapeshellarg($snmp3_privacy_method) . ' -X ' . escapeshellarg($snmp3_privacy_pass) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "authNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -A ' . escapeshellarg($snmp3_auth_pass) . ' -l ' . escapeshellarg($snmp3_security_level) . ' -a ' . escapeshellarg($snmp3_auth_method) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
case "noAuthNoPriv":
exec ($snmpwalk_bin . ' -m ALL -v 3 -u ' . escapeshellarg($snmp3_auth_user) . ' -l ' . escapeshellarg($snmp3_security_level) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
break;
}
}
else {
exec ($snmpwalk_bin . ' -m ALL -M +' . escapeshellarg($config['homedir'] . '/attachment/mibs') . ' -Cc -c ' . escapeshellarg($community) . ' -v ' . escapeshellarg($version) . ' ' . escapeshellarg($target_ip) . ' ' . escapeshellarg($starting_oid) . ' 2> ' . $error_redir_dir, $output, $rc);
}
} }
//if ($rc != 0) { html_debug($output, true);
// return __('No data');
//}
foreach ($output as $line) { foreach ($output as $line) {
// Separate the OID from the value // Separate the OID from the value
@ -518,7 +564,21 @@ function snmp_browser_print_container ($return = false, $width = '100%', $height
'3' => 'v. 3'), '3' => 'v. 3'),
'snmp_browser_version', '', 'checkSNMPVersion();', '', '', true, false, false, ''); 'snmp_browser_version', '', 'checkSNMPVersion();', '', '', true, false, false, '');
$table->data[0][4] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true); $servers_to_exec = array();
$servers_to_exec[0] = __('Local console');
if (enterprise_installed()) {
enterprise_include_once ('include/functions_satellite.php');
$rows = get_proxy_servers();
foreach ($rows as $row) {
$servers_to_exec[$row['id_server']] = $row['name'];
}
}
$table->data[0][4] = '<strong>' . __('Server to execute') . '</strong> &nbsp;&nbsp;';
$table->data[0][4] .= html_print_select($servers_to_exec, 'server_to_exec', '', '', '', '', true);
$table->data[0][5] = html_print_button(__('Browse'), 'browse', false, 'snmpBrowse()', 'class="sub search" style="margin-top:0px;"', true);
// SNMP v3 options // SNMP v3 options
$table3 = new stdClass(); $table3 = new stdClass();

View File

@ -3150,7 +3150,6 @@ function ui_print_agent_autocomplete_input($parameters) {
.attr("value", val["id_agente_modulo"]).text (s)); .attr("value", val["id_agente_modulo"]).text (s));
}); });
$("#' . $selectbox_id . '").enable();
$("#' . $selectbox_id . '").fadeIn ("normal"); $("#' . $selectbox_id . '").fadeIn ("normal");
} }
}); });

View File

@ -2645,6 +2645,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
'proportion_width' => $proportion_width); 'proportion_width' => $proportion_width);
} }
$layout_data['label'] = visual_map_macro($layout_data['label']);
switch ($layout_data['type']) { switch ($layout_data['type']) {
case LINE_ITEM: case LINE_ITEM:
visual_map_print_user_lines($layout_data, $proportion); visual_map_print_user_lines($layout_data, $proportion);
@ -3008,4 +3010,10 @@ function visual_map_type_in_js($type) {
} }
} }
function visual_map_macro($label){
$label = str_replace('_date_',strftime("%x"),$label);
$label = str_replace('_time_',strftime("%T"),$label);
return $label;
}
?> ?>

View File

@ -1709,6 +1709,15 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
how_bigger = "K"; how_bigger = "K";
y = y / 1000; y = y / 1000;
} }
else if(y < -1000000) {
how_bigger = "M";
y = y / 1000000;
}
else if (y < -1000) {
console.log('entra por negativo');
how_bigger = "K";
y = y / 1000;
}
if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) { if (currentRanges == null || (currentRanges.xaxis.from < j && j < currentRanges.xaxis.to)) {
$('#timestamp_'+graph_id).show(); $('#timestamp_'+graph_id).show();
@ -2132,6 +2141,10 @@ function number_format(number, force_integer, unit) {
pos++; //Position in array starting with 0 pos++; //Position in array starting with 0
number = number / 1000; number = number / 1000;
} }
else if (number <= -1000) {
pos++;
number = number / 1000;
}
else { else {
break; break;
} }

View File

@ -54,6 +54,11 @@ $graph_type = get_parameter('graph_type', '');
$id_graph = get_parameter('id_graph', false); $id_graph = get_parameter('id_graph', false);
$graph_threshold = get_parameter('graph_threshold', false);
$id_module = get_parameter('id_module');
if (!$id_graph) { if (!$id_graph) {
exit; exit;
} }
@ -383,7 +388,7 @@ switch ($graph_type) {
pch_vertical_graph($graph_type, $data_keys, $data_values, $width, pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend, $height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
$font, $antialiasing, $water_mark, $font_size, $font, $antialiasing, $water_mark, $font_size,
$backgroundColor, $unit, $series_type); $backgroundColor, $unit, $series_type, $graph_threshold, $id_module);
break; break;
case 'threshold': case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width, pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
@ -769,7 +774,8 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
function pch_vertical_graph ($graph_type, $index, $data, $width, $height, function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false, $rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size, $legend = array(), $font, $antialiasing, $water_mark = '', $font_size,
$backgroundColor = 'white', $unit = '', $series_type = array()) { $backgroundColor = 'white', $unit = '', $series_type = array(),
$graph_threshold = false, $id_module) {
global $config; global $config;
@ -955,8 +961,18 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$chart_size = ($digits_left * $font_size) + 20; $chart_size = ($digits_left * $font_size) + 20;
$max_data = max(max($data)); $min_data = 0;
$max_data = 0;
foreach ($data as $k => $v) {
if(min($v) < $min_data){
$min_data = min($v);
}
if(max($v) > $max_data){
$max_data = max($v);
}
}
$default_chart_size = 40; $default_chart_size = 40;
$rest_chars = strlen($max_data) - 6; $rest_chars = strlen($max_data) - 6;
$default_chart_size += $rest_chars * 5; $default_chart_size += $rest_chars * 5;
@ -975,7 +991,6 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
($height - $margin_bottom)); ($height - $margin_bottom));
/*Get minimun value to draw axis properly*/ /*Get minimun value to draw axis properly*/
$min_data = min(min($data));
$ManualScale = array(); $ManualScale = array();
$mode = SCALE_MODE_START0; $mode = SCALE_MODE_START0;
@ -987,33 +1002,249 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$ManualScale = array(0 => array("Min" => $min_data, "Max" => 0)); $ManualScale = array(0 => array("Min" => $min_data, "Max" => 0));
$mode = SCALE_MODE_MANUAL; $mode = SCALE_MODE_MANUAL;
} }
else if ($max_data >= 0 && $min_data <= 0){
$ManualScale = array(0 => array("Min" => $min_data, "Max" => $max_data));
$mode = SCALE_MODE_MANUAL;
}
/* Draw the scale */ if($graph_threshold){
$scaleSettings = array( $sql_treshold = 'select min_critical, max_critical, min_warning, max_warning, critical_inverse, warning_inverse from tagente_modulo where id_agente_modulo =' . $id_module;
"GridR" => 200, $treshold_position = db_get_all_rows_sql($sql_treshold);
"GridG" => 200,
"GridB" => 200, //min, max and inverse critical and warning
"GridAlpha" => 30, $p_min_crit = $treshold_position[0]['min_critical'];
"DrawSubTicks" => true, $p_max_crit = $treshold_position[0]['max_critical'];
"CycleBackground" => true, $p_inv_crit = $treshold_position[0]['critical_inverse'];
"BackgroundAlpha1" => 35, $p_min_warn = $treshold_position[0]['min_warning'];
"BackgroundAlpha2" => 35, $p_max_warn = $treshold_position[0]['max_warning'];
"Mode" => $mode, $p_inv_warn = $treshold_position[0]['warning_inverse'];
"ManualScale" => $ManualScale,
"LabelRotation" => 40, //interval warning
"XMargin" => 0, $print_rectangle_warning = 1;
"MinDivHeight" => 15, if($p_min_warn == "0.00" && $p_max_warn == "0.00" && $p_inv_warn == 0){
"TicksFontSize" => $font_size - 1); $print_rectangle_warning = 0;
}
$scaleSettings['AxisR'] = '200'; if($print_rectangle_warning){
$scaleSettings['AxisG'] = '200'; if($p_inv_warn){
$scaleSettings['AxisB'] = '200'; if($p_max_warn == 0){
$scaleSettings['TickR'] = '200'; $p_max_warn = $p_min_warn;
$scaleSettings['TickG'] = '200'; $p_min_warn = "none";
$scaleSettings['TickB'] = '200'; }
else{
$myPicture->drawScale($scaleSettings); $p_max_warn_inv = $p_min_warn;
$p_min_warn_inv = $min_data + 2;
$p_min_warn = $p_max_warn;
if($p_max_warn > $max_data){
$p_max_warn = $p_max_warn + 21;
}
else{
$p_max_warn = $max_data + 21;
}
}
}
else{
if($p_max_warn == 0){
if($max_data > $p_min_warn){
$p_max_warn = $max_data + 21;
}
else{
$p_max_warn = $p_min_warn + 21;
}
}
}
}
//interval critical
$print_rectangle_critical = 1;
if($p_min_crit == "0.00" && $p_max_crit == "0.00" && $p_inv_crit == 0){
$print_rectangle_critical = 0;
}
if($print_rectangle_critical){
if($p_inv_crit){
if($p_max_crit == 0){
$p_max_crit = $p_min_crit;
$p_min_crit = "none";
}
else{
$p_max_crit_inv = $p_min_crit;
$p_min_crit_inv = $min_data + 2;
$p_min_crit = $p_max_crit;
if($p_inv_warn){
if($p_max_crit < $p_max_warn){
$p_max_crit = $p_max_warn;
}
}
else{
if($p_max_crit > $max_data){
$p_max_crit = $p_max_crit + 21;
}
else{
$p_max_crit = $max_data + 21;
}
}
}
}
else{
if($p_max_crit == 0){
if($p_max_warn > $p_min_crit){
$p_max_crit = $p_max_warn;
}
else{
if($max_data > $p_min_crit){
$p_max_crit = $max_data + 21;
}
else{
$p_max_crit = $p_min_crit + 21;
}
}
}
}
}
//Check size scale
//Which of the thresholds is higher?
if($p_max_crit > $p_max_warn){
$check_scale = $p_max_crit;
}
else{
$check_scale = $p_max_warn;
}
if($p_min_crit < $p_min_warn){
$check_scale_min = $p_min_crit;
}
else{
$check_scale_min = $p_min_warn;
}
//Is the threshold higher than our maximum?
if($max_data > $check_scale){
$check_scale = $max_data;
}
if($min_data < $check_scale_min){
$check_scale_min = $min_data;
}
$ManualScale = array( 0 => array("Min" => $check_scale_min, "Max" => $check_scale) );
$mode = SCALE_MODE_MANUAL;
/* Draw the scale */
$scaleSettings = array(
"GridR" => 200,
"GridG" => 200,
"GridB" => 200,
"GridAlpha" => 30,
"DrawSubTicks" => true,
"CycleBackground" => true,
"BackgroundAlpha1" => 35,
"BackgroundAlpha2" => 35,
"Mode" => $mode,
"ManualScale" => $ManualScale,
"LabelRotation" => 40,
"XMargin" => 0,
"MinDivHeight" => 15,
"TicksFontSize" => $font_size - 1);
$scaleSettings['AxisR'] = '200';
$scaleSettings['AxisG'] = '200';
$scaleSettings['AxisB'] = '200';
$scaleSettings['TickR'] = '200';
$scaleSettings['TickG'] = '200';
$scaleSettings['TickB'] = '200';
$myPicture->drawScale($scaleSettings);
//values
$scale_max = $myPicture->DataSet->Data["Axis"][0]["ScaleMax"];
$scale_min = $myPicture->DataSet->Data["Axis"][0]["ScaleMin"];
$position_y1 = $myPicture->GraphAreaY1;
$position_y2 = $myPicture->GraphAreaY2;
$position1 = $myPicture->GraphAreaX1;
$position3 = $myPicture->GraphAreaX2;
$cte = ($position_y2 - $position_y1) / ($scale_max - $scale_min);
//warning
if($print_rectangle_warning){
$RectangleSettings = array("R"=>255,"G"=>255,"B"=>000,"Dash"=>TRUE,"DashR"=>170,"DashG"=>220,"DashB"=>190);
if($p_min_warn == "none"){
$p_min_warn = $scale_min;
}
$position2 = ($scale_max - $p_min_warn)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_warn)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, floor($position2),
$position3, floor($position4),
$RectangleSettings);
if($p_inv_warn){
$position2 = ($scale_max - $p_min_warn_inv)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_warn_inv)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, floor($position2),
$position3, floor($position4),
$RectangleSettings);
}
}
//critical
if($print_rectangle_critical){
$RectangleSettings = array("R"=>248,"G"=>000,"B"=>000,"Dash"=>TRUE,"DashR"=>170,"DashG"=>220,"DashB"=>190);
if($p_min_crit == "none"){
$p_min_crit = $scale_min;
}
$position2 = ($scale_max - $p_min_crit)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_crit)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, $position2,
$position3, $position4,
$RectangleSettings);
if($p_inv_crit){
$position2 = ($scale_max - $p_min_crit_inv)*$cte + $position_y1;
$position4 = ($scale_max - $p_max_crit_inv)*$cte + $position_y1;
$myPicture->drawFilledRectangle($position1, $position2,
$position3, $position4,
$RectangleSettings);
}
}
}
else{
/* Draw the scale */
$scaleSettings = array(
"GridR" => 200,
"GridG" => 200,
"GridB" => 200,
"GridAlpha" => 30,
"DrawSubTicks" => true,
"CycleBackground" => true,
"BackgroundAlpha1" => 35,
"BackgroundAlpha2" => 35,
"Mode" => $mode,
"ManualScale" => $ManualScale,
"LabelRotation" => 40,
"XMargin" => 0,
"MinDivHeight" => 15,
"TicksFontSize" => $font_size - 1);
$scaleSettings['AxisR'] = '200';
$scaleSettings['AxisG'] = '200';
$scaleSettings['AxisB'] = '200';
$scaleSettings['TickR'] = '200';
$scaleSettings['TickG'] = '200';
$scaleSettings['TickB'] = '200';
$myPicture->drawScale($scaleSettings);
}
/* Turn on shadow computing */ /* Turn on shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); //$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
@ -1087,7 +1318,6 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
} }
} }
/* Render the picture */ /* Render the picture */
$myPicture->stroke(); $myPicture->stroke();
} }

View File

@ -54,6 +54,7 @@ Apart from the defined module macros, the following macros are also available:
<li>_event_id_ : (Only event alerts) Id of the event that fired the alert.</li> <li>_event_id_ : (Only event alerts) Id of the event that fired the alert.</li>
<li>_id_agent_ : Id of agent, useful to build direct URL to redirect to a Pandora FMS console webpage.</li> <li>_id_agent_ : Id of agent, useful to build direct URL to redirect to a Pandora FMS console webpage.</li>
<li>_id_group_ : Id of agent group.</li> <li>_id_group_ : Id of agent group.</li>
<li>_id_module_ : Id of module.</li>
<li>_id_alert_ : Numerical ID of the alert (unique), used to correlate on third party software</li> <li>_id_alert_ : Numerical ID of the alert (unique), used to correlate on third party software</li>
<li>_policy_ : Name of the policy the module belongs to (if applies).</li> <li>_policy_ : Name of the policy the module belongs to (if applies).</li>
<li>_interval_ : Execution interval of the module. </li> <li>_interval_ : Execution interval of the module. </li>
@ -63,6 +64,9 @@ Apart from the defined module macros, the following macros are also available:
<li>_groupcontact_ : Group contact information. Configured when the group is created.</li> <li>_groupcontact_ : Group contact information. Configured when the group is created.</li>
<li>_groupother_ : Other information about the group. Configured when the group is created.</li> <li>_groupother_ : Other information about the group. Configured when the group is created.</li>
<li>_email_tag_ : Emails associated to the module tags.</li> <li>_email_tag_ : Emails associated to the module tags.</li>
<li>_alert_critical_instructions_: Instructions for CRITICAL status contained in the module.</li>
<li>_alert_warning_instructions_: Instructions for WARNING status contained in the module.</li>
<li>_alert_unknown_instructions_: Instructions for UNKNOWN status contained in the module.</li>
<li>_modulegraph_nh_: (Only for alerts that use the command eMail) Returns an image of a module graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's api is required. This setup is done into the server's configuration file.</li> <li>_modulegraph_nh_: (Only for alerts that use the command eMail) Returns an image of a module graph with a period of n hours (eg. _modulegraph_24h_). A correct setup of the connection between the server and the console's api is required. This setup is done into the server's configuration file.</li>
<li>_homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.</li> <li>_homeurl_ : It is a link of the public URL this must be configured in the general options of the setup.</li>
</ul> </ul>

View File

@ -47,6 +47,7 @@ Besides the defined module macros, the following macros are available:
<li>_event_id_: (Only event alerts) ID of the event that triggered the alert.</li> <li>_event_id_: (Only event alerts) ID of the event that triggered the alert.</li>
<li>_id_agent_: Agents ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.</li> <li>_id_agent_: Agents ID, useful for building a direct URL that redirects to a Pandora FMS console webpage.</li>
<li>_id_group_ : Agent group ID.</li> <li>_id_group_ : Agent group ID.</li>
<li>_id_module_ : ID of module.</li>
<li>_id_alert_: Alerts numeric ID (unique), used to correlate the alert with third party software.</li> <li>_id_alert_: Alerts numeric ID (unique), used to correlate the alert with third party software.</li>
<li>_policy_: Name of the policy that the module belongs to (if applies).</li> <li>_policy_: Name of the policy that the module belongs to (if applies).</li>
<li>_interval_: Modules execution interval </li> <li>_interval_: Modules execution interval </li>

View File

@ -56,6 +56,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_event_id_ : (Solo alertas de evento) Id del evento que disparó la alerta.</li> <li>_event_id_ : (Solo alertas de evento) Id del evento que disparó la alerta.</li>
<li>_id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.</li> <li>_id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.</li>
<li>_id_group_ : Id del grupo de agente.</li> <li>_id_group_ : Id del grupo de agente.</li>
<li>_id_module_ : ID del módulo.</li>
<li>_id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.</li> <li>_id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.</li>
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li> <li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
<li>_interval_ : Intervalo de la ejecución del módulo. </li> <li>_interval_ : Intervalo de la ejecución del módulo. </li>
@ -65,7 +66,11 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.</li> <li>_groupcontact_ : Información de contacto del grupo. Se configura al crear el grupo.</li>
<li>_groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.</li> <li>_groupother_ : Otra información sobre el grupo. Se configura al crear el grupo.</li>
<li>_email_tag_ : Emails asociados a los tags de módulos.</li> <li>_email_tag_ : Emails asociados a los tags de módulos.</li>
<li>_modulegraph_nh_: (Sólo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.</li> <li>_alert_critical_instructions_: Instrucciones contenidas en el módulo para un estado CRITICAL.</li>
<li>_alert_warning_instructions_: Instrucciones contenidas en el módulo para un estado WARNING.</li>
<li>_alert_unknown_instructions_: Instrucciones contenidas en el módulo para un estado UNKNOWN.</li>
<li>_modulegraph_<i>n</i>h_: (Sólo para alertas que usen el comando eMail) Devuelve una imagen codificada en base64 de una gráfica del módulo con un período de n horas (eg. _modulegraph_24h_). Requiere de una configuración correcta de la conexión del servidor a la consola vía api, la cual se realiza en el fichero de configuración del servidor.</li>
<li>_modulegraphth_<i>n</i>h_:mismo funcionamiento que la macro anterior solo que con los umbrales critical y warning del modulo siempre que estos esten definidos</li>
<li>_homeurl_ : Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.</li> <li>_homeurl_ : Es un link de la URL pública esta debe de estar configurada en las opciones generales del setup.</li>
</ul> </ul>
<p> <p>

View File

@ -47,6 +47,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.</li> <li>_event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.</li>
<li>_id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.</li> <li>_id_agent_: ID del agente, util para construir URL de acceso a la consola de Pandora.</li>
<li>_id_group_ : Id del grupo de agente.</li> <li>_id_group_ : Id del grupo de agente.</li>
<li>_id_module_ : ID del módulo.</li>
<li>_id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.</li> <li>_id_alert_: ID de la alerta, util para correlar la alerta en herramientas de terceros.</li>
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li> <li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
<li>_interval_: Intervalo de la ejecución del módulo. </li> <li>_interval_: Intervalo de la ejecución del módulo. </li>

View File

@ -177,7 +177,7 @@ function show_response_dialog(event_id, response_id, response) {
draggable: true, draggable: true,
modal: false, modal: false,
open: function(event, ui) { open: function(event, ui) {
perform_response(response['target']); perform_response(response['target'], response_id);
}, },
width: response['modal_width'], width: response['modal_width'],
height: response['modal_height'] height: response['modal_height']
@ -336,7 +336,7 @@ function get_response_target(event_id, response_id, server_id) {
} }
// Perform a response and put the output into a div // Perform a response and put the output into a div
function perform_response(target) { function perform_response(target, response_id) {
var ajax_file = $('#hidden-ajax_file').val(); var ajax_file = $('#hidden-ajax_file').val();
$('#re_exec_command').hide(); $('#re_exec_command').hide();
@ -351,6 +351,7 @@ function perform_response(target) {
params.push("page=include/ajax/events"); params.push("page=include/ajax/events");
params.push("perform_event_response=1"); params.push("perform_event_response=1");
params.push("target="+target); params.push("target="+target);
params.push("response_id="+response_id)
jQuery.ajax ({ jQuery.ajax ({
data: params.join ("&"), data: params.join ("&"),

View File

@ -19,6 +19,7 @@ function snmpBrowse () {
var community = $('#text-community').val(); var community = $('#text-community').val();
var starting_oid = $('#text-starting_oid').val(); var starting_oid = $('#text-starting_oid').val();
var snmp_version = $('#snmp_browser_version').val(); var snmp_version = $('#snmp_browser_version').val();
var server_to_exec = $('#server_to_exec').val();
var snmp3_auth_user = $('#text-snmp3_browser_auth_user').val(); var snmp3_auth_user = $('#text-snmp3_browser_auth_user').val();
var snmp3_security_level = $('#snmp3_browser_security_level').val(); var snmp3_security_level = $('#snmp3_browser_security_level').val();
var snmp3_auth_method = $('#snmp3_browser_auth_method').val(); var snmp3_auth_method = $('#snmp3_browser_auth_method').val();
@ -33,6 +34,7 @@ function snmpBrowse () {
"community=" + community, "community=" + community,
"starting_oid=" + starting_oid, "starting_oid=" + starting_oid,
"snmp_browser_version=" + snmp_version, "snmp_browser_version=" + snmp_version,
"server_to_exec=" + server_to_exec,
"snmp3_browser_auth_user=" + snmp3_auth_user, "snmp3_browser_auth_user=" + snmp3_auth_user,
"snmp3_browser_security_level=" + snmp3_security_level, "snmp3_browser_security_level=" + snmp3_security_level,
"snmp3_browser_auth_method=" + snmp3_auth_method, "snmp3_browser_auth_method=" + snmp3_auth_method,

View File

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

View File

@ -236,7 +236,7 @@ class User {
$ui->contentAddHtml('<div style="text-align: center;" class="login_logo">' . $ui->contentAddHtml('<div style="text-align: center;" class="login_logo">' .
$logo_image . '</div>'); $logo_image . '</div>');
$ui->contentAddHtml('<div id="login_container">'); $ui->contentAddHtml('<div id="login_container">');
$ui->beginForm(); $ui->beginForm('');
$ui->formAddHtml(html_print_input_hidden('action', 'login', true)); $ui->formAddHtml(html_print_input_hidden('action', 'login', true));
$options = array( $options = array(
'name' => 'user', 'name' => 'user',

View File

@ -191,6 +191,11 @@ switch ($action) {
$l10n = new gettext_reader (new CachedFileReader('../include/languages/'.$user_language.'.mo')); $l10n = new gettext_reader (new CachedFileReader('../include/languages/'.$user_language.'.mo'));
$l10n->load_tables(); $l10n->load_tables();
} }
if($_GET['page'] != ''){
header('refresh:0; url=http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}
if (class_exists("HomeEnterprise")) if (class_exists("HomeEnterprise"))
$home = new HomeEnterprise(); $home = new HomeEnterprise();
else else
@ -211,6 +216,11 @@ switch ($action) {
$l10n = new gettext_reader (new CachedFileReader('../include/languages/'.$user_language.'.mo')); $l10n = new gettext_reader (new CachedFileReader('../include/languages/'.$user_language.'.mo'));
$l10n->load_tables(); $l10n->load_tables();
} }
if($_GET['page'] != ''){
header('refresh:0; url=http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}
if (class_exists("HomeEnterprise")) if (class_exists("HomeEnterprise"))
$home = new HomeEnterprise(); $home = new HomeEnterprise();
else else

View File

@ -621,11 +621,8 @@ foreach ($agents as $agent) {
if (enterprise_installed()) { if (enterprise_installed()) {
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) { if (enterprise_hook('config_agents_has_remote_configuration',array($agent["id_agente"]))) {
$data[10] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=remote_configuration&id_agente='.$agent["id_agente"].'&disk_conf=1">'.html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config'))).'</a>';
$data[10] = html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Remote config')));
} }
} }
@ -696,4 +693,4 @@ $(document).ready (function () {
$(".agent"+$(this)[0].className).css('visibility', 'hidden'); $(".agent"+$(this)[0].className).css('visibility', 'hidden');
}); });
}); });
</script> </script>

View File

@ -120,7 +120,8 @@ if ($searchModules) {
) )
AND AND
(t1.nombre COLLATE utf8_general_ci LIKE "%' . $stringSearchSQL . '%" OR (t1.nombre COLLATE utf8_general_ci LIKE "%' . $stringSearchSQL . '%" OR
t3.nombre LIKE "%' . $stringSearchSQL . '%")'; t3.nombre LIKE "%' . $stringSearchSQL . '%")
AND t1.disabled = 0';
break; break;
case "postgresql": case "postgresql":
$chunk_sql = ' $chunk_sql = '

View File

@ -27,6 +27,7 @@ if (is_ajax()) {
$target_ip = (string) get_parameter ("target_ip", ''); $target_ip = (string) get_parameter ("target_ip", '');
$community = (string) get_parameter ("community", ''); $community = (string) get_parameter ("community", '');
$snmp_version = (string) get_parameter ("snmp_browser_version", ''); $snmp_version = (string) get_parameter ("snmp_browser_version", '');
$server_to_exec = (int) get_parameter ("server_to_exec", 0);
$snmp3_auth_user = get_parameter('snmp3_browser_auth_user'); $snmp3_auth_user = get_parameter('snmp3_browser_auth_user');
$snmp3_security_level = get_parameter('snmp3_browser_security_level'); $snmp3_security_level = get_parameter('snmp3_browser_security_level');
$snmp3_auth_method = get_parameter('snmp3_browser_auth_method'); $snmp3_auth_method = get_parameter('snmp3_browser_auth_method');
@ -41,7 +42,8 @@ if (is_ajax()) {
$snmp_tree = snmp_browser_get_tree( $snmp_tree = snmp_browser_get_tree(
$target_ip, $community, $starting_oid, $snmp_version, $target_ip, $community, $starting_oid, $snmp_version,
$snmp3_auth_user, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_user, $snmp3_security_level, $snmp3_auth_method,
$snmp3_auth_pass, $snmp3_privacy_method, $snmp3_privacy_pass); $snmp3_auth_pass, $snmp3_privacy_method, $snmp3_privacy_pass,
$server_to_exec);
if (! is_array ($snmp_tree)) { if (! is_array ($snmp_tree)) {
echo $snmp_tree; echo $snmp_tree;
} }

View File

@ -2,8 +2,8 @@
# Pandora FMS Console # Pandora FMS Console
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.710 %define version 7.0NG.711
%define release 170816 %define release 170901
# 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

@ -2,8 +2,8 @@
# Pandora FMS Console # Pandora FMS Console
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.710 %define version 7.0NG.711
%define release 170816 %define release 170901
%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

@ -976,6 +976,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
`my_modules` int(11) NOT NULL default 0, `my_modules` int(11) NOT NULL default 0,
`server_keepalive` int(11) NOT NULL default 0, `server_keepalive` int(11) NOT NULL default 0,
`stat_utimestamp` bigint(20) NOT NULL default '0', `stat_utimestamp` bigint(20) NOT NULL default '0',
`exec_proxy` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY (`id_server`), PRIMARY KEY (`id_server`),
KEY `name` (`name`) KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1844,6 +1845,7 @@ CREATE TABLE IF NOT EXISTS `tevent_response` (
`modal_height` INTEGER NOT NULL DEFAULT 0, `modal_height` INTEGER NOT NULL DEFAULT 0,
`new_window` TINYINT(4) NOT NULL DEFAULT 0, `new_window` TINYINT(4) NOT NULL DEFAULT 0,
`params` TEXT NOT NULL, `params` TEXT NOT NULL,
`server_to_exec` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -1150,7 +1150,7 @@ INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0,0),(2,'Depar
INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','',''),(2,'critical','Critical&#x20;modules','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','',''),(5,'configuration','','','',''); INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','',''),(2,'critical','Critical&#x20;modules','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','',''),(5,'configuration','','','','');
INSERT INTO `tevent_response` VALUES (1,'Ping&#x20;to&#x20;host','Ping&#x20;to&#x20;the&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_agent_address_','command',0,620,500,0,''),(2,'SSH&#x20;to&#x20;host','Connect&#x20;via&#x20;SSH&#x20;to&#x20;the&#x20;agent','http://localhost:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;the&#x20;standard&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS','index.php?sec=workspace&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event=_event_id_','url',0,0,0,1,''),(4,'Create&#x20;Integria&#x20;IMS&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;integria&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS.&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Is&#x20;necessary&#x20;to&#x20;enable&#x20;and&#x20;configure&#x20;the&#x20;Integria&#x20;incidents&#x20;in&#x20;Pandora&#x20;FMS&#x20;setup.','index.php?sec=workspace&amp;sec2=operation/integria_incidents/incident&amp;tab=editor&amp;from_event=_event_id_','url',0,0,0,1,''),(5,'Restart&#x20;agent','Restart&#x20;the&#x20;agent&#x20;with&#x20;using&#x20;UDP&#x20;protocol.&#x0d;&#x0a;&#x0d;&#x0a;To&#x20;use&#x20;this&#x20;response&#x20;is&#x20;necessary&#x20;to&#x20;have&#x20;installed&#x20;Pandora&#x20;FMS&#x20;server&#x20;and&#x20;console&#x20;in&#x20;the&#x20;same&#x20;machine.','/usr/share/pandora_server/util/udp_client.pl&#x20;_agent_address_&#x20;41122&#x20;&quot;REFRESH&#x20;AGENT&quot;','command',0,620,500,0,''),(6,'Ping&#x20;to&#x20;module&#x20;agent&#x20;host','Ping&#x20;to&#x20;the&#x20;module&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_module_address_','command',0,620,500,0,''); INSERT INTO `tevent_response` VALUES (1,'Ping&#x20;to&#x20;host','Ping&#x20;to&#x20;the&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_agent_address_','command',0,620,500,0,'',0),(2,'SSH&#x20;to&#x20;host','Connect&#x20;via&#x20;SSH&#x20;to&#x20;the&#x20;agent','http://localhost:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User',0),(3,'Create&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;the&#x20;standard&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS','index.php?sec=workspace&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event=_event_id_','url',0,0,0,1,'',0),(4,'Create&#x20;Integria&#x20;IMS&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;integria&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS.&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Is&#x20;necessary&#x20;to&#x20;enable&#x20;and&#x20;configure&#x20;the&#x20;Integria&#x20;incidents&#x20;in&#x20;Pandora&#x20;FMS&#x20;setup.','index.php?sec=workspace&amp;sec2=operation/integria_incidents/incident&amp;tab=editor&amp;from_event=_event_id_','url',0,0,0,1,'',0),(5,'Restart&#x20;agent','Restart&#x20;the&#x20;agent&#x20;with&#x20;using&#x20;UDP&#x20;protocol.&#x0d;&#x0a;&#x0d;&#x0a;To&#x20;use&#x20;this&#x20;response&#x20;is&#x20;necessary&#x20;to&#x20;have&#x20;installed&#x20;Pandora&#x20;FMS&#x20;server&#x20;and&#x20;console&#x20;in&#x20;the&#x20;same&#x20;machine.','/usr/share/pandora_server/util/udp_client.pl&#x20;_agent_address_&#x20;41122&#x20;&quot;REFRESH&#x20;AGENT&quot;','command',0,620,500,0,'',0),(6,'Ping&#x20;to&#x20;module&#x20;agent&#x20;host','Ping&#x20;to&#x20;the&#x20;module&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_module_address_','command',0,620,500,0,'',0);
INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', ''); INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key', 'PANDORA-FREE'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.710-170816 Version: 7.0NG.711-170901
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.710-170816" pandora_version="7.0NG.711-170901"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -42,8 +42,8 @@ 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.710"; my $pandora_version = "7.0NG.711";
my $pandora_build = "170816"; my $pandora_build = "170901";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -5083,15 +5083,26 @@ sub pandora_set_event_storm_protection ($) {
########################################################################## ##########################################################################
sub pandora_update_agent_module_count ($$$) { sub pandora_update_agent_module_count ($$$) {
my ($pa_config, $dbh, $agent_id) = @_; my ($pa_config, $dbh, $agent_id) = @_;
my $total = 0;
db_do ($dbh, 'UPDATE tagente SET update_module_count=0, my $counts = {
normal_count=(SELECT COUNT(*) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=' . $agent_id . ' AND estado=0), '0' => 0,
critical_count=(SELECT COUNT(*) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=' . $agent_id . ' AND estado=1), '1' => 0,
warning_count=(SELECT COUNT(*) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=' . $agent_id . ' AND estado=2), '2' => 0,
unknown_count=(SELECT COUNT(*) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=' . $agent_id . ' AND estado=3), '3' => 0,
notinit_count=(SELECT COUNT(*) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=' . $agent_id . ' AND estado=4), '4' => 0,
total_count=(SELECT COUNT(*) FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=' . $agent_id . }; # Module counts by status.
') WHERE id_agente = ' . $agent_id);
# Retrieve and hash module status counts.
my @rows = get_db_rows ($dbh, 'SELECT estado, COUNT(*) AS total FROM tagente_modulo, tagente_estado WHERE tagente_modulo.disabled=0 AND tagente_modulo.id_agente_modulo=tagente_estado.id_agente_modulo AND tagente_modulo.id_agente=?GROUP BY estado', $agent_id);
foreach my $row (@rows) {
$counts->{$row->{'estado'}} = $row->{'total'};
$total += $row->{'total'};
}
# Update the agent.
db_do ($dbh, 'UPDATE tagente
SET update_module_count=0, normal_count=?, critical_count=?, warning_count=?, unknown_count=?, notinit_count=?, total_count=?
WHERE id_agente = ?', $counts->{'0'}, $counts->{'1'}, $counts->{'2'}, $counts->{'3'}, $counts->{'4'}, $total, $agent_id);
# Sync the agent cache every time the module count is updated. # Sync the agent cache every time the module count is updated.
enterprise_hook('update_agent_cache', [$pa_config, $dbh, $agent_id]) if ($pa_config->{'node_metaconsole'} == 1); enterprise_hook('update_agent_cache', [$pa_config, $dbh, $agent_id]) if ($pa_config->{'node_metaconsole'} == 1);

View File

@ -2,8 +2,8 @@
# Pandora FMS Server # Pandora FMS Server
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.710 %define version 7.0NG.711
%define release 170816 %define release 170901
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -2,8 +2,8 @@
# Pandora FMS Server # Pandora FMS Server
# #
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.710 %define version 7.0NG.711
%define release 170816 %define release 170901
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -8,8 +8,8 @@
# This code is licensed under GPL 2.0 license. # This code is licensed under GPL 2.0 license.
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.710" PI_VERSION="7.0NG.711"
PI_BUILD="170816" PI_BUILD="170901"
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.710 PS170816"; my $version = "7.0NG.711 PS170901";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -35,7 +35,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.710 PS170816"; my $version = "7.0NG.711 PS170901";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -173,11 +173,11 @@ sub help_screen{
help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system'); help_screen_line('--enable_eacl', '', 'Enable enterprise ACL system');
help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user'); help_screen_line('--disable_double_auth', '<user_name>', 'Disable the double authentication for the specified user');
print "\nEVENTS:\n\n" unless $param ne ''; print "\nEVENTS:\n\n" unless $param ne '';
help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <custom_data_json>]", 'Add event'); help_screen_line('--create_event', "<event> <event_type> <group_name> [<agent_name> <module_name>\n\t <event_status> <severity> <template_name> <user_name> <comment> \n\t <source> <id_extra> <tags> <critical_instructions> <warning_instructions> <unknown_instructions> \n\t <custom_data_json> <force_create_agent>]", 'Add event');
help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name>", 'Validate events'); help_screen_line('--validate_event', "<agent_name> <module_name> <datetime_min> <datetime_max>\n\t <user_name> <criticity> <template_name>", 'Validate events');
help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id'); help_screen_line('--validate_event_id', '<event_id>', 'Validate event given a event id');
help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id'); help_screen_line('--get_event_info', '<event_id>[<csv_separator>]', 'Show info about a event given a event id');
help_screen_line('--add_event_comment', '<event_id> <user_name> <comment>', 'Add event\'s comment'); help_screen_line('--add_event_comment', '<event_id> <user_name> <comment>', 'Add event\'s comment');
print "\nINCIDENTS:\n\n" unless $param ne ''; print "\nINCIDENTS:\n\n" unless $param ne '';
help_screen_line('--create_incident', "<title> <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents'); help_screen_line('--create_incident', "<title> <description> <origin> <status> <priority 0 for Informative, \n\t 1 for Low, 2 for Medium, 3 for Serious, 4 for Very serious or 5 for Maintenance>\n\t <group> [<owner>]", 'Create incidents');
print "\nPOLICIES:\n\n" unless $param ne ''; print "\nPOLICIES:\n\n" unless $param ne '';
@ -3063,14 +3063,14 @@ sub cli_delete_profile() {
############################################################################## ##############################################################################
sub cli_create_event() { sub cli_create_event() {
my ($event,$event_type,$group_name,$agent_name,$module_name,$event_status,$severity,$template_name, $user_name, $comment, $source, $id_extra, $tags, $custom_data) = @ARGV[2..15]; my ($event,$event_type,$group_name,$agent_name,$module_name,$event_status,$severity,$template_name, $user_name, $comment, $source, $id_extra, $tags, $custom_data,$force_create_agent,$c_instructions,$w_instructions,$u_instructions) = @ARGV[2..19];
$event_status = 0 unless defined($event_status); $event_status = 0 unless defined($event_status);
$severity = 0 unless defined($severity); $severity = 0 unless defined($severity);
my $id_user; my $id_user;
if (!defined($user_name)) { if (!defined($user_name) || $user_name eq '') {
$id_user = 0; $id_user = 0;
} }
else { else {
@ -3095,7 +3095,18 @@ sub cli_create_event() {
} }
else { else {
$id_agent = get_agent_id($dbh,$agent_name); $id_agent = get_agent_id($dbh,$agent_name);
exist_check($id_agent,'agent',$agent_name); # exist_check($id_agent,'agent',$agent_name);
if($id_agent == -1){
if($force_create_agent == 1){
pandora_create_agent ($conf, '', $agent_name, '', '', '', '', 'Created by cli_create_event', '', $dbh);
print_log "[INFO] Adding agent '$agent_name' \n\n";
$id_agent = get_agent_id($dbh,$agent_name);
}
else{
exist_check($id_agent,'agent',$agent_name);
}
}
} }
my $id_agentmodule; my $id_agentmodule;
@ -3129,7 +3140,7 @@ sub cli_create_event() {
$custom_data = encode_base64 ($custom_data); $custom_data = encode_base64 ($custom_data);
pandora_event ($conf, $event, $id_group, $id_agent, $severity, pandora_event ($conf, $event, $id_group, $id_agent, $severity,
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra, $tags, '', '', '', $custom_data); $id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, $comment, $id_extra, $tags, $c_instructions, $w_instructions, $u_instructions, $custom_data);
} }
############################################################################## ##############################################################################
@ -3212,8 +3223,13 @@ sub cli_get_event_info () {
exist_check($event_name,'event',$id_event); exist_check($event_name,'event',$id_event);
$csv_separator = '|' unless defined($csv_separator); $csv_separator = '|' unless defined($csv_separator);
my $event_table = "tevento";
if (is_metaconsole($conf) == 1) {
$event_table = "tmetaconsole_event";
}
my $query = "SELECT * FROM tevento where id_evento=".$id_event; my $query = "SELECT * FROM " . $event_table . " where id_evento=" . $id_event;
my $header = "Event ID".$csv_separator."Event name".$csv_separator."Agent ID".$csv_separator."User ID".$csv_separator. my $header = "Event ID".$csv_separator."Event name".$csv_separator."Agent ID".$csv_separator."User ID".$csv_separator.
"Group ID".$csv_separator."Status".$csv_separator."Timestamp".$csv_separator."Event type".$csv_separator. "Group ID".$csv_separator."Status".$csv_separator."Timestamp".$csv_separator."Event type".$csv_separator.
@ -4560,7 +4576,12 @@ sub cli_set_event_storm_protection () {
sub pandora_get_event_name($$) { sub pandora_get_event_name($$) {
my ($dbh,$id_event) = @_; my ($dbh,$id_event) = @_;
my $event_name = get_db_value($dbh, 'SELECT evento FROM tevento WHERE id_evento = ?',$id_event); my $event_table = "tevento";
if (is_metaconsole($conf) == 1) {
$event_table = "tmetaconsole_event";
}
my $event_name = get_db_value($dbh, 'SELECT evento FROM ' . $event_table . ' WHERE id_evento = ?',$id_event);
return defined ($event_name) ? $event_name : -1; return defined ($event_name) ? $event_name : -1;
} }
@ -4571,7 +4592,12 @@ sub pandora_get_event_name($$) {
sub pandora_update_event_from_hash ($$$$) { sub pandora_update_event_from_hash ($$$$) {
my ($parameters, $where_column, $where_value, $dbh) = @_; my ($parameters, $where_column, $where_value, $dbh) = @_;
my $event_id = db_process_update($dbh, 'tevento', $parameters, {$where_column => $where_value}); my $event_table = "tevento";
if (is_metaconsole($conf) == 1) {
$event_table = "tmetaconsole_event";
}
my $event_id = db_process_update($dbh, $event_table, $parameters, {$where_column => $where_value});
return $event_id; return $event_id;
} }
@ -4582,7 +4608,12 @@ sub pandora_update_event_from_hash ($$$$) {
sub pandora_get_event_comment($$) { sub pandora_get_event_comment($$) {
my ($dbh,$id_event) = @_; my ($dbh,$id_event) = @_;
my $event_name = get_db_value($dbh, 'SELECT user_comment FROM tevento WHERE id_evento = ?',$id_event); my $event_table = "tevento";
if (is_metaconsole($conf) == 1) {
$event_table = "tmetaconsole_event";
}
my $event_name = get_db_value($dbh, 'SELECT user_comment FROM ' . $event_table . ' WHERE id_evento = ?',$id_event);
return defined ($event_name) ? $event_name : -1; return defined ($event_name) ? $event_name : -1;
} }
@ -4860,7 +4891,7 @@ sub pandora_manage_main ($$$) {
cli_delete_profile(); cli_delete_profile();
} }
elsif ($param eq '--create_event') { elsif ($param eq '--create_event') {
param_check($ltotal, 14, 11); param_check($ltotal, 18, 15);
cli_create_event(); cli_create_event();
} }
elsif ($param eq '--validate_event') { elsif ($param eq '--validate_event') {

View File

@ -2,7 +2,7 @@ FROM pandorafms/pandorafms-base
MAINTAINER Pandora FMS Team <info@pandorafms.com> MAINTAINER Pandora FMS Team <info@pandorafms.com>
# Pandora FMS Server dependencies # Pandora FMS Server dependencies
RUN yum install -y fping perl-Test-WWW-Selenium RUN yum install -y fping perl-Test-WWW-Selenium perl-Crypt-ECB perl-Net-OpenSSH
RUN ln -s /usr/bin/braa /usr/local/bin/braa RUN ln -s /usr/bin/braa /usr/local/bin/braa