mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2013-01-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_agents.php include/functions_treeview.php extensions/net_tools.php extensions/module_groups.php operation/agentes/status_monitor.php operation/agentes/sla_view.php operation/messages/message_list.php godmode/agentes/fields_manager.php godmode/alerts/alert_list.builder.php godmode/massive/massive_delete_agents.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_modules.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php: Merged fixes from branches. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7414 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
2280aa6f06
commit
b715cc4618
@ -1,3 +1,21 @@
|
|||||||
|
2013-01-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
|
* include/functions_agents.php
|
||||||
|
include/functions_treeview.php
|
||||||
|
extensions/net_tools.php
|
||||||
|
extensions/module_groups.php
|
||||||
|
operation/agentes/status_monitor.php
|
||||||
|
operation/agentes/sla_view.php
|
||||||
|
operation/messages/message_list.php
|
||||||
|
godmode/agentes/fields_manager.php
|
||||||
|
godmode/alerts/alert_list.builder.php
|
||||||
|
godmode/massive/massive_delete_agents.php
|
||||||
|
godmode/massive/massive_edit_agents.php
|
||||||
|
godmode/massive/massive_delete_modules.php
|
||||||
|
godmode/massive/massive_delete_alerts.php
|
||||||
|
godmode/massive/massive_edit_modules.php: Merged fixes from
|
||||||
|
branches.
|
||||||
|
|
||||||
2012-01-09 Sancho Lerena <slerena@artica.es>
|
2012-01-09 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* godmode/setup/setup.php: Fixed warning on enabling EACL.
|
* godmode/setup/setup.php: Fixed warning on enabling EACL.
|
||||||
|
@ -130,9 +130,9 @@ function mainModuleGroups() {
|
|||||||
//The big query
|
//The big query
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$sql = "SELECT COUNT(id_agente) AS count, estado
|
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
|
||||||
FROM tagente_estado
|
FROM tagente_estado
|
||||||
WHERE utimestamp != 0 AND id_agente IN
|
WHERE id_agente IN
|
||||||
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE)
|
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE)
|
||||||
AND id_agente_modulo IN
|
AND id_agente_modulo IN
|
||||||
(SELECT id_agente_modulo
|
(SELECT id_agente_modulo
|
||||||
@ -141,9 +141,9 @@ function mainModuleGroups() {
|
|||||||
GROUP BY estado";
|
GROUP BY estado";
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = "SELECT COUNT(id_agente) AS count, estado
|
$sql = "SELECT COUNT(id_agente) AS count, case utimestamp when 0 then 5 else estado end as estado
|
||||||
FROM tagente_estado
|
FROM tagente_estado
|
||||||
WHERE utimestamp != 0 AND id_agente IN
|
WHERE id_agente IN
|
||||||
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0)
|
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled = 0)
|
||||||
AND id_agente_modulo IN
|
AND id_agente_modulo IN
|
||||||
(SELECT id_agente_modulo
|
(SELECT id_agente_modulo
|
||||||
@ -152,9 +152,9 @@ function mainModuleGroups() {
|
|||||||
GROUP BY estado";
|
GROUP BY estado";
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = "SELECT COUNT(id_agente) AS count, estado
|
$sql = "SELECT COUNT(id_agente) AS count, case when utimestamp = 0 then 5 else estado end estado
|
||||||
FROM tagente_estado
|
FROM tagente_estado
|
||||||
WHERE utimestamp != 0 AND id_agente IN
|
WHERE id_agente IN
|
||||||
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND (disabled IS NOT NULL AND disabled <> 0))
|
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND (disabled IS NOT NULL AND disabled <> 0))
|
||||||
AND id_agente_modulo IN
|
AND id_agente_modulo IN
|
||||||
(SELECT id_agente_modulo
|
(SELECT id_agente_modulo
|
||||||
@ -258,6 +258,9 @@ function mainModuleGroups() {
|
|||||||
elseif (array_key_exists(0, $states)) {
|
elseif (array_key_exists(0, $states)) {
|
||||||
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
|
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
|
||||||
}
|
}
|
||||||
|
elseif (array_key_exists(5, $states)) {
|
||||||
|
$color = '#729fcf'; // Blue when the cell for this module group and all modules have not init value.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '"
|
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '"
|
||||||
@ -303,6 +306,10 @@ function mainModuleGroups() {
|
|||||||
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
||||||
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
|
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
|
||||||
'</li>' .
|
'</li>' .
|
||||||
|
'<li style="clear: both;">
|
||||||
|
<div style="float: left; background: #729fcf; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
||||||
|
__("Blue cell when the module group and agent have all modules in not init status.") .
|
||||||
|
'</li>' .
|
||||||
"</ul>" .
|
"</ul>" .
|
||||||
"</p>";
|
"</p>";
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ function main_net_tools () {
|
|||||||
$id_agente = get_parameter ("id_agente");
|
$id_agente = get_parameter ("id_agente");
|
||||||
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
$ip = db_get_sql ("SELECT direccion FROM tagente WHERE id_agente = $id_agente");
|
||||||
if ($ip == "") {
|
if ($ip == "") {
|
||||||
echo "<h3 class=error>The agent hasn't got IP</h3>";
|
echo "<div class='error' style='margin-top:5px'>The agent hasn't got IP</div>";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
echo "<div>";
|
echo "<div>";
|
||||||
|
@ -99,7 +99,7 @@ else {
|
|||||||
echo '<div class="nf">'. __('No fields defined') .'</div>';
|
echo '<div class="nf">'. __('No fields defined') .'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($fields === false) $fields = array();
|
if ($fields === false) $fields = array();
|
||||||
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
|
|
||||||
|
@ -42,6 +42,12 @@ $table->size[1] = '80%';
|
|||||||
$table->style[0] = 'font-weight: bold; vertical-align: top;';
|
$table->style[0] = 'font-weight: bold; vertical-align: top;';
|
||||||
$table->align[0] = 'left';
|
$table->align[0] = 'left';
|
||||||
$table->align[1] = 'left';
|
$table->align[1] = 'left';
|
||||||
|
// This is because if this view is reused after list alert view then
|
||||||
|
// styles in the previous view can affect this table.
|
||||||
|
$table->rowstyle[0] = '';
|
||||||
|
$table->rowstyle[1] = '';
|
||||||
|
$table->rowstyle[2] = '';
|
||||||
|
$table->rowstyle[3] = '';
|
||||||
|
|
||||||
|
|
||||||
/* Add an agent selector */
|
/* Add an agent selector */
|
||||||
|
@ -30,7 +30,7 @@ require_once ('include/functions_users.php');
|
|||||||
|
|
||||||
function process_manage_delete ($id_agents) {
|
function process_manage_delete ($id_agents) {
|
||||||
if (empty ($id_agents)) {
|
if (empty ($id_agents)) {
|
||||||
echo '<h3 class="error">'.__('No agents selected').'</h3>';
|
ui_print_error_message(__('No agents selected'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,21 +42,28 @@ function process_manage_delete ($id_agents) {
|
|||||||
db_process_sql_begin ();
|
db_process_sql_begin ();
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
|
$count_deleted = 0;
|
||||||
|
$agent_id_restore = 0;
|
||||||
foreach ($id_agents as $id_agent) {
|
foreach ($id_agents as $id_agent) {
|
||||||
$success = agents_delete_agent ($id_agent);
|
$success = agents_delete_agent ($id_agent);
|
||||||
if (! $success)
|
if (! $success) {
|
||||||
|
$agent_id_restore = $id_agent;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$count_deleted++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $success) {
|
if (! $success) {
|
||||||
echo '<h3 class="error">'.__('There was an error deleting the agent, the operation has been cancelled').'</h3>';
|
ui_print_error_message(__('There was an error deleting the agent, the operation has been cancelled') . '. ' . __('Could not delete agent').' '.agents_get_name ($agent_id_restore));
|
||||||
echo '<h4>'.__('Could not delete agent').' '.agents_get_name ($id_agent).'</h4>';
|
|
||||||
|
//echo '<h3 class="error">'.__('There was an error deleting the agent, the operation has been cancelled').'</h3>';
|
||||||
|
//echo '<h4>'.__('Could not delete agent').' '.agents_get_name ($id_agent).'</h4>';
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
|
ui_print_success_message(__('Successfully deleted') . ' (' . $count_deleted . ')');
|
||||||
db_process_sql_commit ();
|
db_process_sql_commit ();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -61,15 +61,17 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
||||||
if (empty ($id_alert_template)) {
|
if (empty ($id_alert_template)) {
|
||||||
echo '<h3 class="error">'.__('No alert selected').'</h3>';
|
ui_print_error_message(__('No alert selected'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($id_agents) || $id_agents[0] == 0) {
|
if (empty ($id_agents) || $id_agents[0] == 0) {
|
||||||
echo '<h3 class="error">'.__('No agents selected').'</h3>';
|
ui_print_error_message(__('No agents selected'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$module_selection_mode = get_parameter('modules_selection_mode');
|
||||||
|
|
||||||
foreach($module_names as $module){
|
foreach($module_names as $module){
|
||||||
foreach($id_agents as $id_agent) {
|
foreach($id_agents as $id_agent) {
|
||||||
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
$module_id = modules_get_agentmodule_id($module, $id_agent);
|
||||||
@ -77,8 +79,34 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($module_names) == 1 && $module_names[0] == '0'){
|
// If is selected "ANY" option then we need the module selection mode: common or all modules
|
||||||
|
if (count($module_names) == 1 && $module_names[0] == '0') {
|
||||||
|
|
||||||
|
if ($module_selection_mode == 'common')
|
||||||
$modules_id = agents_common_modules_with_alerts ($id_agents, false, true);
|
$modules_id = agents_common_modules_with_alerts ($id_agents, false, true);
|
||||||
|
else {
|
||||||
|
// For agents selected
|
||||||
|
$modules_id = array();
|
||||||
|
|
||||||
|
foreach ($id_agents as $id_agent) {
|
||||||
|
$current_modules_agent = agents_get_modules($id_agent, 'id_agente_modulo', array ('disabled' => 0));
|
||||||
|
|
||||||
|
if ($current_modules_agent != false) {
|
||||||
|
// And their modules
|
||||||
|
foreach ($current_modules_agent as $current_module) {
|
||||||
|
$module_alerts = alerts_get_alerts_agent_module($current_module);
|
||||||
|
if ($module_alerts != false) {
|
||||||
|
// And for all alert in modules
|
||||||
|
foreach ($module_alerts as $module_alert) {
|
||||||
|
// Find the template in module
|
||||||
|
if ($module_alert['id_alert_template'] == $id_alert_template)
|
||||||
|
$modules_id[] = $module_alert['id_agent_module'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$conttotal = 0;
|
$conttotal = 0;
|
||||||
|
@ -50,12 +50,12 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
function process_manage_delete ($module_name, $id_agents) {
|
function process_manage_delete ($module_name, $id_agents) {
|
||||||
if (empty ($module_name)) {
|
if (empty ($module_name)) {
|
||||||
echo '<h3 class="error">'.__('No module selected').'</h3>';
|
ui_print_error_message(__('No module selected'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($id_agents)) {
|
if (empty ($id_agents)) {
|
||||||
echo '<h3 class="error">'.__('No agents selected').'</h3>';
|
ui_print_error_message(__('No agents selected'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,19 +63,40 @@ function process_manage_delete ($module_name, $id_agents) {
|
|||||||
|
|
||||||
$module_name = (array)$module_name;
|
$module_name = (array)$module_name;
|
||||||
|
|
||||||
|
// We are selecting "any" agent for the selected modules
|
||||||
|
if (($id_agents[0] == 0) and (is_array($id_agents)) and (count($id_agents) == 1))
|
||||||
|
$id_agents = NULL;
|
||||||
|
|
||||||
|
$selection_delete_mode = get_parameter('selection_mode', 'modules');
|
||||||
|
|
||||||
|
// Selection mode by Agents
|
||||||
|
if ($selection_delete_mode == 'agents') {
|
||||||
|
// We are selecting "any" module for the selecteds agents
|
||||||
|
if (($module_name[0] == 0) and (is_array($module_name)) and (count($module_name) == 1))
|
||||||
|
$filter_for_module_deletion = false;
|
||||||
|
else
|
||||||
|
$filter_for_module_deletion = sprintf('nombre IN ("%s")', implode('","',$module_name));
|
||||||
|
|
||||||
|
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||||
|
$filter_for_module_deletion, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
$modules = agents_get_modules ($id_agents, 'id_agente_modulo',
|
||||||
sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
sprintf('nombre IN ("%s")', implode('","',$module_name)), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$count_deleted_modules = count($modules);
|
||||||
|
|
||||||
$success = modules_delete_agent_module ($modules);
|
$success = modules_delete_agent_module ($modules);
|
||||||
if (! $success) {
|
if (! $success) {
|
||||||
echo '<h3 class="error">'.__('There was an error deleting the modules, the operation has been cancelled').'</h3>';
|
ui_print_error_message(__('There was an error deleting the modules, the operation has been cancelled'));
|
||||||
echo '<h4>'.__('Could not delete modules').'</h4>';
|
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
|
ui_print_success_message(__('Successfully deleted') . ' (' . $count_deleted_modules . ')');
|
||||||
db_process_sql_commit ();
|
db_process_sql_commit ();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -128,11 +149,11 @@ if ($delete) {
|
|||||||
|
|
||||||
$agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente)
|
$agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente)
|
||||||
FROM tagente t1, tagente_modulo t2
|
FROM tagente t1, tagente_modulo t2
|
||||||
WHERE t1.id_agente = t2.id_agente');
|
WHERE t1.id_agente = t2.id_agente AND t2.delete_pending = 0 ' . $condition);
|
||||||
foreach ($agents_ as $id_agent) {
|
foreach($agents_ as $id_agent) {
|
||||||
$module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type),'nombre');
|
$module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent['id_agente'], 'id_tipo_modulo' => $module_type, 'delete_pending' => 0),'nombre');
|
||||||
|
|
||||||
if ($module_name == false) {
|
if($module_name == false) {
|
||||||
$module_name = array();
|
$module_name = array();
|
||||||
}
|
}
|
||||||
foreach ($module_name as $mod_name) {
|
foreach ($module_name as $mod_name) {
|
||||||
@ -149,11 +170,10 @@ if ($delete) {
|
|||||||
if($module_name == false) {
|
if($module_name == false) {
|
||||||
$module_name = array();
|
$module_name = array();
|
||||||
}
|
}
|
||||||
foreach($module_name as $mod_name) {
|
else {
|
||||||
$result = process_manage_delete ($mod_name['nombre'], $id_agent);
|
$result = process_manage_delete (array(0 => 0), $id_agent);
|
||||||
$count ++;
|
|
||||||
$success += (int)$result;
|
|
||||||
}
|
}
|
||||||
|
$success += (int)$result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +181,9 @@ if ($delete) {
|
|||||||
$agents_ = array();
|
$agents_ = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$force)
|
||||||
$result = process_manage_delete ($modules_, $agents_);
|
$result = process_manage_delete ($modules_, $agents_);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
db_pandora_audit("Massive management", "Delete module ", false, false,
|
db_pandora_audit("Massive management", "Delete module ", false, false,
|
||||||
'Agent: ' . json_encode($agents_) . ' Module: ' . $module_name);
|
'Agent: ' . json_encode($agents_) . ' Module: ' . $module_name);
|
||||||
|
@ -352,8 +352,8 @@ $table->data[4][1] = html_print_select($arraySelectIcon, "icon_path", $icon_path
|
|||||||
if ($config['activate_gis']) {
|
if ($config['activate_gis']) {
|
||||||
$table->data[5][0] = __('Ignore new GIS data:');
|
$table->data[5][0] = __('Ignore new GIS data:');
|
||||||
$table->data[5][1] = __('No change').' '.html_print_radio_button_extended ("update_gis_data", -1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[5][1] = __('No change').' '.html_print_radio_button_extended ("update_gis_data", -1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||||
$table->data[5][1] .= __('Disabled').' '.html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[5][1] .= __('Disabled').' '.html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||||
$table->data[5][1] .= __('Active').' '.html_print_radio_button_extended ("update_gis_data", 1, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[5][1] .= __('Active').' '.html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[6][0] = __('Quiet');
|
$table->data[6][0] = __('Quiet');
|
||||||
|
@ -80,11 +80,11 @@ if ($update) {
|
|||||||
|
|
||||||
$agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente)
|
$agents_ = db_get_all_rows_sql('SELECT DISTINCT(t1.id_agente)
|
||||||
FROM tagente t1, tagente_modulo t2
|
FROM tagente t1, tagente_modulo t2
|
||||||
WHERE t1.id_agente = t2.id_agente');
|
WHERE t1.id_agente = t2.id_agente AND t2.delete_pending = 0 ' . $condition);
|
||||||
foreach ($agents_ as $id_agent) {
|
foreach($agents_ as $id_agent) {
|
||||||
$module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type),'nombre');
|
$module_name = db_get_all_rows_filter('tagente_modulo', array('id_agente' => $id_agent, 'id_tipo_modulo' => $module_type, 'delete_pending' => 0),'nombre');
|
||||||
|
|
||||||
if ($module_name == false) {
|
if($module_name == false) {
|
||||||
$module_name = array();
|
$module_name = array();
|
||||||
}
|
}
|
||||||
foreach ($module_name as $mod_name) {
|
foreach ($module_name as $mod_name) {
|
||||||
@ -321,7 +321,10 @@ $table->data['edit4'][1] .= html_print_input_text ('min', '', '', 5, 15, true);
|
|||||||
$table->data['edit4'][1] .= '<br /><em>'.__('Max.').'</em>';
|
$table->data['edit4'][1] .= '<br /><em>'.__('Max.').'</em>';
|
||||||
$table->data['edit4'][1] .= html_print_input_text ('max', '', '', 5, 15, true);
|
$table->data['edit4'][1] .= html_print_input_text ('max', '', '', 5, 15, true);
|
||||||
$table->data['edit4'][2] = __('Module group');
|
$table->data['edit4'][2] = __('Module group');
|
||||||
$module_groups = array_merge(array(0 => 'Not assigned'), modules_get_modulegroups());
|
// Create module groups values for select
|
||||||
|
$module_groups = modules_get_modulegroups();
|
||||||
|
$module_groups[0] = __('Not assigned');
|
||||||
|
|
||||||
$table->data['edit4'][3] = html_print_select ($module_groups,
|
$table->data['edit4'][3] = html_print_select ($module_groups,
|
||||||
'id_module_group', '', '', __('No change'), '', true, false, false);
|
'id_module_group', '', '', __('No change'), '', true, false, false);
|
||||||
|
|
||||||
@ -583,11 +586,14 @@ $(document).ready (function () {
|
|||||||
<?php
|
<?php
|
||||||
function process_manage_edit ($module_name, $agents_select = null) {
|
function process_manage_edit ($module_name, $agents_select = null) {
|
||||||
if (is_int ($module_name) && $module_name < 0) {
|
if (is_int ($module_name) && $module_name < 0) {
|
||||||
echo '<h3 class="error">'.__('No modules selected').'</h3>';
|
ui_print_error_message(__('No modules selected'));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_array($agents_select))
|
||||||
|
$agents_select = array($agents_select);
|
||||||
|
|
||||||
/* List of fields which can be updated */
|
/* List of fields which can be updated */
|
||||||
$fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval',
|
$fields = array ('min_warning', 'max_warning', 'str_warning', 'min_critical', 'max_critical', 'str_critical', 'min_ff_event', 'module_interval',
|
||||||
'disabled', 'post_process', 'unit', 'snmp_community', 'tcp_send', 'custom_string_1', 'plugin_parameter',
|
'disabled', 'post_process', 'unit', 'snmp_community', 'tcp_send', 'custom_string_1', 'plugin_parameter',
|
||||||
@ -621,13 +627,18 @@ function process_manage_edit ($module_name, $agents_select = null) {
|
|||||||
$values['quiet'] = get_parameter('quiet_select');
|
$values['quiet'] = get_parameter('quiet_select');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$filter_modules = false;
|
||||||
|
|
||||||
|
if (!is_numeric($module_name) or ($module_name != 0))
|
||||||
|
$filter_modules['nombre'] = $module_name;
|
||||||
|
|
||||||
// Whether to update module tag info
|
// Whether to update module tag info
|
||||||
$update_tags = get_parameter('id_tag', false);
|
$update_tags = get_parameter('id_tag', false);
|
||||||
|
|
||||||
if (array_search(0, $agents_select) !== false) {
|
if (array_search(0, $agents_select) !== false) {
|
||||||
//Apply at All agents.
|
//Apply at All agents.
|
||||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||||
array ('nombre' => $module_name),
|
$filter_modules,
|
||||||
array ('id_agente_modulo'));
|
array ('id_agente_modulo'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -784,14 +784,6 @@ function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed
|
|||||||
$id_agent = safe_int ($id_agent, 1);
|
$id_agent = safe_int ($id_agent, 1);
|
||||||
|
|
||||||
$where = '';
|
$where = '';
|
||||||
if (! empty ($id_agent)) {
|
|
||||||
$where = sprintf (' WHERE t2.id_agent_module = t1.id_agente_modulo AND delete_pending = 0
|
|
||||||
AND id_agente IN (%s) AND (
|
|
||||||
SELECT count(nombre)
|
|
||||||
FROM tagente_modulo t3, talert_template_modules t4
|
|
||||||
WHERE t4.id_agent_module = t3.id_agente_modulo AND delete_pending = 0
|
|
||||||
AND t1.nombre = t3.nombre AND id_agente IN (%s)) = (%s)', implode (",", (array) $id_agent), implode (",", (array) $id_agent), count($id_agent));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty ($filter)) {
|
if (! empty ($filter)) {
|
||||||
$where .= ' AND ';
|
$where .= ' AND ';
|
||||||
@ -806,6 +798,49 @@ function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty ($id_agent)) {
|
||||||
|
// Get module_name-template repetitions over agents selected
|
||||||
|
// Group by if there is more than one agent
|
||||||
|
$group_by = '';
|
||||||
|
if (count((array)$id_agent) > 1)
|
||||||
|
$group_by = 'having count(*) > 1';
|
||||||
|
|
||||||
|
$sql = sprintf ('SELECT t1.nombre, t2.id_alert_template, count(*)
|
||||||
|
FROM tagente_modulo t1, talert_template_modules t2
|
||||||
|
WHERE t2.id_agent_module = t1.id_agente_modulo
|
||||||
|
AND delete_pending = 0
|
||||||
|
AND id_agente IN (%s) %s group by nombre, id_alert_template %s'
|
||||||
|
, implode (",", (array) $id_agent)
|
||||||
|
, $where
|
||||||
|
,$group_by);
|
||||||
|
|
||||||
|
$result_tmp = db_get_all_rows_sql ($sql);
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
if ($result_tmp != false) {
|
||||||
|
|
||||||
|
foreach ($result_tmp as $module_template) {
|
||||||
|
|
||||||
|
$sql_modules = sprintf ('SELECT t1.id_agente_modulo
|
||||||
|
FROM tagente_modulo t1, talert_template_modules t2
|
||||||
|
WHERE t1.id_agente_modulo = t2.id_agent_module
|
||||||
|
AND delete_pending = 0
|
||||||
|
AND t1.nombre = \'%s\' AND t2.id_alert_template = %s'
|
||||||
|
, $module_template['nombre']
|
||||||
|
, $module_template['id_alert_template']);
|
||||||
|
|
||||||
|
$id_modules_template = db_get_all_rows_sql ($sql_modules);
|
||||||
|
|
||||||
|
if ($id_modules_template != false)
|
||||||
|
foreach ($id_modules_template as $id_module_template)
|
||||||
|
$result[] = $id_module_template;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
$sql = sprintf ('SELECT DISTINCT(t1.id_agente_modulo)
|
$sql = sprintf ('SELECT DISTINCT(t1.id_agente_modulo)
|
||||||
FROM tagente_modulo t1, talert_template_modules t2
|
FROM tagente_modulo t1, talert_template_modules t2
|
||||||
%s
|
%s
|
||||||
@ -813,6 +848,8 @@ function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed
|
|||||||
$where);
|
$where);
|
||||||
$result = db_get_all_rows_sql ($sql);
|
$result = db_get_all_rows_sql ($sql);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (empty ($result)) {
|
if (empty ($result)) {
|
||||||
return array ();
|
return array ();
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ function treeview_printTree($type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($list === false) {
|
if ($list === false) {
|
||||||
ui_print_error_message("There aren't agents in this agrupation");
|
echo '<h3 class="error">'.__('There aren\'t agents in this agrupation').'</h3>';
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
}
|
}
|
||||||
@ -423,6 +423,7 @@ function treeview_getData ($type, $server=false) {
|
|||||||
|
|
||||||
// If there are not groups display error and return
|
// If there are not groups display error and return
|
||||||
if (empty($avariableGroups)) {
|
if (empty($avariableGroups)) {
|
||||||
|
echo '<h3 class="error">'.__('There aren\'t agents in this agrupation').'</h3>';
|
||||||
return array ();
|
return array ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ $offset = get_parameter ("offset", 0);
|
|||||||
|
|
||||||
// Get all module from agent
|
// Get all module from agent
|
||||||
|
|
||||||
ui_pagination (count ($modules), "index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=".$id_agent, $offset);
|
ui_pagination (count ($modules), "index.php?sec=estado&sec2=operation/agentes/ver_agente&tab=sla&id_agente=".$id_agent);
|
||||||
|
|
||||||
$table->width = '95%';
|
$table->width = '95%';
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
@ -115,7 +115,7 @@ $sql = "SELECT id_agent_module, sla_max, sla_min, sla_limit
|
|||||||
WHERE id_agent_module IN (".implode (",",array_keys ($modules)).")";
|
WHERE id_agent_module IN (".implode (",",array_keys ($modules)).")";
|
||||||
$result = db_get_all_rows_sql ($sql);
|
$result = db_get_all_rows_sql ($sql);
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
echo "<h3>".__('User-defined SLA items')." - ".human_time_description_raw ($config["sla_period"])."</h3>";
|
echo "<h4>".__('User-defined SLA items')." - ".human_time_description_raw ($config["sla_period"])."</h4>";
|
||||||
$table->width = '95%';
|
$table->width = '95%';
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
$table->cellspacing = 4;
|
$table->cellspacing = 4;
|
||||||
|
@ -1035,8 +1035,7 @@ if (!empty ($table->data)) {
|
|||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui_print_error_message(
|
echo "<div class='nf'>".__('This group doesn\'t have any monitor')."</div>";
|
||||||
__('This group doesn\'t have any monitor') );
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -214,7 +214,7 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '<form method="post" action="index.php?sec=workspace&sec2=operation/messages/message_edit">';
|
echo '<form method="post" action="index.php?sec=workspace&sec2=operation/messages/message_edit">';
|
||||||
echo '<div class="action-buttons" style="width: 98%;">';
|
echo '<div class="action-buttons" style="width: 98%; margin-top: 5px;">';
|
||||||
html_print_submit_button (__('Create message'), 'create', false, 'class="sub next"');
|
html_print_submit_button (__('Create message'), 'create', false, 'class="sub next"');
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user