Merge remote-tracking branch 'origin/develop' into ent-EDF
Conflicts: pandora_console/general/header.php
This commit is contained in:
commit
98237a8d34
|
@ -348,20 +348,20 @@ if ($config['menu_type'] == 'classic') {
|
|||
|
||||
|
||||
// Support.
|
||||
if (enterprise_installed()) {
|
||||
$header_support_link = 'https://support.artica.es/';
|
||||
if (defined('PANDORA_ENTERPRISE')) {
|
||||
$header_support_link = $config['custom_support_url'];
|
||||
} else {
|
||||
$header_support_link = 'https://pandorafms.com/forums/';
|
||||
}
|
||||
|
||||
$header_support = '<div id="header_support">';
|
||||
$header_support .= '<a href="'.$header_support_link.'" target="_blank">';
|
||||
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
|
||||
$header_support .= html_print_image('/images/header_support.png', true, ['title' => __('Go to support'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_support .= '</a></div>';
|
||||
|
||||
// Documentation.
|
||||
$header_docu = '<div id="header_docu">';
|
||||
$header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">';
|
||||
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
|
||||
$header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
|
||||
$header_docu .= '</a></div>';
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
|
|||
echo '</td>';
|
||||
|
||||
echo '<td style="border:1px solid #FFF; text-align:center;">';
|
||||
echo '<a href="'.$config['custom_docs_url'].'" target="_blank" style="text-decoration:none;">'.html_print_image(
|
||||
echo '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank" style="text-decoration:none;">'.html_print_image(
|
||||
'images/documentation.png',
|
||||
true,
|
||||
[
|
||||
|
@ -96,7 +96,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
|
|||
]
|
||||
).'</a>';
|
||||
echo '<br style="margin-bottom: 40px;" />';
|
||||
echo '<a style="font-size: 9pt;" href="'.$config['custom_docs_url'].'" target="_blank">'.__('Documentation').'</span></a>';
|
||||
echo '<a style="font-size: 9pt;"href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Documentation').'</span></a>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
|
|
@ -96,16 +96,16 @@ echo '<div id="header_login">';
|
|||
|
||||
echo '<div id="list_icon_docs_support"><ul>';
|
||||
if ($docs_logo !== false) {
|
||||
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
|
||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>';
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
if ($support_logo !== false) {
|
||||
echo '<li id="li_margin_left"><a href="'.$config['custom_support_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
echo '<li id="li_margin_left"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
}
|
||||
|
||||
echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
|
||||
echo '<li><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>';
|
||||
} else {
|
||||
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
|
||||
echo '<li>'.__('Support').'</li>';
|
||||
|
|
|
@ -3777,11 +3777,14 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
$("#checkbox-checkbox_show_resume").change(function(){
|
||||
if($(this).is(":checked")){
|
||||
type = $("#type").val();
|
||||
if($(this).is(":checked") && type !== 'general'){
|
||||
$("#row_select_fields2").show();
|
||||
$("#row_select_fields3").show();
|
||||
}
|
||||
else{
|
||||
$("#row_select_fields2").hide();
|
||||
$("#row_select_fields3").hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ define('COL_UNKNOWN', '#B2B2B2');
|
|||
define('COL_DOWNTIME', '#976DB1');
|
||||
define('COL_IGNORED', '#DDD');
|
||||
define('COL_ALERTFIRED', '#F36201');
|
||||
define('COL_MINOR', '#B2B2B2');
|
||||
define('COL_MINOR', '#F099A2');
|
||||
define('COL_MAJOR', '#C97A4A');
|
||||
define('COL_INFORMATIONAL', '#E4E4E4');
|
||||
define('COL_MAINTENANCE', '#4a83f3');
|
||||
|
|
|
@ -1905,7 +1905,7 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
|
|||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator> in this order
|
||||
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator><recursion> in this order
|
||||
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||
* example for CSV:
|
||||
*
|
||||
|
@ -1934,17 +1934,25 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
|
|||
}
|
||||
|
||||
if (isset($other['data'][0])) {
|
||||
// Filter by SO
|
||||
// Filter by SO.
|
||||
if ($other['data'][0] != '') {
|
||||
$where .= ' AND tconfig_os.id_os = '.$other['data'][0];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($other['data'][1])) {
|
||||
// Filter by group
|
||||
// Filter by group.
|
||||
if ($other['data'][1] != '') {
|
||||
$where .= ' AND id_grupo = '.$other['data'][1];
|
||||
$ag_groups = $other['data'][1];
|
||||
// Recursion.
|
||||
if ($other['data'][6] === '1') {
|
||||
$ag_groups = groups_get_id_recursive($ag_groups, true);
|
||||
}
|
||||
|
||||
$ag_groups = implode(',', (array) $ag_groups);
|
||||
}
|
||||
|
||||
$where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))';
|
||||
}
|
||||
|
||||
if (isset($other['data'][3])) {
|
||||
|
@ -1974,24 +1982,27 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
|
|||
// Initialization of array
|
||||
$result_agents = [];
|
||||
// Filter by state
|
||||
if (defined('METACONSOLE')) {
|
||||
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
||||
tconfig_os.name, url_address, nombre
|
||||
FROM tconfig_os, tmetaconsole_agent
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tmetaconsole_agent.id_agente = tagent_secondary_group.id_agent
|
||||
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
|
||||
AND disabled = 0 $where AND $groups";
|
||||
if (is_metaconsole()) {
|
||||
$sql = 'SELECT id_agente, alias, direccion, comentarios,
|
||||
tconfig_os.name, url_address, nombre
|
||||
FROM tconfig_os, tmetaconsole_agent
|
||||
LEFT JOIN tmetaconsole_agent_secondary_group
|
||||
ON tmetaconsole_agent.id_agente = tmetaconsole_agent_secondary_group.id_agent
|
||||
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
|
||||
AND disabled = 0 '.$where.' AND '.$groups;
|
||||
} else {
|
||||
$sql = "SELECT id_agente, alias, direccion, comentarios,
|
||||
$sql = 'SELECT id_agente, alias, direccion, comentarios,
|
||||
tconfig_os.name, url_address, nombre
|
||||
FROM tconfig_os, tagente
|
||||
LEFT JOIN tagent_secondary_group
|
||||
ON tagente.id_agente = tagent_secondary_group.id_agent
|
||||
WHERE tagente.id_os = tconfig_os.id_os
|
||||
AND disabled = 0 $where AND $groups";
|
||||
AND disabled = 0 '.$where.' AND '.$groups;
|
||||
}
|
||||
|
||||
// Group by agent
|
||||
$sql .= ' GROUP BY id_agente';
|
||||
|
||||
$all_agents = db_get_all_rows_sql($sql);
|
||||
|
||||
// Filter by status: unknown, warning, critical, without modules
|
||||
|
@ -14226,6 +14237,46 @@ function api_get_agents_id_name_by_cluster_name($cluster_name, $trash1, $trash2,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get agents alias, id and server id (if Metaconsole) given agent alias
|
||||
* matching part of it.
|
||||
*
|
||||
* @param string $alias
|
||||
* @param $trash1
|
||||
* @param $trash2
|
||||
* @param string $returnType
|
||||
* Example:
|
||||
* api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandrora&id2=strict
|
||||
*/
|
||||
function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($strict == 'strict') {
|
||||
$where_clause = " alias = '$alias'";
|
||||
} else {
|
||||
$where_clause = " upper(alias) LIKE upper('%$alias%')";
|
||||
}
|
||||
|
||||
if (is_metaconsole()) {
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause");
|
||||
} else {
|
||||
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente from tagente WHERE $where_clause");
|
||||
}
|
||||
|
||||
if ($all_agents !== false) {
|
||||
$data = [
|
||||
'type' => 'json',
|
||||
'data' => $all_agents,
|
||||
];
|
||||
|
||||
returnData('json', $data, JSON_FORCE_OBJECT);
|
||||
} else {
|
||||
returnError('error_agents', 'Alias did not match any agent.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function api_get_modules_id_name_by_cluster_id($cluster_id)
|
||||
{
|
||||
global $config;
|
||||
|
|
|
@ -179,6 +179,10 @@ function reporting_make_reporting_data(
|
|||
$report['group_name'] = groups_get_name($report['id_group']);
|
||||
$report['contents'] = [];
|
||||
|
||||
if (empty($report['period']) && $pdf === false) {
|
||||
$report['period'] = $period;
|
||||
}
|
||||
|
||||
if (empty($contents)) {
|
||||
return reporting_check_structure_report($report);
|
||||
}
|
||||
|
|
|
@ -121,12 +121,9 @@ function html_do_report_info($report)
|
|||
</tr>
|
||||
<tr>
|
||||
<td><b>'.__('Report date').': </b></td>';
|
||||
if (isset($report['period'])) {
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period'])) {
|
||||
$html .= '<td>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</td>';
|
||||
}
|
||||
|
||||
$html .= '<td></td>';
|
||||
if (is_numeric($report['datetime']) && is_numeric($report['period']) && ($report['period'] != 0)) {
|
||||
$html .= '<td>'.__('From').' <b>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</b></td>';
|
||||
$html .= '<td>'.__('to').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
|
||||
} else {
|
||||
$html .= '<td>'.__('Items period before').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
|
||||
}
|
||||
|
@ -3583,10 +3580,10 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
}
|
||||
|
||||
$table1->head[3] = __('Value');
|
||||
$table1->style[0] = 'text-align: left';
|
||||
$table1->style[1] = 'text-align: left';
|
||||
$table1->style[2] = 'text-align: left';
|
||||
$table1->style[3] = 'text-align: left';
|
||||
$table1->style[0] = 'text-align: center';
|
||||
$table1->style[1] = 'text-align: center';
|
||||
$table1->style[2] = 'text-align: center';
|
||||
$table1->style[3] = 'text-align: center';
|
||||
|
||||
// Begin - Order by agent.
|
||||
foreach ($item['data'] as $key => $row) {
|
||||
|
@ -3717,12 +3714,16 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
$table_summary->head = [];
|
||||
$table_summary->head_colspan = [];
|
||||
$table_summary->align = [];
|
||||
$table_summary->headstyle = [];
|
||||
$table_summary->headstyle[0] = 'text-align: center;';
|
||||
$table_summary->headstyle[1] = 'text-align: center;';
|
||||
$table_summary->headstyle[2] = 'text-align: center;';
|
||||
|
||||
$table_summary->align[0] = 'left';
|
||||
$table_summary->align[1] = 'right';
|
||||
$table_summary->align[2] = 'right';
|
||||
$table_summary->align[3] = 'left';
|
||||
$table_summary->align[4] = 'right';
|
||||
$table_summary->align[0] = 'center';
|
||||
$table_summary->align[1] = 'center';
|
||||
$table_summary->align[2] = 'center';
|
||||
$table_summary->align[3] = 'center';
|
||||
$table_summary->align[4] = 'center';
|
||||
|
||||
$table_summary->head_colspan[0] = 2;
|
||||
$table_summary->head[0] = __('Min Value');
|
||||
|
@ -3730,11 +3731,11 @@ function reporting_html_general($table, $item, $pdf=0)
|
|||
$table_summary->head_colspan[2] = 2;
|
||||
$table_summary->head[2] = __('Max Value');
|
||||
|
||||
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'];
|
||||
$table_summary->data[0][1] = $item['min']['formated_value'];
|
||||
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'].str_repeat(' ', 20).$item['min']['formated_value'];
|
||||
$table_summary->data[0][1] = '';
|
||||
$table_summary->data[0][2] = format_for_graph($item['avg_value'], 2);
|
||||
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'];
|
||||
$table_summary->data[0][4] = $item['max']['formated_value'];
|
||||
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'].str_repeat(' ', 20).$item['max']['formated_value'];
|
||||
$table_summary->data[0][4] = '';
|
||||
|
||||
if ($pdf !== 0) {
|
||||
$return_pdf .= html_print_table($table_summary, true);
|
||||
|
|
|
@ -3237,6 +3237,8 @@ function ui_print_datatable(array $parameters)
|
|||
{
|
||||
extend: "csv",
|
||||
text : "'.__('Export current page to CSV').'",
|
||||
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
|
||||
fieldSeparator: "'.$config['csv_divider'].'",
|
||||
exportOptions : {
|
||||
modifier : {
|
||||
// DataTables core
|
||||
|
@ -5745,3 +5747,23 @@ function ui_print_comments($comments)
|
|||
return io_safe_output($comentario);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get complete external pandora url.
|
||||
*
|
||||
* @param string $url Url to be parsed.
|
||||
*
|
||||
* @return string Full url.
|
||||
*/
|
||||
function ui_get_full_external_url(string $url)
|
||||
{
|
||||
$url_parsed = parse_url($url);
|
||||
if ($url_parsed) {
|
||||
if (!isset($url_parsed['scheme'])) {
|
||||
$url = 'http://'.$url;
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ Besides the defined module macros, the following macros are available:
|
|||
<li>_policy_: Name of the policy that the module belongs to (if applies).</li>
|
||||
<li>_prevdata_: Module previous data before the alert has been triggered.</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_secondarygroups_: List of all secondary groups of the agent.</li>
|
||||
<li>_server_ip_: Ip of server assigned to agent. </li>
|
||||
<li>_server_name_: Name of server assigned to agent. </li>
|
||||
<li>_target_ip_: IP address for the module’s target.</li>
|
||||
|
|
|
@ -77,6 +77,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
|
|||
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
|
||||
<li>_prevdata_: Dato previo antes de disparase la alerta.</li>
|
||||
<li>_rca_: Cadena de análasis de causa raíz (sólo para servicios).</li>
|
||||
<li>_secondarygroups_: Lista de todos los grupos secundarios del agente.</li>
|
||||
<li>_server_ip_: Ip del servidor al que el agente está asignado. </li>
|
||||
<li>_server_name_: Nombre del servidor al que el agente está asignado. </li>
|
||||
<li>_target_ip_: Dirección IP del objetivo del módulo.</li>
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
<li>_policy_ : モジュールが属するポリシー名 (存在する場合)</li>
|
||||
<li>_prevdata_ : アラートを発報する前のモジュールデータ</li>
|
||||
<li>_rca_: Root cause analysis chain (only for services).</li>
|
||||
<li>_secondarygroups_: エージェントのすべてのセカンダリグループのリスト</li>
|
||||
<li>_server_ip_ : エージェントが割り当てられているサーバ IP。</li>
|
||||
<li>_server_name_ : エージェントが割り当てられているサーバ名。 </li>
|
||||
<li>_target_ip_ : モジュールの対象IPアドレス</li>
|
||||
|
|
|
@ -1018,7 +1018,7 @@ $adv_inputs[] = $in;
|
|||
$user_users = users_get_user_users(
|
||||
$config['id_user'],
|
||||
$access,
|
||||
users_can_manage_group_all()
|
||||
true
|
||||
);
|
||||
|
||||
$data = html_print_select(
|
||||
|
@ -1539,7 +1539,7 @@ function process_datatables_callback(table, settings) {
|
|||
// Agent id.
|
||||
target = i;
|
||||
}
|
||||
if(label == '<?php echo __('Agent name'); ?>') {
|
||||
if(label == '<?php echo addslashes(__('Agent name')); ?>') {
|
||||
// Agent id.
|
||||
target = i;
|
||||
break;
|
||||
|
@ -1619,15 +1619,13 @@ function process_datatables_item(item) {
|
|||
|
||||
// Show comments events.
|
||||
item.user_comment = item.comments
|
||||
|
||||
if(item.comments.length > 80){
|
||||
|
||||
item.user_comment += ' <a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
|
||||
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
|
||||
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
|
||||
|
||||
if(typeof item.comments !== 'undefined' && item.comments.length > 80) {
|
||||
item.user_comment += ' <a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
|
||||
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
|
||||
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
|
||||
}
|
||||
|
||||
|
||||
// Grouped events.
|
||||
if(item.max_id_evento) {
|
||||
item.id_evento = item.max_id_evento
|
||||
|
|
|
@ -767,7 +767,7 @@ $data[0] = __('User ack.').$jump;
|
|||
$user_users = users_get_user_users(
|
||||
$config['id_user'],
|
||||
$access,
|
||||
users_can_manage_group_all()
|
||||
users_can_manage_group_all($access)
|
||||
);
|
||||
|
||||
$data[0] .= html_print_select(
|
||||
|
|
|
@ -118,7 +118,7 @@ $now = date('Y-m-d');
|
|||
|
||||
// Download header.
|
||||
header('Content-type: text/txt');
|
||||
header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"');
|
||||
header('Content-Disposition: attachment; filename="export_events_'.$now.'.csv"');
|
||||
|
||||
try {
|
||||
$fb64 = get_parameter('fb64', null);
|
||||
|
|
|
@ -91,10 +91,6 @@ check_login();
|
|||
$id_report = (int) get_parameter('id');
|
||||
$filename = (string) get_parameter('filename');
|
||||
|
||||
if (empty($filename)) {
|
||||
$filename = 'pandorafms_report_'.date('Y-m-d_His');
|
||||
}
|
||||
|
||||
$date_mode = get_parameter('date_mode', 'none');
|
||||
|
||||
$period = null;
|
||||
|
@ -132,6 +128,10 @@ $report = reporting_make_reporting_data(
|
|||
'static'
|
||||
);
|
||||
|
||||
if (empty($filename)) {
|
||||
$filename = $report['name'].'_report_'.date('Y-m-d_His');
|
||||
}
|
||||
|
||||
reporting_xml_get_report($report, $filename);
|
||||
|
||||
exit;
|
||||
|
|
|
@ -1130,6 +1130,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
_name_tag_ => undef,
|
||||
_all_address_ => undef,
|
||||
'_address_\d+_' => undef,
|
||||
_secondarygroups_ => undef,
|
||||
);
|
||||
|
||||
if ((defined ($extra_macros)) && (ref($extra_macros) eq "HASH")) {
|
||||
|
@ -4118,6 +4119,15 @@ sub on_demand_macro($$$$$$;$) {
|
|||
}
|
||||
|
||||
return(defined($field_value)) ? $field_value : '';
|
||||
} elsif ($macro eq '_secondarygroups_') {
|
||||
my $field_value = '';
|
||||
|
||||
my @groups = get_db_rows ($dbh, 'SELECT tg.nombre from tagent_secondary_group as tsg INNER JOIN tgrupo tg ON tsg.id_group = tg.id_grupo WHERE tsg.id_agent = ?', $module->{'id_agente'});
|
||||
foreach my $element (@groups) {
|
||||
$field_value .= $element->{'nombre'} .",";
|
||||
}
|
||||
chop($field_value);
|
||||
return(defined($field_value)) ? '('.$field_value.')' : '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,12 +118,22 @@ sub help_screen{
|
|||
help_screen_line('--get_planned_downtimes_items', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all items of planned downtimes');
|
||||
help_screen_line('--set_planned_downtimes_deleted', '<name> ', 'Deleted a planned downtime');
|
||||
help_screen_line('--get_module_id', '<agent_id> <module_name>', 'Get the id of an module');
|
||||
<<<<<<< HEAD
|
||||
help_screen_line('--get_agent_group', '<agent_name>', 'Get the group name of an agent');
|
||||
help_screen_line('--get_agent_group_id', '<agent_name>', 'Get the group ID of an agent');
|
||||
help_screen_line('--get_agent_modules', '<agent_name>', 'Get the modules of an agent');
|
||||
help_screen_line('--get_agents_id_name_by_alias', '<agent_alias>', '[<strict>]', 'List id and alias of agents mathing given alias');
|
||||
help_screen_line('--get_agents', '[<group_name> <os_name> <status> <max_modules> <filter_substring> <policy_name>]', "Get \n\t list of agents with optative filter parameters");
|
||||
help_screen_line('--delete_conf_file', '<agent_name>', 'Delete a local conf of a given agent');
|
||||
help_screen_line('--clean_conf_file', '<agent_name>', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments");
|
||||
=======
|
||||
help_screen_line('--get_agent_group', '<agent_name> [<use_alias>]', 'Get the group name of an agent');
|
||||
help_screen_line('--get_agent_group_id', '<agent_name> [<use_alias>]', 'Get the group ID of an agent');
|
||||
help_screen_line('--get_agent_modules', '<agent_name> [<use_alias>]', 'Get the modules of an agent');
|
||||
help_screen_line('--get_agents', '[<group_name> <os_name> <status> <max_modules> <filter_substring> <policy_name> <use_alias>]', "Get \n\t list of agents with optative filter parameters");
|
||||
help_screen_line('--delete_conf_file', '<agent_name> [<use_alias>]', 'Delete a local conf of a given agent');
|
||||
help_screen_line('--clean_conf_file', '<agent_name> [<use_alias>]', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments");
|
||||
>>>>>>> origin/develop
|
||||
help_screen_line('--get_bad_conf_files', '', 'Get the files bad configured (without essential tokens)');
|
||||
help_screen_line('--locate_agent', '<agent_name> [<use_alias>]', 'Search a agent into of nodes of metaconsole. Only Enterprise.');
|
||||
help_screen_line('--migration_agent_queue', '<id_node> <source_node_name> <target_node_name> [<db_only>]', 'Migrate agent only metaconsole');
|
||||
|
@ -4849,6 +4859,49 @@ sub cli_get_agent_modules() {
|
|||
}
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Show id, name and id_server of an agent given alias
|
||||
# Related option: --get_agents_id_name_by_alias
|
||||
##############################################################################
|
||||
|
||||
sub cli_get_agents_id_name_by_alias() {
|
||||
my $agent_alias = @ARGV[2];
|
||||
my $strict = @ARGV[3];
|
||||
my @agents;
|
||||
my $where_value;
|
||||
|
||||
if($strict eq 'strict') {
|
||||
$where_value = $agent_alias;
|
||||
} else {
|
||||
$where_value = "%".$agent_alias."%";
|
||||
}
|
||||
|
||||
if(is_metaconsole($conf) == 1) {
|
||||
@agents = get_db_rows($dbh,"SELECT alias, id_agente, id_tagente, id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE UPPER(alias) LIKE UPPER(?)", $where_value);
|
||||
} else {
|
||||
@agents = get_db_rows($dbh,"SELECT alias, id_agente FROM tagente WHERE UPPER(alias) LIKE UPPER(?)", $where_value);
|
||||
}
|
||||
if(scalar(@agents) == 0) {
|
||||
print "[ERROR] No agents retrieved.\n\n";
|
||||
} else {
|
||||
if(is_metaconsole($conf) == 1) {
|
||||
print "alias, id_agente, id_tagente, id_server, server_name\n";
|
||||
|
||||
foreach my $agent (@agents) {
|
||||
|
||||
print safe_output($agent->{'alias'}).", ".$agent->{'id_agente'}.", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n";
|
||||
}
|
||||
} else {
|
||||
print "alias, id_agente\n";
|
||||
|
||||
foreach my $agent (@agents) {
|
||||
print $agent->{'id_agente'}.",".safe_output($agent->{'alias'})."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub cli_create_synthetic() {
|
||||
my $name_module = @ARGV[2];
|
||||
my $synthetic_type = @ARGV[3];
|
||||
|
@ -7426,6 +7479,10 @@ sub pandora_manage_main ($$$) {
|
|||
param_check($ltotal, 2, 1);
|
||||
cli_get_agent_modules();
|
||||
}
|
||||
elsif ($param eq '--get_agents_id_name_by_alias') {
|
||||
param_check($ltotal, 2,1);
|
||||
cli_get_agents_id_name_by_alias();
|
||||
}
|
||||
elsif ($param eq '--get_policy_modules') {
|
||||
param_check($ltotal, 1);
|
||||
cli_get_policy_modules();
|
||||
|
|
Loading…
Reference in New Issue