Merge remote-tracking branch 'origin/develop' into ent-6377-proyectos-amazon-s3-en-el-discovery

This commit is contained in:
fbsanchez 2021-03-22 15:16:10 +01:00
commit d73ba6a2e5
75 changed files with 1911 additions and 294 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.752-210317
Version: 7.0NG.752-210322
Architecture: all
Priority: optional
Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.752"
PI_BUILD="210317"
PI_BUILD="210322"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210317}
{210322}
ViewReadme
{Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.752-210317
Version: 7.0NG.752-210322
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -64,6 +64,16 @@ if (isset($config['console_log_enabled']) === true
ini_set('error_log', 0);
}
// Sometimes input is badly retrieved from caller...
if (empty($_REQUEST) === true) {
$data = explode('&', urldecode(file_get_contents('php://input')));
foreach ($data as $d) {
$r = explode('=', $d, 2);
$_POST[$r[0]] = $r[1];
$_GET[$r[0]] = $r[1];
}
}
// Hash login process.
if (isset($_GET['loginhash']) === true) {
$loginhash_data = get_parameter('loginhash_data', '');

View File

@ -11,4 +11,10 @@ UPDATE `tinventory_alert` t1 INNER JOIN `tinventory_alert` t2 ON t1.id = t2.id S
ALTER TABLE `tnotification_source` ADD COLUMN `subtype_blacklist` TEXT;
SET @plugin_name = 'Network bandwidth SNMP';
SET @plugin_description = 'Retrieves amount of digital information sent and received from device or filtered  interface index over a particular time (agent/module interval).';
SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,300,0,'perl /usr/share/pandora_server/util/plugin/pandora_snmp_bandwidth.pl','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"SNMP Version(1,2c,3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Interface Index (filter)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"securityName\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"context\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"securityLevel\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"authProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"authKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"privProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"privKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"13\":{\"macro\":\"_field13_\",\"desc\":\"UniqId\",\"help\":\"This plugin needs to store information in temporary directory to calculate bandwidth. Set here an unique identifier with no spaces or symbols.\",\"value\":\"\",\"hide\":\"\"},\"14\":{\"macro\":\"_field14_\",\"desc\":\"inUsage\",\"help\":\"Retrieve input usage (%)\",\"value\":\"\",\"hide\":\"\"},\"15\":{\"macro\":\"_field15_\",\"desc\":\"outUsage\",\"help\":\"Retrieve output usage (%)\",\"value\":\"\",\"hide\":\"\"}}','-version '_field1_' -community '_field2_' -host '_field3_' -port '_field4_' -ifIndex '_field5_' -securityName '_field6_' -context '_field7_' -securityLevel '_field8_' -authProtocol '_field9_' -authKey '_field10_' -privProtocol '_field11_' -privKey '_field12_' -uniqid '_field13_' -inUsage '_field14_' -outUsage '_field15_'');
COMMIT;

View File

@ -2880,6 +2880,12 @@ SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_wmi_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Namespace (Optional)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"User\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"WMI Class\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Fields list\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Query filter (Optional)\",\"help\":\"Use single quotes for query conditions\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Operation\",\"help\":\"Aritmetic operation to get data. Macros _fN_ will be changed by fields in list. Example: ((_f1_ - _f2_) * 100) / _f1_\",\"value\":\"\",\"hide\":\"\"}}','-host '_field1_' -namespace '_field2_' -user '_field3_' -pass '_field4_' -wmiClass '_field5_' -fieldsList '_field6_' -queryFilter "_field7_" -operation '_field8_' -wmicPath /usr/bin/wmic');
SET @plugin_name = 'Network bandwidth SNMP';
SET @plugin_description = 'Retrieves amount of digital information sent and received from device or filtered  interface index over a particular time (agent/module interval).';
SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,300,0,'perl /usr/share/pandora_server/util/plugin/pandora_snmp_bandwidth.pl','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"SNMP Version(1,2c,3)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Interface Index (filter)\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"securityName\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"context\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"securityLevel\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"authProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"authKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"privProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"privKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"13\":{\"macro\":\"_field13_\",\"desc\":\"UniqId\",\"help\":\"This plugin needs to store information in temporary directory to calculate bandwidth. Set here an unique identifier with no spaces or symbols.\",\"value\":\"\",\"hide\":\"\"},\"14\":{\"macro\":\"_field14_\",\"desc\":\"inUsage\",\"help\":\"Retrieve input usage (%)\",\"value\":\"\",\"hide\":\"\"},\"15\":{\"macro\":\"_field15_\",\"desc\":\"outUsage\",\"help\":\"Retrieve output usage (%)\",\"value\":\"\",\"hide\":\"\"}}','-version '_field1_' -community '_field2_' -host '_field3_' -port '_field4_' -ifIndex '_field5_' -securityName '_field6_' -context '_field7_' -securityLevel '_field8_' -authProtocol '_field9_' -authKey '_field10_' -privProtocol '_field11_' -privKey '_field12_' -uniqid '_field13_' -inUsage '_field14_' -outUsage '_field15_'');
SET @main_component_group_name = 'Wizard';
SET @component_id = '';
SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name;

View File

