2011-04-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/db/oracle.php
	include/functions_modules.php
	include/functions_reporting.php
	include/functions_networkmap.php
	include/ajax/agent.php
	include/ajax/alert_list.ajax.php
	include/functions_ui.php
	include/functions_agents.php
	include/functions_db.php
	include/functions_alerts.php
	extensions/agents_modules.php
	extensions/resource_registration.php
	extensions/module_groups.php
	operation/agentes/alerts_status.php
	operation/agentes/estado_generalagente.php
	operation/agentes/estado_agente.php
	operation/agentes/alerts_status.functions.php
	operation/agentes/exportdata.php
	operation/events/events.php
	operation/search_alerts.php
	mobile/operation/agents/view_agents.php
	mobile/operation/agents/view_alerts.php
	general/ui/agents_list.php
	godmode/agentes/configurar_agente.php
	godmode/agentes/agent_manager.php
	godmode/alerts/alert_list.list.php
	godmode/alerts/configure_alert_compound.php
	godmode/alerts/alert_compounds.php
	godmode/alerts/alert_list.php
	godmode/alerts/configure_alert_template.php
	godmode/alerts/alert_templates.php
	godmode/alerts/configure_alert_action.php
	godmode/alerts/configure_alert_command.php
	godmode/alerts/alert_actions.php
	godmode/alerts/alert_list.builder.php
	godmode/alerts/alert_commands.php
	godmode/snmpconsole/snmp_alert.php
	godmode/massive/massive_add_alerts.php
	godmode/massive/massive_copy_modules.php
	godmode/massive/massive_enable_disable_alerts.php
	godmode/massive/massive_delete_action_alerts.php
	godmode/massive/massive_delete_alerts.php
	godmode/massive/massive_standby_alerts.php
	godmode/massive/massive_add_action_alerts.php
	godmode/reporting/graph_builder.main.php
	godmode/reporting/graph_builder.php
	godmode/reporting/graph_builder.preview.php: Functions of functions_agents.php
	and function_alerts.php have the "agent_" and "alert_" prefix respectively.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4228 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-04-15 10:57:43 +00:00
parent f009394310
commit db6d2c9d6e
48 changed files with 997 additions and 331 deletions

View File

@ -1,3 +1,54 @@
2011-04-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/db/oracle.php
include/functions_modules.php
include/functions_reporting.php
include/functions_networkmap.php
include/ajax/agent.php
include/ajax/alert_list.ajax.php
include/functions_ui.php
include/functions_agents.php
include/functions_db.php
include/functions_alerts.php
extensions/agents_modules.php
extensions/resource_registration.php
extensions/module_groups.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/estado_agente.php
operation/agentes/alerts_status.functions.php
operation/agentes/exportdata.php
operation/events/events.php
operation/search_alerts.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
general/ui/agents_list.php
godmode/agentes/configurar_agente.php
godmode/agentes/agent_manager.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/snmpconsole/snmp_alert.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/reporting/graph_builder.main.php
godmode/reporting/graph_builder.php
godmode/reporting/graph_builder.preview.php: Functions of functions_agents.php
and function_alerts.php have the "agent_" and "alert_" prefix respectively.
2011-04-14 Sergio Martin <sergio.martin@artica.es>
* include/graphs/functions_pchart.php

View File

