2010-10-21 Miguel de Dios <miguel.dedios@artica.es>
* extensions/module_groups.php: show color for when the alert fired, and added cluetip for more details. Pending task: #3041855 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3458 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
79a86c4950
commit
c1c8dbcb15
|
@ -1,3 +1,10 @@
|
|||
2010-10-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* extensions/module_groups.php: show color for when the alert fired, and
|
||||
added cluetip for more details.
|
||||
|
||||
Pending task: #3041855
|
||||
|
||||
2010-10-25 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/pchart_graph.php, include/fgraph.php: Added baseline support
|
||||
|
|
|
@ -12,6 +12,63 @@
|
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
// Load global vars
|
||||
global $config;
|
||||
|
||||
if (is_ajax ()) {
|
||||
check_login ();
|
||||
|
||||
require_once('include/functions_agents.php');
|
||||
|
||||
$get_info_alert_module_group = (bool)get_parameter('get_info_alert_module_group');
|
||||
$module_group = (int)get_parameter('module_group');
|
||||
$id_agent_group = (int)get_parameter('id_agent_group');
|
||||
|
||||
if ($get_info_alert_module_group) {
|
||||
$agents = get_group_agents($id_agent_group);
|
||||
if (!empty($agents)) {
|
||||
$alerts = get_agent_alerts_simple($agents);
|
||||
|
||||
foreach ($alerts as $alert) {
|
||||
$module = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
|
||||
if ($module_group == $module['id_module_group']) {
|
||||
if ($alert["times_fired"] > 0) {
|
||||
echo '<strong>' . __('Number fired of alerts').': </strong> ' . $alert["times_fired"] . '<br />';
|
||||
$agent = get_db_row('tagente', 'id_agente', $module['id_agente']);
|
||||
echo '<strong>' . __('Agent').': </strong>';
|
||||
echo safe_output($agent['nombre']) . '<br />';
|
||||
echo '<strong>' . __('Module') . ': </strong>';
|
||||
echo safe_output($module['nombre']) . '<br />';
|
||||
$template = get_db_row('talert_templates', 'id' , $alert['id_alert_template']);
|
||||
echo '<strong>' . __('Alert template') . ': </strong>';
|
||||
echo safe_output($template['name']) . '<br />';
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM talert_template_module_actions AS t1
|
||||
INNER JOIN talert_actions AS t2 ON t1.id_alert_action = t2.id
|
||||
WHERE t1.id_alert_template_module = ' . $template['id'] . ' OR t2.id = ' . $template['id_alert_action'] . ';';
|
||||
|
||||
$actions = get_db_all_rows_sql($sql);
|
||||
if ($actions === false) {
|
||||
$actions = array();
|
||||
}
|
||||
|
||||
echo '<strong>' . __('Actions') . ': </strong>' . '<br />';
|
||||
echo '<ul style="margin-top: 0px; margin-left: 30px;">';
|
||||
foreach ($actions as $action) {
|
||||
echo '<li style="list-style: disc;">' . $action['name'] . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
if ($alert != end($alerts)) {
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate the array texts using gettext
|
||||
|
@ -61,7 +118,8 @@ function mainModuleGroups() {
|
|||
|
||||
//The content of table
|
||||
$tableData = array();
|
||||
//Create rows and celds
|
||||
|
||||
//Create rows and cells
|
||||
foreach ($agentGroups as $idAgentGroup => $name) {
|
||||
|
||||
$row = array();
|
||||
|
@ -72,6 +130,23 @@ function mainModuleGroups() {
|
|||
$query = sprintf($sql,$idAgentGroup, $idModelGroup);
|
||||
$rowsDB = get_db_all_rows_sql ($query);
|
||||
|
||||
|
||||
$agents = get_group_agents($idAgentGroup);
|
||||
if (!empty($agents)) {
|
||||
$alerts = get_agent_alerts_simple($agents);
|
||||
|
||||
foreach ($alerts as $alert) {
|
||||
$module = get_db_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module']));
|
||||
|
||||
if ($idModelGroup == $module['id_module_group']) {
|
||||
$fired = false;
|
||||
if ($alert["times_fired"] > 0) {
|
||||
$fired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$states = array();
|
||||
if ($rowsDB !== false) {
|
||||
foreach ($rowsDB as $rowDB) {
|
||||
|
@ -92,11 +167,11 @@ function mainModuleGroups() {
|
|||
$alinkEnd = '';
|
||||
}
|
||||
else {
|
||||
// TODO: ADD Alerts fired status
|
||||
/*if (array_key_exists(4,$states)) {
|
||||
|
||||
if ($fired) {
|
||||
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
|
||||
}*/
|
||||
if (array_key_exists(1,$states)) {
|
||||
}
|
||||
else if (array_key_exists(1,$states)) {
|
||||
$color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
|
||||
$font_color = '#ffffff';
|
||||
}
|
||||
|
@ -111,9 +186,9 @@ function mainModuleGroups() {
|
|||
}
|
||||
|
||||
|
||||
$alinkStart = '<a href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' . $idAgentGroup .
|
||||
'&modulegroup=' . $idModelGroup . '".
|
||||
style="color: ' . $font_color . '; font-size: 18px;";>';
|
||||
$alinkStart = '<a class="info_cell" rel="ajax.php?page=extensions/module_groups&get_info_alert_module_group=1&module_group=' . $idModelGroup . '&id_agent_group=' . $idAgentGroup . '"
|
||||
href="index.php?sec=estado&sec2=operation/agentes/status_monitor&status=-1&ag_group=' . $idAgentGroup .
|
||||
'&modulegroup=' . $idModelGroup . '" style="color: ' . $font_color . '; font-size: 18px;";>';
|
||||
$alinkEnd = '</a>';
|
||||
}
|
||||
|
||||
|
@ -133,6 +208,10 @@ function mainModuleGroups() {
|
|||
|
||||
echo "<p>" . __("The colours meaning:") .
|
||||
"<ul style='float: left;'>" .
|
||||
'<li style="clear: both;">
|
||||
<div style="float: left; background: #ffa300; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
||||
__("Orange cell when the module group and agent have at least one alarm fired.") .
|
||||
'</li>' .
|
||||
'<li style="clear: both;">
|
||||
<div style="float: left; background: #cc0000; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
||||
__("Red cell when the module group and agent have at least one module in critical status and the others in any status") .
|
||||
|
@ -151,6 +230,20 @@ function mainModuleGroups() {
|
|||
'</li>' .
|
||||
"</ul>" .
|
||||
"</p>";
|
||||
|
||||
require_css_file('cluetip');
|
||||
require_jquery_file('cluetip');
|
||||
?>
|
||||
<script>
|
||||
$(document).ready (function () {
|
||||
$("a.info_cell").cluetip ({
|
||||
arrows: true,
|
||||
attribute: 'rel',
|
||||
cluetipClass: 'default'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_operation_menu_option(__("Modules groups"), 'estado', 'module_groups/icon_menu.png');
|
||||
|
|
Loading…
Reference in New Issue