2013-01-29 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/visual_console_builder.wizard.php,
	godmode/reporting/reporting_builder.php,
	godmode/agentes/configurar_agente.php, godmode/menu.php,
	include/functions_ui.php, include/functions_agents.php,
	include/functions_alerts.php, include/functions_menu.php,
	include/functions_networkmap.php,
	include/help/en/help_alert_type.php,
	include/help/es/help_alert_type.php,
	include/functions_reporting.php,
	operation/agentes/alerts_status.functions.php,
	operation/agentes/alerts_status.php: erased the ocurrences about
	the deprecated alert compounds.
	
	Fixes: #3602487




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7543 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-01-29 14:42:55 +00:00
parent 9a4d12df7b
commit e68a23b6cb
15 changed files with 156 additions and 492 deletions

View File

@ -1,3 +1,20 @@
2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/reporting_builder.php,
godmode/agentes/configurar_agente.php, godmode/menu.php,
include/functions_ui.php, include/functions_agents.php,
include/functions_alerts.php, include/functions_menu.php,
include/functions_networkmap.php,
include/help/en/help_alert_type.php,
include/help/es/help_alert_type.php,
include/functions_reporting.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/alerts_status.php: erased the ocurrences about
the deprecated alert compounds.
Fixes: #3602487
2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
* include/help/en/help_alert_compound.php: delete old files for

View File

@ -35,9 +35,9 @@ $group = 0;
if ($id_agente)
$group = agents_get_agent_group ($id_agente);
if (! check_acl ($config["id_user"], $group, "AW", $id_agente)) {
if (!check_acl ($config["id_user"], $group, "AW", $id_agente)) {
$access_granted = false;
switch($tab) {
switch ($tab) {
case 'alert':
case 'module':
if (check_acl ($config["id_user"], $group, "AD", $id_agente)) {
@ -48,7 +48,7 @@ if (! check_acl ($config["id_user"], $group, "AW", $id_agente)) {
break;
}
if(!$access_granted) {
if (!$access_granted) {
db_pandora_audit("ACL Violation",
"Trying to access agent manager");
require ("general/noaccess.php");
@ -61,8 +61,8 @@ require_once ('include/functions_alerts.php');
require_once ('include/functions_reporting.php');
// Get passed variables
$alerttype = get_parameter ('alerttype');
$id_agent_module = (int) get_parameter ('id_agent_module');
$alerttype = get_parameter('alerttype');
$id_agent_module = (int)get_parameter('id_agent_module');
// Init vars
$descripcion = "";
@ -73,7 +73,7 @@ $campo_3 = "";
$maximo = 0;
$minimo = 0;
$nombre_agente = "";
$direccion_agente = get_parameter ('direccion', '');
$direccion_agente = get_parameter('direccion', '');
$intervalo = SECONDS_5MINUTES;
$ff_interval = 0;
$quiet_module = 0;
@ -139,12 +139,12 @@ $url_description = '';
$quiet = 0;
$macros = '';
$create_agent = (bool) get_parameter ('create_agent');
$create_agent = (bool)get_parameter('create_agent');
// Create agent
if ($create_agent) {
$nombre_agente = (string) get_parameter_post ("agente",'');
$direccion_agente = (string) get_parameter_post ("direccion",'');
$nombre_agente = (string) get_parameter_post("agente",'');
$direccion_agente = (string) get_parameter_post("direccion",'');
$grupo = (int) get_parameter_post ("grupo");
$intervalo = (string) get_parameter_post ("intervalo", SECONDS_5MINUTES);
$comentarios = (string) get_parameter_post ("comentarios", '');
@ -347,7 +347,7 @@ if ($id_agente) {
$incidenttab['active'] = false;
}
if(check_acl ($config["id_user"], $group, "AW", $id_agente)) {
if (check_acl ($config["id_user"], $group, "AW", $id_agente)) {
$onheader = array('view' => $viewtab,
'separator' => "",
'main' => $maintab,
@ -1055,20 +1055,25 @@ if ($create_module) {
// =================
if ($delete_module) { // DELETE agent module !
$id_borrar_modulo = (int) get_parameter_get ("delete_module",0);
$module_data = db_get_row_sql ('SELECT * FROM tagente_modulo, tagente_estado WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo AND tagente_modulo.id_agente_modulo=' . $id_borrar_modulo);
$module_data = db_get_row_sql ('SELECT *
FROM tagente_modulo, tagente_estado
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
AND tagente_modulo.id_agente_modulo=' . $id_borrar_modulo);
$id_grupo = (int) agents_get_agent_group($id_agente);
if (! check_acl ($config["id_user"], $id_grupo, "AW")) {
db_pandora_audit("ACL Violation",
"Trying to delete a module without admin rights");
"Trying to delete a module without admin rights");
require ("general/noaccess.php");
exit;
}
if ($id_borrar_modulo < 1) {
db_pandora_audit("HACK Attempt",
"Expected variable from form is not correct");
"Expected variable from form is not correct");
require ("general/noaccess.php");
exit;
}
@ -1087,38 +1092,59 @@ if ($delete_module) { // DELETE agent module !
'nombre' => 'pendingdelete',
'disabled' => 1,
'delete_pending' => 1);
$result = db_process_sql_update('tagente_modulo', $values, array('id_agente_modulo' => $id_borrar_modulo));
$result = db_process_sql_update('tagente_modulo',
$values, array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false) {
$error++;
} else {
}
else {
// Update module status count
if ($module_data['estado'] == 0) {
db_process_sql ('UPDATE tagente SET normal_count=normal_count-1 WHERE id_agente=' . $module_data['id_agente']);
} else if ($module_data['estado'] == 1) {
db_process_sql ('UPDATE tagente SET critical_count=critical_count-1 WHERE id_agente=' . $module_data['id_agente']);
} else if ($module_data['estado'] == 2) {
db_process_sql ('UPDATE tagente SET warning_count=warning_count-1 WHERE id_agente=' . $module_data['id_agente']);
} else if ($module_data['estado'] == 3) {
db_process_sql ('UPDATE tagente SET unknown_count=unknown_count-1 WHERE id_agente=' . $module_data['id_agente']);
} else if ($module_data['estado'] == 4) {
db_process_sql ('UPDATE tagente SET notinit_count=notinit_count-1 WHERE id_agente=' . $module_data['id_agente']);
db_process_sql ('UPDATE tagente
SET normal_count=normal_count-1
WHERE id_agente=' . $module_data['id_agente']);
}
else if ($module_data['estado'] == 1) {
db_process_sql ('UPDATE tagente
SET critical_count=critical_count-1
WHERE id_agente=' . $module_data['id_agente']);
}
else if ($module_data['estado'] == 2) {
db_process_sql ('UPDATE tagente
SET warning_count=warning_count-1
WHERE id_agente=' . $module_data['id_agente']);
}
else if ($module_data['estado'] == 3) {
db_process_sql ('UPDATE tagente
SET unknown_count=unknown_count-1
WHERE id_agente=' . $module_data['id_agente']);
}
else if ($module_data['estado'] == 4) {
db_process_sql ('UPDATE tagente
SET notinit_count=notinit_count-1
WHERE id_agente=' . $module_data['id_agente']);
}
db_process_sql ('UPDATE tagente SET total_count=total_count-1 WHERE id_agente=' . $module_data['id_agente']);
db_process_sql ('UPDATE tagente
SET total_count=total_count-1
WHERE id_agente=' . $module_data['id_agente']);
}
$result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_borrar_modulo));
$result = db_process_sql_delete('tagente_estado',
array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false)
$error++;
$result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_borrar_modulo));
$result = db_process_sql_delete('tagente_datos_inc',
array('id_agente_modulo' => $id_borrar_modulo));
if ($result === false)
$error++;
if (alerts_delete_alert_agent_module($id_borrar_modulo) === false)
$error++;
$result = db_process_delete_temp('ttag_module', 'id_agente_modulo', $id_borrar_modulo);
$result = db_process_delete_temp('ttag_module', 'id_agente_modulo',
$id_borrar_modulo);
if ($result === false)
$error++;

View File

@ -28,13 +28,13 @@ if (check_acl ($config['id_user'], 0, "AW") || check_acl ($config['id_user'], 0,
$menu_godmode["gagente"]["text"] = __('Manage monitoring');
$menu_godmode["gagente"]["sec2"] = "godmode/agentes/modificar_agente";
$menu_godmode["gagente"]["id"] = "god-agents";
if(check_acl ($config['id_user'], 0, "AW")) {
$sub = array ();
$sub['godmode/agentes/modificar_agente']['text'] = __('Manage agents');
$sub["godmode/agentes/modificar_agente"]["subsecs"] = array(
"godmode/agentes/configurar_agente");
enterprise_hook("duplicate_confi_submenu");
if (check_acl ($config["id_user"], 0, "PM")) {
@ -53,7 +53,7 @@ if (check_acl ($config['id_user'], 0, "AW")) {
$menu_godmode["gmassive"]["text"] = __('Massive operations');
$menu_godmode["gmassive"]["sec2"] = "godmode/massive/massive_operations";
$menu_godmode["gmassive"]["id"] = "god-massive";
$sub = array ();
$sub["godmode/massive/massive_operations&amp;tab=massive_agents"]["text"] = __('Agents operations');
$sub["godmode/massive/massive_operations&amp;tab=massive_modules"]["text"] = __('Modules operations');
@ -106,14 +106,13 @@ if (check_acl ($config['id_user'], 0, "LM") || check_acl ($config['id_user'], 0,
$sub = array ();
$sub["godmode/alerts/alert_templates"]["text"] = __('Templates');
$sub["godmode/alerts/alert_actions"]["text"] = __('Actions');
if (check_acl ($config['id_user'], 0, "PM")) {
$sub["godmode/alerts/alert_commands"]["text"] = __('Commands');
}
$sub["godmode/alerts/alert_compounds"]["text"] = __('Correlation');
$sub["godmode/alerts/alert_special_days"]["text"] = __('Special days list');
enterprise_hook('eventalerts_submenu');
$menu_godmode["galertas"]["sub"] = $sub;
}
}
@ -139,10 +138,10 @@ if (check_acl ($config['id_user'], 0, "IW")) {
if ($config['activate_gis']) {
$menu_godmode["godgismaps"]["text"] = __('GIS Maps builder');
$menu_godmode["godgismaps"]["sec2"] = "godmode/gis_maps/index";
if (!empty($config['refr'])){
if (!empty($config['refr'])) {
$menu_godmode["godgismaps"]["refr"] = $config['refr'];
}
else{
else {
$menu_godmode["godgismaps"]["refr"] = 60;
}
$menu_godmode["godgismaps"]["id"] = "god-gismaps";
@ -168,12 +167,12 @@ if (check_acl ($config['id_user'], 0, "EW")) {
}
if (check_acl ($config['id_user'], 0, "AW")) {
// Servers
$menu_godmode["gservers"]["text"] = __('Manage servers');
$menu_godmode["gservers"]["sec2"] = "godmode/servers/modificar_server";
$menu_godmode["gservers"]["id"] = "god-servers";
$sub = array ();
$sub["godmode/servers/manage_recontask"]["text"] = __('Manage recontask');
@ -198,36 +197,36 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$menu_godmode["glog"]["text"] = __('System audit log');
$menu_godmode["glog"]["sec2"] = "godmode/admin_access_logs";
$menu_godmode["glog"]["id"] = "god-audit";
// Setup
$menu_godmode["gsetup"]["text"] = __('Setup');
$menu_godmode["gsetup"]["sec2"] = "godmode/setup/setup&section=general";
$menu_godmode["gsetup"]["id"] = "god-setup";
$sub = array ();
$sub["godmode/setup/file_manager"]["text"] = __('File manager');
if ($config['activate_gis'])
$sub["godmode/setup/gis"]["text"] = __('Map conections GIS');
$sub["godmode/setup/links"]["text"] = __('Links');
$sub["godmode/setup/news"]["text"] = __('Site news');
$sub["godmode/setup/os"]["text"] = __('Edit OS');
enterprise_hook ('enterprise_acl_submenu');
enterprise_hook ('skins_submenu');
$sub["extras/pandora_diag"]["text"] = __('Diagnostic info');
$menu_godmode["gsetup"]["sub"] = $sub;
}
if (check_acl ($config['id_user'], 0, "AW")) {
if ($config['activate_netflow']) {
//Netflow
$menu_godmode["netf"]["text"] = __('Netflow filters');
$menu_godmode["netf"]["sec2"] = "godmode/netflow/nf_edit";
$menu_godmode["netf"]["id"] = "god-netflow";
}
if ($config['activate_netflow']) {
//Netflow
$menu_godmode["netf"]["text"] = __('Netflow filters');
$menu_godmode["netf"]["sec2"] = "godmode/netflow/nf_edit";
$menu_godmode["netf"]["id"] = "god-netflow";
}
}
if (check_acl ($config['id_user'], 0, "DM")) {
@ -242,7 +241,7 @@ if (check_acl ($config['id_user'], 0, "DM")) {
$sub["godmode/db/db_audit"]["text"] = __('Database audit');
$sub["godmode/db/db_event"]["text"] = __('Database event');
$sub["godmode/db/db_sanity"]["text"] = __('Database sanity');
$menu_godmode["gdbman"]["sub"] = $sub;
}
@ -251,7 +250,7 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$menu_godmode["gextensions"]["text"] = __('Extensions');
$menu_godmode["gextensions"]["sec2"] = "godmode/extensions";
$menu_godmode["gextensions"]["id"] = "god-extensions";
$sub = array ();
foreach ($config['extensions'] as $extension) {
//If no godmode_menu is a operation extension
@ -276,10 +275,10 @@ if (check_acl ($config['id_user'], 0, "PM")) {
if (strlen($extmenu['fatherId']) > 0) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["text"] = __($extmenu['name']);
if ($extmenu["name"] != 'DB interface'){
if (!empty($config['refr'])){
if (!empty($config['refr'])) {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["refr"] = $config['refr'];
}
else{
else {
$menu_godmode[$extmenu['fatherId']]['sub'][$extmenu['sec2']]["refr"] = 60;
}
}

View File

@ -562,7 +562,7 @@ switch ($action) {
$start_url = ui_get_full_url(false);
$first_page = "&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;".$start_url."/images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;";
$idOrResult = db_process_sql_insert('treport',
array('name' => $reportName,
'id_group' => $idGroupReport,

View File

@ -36,7 +36,8 @@ else {
$metaconsole_hack = '../../';
$table->width = '600';
require_once($config['homedir'] . "/enterprise/meta/include/functions_html_meta.php");
require_once($config['homedir'] .
"/enterprise/meta/include/functions_html_meta.php");
}
$table->style = array ();

View File

@ -1748,7 +1748,6 @@ function agents_delete_agent ($id_agents, $disableACL = false) {
// daily maintance process, all data for that modules are deleted
//Alert
db_process_delete_temp ("talert_compound", "id_agent", $id_agent);
db_process_delete_temp ("talert_template_modules", "id_agent_module", $where_modules);
//Events (up/down monitors)

View File

@ -873,18 +873,6 @@ function alerts_delete_alert_agent_module ($id_alert_agent_module, $filter = fal
if ($id_alert_agent_module)
$filter['id'] = $id_alert_agent_module;
if ($id_alert_agent_module !== false) {
$idAlertCompunds = db_get_all_rows_sql('
SELECT id_alert_compound
FROM talert_compound_elements
WHERE id_alert_template_module = ' . $id_alert_agent_module);
if ($idAlertCompunds !== false) {
foreach($idAlertCompunds as $id)
alerts_delete_alert_compound($id);
}
}
/*
The deletion of actions from talert_template_module_actions,
it is automatily because the data base this table have
@ -1101,24 +1089,16 @@ function alerts_delete_alert_agent_module_action ($id_alert_agent_module_action)
*
* @param int Id of an alert associated to a module.
* @param mixed Array with fields to retrieve or false.
* @param bool Whether to retrieve compound alert or not.
*
* @return mixed Actions associated or false if something goes wrong.
*/
function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false, $compound = false) {
function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false) {
if (empty ($id_alert_agent_module))
return false;
if ($compound) {
$actions = db_get_all_rows_filter ('talert_compound_actions',
array ('id_alert_compound' => $id_alert_agent_module),
$actions = db_get_all_rows_filter ('talert_template_module_actions',
array ('id_alert_template_module' => $id_alert_agent_module),
$fields);
}
else {
$actions = db_get_all_rows_filter ('talert_template_module_actions',
array ('id_alert_template_module' => $id_alert_agent_module),
$fields);
}
if ($actions === false)
return array ();
@ -1130,10 +1110,10 @@ function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields
$action = alerts_get_alert_action ($element['id_alert_action']);
$action['fires_min'] = $element['fires_min'];
$action['fires_max'] = $element['fires_max'];
if (!$compound)
$action['module_action_threshold'] = $element['module_action_threshold'];
$action['module_action_threshold'] = $element['module_action_threshold'];
if (isset($element['id']))
$retval[$element['id']] = $action;
$retval[$element['id']] = $action;
}
return $retval;
@ -1252,349 +1232,6 @@ function alerts_copy_alert_module_to_module ($id_agent_alert, $id_destiny_module
return $id_new_alert;
}
/* Compound alerts */
/**
* Get Threshold values of an alert.
*
* @return Result threshold values.
*/
function alerts_compound_threshold_values () {
/* At this moment we don't need different threshold values */
// TODO: Delete when compound alerts will be deleted
return get_periods ();
}
/**
* Get an array of compound operations.
*
* @return Result array with operations.
*/
function alerts_compound_operations () {
$operations = array ();
$operations['OR'] = 'OR';
$operations['AND'] = 'AND';
$operations['XOR'] = 'XOR';
$operations['NOR'] = 'NOR';
$operations['NAND'] = 'NAND';
$operations['NXOR'] = 'NXOR';
return $operations;
}
/**
* Creates an alert compound.
*
* @param string Name of the alert compound.
* @param int Id of the associated agent.
* @param mixed Array of values of the alert compound.
*
* @return Id of the alert compound of false is something goes wrong.
*/
function alerts_create_alert_compound ($name, $id_agent, $values = false) {
global $config;
if (empty ($name))
return false;
if (! is_array ($values))
$values = array ();
$values['name'] = $name;
$values['id_agent'] = (int) $id_agent;
switch ($config['dbtype']) {
case "oracle":
$values['field3_recovery'] = ' ';
break;
}
return @db_process_sql_insert ('talert_compound', $values);
}
/**
* Updates an alert compound.
*
* @param int Id of the associated agent.
* @param mixed Array of values of the alert compound.
*
* @return Affected values or false is something goes wrong.
*/
function alerts_update_alert_compound ($id_alert_compound, $values) {
$id_alert_compound = safe_int ($id_alert_compound);
if (empty ($id_alert_compound))
return false;
if (! is_array ($values))
return false;
return (@db_process_sql_update ('talert_compound', $values,
array ('id' => $id_alert_compound))) !== false;
}
/**
* Deletes an alert compound.
*
* @param int Id of the associated agent.
*
* @return Affected values or false is something goes wrong.
*/
function alerts_delete_alert_compound_elements ($id_alert_compound) {
$id_alert_compound = safe_int ($id_alert_compound);
if (empty ($id_alert_compound))
return false;
return (@db_process_sql_delete ('talert_compound_elements',
array ('id_alert_compound' => $id_alert_compound))) !== false;
}
/**
* Add an alert compound element.
*
* @param int Id alert compound.
* @param int Id alert associated to a module.
* @param string Operation content.
*
* @return Affected values or false is something goes wrong.
*/
function alerts_add_alert_compound_element ($id_alert_compound, $id_alert_template_module, $operation) {
$id_alert_compound = safe_int ($id_alert_compound);
if (empty ($id_alert_compound))
return false;
if (empty ($id_alert_template_module))
return false;
if (empty ($operation))
return false;
$values = array ();
$values['id_alert_compound'] = (int) $id_alert_compound;
$values['id_alert_template_module'] = (int) $id_alert_template_module;
$values['operation'] = $operation;
return @db_process_sql_insert ('talert_compound_elements', $values);
}
/**
* Get all alert compounds.
*
* @param mixed Filter conditions or false.
* @param mixed Array with a fields to retrieve.
*
* @return Result set of alert compounds or false is something goes wrong.
*/
function alerts_get_alert_compounds ($filter = false, $fields = false) {
return @db_get_all_rows_filter ('talert_compound', $filter, $fields);
}
/**
* Get one alert compound.
*
* @param int Id of the alert compound.
*
* @return Result set of the selected alert compound or false is something goes wrong.
*/
function alerts_get_alert_compound ($id_alert_compound) {
global $config;
switch ($config['dbtype']){
case "mysql":
case "postgresql":
return db_get_row ('talert_compound', 'id', $id_alert_compound);
break;
case "oracle":
$fields_select = db_get_all_rows_sql('SELECT column_name FROM user_tab_columns WHERE table_name = \'TALERT_COMPOUND\' AND column_name NOT IN (\'TIME_FROM\',\'TIME_TO\')');
foreach ($fields_select as $field_select){
$select_field[] = $field_select['column_name'];
}
$select_stmt = implode(',', $select_field);
return db_get_row_sql("SELECT $select_stmt, to_char(time_from, 'hh24:mi:ss') as time_from, to_char(time_to, 'hh24:mi:ss') as time_to FROM talert_compound");
break;
}
}
/**
* Get actions of an alert compound.
*
* @param int Id of the alert compound.
* @param mixed Array of fields to retrieve or false.
*
* @return Result set of actions or false is something goes wrong.
*/
function alerts_get_alert_compound_actions ($id_alert_compound, $fields = false) {
$id_alert_compound = safe_int ($id_alert_compound);
if (empty ($id_alert_compound))
return false;
$actions = db_get_all_rows_filter ('talert_compound_actions',
array ('id_alert_compound' => $id_alert_compound),
$fields);
if ($actions === false)
return array ();
if ($fields !== false)
return $actions;
$retval = array ();
foreach ($actions as $element) {
$action = alerts_get_alert_action ($element['id_alert_action']);
$action['fires_min'] = $element['fires_min'];
$action['fires_max'] = $element['fires_max'];
$retval[$element['id']] = $action;
}
return $retval;
}
/**
* Get name field of talert_compound.
*
* @param int Id of the alert compound.
*
* @return Name of the alert compound or false is something goes wrong.
*/
function alerts_get_alert_compound_name ($id_alert_compound) {
return (string) db_get_value ('name', 'talert_compound', 'id',
$id_alert_compound);
}
/**
* Get elements of an alert compound.
*
* @param int Id of the alert compound.
*
* @return Result set of the elements selected or false is something goes wrong.
*/
function alerts_get_alert_compound_elements ($id_alert_compound) {
return db_get_all_rows_field_filter ('talert_compound_elements',
'id_alert_compound', $id_alert_compound);
}
/**
* Gets action of an alert compound.
*
* @param int Id of the alert compound.
* @param int Id of the alert compound action.
*
* @return Result set of the action selected or false is something goes wrong.
*/
function alerts_add_alert_compound_action ($id_alert_compound, $id_alert_action, $options = false) {
if (empty ($id_alert_compound))
return false;
if (empty ($id_alert_action))
return false;
$values = array ();
$values['id_alert_compound'] = (int) $id_alert_compound;
$values['id_alert_action'] = (int) $id_alert_action;
$values['fires_max'] = 0;
$values['fires_min'] = 0;
if ($options) {
$max = 0;
$min = 0;
if (isset ($options['fires_max']))
$max = (int) $options['fires_max'];
if (isset ($options['fires_min']))
$min = (int) $options['fires_min'];
$values['fires_max'] = max ($max, $min);
$values['fires_min'] = min ($max, $min);
}
return (@db_process_sql_insert ('talert_compound_actions', $values)) !== false;
}
/**
* Delete action of an alert compound.
*
* @param int Id of the alert compound action.
*
* @return Affected rows or false is something goes wrong.
*/
function alerts_delete_alert_compound_action ($id_alert_compound_action) {
if (empty ($id_alert_compound_action))
return false;
return (@db_process_sql_delete ('talert_compound_actions',
array ('id' => $id_alert_compound_action))) !== false;
}
/**
* Disable/Enable an alert compound.
*
* @param int Id of the alert compound.
* @param bool Whether to enable or disable an alert compound.
*
* @return Affected rows or false is something goes wrong.
*/
function alerts_set_alerts_compound_disable ($id_alert_compound, $disabled) {
$id_alert_agent_module = safe_int ($id_alert_compound, 0);
return (@db_process_sql_update ('talert_compound',
array ('disabled' => (bool) $disabled),
array ('id' => $id_alert_compound))) !== false;
}
/**
* Validates a compound alert id or an array of alert id's.
*
* @param mixed Array of compound alert ids or single id.
*
* @return bool True if it was successful, false otherwise.
*/
function alerts_validate_alert_compound ($id_alert_compound) {
global $config;
require_once ("include/functions_events.php");
$alerts = safe_int ($id_alert_compound, 1);
if (empty ($alerts)) {
return false;
}
$alerts = (array) $alerts;
foreach ($alerts as $id) {
$alert = alerts_get_alert_compound ($id);
$agent_id = $alert["id_agent"];
$group_id = agents_get_agent_group ($agent_id);
if (! check_acl ($config['id_user'], $group_id, "AW")) {
continue;
}
$result = db_process_sql_update ('talert_compound',
array ('times_fired' => 0,
'internal_counter' => 0),
array ('id' => $id));
if ($result > 0) {
events_create_event ("Manual validation of compound alert for ".
$alert["name"],
$group_id, $agent_id, 1, $config["id_user"],
"alert_manual_validation", 1, $alert["id"],
$id);
}
elseif ($result === false) {
return false;
}
}
return true;
}
/**
* Deletes an alert compound.
*
* @param int Id of the alert compound.
*
* @return mixed Affected rows or false is something goes wrong.
*/
function alerts_delete_alert_compound ($id_alert_compound) {
$id_alert_compound = safe_int ($id_alert_compound, 1);
if (empty ($id_alert_compound))
return false;
return (@db_process_sql_delete ('talert_compound',
array ('id' => $id_alert_compound))) !== false;
}
/**
* Get agents with an specific alert template.
*

View File

@ -358,45 +358,59 @@ function menu_add_extras(&$menu) {
$menu_extra = array();
$menu_extra['gusuarios']['sub']['godmode/users/configure_user']['text'] = __('Configure user');
$menu_extra['gusuarios']['sub']['godmode/users/configure_profile']['text'] = __('Configure profile');
$menu_extra['gservers']['sub']['godmode/servers/manage_recontask_form']['text'] = __('Manage recontask');
$menu_extra['gmodules']['sub']['godmode/modules/manage_network_templates_form']['text'] = __('Module templates management');
$menu_extra['gmodules']['sub']['enterprise/godmode/modules/manage_inventory_modules_form']['text'] = __('Inventory modules management');
$menu_extra['gmodules']['sub']['godmode/tag/edit_tag']['text'] = __('Tags management');
$menu_extra['gagente']['sub']['godmode/agentes/configurar_agente']['text'] = __('Agents management');
$menu_extra['estado']['sub']['operation/agentes/ver_agente']['text'] = __('View agent');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_template']['text'] = __('Configure alert template');
$menu_extra['network']['sub']['operation/agentes/networkmap']['text'] = __('Manage network map');
$menu_extra['reporting']['sub']['operation/reporting/reporting_viewer']['text'] = __('View reporting');
$menu_extra['reporting']['sub']['operation/visual_console/render_view']['text'] = __('View visual console');
$menu_extra['reporting']['sub']['godmode/reporting/graph_builder']['text'] = __('Manage custom graphs');
$menu_extra['reporting']['sub']['enterprise/dashboard/dashboard_replicate']['text'] = __('Copy dashboard');
if ($config['activate_gis'])
$menu_extra['godgismaps']['sub']['godmode/gis_maps/configure_gis_map']['text'] = __('Manage GIS Maps');
$menu_extra['workspace']['sub']['operation/incidents/incident_statistics']['text'] = __('Incidents statistics');
$menu_extra['workspace']['sub']['operation/messages/message_edit']['text'] = __('Manage messages');
$menu_extra['gagente']['sub']['godmode/groups/configure_group']['text'] = __('Manage groups');
$menu_extra['gagente']['sub']['godmode/groups/configure_modu_group']['text'] = __('Manage module groups');
$menu_extra['gagente']['sub']['godmode/agentes/configure_field']['text'] = __('Manage custom field');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_action']['text'] = __('Manage alert actions');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_command']['text'] = __('Manage commands');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_compound']['text'] = __('Manage compound alerts');
$menu_extra['galertas']['sub']['enterprise/godmode/alerts/alert_events']['text'] = __('Manage event alerts');
$menu_extra['gservers']['sub']['enterprise/godmode/servers/manage_export_form']['text'] = __('Manage export targets');
$menu_extra['estado']['sub']['enterprise/godmode/services/manage_services']['text'] = __('Manage services');
$menu_extra['estado']['sub']['godmode/snmpconsole/snmp_alert']['text'] = __('SNMP alerts');
$menu_extra['estado']['sub']['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
$menu_extra['estado']['sub']['enterprise/godmode/snmpconsole/snmp_trap_editor']['text'] = __('SNMP trap editor');
$menu_extra['estado']['sub']['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator');
$menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident');
$menu_extra['reporting']['sub']['godmode/reporting/visual_console_builder']['text'] = __('Manage visual console');
// Duplicate extensions as sec=extension to check it from url
foreach ($menu as $k => $m) {
if(!isset($m['sub'])) {
if (!isset($m['sub'])) {
continue;
}
foreach($m['sub'] as $kk => $mm) {
if(isset($mm['sec'])) {
foreach ($m['sub'] as $kk => $mm) {
if (isset($mm['sec'])) {
$menu_extra[$mm['sec']]['sub'][$kk]['text'] = $mm['text'];
}
}
@ -418,7 +432,7 @@ function menu_get_sec($with_categories = false) {
unset($menu['class']);
$in_godmode = false;
foreach($menu as $k => $v) {
foreach ($menu as $k => $v) {
if ($with_categories) {
if (!$in_godmode && $k[0] == 'g') {
// Hack to dont confuse with gis activated because godmode

View File

@ -307,11 +307,11 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
continue;
}
}
// If only agents with alerts => agents without alerts discarded
$alert_agent = agents_get_alerts($agent['id_agente']);
if ($modwithalerts and empty($alert_agent['simple']) and empty($alert_agent['compounds'])){
if ($modwithalerts and empty($alert_agent['simple'])) {
continue;
}
@ -371,8 +371,8 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0, $simple = 0,
}
// Create void statistics array
$stats = array();
$stats = array();
// Create nodes
foreach ($nodes as $node_id => $node) {
if ($center > 0 && ! networkmap_is_descendant ($node_id, $center, $parents)) {

View File

@ -1794,7 +1794,7 @@ function reporting_get_agent_alerts_table ($id_agent, $period = 0, $date = 0) {
require_once ($config["homedir"].'/include/functions_alerts.php');
$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);
if (! $fires) {

View File

@ -648,7 +648,7 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_mediu
*
* @return array A formatted array with proper html for use in $table->data (6 columns)
*/
function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '', $agent_style = false) {
function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = false) {
global $config;
@ -702,18 +702,13 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
}
// Get agent id
if ($compound) {
$id_agent = $alert['id_agent'];
$description = $alert['description'];
}
else {
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$description = io_safe_output($template['name']);
}
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$description = io_safe_output($template['name']);
$data = array ();
if (($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) && (!$compound)) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
if ($policyInfo === false)
$data[$index['policy']] = '';
@ -725,8 +720,6 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
'</a>';
}
}
else if (($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) && ($compound))
$data[$index['policy']] = '';
// Standby
$data[$index['standby']] = '';
@ -736,27 +729,17 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
// Force alert execution
$data[$index['force_execution']] = '';
if (! $compound) {
if ($alert["force_execution"] == 0) {
$data[$index['force_execution']] =
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;force_execution=1&refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "alt" => __('Force'))) . '</a>';
}
else {
$data[$index['force_execution']] =
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;refr=60">' . html_print_image("images/refresh.png", true) . '</a>';
}
if ($alert["force_execution"] == 0) {
$data[$index['force_execution']] =
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;force_execution=1&refr=60">' . html_print_image("images/target.png", true, array("border" => '0', "alt" => __('Force'))) . '</a>';
}
else {
$data[$index['force_execution']] =
'<a href="'.$url.'&amp;id_alert='.$alert["id"].'&amp;refr=60">' . html_print_image("images/refresh.png", true) . '</a>';
}
$data[$index['agent_name']] = $disabledHtmlStart;
if ($compound) {
if ($agent_style !== false) {
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 20, $styleDisabled . " $agent_style");
}
else {
$data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 20, $styleDisabled);
}
}
elseif ($agent == 0) {
if ($agent == 0) {
$data[$index['module_name']] .=
ui_print_truncate_text(modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[&hellip;]', 'font-size: 7.2pt');
}
@ -773,21 +756,18 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
$data[$index['agent_name']] .= $disabledHtmlEnd;
$data[$index['description']] = '';
if (! $compound) {
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
$data[$index['template']] .= html_print_image ('images/zoom.png', true);
$data[$index['template']] .= '</a> ';
$actionDefault = db_get_value_sql("SELECT id_alert_action
FROM talert_templates WHERE id = " . $alert['id_alert_template']);
}
else {
$actionDefault = db_get_value_sql("SELECT id_alert_action FROM talert_compound_actions WHERE id_alert_compound = " . $alert['id']);
}
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
$data[$index['template']] .= html_print_image ('images/zoom.png', true);
$data[$index['template']] .= '</a> ';
$actionDefault = db_get_value_sql("SELECT id_alert_action
FROM talert_templates WHERE id = " . $alert['id_alert_template']);
$data[$index['description']] .= $disabledHtmlStart .
ui_print_truncate_text (io_safe_output($description), 'description', false, true, true, '[&hellip;]', 'font-size: 7.1pt') .
$disabledHtmlEnd;
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $compound);
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false);
if (!empty($actions)) {
$actionText = '<div style="margin-left: 10px;"><ul class="action_list">';
@ -831,12 +811,8 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = '
if (check_acl ($config["id_user"], $id_group, "LW") || check_acl ($config["id_user"], $id_group, "LM")) {
$data[$index['validate']] = '';
if ($compound) {
$data[$index['validate']] .= html_print_checkbox ("validate_compound[]", $alert["id"], false, true);
}
else {
$data[$index['validate']] .= html_print_checkbox ("validate[]", $alert["id"], false, true);
}
$data[$index['validate']] .= html_print_checkbox ("validate[]", $alert["id"], false, true);
}
return $data;

View File

@ -7,7 +7,6 @@
There are some predefined alerts, in which is very likely you will have to adjust, in case your system does not provide the internal commands needed to execute those alerts. The development team has tested these alerts with Red Hat Enterprise Linux (RHEL), CentOS, Debian and Ubuntu Server.
<ul>
<li><b>Compound only</b>: This alert will not be executed individually. This will just be part of a combined alert, and is needed to trigger the combined alert depending on its status and other compound alerts, if exist.</li>
<li><b>eMail</b>: Sends an e-mail from Pandora FMS Server. It uses your local sendmail. If you installed other kind of local mailer or do not have one, you should install and configure sendmail or any equivalent (and check the syntax) to be able to use this service. Pandora FMS rely on system tools to execute almost every alert, it will be necessary to check that those commands work properly on your system.</li>
<li><b>Internal audit</b>: This is the only "internal" alert, it writes the incident in Pandora FMS internal audit system. This is stored in Pandora FMS Database and can be reviewed with Pandora FMS audit viewer from the Web console.</li>
<li><b>Pandora FMS Alertlog</b>: Saves information about the alert inside a text file (.log). Use this type of alert to generate log files using the format you need. To do so, you will need to modify the command so that it will use the format and file you want. Note that Pandora FMS does not handle file rotation, and that Pandora FMS Server process that executes the alert will need acess to the log file to write on it.</li>

View File

@ -7,7 +7,6 @@
Existen algunas alertas predefinidas, las cuales es muy probable que tenga que configurar en caso de que su sistema no proporcione los comandos necesarios para ejecutarlas. El equipo de desarrollo ha probado estas alertas con Red Hat Enterprise Linux (RHEL), CentOS, Debian y Ubuntu Server.
<ul>
<li><b>Compound only</b>: Esta alerta no se ejecutara individualmente. Será parte de una alerta compuesta, y se necesita para disparar a alerta compuesta dependiendo de su estado y otras alertas compuestas, de existir.</li>
<li><b>eMail</b>: Envía un correo-e desde el servidor de Pandora FMS. Usa el sendmail local. Si instaló otro tipo de servidor de correo o no tiene uno, debería instalar y configurar sendmail o cualquiera equivalente (y comprobar la sintaxis) para poder usar este servicio. Pandora FMS depende de las herramientas del sistema para ejecutar prácticamente cada alerta, será necesario comprobar que esos comandos funcionan correctamente en su sistema.</li>
<li><b>Internal audit</b>: Es la única alerta &laquo;interna&raquo;, escribe un incidente en el sistema de auditoría interno de Pandora FMS. Ésto se almacena en la base de datos de Pandora FMS y se puede revisar con el visor de auditoría de Pandora FMS desde la consola Web.</li>
<li><b>Pandora FMS Alertlog</b>: Guarda información acerca de la alerta en un fichero de texto (.log). Use este tipo de alerta para generar ficheros log usando el formato que necesite. Para ello, deberá modificar el comando para que use el formato y fichero que usted quierd.a Note que Pandora FMS no gestiona rotación de ficheros, y que el proceso del servidor de Pandora FMS que ejecuta la alerta deberá poder acceder al fichero log para escribir en él.</li>

View File

@ -23,13 +23,10 @@ function forceExecution($id_group) {
function validateAlert() {
$ids = (array) get_parameter_post ("validate", array ());
$compound_ids = (array) get_parameter_post ("validate_compound", array ());
if (! empty ($ids) || ! empty ($compound_ids)) {
if (!empty($ids)) {
require_once ("include/functions_alerts.php");
$result1 = alerts_validate_alert_agent_module ($ids);
$result2 = alerts_validate_alert_compound ($compound_ids);
$result = $result1 || $result2;
$result = alerts_validate_alert_agent_module ($ids);
ui_print_result_message ($result,
__('Alert(s) validated'),

View File

@ -366,7 +366,7 @@ foreach ($alerts['alerts_simple'] as $alert) {
$table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair;
array_push ($table->data, ui_format_alert_row ($alert, false, $print_agent, $url, 'font-size: 7pt;'));
array_push ($table->data, ui_format_alert_row ($alert, $print_agent, $url, 'font-size: 7pt;'));
}
echo '<form method="post" action="'.$url.'">';