@ -150,7 +150,7 @@ function mainAgentsModules() {
$filter_groups['id_grupo'] = $group_id;
}
$agents = get_agents ($filter_groups);
$agents = agents_get_agents ($filter_groups);
$nagents = count($agents);
if($all_modules == false || $agents == false) {
@ -188,7 +188,7 @@ function mainAgentsModules() {
$filter_agents = array('id_grupo' => $group_id);
}
// Prepare pagination
ui_pagination ((int)count(get_agents ($filter_agents)));
ui_pagination ((int)count(agents_get_agents ($filter_agents)));
echo "<br>";
foreach ($agents as $agent) {

View File

@ -29,7 +29,7 @@ if (is_ajax ()) {
if ($get_info_alert_module_group) {
$agents = get_group_agents($id_agent_group);
if (!empty($agents)) {
$alerts = get_agent_alerts_simple($agents);
$alerts = agents_get_alerts_simple($agents);
foreach ($alerts as $alert) {
$module = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
@ -159,7 +159,7 @@ function mainModuleGroups() {
$agents = get_group_agents($idAgentGroup);
if (!empty($agents)) {
$alerts = get_agent_alerts_simple($agents);
$alerts = agents_get_alerts_simple($agents);
foreach ($alerts as $alert) {
$module = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));

View File

@ -120,7 +120,7 @@ function process_upload_xml_report($xml, $group_filter = 0) {
$agents_item= array();
if (isset($item['agent'])) {
$agents = get_agents(array('id_grupo' => $group_filter), array('id_agente', 'nombre'));
$agents = agents_get_agents(array('id_grupo' => $group_filter), array('id_agente', 'nombre'));
$agent_clean = str_replace(array('[', ']'), '', $item['agent']);
$regular_expresion = ($agent_clean != $item['agent']);
@ -205,7 +205,7 @@ function process_upload_xml_report($xml, $group_filter = 0) {
}
foreach ($item['sla'] as $sla_xml) {
if (isset($sla_xml->agent)) {
$agents = get_agents(array('id_grupo' => $group_filter), array('id_agente', 'nombre'));
$agents = agents_get_agents(array('id_grupo' => $group_filter), array('id_agente', 'nombre'));
$agent_clean = str_replace(array('[', ']'), '', $sla_xml->agent);
$regular_expresion = ($agent_clean != $sla_xml->agent);
@ -440,7 +440,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
$agent_clean = str_replace(array('[', ']'), '', $item->agent);
$regular_expresion = ($agent_clean != $item->agent);
$agents = get_agents(array('id_grupo' => $filter_group), array('id_agente', 'nombre'));
$agents = agents_get_agents(array('id_grupo' => $filter_group), array('id_agente', 'nombre'));
if ($agents === false) $agents = array();
$temp = array();
foreach ($agents as $agent) {

View File

@ -103,14 +103,14 @@ if ($search_string != '') {
$filter[] = '(nombre LIKE "%'.$search_string.'%" OR comentarios LIKE "%'.$search_string.'%" OR direccion LIKE "%'.$search_string.'%")';
}
$total_agents = get_agents ($filter, array ('COUNT(*) AS total'), $access);
$total_agents = agents_get_agents ($filter, array ('COUNT(*) AS total'), $access);
if ($total_agents !== false)
$total_agents = $total_agents[0]['total'];
else
$total_agents = 0;
$filter['limit'] = $config['block_size'];
$filter['offset'] = (int) get_parameter ('offset');
$agents = get_agents ($filter, $fields, $access);
$agents = agents_get_agents ($filter, $fields, $access);
unset ($filter['limit']);
unset ($filter['offset']);

View File

@ -26,7 +26,7 @@ if (is_ajax ()) {
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter[] = 'id_agente != '.$id_agent;
$agents = get_agents ($filter, array ('nombre', 'direccion'));
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;

View File

@ -804,7 +804,7 @@ if ($delete_module) { // DELETE agent module !
if ($result === false)
$error++;
if (delete_alert_agent_module($id_borrar_modulo) === false)
if (alerts_delete_alert_agent_module($id_borrar_modulo) === false)
$error++;

View File

@ -31,8 +31,8 @@ if (is_ajax ()) {
$get_alert_action = (bool) get_parameter ('get_alert_action');
if ($get_alert_action) {
$id = (int) get_parameter ('id');
$action = get_alert_action ($id);
$action['command'] = get_alert_action_alert_command ($action['id']);
$action = alerts_get_alert_action ($id);
$action['command'] = alerts_get_alert_action_alert_command ($action['id']);
echo json_encode ($action);
}
@ -51,7 +51,7 @@ if ((!$copy_action) && (!$delete_action))
if ($copy_action) {
$id = get_parameter ('id');
$al_action = get_alert_action ($id);
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false){
// If user tries to copy an action with group=ALL
@ -89,7 +89,7 @@ if ($copy_action) {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true);
$result = clone_alert_action ($id);
$result = alerts_clone_alert_action ($id);
if ($result) {
pandora_audit("Command management", "Duplicate alert action " . $id . " clone to " . $result);
@ -112,7 +112,7 @@ if ($create_action) {
$group = (string) get_parameter ('group');
$action_threshold = (int) get_parameter ('action_threshold');
$result = create_alert_action ($name, $id_alert_command,
$result = alerts_create_alert_action ($name, $id_alert_command,
array ('field1' => $field1,
'field2' => $field2,
'field3' => $field3,
@ -138,7 +138,7 @@ if ($create_action) {
if ($update_action) {
$id = (string) get_parameter ('id');
$al_action = get_alert_action ($id);
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false){
if ($al_action['id_group'] == 0){
@ -173,7 +173,7 @@ if ($update_action) {
$values['id_group'] = $group;
$values['action_threshold'] = $action_threshold;
$result = update_alert_action ($id, $values);
$result = alerts_update_alert_action ($id, $values);
$info = 'Name: ' . $name . ' ID alert Command: ' . $id_alert_command .
' Field1: ' . $field1 . ' Field2: ' . $field2 . ' Field3: ' . $field3 . ' Group: ' . $group .
@ -194,7 +194,7 @@ if ($update_action) {
if ($delete_action) {
$id = get_parameter ('id');
$al_action = get_alert_action ($id);
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false){
// If user tries to delete an action with group=ALL
@ -234,7 +234,7 @@ if ($delete_action) {
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true);
$result = delete_alert_action ($id);
$result = alerts_delete_alert_action ($id);
if ($result) {
pandora_audit("Command management", "Delete alert action " . $id);

View File

@ -32,7 +32,7 @@ if (is_ajax ()) {
$get_alert_command = (bool) get_parameter ('get_alert_command');
if ($get_alert_command) {
$id = (int) get_parameter ('id');
$command = get_alert_command ($id);
$command = alerts_get_alert_command ($id);
echo json_encode ($command);
}
return;
@ -50,7 +50,7 @@ if ($create_command) {
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$result = create_alert_command ($name, $command,
$result = alerts_create_alert_command ($name, $command,
array ('description' => $description));
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description;
@ -69,7 +69,7 @@ if ($create_command) {
if ($update_command) {
$id = (int) get_parameter ('id');
$alert = get_alert_command ($id);
$alert = alerts_get_alert_command ($id);
if ($alert['internal']) {
pandora_audit("ACL Violation", "Trying to access Alert Management");
require ("general/noaccess.php");
@ -83,7 +83,7 @@ if ($update_command) {
$values['name'] = $name;
$values['command'] = $command;
$values['description'] = $description;
$result = update_alert_command ($id, $values);
$result = alerts_update_alert_command ($id, $values);
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description;
if ($result) {
@ -102,14 +102,14 @@ if ($delete_command) {
$id = (int) get_parameter ('id');
// Internal commands cannot be deleted
if (get_alert_command_internal ($id)) {
if (alerts_get_alert_command_internal ($id)) {
pandora_audit("ACL Violation",
"Trying to access Alert Management");
require ("general/noaccess.php");
return;
}
$result = delete_alert_command ($id);
$result = alerts_delete_alert_command ($id);
if ($result) {
pandora_audit("Command management", "Delete alert command " . $id);

View File

@ -57,7 +57,7 @@ if ($update_compound) {
$field2_recovery = (string) get_parameter ('field2_recovery');
$field3_recovery = (string) get_parameter ('field3_recovery');
$result = update_alert_compound ($id,
$result = alerts_update_alert_compound ($id,
array ('recovery_notify' => $recovery_notify,
'field2_recovery' => $field2_recovery,
'field3_recovery' => $field3_recovery));
@ -69,7 +69,7 @@ if ($update_compound) {
if ($delete_alert) {
$id = (int) get_parameter ('id');
$result = delete_alert_compound ($id);
$result = alerts_delete_alert_compound ($id);
ui_print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
@ -79,7 +79,7 @@ if ($delete_alert) {
if ($enable_alert) {
$id = (int) get_parameter ('id');
$result = set_alerts_compound_disable ($id, false);
$result = alerts_set_alerts_compound_disable ($id, false);
ui_print_result_message ($result,
__('Successfully enabled'),
__('Could not be enabled'));
@ -89,7 +89,7 @@ if ($enable_alert) {
if ($disable_alert) {
$id = (int) get_parameter ('id');
$result = set_alerts_compound_disable ($id, true);
$result = alerts_set_alerts_compound_disable ($id, true);
ui_print_result_message ($result,
__('Successfully disabled'),
__('Could not be disabled'));
@ -209,7 +209,7 @@ if ($id_alerts === false)
$id_alerts = array ();
foreach ($id_alerts as $alert) {
$alert = get_alert_compound ($alert['id']);
$alert = alerts_get_alert_compound ($alert['id']);
if ($alert === false)
continue;

View File

@ -66,12 +66,12 @@ $table->data[1][0] = __('Template');
$table->data[1][0] = __('Template');
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$templates = get_alert_templates (false, array ('id', 'name'));
$templates = alerts_get_alert_templates (false, array ('id', 'name'));
else{
$usr_groups = get_user_groups($config['id_user'], 'LW', true);
$filter_groups = '';
$filter_groups = implode(',', array_keys($usr_groups));
$templates = get_alert_templates (array ('id_group IN (' . $filter_groups . ')'), array ('id', 'name'));
$templates = alerts_get_alert_templates (array ('id_group IN (' . $filter_groups . ')'), array ('id', 'name'));
}
$table->data[1][1] = print_select (index_array ($templates, 'id', 'name'),

View File

@ -42,7 +42,7 @@ $form_filter .= "<tr>\n";
$form_filter .= "<td>".__('Template name')."</td><td>";
$form_filter .= print_input_text ('template_name', $templateName, '', 12, 255, true);
$form_filter .= "</td>\n";
$temp = get_agents();
$temp = agents_get_agents();
$arrayAgents = array();
# Avoid empty arrays, warning messages are UGLY !
@ -159,7 +159,7 @@ if ($searchFlag) {
$where .= " AND talert_template_modules.standby = " . $standby;
}
$total = get_agent_alerts_simple (array_keys ($agents), false,
$total = agents_get_alerts_simple (array_keys ($agents), false,
false, $where, false, false, false, true);
if(empty($total)) $total = 0;
@ -277,7 +277,7 @@ if ($id_agente) {
else {
ui_pagination ($total, 'index.php?sec=gagente&sec2=godmode/alerts/alert_list');
}
$simple_alerts = get_agent_alerts_simple (array_keys ($agents), false,
$simple_alerts = agents_get_alerts_simple (array_keys ($agents), false,
array ('offset' => (int) get_parameter ('offset'),
'limit' => $config['block_size'], 'order' => $order), $where, false);
@ -423,7 +423,7 @@ foreach ($simple_alerts as $alert) {
print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help")) . '</a> ';
$data[4] .= "<a href='index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
$data[4] .= ui_print_truncate_text(get_alert_template_name ($alert['id_alert_template']), 15, false);
$data[4] .= ui_print_truncate_text(alerts_get_alert_template_name ($alert['id_alert_template']), 15, false);
$data[4] .= "</a>";
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
@ -439,7 +439,7 @@ foreach ($simple_alerts as $alert) {
}
}
$actions = get_alert_agent_module_actions ($alert['id']);
$actions = alerts_get_alert_agent_module_actions ($alert['id']);
$data[6] = '';
if (empty($actions)){
@ -504,7 +504,7 @@ foreach ($simple_alerts as $alert) {
$own_groups = get_user_groups($config['id_user'], 'LW', $own_info['is_admin']);
$filter_groups = '';
$filter_groups = implode(',', array_keys($own_groups));
$actions = get_alert_actions_filter(true, 'id_group IN (' . $filter_groups . ')');
$actions = alerts_get_alert_actions_filter(true, 'id_group IN (' . $filter_groups . ')');
$data[6] .= print_select ($actions, 'action', '', '', __('None'), 0, true);
$data[6] .= '<br />';
$data[6] .= '<span><a href="#" class="show_advanced_actions">'.__('Advanced options').' &raquo; </a></span>';

View File

@ -73,7 +73,7 @@ if ($create_alert) {
$messageAction = ui_print_result_message (false, '', __('Already added'), '', true);
}
else {
$id = create_alert_agent_module ($id_agent_module, $id_alert_template);
$id = alerts_create_alert_agent_module ($id_agent_module, $id_alert_template);
$alert_template_name = get_db_value ("name", "talert_templates","id", $id_alert_template);
$module_name = get_db_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
@ -99,7 +99,7 @@ if ($create_alert) {
$values['fires_max'] = get_parameter ('fires_max');
$values['module_action_threshold'] = (int) get_parameter ('module_action_threshold');
add_alert_agent_module_action ($id, $action_select, $values);
alerts_add_alert_agent_module_action ($id, $action_select, $values);
}
}
}
@ -115,7 +115,7 @@ if ($delete_alert) {
$module_name = get_db_value ("nombre", "tagente_modulo","id_agente_modulo", $id_agent_module);
$agent_name = get_agent_name (get_db_value ("id_agente", "tagente_modulo","id_agente_modulo", $id_agent_module));
$result = delete_alert_agent_module ($id_alert_agent_module);
$result = alerts_delete_alert_agent_module ($id_alert_agent_module);
if ($result) {
pandora_audit("Alert management",
@ -141,7 +141,7 @@ if ($add_action) {
$values['fires_max'] = $fires_max;
$values['module_action_threshold'] = (int) get_parameter ('module_action_threshold');
$result = add_alert_agent_module_action ($id_alert_module, $id_action, $values);
$result = alerts_add_alert_agent_module_action ($id_alert_module, $id_action, $values);
if ($result) {
pandora_audit("Alert management", 'Add action ' . $id_action . ' in alert ' . $id_alert_module);
@ -157,7 +157,7 @@ if ($delete_action) {
$id_action = (int) get_parameter ('id_action');
$id_alert = (int) get_parameter ('id_alert');
$result = delete_alert_agent_module_action ($id_action);
$result = alerts_delete_alert_agent_module_action ($id_action);
if ($result) {
pandora_audit("Alert management", 'Delete action ' . $id_action . ' in alert ' . $id_alert);
@ -172,7 +172,7 @@ if ($delete_action) {
if ($enable_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_disable ($id_alert, false);
$result = alerts_agent_module_disable ($id_alert, false);
if ($result) {
pandora_audit("Alert management", 'Enable ' . $id_alert);
@ -187,7 +187,7 @@ if ($enable_alert) {
if ($disable_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_disable ($id_alert, true);
$result = alerts_agent_module_disable ($id_alert, true);
if ($result) {
pandora_audit("Alert management", 'Disable ' . $id_alert);
@ -202,7 +202,7 @@ if ($disable_alert) {
if ($standbyon_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_standby ($id_alert, true);
$result = alerts_agent_module_standby ($id_alert, true);
if ($result) {
pandora_audit("Alert management", 'Standby ' . $id_alert);
@ -217,7 +217,7 @@ if ($standbyon_alert) {
if ($standbyoff_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_standby ($id_alert, false);
$result = alerts_agent_module_standby ($id_alert, false);
if ($result) {
pandora_audit("Alert management", 'Standbyoff ' . $id_alert);

View File

@ -25,13 +25,13 @@ if (is_ajax ()) {
if ($get_template_tooltip) {
$id_template = (int) get_parameter ('id_template');
$template = get_alert_template ($id_template);
$template = alerts_get_alert_template ($id_template);
if ($template === false)
return;
echo '<h3>'.$template['name'].'</h3>';
echo '<strong>'.__('Type').': </strong>';
echo get_alert_templates_type_name ($template['type']);
echo alerts_get_alert_templates_type_name ($template['type']);
echo '<br />';
echo ui_print_alert_template_example ($template['id'], true);
@ -121,7 +121,7 @@ if ($update_template) {
$field2_recovery = (string) get_parameter ('field2_recovery');
$field3_recovery = (string) get_parameter ('field3_recovery');
$result = update_alert_template ($id,
$result = alerts_update_alert_template ($id,
array ('recovery_notify' => $recovery_notify,
'field2_recovery' => $field2_recovery,
'field3_recovery' => $field3_recovery));
@ -134,7 +134,7 @@ if ($update_template) {
// If user tries to delete a template with group=ALL then must have "PM" access privileges
if ($delete_template) {
$id = get_parameter ('id');
$al_template = get_alert_template($id);
$al_template = alerts_get_alert_template($id);
if ($al_template !== false){
// If user tries to delete a template with group=ALL then must have "PM" access privileges
@ -170,7 +170,7 @@ if ($delete_template) {
// Header
ui_print_page_header (__('Alerts')." &raquo; ". __('Alert templates'), "images/god2.png", false, "", true);
$result = delete_alert_template ($id);
$result = alerts_delete_alert_template ($id);
if ($result) {
pandora_audit("Template alert management", "Delete alert template " . $id);
@ -197,7 +197,7 @@ $table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data[0][0] = __('Type');
$table->data[0][1] = print_select (get_alert_templates_types (), 'search_type',
$table->data[0][1] = print_select (alerts_get_alert_templates_types (), 'search_type',
$search_type, '', __('All'), '', true, false, false);
$table->data[0][2] = __('Search');
$table->data[0][3] = print_input_text ('search_string', $search_string, '', 25,
@ -218,11 +218,11 @@ if ($search_type != '')
$filter['type'] = $search_type;
if ($search_string)
$filter[] = '(name LIKE "%'.$search_string.'%" OR description LIKE "%'.$search_string.'%" OR value LIKE "%'.$search_string.'%")';
$total_templates = get_alert_templates ($filter, array ('COUNT(*) AS total'));
$total_templates = alerts_get_alert_templates ($filter, array ('COUNT(*) AS total'));
$total_templates = $total_templates[0]['total'];
$filter['offset'] = (int) get_parameter ('offset');
$filter['limit'] = (int) $config['block_size'];
$templates = get_alert_templates ($filter,
$templates = alerts_get_alert_templates ($filter,
array ('id', 'name', 'description', 'type', 'id_group'));
if ($templates === false)
$templates = array ();
@ -258,7 +258,7 @@ foreach ($templates as $template) {
$template['name'].'</a>';
$data[1] = ui_print_group_icon ($template["id_group"], true) .'&nbsp;'. ui_print_truncate_text(get_group_name ($template['id_group'], true));
$data[3] = get_alert_templates_type_name ($template['type']);
$data[3] = alerts_get_alert_templates_type_name ($template['type']);
$data[4] = '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template" style="display: inline; float: left">';
$data[4] .= print_input_hidden ('duplicate_template', 1, true);

View File

@ -29,7 +29,7 @@ if (! check_acl ($config['id_user'], 0, "LM")) {
$id = (int) get_parameter ('id');
$al_action = get_alert_action ($id);
$al_action = alerts_get_alert_action ($id);
if ($al_action !== false){
// If user tries to edit an action with group=ALL
@ -75,7 +75,7 @@ $group = 0; //All group is 0
$action_threshold = 0; //All group is 0
if ($id) {
$action = get_alert_action ($id);
$action = alerts_get_alert_action ($id);
$name = $action['name'];
$id_command = $action['id_alert_command'];
$field1 = $action['field1'];
@ -151,7 +151,7 @@ ui_require_javascript_file ('pandora_alerts');
<script type="text/javascript">
$(document).ready (function () {
<?php if ($id_command) : ?>
original_command = "<?php echo get_alert_command_command ($id_command); ?>";
original_command = "<?php echo alerts_get_alert_command_command ($id_command); ?>";
render_command_preview ();
<?php endif; ?>
$("#id_command").change (function () {

View File

@ -32,7 +32,7 @@ $name = '';
$command = '';
$description = '';
if ($id) {
$alert = get_alert_command ($id);
$alert = alerts_get_alert_command ($id);
$name = $alert['name'];
$command = $alert['command'];
$description = $alert['description'];

View File

@ -103,22 +103,22 @@ function update_compound ($step) {
$name = (string) get_parameter ('name');
$description = (string) get_parameter ('description');
$result = update_alert_compound ($id,
$result = alerts_update_alert_compound ($id,
array ('name' => $name,
'description' => $description,
'id_agent' => $id_agent));
/* Temporary disable the alert for update all elements */
set_alerts_compound_disable ($id, true);
alerts_set_alerts_compound_disable ($id, true);
/* Delete all elements of the alert and create them again */
delete_alert_compound_elements ($id);
alerts_delete_alert_compound_elements ($id);
$alerts = (array) get_parameter ('conditions');
$operations = (array) get_parameter ('operations');
foreach ($alerts as $id_alert) {
add_alert_compound_element ($id, (int) $id_alert, $operations[$id_alert]);
alerts_add_alert_compound_element ($id, (int) $id_alert, $operations[$id_alert]);
}
set_alerts_compound_disable ($id, false);
alerts_set_alerts_compound_disable ($id, false);
} elseif ($step == 2) {
$monday = (bool) get_parameter ('monday');
$tuesday = (bool) get_parameter ('tuesday');
@ -151,21 +151,21 @@ function update_compound ($step) {
'min_alerts' => $min_alerts
);
$result = update_alert_compound ($id, $values);
$result = alerts_update_alert_compound ($id, $values);
/* Update actions */
$actions = (array) get_parameter ('actions');
foreach ($actions as $id_action) {
/* TODO: fires_min and fires_max missing */
add_alert_compound_action ($id, (int) $id_action);
alerts_add_alert_compound_action ($id, (int) $id_action);
}
} elseif ($step == 3) {
$recovery_notify = (bool) get_parameter ('recovery_notify');
$field2_recovery = (bool) get_parameter ('field2_recovery');
$field3_recovery = (bool) get_parameter ('field3_recovery');
$result = update_alert_compound ($id,
$result = alerts_update_alert_compound ($id,
array ('recovery_notify' => $recovery_notify,
'field2_recovery' => $field2_recovery,
'field3_recovery' => $field3_recovery));
@ -207,7 +207,7 @@ $field2_recovery = '';
$field3_recovery = '';
if ($id && ! $create_compound) {
$compound = get_alert_compound ($id);
$compound = alerts_get_alert_compound ($id);
$name = $compound['name'];
$description = $compound['description'];
$time_from = $compound['time_from'];
@ -242,7 +242,7 @@ if ($create_compound) {
$name = (string) get_parameter ('name');
$description = (string) get_parameter ('description');
$result = create_alert_compound ($name, $id_agent,
$result = alerts_create_alert_compound ($name, $id_agent,
array ('description' => $description));
ui_print_result_message ($result,
@ -257,7 +257,7 @@ if ($create_compound) {
$operations = (array) get_parameter ('operations');
foreach ($alerts as $id_alert) {
add_alert_compound_element ($id, (int) $id_alert, $operations[$id_alert]);
alerts_add_alert_compound_element ($id, (int) $id_alert, $operations[$id_alert]);
}
}
}
@ -288,7 +288,7 @@ $table->size[0] = '20%';
$table->size[2] = '20%';
if ($step == 2) {
/* Firing conditions and events */
$threshold_values = get_alert_compound_threshold_values ();
$threshold_values = alerts_compound_threshold_values ();
if (in_array ($threshold, array_keys ($threshold_values))) {
$table->style['other_label'] = 'display:none; font-weight: bold';
$table->style['other_input'] = 'display:none';
@ -372,7 +372,7 @@ if ($step == 2) {
$table->data['actions'][0] = __('Assigned actions');
$table->data['actions'][1] = '<ul id="alert_actions">';
if ($id) {
$actions = get_alert_compound_actions ($id);
$actions = alerts_get_alert_compound_actions ($id);
if (empty ($actions))
$table->rowstyle['actions'] = 'display: none';
foreach ($actions as $action) {
@ -463,25 +463,25 @@ if ($step == 2) {
$table_alerts->size[4] = '10%';
if ($id) {
$conditions = get_alert_compound_elements ($id);
$conditions = alerts_get_alert_compound_elements ($id);
if ($conditions === false)
$conditions = array ();
foreach ($conditions as $condition) {
$data = array ();
$alert = get_alert_agent_module ($condition['id_alert_template_module']);
$alert = alerts_get_alert_agent_module ($condition['id_alert_template_module']);
$data[0] = '<a href="#" class="remove_alert" id="alert-'.$alert['id'].'" />';
$data[0] .= print_image("images/delete.png", true);
$data[0] .= '</a>';
$idAgent = get_agent_module_id($alert['id_agent_module']);
$nameAgent = get_agent_name($idAgent);
$data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $idAgent . '">' . $nameAgent . '</a>';
$data[2] = get_alert_template_name ($alert['id_alert_template']);
$data[2] = alerts_get_alert_template_name ($alert['id_alert_template']);
$data[3] = get_agentmodule_name ($alert['id_agent_module']);
if ($condition['operation'] == 'NOP') {
$data[4] = print_input_hidden ('operations['.$alert['id'].']', 'NOP', true);
} else {
$data[4] = print_select (get_alert_compound_operations (),
$data[4] = print_select (alerts_compound_operations (),
'operations['.$alert['id'].']', $condition['operation'], '', '', '', true);
}
$data[4] .= print_input_hidden ("conditions[]", $alert['id'], true);
@ -560,7 +560,7 @@ if ($step == 1) {
if (! $id_agent) {
$table_alerts->class = 'invisible';
} else {
$alerts = get_agent_alerts_simple ($id_agent);
$alerts = agents_get_alerts_simple ($id_agent);
if (empty ($alerts)) {
$table_alerts->data[0][0] = "<div class='nf'>".__('No alerts found')."</div>";
@ -575,7 +575,7 @@ if ($step == 1) {
$data[0] .= print_image('images/add.png', true);
$data[0] .= '</a>';
$data[1] = get_agentmodule_name ($alert['id_agent_module']);
$data[2] = get_alert_template_name ($alert['id_alert_template']);
$data[2] = alerts_get_alert_template_name ($alert['id_alert_template']);
array_push ($table_alerts->data, $data);
}
@ -598,7 +598,7 @@ if ($step == 1) {
echo '</div>';
echo '<div class="invisible">';
print_select (get_alert_compound_operations (), 'operations');
print_select (alerts_compound_operations (), 'operations');
echo '</div>';
}

View File

@ -33,9 +33,9 @@ $id = (int) get_parameter ('id');
// If user tries to duplicate/edit a template with group=ALL then must have "PM" access privileges
if ($duplicate_template) {
$source_id = (int) get_parameter ('source_id');
$a_template = get_alert_template($source_id);
$a_template = alerts_get_alert_template($source_id);
}else{
$a_template = get_alert_template($id);
$a_template = alerts_get_alert_template($id);
}
if ($a_template !== false){
@ -78,7 +78,7 @@ if ($a_template !== false){
if ($duplicate_template) {
$source_id = (int) get_parameter ('source_id');
$id = duplicate_alert_template ($source_id);
$id = alerts_duplicate_alert_template ($source_id);
if ($id) {
pandora_audit("Template alert management", "Duplicate alert template " . $source_id . " clone to " . $id);
@ -88,7 +88,7 @@ if ($duplicate_template) {
}
ui_print_result_message ($id,
__('Successfully created from %s', get_alert_template_name ($source_id)),
__('Successfully created from %s', alerts_get_alert_template_name ($source_id)),
__('Could not be created'));
}
@ -186,7 +186,7 @@ function update_template ($step) {
'matches_value' => $matches,
'priority' => $priority);
$result = update_alert_template ($id,$values);
$result = alerts_update_alert_template ($id,$values);
}
elseif ($step == 2) {
$monday = (bool) get_parameter ('monday');
@ -231,7 +231,7 @@ function update_template ($step) {
'min_alerts' => $min_alerts
);
$result = update_alert_template ($id, $values);
$result = alerts_update_alert_template ($id, $values);
}
elseif ($step == 3) {
$recovery_notify = (bool) get_parameter ('recovery_notify');
@ -242,7 +242,7 @@ function update_template ($step) {
'field2_recovery' => $field2_recovery,
'field3_recovery' => $field3_recovery);
$result = update_alert_template ($id, $values);
$result = alerts_update_alert_template ($id, $values);
}
else {
return false;
@ -314,7 +314,7 @@ if ($create_template) {
'matches_value' => $matches,
'priority' => $priority);
$result = create_alert_template ($name, $type, $values);
$result = alerts_create_alert_template ($name, $type, $values);
if ($result) {
pandora_audit("Command management", "Create alert command " . $result, false, false, json_encode($values));
@ -346,7 +346,7 @@ if ($update_template) {
}
if ($id && ! $create_template) {
$template = get_alert_template ($id);
$template = alerts_get_alert_template ($id);
$name = $template['name'];
$description = $template['description'];
$type = $template['type'];
@ -390,7 +390,7 @@ $table->size[2] = '20%';
if ($step == 2) {
/* Firing conditions and events */
$threshold_values = get_alert_template_threshold_values ();
$threshold_values = alerts_get_alert_template_threshold_values ();
if (in_array ($threshold, array_keys ($threshold_values))) {
$table->style['other_label'] = 'display:none; font-weight: bold';
$table->style['other_input'] = 'display:none';
@ -534,7 +534,7 @@ if ($step == 2) {
$priority, '', 0, 0, true, false, false);
$table->data[3][0] = __('Condition type');
$table->data[3][1] = print_select (get_alert_templates_types (), 'type',
$table->data[3][1] = print_select (alerts_get_alert_templates_types (), 'type',
$type, '', __('Select'), 0, true, false, false);
$table->data[3][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>';
$table->data[3][1] .= '&nbsp;'.print_checkbox ('matches_value', 1, $matches, true);

View File

@ -37,7 +37,7 @@ if (is_ajax ()) {
}
$get_compounds = get_parameter ('get_compounds');
if (!$get_compounds) {
$alert_templates = get_agent_alerts_simple ($id_agents);
$alert_templates = agents_get_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return;
}
@ -49,7 +49,7 @@ if (is_ajax ()) {
}
$filter .= 'id_agent=' . $id_agent;
};
$alert_compounds = get_alert_compounds ($filter, array('id', 'name'));
$alert_compounds = alerts_get_alert_compounds ($filter, array('id', 'name'));
echo json_encode (index_array ($alert_compounds, 'id', 'name'));
return;
}
@ -73,7 +73,7 @@ if ($add) {
$fires_max = get_parameter ('fires_max');
if ($action > 0) {
$agent_alerts = get_agent_alerts($id_agents);
$agent_alerts = agents_get_alerts($id_agents);
$cont = 0;
$agent_alerts_id = array();
foreach($agent_alerts['simple'] as $agent_alert){
@ -105,13 +105,13 @@ if ($add) {
else {
$results = true;
foreach ($agent_alerts_id as $agent_alert_id) {
$result = add_alert_agent_module_action($agent_alert_id, $action, $options);
$result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options);
if($result === false)
$results = false;
}
foreach ($agent_alerts_id_compound as $agent_alert_id_compound) {
$result = add_alert_compound_action ($agent_alert_id_compound, $action, $options);
$result = alerts_add_alert_compound_action ($agent_alert_id_compound, $action, $options);
if($result === false)
$results = false;
}
@ -158,7 +158,7 @@ if (empty($id_agents)) {
$alert_templates = '';
}
else {
$alert_templates = get_agent_alerts_simple ($id_agents);
$alert_templates = agents_get_alerts_simple ($id_agents);
}
$table->data[2][0] = __('Alert templates');
$table->data[2][0] .= '<span id="template_loading" class="invisible">';
@ -177,7 +177,7 @@ else {
}
$filter .= 'id_agent=' . $id_agent;
};
$alert_compounds = get_alert_compounds ($filter, array('id', 'name'));
$alert_compounds = alerts_get_alert_compounds ($filter, array('id', 'name'));
}
$table->data[3][0] = __('Alert compounds');
$table->data[3][0] .= '<span id="compound_loading" class="invisible">';
@ -185,7 +185,7 @@ $table->data[3][0] .= print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$table->data[3][1] = print_select (index_array ($alert_compounds, 'id', 'name'), 'id_alert_compounds[]', '', false, '', '', true, true, true, '', $alert_compounds == 0);
$actions = get_alert_actions ();
$actions = alerts_get_alert_actions ();
$table->data[4][0] = __('Action');
$table->data[4][1] = print_select ($actions, 'action', '', '', __('None'), 0, true);
$table->data[4][1] .= '<span><a href="#" class="show_advanced_actions">'.__('Advanced options').' &raquo; </a></span>';

View File

@ -60,14 +60,14 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
}
if(count($module_names) == 1 && $module_names[0] == '0'){
$modules_id = get_agents_common_modules ($id_agents, false, true);
$modules_id = agents_common_modules ($id_agents, false, true);
}
$conttotal = 0;
$contsuccess = 0;
foreach($modules_id as $module){
$success = create_alert_agent_module ($module, $id_alert_template);
$success = alerts_create_alert_agent_module ($module, $id_alert_template);
if($success)
$contsuccess ++;
@ -124,15 +124,15 @@ $table->data[1][0] = __('Agents');
$table->data[1][0] .= '<span id="agent_loading" class="invisible">';
$table->data[1][0] .= print_image('images/spinner.png', true);
$table->data[1][0] .= '</span>';
$agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$agents = get_agents();
$agents = agents_get_agents();
$table->data[1][1] = print_select (index_array ($agents, 'id_agente', 'nombre'),
'id_agents[]', '', '', '', '', true, true, true, '', false);
$table->data[1][2] = __('Modules');
$table->data[1][3] = print_select (array(), 'module[]', '', false, '', '', true, true, false);
$templates = get_alert_templates (false, array ('id', 'name'));
$templates = alerts_get_alert_templates (false, array ('id', 'name'));
$table->data[2][0] = __('Alert template');
$table->data[2][1] = print_select (index_array ($templates, 'id', 'name'),
'id_alert_template', $id_alert_template, false, __('Select'), 0, true);

View File

@ -36,7 +36,7 @@ $destiny_id_agents = (array) get_parameter ('destiny_id_agent', array ());
$do_operation = (bool) get_parameter ('do_operation');
if ($do_operation) {
$result = process_manage_config ($source_id_agent, $destiny_id_agents);
$result = agents_process_manage_config ($source_id_agent, $destiny_id_agents);
if ($result) {
pandora_audit("Masive management", "Copy modules", false, false,
@ -119,10 +119,10 @@ $table->data[2][0] = __('Alerts');
$agent_alerts = array ();
if ($source_id_agent)
$agent_alerts = get_agent_alerts_simple ($source_id_agent);
$agent_alerts = agents_get_alerts_simple ($source_id_agent);
$alerts = array ();
foreach ($agent_alerts as $alert) {
$name = get_alert_template_name ($alert['id_alert_template']);
$name = alerts_get_alert_template_name ($alert['id_alert_template']);
$name .= ' (<em>'.$modules[$alert['id_agent_module']].'</em>)';
$alerts[$alert['id']] = $name;
}

View File

@ -37,7 +37,7 @@ if (is_ajax ()) {
}
$get_compounds = get_parameter ('get_compounds');
if (!$get_compounds) {
$alert_templates = get_agent_alerts_simple ($id_agents);
$alert_templates = agents_get_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return;
} else {
@ -48,7 +48,7 @@ if (is_ajax ()) {
}
$filter .= 'id_agent=' . $id_agent;
};
$alert_compounds = get_alert_compounds ($filter, array('id', 'name'));
$alert_compounds = alerts_get_alert_compounds ($filter, array('id', 'name'));
echo json_encode (index_array ($alert_compounds, 'id', 'name'));
return;
}
@ -70,12 +70,12 @@ if ($delete) {
$action = (int) get_parameter ('action');
if($action > 0){
$agent_alerts = get_agent_alerts($id_agents);
$agent_alerts = agents_get_alerts($id_agents);
$alerts_agent_modules = array();
foreach($agent_alerts['simple'] as $agent_alert){
if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) {
$alerts_agent_modules = array_merge($alerts_agent_modules, get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
$alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id'));
}
}
@ -95,11 +95,11 @@ if ($delete) {
$agent_module_actions = array();
foreach($alerts_agent_modules as $alert_agent_module){
$agent_module_actions = get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action'));
$agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action'));
foreach ($agent_module_actions as $agent_module_action){
if($agent_module_action['id_alert_action'] == $action) {
$result = delete_alert_agent_module_action ($agent_module_action['id']);
$result = alerts_delete_alert_agent_module_action ($agent_module_action['id']);
if($result === false)
$results = false;
@ -108,10 +108,10 @@ if ($delete) {
}
foreach($alerts_compound as $alert_compound) {
$compound_actions = get_alert_compound_actions ($alert_compound['id'], array('id','id_alert_action'));
$compound_actions = alerts_get_alert_compound_actions ($alert_compound['id'], array('id','id_alert_action'));
foreach ($compound_actions as $compound_action) {
if ($compound_action['id_alert_action'] == $action) {
$result = delete_alert_compound_action($compound_action['id']);
$result = alerts_delete_alert_compound_action($compound_action['id']);
if($result === false)
$results = false;
}
@ -166,7 +166,7 @@ $table->data[1][1] = print_select (get_group_agents ($id_group, false, "none"),
if (empty($id_agents)) {
$alert_templates = '';
} else {
$alert_templates = get_agent_alerts_simple ($id_agents);
$alert_templates = agents_get_alerts_simple ($id_agents);
}
$table->data[2][0] = __('Alert templates');
$table->data[2][0] .= '<span id="template_loading" class="invisible">';
@ -184,7 +184,7 @@ if (empty($id_agents)) {
}
$filter .= 'id_agent=' . $id_agent;
};
$alert_compounds = get_alert_compounds ($filter, array('id', 'name'));
$alert_compounds = alerts_get_alert_compounds ($filter, array('id', 'name'));
}
$table->data[3][0] = __('Alert compounds');
$table->data[3][0] .= '<span id="compound_loading" class="invisible">';
@ -192,7 +192,7 @@ $table->data[3][0] .= print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$table->data[3][1] = print_select (index_array ($alert_compounds, 'id', 'name'), 'id_alert_compounds[]', '', false, '', '', true, true, true, '', $alert_compounds == 0);
$actions = get_alert_actions ();
$actions = alerts_get_alert_actions ();
$table->data[4][0] = __('Action');
$table->data[4][1] = print_select ($actions, 'action', '', '', __('None'), 0, true);

View File

@ -34,7 +34,7 @@ if (is_ajax ()) {
$id_group = (int) get_parameter ('id_group');
$id_alert_template = (int) get_parameter ('id_alert_template');
$agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
echo json_encode (index_array ($agents_alerts, 'id_agente', 'nombre'));
@ -62,13 +62,13 @@ function process_manage_delete ($id_alert_template, $id_agents, $module_names) {
}
if(count($module_names) == 1 && $module_names[0] == '0'){
$modules_id = get_agents_common_modules_with_alerts ($id_agents, false, true);
$modules_id = agents_common_modules_with_alerts ($id_agents, false, true);
}
$conttotal = 0;
$contsuccess = 0;
foreach($modules_id as $module){
$success = delete_alert_agent_module (false,
$success = alerts_delete_alert_agent_module (false,
array ('id_agent_module' => $module,
'id_alert_template' => $id_alert_template));
@ -121,7 +121,7 @@ $table->size[3] = '40%';
$table->data = array ();
$templates = get_alert_templates (false, array ('id', 'name'));
$templates = alerts_get_alert_templates (false, array ('id', 'name'));
$table->data[0][0] = __('Alert template');
$table->data[0][1] = print_select (index_array ($templates, 'id', 'name'),
'id_alert_template', $id_alert_template, false, __('Select'), 0, true);
@ -138,7 +138,7 @@ $table->data[2][0] = __('Agents');
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
$table->data[2][0] .= print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
$agents_alerts = get_agents_with_alert_template ($id_alert_template, $id_group,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_template, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$table->data[2][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
'id_agents[]', '', '', '', '', true, true, true, '', $id_alert_template == 0);

View File

@ -39,14 +39,14 @@ if (is_ajax ()) {
echo json_encode ('');
return;
}
$alert_templates = get_agent_alerts_simple ($id_agents);
$alert_templates = agents_get_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return;
} else {
$id_alert_templates = (array) get_parameter ('id_alert_templates');
$disabled = (int) get_parameter ('disabled');
$agents_alerts = get_agents_with_alert_template ($id_alert_templates, false,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false,
array('order' => 'tagente.nombre, talert_template_modules.disabled', 'talert_template_modules.disabled' => $disabled),
array ('LEFT(CONCAT(LEFT(tagente.nombre,40), " - ", tagente_modulo.nombre), 85) as agent_agentmodule_name',
'talert_template_modules.id as template_module_id'), $id_agents);
@ -69,7 +69,7 @@ switch($action) {
$id_alert_templates = (int) get_parameter ('id_alert_template_disabled', 0);
$id_disabled_alerts = get_parameter_post ('id_disabled_alerts', array());
foreach($id_disabled_alerts as $id_alert) {
$result = set_alerts_agent_module_disable ($id_alert, false);
$result = alerts_agent_module_disable ($id_alert, false);
}
ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled'));
@ -87,7 +87,7 @@ switch($action) {
$id_enabled_alerts = get_parameter_post ('id_enabled_alerts', array());
foreach($id_enabled_alerts as $id_alert) {
$result = set_alerts_agent_module_disable ($id_alert, true);
$result = alerts_agent_module_disable ($id_alert, true);
}
ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled'));
@ -142,7 +142,7 @@ $table->data[3][0] = __('Enabled alerts').ui_print_help_tip(__('Format').":<br>
$table->data[3][0] .= '<span id="alerts_loading" class="invisible">';
$table->data[3][0] .= print_image("images/spinner.png", true);
$table->data[3][0] .= '</span>';
$agents_alerts = get_agents_with_alert_template ($id_alert_templates, $id_group,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$table->data[3][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
'id_enabled_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);

View File

@ -39,7 +39,7 @@ if (is_ajax ()) {
echo json_encode ('');
return;
}
$alert_templates = get_agent_alerts_simple ($id_agents);
$alert_templates = agents_get_alerts_simple ($id_agents);
echo json_encode (index_array ($alert_templates, 'id_alert_template', 'template_name'));
return;
}
@ -47,7 +47,7 @@ if (is_ajax ()) {
$id_alert_templates = (array) get_parameter ('id_alert_templates');
$standby = (int) get_parameter ('standby');
$agents_alerts = get_agents_with_alert_template ($id_alert_templates, false,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, false,
array('order' => 'tagente.nombre, talert_template_modules.standby', 'talert_template_modules.standby' => $standby),
array ('LEFT(CONCAT(LEFT(tagente.nombre,40), " - ", tagente_modulo.nombre), 85) as agent_agentmodule_name',
'talert_template_modules.id as template_module_id'), $id_agents);
@ -70,7 +70,7 @@ switch($action) {
$id_alert_templates = (int) get_parameter ('id_alert_template_standby', 0);
$id_standby_alerts = get_parameter_post ('id_standby_alerts', array());
foreach($id_standby_alerts as $id_alert) {
$result = set_alerts_agent_module_standby ($id_alert, false);
$result = alerts_agent_module_standby ($id_alert, false);
}
ui_print_result_message ($result, __('Successfully set off standby'), __('Could not be set off standby'));
@ -88,7 +88,7 @@ switch($action) {
$id_not_standby_alerts = get_parameter_post ('id_not_standby_alerts', array());
foreach($id_not_standby_alerts as $id_alert) {
$result = set_alerts_agent_module_standby ($id_alert, true);
$result = alerts_agent_module_standby ($id_alert, true);
}
ui_print_result_message ($result, __('Successfully set standby'), __('Could not be set standby'));
@ -120,7 +120,7 @@ $table->size[1] = '85%';
$table->data = array ();
$templates = get_alert_templates (false, array ('id', 'name'));
$templates = alerts_get_alert_templates (false, array ('id', 'name'));
$table->data[0][0] = '<form method="post" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&tab=massive_alerts&option=standby_alerts&action=set_standby_alerts" onsubmit="if (! confirm(\''.__('Are you sure?').'\')) return false;">';
$table->data[0][0] .= print_input_hidden('id_alert_template_not_standby', $id_alert_templates, true);
$table->data[0][0] .= __('Group');
@ -144,7 +144,7 @@ $table->data[3][0] = __('Not standby alerts').ui_print_help_tip(__('Format').":<
$table->data[3][0] .= '<span id="alerts_loading" class="invisible">';
$table->data[3][0] .= print_image('images/spinner.png', true);
$table->data[3][0] .= '</span>';
$agents_alerts = get_agents_with_alert_template ($id_alert_templates, $id_group,
$agents_alerts = alerts_get_agents_with_alert_template ($id_alert_templates, $id_group,
false, array ('tagente.nombre', 'tagente.id_agente'));
$table->data[3][1] = print_select (index_array ($agents_alerts, 'id_agente', 'nombre'),
'id_not_standby_alerts[]', '', '', '', '', true, true, true, '', $id_alert_templates == 0);

View File

@ -30,7 +30,7 @@ if (is_ajax ()) {
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter['id_grupo'] = $id_group;
$agents = get_agents ($filter, array ('nombre', 'direccion'));
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;

View File

@ -30,7 +30,7 @@ if (is_ajax ()) {
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter['id_grupo'] = $id_group;
$agents = get_agents ($filter, array ('nombre', 'direccion'));
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;

View File

@ -32,7 +32,7 @@ if (is_ajax ()) {
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
$filter['id_grupo'] = $id_group;
$agents = get_agents ($filter, array ('nombre', 'direccion'));
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;

View File

@ -292,7 +292,7 @@ if (isset ($_GET["update_alert"])) {
foreach ($result as $row) {
$data = array ();
$data[0] = get_alert_action_name ($row["id_alert"]);
$data[0] = alerts_get_alert_action_name ($row["id_alert"]);
$data[1] = __('SNMP Agent');
$data[1] = $row["agent"];

View File

@ -52,7 +52,7 @@ if ($search_agents) {
$filter['id_grupo'] = $id_group;
$agents = get_agents ($filter, array ('id_agente','nombre', 'direccion'));
$agents = agents_get_agents ($filter, array ('id_agente','nombre', 'direccion'));
if ($agents === false)
return;

View File

@ -50,7 +50,7 @@ if ($get_agent_alerts_simple) {
require_once ('include/functions_agents.php');
require_once ('include/functions_alerts.php');
$alerts = get_agent_alerts_simple ($id_agent);
$alerts = agents_get_alerts_simple ($id_agent);
if (empty ($alerts)) {
echo json_encode (false);
return;
@ -58,7 +58,7 @@ if ($get_agent_alerts_simple) {
$retval = array ();
foreach ($alerts as $alert) {
$alert['template'] = get_alert_template ($alert['id_alert_template']);
$alert['template'] = alerts_get_alert_template ($alert['id_alert_template']);
$alert['module_name'] = get_agentmodule_name ($alert['id_agent_module']);
$alert['agent_name'] = get_agentmodule_agent_name ($alert['id_agent_module']);
$retval[$alert['id']] = $alert;
@ -71,7 +71,7 @@ if ($get_agent_alerts_simple) {
if ($enable_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_disable ($id_alert, false);
$result = alerts_agent_module_disable ($id_alert, false);
if ($result)
echo __('Successfully enabled');
else
@ -82,7 +82,7 @@ if ($enable_alert) {
if ($disable_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_disable ($id_alert, true);
$result = alerts_agent_module_disable ($id_alert, true);
if ($result)
echo __('Successfully disabled');
else

View File

@ -365,10 +365,11 @@ function oracle_get_db_all_rows_in_table($table, $order_field = "", $order = 'AS
*
* @param string Table to insert into
* @param mixed A single value or array of values to insert (can be a multiple amount of rows)
* @param bool Whether to do autocommit or not
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function oracle_process_sql_insert($table, $values) {
function oracle_process_sql_insert($table, $values, $autocommit = true) {
//Empty rows or values not processed
if (empty ($values))
return false;
@ -405,8 +406,9 @@ function oracle_process_sql_insert($table, $values) {
$query .= '(' . implode(', ', $fields) . ')';
$query .= ' VALUES (' . $values_str . ')';
$status = '';
return process_sql($query, 'insert_id');
return process_sql($query, 'insert_id', '', true, $status, $autocommit);
}
/**

View File

@ -29,7 +29,7 @@
*
* @return int New agent id if created. False if it could not be created.
*/
function create_agent ($name, $id_group, $interval, $ip_address, $values = false) {
function agents_create_agent ($name, $id_group, $interval, $ip_address, $values = false) {
if (empty ($name))
return false;
if (empty ($id_group))
@ -109,7 +109,7 @@ function create_agent ($name, $id_group, $interval, $ip_address, $values = false
* @return array All simple alerts defined for an agent. Empty array if no
* alerts found.
*/
function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = false, $where = '',
function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = false, $where = '',
$allModules = false, $orderby = false, $idGroup = false, $count = false) {
global $config;
@ -237,7 +237,7 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa
*
* @return array An array with all combined alerts defined for an agent.
*/
function get_agent_alerts_compound ($id_agent = false, $filter = '', $options = false, $idGroup = false, $count = false, $where = '') {
function agents_get_alerts_compound ($id_agent = false, $filter = '', $options = false, $idGroup = false, $count = false, $where = '') {
switch ($filter) {
case "notfired":
$filter = ' AND times_fired = 0 AND disabled = 0';
@ -313,7 +313,7 @@ function get_agent_alerts_compound ($id_agent = false, $filter = '', $options =
*
* @return mixed An array with all alerts defined for an agent or false in case no allowed groups are specified.
*/
function get_agents ($filter = false, $fields = false, $access = 'AR', $order = array('field' => 'nombre', 'order' => 'ASC')) {
function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $order = array('field' => 'nombre', 'order' => 'ASC')) {
global $config;
if (! is_array ($filter)) {
@ -371,9 +371,9 @@ function get_agents ($filter = false, $fields = false, $access = 'AR', $order =
*
* @return array An array with all alerts defined for an agent.
*/
function get_agent_alerts ($id_agent = false, $filter = false, $options = false) {
$combined_alerts = get_agent_alerts_compound ($id_agent, $filter, $options);
$simple_alerts = get_agent_alerts_simple ($id_agent, $filter, $options);
function agents_get_alerts ($id_agent = false, $filter = false, $options = false) {
$combined_alerts = agents_get_alerts_compound ($id_agent, $filter, $options);
$simple_alerts = agents_get_alerts_simple ($id_agent, $filter, $options);
return array ('simple' => $simple_alerts, 'compounds' => $combined_alerts);
}
@ -390,7 +390,9 @@ function get_agent_alerts ($id_agent = false, $filter = false, $options = false)
*
* @return bool True in case of good, false in case of bad
*/
function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modules = false, $copy_alerts = false, $target_modules = false, $target_alerts = false) {
function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modules = false, $copy_alerts = false, $target_modules = false, $target_alerts = false) {
global $config;
if (empty ($source_id_agent)) {
echo '<h3 class="error">'.__('No source agent to copy').'</h3>';
return false;
@ -428,7 +430,7 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
$target_modules = array ();
foreach ($target_alerts as $id_alert) {
$alert = get_alert_agent_module ($id_alert);
$alert = alerts_get_alert_agent_module ($id_alert);
if ($alert === false)
continue;
/* Check if some alerts which doesn't belong to the agent was given */
@ -438,8 +440,16 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
}
}
process_sql ('SET AUTOCOMMIT = 0');
process_sql ('START TRANSACTION');
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
process_sql ('SET AUTOCOMMIT = 0');
process_sql ('START TRANSACTION');
break;
case "oracle":
process_sql_begin();
break;
}
$error = false;
foreach ($destiny_id_agents as $id_destiny_agent) {
@ -461,12 +471,12 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
alerts for the module will be copied */
if (! empty ($target_alerts)) {
foreach ($target_alerts as $id_alert) {
$alert = get_alert_agent_module ($id_alert);
$alert = alerts_get_alert_agent_module ($id_alert);
if ($alert === false)
continue;
if ($alert['id_agent_module'] != $id_agent_module)
continue;
$result = copy_alert_agent_module_to_agent_module ($alert['id'],
$result = alerts_copy_alert_module_to_module ($alert['id'],
$id_destiny_module);
if ($result === false) {
$error = true;
@ -476,13 +486,13 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
continue;
}
$alerts = get_alerts_agent_module ($id_agent_module, true);
$alerts = alerts_get_alerts_agent_module ($id_agent_module, true);
if ($alerts === false)
continue;
foreach ($alerts as $alert) {
$result = copy_alert_agent_module_to_agent_module ($alert['id'],
$result = alerts_copy_alert_module_to_module ($alert['id'],
$id_destiny_module);
if ($result === false) {
$error = true;
@ -496,15 +506,36 @@ function process_manage_config ($source_id_agent, $destiny_id_agents, $copy_modu
if ($error) {
echo '<h3 class="error">'.__('There was an error copying the agent configuration, the copy has been cancelled').'</h3>';
process_sql ('ROLLBACK');
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
process_sql ('ROLLBACK');
break;
case "oracle":
process_sql_rollback();
break;
}
} else {
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
process_sql ('COMMIT');
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
process_sql ('COMMIT');
break;
case "oracle":
process_sql_commit();
break;
}
}
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
process_sql ('SET AUTOCOMMIT = 1');
break;
}
process_sql ('SET AUTOCOMMIT = 1');
}
function getNextAgentContact($idAgent, $maxModules = false) {
function agents_get_next_contact($idAgent, $maxModules = false) {
$agent = get_db_row_sql("SELECT * FROM tagente WHERE id_agente = " . $idAgent);
@ -553,7 +584,7 @@ $modules = get_agent_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0
* @return array An array with all modules in the agent.
* If multiple rows are selected, they will be in an array
*/
function get_agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed = true, $get_not_init_modules = true) {
function agents_common_modules_with_alerts ($id_agent, $filter = false, $indexed = true, $get_not_init_modules = true) {
$id_agent = safe_int ($id_agent, 1);
$where = '';
@ -629,7 +660,7 @@ $modules = get_agent_modules ($id_agent, '*', 'disabled = 0 AND history_data = 0
* @return array An array with all modules in the agent.
* If multiple rows are selected, they will be in an array
*/
function get_agents_common_modules ($id_agent, $filter = false, $indexed = true, $get_not_init_modules = true) {
function agents_common_modules ($id_agent, $filter = false, $indexed = true, $get_not_init_modules = true) {
$id_agent = safe_int ($id_agent, 1);
$where = '';

File diff suppressed because it is too large Load Diff

View File

@ -1475,7 +1475,7 @@ function get_group_alerts ($id_group) {
$agents = get_group_agents ($id_group, false, "none");
foreach ($agents as $agent_id => $agent_name) {
$agent_alerts = get_agent_alerts ($agent_id);
$agent_alerts = agents_get_alerts ($agent_id);
$alerts = array_merge ($alerts, $agent_alerts);
}
@ -3537,10 +3537,11 @@ function get_modulegroup_name ($modulegroup_id) {
*
* @param string Table to insert into
* @param mixed A single value or array of values to insert (can be a multiple amount of rows)
* @param bool Whether to do autocommit or not (only Oracle)
*
* @return mixed False in case of error or invalid values passed. Affected rows otherwise
*/
function process_sql_insert($table, $values) {
function process_sql_insert($table, $values, $autocommit = true) {
global $config;
switch ($config["dbtype"]) {
@ -3551,7 +3552,7 @@ function process_sql_insert($table, $values) {
return postgresql_process_sql_insert($table, $values);
break;
case "oracle":
return oracle_process_sql_insert($table, $values);
return oracle_process_sql_insert($table, $values, $autocommit);
break;
}
}

View File

@ -32,6 +32,8 @@
* False on error.
*/
function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $forced_name = false) {
global $config;
$module = get_agentmodule ($id_agent_module);
if ($module === false)
return false;
@ -52,8 +54,17 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $force
//the foreach have only one loop but extract the array index, and it's id_agente_modulo
foreach ($modulesDisabled as $id => $garbage) {
$id_module = $id;
process_sql_update('tagente_modulo', array('disabled' => false, 'delete_pending' => false),
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
process_sql_update('tagente_modulo', array('disabled' => false, 'delete_pending' => false),
array('id_agente_modulo' => $id_module, 'disabled' => true));
break;
case "oracle":
process_sql_update('tagente_modulo', array('disabled' => false, 'delete_pending' => false),
array('id_agente_modulo' => $id_module, 'disabled' => true), 'AND', false);
break;
}
}
$values = array ();
@ -89,8 +100,16 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $force
unset ($new_module[$i]);
/* Unset original agent module id */
unset ($new_module['id_agente_modulo']);
$id_new_module = process_sql_insert ('tagente_modulo', $new_module);
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$id_new_module = process_sql_insert ('tagente_modulo', $new_module);
break;
case "oracle":
$id_new_module = process_sql_insert ('tagente_modulo', $new_module, false);
break;
}
if ($id_new_module === false) {
return false;
}
@ -104,8 +123,16 @@ function copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $force
if (! in_array ($new_module['id_tipo_modulo'], array (2, 6, 9, 18, 21, 100))) //TODO delete magic numbers
/* Not proc modules uses a special estado (status) value */
$values['estado'] = 100;
$result = process_sql_insert ('tagente_estado', $values);
switch ($config['dbtype']) {
case "mysql":
case "postgresql":
$result = process_sql_insert ('tagente_estado', $values);
break;
case "oracle":
$result = process_sql_insert ('tagente_estado', $values, false);
break;
}
if ($result === false)
return false;

View File

@ -50,7 +50,7 @@ function generate_dot ($pandora_name, $group = 0, $simple = 0, $font_size = 12,
$filter['id_grupo'] = $group;
// Get agent data
$agents = get_agents ($filter,
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente'));
if ($agents === false)
return false;
@ -177,7 +177,7 @@ function generate_dot_groups ($pandora_name, $group = 0, $simple = 0, $font_size
if($depth != 'group') {
// Get agents data
$agents = get_agents ($filter,
$agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_agente'));
if ($agents === false)

View File

@ -953,8 +953,8 @@ function get_fired_alerts_reporting_table ($alerts_fired) {
require_once ($config["homedir"].'/include/functions_alerts.php');
foreach (array_keys ($alerts_fired) as $id_alert) {
$alert_module = get_alert_agent_module ($id_alert);
$template = get_alert_template ($id_alert);
$alert_module = alerts_get_alert_agent_module ($id_alert);
$template = alerts_get_alert_template ($id_alert);
/* Add alerts fired to $agents_fired_alerts indexed by id_agent */
$id_agent = get_db_value ('id_agente', 'tagente_modulo',
@ -1024,7 +1024,7 @@ function alert_reporting_agent ($id_agent, $period = 0, $date = 0, $return = tru
$table->head[2] = __('Actions');
$table->head[3] = __('Fired');
$alerts = get_agent_alerts ($id_agent);
$alerts = agents_get_alerts ($id_agent);
if (isset($alerts['simple'])) {
$i = 0;
@ -1362,7 +1362,7 @@ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) {
require_once ($config["homedir"].'/include/functions_alerts.php');
$alerts = get_agent_alerts ($id_agent);
$alerts = agents_get_alerts ($id_agent);
/* FIXME: Add compound alerts to the report. Some extra code is needed here */
foreach ($alerts['simple'] as $alert) {
$fires = get_alert_fires_in_period ($alert['id'], $period, $date);
@ -1370,9 +1370,9 @@ function get_agent_alerts_reporting_table ($id_agent, $period = 0, $date = 0) {
continue;
}
$template = get_alert_template ($alert['id_alert_template']);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$data = array ();
$data[0] = get_alert_templates_type_name ($template['type']);
$data[0] = alerts_get_alert_templates_type_name ($template['type']);
$data[1] = $template['name'];
switch ($template['type']) {
@ -3407,7 +3407,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$filter_groups['id_grupo'] = $id_group;
}
$agents = get_agents ($filter_groups);
$agents = agents_get_agents ($filter_groups);
$nagents = count($agents);
if($all_modules == false || $agents == false) {
@ -3442,7 +3442,7 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
$filter_agents = array('id_grupo' => $id_group);
}
// Prepare pagination
ui_pagination ((int)count(get_agents ($filter_agents)));
ui_pagination ((int)count(agents_get_agents ($filter_agents)));
$table_data .= "<br>";
foreach ($agents as $agent) {

View File

@ -470,7 +470,7 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
}
else {
$id_agent = get_agentmodule_agent ($alert['id_agent_module']);
$template = get_alert_template ($alert['id_alert_template']);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$description = safe_output($template['name']);
}
$data = array ();
@ -535,7 +535,7 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
}
$data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd;
$actions = get_alert_agent_module_actions ($alert['id'], false, $compound);
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $compound);
if (!empty($actions)) {
$actionText = '<div style="margin-left: 10px;"><ul class="action_list">';
@ -629,7 +629,7 @@ function ui_print_alert_template_example ($id_alert_template, $return = false, $
$output .= print_image("images/information.png", true);
$output .= '<span id="example">';
$template = get_alert_template ($id_alert_template);
$template = alerts_get_alert_template ($id_alert_template);
switch ($template['type']) {
case 'equal':

View File

@ -59,14 +59,14 @@ class ViewAgents {
$agent_names = get_group_agents (array_keys ($user_group), array('string' => $this->filterText), "upper");
}
$total_agents = get_agents (array('id_agente' => array_keys ($agent_names),
$total_agents = agents_get_agents (array('id_agente' => array_keys ($agent_names),
'order' => 'nombre ASC',
'disabled' => 0,
'id_grupo' => $groups),
array ('COUNT(*) as total'));
$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
$agents = get_agents(array('id_agente' => array_keys ($agent_names),
$agents = agents_get_agents(array('id_agente' => array_keys ($agent_names),
'order' => 'nombre ASC',
'id_grupo' => $groups,
'offset' => (int) get_parameter ('offset'),
@ -333,7 +333,7 @@ class ViewAgent {
$table->rowclass = array();
echo "<h3 class='title_h3'>" . __('Alerts') . "</h3>";
$alertsSimple = get_agent_alerts_simple (array($this->idAgent));
$alertsSimple = agents_get_alerts_simple (array($this->idAgent));
$rowPair = false;
$iterator = 0;
foreach ($alertsSimple as $alert) {
@ -348,7 +348,7 @@ class ViewAgent {
$data[] = ui_print_truncate_text(get_agentmodule_name($alert["id_agent_module"]), 20, true, true);
$template = safe_output(get_alert_template ($alert['id_alert_template']));
$template = safe_output(alerts_get_alert_template ($alert['id_alert_template']));
$data[] = ui_print_truncate_text(safe_output($template['name']), 20, true, true);
$data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny'));

View File

@ -42,7 +42,7 @@ class ViewAlerts {
$idGroups = array_keys($groups);
$agents = get_group_agents($idGroups);
$alertsSimple = get_agent_alerts_simple($agents);
$alertsSimple = agents_get_alerts_simple($agents);
$rowPair = false;
$iterator = 0;
@ -59,7 +59,7 @@ class ViewAlerts {
$idAgent = get_agentmodule_agent($alert["id_agent_module"]);
$data[] = '<a href="index.php?page=agent&id=' . $idAgent . '">' . ui_print_truncate_text(get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . '</a>';
$template = safe_output(get_alert_template ($alert['id_alert_template']));
$template = safe_output(alerts_get_alert_template ($alert['id_alert_template']));
$data[] = ui_print_truncate_text(safe_output($template['name']), 20, true, true);
$data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny'));

View File

@ -18,7 +18,7 @@ function forceExecution($id_group) {
require_once ("include/functions_alerts.php");
$id_alert = (int) get_parameter ('id_alert');
set_alerts_agent_module_force_execution ($id_alert);
alerts_agent_module_force_execution ($id_alert);
}
function validateAlert() {
@ -27,8 +27,8 @@ function validateAlert() {
if (! empty ($ids) || ! empty ($compound_ids)) {
require_once ("include/functions_alerts.php");
$result1 = validate_alert_agent_module ($ids);
$result2 = validate_alert_compound ($compound_ids);
$result1 = alerts_validate_alert_agent_module ($ids);
$result2 = alerts_validate_alert_compound ($compound_ids);
$result = $result1 || $result2;
ui_print_result_message ($result,

View File

@ -211,11 +211,11 @@ if($filter_standby == 'standby_on') {
}else {
$filter_alert['disabled'] = $filter;
}
$alerts['alerts_simple'] = get_agent_alerts_simple ($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup);
$countAlertsSimple = get_agent_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, $idGroup, true);
$alerts['alerts_simple'] = agents_get_alerts_simple ($agents, $filter_alert, $options_simple, $whereAlertSimple, false, false, $idGroup);
$countAlertsSimple = agents_get_alerts_simple ($agents, $filter, false, $whereAlertSimple, false, false, $idGroup, true);
$alerts['alerts_combined'] = get_agent_alerts_compound($agents, $filter, $options_combined, $idGroup, false, $whereAlertCombined);
$countAlertsCombined = get_agent_alerts_compound($agents, $filter, false, $idGroup, true, $whereAlertCombined);
$alerts['alerts_combined'] = agents_get_alerts_compound($agents, $filter, $options_combined, $idGroup, false, $whereAlertCombined);
$countAlertsCombined = agents_get_alerts_compound($agents, $filter, false, $idGroup, true, $whereAlertCombined);
if ($tab != null) {
$url = $url.'&tab='.$tab;
}

View File

@ -234,13 +234,13 @@ else {
$total_agents = 0;
$agents = false;
if (! empty ($agent_names)) {
$total_agents = get_agents (array ('id_agente' => array_keys ($agent_names),
$total_agents = agents_get_agents (array ('id_agente' => array_keys ($agent_names),
'order' => 'nombre ASC',
'disabled' => 0,
'id_grupo' => $groups),
array ('COUNT(*) as total'));
$total_agents = isset ($total_agents[0]['total']) ? $total_agents[0]['total'] : 0;
$agents = get_agents (array ('id_agente' => array_keys ($agent_names),
$agents = agents_get_agents (array ('id_agente' => array_keys ($agent_names),
'order' => 'nombre ASC',
'id_grupo' => $groups,
'offset' => (int) get_parameter ('offset'),

View File

@ -170,7 +170,7 @@ if ($agent['timezone_offset'] != 0) {
echo '<td class="datos2" colspan="2">'.$agent["timezone_offset"].'</td></tr>';
}
// Next contact (agent)
$progress = getNextAgentContact($id_agente);
$progress = agents_get_next_contact($id_agente);
echo '<tr><td class="datos"><b>'.__('Next agent contact').'</b></td>';
echo '<td class="datos f9" colspan="2">' . progress_bar2($progress, 200, 20) . '</td></tr>';

View File

@ -53,7 +53,7 @@ if (is_ajax ()) {
break;
}
$agents = get_agents ($filter, array ('nombre', 'direccion'));
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));
if ($agents === false)
return;
@ -92,10 +92,10 @@ $agentName = get_parameter_post ('agent', 0);
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$agents = get_agents (array('nombre LIKE "' . $agentName . '"'), array ('id_agente'));
$agents = agents_get_agents (array('nombre LIKE "' . $agentName . '"'), array ('id_agente'));
break;
case "oracle":
$agents = get_agents (array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente'));
$agents = agents_get_agents (array('nombre LIKE \'%' . $agentName . '%\''), array ('id_agente'));
break;
}
$agent = $agents[0]['id_agente'];
@ -314,7 +314,7 @@ if ($group > 0) {
}
$agents = array ();
$rows = get_agents ($filter, false, 'AR');
$rows = agents_get_agents ($filter, false, 'AR');
if ($rows == null) $rows = array();
foreach ($rows as $row) {
$agents[$row['id_agente']] = $row['nombre'];

View File

@ -73,7 +73,7 @@ if (is_ajax ()) {
if ($event === false)
return;
set_alerts_agent_module_standby ($event['id_alert_am'], 1);
alerts_agent_module_standby ($event['id_alert_am'], 1);
return;
}
@ -86,7 +86,7 @@ if (is_ajax ()) {
// Set off the standby mode when close an event
if($new_status == 1) {
$event = get_event ($id);
set_alerts_agent_module_standby ($event['id_alert_am'], 0);
alerts_agent_module_standby ($event['id_alert_am'], 0);
}
$return = validate_event ($id, $similars, $comment, $new_status);
@ -119,15 +119,15 @@ if (is_ajax ()) {
$type = array();
$alert = get_parameter('alert_fired');
if ($alert == 'true') {
$resultAlert = get_event_status_group($idGroup, 'alert_fired', $query);
$resultAlert = alerts_get_event_status_group($idGroup, 'alert_fired', $query);
}
$critical = get_parameter('critical');
if ($critical == 'true') {
$resultCritical = get_event_status_group($idGroup, 'going_up_critical', $query);
$resultCritical = alerts_get_event_status_group($idGroup, 'going_up_critical', $query);
}
$warning = get_parameter('warning');
if ($warning == 'true') {
$resultWarning = get_event_status_group($idGroup, 'going_up_warning', $query);
$resultWarning = alerts_get_event_status_group($idGroup, 'going_up_warning', $query);
}
if ($resultAlert) {

View File

@ -161,7 +161,7 @@ if($searchAlerts) {
break;
}
$alertsraw = get_agent_alerts_simple ($agents, "all_enabled", array('offset' => get_parameter ('offset',0), 'limit' => $config['block_size'], 'order' => $order['field'] . " " . $order['order']), $whereAlerts);
$alertsraw = agents_get_alerts_simple ($agents, "all_enabled", array('offset' => get_parameter ('offset',0), 'limit' => $config['block_size'], 'order' => $order['field'] . " " . $order['order']), $whereAlerts);
$stringSearchPHP = substr($stringSearchSQL,1,strlen($stringSearchSQL)-2);
@ -173,7 +173,7 @@ if($searchAlerts) {
$alerts[$key]['agent_name'] = $alert['agent_name'];
$alerts[$key]['module_name'] = $alert['agent_module_name'];
$alerts[$key]['template_name'] = $alert['template_name'];
$actions = get_alert_agent_module_actions($alert['id']);
$actions = alerts_get_alert_agent_module_actions($alert['id']);
$actions_name = array();
foreach($actions as $action) {