@ -175,7 +175,7 @@ if (!empty($result)) {
}
// Form to add new categories or search categories
echo "<div class='w100p right'>";
echo "<div class='w100p right_align'>";
if (defined('METACONSOLE')) {
echo '<form method="post" action="index.php?sec=advanced&sec2=godmode/category/edit_category&action=new&pure='.(int) $config['pure'].'">';
} else {

View File

@ -279,7 +279,7 @@ if (isset($data)) {
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
if (is_management_allowed() === true) {
echo "<div class='pdd_l_10px float-right'>";
echo "<div class='pdd_l_10px float-right mrgn_btn_15px'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
}

View File

@ -900,7 +900,7 @@ if (isset($data)) {
true,
'pagination-bottom'
);
echo "<div id='btn_delete_5'>";
echo "<div id='btn_delete_5' class='float-right'>";
html_print_submit_button(
__('Delete'),
'delete_btn',
@ -918,8 +918,8 @@ if (isset($data)) {
);
}
echo '<form method="post" action="'.$url.'" class="float-right">';
echo '<div class="right">';
echo '<form method="post" action="'.$url.'">';
echo '<div class="right_align mrgn_btn_15px">';
html_print_input_hidden('new_component', 1);
html_print_select(
[

View File

@ -132,7 +132,7 @@ if ($edit_container) {
$id_parent = get_parameter('id_parent', 0);
$description = io_safe_input(get_parameter('description', ''));
$id_group = get_parameter('container_id_group', 0);
} else {
} else if ((bool) $id_container !== false) {
$tcontainer = db_get_row_sql('SELECT * FROM tcontainer WHERE id_container = '.$id_container);
$name = $tcontainer['name'];
$id_parent = $tcontainer['parent'];
@ -142,13 +142,21 @@ if ($edit_container) {
}
if ($add_container) {
$values = [
'name' => $name,
'description' => $description,
'parent' => $id_parent,
'id_group' => $id_group,
];
$id_container = db_process_sql_insert('tcontainer', $values);
if ((bool) $name !== false) {
$values = [
'name' => $name,
'description' => $description,
'parent' => $id_parent,
'id_group' => $id_group,
];
$id_container = db_process_sql_insert('tcontainer', $values);
} else {
$error = ui_print_error_message(
__('Container name is missing.'),
'',
true
);
}
}
if ($update_container) {
@ -195,6 +203,9 @@ ui_print_page_header(
if ($add_container) {
ui_print_result_message($id_container, __('Container stored successfully'), __('There was a problem storing container'));
if (empty($error) === false) {
echo $error;
}
}
if ($update_container) {
@ -214,6 +225,8 @@ if ($id_container === '1') {
echo "<td class='datos w30p'><input type='text' name='name' size='30' disabled='1'";
} else {
echo "<td class='datos w30p'><input type='text' name='name' size='30' ";
// Using latest style...
echo ' required ';
}
if ($edit_container) {
@ -230,21 +243,31 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
echo "<td class='w10p'><b>".__('Group').'</b></td><td>';
echo '<div class="w250px">';
if ($id_container === '1') {
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', true);
} else {
echo html_print_select_groups($config['id_user'], '', $return_all_groups, 'container_id_group', $id_group, '', '', '', true, false, true, '', false);
}
echo html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
'privilege' => 'RW',
'returnAllGroup' => $return_all_groups,
'name' => 'container_id_group',
'selected' => $id_group,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => false,
'required' => true,
'disabled' => ($id_container === '1'),
]
);
echo '</div>';
echo '</td></tr>';
echo '<tr>';
echo "<td class='datos2'><b>".__('Description').'</b></td>';
if ($id_container === '1') {
echo "<td class='datos2' colspan=3><textarea name='description' class='height_45px' cols=95 rows=2 disabled>";
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2 disabled>";
} else {
echo "<td class='datos2' colspan=3><textarea name='description' class='height_45px' cols=95 rows=2>";
echo "<td class='datos2' colspan=3><textarea name='description' style='height:45px;' cols=95 rows=2>";
}
if ($edit_container) {
@ -400,8 +423,8 @@ if ($edit_container) {
$single_table .= '</td>';
$single_table .= '</tr>';
$single_table .= "<tr id='row_type_graphs' class='datos'>";
$single_table .= "<td class='bolder'>";
$single_table .= "<tr id='row_type_graphs' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;'>";
$single_table .= __('Type of graph');
$single_table .= '</td>';
$single_table .= '<td>';
@ -409,8 +432,8 @@ if ($edit_container) {
$single_table .= '</td>';
$single_table .= '</tr>';
$single_table .= "<tr id='row_fullscale' class='datos'>";
$single_table .= "<td class='bolder'>";
$single_table .= "<tr id='row_fullscale' style='' class='datos'>";
$single_table .= "<td style='font-weight:bold;'>";
$single_table .= __('Show full scale graph (TIP)').ui_print_help_tip('This option may cause performance issues', true);
$single_table .= '</td>';
$single_table .= '<td>';
@ -421,8 +444,8 @@ if ($edit_container) {
$single_table .= '<tr>';
$single_table .= '<td >';
$single_table .= '</td>';
$single_table .= "<td class='right'>";
$single_table .= "<input type=submit name='add_single' class='sub add right' value='".__('Add item')."'>";
$single_table .= "<td style='float:right;'>";
$single_table .= "<input style='float:right;' type=submit name='add_single' class='sub add' value='".__('Add item')."'>";
$single_table .= '</td>';
$single_table .= '</tr>';
$single_table .= '</table>';
@ -475,7 +498,7 @@ if ($edit_container) {
$data = [];
$data[0] = '';
$data[1] = "<input type=submit name='add_custom' class='sub add right' value='".__('Add item')."'>";
$data[1] = "<input style='float:right;' type=submit name='add_custom' class='sub add' value='".__('Add item')."'>";
$table->data[] = $data;
$table->rowclass[] = '';
@ -570,7 +593,7 @@ if ($edit_container) {
$data = [];
$data[0] = '';
$data[1] = "<input type=submit name='add_dynamic' class='sub add right' value='".__('Add item')."'>";
$data[1] = "<input style='float:right;' type=submit name='add_dynamic' class='sub add' value='".__('Add item')."'>";
$table->data[] = $data;
$table->rowclass[] = '';
@ -582,11 +605,13 @@ if ($edit_container) {
echo '</tr>';
echo '</table>';
$total_item = db_get_all_rows_sql('SELECT count(*) FROM tcontainer_item WHERE id_container = '.$id_container);
$result_item = db_get_all_rows_sql('SELECT * FROM tcontainer_item WHERE id_container = '.$id_container.' LIMIT 10 OFFSET '.$offset);
if ((bool) $id_container !== false) {
$total_item = db_get_all_rows_sql('SELECT count(*) FROM tcontainer_item WHERE id_container = '.$id_container);
$result_item = db_get_all_rows_sql('SELECT * FROM tcontainer_item WHERE id_container = '.$id_container.' LIMIT 10 OFFSET '.$offset);
}
if (!$result_item) {
echo "<div class='nf'>".__('There are no defined item container').'</div>';
echo "<div class='nf'>".__('There are no items in this container.').'</div>';
} else {
ui_pagination($total_item[0]['count(*)'], false, $offset, 10);
$table = new stdClass();
@ -655,7 +680,7 @@ if ($edit_container) {
}
$data[7] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/create_container&edit_container=1&delete_item=1&id_item='.$item['id_ci'].'&id='.$id_container.'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
array_push($table->data, $data);
}
@ -753,4 +778,4 @@ echo html_print_input_hidden('id_agent', 0);
});
});
</script>
</script>

View File

@ -94,7 +94,7 @@ if ($edit_graph) {
} else {
$id_agent = 0;
$id_module = 0;
$id_group = 0;
$id_group = null;
$period = SECONDS_1DAY;
$factor = 1;
$stacked = 4;
@ -142,28 +142,36 @@ if (users_can_manage_group_all('RW') === false
$output .= '<td><b>'.__('Group').'</b></td><td>';
if (check_acl($config['id_user'], 0, 'RW')) {
$output .= html_print_select_groups(
$config['id_user'],
'RW',
$return_all_group,
'graph_id_group',
$id_group,
'',
'',
'',
true
$output .= html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
'privilege' => 'RW',
'returnAllGroup' => $return_all_group,
'name' => 'graph_id_group',
'selected' => $id_group,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
);
} else if (check_acl($config['id_user'], 0, 'RM')) {
$output .= html_print_select_groups(
$config['id_user'],
'RM',
$return_all_group,
'graph_id_group',
$id_group,
'',
'',
'',
true
$output .= html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
'privilege' => 'RM',
'returnAllGroup' => $return_all_group,
'name' => 'graph_id_group',
'selected' => $id_group,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
);
}

View File

@ -517,7 +517,7 @@ if ($maps) {
if (!is_metaconsole()) {
echo '<div class="action-buttons w100p right">';
} else {
echo '<div class="w100p right">';
echo '<div class="w100p right_align">';
}
}

View File

@ -121,16 +121,20 @@ if (users_can_manage_group_all('RW') === true) {
}
$table->data['group'][1] = '<div class="w290px inline">';
$table->data['group'][1] .= html_print_select_groups(
$config['id_user'],
'AR',
$return_all_group,
'id_group',
$idGroupReport,
'',
'',
'',
true
$table->data['group'][1] .= html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
'privilege' => 'AR',
'returnAllGroup' => $return_all_group,
'name' => 'id_group',
'selected' => $idGroupReport,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
);
$table->data['group'][1] .= '</div>';

View File

@ -1211,7 +1211,7 @@ switch ($action) {
switch ($activeTab) {
case 'main':
$reportName = '';
$idGroupReport = 0;
$idGroupReport = null;
// All groups.
$description = '';
$resultOperationDB = null;

View File

@ -141,16 +141,20 @@ if (users_can_manage_group_all('RW') === true) {
$return_all_group = true;
}
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'],
'RW',
$return_all_group,
'id_group',
$idGroup,
'',
'',
'',
true
$table->data[1][1] = '<div class="w250px">'.html_print_input(
[
'type' => 'select_groups',
'id_user' => $config['id_user'],
'privilege' => 'RW',
'returnAllGroup' => $return_all_group,
'name' => 'id_group',
'selected' => $idGroup,
'script' => '',
'nothing' => '',
'nothing_value' => '',
'return' => true,
'required' => true,
]
).'</div>';
$backgrounds_list = list_files(
$config['homedir'].'/images/console/background/',
@ -433,4 +437,4 @@ $(document).ready (function () {
}
});
</script>
</script>

View File

@ -97,6 +97,13 @@ if (isset($_GET['server'])) {
echo '<div class="action-buttons w100p">';
echo '<input type="submit" class="sub upd" value="'.__('Update').'">';
echo '</div>';
echo '</form>';
if ($row['server_type'] == 13) {
echo '<div style="margin-top: 20px;">';
ui_toggle($content, __('Credential boxes'), '', 'toggle_credential', false);
echo '</div>';
}
} else if (isset($_GET['server_remote'])) {
// Headers.
$id_server = get_parameter_get('server_remote');
@ -224,11 +231,148 @@ if (isset($_GET['server'])) {
<script language="javascript" type="text/javascript">
$(document).ready (function () {
var id_server = <?php echo $id_server; ?>;
var server_type = <?php echo $row['server_type']; ?>;
$("#check_exec_server img").on("click", function () {
$("#check_exec_server img").attr("src", "images/spinner.gif");
check_process("<?php echo $id_server; ?>");
check_process(id_server);
});
if (server_type == 13) {
load_credential_boxes();
}
function load_credential_boxes () {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['load_credential_boxes'] = 1;
parameters['id_server'] = id_server;
parameters['server_name'] = "<?php echo $row['name']; ?>";
jQuery.get(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html(data);
$("#submit-add").click(function (e) {
add_credential_boxes();
});
$("[id^=delete-]").click(function (e) {
delete_credential_boxes(e.currentTarget.id);
});
$("[id^=update-]").click(function (e) {
load_update_credential_boxes(e.currentTarget.id);
});
},
"html"
);
}
function add_credential_boxes () {
$(".white-box-content").html('');
var parameters2 = {};
parameters2['page'] = 'enterprise/include/ajax/servers.ajax';
parameters2['add_credential_boxes'] = 1;
jQuery.get(
"ajax.php",
parameters2,
function (data2) {
$(".white-box-content").html(data2);
// Insert credential
$("#submit-add").click(function (e) {
save_credential_boxes();
})
},
"html"
);
}
function save_credential_boxes () {
var parameters3 = {};
parameters3['page'] = 'enterprise/include/ajax/servers.ajax';
parameters3['save_credential_boxes'] = 1;
parameters3['subnet'] = $("#text-subnet").val();
parameters3['name'] = $("#text-name").val();
parameters3['pass'] = $("#password-pass").val();
parameters3['server_name'] = "<?php echo $row['name']; ?>";
jQuery.post(
"ajax.php",
parameters3,
function (data3) {
$(".white-box-content").html('');
load_credential_boxes();
},
"html"
);
}
function delete_credential_boxes (datas) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['delete_credential_boxes'] = 1;
parameters['server_name'] = "<?php echo $row['name']; ?>";
parameters['datas'] = datas;
jQuery.post(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html('');
load_credential_boxes();
},
"html"
);
}
function load_update_credential_boxes (datas) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['load_update_credential_boxes'] = 1;
parameters['datas'] = datas;
jQuery.get(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html(data);
$("#submit-update").click(function (e) {
update_credential_boxes(datas);
});
},
"html"
);
}
function update_credential_boxes(datas) {
var parameters = {};
parameters['page'] = 'enterprise/include/ajax/servers.ajax';
parameters['update_credential_boxes'] = 1;
parameters['subnet'] = $("#text-subnet").val();
parameters['name'] = $("#text-name").val();
parameters['pass'] = $("#password-pass").val();
parameters['server_name'] = "<?php echo $row['name']; ?>";
parameters['old_datas'] = datas;
jQuery.post(
"ajax.php",
parameters,
function (data) {
$(".white-box-content").html('');
load_credential_boxes();
},
"html"
);
}
});
function check_process (id_server) {

View File

@ -105,7 +105,7 @@ if (is_metaconsole()) {
$table->data = [];
$table->data[0][0] = '<strong>'.__('Customer key').'</strong>';
$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'class="height_50px w450px"', true);
$table->data[0][1] = html_print_textarea('keys[customer_key]', 10, 255, $settings->customer_key, 'style="width: 450px" class="height_50px w450px"', true);
$table->data[1][0] = '<strong>'.__($license['expiry_caption']).'</strong>';
$table->data[1][1] = html_print_input_text('expires', $license['expiry_date'], '', 10, 255, true, true);

View File

@ -761,6 +761,16 @@ class DiscoveryTaskList extends HTML
$data[6] .= __('Discovery.Agent.Deployment');
break;
case DISCOVERY_APP_MICROSOFT_SQL_SERVER:
// Discovery Applications Oracle.
$data[6] = html_print_image(
'images/network.png',
true,
['title' => __('Discovery Applications Microsoft SQL Server')]
).'&nbsp;&nbsp;';
$data[6] .= __('Discovery.App.Microsoft SQL Server');
break;
case DISCOVERY_HOSTDEVICES:
default:
if ($task['id_recon_script'] == 0) {
@ -1042,6 +1052,9 @@ class DiscoveryTaskList extends HTML
case DISCOVERY_APP_MYSQL:
return 'wiz=app&mode=mysql&page=0';
case DISCOVERY_APP_MICROSOFT_SQL_SERVER:
return 'wiz=app&mode=MicrosoftSQLServer&page=0';
case DISCOVERY_APP_ORACLE:
return 'wiz=app&mode=oracle&page=0';

View File

@ -937,8 +937,8 @@ class AgentWizard extends HTML
$ipsResult = [];
// In this case we need the full information provided by snmpwalk.
$ipsResult = $this->snmpwalkValues($snmpIpDiscover, false, true);
$indexes = $this->snmpwalkValues($snmpIpIndexes, false, true);
$ipsResult = $this->snmpWalkValues($snmpIpDiscover, false, true);
$indexes = $this->snmpWalkValues($snmpIpIndexes, false, true);
$unicastIpReferences = [];
foreach ($indexes as $k => $v) {
@ -960,11 +960,11 @@ class AgentWizard extends HTML
// Set the name of interface.
$interfaces[$indexKey]['name'] = $name;
// Get the description.
$interfaces[$indexKey]['descr'] = $this->snmpgetValue(
$interfaces[$indexKey]['descr'] = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.2.'.$indexKey
);
// Get the MAC address.
$interfaces[$indexKey]['mac'] = $this->snmpgetValue(
$interfaces[$indexKey]['mac'] = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.6.'.$indexKey
);
// Get unicast IP address.
@ -972,6 +972,16 @@ class AgentWizard extends HTML
if (isset($unicastIpReferences[$indexKey]) === true) {
$interfaces[$indexKey]['ip'] = '';
}
// Get interface alias.
$interfaces[$indexKey]['alias'] = $this->snmpGetValue(
'.1.3.6.1.2.1.31.1.1.1.18.'.$indexKey
);
// Get interface speed.
$interfaces[$indexKey]['speed'] = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.5.'.$indexKey
);
}
// Save the interfaces found for process later.
@ -1035,7 +1045,7 @@ class AgentWizard extends HTML
if ($this->wizardSection === 'snmp_interfaces_explorer') {
// Check if thereis x64 counters.
$snmp_tmp = '.1.3.6.1.2.1.31.1.1.1.6';
$check_x64 = $this->snmpwalkValues(
$check_x64 = $this->snmpWalkValues(
$snmp_tmp,
false,
true
@ -1051,7 +1061,7 @@ class AgentWizard extends HTML
// Explore interface names.
$oidExplore = '.1.3.6.1.2.1.31.1.1.1.1';
$receivedOid = $this->snmpwalkValues(
$receivedOid = $this->snmpWalkValues(
$oidExplore,
false,
true
@ -1062,7 +1072,7 @@ class AgentWizard extends HTML
}
// Doc Interfaces de red.
$receivedOid = $this->snmpwalkValues(
$receivedOid = $this->snmpWalkValues(
$oidExplore,
false,
false
@ -1073,7 +1083,7 @@ class AgentWizard extends HTML
$oidExplore = '1.3.6.1.2.1.2.2.1.2';
// Doc Interfaces de red.
$receivedOid = $this->snmpwalkValues(
$receivedOid = $this->snmpWalkValues(
$oidExplore,
false,
true
@ -1339,7 +1349,6 @@ class AgentWizard extends HTML
$content .= html_print_table($table, true);
echo $content;
return;
}
@ -1431,6 +1440,18 @@ class AgentWizard extends HTML
$result[$value]['description'] = $data['module-default_description-'.$key];
} else if (empty(preg_match('/module-value/', $k)) === false) {
$result[$value]['value'] = $data['module-value-'.$key];
} else if (empty(preg_match('/module-macros/', $k)) === false) {
$result[$value]['macros'] = $data['module-macros-'.$key];
continue;
} else if (empty(preg_match('/module-id_plugin/', $k)) === false) {
$result[$value]['id_plugin'] = $data['module-id_plugin-'.$key];
continue;
} else if (empty(preg_match('/module-id_modulo/', $k)) === false) {
$result[$value]['id_modulo'] = $data['module-id_modulo-'.$key];
continue;
} else if (empty(preg_match('/module-unit/', $k)) === false) {
$result[$value]['unit'] = $data['module-unit-'.$key];
continue;
}
preg_match('/^(.*).*?_(\d+)-+(\d+)$/', $k, $matches);
@ -1891,6 +1912,7 @@ class AgentWizard extends HTML
{
$modules = [];
$errorflag = false;
foreach ($modulesCandidates as $candidate) {
$tmp = Module::search(
[
@ -2062,35 +2084,42 @@ class AgentWizard extends HTML
} else {
$tmp->ip_target($this->targetIp);
$tmp->id_modulo(MODULE_PLUGIN);
$fieldsPlugin = db_get_value_sql(
sprintf(
'SELECT macros FROM tplugin WHERE id=%d',
(int) $infoMacros['server_plugin']
)
);
if ($fieldsPlugin !== false) {
$fieldsPlugin = json_decode($fieldsPlugin, true);
$i = 1;
foreach ($infoMacros as $key => $value) {
if (empty(preg_match('/_snmp_field/', $key)) === false) {
$new_macros = [];
foreach ($fieldsPlugin as $k => $v) {
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
$value,
$infoMacros['macros']
);
$i++;
continue;
if (empty($candidate['macros']) === true) {
$fieldsPlugin = db_get_value_sql(
sprintf(
'SELECT macros FROM tplugin WHERE id=%d',
(int) $infoMacros['server_plugin']
)
);
if ($fieldsPlugin !== false) {
$fieldsPlugin = json_decode($fieldsPlugin, true);
$i = 1;
foreach ($infoMacros as $key => $value) {
if (empty(preg_match('/_snmp_field/', $key)) === false) {
$new_macros = [];
foreach ($fieldsPlugin as $k => $v) {
if ($v['macro'] === preg_replace('/_snmp_field/', '', $key)) {
$fieldsPlugin[$k]['value'] = $this->replacementMacrosPlugin(
$value,
$infoMacros['macros']
);
$i++;
continue;
}
}
}
}
}
}
$tmp->id_plugin($infoMacros['server_plugin']);
$tmp->macros(json_encode($fieldsPlugin));
$tmp->id_plugin($infoMacros['server_plugin']);
$tmp->macros(json_encode($fieldsPlugin));
} else {
// Use definition provided.
$tmp->id_plugin($candidate['id_plugin']);
$tmp->macros(base64_decode($candidate['macros']));
}
}
}
} else if ($this->protocol === 'wmi') {
@ -2403,7 +2432,18 @@ class AgentWizard extends HTML
}
// Get current value.
$currentValue = $this->snmpgetValue($moduleData['value']);
if (in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
) {
$currentValue = $this->snmpGetValue($moduleData['value']);
}
// It unit of measure have data, attach to current value.
if (empty($moduleData['module_unit']) === false) {
@ -2413,6 +2453,7 @@ class AgentWizard extends HTML
// Stablish the data for show.
$generalInterfaceModulesUpdated[] = [
'component_id' => $component_id_number++,
'execution_type' => $moduleData['execution_type'],
'name' => $moduleData['module_name'],
'type' => $moduleData['module_type'],
'description' => $moduleData['module_info'],
@ -2425,6 +2466,9 @@ class AgentWizard extends HTML
'module_enabled' => $moduleData['default_enabled'],
'name_oid' => $moduleData['value'],
'value' => $moduleData['value'],
'id_plugin' => $moduleData['id_plugin'],
'macros' => $moduleData['macros'],
'id_modulo' => $moduleData['id_modulo'],
];
}
@ -2556,7 +2600,20 @@ class AgentWizard extends HTML
}
// Get current value.
$currentValue = $this->snmpgetValue($moduleData['value']);
$currentValue = '';
if (in_array(
$moduleData['module_type'],
[
MODULE_TYPE_REMOTE_SNMP,
MODULE_TYPE_REMOTE_SNMP_INC,
MODULE_TYPE_REMOTE_SNMP_STRING,
MODULE_TYPE_REMOTE_SNMP_PROC,
]
) === true
) {
$currentValue = $this->snmpGetValue($moduleData['value']);
}
// Format current value with thousands and decimals.
if (is_numeric($currentValue) === true) {
@ -2572,6 +2629,7 @@ class AgentWizard extends HTML
// Stablish the data for show.
$interfaceModulesUpdated[] = [
'component_id' => $component_id_number++,
'execution_type' => $moduleData['execution_type'],
'name' => $moduleData['module_name'],
'type' => $moduleData['module_type'],
'description' => $moduleData['module_description'],
@ -2585,6 +2643,10 @@ class AgentWizard extends HTML
'current_value' => $currentValue,
'name_oid' => $moduleData['value'],
'value' => $moduleData['value'],
'id_plugin' => $moduleData['id_plugin'],
'macros' => $moduleData['macros'],
'id_modulo' => $moduleData['id_modulo'],
'unit' => ($moduleData['unit'] ?? $moduleData['module_unit']),
];
}
@ -2927,7 +2989,7 @@ class AgentWizard extends HTML
// Common for FIXED Scan types.
// If _nameOID_ macro exists, stablish the name getted.
if (empty($module['name_oid']) === false) {
$nameValue = $this->snmpgetValue($module['name_oid']);
$nameValue = $this->snmpGetValue($module['name_oid']);
$moduleBlocks[$k]['name'] = str_replace(
'_nameOID_',
$nameValue,
@ -2941,7 +3003,7 @@ class AgentWizard extends HTML
$module['value'] = 0;
}
$value = $this->snmpgetValue($module['value']);
$value = $this->snmpGetValue($module['value']);
// If the value is missing, we must not show this module.
if (empty($value) === true) {
unset($moduleBlocks[$k]);
@ -2963,7 +3025,7 @@ class AgentWizard extends HTML
// OIDs and get his values.
foreach ($macros as $key => $oid) {
if (preg_match('/extra_field_/', $key) !== 0) {
$value = (float) $this->snmpgetValue($oid);
$value = (float) $this->snmpGetValue($oid);
// If the value not exists,
// we must not create a module.
@ -2999,20 +3061,20 @@ class AgentWizard extends HTML
} else {
if ($module['execution_type'] == EXECUTION_TYPE_NETWORK) {
// Get the values of snmpwalk.
$snmpwalkNames = $this->snmpwalkValues($module['name_oid']);
$snmpwalkValues = $this->snmpwalkValues($module['value']);
$snmpwalkNames = $this->snmpWalkValues($module['name_oid']);
$snmpWalkValues = $this->snmpWalkValues($module['value']);
$snmpwalkCombined = [];
foreach ($snmpwalkNames as $index => $name) {
if (isset($name) !== true
|| isset($snmpwalkValues[$index]) !== true
|| isset($snmpWalkValues[$index]) !== true
) {
continue;
}
$snmpwalkCombined[$index] = [
'name' => $name,
'value' => $snmpwalkValues[$index],
'value' => $snmpWalkValues[$index],
];
}
@ -3062,7 +3124,7 @@ class AgentWizard extends HTML
$snmpwalkNamesTmp = [];
// Is needed the index and the values of snmpwalk.
$snmpwalkNamesTmp = $this->snmpwalkValues(
$snmpwalkNamesTmp = $this->snmpWalkValues(
$module['name_oid'],
true
);
@ -3082,7 +3144,7 @@ class AgentWizard extends HTML
foreach ($oids as $oidName => $oid) {
$currentOid = $oid.'.'.$tmpSecond[0];
$macros['macros'][$oidName] = $currentOid;
$currentOidValue = $this->snmpgetValue($currentOid);
$currentOidValue = $this->snmpGetValue($currentOid);
// If for any reason the value comes empty, add 1.
if ($currentOidValue == '') {
$currentOidValue = 1;
@ -3240,6 +3302,58 @@ class AgentWizard extends HTML
}
/**
* Returns associated PEN code of this device.
*
* @return integer|null PEN oid or null if not found.
*/
private function getPEN()
{
$oid = '.1.3.6.1.2.1.1.2.0';
$output = $this->snmpWalkValues($oid, false, true, true);
static $pen;
if (isset($pen) === true) {
return $pen;
}
if (is_array($output) === true
&& isset($output[$oid]) === true
) {
// Output should be an array with only 1 element.
$pen = (int) explode('.', $output[$oid])[7];
}
if ($pen === 0) {
return null;
}
return $pen;
}
/**
* Returns the index oid matching selected expected value.
*
* @param string $oidTree Tree to search in.
* @param string $expectedValue Expected value.
*
* @return string|false Index where expected value is stored or false if not
* found.
*/
private function snmpGetValueInverse($oidTree, $expectedValue)
{
$oidTree = $this->snmpWalkValues($oidTree);
if (is_array($oidTree) === false) {
return false;
}
return array_search($expectedValue, $oidTree);
}
/**
* Perform a snmpget for get a value from provided oid.
*
@ -3248,13 +3362,13 @@ class AgentWizard extends HTML
*
* @return mixed String when response, null if error.
*/
private function snmpgetValue(string $oid, ?bool $full_output=false)
private function snmpGetValue(string $oid, ?bool $full_output=false)
{
if ($oid[0] !== '.') {
$oid = '.'.$oid;
}
$output = $this->snmpwalkValues($oid, false, true, true);
$output = $this->snmpWalkValues($oid, false, true, true);
if (is_array($output) === true) {
foreach ($output as $k => $v) {
@ -3287,7 +3401,7 @@ class AgentWizard extends HTML
*
* @return array
*/
private function snmpwalkValues(
private function snmpWalkValues(
string $oid,
bool $full_output=false,
bool $pure=false,
@ -4122,7 +4236,7 @@ class AgentWizard extends HTML
// Unit module.
$data[6] .= html_print_input_hidden(
'module-unit-'.$uniqueId,
$module['unit'],
($module['unit'] ?? $module['module_unit']),
true,
$md5IdBlock,
'form="form-create-modules"'
@ -4137,14 +4251,49 @@ class AgentWizard extends HTML
'form="form-create-modules"'
);
// Macro module.
$data[6] .= html_print_input_hidden(
'module-macros-'.$uniqueId,
base64_encode($module['macros']),
true,
$md5IdBlock,
'form="form-create-modules"'
);
if (empty($module['macros']) === false) {
// Macro module.
$data[6] .= html_print_input_hidden(
'module-macros-'.$uniqueId,
base64_encode($module['macros']),
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
if (empty($module['execution_type']) === false) {
// Id plugin.
$data[6] .= html_print_input_hidden(
'module-execution_type-'.$uniqueId,
$module['execution_type'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
if (empty($module['id_modulo']) === false) {
// Id module.
$data[6] .= html_print_input_hidden(
'module-id_modulo-'.$uniqueId,
$module['id_modulo'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
if (empty($module['id_plugin']) === false) {
// Id plugin.
$data[6] .= html_print_input_hidden(
'module-id_plugin-'.$uniqueId,
$module['id_plugin'],
true,
$md5IdBlock,
'form="form-create-modules"'
);
}
// Macro module.
$data[6] .= html_print_input_hidden(
@ -4286,7 +4435,7 @@ class AgentWizard extends HTML
{
$moduleDescription = '';
$name = '';
$value = '1';
$value = '_generic_';
// Unpack the array with data.
if (empty($data) === false) {
if (empty($data['mac']) === false) {
@ -4301,6 +4450,12 @@ class AgentWizard extends HTML
$moduleDescription .= '';
}
if (empty($data['alias']) === false) {
$moduleDescription .= 'Alias: '.$data['alias'].' - ';
} else {
$moduleDescription .= '';
}
$name = $data['name'].'_';
$value = $data['index'];
}
@ -4313,11 +4468,16 @@ class AgentWizard extends HTML
// IfOperStatus.
$adminStatusValue = 1;
$speed = 0;
if (empty($data) === false) {
$adminStatusValue = $this->snmpgetValue(
$adminStatusValue = $this->snmpGetValue(
'1.3.6.1.2.1.2.2.1.7.'.$value
);
$speed = $this->snmpGetValue(
'.1.3.6.1.2.1.2.2.1.5.'.$value
);
preg_match('/\((\d+?)\)/', $adminStatusValue, $match);
$adminStatusValue = (int) $match[1];
}
@ -4325,7 +4485,7 @@ class AgentWizard extends HTML
// IfOperStatus.
$operStatusValue = 1;
if (empty($data) === false) {
$operStatusValue = $this->snmpgetValue(
$operStatusValue = $this->snmpGetValue(
'1.3.6.1.2.1.2.2.1.8.'.$value
);
@ -4402,9 +4562,11 @@ class AgentWizard extends HTML
'ifOutNUcastPkts / ifHCOutNUcastPkts',
];
if ($name == '') {
if ($name === '') {
foreach ($definition_temp as $module => $module_def) {
$definition_temp[$module]['module_name'] = array_shift($general_module_names);
$definition_temp[$module]['module_name'] = array_shift(
$general_module_names
);
}
}
@ -4412,6 +4574,248 @@ class AgentWizard extends HTML
$definition = array_merge($definition, $definition_temp);
}
// LocIfInCRC.
$moduleName = $name.'locIfInCRC';
$definition['locIfInCRC'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_REMOTE_SNMP_INC,
'module_description' => sprintf(
'(%s%s)',
$moduleDescription,
$moduleName
),
'module_info' => 'Number of input packets which had cyclic redundancy checksum errors.',
'execution_type' => 'network',
'value' => '1.3.6.1.4.1.9.2.2.1.1.12.'.$value,
'module_unit' => 'packets/s',
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
],
];
// Manufacturer specific modules.
$pen = $this->getPEN();
switch ($pen) {
case 9:
// CISCO.
$valueTranslated = $this->snmpGetValueInverse(
'.1.3.6.1.4.1.9.5.1.4.1.1.11.1',
$value
);
if ($valueTranslated === false && $value !== '_generic_') {
$duplexMismatchOID = null;
} else {
$duplexMismatchOID = '.1.3.6.1.4.1.9.5.1.4.1.1.10.1';
$duplexMismatchOID .= $valueTranslated;
$minc = 2.5;
$maxc = 3.5;
}
break;
// TODO: Add here extra manufacturers.
default:
// Unknown.
$duplexMismatchOID = null;
break;
}
if (isset($duplexMismatchOID) === true) {
// Duplex mismatch.
$moduleName = $name.'DuplexMismatch';
$definition['DuplexMismatch'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_REMOTE_SNMP,
'module_description' => sprintf(
'(%s%s)',
$moduleDescription,
$moduleName
),
'module_info' => 'Indicates whether the port is operating in half-duplex, full-duplex, disagree or auto negotiation mode. If the port could not agree with the far end on port duplex, the port will be in disagree(3) mode.',
'execution_type' => 'network',
'value' => $duplexMismatchOID,
'default_enabled' => true,
'module_enabled' => false,
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => $minc,
'max_critical' => $maxc,
'inv_critical' => false,
],
];
}
// Bandwidth plugin.
static $plugin;
if ($plugin === null) {
$plugin = \db_get_row_filter(
'tplugin',
[ 'name' => 'Network&#x20;bandwidth&#x20;SNMP' ]
);
}
if ($plugin !== false) {
// Network Bandwidth is installed.
$plugin_id = $plugin['id'];
$macros = json_decode($plugin['macros'], 1);
if (json_last_error() === JSON_ERROR_NONE) {
// SNMP Version.
$macros[1]['value'] = $this->version;
// Community.
$macros[2]['value'] = $this->community;
// Host.
$macros[3]['value'] = $this->targetIp;
// Port.
$macros[4]['value'] = $this->targetPort;
// Interface index filter.
$macros[5]['value'] = $value;
// SecurityName.
$macros[6]['value'] = $this->authUserV3;
// SecurityContext.
$macros[7]['value'] = $this->community;
// SecurityLevel.
$macros[8]['value'] = $this->securityLevelV3;
// AuthProtocol.
$macros[9]['value'] = $this->authMethodV3;
// AuthKey.
$macros[10]['value'] = $this->authPassV3;
// PrivProtocol.
$macros[11]['value'] = $this->privacyMethodV3;
// PrivKey.
$macros[12]['value'] = $this->privacyPassV3;
// Hash identifier.
$macros[13]['value'] = uniqid();
// Get input usage.
$macros[14]['value'] = 0;
// Get output usage.
$macros[15]['value'] = 0;
$moduleName = $name.'Bandwidth';
$definition['Bandwidth'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_NUMERIC,
'module_description' => sprintf(
'(%s%s - Speed:%d)',
$moduleDescription,
$moduleName,
$speed
),
'module_info' => 'Amount of digital information sent and received from this interface over a particular time (see interval).',
'execution_type' => EXECUTION_TYPE_PLUGIN,
'id_plugin' => $plugin_id,
'id_modulo' => MODULE_PLUGIN,
'macros' => json_encode($macros),
'default_enabled' => true,
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '85',
'max_critical' => '0',
'inv_critical' => false,
],
];
// Hash identifier.
$macros[13]['value'] = uniqid();
// Get input usage.
$macros[14]['value'] = 1;
// Get output usage.
$macros[15]['value'] = 0;
$moduleName = $name.'inUsage';
$definition['inUsage'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_NUMERIC,
'module_description' => sprintf(
'(%s%s - Speed:%d)',
$moduleDescription,
$moduleName,
$speed
),
'module_info' => 'Bandwidth usage received into this interface over a particular time (see interval).',
'execution_type' => EXECUTION_TYPE_PLUGIN,
'id_plugin' => $plugin_id,
'id_modulo' => MODULE_PLUGIN,
'macros' => json_encode($macros),
'default_enabled' => true,
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
],
];
// Hash identifier.
$macros[13]['value'] = uniqid();
// Get input usage.
$macros[14]['value'] = 0;
// Get output usage.
$macros[15]['value'] = 1;
$moduleName = $name.'outUsage';
$definition['outUsage'] = [
'module_name' => $moduleName,
'module_type' => MODULE_TYPE_NUMERIC,
'module_description' => sprintf(
'(%s%s - Speed:%d)',
$moduleDescription,
$moduleName,
$speed
),
'module_info' => 'Bandwidth usage sent from this interface over a particular time (see interval).',
'execution_type' => EXECUTION_TYPE_PLUGIN,
'id_plugin' => $plugin_id,
'id_modulo' => MODULE_PLUGIN,
'macros' => json_encode($macros),
'default_enabled' => true,
'module_enabled' => false,
'module_unit' => '%',
'module_thresholds' => [
'min_warning' => '0',
'max_warning' => '0',
'inv_warning' => false,
'min_critical' => '0',
'max_critical' => '0',
'inv_critical' => false,
],
];
}
}
// Continue with common x86 and x84 modules.
// IfAdminStatus.
$moduleName = $name.'ifAdminStatus';
@ -4569,6 +4973,12 @@ class AgentWizard extends HTML
$moduleDescription .= '';
}
if (empty($data['alias']) === false) {
$moduleDescription .= 'Alias: '.$data['alias'].' - ';
} else {
$moduleDescription .= '';
}
$name = $data['name'].'_';
$value = $data['index'];
}
@ -4758,6 +5168,12 @@ class AgentWizard extends HTML
$moduleDescription .= '';
}
if (empty($data['alias']) === false) {
$moduleDescription .= 'Alias: '.$data['alias'].' - ';
} else {
$moduleDescription .= '';
}
$name = $data['name'].'_';
$value = $data['index'];
}

View File

@ -548,10 +548,7 @@ class AgentsAlerts extends HTML
if (empty($templates_raw)) {
$templates_raw = [];
}
}
// Is needed sort templates for show in the row.
sort($templates);
};
$alerts = [];
$ntemplates = 0;
@ -600,20 +597,22 @@ class AgentsAlerts extends HTML
}
$templates[$temp['id']] = $temp['name'];
}
}
if (empty($temp['name']) === false) {
$outputLine = html_print_div(
[
'id' => 'line_header_'.$temp['id'],
'class' => 'rotate_text_module position_text_module',
'style' => '',
'content' => '<div title="'.io_safe_output($temp['name']).'">'.ui_print_truncate_text(io_safe_output($temp['name']), 20).'</div>',
],
true
);
foreach ($templates as $id => $name) {
if (empty($name) === false) {
$outputLine = html_print_div(
[
'id' => 'line_header_'.$id,
'class' => 'rotate_text_module position_text_module',
'style' => '',
'content' => '<div title="'.io_safe_output($name).'">'.ui_print_truncate_text(io_safe_output($name), 20).'</div>',
],
true
);
echo sprintf('<th class="th_class_module_r header_table_caption_cell" style="width:%s">%s</th>', $thSize, $outputLine);
}
echo sprintf('<th class="th_class_module_r header_table_caption_cell" style="width:%s">%s</th>', $thSize, $outputLine);
}
}
@ -651,7 +650,7 @@ class AgentsAlerts extends HTML
$alias = db_get_row('tagente', 'id_agente', $agent['id_agente']);
echo '<tr>';
// Name of the agent.
echo '<td class="bolder right">'.$alias['alias'].'</td>';
echo '<td class="bolder" style="text-align: right" >'.$alias['alias'].'</td>';
// Alerts of the agent.
foreach ($templates as $tid => $tname) {
$anyfired = 0;

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC210317';
$build_version = 'PC210322';
$pandora_version = 'v7.0NG.752';
// Do not overwrite default timezone set if defined.

View File

@ -1864,10 +1864,14 @@ function api_get_custom_field_id($t1, $t2, $other, $returnType)
* @param $thrast2 Don't use.
* @param $thrash3 Don't use.
*/
function api_set_delete_agent($id, $thrash1, $other, $thrash3)
function api_set_delete_agent($id, $thrash1, $other, $returnType)
{
global $config;
if (empty($returnType)) {
$returnType = 'string';
}
$agent_by_alias = false;
if ($other['data'][0] === '1') {
@ -1910,7 +1914,7 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
} else {
// Delete only if the centralised mode is disabled.
$headers = getallheaders();
if (isset($headers['idk']) === false || is_management_allowed($headers['idk']) === false) {
if (isset($headers['idk']) === false && is_management_allowed($headers['idk']) === false) {
returnError('centralized');
exit;
}
@ -1934,19 +1938,27 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
}
}
} else {
$idAgent = agents_get_agent_id($id, true);
$idAgent = agents_get_agent_id($id, false);
if (!util_api_check_agent_and_print_error($idAgent, 'string', 'AD')) {
return;
}
$result = agents_delete_agent($idAgent, true);
$result = agents_delete_agent($idAgent, false);
}
}
if (!$result) {
returnError('The agent could not be deleted');
if ($result === false) {
if ($returnType !== 'string') {
return false;
}
returnError('The agent could not be deleted', $returnType);
} else {
returnData('string', ['type' => 'string', 'data' => __('The agent was successfully deleted')]);
if ($returnType !== 'string') {
return true;
}
returnData($returnType, ['type' => 'string', 'data' => __('The agent was successfully deleted')]);
}
}

View File

@ -467,10 +467,9 @@ function html_print_select_groups(
$output = '';
global $config;
$select2_css = 'select2.min';
if ($config['style'] === 'pandora') {
$select2_css = 'select2.min';
} else {
if ($config['style'] === 'pandora_black') {
$select2_css = 'select2_dark.min';
}
@ -576,6 +575,10 @@ function html_print_select_groups(
$required
);
if ($required !== false) {
$require_message = __('Please select an item from this list.');
}
if (empty($size) === true) {
$size = '100%';
}
@ -629,6 +632,25 @@ function html_print_select_groups(
}
}
});
<?php
if ($required !== false) {
?>
$(this).on('change', function(e) {
e.currentTarget.setCustomValidity('');
})
$(this).on('invalid', function(e) {
if ($(e.currentTarget).val() == null) {
e.currentTarget.setCustomValidity(
'<?php echo $require_message; ?>'
);
}
})
<?php
}
?>
}
);

View File

@ -1080,6 +1080,27 @@ function notifications_print_dropdown_element($message_info)
break;
}
$split_subject = explode(' ', io_safe_output($message_info['subject']));
$is_image = false;
$img = '';
foreach ($split_subject as $item) {
if ($is_image) {
if (preg_match('/src/', $item)) {
$img .= $item.' >';
$is_image = false;
}
}
if (preg_match('/img/', $item)) {
$img = '<img ';
$is_image = true;
}
}
if ($img !== '') {
$message_info['subject'] = io_safe_input($img);
}
return sprintf(
"<a
class='notification-item'

View File

@ -1065,16 +1065,16 @@ function snmp_browser_print_container(
);
$output .= '<div id="search_results" class="search_results"></div>';
$output .= '<div id="spinner" class="spinner_none_padding">'.html_print_image('images/spinner.gif', true).'</div>';
$output .= '<div id="spinner" class="spinner_none_padding" style="display:none">'.html_print_image('images/spinner.gif', true).'</div>';
$output .= '<div id="snmp_browser">';
$output .= '</div>';
$output .= '<div class="databox mrgn_5px" id="snmp_data"></div>';
$output .= '<div class="databox" id="snmp_data"></div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
if ($show_massive_buttons) {
$output .= '<div id="snmp_create_buttons" class="invisible">';
$output .= '<div id="snmp_create_buttons" style="display:none">';
$output .= html_print_submit_button(
__('Create agent modules'),
'create_modules_agent',

View File

@ -337,7 +337,7 @@ function treeview_printModuleTable($id_module, $server_data=false, $no_head=fals
if ($user_access_node && check_acl($config['id_user'], $id_group, 'AW')) {
// Actions table
echo '<div class="actions_treeview">';
echo '<div class="actions_treeview" style="text-align: right">';
echo '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$module['id_agente'].'&tab=module&edit_module=1&id_agent_module='.$module['id_agente_modulo'].$url_hash.'">';
html_print_submit_button(__('Go to module edition'), 'upd_button', false, 'class="sub config"');
echo '</a>';
@ -694,7 +694,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$agent_table = html_print_table($table, true);
if ($user_access_node && check_acl($config['id_user'], $agent['id_grupo'], 'AW')) {
$go_to_agent = '<div class="right">';
$go_to_agent = '<div style="text-align: right">';
if ($agent['id_os'] == CLUSTER_OS_ID) {
if (enterprise_installed()) {

View File

@ -3272,12 +3272,6 @@ function visual_map_get_status_element($layoutData)
}
}
$module_value = db_get_sql(
'SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
// Linked to other layout ?? - Only if not module defined
if (!empty($layoutData['id_layout_linked'])) {
if (!empty($layoutData['linked_layout_node_id'])) {
@ -3379,6 +3373,11 @@ function visual_map_get_status_element($layoutData)
case PERCENTILE_BUBBLE:
case CIRCULAR_PROGRESS_BAR:
case CIRCULAR_INTERIOR_PROGRESS_BAR:
$module_value = db_get_sql(
'SELECT datos
FROM tagente_estado
WHERE id_agente_modulo = '.$layoutData['id_agente_modulo']
);
if (empty($module_value) || $module_value == '') {
return VISUAL_MAP_STATUS_UNKNOWN;
@ -3907,9 +3906,19 @@ function visual_map_get_layout_status($layout_id, $status_data=[], $depth=0)
return VISUAL_MAP_STATUS_UNKNOWN;
}
$layout_items = db_get_all_rows_filter(
'tlayout_data',
['id_layout' => $layout_id]
$layout_items = db_get_all_rows_sql(
sprintf(
'SELECT tld.*
FROM tlayout_data tld
LEFT JOIN tagente ta
ON ta.id_agente=tld.id_agent
LEFT JOIN tagente_modulo tam
ON tam.id_agente_modulo = tld.id_agente_modulo
WHERE tld.id_layout = %d
AND (ta.disabled = 0 OR ta.disabled is null)
AND (tam.disabled = 0 OR tam.disabled is null)',
$layout_id
)
);
if ($layout_items === false) {

View File

@ -455,7 +455,6 @@ function createVisualConsole(
},
createItem: function(typeString) {
var type;
console.log(typeString);
switch (typeString) {
case "STATIC_GRAPH":
type = 0;

View File

@ -105,6 +105,23 @@ class Group extends Entity
}
/**
* Alias of 'nombre'.
*
* @param string|null $name Name of group.
*
* @return string|void Name assigned or void if set operation.
*/
public function name(?string $name=null)
{
if ($name === null) {
return $this->nombre();
}
return $this->nombre($name);
}
/**
* Retrieves a list of groups fitered.
*
@ -119,7 +136,7 @@ class Group extends Entity
if (empty($filter['id_user']) === true) {
// By default query current user groups.
$filter['id_user'] = false;
} else if (!\users_is_admin()) {
} else if ((bool) \users_is_admin() === false) {
// Override user queried if user is not an admin.
$filter['id_user'] = false;
}
@ -226,8 +243,9 @@ class Group extends Entity
if (isset($config['centralized_management']) === true
&& $config['centralized_management'] > 0
) {
$msg = 'cannot be modified in a centralized management environment';
throw new \Exception(
get_class($this).' error, cannot be modified while centralized management environment.'
get_class($this).' error, '.$msg
);
}

View File

@ -242,6 +242,13 @@ class Item extends CachedModel
);
}
$decodedData['agentDisabled'] = static::parseBool(
$data['agentDisabled']
);
$decodedData['moduleDisabled'] = static::parseBool(
$data['moduleDisabled']
);
return $decodedData;
}
@ -939,7 +946,7 @@ class Item extends CachedModel
if (\is_metaconsole()) {
$sql = sprintf(
'SELECT nombre, alias, direccion, comentarios
'SELECT nombre, alias, direccion, comentarios, `disabled`
FROM tmetaconsole_agent
WHERE id_tagente = %s and id_tmetaconsole_setup = %s',
$agentId,
@ -947,7 +954,7 @@ class Item extends CachedModel
);
} else {
$sql = sprintf(
'SELECT nombre, alias, direccion, comentarios
'SELECT nombre, alias, direccion, comentarios, `disabled`
FROM tagente
WHERE id_agente = %s',
$agentId
@ -966,6 +973,7 @@ class Item extends CachedModel
$agentData['agentAlias'] = $agent['alias'];
$agentData['agentDescription'] = $agent['comentarios'];
$agentData['agentAddress'] = $agent['direccion'];
$agentData['agentDisabled'] = $agent['disabled'];
return \io_safe_output($agentData);
}
@ -1026,7 +1034,7 @@ class Item extends CachedModel
}
$sql = sprintf(
'SELECT nombre, descripcion
'SELECT nombre, descripcion, `disabled`
FROM tagente_modulo
WHERE id_agente_modulo = %s',
$moduleId
@ -1046,6 +1054,7 @@ class Item extends CachedModel
$moduleData['moduleName'] = $moduleName['nombre'];
$moduleData['moduleDescription'] = $moduleName['descripcion'];
$moduleData['moduleDisabled'] = $moduleName['disabled'];
return \io_safe_output($moduleData);
}
@ -1076,6 +1085,12 @@ class Item extends CachedModel
$baseUrl = \ui_get_full_url('index.php');
if ((bool) $data['agentDisabled'] === true
|| (bool) $data['moduleDisabled'] === true
) {
return null;
}
// TODO: There's a feature to get the link from the label.
if (static::$useLinkedVisualConsole === true
&& $linkedVisualConsole['linkedLayoutId'] !== null

View File

@ -133,7 +133,8 @@ final class StaticGraph extends Item
/**
* Fetch a vc item data structure from the database using a filter.
*
* @param array $filter Filter of the Visual Console Item.
* @param array $filter Filter of the Visual Console Item.
* @param float|null $ratio Ratio.
*
* @return array The Visual Console Item data structure stored into the DB.
* @throws \InvalidArgumentException When an agent Id cannot be found.
@ -171,44 +172,57 @@ final class StaticGraph extends Item
throw new \InvalidArgumentException('missing module Id');
}
// Get the img src.
// There's no need to connect to the metaconsole before searching for
// the image status cause the function itself does that for us.
$imagePath = \visual_map_get_image_status_element($data);
$data['statusImageSrc'] = \ui_get_full_url(
$imagePath,
false,
false,
false
);
if ((bool) $data['agentDisabled'] === false
&& (bool) $data['moduleDisabled'] === false
) {
// Get the img src.
// There's no need to connect to the metaconsole before searching
// for the image status cause the function itself does that for us.
$imagePath = \visual_map_get_image_status_element($data);
$data['statusImageSrc'] = \ui_get_full_url(
$imagePath,
false,
false,
false
);
$status = \visual_map_get_status_element($data);
$status = \visual_map_get_status_element($data);
// Magic numbers from the hell.
switch ($status) {
case 1:
case 4:
// Critical or critical alert (BAD).
$data['colorStatus'] = COL_CRITICAL;
break;
// Magic numbers from the hell.
switch ($status) {
case 1:
case 4:
// Critical or critical alert (BAD).
$data['colorStatus'] = COL_CRITICAL;
break;
case 0:
// Normal (OK).
$data['colorStatus'] = COL_NORMAL;
break;
case 0:
// Normal (OK).
$data['colorStatus'] = COL_NORMAL;
break;
case 2:
case 10:
// Warning or warning alert.
$data['colorStatus'] = COL_WARNING;
break;
case 2:
case 10:
// Warning or warning alert.
$data['colorStatus'] = COL_WARNING;
break;
case 3:
// Unknown.
default:
// Default is Grey (Other).
$data['colorStatus'] = COL_UNKNOWN;
break;
case 3:
// Unknown.
default:
// Default is Grey (Other).
$data['colorStatus'] = COL_UNKNOWN;
break;
}
} else {
$data['colorStatus'] = COL_UNKNOWN;
$imagePath = 'images/console/icons/'.$data['image'].'.png';
$data['statusImageSrc'] = \ui_get_full_url(
$imagePath,
false,
false,
false
);
}
// If the width or the height are equal to 0 we will extract them
@ -359,7 +373,6 @@ final class StaticGraph extends Item
'label' => __('Module'),
'arguments' => [
'type' => 'autocomplete_module',
'fields' => $fields,
'name' => 'moduleId',
'selected' => $values['moduleId'],
'return' => true,

View File

@ -6314,7 +6314,6 @@ div.graph div.legend table {
position: absolute;
top: 0;
left: 0px;
display: none;
padding: 5px;
}
/*

View File

@ -125,12 +125,26 @@ input.delete_min {
input.delete_min[disabled] {
background: url(../../images/cross.disabled.png) no-repeat center;
}
input.delete_min_white {
background: url(../../images/cross.disabled.png) no-repeat center;
}
input.delete_min_white[disabled] {
background: url(../../images/cross.png) no-repeat center;
}
input.graph_min {
background: url(../../images/chart_curve.png) no-repeat center;
}
input.graph_min[disabled] {
background: url(../../images/chart_curve.disabled.png) no-repeat center;
}
input.graph_min_white {
background: url(../../images/chart_curve.disabled.png) no-repeat center;
}
input.graph_min_white[disabled] {
background: url(../../images/chart_curve.png) no-repeat center;
}
input.bars_graph_min {
background: url(../../images/icono-barras-arriba.png) no-repeat center;
}
@ -138,120 +152,260 @@ input.bars_graph_min[disabled] {
background: url(../../images/icono-barras-arriba.disabled.png) no-repeat
center;
}
input.bars_graph_min_white {
background: url(../../images/icono-barras-arriba.disabled.png) no-repeat
center;
}
input.bars_graph_min_white[disabled] {
background: url(../../images/icono-barras-arriba.png) no-repeat center;
}
input.percentile_min {
background: url(../../images/chart_bar.png) no-repeat center;
}
input.percentile_min[disabled] {
background: url(../../images/chart_bar.disabled.png) no-repeat center;
}
input.percentile_min_white {
background: url(../../images/chart_bar.disabled.png) no-repeat center;
}
input.percentile_min_white[disabled] {
background: url(../../images/chart_bar.png) no-repeat center;
}
input.percentile_item_min {
background: url(../../images/percentile_item.png) no-repeat center;
}
input.percentile_item_min[disabled] {
background: url(../../images/percentile_item.disabled.png) no-repeat center;
}
input.percentile_item_min_white {
background: url(../../images/percentile_item.disabled.png) no-repeat center;
}
input.percentile_item_min_white[disabled] {
background: url(../../images/percentile_item.png) no-repeat center;
}
input.auto_sla_graph_min {
background: url(../../images/auto_sla_graph.png) no-repeat center;
}
input.auto_sla_graph_min[disabled] {
background: url(../../images/auto_sla_graph.disabled.png) no-repeat center;
}
input.auto_sla_graph_min_white {
background: url(../../images/auto_sla_graph.disabled.png) no-repeat center;
}
input.auto_sla_graph_min_white[disabled] {
background: url(../../images/auto_sla_graph.png) no-repeat center;
}
input.donut_graph_min {
background: url(../../images/icono-quesito.png) no-repeat center;
}
input.donut_graph_min[disabled] {
background: url(../../images/icono-quesito.disabled.png) no-repeat center;
}
input.donut_graph_min_white {
background: url(../../images/icono-quesito.disabled.png) no-repeat center;
}
input.donut_graph_min_white[disabled] {
background: url(../../images/icono-quesito.png) no-repeat center;
}
input.binary_min {
background: url(../../images/binary.png) no-repeat center;
}
input.binary_min[disabled] {
background: url(../../images/binary.disabled.png) no-repeat center;
}
input.binary_min_white {
background: url(../../images/binary.disabled.png) no-repeat center;
}
input.binary_min_white[disabled] {
background: url(../../images/binary.png) no-repeat center;
}
input.camera_min {
background: url(../../images/camera.png) no-repeat center;
}
input.camera_min[disabled] {
background: url(../../images/camera.disabled.png) no-repeat center;
}
input.camera_min_white {
background: url(../../images/camera.disabled.png) no-repeat center;
}
input.camera_min_white[disabled] {
background: url(../../images/camera.png) no-repeat center;
}
input.config_min {
background: url(../../images/config.png) no-repeat center;
}
input.config_min[disabled] {
background: url(../../images/config.disabled.png) no-repeat center;
}
input.config_min_white {
background: url(../../images/config.disabled.png) no-repeat center;
}
input.config_min_white[disabled] {
background: url(../../images/config.png) no-repeat center;
}
input.label_min {
background: url(../../images/tag_red.png) no-repeat center;
}
input.label_min[disabled] {
background: url(../../images/tag_red.disabled.png) no-repeat center;
}
input.label_min_white {
background: url(../../images/tag_red.disabled.png) no-repeat center;
}
input.label_min_white[disabled] {
background: url(../../images/tag_red.png) no-repeat center;
}
input.icon_min {
background: url(../../images/photo.png) no-repeat center;
}
input.icon_min[disabled] {
background: url(../../images/photo.disabled.png) no-repeat center;
}
input.icon_min_white {
background: url(../../images/photo.disabled.png) no-repeat center;
}
input.icon_min_white[disabled] {
background: url(../../images/photo.png) no-repeat center;
}
input.clock_min {
background: url(../../images/clock-tab.png) no-repeat center;
}
input.clock_min[disabled] {
background: url(../../images/clock-tab.disabled.png) no-repeat center;
}
input.clock_min_white {
background: url(../../images/clock-tab.disabled.png) no-repeat center;
}
input.clock_min_white[disabled] {
background: url(../../images/clock-tab.png) no-repeat center;
}
input.box_item {
background: url(../../images/box_item.png) no-repeat center;
}
input.box_item[disabled] {
background: url(../../images/box_item.disabled.png) no-repeat center;
}
input.box_item_white {
background: url(../../images/box_item.disabled.png) no-repeat center;
}
input.box_item_white[disabled] {
background: url(../../images/box_item.png) no-repeat center;
}
input.line_item {
background: url(../../images/line_item.png) no-repeat center;
}
input.line_item[disabled] {
background: url(../../images/line_item.disabled.png) no-repeat center;
}
input.line_item_white {
background: url(../../images/line_item.disabled.png) no-repeat center;
}
input.line_item_white[disabled] {
background: url(../../images/line_item.png) no-repeat center;
}
input.copy_item {
background: url(../../images/copy_visualmap.png) no-repeat center;
}
input.copy_item[disabled] {
background: url(../../images/copy_visualmap.disabled.png) no-repeat center;
}
input.copy_item_white {
background: url(../../images/copy_visualmap.disabled.png) no-repeat center;
}
input.copy_item_white[disabled] {
background: url(../../images/copy_visualmap.png) no-repeat center;
}
input.grid_min {
background: url(../../images/grid.png) no-repeat center;
}
input.grid_min[disabled] {
background: url(../../images/grid.disabled.png) no-repeat center;
}
input.grid_min_white {
background: url(../../images/grid.disabled.png) no-repeat center;
}
input.grid_min_white[disabled] {
background: url(../../images/grid.png) no-repeat center;
}
input.save_min {
background: url(../../images/file.png) no-repeat center;
}
input.save_min[disabled] {
background: url(../../images/file.disabled.png) no-repeat center;
}
input.save_min_white {
background: url(../../images/file.disabled.png) no-repeat center;
}
input.save_min_white[disabled] {
background: url(../../images/file.png) no-repeat center;
}
input.service_min {
background: url(../../images/box.png) no-repeat center;
}
input.service_min[disabled] {
background: url(../../images/box.disabled.png) no-repeat center;
}
input.service_min_white {
background: url(../../images/box.disabled.png) no-repeat center;
}
input.service_min_white[disabled] {
background: url(../../images/box.png) no-repeat center;
}
input.network_link_min {
background: url(../../images/network_link_item.png) no-repeat center;
}
input.network_link_min[disabled] {
background: url(../../images/network_link_item.disabled.png) no-repeat center;
}
input.network_link_min_white {
background: url(../../images/network_link_item.disabled.png) no-repeat center;
}
input.network_link_min_white[disabled] {
background: url(../../images/network_link_item.png) no-repeat center;
}
input.group_item_min {
background: url(../../images/group_green.png) no-repeat center;
}
input.group_item_min[disabled] {
background: url(../../images/group_green.disabled.png) no-repeat center;
}
input.group_item_min_white {
background: url(../../images/group_green.disabled.png) no-repeat center;
}
input.group_item_min_white[disabled] {
background: url(../../images/group_green.png) no-repeat center;
}
input.color_cloud_min {
background: url(../../images/color_cloud_item.png) no-repeat center;
}
input.color_cloud_min[disabled] {
background: url(../../images/color_cloud_item.disabled.png) no-repeat center;
}
input.color_cloud_min_white {
background: url(../../images/color_cloud_item.disabled.png) no-repeat center;
}
input.color_cloud_min_white[disabled] {
background: url(../../images/color_cloud_item.png) no-repeat center;
}
div#cont {
position: fixed;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -1004,12 +1004,12 @@ if ($group_rep == 2) {
true
).'</span>';
echo '</form>';
echo '<span id="max_custom_event_resp_msg" class="max_custom_events">';
echo '<span id="max_custom_event_resp_msg" style="display: none; color: #e63c52; line-height: 200%;">';
echo __(
'A maximum of %s event custom responses can be selected',
$config['max_execution_event_response']
).'</span>';
echo '<span id="max_custom_selected" class="max_custom_events">';
echo '<span id="max_custom_selected" style="display: none; color: #e63c52; line-height: 200%;">';
echo __(
'Please, select an event'
).'</span>';

View File

@ -1654,12 +1654,12 @@ if (check_acl(
true
).'</span>';
echo '</form>';
echo '<span id="max_custom_event_resp_msg" class="max_custom_events">';
echo '<span id="max_custom_event_resp_msg" style="display: none; color: #e63c52; line-height: 200%;">';
echo __(
'A maximum of %s event custom responses can be selected',
$config['max_execution_event_response']
).'</span>';
echo '<span id="max_custom_selected" class="max_custom_events">';
echo '<span id="max_custom_selected" style="display: none; color: #e63c52; line-height: 200%;">';
echo __(
'Please, select an event'
).'</span>';

View File

@ -235,80 +235,117 @@ if ($pure === false) {
echo '<div id ="edit-vc">';
echo '<div id ="edit-controls" class="visual-console-edit-controls" style="visibility:hidden">';
echo '<div>';
$class_camera = 'camera_min link-create-item';
$class_percentile = 'percentile_item_min link-create-item';
$class_module_graph = 'graph_min link-create-item';
$class_donut = 'donut_graph_min link-create-item';
$class_bars = 'bars_graph_min link-create-item';
$class_value = 'binary_min link-create-item';
$class_sla = 'auto_sla_graph_min link-create-item';
$class_label = 'label_min link-create-item';
$class_icon = 'icon_min link-create-item';
$class_clock = 'clock_min link-create-item';
$class_group = 'group_item_min link-create-item';
$class_box = 'box_item link-create-item';
$class_line = 'line_item link-create-item';
$class_cloud = 'color_cloud_min link-create-item';
$class_nlink = 'network_link_min link-create-item';
$class_delete = 'delete_item delete_min';
$class_copy = 'copy_item';
if ($config['style'] === 'pandora_black') {
$class_camera = 'camera_min_white link-create-item';
$class_percentile = 'percentile_item_min_white link-create-item';
$class_module_graph = 'graph_min_white link-create-item';
$class_donut = 'donut_graph_min_white link-create-item';
$class_bars = 'bars_graph_min_white link-create-item';
$class_value = 'binary_min_white link-create-item';
$class_sla = 'auto_sla_graph_min_white link-create-item';
$class_label = 'label_min_white link-create-item';
$class_icon = 'icon_min_white link-create-item';
$class_clock = 'clock_min_white link-create-item';
$class_group = 'group_item_min_white link-create-item';
$class_box = 'box_item_white link-create-item';
$class_line = 'line_item_white link-create-item';
$class_cloud = 'color_cloud_min_white link-create-item';
$class_nlink = 'network_link_min_white link-create-item';
$class_delete = 'delete_item_white delete_min_white';
$class_copy = 'copy_item_white';
}
visual_map_print_button_editor_refactor(
'STATIC_GRAPH',
__('Static Image'),
'camera_min link-create-item'
$class_camera
);
visual_map_print_button_editor_refactor(
'PERCENTILE_BAR',
__('Percentile Item'),
'percentile_item_min link-create-item'
$class_percentile
);
visual_map_print_button_editor_refactor(
'MODULE_GRAPH',
__('Module Graph'),
'graph_min link-create-item'
$class_module_graph
);
visual_map_print_button_editor_refactor(
'DONUT_GRAPH',
__('Serialized pie graph'),
'donut_graph_min link-create-item'
$class_donut
);
visual_map_print_button_editor_refactor(
'BARS_GRAPH',
__('Bars Graph'),
'bars_graph_min link-create-item'
$class_bars
);
visual_map_print_button_editor_refactor(
'AUTO_SLA_GRAPH',
__('Event history graph'),
'auto_sla_graph_min link-create-item'
$class_sla
);
visual_map_print_button_editor_refactor(
'SIMPLE_VALUE',
__('Simple Value'),
'binary_min link-create-item'
$class_value
);
visual_map_print_button_editor_refactor(
'LABEL',
__('Label'),
'label_min link-create-item'
$class_label
);
visual_map_print_button_editor_refactor(
'ICON',
__('Icon'),
'icon_min link-create-item'
$class_icon
);
visual_map_print_button_editor_refactor(
'CLOCK',
__('Clock'),
'clock_min link-create-item'
$class_clock
);
visual_map_print_button_editor_refactor(
'GROUP_ITEM',
__('Group'),
'group_item_min link-create-item'
$class_group
);
visual_map_print_button_editor_refactor(
'BOX_ITEM',
__('Box'),
'box_item link-create-item'
$class_box
);
visual_map_print_button_editor_refactor(
'LINE_ITEM',
__('Line'),
'line_item link-create-item'
$class_line
);
visual_map_print_button_editor_refactor(
'COLOR_CLOUD',
__('Color cloud'),
'color_cloud_min link-create-item'
$class_cloud
);
visual_map_print_button_editor_refactor(
'NETWORK_LINK',
__('Network link'),
'network_link_min link-create-item'
$class_nlink
);
enterprise_include_once('include/functions_visual_map_editor.php');
enterprise_hook(
@ -319,13 +356,13 @@ if ($pure === false) {
visual_map_print_button_editor_refactor(
'button_delete',
__('Delete Item'),
'delete_item delete_min',
$class_delete,
true
);
visual_map_print_button_editor_refactor(
'button_copy',
__('Copy Item'),
'copy_item',
$class_copy,
true
);
echo '</div>';

View File

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

View File

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

View File

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

View File

@ -1739,6 +1739,12 @@ SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,20,0,'/usr/share/pandora_server/util/plugin/wizard_wmi_module',NULL,NULL,NULL,NULL,0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Namespace&#x20;&#40;Optional&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"User\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Password\",\"help\":\"\",\"value\":\"\",\"hide\":\"1\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"WMI&#x20;Class\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"Fields&#x20;list\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"Query&#x20;filter&#x20;&#40;Optional&#41;\",\"help\":\"Use&#x20;single&#x20;quotes&#x20;for&#x20;query&#x20;conditions\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"Operation\",\"help\":\"Aritmetic&#x20;operation&#x20;to&#x20;get&#x20;data.&#x20;Macros&#x20;_fN_&#x20;will&#x20;be&#x20;changed&#x20;by&#x20;fields&#x20;in&#x20;list.&#x20;Example:&#x20;&#40;&#40;_f1_&#x20;-&#x20;_f2_&#41;&#x20;*&#x20;100&#41;&#x20;/&#x20;_f1_\",\"value\":\"\",\"hide\":\"\"}}','-host&#x20;&#039;_field1_&#039;&#x20;-namespace&#x20;&#039;_field2_&#039;&#x20;-user&#x20;&#039;_field3_&#039;&#x20;-pass&#x20;&#039;_field4_&#039;&#x20;-wmiClass&#x20;&#039;_field5_&#039;&#x20;-fieldsList&#x20;&#039;_field6_&#039;&#x20;-queryFilter&#x20;&quot;_field7_&quot;&#x20;-operation&#x20;&#039;_field8_&#039;&#x20;-wmicPath&#x20;/usr/bin/wmic');
SET @plugin_name = 'Network&#x20;bandwidth&#x20;SNMP';
SET @plugin_description = 'Retrieves&#x20;amount&#x20;of&#x20;digital&#x20;information&#x20;sent&#x20;and&#x20;received&#x20;from&#x20;device&#x20;or&#x20;filtered&#x20;&#x20;interface&#x20;index&#x20;over&#x20;a&#x20;particular&#x20;time&#x20;&#40;agent/module&#x20;interval&#41;.';
SET @plugin_id = '';
SELECT @plugin_id := `id` FROM `tplugin` WHERE `name` = @plugin_name;
INSERT IGNORE INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `max_retries`, `execute`, `net_dst_opt`, `net_port_opt`, `user_opt`, `pass_opt`, `plugin_type`, `macros`, `parameters`) VALUES (@plugin_id,@plugin_name,@plugin_description,300,0,'perl&#x20;/usr/share/pandora_server/util/plugin/pandora_snmp_bandwidth.pl','','','','',0,'{\"1\":{\"macro\":\"_field1_\",\"desc\":\"SNMP&#x20;Version&#40;1,2c,3&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"2\":{\"macro\":\"_field2_\",\"desc\":\"Community\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"3\":{\"macro\":\"_field3_\",\"desc\":\"Host\",\"help\":\"\",\"value\":\"_address_\",\"hide\":\"\"},\"4\":{\"macro\":\"_field4_\",\"desc\":\"Port\",\"help\":\"\",\"value\":\"161\",\"hide\":\"\"},\"5\":{\"macro\":\"_field5_\",\"desc\":\"Interface&#x20;Index&#x20;&#40;filter&#41;\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"6\":{\"macro\":\"_field6_\",\"desc\":\"securityName\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"7\":{\"macro\":\"_field7_\",\"desc\":\"context\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"8\":{\"macro\":\"_field8_\",\"desc\":\"securityLevel\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"9\":{\"macro\":\"_field9_\",\"desc\":\"authProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"10\":{\"macro\":\"_field10_\",\"desc\":\"authKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"11\":{\"macro\":\"_field11_\",\"desc\":\"privProtocol\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"12\":{\"macro\":\"_field12_\",\"desc\":\"privKey\",\"help\":\"\",\"value\":\"\",\"hide\":\"\"},\"13\":{\"macro\":\"_field13_\",\"desc\":\"UniqId\",\"help\":\"This&#x20;plugin&#x20;needs&#x20;to&#x20;store&#x20;information&#x20;in&#x20;temporary&#x20;directory&#x20;to&#x20;calculate&#x20;bandwidth.&#x20;Set&#x20;here&#x20;an&#x20;unique&#x20;identifier&#x20;with&#x20;no&#x20;spaces&#x20;or&#x20;symbols.\",\"value\":\"\",\"hide\":\"\"},\"14\":{\"macro\":\"_field14_\",\"desc\":\"inUsage\",\"help\":\"Retrieve&#x20;input&#x20;usage&#x20;&#40;%&#41;\",\"value\":\"\",\"hide\":\"\"},\"15\":{\"macro\":\"_field15_\",\"desc\":\"outUsage\",\"help\":\"Retrieve&#x20;output&#x20;usage&#x20;&#40;%&#41;\",\"value\":\"\",\"hide\":\"\"}}','-version&#x20;&#039;_field1_&#039;&#x20;-community&#x20;&#039;_field2_&#039;&#x20;-host&#x20;&#039;_field3_&#039;&#x20;-port&#x20;&#039;_field4_&#039;&#x20;-ifIndex&#x20;&#039;_field5_&#039;&#x20;-securityName&#x20;&#039;_field6_&#039;&#x20;-context&#x20;&#039;_field7_&#039;&#x20;-securityLevel&#x20;&#039;_field8_&#039;&#x20;-authProtocol&#x20;&#039;_field9_&#039;&#x20;-authKey&#x20;&#039;_field10_&#039;&#x20;-privProtocol&#x20;&#039;_field11_&#039;&#x20;-privKey&#x20;&#039;_field12_&#039;&#x20;-uniqid&#x20;&#039;_field13_&#039;&#x20;-inUsage&#x20;&#039;_field14_&#039;&#x20;-outUsage&#x20;&#039;_field15_&#039;');
SET @main_component_group_name = 'Wizard';
SET @component_id = '';
SELECT @component_id := `id_sg` FROM `tnetwork_component_group` WHERE `name` = @main_component_group_name;

View File

@ -33,7 +33,7 @@ if (empty($arrayDashboard) === true) {
$arrayDashboard['name'] = 'Default';
$arrayDashboard['id_user'] = '';
$private = 0;
$arrayDashboard['id_group'] = 0;
$arrayDashboard['id_group'] = null;
$arrayDashboard['active'] = 0;
$arrayDashboard['cells_slideshow'] = 0;
} else {
@ -112,6 +112,7 @@ $inputs = [
'returnAllGroup' => $return_all_group,
'selected' => $arrayDashboard['id_group'],
'return' => true,
'required' => true,
],
],
],

View File

@ -209,11 +209,16 @@ if (empty($dashboards) === true) {
}
if ($writeDashboards === 1) {
$text = __('Create a new dashboard');
if ($dashboard !== null) {
$text = __('Update Dashboard');
}
// Button for display modal options dashboard.
$output = '<a href="#" class="float-right" onclick=\'';
$output .= 'show_option_dialog('.json_encode(
[
'title' => __('Update Dashboard'),
'title' => $text,
'btn_text' => __('Ok'),
'btn_cancel' => __('Cancel'),
'url' => $ajaxController,

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.752-210317
Version: 7.0NG.752-210322
Architecture: all
Priority: optional
Section: admin

View File

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

View File

@ -140,6 +140,9 @@ discoveryserver 1
# Discovery SAP utils (PANDORA FMS ENTERPRISE ONLY)
# sap_utils /usr/share/pandora_server/util/recon_scripts/SAP
# Discovery Microsoft SQL ODBC driver (PANDORA FMS ENTERPRISE ONLY)
# mssql_driver ODBC Driver 17 for SQL Server
# pluginserver : 1 or 0. Set to 1 to activate plugin server with this setup
pluginserver 1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.752";
my $pandora_build = "210317";
my $pandora_build = "210322";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@ -330,6 +330,7 @@ sub pandora_load_config {
$pa_config->{"dynamic_updates"} = 5; # 7.0
$pa_config->{"dynamic_warning"} = 25; # 7.0
$pa_config->{"dynamic_constant"} = 10; # 7.0
$pa_config->{"mssql_driver"} = undef; # 745
# Internal MTA for alerts, each server need its own config.
$pa_config->{"mta_address"} = ''; # Introduced on 2.0
@ -1186,6 +1187,9 @@ sub pandora_load_config {
elsif ($parametro =~ m/^dynamic_constant\s+([0-9]*)/i) {
$pa_config->{'dynamic_constant'}= clean_blank($1);
}
elsif ($parametro =~ m/^mssql_driver\s+(.*)/i) {
$pa_config->{'mssql_driver'}= clean_blank($1);
}
elsif ($parametro =~ m/^logstash_host\s+(.*)/i) {
$pa_config->{'logstash_host'}= clean_blank($1);

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.752";
my $pandora_build = "210317";
my $pandora_build = "210322";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
@ -504,10 +504,20 @@ sub print_agent {
# print header
$xml .= "<agent_data ";
my $group_password_specified = 0;
foreach my $kad (keys %{$agent_data}){
no warnings "uninitialized";
$xml .= $kad . "='";
$xml .= $agent_data->{$kad} . "' ";
if ($kad eq 'group_password') {
$group_password_specified = 1;
}
}
if ($group_password_specified == 0 && !empty($config->{'group_password'})) {
$xml .= " group_password='".$config->{'group_password'}."' ";
}
$xml .= ">";
@ -2042,19 +2052,18 @@ sub api_create_group {
# -> means $context (v3)
#
# Configuration hash
#
# $snmp{version}
# $snmp{community}
# $snmp{host}
# $snmp{oid}
# $snmp{port}
# $snmp{securityName}
# $snmp{context
# $snmp{securityLevel}
# $snmp{authProtocol}
# $snmp{authKey}
# $snmp{privProtocol}
# $snmp{privKey}
# $snmp{version}
# $snmp{community}
# $snmp{host}
# $snmp{oid}
# $snmp{port}
# $snmp{securityName}
# $snmp{context
# $snmp{securityLevel}
# $snmp{authProtocol}
# $snmp{authKey}
# $snmp{privProtocol}
# $snmp{privKey}
################################################################################
sub snmp_walk {
my $snmp = shift;

View File

@ -1713,6 +1713,8 @@ sub app_scan($) {
$type = 'Oracle';
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_DB2) {
$type = 'DB2';
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_MICROSOFT_SQL_SERVER) {
$type = 'MSSQL';
} elsif ($self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
$type = 'SAP';
} else {
@ -1797,6 +1799,7 @@ sub app_scan($) {
if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_DB2
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_MICROSOFT_SQL_SERVER
) {
# Database.
@ -1905,6 +1908,7 @@ sub scan($) {
if ( $self->{'task_data'}->{'type'} == DISCOVERY_APP_MYSQL
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_ORACLE
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_DB2
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_MICROSOFT_SQL_SERVER
|| $self->{'task_data'}->{'type'} == DISCOVERY_APP_SAP) {
# Application scan.
$self->call('message', "Scanning application ...", 6);

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.752 PS210317";
my $version = "7.0NG.752 PS210322";
# Pandora server configuration
my %conf;

View File

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

View File

@ -0,0 +1,588 @@
#!/usr/bin/perl
#
################################################################################
#
# Bandwith usage plugin
#
# Requirements:
# snmpget
# snmpwalk
#
# (c) Fco de Borja Sanchez <fborja.sanchez@artica.es>
#
# 2018/06/27
# Changes:
# First version
#
################################################################################
use strict;
use warnings;
use POSIX qw(strftime);
use lib '/usr/lib/perl5';
use PandoraFMS::PluginTools;
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
# version: Defines actual version of Pandora FMS
my $pandora_version = "7.0NG.752";
my $pandora_build = "210212";
our $VERSION = $pandora_version." ".$pandora_build;
my $HELP=<<EO_HELP;
Pandora FMS Server plugin for bandwidth monitoring $VERSION
Where OPTIONS could be:
[SNMP]
-community community
-version SNMP version (1,2c,3)
-host target host
-port target port (161)
[SNMPv3]
-securityName
-context
-securityLevel
-authProtocol
-authKey
-privProtocol
-privKey
[EXTRA]
-ifIndex Target interface to retrieve, if not specified, total
bandwith will be reported.
-uniqid Use custom temporary file name.
-inUsage Show only input usage (in percentage) - 1, or not 0.
-outUsage Show only output usage (in percentage) - 1, or not 0.
Note: You can also use snmpget/snmpwalk argument notation,
e.g. -v is equal to -version, -c to -community, etc.
EO_HELP
use constant {
UNKNOWN_DUPLEX => 0,
HALF_DUPLEX => 2,
FULL_DUPLEX => 3,
};
################################################################################
# Translate argument to config hash key
################################################################################
sub update_config_key ($) {
my $arg = shift;
if ($arg eq "c"){
return "community";
}
if ($arg eq "v"){
return "version";
}
if ($arg eq "h"){
return "host";
}
if ($arg eq "p"){
return "port";
}
if ($arg eq "o"){
return "oid_base";
}
if ($arg eq "d"){
return "datatype";
}
if ($arg eq "u"){
return "securityName";
}
if ($arg eq "n"){
return "context";
}
if ($arg eq "l"){
return "securityLevel";
}
if ($arg eq "a"){
return "authProtocol";
}
if ($arg eq "A"){
return "authKey";
}
if ($arg eq "x"){
return "privProtocol";
}
if ($arg eq "X"){
return "privKey";
}
if ($arg eq "agent") {
return "agent_name";
}
if ($arg eq "names") {
return "names";
}
if ($arg eq "branches") {
return "branches";
}
if ($arg eq 'ifIndex') {
return "ifIndex";
}
if ($arg eq 'uniqid') {
return "uniqid";
}
if ($arg eq 'inUsage') {
return "inUsage";
}
if ($arg eq 'outUsage') {
return "outUsage";
}
}
################################################################################
# Prepare analysis tree
################################################################################
sub prepare_tree {
my ($config) = @_;
my $tree;
my %snmp_call = %{$config};
my $ifIndex = $config->{'ifIndex'};
$ifIndex = '' if empty($ifIndex);
if (!empty($ifIndex) && $ifIndex !~ /^\./) {
$ifIndex = '.'.$ifIndex;
}
if (is_enabled($config->{'use_x64'})) {
$snmp_call{'oid'} = $config->{'oid_base'} . $config->{'x64_indexes'}{'__idx__'}.$ifIndex;
} else {
$snmp_call{'oid'} = $config->{'oid_base'} . $config->{'x86_indexes'}{'__idx__'}.$ifIndex;
}
my $raw = snmp_walk(\%snmp_call);
return $raw if (ref($raw) eq "HASH");
my @data = split /\n/, $raw;
foreach my $it (@data) {
my ($key, $value) = split /=/, $it;
$value = trim($value);
$key = trim($key);
$value =~ s/^.*:\ {0,1}//;
if ($value =~ /No such instance/i) {
return {};
}
$ifIndex = $value;
if ($ifIndex !~ /^\./) {
$ifIndex = '.'.$ifIndex;
}
my %inOctets_call = %{$config};
if (is_enabled($config->{'use_x64'})) {
$inOctets_call{'oid'} = $config->{'oid_base'};
$inOctets_call{'oid'} .= $config->{'x64_indexes'}{'inOctets'}.$ifIndex;
} else {
$inOctets_call{'oid'} = $config->{'oid_base'};
$inOctets_call{'oid'} .= $config->{'x86_indexes'}{'inOctets'}.$ifIndex;
}
my $inOctets = snmp_get(\%inOctets_call);
if (ref($inOctets) eq "HASH") {
if ($inOctets->{'data'} eq '') {
$inOctets = 0;
} else {
$inOctets = int $inOctets->{'data'};
}
} else {
# Ignore, cannot retrieve inOctets.
next;
}
my %outOctets_call = %{$config};
if (is_enabled($config->{'use_x64'})) {
$outOctets_call{'oid'} = $config->{'oid_base'};
$outOctets_call{'oid'} .= $config->{'x64_indexes'}{'outOctets'}.$ifIndex;
} else {
$outOctets_call{'oid'} = $config->{'oid_base'};
$outOctets_call{'oid'} .= $config->{'x86_indexes'}{'outOctets'}.$ifIndex;
}
my $outOctets = snmp_get(\%outOctets_call);
if (ref($outOctets) eq "HASH") {
if ($outOctets->{'data'} eq '') {
$outOctets = 0;
} else {
$outOctets = int $outOctets->{'data'};
}
} else {
# Ignore, cannot retrieve inOctets.
next;
}
my %duplex_call = %{$config};
if (is_enabled($config->{'use_x64'})) {
$duplex_call{'oid'} = $config->{'oid_base'};
$duplex_call{'oid'} .= $config->{'x64_indexes'}{'duplex'}.$ifIndex;
} else {
$duplex_call{'oid'} = $config->{'oid_base'};
$duplex_call{'oid'} .= $config->{'x86_indexes'}{'duplex'}.$ifIndex;
}
my $duplex = snmp_get(\%duplex_call);
if (ref($duplex) eq "HASH") {
if ($duplex->{'data'} eq '') {
$duplex = 0;
} else {
$duplex = int $duplex->{'data'};
}
} else {
# Ignore, cannot retrieve inOctets.
next;
}
my %speed = %{$config};
if (is_enabled($config->{'use_x64'})) {
$speed{'oid'} = $config->{'oid_base'};
$speed{'oid'} .= $config->{'x64_indexes'}{'ifSpeed'}.$ifIndex;
} else {
$speed{'oid'} = $config->{'oid_base'};
$speed{'oid'} .= $config->{'x86_indexes'}{'ifSpeed'}.$ifIndex;
}
my $speed = snmp_get(\%speed);
if (ref($speed) eq "HASH") {
$speed = int $speed->{'data'};
} else {
# Ignore, cannot retrieve inOctets.
next;
}
{
no warnings "uninitialized";
$tree->{$value} = {
'duplex' => int $duplex,
'speed' => int $speed,
'now' => {
'timestamp' => time(),
'inOctets' => int $inOctets,
'outOctets' => int $outOctets,
},
};
};
}
load_data($config, $tree);
save_data($config, $tree);
return $tree;
}
################################################################################
# Load previous metrics from temporal file.
################################################################################
sub load_data {
my ($config, $tree) = @_;
my $_f;
eval {
open($_f, "<$config->{'tmp_file'}") or die('Cannot open ' . $config->{'tmp_file'});
};
if( $@ ) {
foreach my $iface (keys %{$tree}) {
$tree->{$iface}{'old'} = {
'timestamp' => int $tree->{$iface}{'now'}{'timestamp'},
'inOctets' => int $tree->{$iface}{'now'}{'inOctets'},
'outOctets' => int $tree->{$iface}{'now'}{'outOctets'},
};
}
return;
}
# File opened, load previous values.
while (my $line =<$_f>) {
$line = trim($line);
my ($timestamp, $iface, $inOctets, $outOctets) = split /$config->{'tmp_separator'}/, $line;
next if (!defined($tree->{trim($iface)}));
$tree->{trim($iface)}{'old'} = {
'timestamp' => int trim($timestamp),
'inOctets' => int trim($inOctets),
'outOctets' => int trim($outOctets),
};
}
close($_f);
foreach my $iface (keys %{$tree}) {
if (empty($tree->{trim($iface)}{'old'}{'timestamp'})) {
$tree->{$iface}{'old'} = {
'timestamp' => int $tree->{$iface}{'now'}{'timestamp'},
'inOctets' => int $tree->{$iface}{'now'}{'inOctets'},
'outOctets' => int $tree->{$iface}{'now'}{'outOctets'},
};
}
}
}
################################################################################
# Save metrics to temporal file.
################################################################################
sub save_data {
my ($config, $tree) = @_;
my $_f;
eval {
open($_f, ">$config->{'tmp_file'}") or die('Cannot open ' . $config->{'tmp_file'});
};
if( $@ ) {
logger($config, 'info', "Cannot save stats, please check writting permissions on [" . $config->{'tmp_file'} . "]") if (is_enabled($config->{'debug'}));
return;
}
# File not available, reset old data.
my $target_oids = 'x86_indexes';
$target_oids = 'x64_indexes' if is_enabled($config->{'use_x64'});
foreach my $iface (keys %{$tree}) {
# Timestamp.
print $_f $tree->{$iface}{'now'}{'timestamp'} . $config->{'tmp_separator'};
# Iface.
print $_f $iface . $config->{'tmp_separator'};
# InOctets.
print $_f $tree->{$iface}{'now'}{'inOctets'} . $config->{'tmp_separator'};
# OutOctets.
print $_f $tree->{$iface}{'now'}{'outOctets'} . $config->{'tmp_separator'};
# End.
print $_f "\n";
}
close($_f);
}
################################################################################
# Calculate bandwidth usage
################################################################################
sub get_bandwidth_usage {
my ($config, $tree) = @_;
foreach my $iface (keys %{$tree}) {
my $ifIndex = $iface;
if ($ifIndex !~ /^\./) {
$ifIndex = '.'.$ifIndex;
}
my $speed = $tree->{$iface}{'speed'};
my $input = $tree->{$iface}{'now'}{'inOctets'} - $tree->{$iface}{'old'}{'inOctets'};
my $output = $tree->{$iface}{'now'}{'outOctets'} - $tree->{$iface}{'old'}{'outOctets'};
my $delta = $tree->{$iface}{'now'}{'timestamp'} - $tree->{$iface}{'old'}{'timestamp'};
my $bandwidth = 0;
my $inUsage = 0;
my $outUsage = 0;
$tree->{$iface}->{'delta'} = {
'inOctets' => $input,
'outOctets' => $output,
'seconds' => $delta,
};
$tree->{$iface}->{'speed'} = $speed;
if (($speed > 0) && ($delta > 0)) {
# Information about bandwidth usage calculation: https://www.cisco.com/c/en/us/support/docs/ip/simple-network-management-protocol-snmp/8141-calculate-bandwidth-snmp.html
if ($tree->{$iface}{'duplex'} == HALF_DUPLEX
|| $tree->{$iface}{'duplex'} == UNKNOWN_DUPLEX
) {
$bandwidth = (($input + $output) * 8) / ($delta * $speed);
}
elsif ($tree->{$iface}{'duplex'} == FULL_DUPLEX) {
my $input_bandwidth = ($input * 8) / ($delta * $speed);
my $output_bandwidth = ($output * 8) / ($delta * $speed);
$bandwidth = ($input_bandwidth + $output_bandwidth) / 2;
}
else {
no warnings "uninitialized";
logger($config, 'info', "Failed to calculate bandwidth usage, unknown duplex mode: [" . $tree->{$iface}{'duplex_mode'} . "]") if (is_enabled($config->{'debug'}));
}
$inUsage = ($input * 8) / ($delta * $speed);
$outUsage = ($output * 8) / ($delta * $speed);
if ($inUsage > 1) {
$inUsage = 1;
logger($config, 'info', "Max input usage exceeded: $inUsage") if (is_enabled($config->{'debug'}));
}
if ($outUsage > 1) {
$outUsage = 1;
logger($config, 'info', "Max output usage exceeded: $outUsage") if (is_enabled($config->{'debug'}));
}
}
else {
logger($config, 'info', "Failed to calculate bandwidth usage, interface [" . $iface . "] speed is 0") if (is_enabled($config->{'debug'}));
}
$tree->{$iface}->{'bandwidth'} = 100 * $bandwidth;
$tree->{$iface}->{'inUsage'} = 100 * $inUsage;
$tree->{$iface}->{'outUsage'} = 100 * $outUsage;
}
}
################################################################################
#
# MAIN
#
################################################################################
if ($#ARGV < 0) {
print $HELP;
exit 0;
}
# Base config definition
my $_config = {
'oid_base' => ".1.3.6.1.2.1",
'as_agent_plugin' => 1,
'x86_indexes' => {
'__idx__' => ".2.2.1.1",
'duplex' => ".10.7.2.1.19",
'inOctets' => ".2.2.1.16",
'outOctets' => ".2.2.1.10",
'ifSpeed' => ".2.2.1.5",
},
'x64_indexes' => {
# In x64 there is no 'index' branch. Uses latest 'id' in OID as ID.
'__idx__' => ".2.2.1.1",
'duplex' => ".10.7.2.1.19",
'inOctets' => ".31.1.1.1.6",
'outOctets' => ".31.1.1.1.10",
'ifSpeed' => ".2.2.1.5",
},
};
$_config = read_configuration($_config);
if (check_lib_version($pandora_version) == 0){
print_stderror($_config, "Incorrect PluginTools library version " . get_lib_version() . " != " . $VERSION . " functionality could be affected.");
}
my $config;
foreach my $pk (keys %{$_config}) {
my $k = update_config_key($pk);
if (!empty($k)) {
$config->{$k} = $_config->{$pk};
}
else {
$config->{$pk} = $_config->{$pk};
}
}
$config->{'host'} = '127.0.0.1' if empty($config->{'host'});
$config->{'port'} = '161' if empty($config->{'port'});
$config->{'tmp_separator'} = ';' if empty($config->{'tmp_separator'});
$config->{'tmp'} = (($^O =~ /win/)?$ENV{'TMP'}:'/tmp') if empty($config->{'tmp'});
if(snmp_walk({
%{$config},
'oid' => '.1.3.6.1.2.1.31.1.1.1.6'
})
) {
# x64 counters available.
$config->{'use_x64'} = 1;
} else {
# x64 counters not available.
$config->{'use_x64'} = 1;
}
# Create unique name for tmp and log file for host
my $filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'host'};
if (!empty($config->{'uniqid'})) {
$filename = $config->{'tmp'}.'/pandora_bandwith_'.$config->{'uniqid'};
}
# Replace every dot for underscore
$filename =~ tr/./_/;
$config->{'tmp_file'} = $filename.'.idx' if empty($config->{'tmp_file'});
$config->{'log'} = $filename.'.log' if empty($config->{'log'});
my @int_exc = split /,/, trim($config->{'interface_exceptions'}) if (!empty($config->{'interface_exceptions'}));
if ($#int_exc >= 0) {
$config->{'interface_exceptions'} = \@int_exc;
}
my @only_int = split /,/, trim($config->{'only_interfaces'}) if (!empty($config->{'only_interfaces'}));
if ($#only_int >= 0) {
$config->{'only_interfaces'} = \@only_int;
}
logger($config, 'info', "Plugin starts") if (is_enabled($config->{'debug'}));
if (is_enabled($config->{'debug'})) {
eval {
eval "use Data::Dumper;1;";if($@) {}
logger($config, Dumper($config)) if (is_enabled($config->{'debug'}));
};
if($@) {}
}
my $analysis_tree = prepare_tree($config);
if (!empty($analysis_tree->{'error'})) {
logger($config, 'info', "Failed: " . $analysis_tree->{'error'}) if (is_enabled($config->{'debug'}));
exit 0;
}
else {
get_bandwidth_usage($config, $analysis_tree);
}
# Report data
my @modules;
my $bandwidth = 0;
my $inUsage = 0;
my $outUsage = 0;
my $i = 0;
my $j = 0;
my $k = 0;
foreach my $iface (keys %{$analysis_tree}) {
# Calculate summary;
if (is_enabled($analysis_tree->{$iface}{'bandwidth'})) {
$bandwidth = $analysis_tree->{$iface}{'bandwidth'};
$i++;
}
if (is_enabled($analysis_tree->{$iface}{'inUsage'})) {
$inUsage = $analysis_tree->{$iface}{'inUsage'};
$j++;
}
if (is_enabled($analysis_tree->{$iface}{'outUsage'})) {
$outUsage = $analysis_tree->{$iface}{'outUsage'};
$k++;
}
}
if ($j > 0 && is_enabled($config->{'inUsage'})) {
$inUsage /= $j;
print sprintf("%.9f\n", $inUsage);
} elsif ($k > 0 && is_enabled($config->{'outUsage'})) {
$outUsage /= $k;
print sprintf("%.9f\n", $outUsage);
}
if ($i > 0
&& !is_enabled($config->{'inUsage'})
&& !is_enabled($config->{'outUsage'})
) {
$bandwidth /= $i;
print sprintf("%.9f\n", $bandwidth);
}
logger($config, 'info', "Plugin ends") if (is_enabled($config->{'debug'}));

View File

@ -75,9 +75,14 @@ export default class BarsGraph extends Item<BarsGraphProps> {
element.className = "bars-graph";
element.style.backgroundImage = `url(${this.props.html})`;
element.style.backgroundRepeat = "no-repeat";
element.style.backgroundSize = `${this.props.width}px ${
this.props.height
}px`;
element.style.backgroundSize = `${this.props.width}px ${this.props.height}px`;
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
return element;
}
@ -85,8 +90,13 @@ export default class BarsGraph extends Item<BarsGraphProps> {
protected updateDomElement(element: HTMLElement): void {
element.style.backgroundImage = `url(${this.props.html})`;
element.style.backgroundRepeat = "no-repeat";
element.style.backgroundSize = `${this.props.width}px ${
this.props.height
}px`;
element.style.backgroundSize = `${this.props.width}px ${this.props.height}px`;
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
}
}

View File

@ -410,6 +410,13 @@ export default class ColorCloud extends Item<ColorCloudProps> {
defs.append(radialGradient);
svg.append(defs, circle);
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
svg.setAttribute("opacity", "0.2");
}
return svg;
}

View File

@ -56,6 +56,13 @@ export default class DonutGraph extends Item<DonutGraphProps> {
element.className = "donut-graph";
element.innerHTML = this.props.html;
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Hack to execute the JS after the HTML is added to the DOM.
const scripts = element.getElementsByTagName("script");
for (let i = 0; i < scripts.length; i++) {

View File

@ -48,6 +48,13 @@ export default class EventsHistory extends Item<EventsHistoryProps> {
element.className = "events-history";
element.innerHTML = this.props.html;
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Hack to execute the JS after the HTML is added to the DOM.
const scripts = element.getElementsByTagName("script");
for (let i = 0; i < scripts.length; i++) {

View File

@ -97,6 +97,12 @@ export default class ModuleGraph extends Item<ModuleGraphProps> {
element.innerHTML = this.props.html;
element.className = "module-graph";
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Remove the overview graph.
const legendP = element.getElementsByTagName("p");

View File

@ -261,6 +261,13 @@ export default class Percentile extends Item<PercentileProps> {
break;
}
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
svg.setAttribute("opacity", "0.2");
}
if (svg !== null) element.append(svg);
return element;

View File

@ -22,7 +22,8 @@ export type SimpleValueProps = {
| {
processValue: "avg" | "max" | "min";
period: number;
}) &
}
) &
ItemProps &
WithModuleProps &
LinkedVisualConsoleProps;
@ -95,6 +96,13 @@ export default class SimpleValue extends Item<SimpleValueProps> {
const element = document.createElement("div");
element.className = "simple-value";
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
if (this.props.valueType === "image") {
const img = document.createElement("img");
img.src = this.props.value;

View File

@ -78,6 +78,13 @@ export default class StaticGraph extends Item<StaticGraphProps> {
element.style.backgroundSize = "contain";
element.style.backgroundPosition = "center";
if (
this.props.agentDisabled === true ||
this.props.moduleDisabled === true
) {
element.style.opacity = "0.2";
}
// Show last value in a tooltip.
if (
this.props.lastValue !== null &&

View File

@ -177,7 +177,8 @@ export function agentPropsDecoder(data: AnyObject): WithAgentProps {
agentName: notEmptyStringOr(data.agentName, null),
agentAlias: notEmptyStringOr(data.agentAlias, null),
agentDescription: notEmptyStringOr(data.agentDescription, null),
agentAddress: notEmptyStringOr(data.agentAddress, null)
agentAddress: notEmptyStringOr(data.agentAddress, null),
agentDisabled: parseBoolean(data.agentDisabled)
};
return data.metaconsoleId != null
@ -198,6 +199,7 @@ export function modulePropsDecoder(data: AnyObject): WithModuleProps {
moduleId: parseIntOr(data.moduleId, null),
moduleName: notEmptyStringOr(data.moduleName, null),
moduleDescription: notEmptyStringOr(data.moduleDescription, null),
moduleDisabled: parseBoolean(data.moduleDisabled),
...agentPropsDecoder(data) // Object spread: http://es6-features.org/#SpreadOperator
};
}

View File

@ -23,12 +23,14 @@ export interface WithAgentProps {
agentAlias: string | null;
agentDescription: string | null;
agentAddress: string | null;
agentDisabled: boolean;
}
export interface WithModuleProps extends WithAgentProps {
moduleId: number | null;
moduleName: string | null;
moduleDescription: string | null;
moduleDisabled: boolean;
}
export type LinkedVisualConsolePropsStatus =