2008-06-20 Esteban Sanchez <estebans@artica.es>
* functions_db.php: Fixed get_agents_in_group() to handle "All" group properly and make it capable to get disabled agents or not. Style correction. Fixed a typo in agent_add_address(). * godmode/reporting/reporting_builder.php: Use get_agents_in_group() to get the agents in the group of the report, specially group "All". Added agent and module column to report content list when applies. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@893 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
76a4ac5f0b
commit
f5a7114a87
|
@ -1,3 +1,13 @@
|
||||||
|
2008-06-20 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* functions_db.php: Fixed get_agents_in_group() to handle "All" group
|
||||||
|
properly and make it capable to get disabled agents or not. Style
|
||||||
|
correction. Fixed a typo in agent_add_address().
|
||||||
|
|
||||||
|
* godmode/reporting/reporting_builder.php: Use get_agents_in_group()
|
||||||
|
to get the agents in the group of the report, specially group "All".
|
||||||
|
Added agent and module column to report content list when applies.
|
||||||
|
|
||||||
2008-06-20 Esteban Sanchez <estebans@artica.es>
|
2008-06-20 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* include/functions_reporting.php: Deleted reference to localhost. Align
|
* include/functions_reporting.php: Deleted reference to localhost. Align
|
||||||
|
|
|
@ -190,6 +190,13 @@ if ($id_report) {
|
||||||
$report_id_group = $report['id_group'];
|
$report_id_group = $report['id_group'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$all_agents = get_agents_in_group ($report_id_group);
|
||||||
|
$agents = array ();
|
||||||
|
foreach ($all_agents as $agent) {
|
||||||
|
$agents[$agent['id_agente']] = $agent['nombre'];
|
||||||
|
}
|
||||||
|
asort ($agents);
|
||||||
|
|
||||||
if ($edit_sla_report_content) {
|
if ($edit_sla_report_content) {
|
||||||
/* Edit SLA report form */
|
/* Edit SLA report form */
|
||||||
$add_sla = (bool) get_parameter ('add_sla');
|
$add_sla = (bool) get_parameter ('add_sla');
|
||||||
|
@ -280,9 +287,8 @@ if ($edit_sla_report_content) {
|
||||||
$table->size[0] = '150px';
|
$table->size[0] = '150px';
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->style[0] = 'font-weight: bold';
|
$table->style[0] = 'font-weight: bold';
|
||||||
$sql = sprintf ('SELECT id_agente, nombre FROM tagente WHERE id_grupo = %d ORDER BY nombre', $report_id_group);
|
|
||||||
$table->data[0][0] = lang_string ('agent');
|
$table->data[0][0] = lang_string ('agent');
|
||||||
$table->data[0][1] = print_select_from_sql ($sql, 'id_agent', 0, '', '--', 0, true);
|
$table->data[0][1] = print_select ($agents, 'id_agent', 0, '', '--', 0, true);
|
||||||
$table->data[1][0] = lang_string ('module');
|
$table->data[1][0] = lang_string ('module');
|
||||||
$table->data[1][1] = print_select (array (), 'id_module', 0, '', '--', 0, true);
|
$table->data[1][1] = print_select (array (), 'id_module', 0, '', '--', 0, true);
|
||||||
$table->data[2][0] = lang_string ('sla_min');
|
$table->data[2][0] = lang_string ('sla_min');
|
||||||
|
@ -387,8 +393,7 @@ if ($edit_sla_report_content) {
|
||||||
$table->data[1][1] = print_select ($periods, 'period', 0, '', '--', 0, true);
|
$table->data[1][1] = print_select ($periods, 'period', 0, '', '--', 0, true);
|
||||||
|
|
||||||
$table->data[2][0] = lang_string ('source_agent');
|
$table->data[2][0] = lang_string ('source_agent');
|
||||||
$sql = sprintf ('SELECT id_agente, nombre FROM tagente WHERE id_grupo = %d ORDER BY nombre', $report_id_group);
|
$table->data[2][1] = print_select ($agents, 'id_agent', $id_agent, '', '--', 0, true);
|
||||||
$table->data[2][1] = print_select_from_sql ($sql, 'id_agent', $id_agent, '', '--', 0, true);
|
|
||||||
|
|
||||||
$table->data[3][0] = lang_string ('module');
|
$table->data[3][0] = lang_string ('module');
|
||||||
$modules = array ();
|
$modules = array ();
|
||||||
|
@ -421,15 +426,16 @@ if ($edit_sla_report_content) {
|
||||||
$table->rowstyle = array ();
|
$table->rowstyle = array ();
|
||||||
$table->head[0] = lang_string ('order');
|
$table->head[0] = lang_string ('order');
|
||||||
$table->head[1] = lang_string ('type');
|
$table->head[1] = lang_string ('type');
|
||||||
$table->head[2] = lang_string ('module');
|
$table->head[2] = lang_string ('agent');
|
||||||
$table->head[3] = lang_string ('period');
|
$table->head[3] = lang_string ('module');
|
||||||
$table->head[4] = lang_string ('Options');
|
$table->head[4] = lang_string ('period');
|
||||||
|
$table->head[5] = lang_string ('Options');
|
||||||
$table->align = array ();
|
$table->align = array ();
|
||||||
$table->align[0] = 'center';
|
$table->align[0] = 'center';
|
||||||
$table->align[4] = 'center';
|
|
||||||
if ($report_id_user == $config['id_user']) {
|
|
||||||
$table->align[5] = 'center';
|
$table->align[5] = 'center';
|
||||||
$table->head[5] = lang_string ('delete');
|
if ($report_id_user == $config['id_user']) {
|
||||||
|
$table->align[6] = 'center';
|
||||||
|
$table->head[6] = lang_string ('delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -454,15 +460,18 @@ if ($edit_sla_report_content) {
|
||||||
}
|
}
|
||||||
$data[1] = get_report_name ($report_content['type']);
|
$data[1] = get_report_name ($report_content['type']);
|
||||||
$data[2] = '--';
|
$data[2] = '--';
|
||||||
if (get_report_type_data_source ($report_content['type']) == 'module')
|
$data[3] = '--';
|
||||||
$data[2] = get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']);
|
if (get_report_type_data_source ($report_content['type']) == 'module') {
|
||||||
$data[3] = human_time_description ($report_content['period']);
|
$data[2] = dame_nombre_agente_agentemodulo ($report_content['id_agent_module']);
|
||||||
$data[4] = '';
|
$data[3] = get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']);
|
||||||
|
}
|
||||||
|
$data[4] = human_time_description ($report_content['period']);
|
||||||
|
$data[5] = '';
|
||||||
if ($report_content['type'] == 'SLA') {
|
if ($report_content['type'] == 'SLA') {
|
||||||
$data[4] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&edit_sla_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/setup.png"></a>';
|
$data[5] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&edit_sla_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/setup.png"></a>';
|
||||||
}
|
}
|
||||||
if ($report_id_user == $config['id_user']) {
|
if ($report_id_user == $config['id_user']) {
|
||||||
$data[5] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&delete_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/cross.png"></a>';
|
$data[6] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&delete_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/cross.png"></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
@ -534,7 +543,7 @@ function agent_changed () {
|
||||||
jQuery.ajax ({
|
jQuery.ajax ({
|
||||||
data: inputs.join ("&"),
|
data: inputs.join ("&"),
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: action="ajax.php",
|
url: "ajax.php",
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
|
@ -214,12 +214,25 @@ function give_disabled_group ($id_group) {
|
||||||
/**
|
/**
|
||||||
* Get all the agents in a group.
|
* Get all the agents in a group.
|
||||||
*
|
*
|
||||||
* @param $id_group Group id
|
* @param id_group Group id
|
||||||
|
* @param disabled Add disabled agents to agents. Default: False.
|
||||||
*
|
*
|
||||||
* @return An array with all agents in the group.
|
* @return An array with all agents in the group.
|
||||||
*/
|
*/
|
||||||
function get_agents_in_group ($id_group) {
|
function get_agents_in_group ($id_group, $disabled = false) {
|
||||||
|
echo "GROUP: ".$id_group;
|
||||||
|
/* 'All' group must return all agents */
|
||||||
|
if ($id_group == 1) {
|
||||||
|
if ($disabled)
|
||||||
|
return get_db_all_rows_in_table ('tagente');
|
||||||
|
return get_db_all_rows_field_filter ('tagente', 'disabled', 0);
|
||||||
|
}
|
||||||
|
if ($disabled)
|
||||||
return get_db_all_rows_field_filter ('tagente', 'id_grupo', (int) $id_group);
|
return get_db_all_rows_field_filter ('tagente', 'id_grupo', (int) $id_group);
|
||||||
|
$sql = sprintf ('SELECT * FROM tagente
|
||||||
|
WHERE id_grupo = %d AND disabled = 0',
|
||||||
|
$id_group);
|
||||||
|
return get_db_all_rows_sqlfree ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -942,19 +955,23 @@ function show_icon_type ($id_type) {
|
||||||
* @param int Server type id
|
* @param int Server type id
|
||||||
* @return string Fully formatted IMG HTML tag with icon
|
* @return string Fully formatted IMG HTML tag with icon
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show_server_type ($id){
|
function show_server_type ($id){
|
||||||
global $config;
|
global $config;
|
||||||
switch ($id) {
|
switch ($id) {
|
||||||
case 1: return '<img src="images/data.png" title="Pandora FMS Data server">';
|
case 1:
|
||||||
|
return '<img src="images/data.png" title="Pandora FMS Data server">';
|
||||||
break;
|
break;
|
||||||
case 2: return '<img src="images/network.png" title="Pandora FMS Network server">';
|
case 2:
|
||||||
|
return '<img src="images/network.png" title="Pandora FMS Network server">';
|
||||||
break;
|
break;
|
||||||
case 4: return '<img src="images/plugin.png" title="Pandora FMS Plugin server">';
|
case 4:
|
||||||
|
return '<img src="images/plugin.png" title="Pandora FMS Plugin server">';
|
||||||
break;
|
break;
|
||||||
case 5: return '<img src="images/chart_bar.png" title="Pandora FMS Prediction server">';
|
case 5:
|
||||||
|
return '<img src="images/chart_bar.png" title="Pandora FMS Prediction server">';
|
||||||
break;
|
break;
|
||||||
case 6: return '<img src="images/wmi.png" title="Pandora FMS WMI server">';
|
case 6:
|
||||||
|
return '<img src="images/wmi.png" title="Pandora FMS WMI server">';
|
||||||
break;
|
break;
|
||||||
default: return "--";
|
default: return "--";
|
||||||
}
|
}
|
||||||
|
@ -1023,7 +1040,7 @@ function agent_add_address ($id_agent, $ip_address) {
|
||||||
WHERE taddress_agent.id_a = taddress.id_a
|
WHERE taddress_agent.id_a = taddress.id_a
|
||||||
AND ip = '$ip_address'
|
AND ip = '$ip_address'
|
||||||
AND id_agent = $id_agent";
|
AND id_agent = $id_agent";
|
||||||
$current_address = get_db_sql_row ($sql);
|
$current_address = get_db_row_sql ($sql);
|
||||||
if ($current_address)
|
if ($current_address)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue