2009-01-15 Esteban Sanchez <estebans@artica.es>
* include/styles/menu.css: Changed the z-index property of the menu which was overlapped in some cases. * include/functions.php: format_alert_row() moved to functions_ui.php * include/functions_ui.php: Added format_alert_row() from function.php * include/functions_agents.php: Added to repository. * include/functions_alerts.php: Added new functions get_alerts_agent_module_disabled(), set_alerts_agent_module_force_execution(), get_alerts_agent_module_last_fired(). * include/functions_db.php, operation/agentes/estado_agente.php, operation/agentes/networkmap.php: Style correction. * include/functions_reporting.php: Use new functions_agent.php. Added a bit of documentation and style correction. * godmode/alerts/alert_templates.php: Improved a bit the template tooltip. * operation/agentes/alerts_status.php: Added to repository. New interface to list agent alerts. * operation/agentes/estado_alertas.php: Removed from repository. Replaced by alert_status.php. * operation/agentes/ver_agente.php: Removed flag_alert code snippet. Use new files added. Style correction. * operation/menu.php: Old files references replaced by new ones. * index.php: Removed build and pandora version references. * pandoradb.sql: Removed useless module_type field in talert_templates. * pandoradb_migrate_20_to_21.sql: Removed duplicate fields addition. Fixed some warnings. Added custom_id field to tagente. Style correction. * include/config_process.php: Updated build version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1344 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0731ede38a
commit
28df678873
|
@ -1,3 +1,50 @@
|
|||
2009-01-15 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/styles/menu.css: Changed the z-index property of the menu
|
||||
which was overlapped in some cases.
|
||||
|
||||
* include/functions.php: format_alert_row() moved to functions_ui.php
|
||||
|
||||
* include/functions_ui.php: Added format_alert_row() from function.php
|
||||
|
||||
* include/functions_agents.php: Added to repository.
|
||||
|
||||
* include/functions_alerts.php: Added new functions
|
||||
get_alerts_agent_module_disabled(),
|
||||
set_alerts_agent_module_force_execution(),
|
||||
get_alerts_agent_module_last_fired().
|
||||
|
||||
* include/functions_db.php, operation/agentes/estado_agente.php,
|
||||
operation/agentes/networkmap.php: Style correction.
|
||||
|
||||
* include/functions_reporting.php: Use new functions_agent.php. Added
|
||||
a bit of documentation and style correction.
|
||||
|
||||
* godmode/alerts/alert_templates.php: Improved a bit the template
|
||||
tooltip.
|
||||
|
||||
* operation/agentes/alerts_status.php: Added to repository. New
|
||||
interface to list agent alerts.
|
||||
|
||||
* operation/agentes/estado_alertas.php: Removed from repository.
|
||||
Replaced by alert_status.php.
|
||||
|
||||
* operation/agentes/ver_agente.php: Removed flag_alert code snippet.
|
||||
Use new files added. Style correction.
|
||||
|
||||
* operation/menu.php: Old files references replaced by new ones.
|
||||
|
||||
* index.php: Removed build and pandora version references.
|
||||
|
||||
* pandoradb.sql: Removed useless module_type field in
|
||||
talert_templates.
|
||||
|
||||
* pandoradb_migrate_20_to_21.sql: Removed duplicate fields addition.
|
||||
Fixed some warnings. Added custom_id field to tagente. Style
|
||||
correction.
|
||||
|
||||
* include/config_process.php: Updated build version.
|
||||
|
||||
2009-01-14 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* operation/servers/view_server_detail.php: Fixed missing parameter.
|
||||
|
|
|
@ -40,35 +40,33 @@ if (defined ('AJAX')) {
|
|||
return;
|
||||
|
||||
echo '<h3>'.$template['name'].'</h3>';
|
||||
echo '<strong>'.__('Type').':</strong> '.get_alert_templates_type_name ($template['type']).'<br />';
|
||||
echo '<strong>'.get_alert_templates_type_name ($template['type']).':</strong> ';
|
||||
|
||||
switch ($template['type']) {
|
||||
case 'regex':
|
||||
case 'equal':
|
||||
case 'not_equal':
|
||||
echo '<strong>'.__('Value').':</strong> ';
|
||||
if (empty ($template['value']))
|
||||
echo '<em>'.__('Empty').'</em>';
|
||||
else
|
||||
echo '<code>'.$template['value'].'</code>';
|
||||
echo '<br />';
|
||||
|
||||
break;
|
||||
case 'max':
|
||||
case 'max_min':
|
||||
echo '<strong>'.__('Max. Value').':</strong> ';
|
||||
echo __('Between').' ';
|
||||
case 'max':
|
||||
echo format_numeric ($template['max_value']);
|
||||
echo '<br />';
|
||||
|
||||
/* Break on max to not show min */
|
||||
if ($template['type'] == 'max')
|
||||
break;
|
||||
echo ''.__('and').' ';
|
||||
case 'min':
|
||||
echo '<strong>'.__('Min. Value').':</strong> ';
|
||||
echo format_numeric ($template['min_value']);
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
|
||||
if ($template['description'] != '') {
|
||||
echo '<strong>'.__('Description').':</strong><br />';
|
||||
echo $template['description'];
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
//Pandora Version
|
||||
if (!isset ($build_version))
|
||||
$build_version="PC081016";
|
||||
if (!isset ($pandora_version))
|
||||
$pandora_version="v2.1-dev";
|
||||
$build_version = "PC090115";
|
||||
$pandora_version = "v2.1-dev";
|
||||
|
||||
// This is directory where placed "/attachment" directory, to upload files stores.
|
||||
// This MUST be writtable by http server user, and should be in pandora root.
|
||||
|
|
|
@ -800,95 +800,6 @@ function show_alert_row_edit ($row2, $tdcolor = "datos", $id_tipo_modulo = 1, $c
|
|||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a row from the alert table and returns an array usable in the table function
|
||||
*
|
||||
* @param array $alert A valid (non empty) row from the alert table
|
||||
* @param bool $combined Whether or not this is a combined alert
|
||||
* @param bool $agent Whether to print the agent information with the module information
|
||||
* @param string $section Tab where the function was called from (used for urls)
|
||||
*
|
||||
* @return array A formatted array with proper html for use in $table->data (7 columns)
|
||||
*/
|
||||
function format_alert_row ($alert, $combined = 0, $agent = 1, $tab = 'main') {
|
||||
if (empty ($alert)) {
|
||||
return array ("", "", "", "", "", "", "");
|
||||
}
|
||||
|
||||
// Get agent id
|
||||
$id_agente = get_agentmodule_agent($alert["id_agente_modulo"]);
|
||||
|
||||
$data = array ();
|
||||
|
||||
// Force alert execution
|
||||
if ($combined == 0) {
|
||||
if ($alert["flag"] == 0) {
|
||||
$data[0] = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$alert["id_agente_modulo"]."&tab=".$tab."&flag_alert=1&refr=60'><img src='images/target.png' border='0'></a>";
|
||||
} else {
|
||||
$data[0] = "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&tab=".$tab."&refr=60'><img src='images/refresh.png' border='0'></a>";
|
||||
}
|
||||
} else {
|
||||
$data[0] = '';
|
||||
}
|
||||
|
||||
$data[1] = get_alert_type ($alert["id_alerta"]);
|
||||
|
||||
if ($combined == 1) {
|
||||
$data[2] = print_agent_name ($id_agente, true, 20);
|
||||
} elseif ($agent == 0) {
|
||||
$data[2] = mb_substr (get_agentmodule_name ($alert["id_agente_modulo"]), 0, 20);
|
||||
} else {
|
||||
$data[2] = print_agent_name (get_agentmodule_agent ($alert["id_agente_modulo"]), true, 20);
|
||||
}
|
||||
|
||||
$data[3] = mb_substr (safe_input ($alert["descripcion"]), 0, 35);
|
||||
|
||||
//Eye tooltip
|
||||
$data[4] = '<a class="info"><img class="top" src="images/eye.png" alt="detail tooltip" />';
|
||||
$data[4] .= '<span><table cellspacing="2" cellpadding="0" style="margin-left:2px;">
|
||||
<tr><th colspan="2" width="91">'.__('Recovery').'</th></tr>
|
||||
<tr><td colspan="2" class="datos" align="center"><b>'.($alert["recovery_notify"] == 1 ? __('Yes') : __('No')).'</b></td></tr>
|
||||
<tr><th colspan="2" width="91">'.__('Priority').'</th></tr>
|
||||
<tr><td colspan="2" class="datos" align="center"><b>'.get_alert_priority ($alert["priority"]).'</b></td></tr>
|
||||
<tr><th colspan="2" width="91">'.__('Fires every').'</th></tr><tr><td colspan="2" class="datos" align="center"><b>';
|
||||
if ($alert["min_alerts"] > 0) {
|
||||
$data[4] .= human_time_description_raw ($alert["time_threshold"] / $alert["min_alerts"]);
|
||||
} else {
|
||||
$data[4] .= human_time_description_raw ($alert["time_threshold"]);
|
||||
}
|
||||
$data[4] .= '</b></td></tr>
|
||||
<tr><th colspan="2" width="91">'.__('Firing days').'</th></tr>
|
||||
<tr><td colspan="2" class="datos" align="center"><b>'.get_alert_days ($alert).'</b></td></tr>
|
||||
<tr><th colspan="2" width="91">'.__('Firing times').'</th></tr>
|
||||
<tr><td colspan="2" class="datos" align="center"><b>'.($alert["time_from"] == $alert["time_to"] ? __('Always') : $alert["time_from"].' - '.$alert["time_to"]).'</b></td></tr>
|
||||
</table></span></a>';
|
||||
|
||||
//Min. and Max. - maybe move this to the span
|
||||
$data[5] = format_numeric ($alert["dis_min"], 2).' / '.format_numeric ($alert["dis_max"], 2);
|
||||
|
||||
$data[6] = print_timestamp ($alert["last_fired"], true);
|
||||
|
||||
$options = array ();
|
||||
$options["height"] = 9;
|
||||
$options["width"] = 20;
|
||||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$options["src"] = "images/pixel_red.png";
|
||||
$options["title"] = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
} elseif ($alert["disable"] > 0) {
|
||||
$options["src"] = "images/pixel_gray.png";
|
||||
$options["title"] = __('Alert disabled');
|
||||
} else {
|
||||
$options["src"] = "images/pixel_green.png";
|
||||
$options["title"] = __('Alert not fired');
|
||||
}
|
||||
$data[7] = print_image ($options["src"], true, $options);
|
||||
|
||||
$data[8] = print_checkbox ("validate[]", $alert["id_aam"], false, true);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report types in an array.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License (LGPL)
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
/**
|
||||
* Get all the simple alerts of an agent.
|
||||
*
|
||||
* @param int Agent id
|
||||
* @param string Filter on "fired", "notfired" or "disabled". Any other value
|
||||
* will not do any filter.
|
||||
*
|
||||
* @return array All simple alerts defined for an agent. Empty array if no
|
||||
* alerts found.
|
||||
*/
|
||||
function get_agent_alerts_simple ($id_agent, $filter = false) {
|
||||
switch ($filter) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disable = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND disable = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND disable = 1';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
|
||||
$id_modules = array_keys (get_agent_modules ($id_agent));
|
||||
|
||||
//$modules = ();
|
||||
|
||||
$sql = sprintf ("SELECT talert_template_modules.*
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module in (%s)",
|
||||
$id_agent, implode (",", $id_modules));
|
||||
|
||||
$alerts = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($alerts === false)
|
||||
return array ();
|
||||
return $alerts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the combined alerts of an agent.
|
||||
*
|
||||
* @param int $id_agent Agent id
|
||||
*
|
||||
* @return array An array with all combined alerts defined for an agent.
|
||||
*/
|
||||
function get_agent_alerts_combined ($id_agent, $filter = false) {
|
||||
switch ($filter) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disable = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND disable = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND disable = 1';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
$sql = sprintf ("SELECT * FROM talerta_agente_modulo WHERE id_agent = %d%s", $id_agent, $filter);
|
||||
$alerts = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($alerts === false)
|
||||
return array ();
|
||||
return $alerts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the alerts of an agent, simple and combined.
|
||||
*
|
||||
* @param int $id_agent Agent id
|
||||
*
|
||||
* @return array An array with all alerts defined for an agent.
|
||||
*/
|
||||
function get_agent_alerts ($id_agent, $filter = false) {
|
||||
$simple_alerts = get_agent_alerts_simple ($id_agent, $filter);
|
||||
$combined_alerts = get_agent_alerts_combined ($id_agent, $filter);
|
||||
|
||||
return array_merge ($simple_alerts, $combined_alerts);
|
||||
}
|
||||
|
||||
?>
|
|
@ -589,12 +589,35 @@ function get_alert_agent_module ($id_alert_agent_module) {
|
|||
}
|
||||
|
||||
function get_alerts_agent_module ($id_agent_module) {
|
||||
$id_alert_agent_module = safe_int ($id_agent_module, 1);
|
||||
$sql = sprintf ('SELECT * FROM talert_template_modules
|
||||
WHERE id_agent_module = %d
|
||||
AND disabled = 0', $id_agent_module);
|
||||
return get_db_all_rows_sql ($sql);
|
||||
}
|
||||
|
||||
function get_alerts_agent_module_disabled ($id_alert_agent_module) {
|
||||
$id_alert_agent_module = safe_int ($id_alert_agent_module, 1);
|
||||
return get_db_value ('disabled', 'talert_template_modules', 'id',
|
||||
$id_alert_agent_module);
|
||||
}
|
||||
|
||||
function set_alerts_agent_module_force_execution ($id_alert_agent_module) {
|
||||
$id_alert_agent_module = safe_int ($id_alert_agent_module, 1);
|
||||
$sql = sprintf ('UPDATE talert_template_modules
|
||||
SET force_execution = 1
|
||||
WHERE id = %d',
|
||||
$id_alert_agent_module);
|
||||
|
||||
return process_sql ($sql) !== false;
|
||||
}
|
||||
|
||||
function get_alerts_agent_module_last_fired ($id_alert_agent_module) {
|
||||
$id_alert_agent_module = safe_int ($id_alert_agent_module, 1);
|
||||
return get_db_value ('last_fired', 'talert_template_modules', 'id',
|
||||
$id_alert_agent_module);
|
||||
}
|
||||
|
||||
function add_alert_agent_module_action ($id_alert_agent_module, $id_alert_action, $options = false) {
|
||||
if (empty ($id_alert_agent_module))
|
||||
return false;
|
||||
|
|
|
@ -291,87 +291,6 @@ function get_agent_modules ($id_agent, $details = false) {
|
|||
}
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the simple alerts of an agent.
|
||||
*
|
||||
* @param int Agent id
|
||||
* @param string Filter on "fired", "notfired" or "disabled". Any other value
|
||||
* will not do any filter.
|
||||
*
|
||||
* @return array All simple alerts defined for an agent. Empty array if no
|
||||
* alerts found.
|
||||
*/
|
||||
function get_agent_alerts_simple ($id_agent, $filter = false) {
|
||||
switch ($filter) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disable = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND disable = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND disable = 1';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT talerta_agente_modulo.*
|
||||
FROM talerta_agente_modulo, tagente_modulo
|
||||
WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.id_agente = %d %s",
|
||||
$id_agent, $filter);
|
||||
$alerts = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($alerts === false)
|
||||
return array ();
|
||||
return $alerts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the combined alerts of an agent.
|
||||
*
|
||||
* @param int $id_agent Agent id
|
||||
*
|
||||
* @return array An array with all combined alerts defined for an agent.
|
||||
*/
|
||||
function get_agent_alerts_combined ($id_agent, $filter = false) {
|
||||
switch ($filter) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disable = 0';
|
||||
break;
|
||||
case "fired":
|
||||
$filter = ' AND times_fired > 0 AND disable = 0';
|
||||
break;
|
||||
case "disabled":
|
||||
$filter = ' AND disable = 1';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
$sql = sprintf ("SELECT * FROM talerta_agente_modulo WHERE id_agent = %d%s", $id_agent, $filter);
|
||||
$alerts = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($alerts === false)
|
||||
return array ();
|
||||
return $alerts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the alerts of an agent, simple and combined.
|
||||
*
|
||||
* @param int $id_agent Agent id
|
||||
*
|
||||
* @return array An array with all alerts defined for an agent.
|
||||
*/
|
||||
function get_agent_alerts ($id_agent, $filter = false) {
|
||||
$simple_alerts = get_agent_alerts_simple ($id_agent, $filter);
|
||||
$combined_alerts = get_agent_alerts_combined ($id_agent, $filter);
|
||||
|
||||
return array_merge ($simple_alerts, $combined_alerts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of the reports the user can view.
|
||||
*
|
||||
|
@ -2273,7 +2192,7 @@ function get_server_info ($id_server = -1) {
|
|||
}
|
||||
|
||||
//Push the raw data on the return stack
|
||||
$return[$server["id_server"]] = $server;
|
||||
$return[$server["id_server"]] = $server;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
@ -2520,4 +2439,4 @@ function process_sql_update ($table, $values) {
|
|||
|
||||
return process_sql ($query);
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require_once ("include/functions_agents.php");
|
||||
|
||||
/**
|
||||
* Get SLA of a module.
|
||||
*
|
||||
|
@ -111,7 +113,7 @@ function get_agent_module_sla ($id_agent_module, $period, $min_value, $max_value
|
|||
/**
|
||||
* Get general stats info on a group
|
||||
*
|
||||
* @param int $id_group
|
||||
* @param int Group Id to get info.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@ -125,10 +127,13 @@ function get_group_stats ($id_group) {
|
|||
|
||||
//Select all modules in group
|
||||
$sql = sprintf ("SELECT tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval, tagente_estado.utimestamp,
|
||||
tagente_estado.id_agente_modulo, tagente_modulo.id_tipo_modulo FROM tagente, tagente_estado, tagente_modulo
|
||||
tagente_estado.id_agente_modulo, tagente_modulo.id_tipo_modulo
|
||||
FROM tagente, tagente_estado, tagente_modulo
|
||||
WHERE tagente.disabled = 0 AND tagente.id_grupo IN (%s)
|
||||
AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0", implode (",",$groups));
|
||||
AND tagente.id_agente = tagente_estado.id_agente
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0",
|
||||
implode (",",$groups));
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($result === false)
|
||||
|
@ -152,7 +157,6 @@ function get_group_stats ($id_group) {
|
|||
$data["data_alerts_fired"] = 0;
|
||||
$data["data_alerts_fire_count"] = 0;
|
||||
|
||||
|
||||
$cur_time = get_system_time ();
|
||||
|
||||
foreach ($result as $row) {
|
||||
|
|
|
@ -220,4 +220,75 @@ function print_agent_name ($id_agent, $return = false, $cutoff = 0) {
|
|||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a row from the alert table and returns an array usable in the table function
|
||||
*
|
||||
* @param array A valid (non empty) row from the alert table
|
||||
* @param bool Whether or not this is a combined alert
|
||||
* @param bool Whether to print the agent information with the module information
|
||||
* @param string Tab where the function was called from (used for urls)
|
||||
*
|
||||
* @return array A formatted array with proper html for use in $table->data (6 columns)
|
||||
*/
|
||||
function format_alert_row ($alert, $combined = false, $agent = true, $url = '') {
|
||||
require_once ("include/functions_alerts.php");
|
||||
|
||||
if (empty ($alert))
|
||||
return array ("", "", "", "", "", "", "");
|
||||
|
||||
// Get agent id
|
||||
$id_agente = get_agentmodule_agent ($alert["id_agent_module"]);
|
||||
$template = get_alert_template ($alert['id_alert_template']);
|
||||
|
||||
$data = array ();
|
||||
|
||||
// Force alert execution
|
||||
$data[0] = '';
|
||||
if (! $combined) {
|
||||
if ($alert["force_execution"] == 0) {
|
||||
$data[0] = '<a href="'.$url.'&id_alert='.$alert["id"].'&force_execution=1&refr=60"><img src="images/target.png" ></a>';
|
||||
} else {
|
||||
$data[0] = '<a href="'.$url.'&id_alert='.$alert["id"].'&refr=60"><img src="images/refresh.png" /></a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($combined == 1) {
|
||||
$data[1] = print_agent_name ($id_agente, true, 20);
|
||||
} elseif ($agent == 0) {
|
||||
$data[1] = mb_substr (get_agentmodule_name ($alert["id_agent_module"]), 0, 20);
|
||||
} else {
|
||||
$data[1] = print_agent_name (get_agentmodule_agent ($alert["id_agent_module"]), true, 20);
|
||||
}
|
||||
|
||||
$data[2] = '<span class="left">';
|
||||
$data[2] .= mb_substr (safe_input ($template["description"]), 0, 35);
|
||||
$data[2] .= '</span> <span class="right">';
|
||||
$data[2] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
|
||||
$data[2] .= '<img src="images/zoom.png" />';
|
||||
$data[2] .= '</a></span>';
|
||||
|
||||
$data[3] = print_timestamp ($alert["last_fired"], true);
|
||||
|
||||
$options = array ();
|
||||
$options["height"] = 9;
|
||||
$options["width"] = 20;
|
||||
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$options["src"] = "images/pixel_red.png";
|
||||
$options["title"] = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
||||
} elseif ($alert["disabled"] > 0) {
|
||||
$options["src"] = "images/pixel_gray.png";
|
||||
$options["title"] = __('Alert disabled');
|
||||
} else {
|
||||
$options["src"] = "images/pixel_green.png";
|
||||
$options["title"] = __('Alert not fired');
|
||||
}
|
||||
|
||||
$data[4] = print_image ($options["src"], true, $options);
|
||||
|
||||
$data[5] = print_checkbox ("validate[]", $alert["id"], false, true);
|
||||
|
||||
return $data;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
top:-25px;
|
||||
left:155px;
|
||||
width:130px;
|
||||
z-index:1;
|
||||
z-index:5;
|
||||
background: #E9F3D2 url(../../images/arrow.png) no-repeat scroll 6px 4px;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
@ -171,4 +171,4 @@
|
|||
#god-agents.selected, #god-modules.selected, #god-alerts.selected, #god-dbmaint.selected, #god-users.selected, #god-reporting.selected, #god-profiles.selected, #god-servers.selected, #god-audit.selected, #god-setup.selected, #god-snmpc.selected, #god-extensions.selected
|
||||
{
|
||||
background-color: #efefbd;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,6 @@
|
|||
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
|
||||
// Pandora FMS uses Pear Image::Graph code
|
||||
|
||||
$build_version="PC090106";
|
||||
$pandora_version="v2.1-dev";
|
||||
global $build_version;
|
||||
global $pandora_version;
|
||||
|
||||
//Set character encoding to UTF-8 - fixes a lot of multibyte character headaches
|
||||
if (function_exists (mb_internal_encoding)) {
|
||||
mb_internal_encoding ("UTF-8");
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
require_once ("include/functions_agents.php");
|
||||
|
||||
$filter = get_parameter_get ("filter", "all");
|
||||
$offset = (int) get_parameter_get ("offset", 0);
|
||||
$id_group = (int) get_parameter ("ag_group", 1); //1 is the All group (selects all groups)
|
||||
|
@ -33,6 +32,13 @@ $sec = safe_url_extraclean ($sec);
|
|||
|
||||
$url = 'index.php?sec='.$sec.'&sec2='.$sec2.'&refr='.$config["refr"].'&filter='.$filter.'&ag_group='.$id_group;
|
||||
|
||||
// Force alert execution
|
||||
$flag_alert = (bool) get_parameter ('force_execution');
|
||||
if ($flag_alert == 1 && give_acl ($config['id_user'], $id_grupo, "AW")) {
|
||||
require_once ("include/functions_alerts.php");
|
||||
$id_alert = (int) get_parameter ('id_alert');
|
||||
set_alerts_agent_module_force_execution ($id_alert);
|
||||
}
|
||||
|
||||
// Show alerts for specific agent
|
||||
if (isset ($_GET["id_agente"])) {
|
||||
|
@ -49,7 +55,7 @@ if (isset ($_GET["id_agente"])) {
|
|||
|
||||
$alerts_simple = get_agent_alerts_simple ($id_agent, $filter);
|
||||
$alerts_combined = get_agent_alerts_combined ($id_agent, $filter);
|
||||
$print_agent = 0;
|
||||
$print_agent = false;
|
||||
} else {
|
||||
if (give_acl ($config["id_user"], $id_group, "AR") == 0) {
|
||||
audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to access alert view");
|
||||
|
@ -70,122 +76,134 @@ if (isset ($_GET["id_agente"])) {
|
|||
$alerts_combined = array_merge ($alerts_combined, $combined);
|
||||
}
|
||||
|
||||
$print_agent = 1;
|
||||
$print_agent = true;
|
||||
}
|
||||
|
||||
$tab = get_parameter_get ("tab");
|
||||
if ($tab != '') {
|
||||
echo "<h2>".__('Pandora Agents')." > ".__('Full list of Alerts')."</h2>";
|
||||
$url = $url.'&tab='.$tab;
|
||||
} else {
|
||||
echo "<h3>".__('Full list of alerts').'</h3>';
|
||||
}
|
||||
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
if (isset ($_POST["alert_validate"])) {
|
||||
echo "<h3>".__('Alerts').'</h3>';
|
||||
|
||||
if (get_parameter ('alert_validate')) {
|
||||
$validate = get_parameter_post ("validate", array ());
|
||||
$result = process_alerts_validate ($validate);
|
||||
print_error_message ($result, __('Alert(s) validated'), __('Error processing alert(s)'));
|
||||
}
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
|
||||
if ($print_agent == 1) {
|
||||
echo '<table cellpadding="4" cellspacing="4" class="databox">';
|
||||
echo '<tr><td>'.__('Group').'</td><td valign="middle">';
|
||||
if ($print_agent) {
|
||||
$table->width = '90%';
|
||||
$table->data = array ();
|
||||
$table->style = array ();
|
||||
|
||||
//Select box
|
||||
$fields = get_user_groups ($config["id_user"]);
|
||||
print_select ($fields, "ag_group", $id_group, 'javascript:this.form.submit();" class="w150','');
|
||||
$table->data[0][0] = __('Group');
|
||||
$table->data[0][1] = print_select (get_user_groups (), "ag_group", $id_group,
|
||||
'javascript:this.form.submit();', '', '', true);
|
||||
|
||||
//And submit button
|
||||
echo '</td><td valign="middle"><noscript><input name="uptbutton" type="submit" class="sub" value="'.__('Show').'"></noscript></td>';
|
||||
$table->data[0][2] = '<a href="'.$url.'&filter=fired"><img src="images/pixel_red.png" width="18" height="18" title="'.__('Click to filter').'">'.__('Alert fired').'</a>';
|
||||
$table->data[0][3] = '<a href="'.$url.'&filter=notfired"><img src="images/pixel_green.png" width="18" height="18" title="'.__('Click to filter').'">'.__('Alert not fired').'</a>';
|
||||
$table->data[0][4] = '<a href="'.$url.'&filter=disabled"><img src="images/pixel_gray.png" width="18" height="18" title="'.__('Click to filter').'">'.__('Alert disabled').'</a>';
|
||||
|
||||
//And finish the table here
|
||||
echo '<td class="f9" style="padding-left:30px;'.($filter == "fired" ? ' font-weight: bold;' : '').'"><a href="'.$url.'&filter=fired"><img src="images/pixel_red.png" width="18" height="18" title="'.__('Click to filter').'"></a> '.__('Alert fired').'</td>';
|
||||
echo '<td class="f9" style="padding-left:30px;'.($filter == "notfired" ? ' font-weight: bold;' : '').'"><a href="'.$url.'&filter=notfired"><img src="images/pixel_green.png" width="18" height="18" title="'.__('Click to filter').'"></a> '.__('Alert not fired').'</td>';
|
||||
echo '<td class="f9" style="padding-left:30px;'.($filter == "disabled" ? ' font-weight: bold;' : '').'"><a href="'.$url.'&filter=disabled"><img src="images/pixel_gray.png" width="18" height="18" title="'.__('Click to filter').'"></a> '.__('Alert disabled').'</td></tr></table>';
|
||||
switch ($filter) {
|
||||
case 'fired':
|
||||
$table->style[2] = 'font-weight: bold';
|
||||
|
||||
break;
|
||||
case 'notfired':
|
||||
$table->style[3] = 'font-weight: bold';
|
||||
|
||||
break;
|
||||
case 'disabled':
|
||||
$table->style[4] = 'font-weight: bold';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
print_table ($table);
|
||||
}
|
||||
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = 750;
|
||||
$table->border = 0;
|
||||
$table->width = '90%';
|
||||
$table->class = "databox";
|
||||
|
||||
$table->head = array ();
|
||||
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = __('Type');
|
||||
$table->head[2] = ''; //Placeholder for name
|
||||
$table->head[3] = __('Description');
|
||||
$table->head[4] = __('Info');
|
||||
$table->head[5] = __('Min.').'/'.__('Max.');
|
||||
$table->head[6] = __('Last fired');
|
||||
$table->head[7] = __('Status');
|
||||
$table->head[8] = __('Validate') . pandora_help('alert_validation', true);
|
||||
$table->align = array ();
|
||||
$table->align[0] = "center";
|
||||
$table->align[1] = "center";
|
||||
$table->align[4] = "center";
|
||||
$table->align[5] = "center";
|
||||
$table->align[6] = "center";
|
||||
$table->align[7] = "center";
|
||||
$table->align[8] = "center";
|
||||
|
||||
$table->head[1] = ''; //Placeholder for name
|
||||
$table->head[2] = __('Template');
|
||||
$table->head[3] = __('Last fired');
|
||||
$table->head[4] = __('Status');
|
||||
$table->head[5] = __('Validate').pandora_help ('alert_validation', true);
|
||||
$table->title = __('Single alerts');
|
||||
if ($print_agent == 0) {
|
||||
$table->head[2] = __('Module name');
|
||||
} else {
|
||||
$table->head[2] = __('Agent name');
|
||||
}
|
||||
|
||||
if ($print_agent == 0) {
|
||||
$table->head[1] = __('Module');
|
||||
} else {
|
||||
$table->head[1] = __('Agent');
|
||||
}
|
||||
$table->align = array ();
|
||||
$table->align[4] = 'center';
|
||||
$table->align[5] = 'center';
|
||||
$table->data = array ();
|
||||
|
||||
$counter[0] = 0; //Dual counter. This one counts the total number of alerts
|
||||
$counter[1] = 0; //Dual counter. This one counts only the printed alerts
|
||||
$total = 0;
|
||||
$printed = 0;
|
||||
foreach ($alerts_simple as $alert) {
|
||||
$counter[0]++;
|
||||
if (empty ($alert) || $counter[1] >= $config["block_size"] || $counter[0] <= $offset) {
|
||||
$total++;
|
||||
if (empty ($alert) || $printed >= $config["block_size"] || $total <= $offset) {
|
||||
continue;
|
||||
}
|
||||
$counter[1]++;
|
||||
array_push ($table->data, format_alert_row ($alert, 0, $print_agent, 'alert'));
|
||||
$printed++;
|
||||
array_push ($table->data, format_alert_row ($alert, 0, $print_agent, $url));
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
pagination ($counter[0], $url, $offset);
|
||||
pagination ($total, $url, $offset);
|
||||
print_table ($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.__('No simple alerts found').'</div>';
|
||||
}
|
||||
|
||||
$table->title = __('Combined alerts');
|
||||
$table->head[1] = __('Agent name');
|
||||
$table->head[1] = __('Agent');
|
||||
$table->data = array ();
|
||||
|
||||
$counter[2] = 0;
|
||||
$counter[3] = 0;
|
||||
$combined_total = 0;
|
||||
$combined_printed = 0;
|
||||
foreach ($alerts_combined as $alert) {
|
||||
$counter[2]++;
|
||||
if (empty ($alert) || $counter[3] >= $config["block_size"] || $counter[2] <= $offset) {
|
||||
$combined_total++;
|
||||
if (empty ($alert) || $combined_printed >= $config["block_size"] || $combined_total <= $offset) {
|
||||
continue;
|
||||
}
|
||||
$counter[3]++;
|
||||
$combined_printed++;
|
||||
array_push ($table->data, format_alert_row ($alert, 1, $print_agent));
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
pagination ($counter[0], $url, $offset);
|
||||
pagination ($total, $url, $offset);
|
||||
print_table ($table);
|
||||
} else {
|
||||
echo '<div class="nf">'.__('No combined alerts found').'</div>';
|
||||
}
|
||||
|
||||
if ($counter[1] > 0 || $counter[2] > 0) {
|
||||
echo '<div style="text-align: right; width: 750px;">';
|
||||
if ($printed > 0 || $combined_total > 0) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.';">';
|
||||
print_submit_button (__('Validate'), 'alert_validate', false, 'class="sub upd"', false);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</form>';
|
||||
?>
|
||||
<link rel="stylesheet" href="include/styles/cluetip.css" type="text/css" />
|
||||
<script type="text/javascript" src="include/javascript/jquery.cluetip.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("a.template_details").cluetip ({
|
||||
arrows: true,
|
||||
attribute: 'href',
|
||||
cluetipClass: 'default',
|
||||
fx: { open: 'fadeIn', openSpeed: 'slow' },
|
||||
}).click (function () {
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -33,7 +33,7 @@ $group_id = get_parameter ("group_id", 0);
|
|||
$ag_group = get_parameter ("ag_group", $group_id);
|
||||
$ag_group = get_parameter_get ("ag_group_refresh", $ag_group); //if it isn't set, defaults to prev. value
|
||||
|
||||
$search = get_parameter ("search", "");
|
||||
$search = get_parameter ("search");
|
||||
|
||||
echo "<h2>".__('Pandora Agents')." > ".__('Summary')."</h2>";
|
||||
|
||||
|
@ -242,11 +242,11 @@ if ($agents !== false) {
|
|||
echo "<a href='index.php?sec=gagente&
|
||||
sec2=godmode/agentes/configurar_agente&
|
||||
id_agente=".$id_agente."'>
|
||||
<img src='images/setup.png' border=0 width=16></a>";
|
||||
<img src='images/setup.png' border=0 width=16></a> ";
|
||||
}
|
||||
echo " <a href='index.php?sec=estado&
|
||||
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>
|
||||
<b>".$nombre_agente."</b></a></td>";
|
||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'"><strong>';
|
||||
echo $nombre_agente;
|
||||
echo "</strong></a></td>";
|
||||
|
||||
// Show SO icon :)
|
||||
echo "<td class='$tdcolor' align='center'>";
|
||||
|
@ -267,7 +267,7 @@ if ($agents !== false) {
|
|||
//echo ' (<b>';
|
||||
//echo get_group_name ($id_grupo);
|
||||
//echo "</b>)";
|
||||
echo "</A>";
|
||||
echo "</a>";
|
||||
|
||||
|
||||
echo "<td class='$tdcolor'><b>".$numero_modulos." : ";
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
require ("include/config.php");
|
||||
|
||||
check_login ();
|
||||
|
||||
|
@ -43,22 +43,26 @@ function generate_dot ($simple = 0, $font_size) {
|
|||
$graph = open_graph ();
|
||||
|
||||
// Get agent data
|
||||
$agents = get_db_all_rows_sql ('SELECT id_grupo, nombre, id_os, id_parent, id_agente FROM tagente WHERE disabled = 0 ORDER BY id_grupo');
|
||||
if ($agents)
|
||||
foreach ($agents as $agent) {
|
||||
if (give_acl ($config["id_user"], $agent["id_grupo"], "AR") == 0)
|
||||
continue;
|
||||
// Save node parent information to define edges later
|
||||
if ($agent['id_parent'] != "0") {
|
||||
$parents[$agent['id_agente']] = $agent['id_parent'];
|
||||
} else {
|
||||
$orphans[$agent['id_agente']] = 1;
|
||||
}
|
||||
$agents = get_db_all_rows_sql ('SELECT id_grupo, nombre, id_os, id_parent, id_agente
|
||||
FROM tagente
|
||||
WHERE disabled = 0
|
||||
ORDER BY id_grupo');
|
||||
if ($agents){
|
||||
foreach ($agents as $agent) {
|
||||
if (give_acl ($config["id_user"], $agent["id_grupo"], "AR") == 0)
|
||||
continue;
|
||||
// Save node parent information to define edges later
|
||||
if ($agent['id_parent'] != "0") {
|
||||
$parents[$agent['id_agente']] = $agent['id_parent'];
|
||||
} else {
|
||||
$orphans[$agent['id_agente']] = 1;
|
||||
}
|
||||
|
||||
// Add node
|
||||
$graph .= create_node ($agent , $simple, $font_size)."\n\t\t";
|
||||
// Add node
|
||||
$graph .= create_node ($agent , $simple, $font_size)."\n\t\t";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create a central node if orphan nodes exist
|
||||
if (count ($orphans)) {
|
||||
$graph .= create_pandora_node ($pandora_name, $font_size);
|
||||
|
@ -94,7 +98,8 @@ function create_node ($agent, $simple = 0, $font_size = 10) {
|
|||
AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
|
||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.estado = 1', $agent['id_agente']);
|
||||
AND tagente_estado.estado = 1',
|
||||
$agent['id_agente']);
|
||||
$bad_modules = get_db_sql ($sql);
|
||||
|
||||
// Set node status
|
||||
|
@ -105,7 +110,15 @@ function create_node ($agent, $simple = 0, $font_size = 10) {
|
|||
}
|
||||
|
||||
// Check for alert
|
||||
$sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam) from talerta_agente_modulo, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.times_fired > 0 ', $agent['id_agente']);
|
||||
$sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam)
|
||||
FROM talerta_agente_modulo, tagente_modulo, tagente
|
||||
WHERE tagente.id_agente = %d
|
||||
AND tagente.disabled = 0
|
||||
AND tagente.id_agente = tagente_modulo.id_agente
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo
|
||||
AND talerta_agente_modulo.times_fired > 0 ',
|
||||
$agent['id_agente']);
|
||||
$alert_modules = get_db_sql ($sql);
|
||||
if ($alert_modules)
|
||||
$status_color = '#FFE308';
|
||||
|
@ -151,7 +164,7 @@ function create_pandora_node ($name, $font_size = 10) {
|
|||
|
||||
// Opens a group definition
|
||||
function open_group ($id) {
|
||||
$img = 'images/' . dame_grupo_icono($id) . '.png';
|
||||
$img = 'images/'.dame_grupo_icono ($id).'.png';
|
||||
$name = get_group_name ($id);
|
||||
|
||||
$group = 'subgraph cluster_' . $id .
|
||||
|
@ -160,7 +173,7 @@ function open_group ($id) {
|
|||
</TABLE>>; tooltip="'.$name.'";
|
||||
URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='
|
||||
. $id . '";';
|
||||
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
|
@ -180,27 +193,19 @@ function open_graph () {
|
|||
if ($layout == 'radial')
|
||||
$overlap = 'true';
|
||||
|
||||
if (($layout == 'flat') OR ($layout == 'radial') OR ($layout == 'spring1') OR ($layout == "spring2"))
|
||||
if ($layout == 'flat' || $layout == 'radial' || $layout == 'spring1' || $layout == "spring2")
|
||||
if ($nooverlap != '')
|
||||
$overlap = 'scalexy';
|
||||
|
||||
|
||||
if ($pure == 1 && $zoom > 1 ) {
|
||||
$size_x *= $zoom;
|
||||
$size_y *= $zoom;
|
||||
}
|
||||
$size = $size_x . ',' . $size_y;
|
||||
//
|
||||
/*
|
||||
echo "SIZE $size <br>";
|
||||
echo "NO OVERLAP $nooverlap <br>";
|
||||
echo "LAYOUT $layout <br>";
|
||||
echo "FONTSIZE $font_size <br>";
|
||||
echo "RANKSEP $ranksep <br>";
|
||||
*/
|
||||
|
||||
// BEWARE: graphwiz DONT use single ('), you need double (")
|
||||
$head = "graph networkmap { labeljust=l; margin=0; ";
|
||||
if ($nooverlap != ''){
|
||||
if ($nooverlap != '') {
|
||||
$head .= "overlap=\"$overlap\";";
|
||||
$head .= "ranksep=\"$ranksep\";";
|
||||
$head .= "outputorder=edgesfirst;";
|
||||
|
@ -208,6 +213,7 @@ echo "RANKSEP $ranksep <br>";
|
|||
$head .= "ratio=fill;";
|
||||
$head .= "root=0;";
|
||||
$head .= "size=\"$size\";";
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
@ -217,7 +223,7 @@ function close_graph () {
|
|||
}
|
||||
|
||||
// Returns the filter used to achieve the desired layout
|
||||
function set_filter () {
|
||||
function set_filter () {
|
||||
global $layout;
|
||||
|
||||
switch($layout) {
|
||||
|
@ -263,7 +269,7 @@ $layout_array = array (
|
|||
'spring2' => 'spring 2',
|
||||
'flat' => 'flat');
|
||||
|
||||
echo '<form name="input" action="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=' . $pure . '" method="post">';
|
||||
echo '<form name="input" action="index.php?sec=estado&sec2=operation/agentes/networkmap&pure='.$pure.'" method="post">';
|
||||
echo '<table cellpadding="4" cellspacing="4" class="databox">';
|
||||
echo '<tr>';
|
||||
echo '<td valign="top">' . __('Layout') . ' ';
|
||||
|
@ -318,7 +324,7 @@ echo '</td></tr>';
|
|||
echo '</table></form>';
|
||||
|
||||
// Set filter
|
||||
$filter = set_filter();
|
||||
$filter = set_filter ();
|
||||
|
||||
// Generate dot file
|
||||
$graph = generate_dot ($simple, $font_size);
|
||||
|
@ -328,12 +334,12 @@ $graph = generate_dot ($simple, $font_size);
|
|||
$filename_map = $config["attachment_store"]."/networkmap_".$layout;
|
||||
$filename_img = "attachment/networkmap_".$layout."_".$font_size;
|
||||
$filename_dot = $config["attachment_store"]."/networkmap_".$layout;
|
||||
if($simple) {
|
||||
if ($simple) {
|
||||
$filename_map .= "_simple";
|
||||
$filename_img .= "_simple";
|
||||
$filename_dot .= "_simple";
|
||||
}
|
||||
if($nooverlap) {
|
||||
if ($nooverlap) {
|
||||
$filename_map .= "_nooverlap";
|
||||
$filename_img .= "_nooverlap";
|
||||
$filename_dot .= "_nooverlap";
|
||||
|
@ -345,7 +351,7 @@ $filename_dot .= ".dot";
|
|||
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
|
||||
$result = true;
|
||||
} else {
|
||||
$fh = fopen($filename_dot, 'w');
|
||||
$fh = fopen ($filename_dot, 'w');
|
||||
if ($fh === false) {
|
||||
$result = false;
|
||||
break;
|
||||
|
@ -367,13 +373,14 @@ if ($result !== false) {
|
|||
return;
|
||||
}
|
||||
echo '<img src="'.$filename_img.'" usemap="#networkmap" />';
|
||||
include $filename_map;
|
||||
include ($filename_map);
|
||||
} else {
|
||||
echo '<h2 class="err">'.__('Map could not be generated').'</h2>';
|
||||
echo $result;
|
||||
echo "<br /> Apparently something went wrong executing the command.";
|
||||
echo "<br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver?";
|
||||
echo "<br /> Is your webserver restricted from executing command line tools through the system() call (PHP Safe Mode or SELinux)";
|
||||
echo "<br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
|
||||
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -161,13 +161,6 @@ if (isset($_GET["flag_agent"])){
|
|||
process_sql ($sql);
|
||||
}
|
||||
}
|
||||
// Force alert execution
|
||||
$flag_alert = (int) get_parameter ('flag_alert', 0);
|
||||
$id_agente_modulo = (int) get_parameter ('id_agente_modulo', 0);
|
||||
if ($flag_alert == 1 && give_acl ($config['id_user'], $id_grupo, "AW")) {
|
||||
$sql = "UPDATE talerta_agente_modulo SET flag = 1 WHERE id_agente_modulo = " . $id_agente_modulo;
|
||||
process_sql ($sql);
|
||||
}
|
||||
|
||||
echo "<div id='menu_tab_frame_view'>";
|
||||
echo "<div id='menu_tab_left'><ul class='mn'><li class='view'>
|
||||
|
@ -197,7 +190,7 @@ echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=
|
|||
echo "</li>";
|
||||
|
||||
// Data
|
||||
if (($tab == "data") OR ($tab == "data_view")){
|
||||
if (($tab == "data") OR ($tab == "data_view")) {
|
||||
echo "<li class='nomn_high'>";
|
||||
} else {
|
||||
echo "<li class='nomn'>";
|
||||
|
@ -230,7 +223,6 @@ echo "<img src='images/god4.png' class='top' border=0> ";
|
|||
echo __("Group");
|
||||
echo "</a></li>";
|
||||
|
||||
|
||||
// Inventory
|
||||
enterprise_hook ('inventory_tab');
|
||||
|
||||
|
@ -241,27 +233,27 @@ echo "<div style='height: 25px'> </div>";
|
|||
|
||||
switch ($tab) {
|
||||
case "sla":
|
||||
require "sla_view.php";
|
||||
require ("sla_view.php");
|
||||
break;
|
||||
case "manage":
|
||||
require "estado_generalagente.php";
|
||||
require ("estado_generalagente.php");
|
||||
break;
|
||||
case "main":
|
||||
require "estado_generalagente.php";
|
||||
require "estado_monitores.php";
|
||||
require "estado_alertas.php";
|
||||
require "status_events.php";
|
||||
require ("estado_generalagente.php");
|
||||
require ("estado_monitores.php");
|
||||
require ("alerts_status.php");
|
||||
require ("status_events.php");
|
||||
break;
|
||||
case "data_view":
|
||||
require "datos_agente.php";
|
||||
require ("datos_agente.php");
|
||||
break;
|
||||
case "data":
|
||||
require "estado_ultimopaquete.php";
|
||||
case "data":
|
||||
require ("estado_ultimopaquete.php");
|
||||
break;
|
||||
case "alert":
|
||||
require "estado_alertas.php";
|
||||
case "alert":
|
||||
require ("alerts_status.php");
|
||||
break;
|
||||
case "inventory":
|
||||
case "inventory":
|
||||
enterprise_include ('operation/agentes/agent_inventory.php');
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ if (give_acl ($config['id_user'], 0, "AR")) {
|
|||
$sub["operation/agentes/estado_agente"]["text"] = __('Agent detail');
|
||||
$sub["operation/agentes/estado_agente"]["refr"] = 60;
|
||||
|
||||
$sub["operation/agentes/estado_alertas"]["text"] = __('Alert detail');
|
||||
$sub["operation/agentes/estado_alertas"]["refr"] = 60;
|
||||
$sub["operation/agentes/alerts_status"]["text"] = __('Alert detail');
|
||||
$sub["operation/agentes/alerts_status"]["refr"] = 60;
|
||||
|
||||
$sub["operation/agentes/status_monitor"]["text"] = __('Monitor detail');
|
||||
$sub["operation/agentes/status_monitor"]["refr"] = 60;
|
||||
|
|
|
@ -235,7 +235,6 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
|
|||
`min_value` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`module_type` int(10) unsigned NOT NULL default '0',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`alert_text` varchar(255) default '',
|
||||
`time_from` time default '00:00:00',
|
||||
|
@ -291,46 +290,6 @@ CREATE TABLE IF NOT EXISTS `tcompound_alert` (
|
|||
PRIMARY KEY (`id`, `id_aam`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `talerta_agente_modulo` (
|
||||
`id_aam` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agente_modulo` int(10) unsigned NOT NULL default '0',
|
||||
`id_alerta` int(10) unsigned NOT NULL default '0',
|
||||
`al_campo1` varchar(255) default '',
|
||||
`al_campo2` varchar(255) default '',
|
||||
`al_campo3` mediumtext NOT NULL,
|
||||
`descripcion` varchar(255) default '',
|
||||
`dis_max` double(18,2) default NULL,
|
||||
`dis_min` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`last_fired` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`times_fired` int(3) NOT NULL default '0',
|
||||
`module_type` int(10) unsigned NOT NULL default '0',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`internal_counter` int(4) default '0',
|
||||
`alert_text` varchar(255) default '',
|
||||
`disable` tinyint(3) default '0',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`id_agent` int(10) default NULL,
|
||||
`monday` tinyint(1) default '1',
|
||||
`tuesday` tinyint(1) default '1',
|
||||
`wednesday` tinyint(1) default '1',
|
||||
`thursday` tinyint(1) default '1',
|
||||
`friday` tinyint(1) default '1',
|
||||
`saturday` tinyint(1) default '1',
|
||||
`sunday` tinyint(1) default '1',
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`al_f2_recovery` varchar(255) NOT NULL default '',
|
||||
`al_f3_recovery` mediumtext NOT NULL,
|
||||
`flag` tinyint(1) unsigned default '0',
|
||||
PRIMARY KEY (`id_aam`),
|
||||
KEY `id_agente_modulo` (`id_agente_modulo`),
|
||||
KEY `disable` (`disable`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- Priority : 0 - Maintance (grey)
|
||||
-- Priority : 1 - Low (green)
|
||||
-- Priority : 2 - Normal (blue)
|
||||
|
|
|
@ -13,21 +13,13 @@ NULL DEFAULT '0', ADD `last_status` TINYINT( 4 ) NOT NULL DEFAULT
|
|||
ALTER TABLE `tagente_estado` ADD INDEX ( `current_interval` );
|
||||
ALTER TABLE `tagente_estado` ADD INDEX ( `running_by` );
|
||||
ALTER TABLE `tagente_estado` ADD INDEX ( `last_execution_try` );
|
||||
ALTER TABLE `tagente_modulo` ADD `history_data` TINYINT( 1 )
|
||||
UNSIGNED NOT NULL DEFAULT '1', ADD `min_warning` DOUBLE( 18, 2 ) NOT
|
||||
NULL DEFAULT '0', ADD `max_warning` DOUBLE( 18, 2 ) NOT NULL
|
||||
DEFAULT '0', ADD `min_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT
|
||||
'0', ADD `max_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT '0', ADD
|
||||
`min_ff_event` INT( 4 ) UNSIGNED NOT NULL DEFAULT '0', ADD
|
||||
`delete_pending` INT( 1 ) UNSIGNED NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `tagente_modulo` ADD `min_warning` double(18,2) default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD `max_warning` double(18,2) default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD `min_critical` double(18,2) default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD `max_critical` double(18,2) default 0;
|
||||
ALTER TABLE `tagente_modulo` ADD `min_ff_event` int(4) unsigned default '0';
|
||||
ALTER TABLE tagente_modulo ADD `delete_pending` int(1) unsigned default 0;
|
||||
|
||||
ALTER TABLE `tagente_modulo` ADD `delete_pending` int(1) unsigned default 0;
|
||||
|
||||
ALTER TABLE `tagente_modulo` DROP INDEX `tam_plugin`;
|
||||
ALTER TABLE `tagente_modulo` DROP PRIMARY KEY , ADD PRIMARY KEY
|
||||
|
@ -60,7 +52,7 @@ CREATE TABLE IF NOT EXISTS `talert_actions` (
|
|||
CREATE TABLE IF NOT EXISTS `talert_templates` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) default '',
|
||||
`description` mediumtext default '',
|
||||
`description` mediumtext,
|
||||
`id_alert_action` int(10) unsigned NULL,
|
||||
`field1` varchar(255) default '',
|
||||
`field2` varchar(255) default '',
|
||||
|
@ -102,8 +94,7 @@ CREATE TABLE IF NOT EXISTS `talert_template_modules` (
|
|||
`priority` tinyint(4) default '0',
|
||||
`force_execution` tinyint(1) default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent_module`) REFERENCES
|
||||
tagente_modulo(`id_agente_modulo`)
|
||||
FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
|
@ -122,6 +113,8 @@ talert_template_modules(`id`)
|
|||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE tagente ADD `custom_id` varchar(255) default '';
|
||||
|
||||
-- If you have custom stuff here, please make sure you manually
|
||||
-- migrate it.
|
||||
|
||||
|
|
Loading…
Reference in New Issue