$alert['id_agent_module']));
if ($module_group == $module['id_module_group']) {
if ($alert["times_fired"] > 0) {
$data = true;
echo '' . __('Number fired of alerts').': ' . $alert["times_fired"] . '
';
$agent = db_get_row('tagente', 'id_agente', $module['id_agente']);
echo '' . __('Agent').': ';
echo io_safe_output($agent['nombre']) . '
';
echo '' . __('Module') . ': ';
echo io_safe_output($module['nombre']) . '
';
$template = db_get_row('talert_templates', 'id' , $alert['id_alert_template']);
echo '' . __('Alert template') . ': ';
echo io_safe_output($template['name']) . '
';
// This prevent from templates without predefined actions
if (empty($template['id_alert_action']))
$template_id_alert_action = "''";
else
$template_id_alert_action = $template['id_alert_action'];
// True if the alert only has the default template action
$default_action = false;
// Try to get actions for the current alert
$sql = 'SELECT t2.name
FROM talert_template_module_actions AS t1
INNER JOIN talert_actions AS t2
INNER JOIN talert_template_modules AS t3
ON t3.id = t1.id_alert_template_module
AND t1.id_alert_action = t2.id
WHERE (t3.id_alert_template = ' . $template['id'] . ' AND
t3.id_agent_module = ' . $module['id_agente_modulo'] . ');';
$actions = db_get_all_rows_sql($sql);
// If this alert doesn't have actions try to get default action from template
if ($actions === false) {
$sql = 'SELECT name
FROM talert_actions
WHERE (id = ' . $template_id_alert_action . ');';
$default_action = true;
$actions = db_get_all_rows_sql($sql);
}
if ($actions === false) {
$actions = array();
}
echo '' . __('Actions') . ': ' . '
';
echo '
" . __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") . "
"; $agentGroups = users_get_groups ($config['id_user'], "AR", false); $modelGroups = users_get_all_model_groups(); if (!empty($agentGroups) && !empty($modelGroups)) { array_walk($modelGroups, 'translate'); //Translate all head titles to language is set foreach ($modelGroups as $i => $n) { $modelGroups[$i] = ui_print_truncate_text($n, GENERIC_SIZE_TEXT); } $head = $modelGroups; array_unshift($head, ' '); //Metaobject use in html_print_table $table = null; $table->align[0] = 'left'; //Align to right the first column. $table->style[0] = 'color: #ffffff; '. 'background-color: #373737; font-weight: bolder; padding-right: 10px;'; $table->head = $head; $table->width = '100%'; //The content of table $tableData = array(); //Create rows and cells foreach ($agentGroups as $idAgentGroup => $name) { $fired = false; $row = array(); array_push($row, ui_print_truncate_text($name, GENERIC_SIZE_TEXT, true, true, true, '…', 'color:#FFF')); foreach ($modelGroups as $idModelGroup => $modelGroup) { $fired = false; $query = sprintf($sql, $idAgentGroup, $idModelGroup); $rowsDB = db_get_all_rows_sql ($query); $agents = agents_get_group_agents($idAgentGroup); if (!empty($agents)) { $alerts = agents_get_alerts_simple(array_keys($agents)); foreach ($alerts as $alert) { $module = db_get_row_filter('tagente_modulo', array('id_agente_modulo' => $alert['id_agent_module'])); if ($idModelGroup == $module['id_module_group']) { if ($alert["times_fired"] > 0) { $fired = true; } } } } $states = array(); if ($rowsDB !== false) { foreach ($rowsDB as $rowDB) { $states[$rowDB['estado']] = $rowDB['count']; } } $count = 0; foreach ($states as $idState => $state) { $count += $state; } $color = 'transparent'; //Defaut color for cell $font_color = '#000000'; //Default font color for cell if ($count == 0) { $color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules. $alinkStart = ''; $alinkEnd = ''; } else { if ($fired) { $color = '#FFA631'; //Orange when the cell for this model group and agent has at least one alert fired. } else if (array_key_exists(1, $states)) { $color = '#FC4444'; //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'; } elseif (array_key_exists(2, $states)) { $color = '#FAD403'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state. } elseif (array_key_exists(3, $states)) { $color = '#B2B2B2'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state. } elseif (array_key_exists(0, $states)) { $color = '#80BA27'; //Green when the cell for this model group and agent has OK state all modules. } elseif (array_key_exists(5, $states)) { $color = '#5BB6E5'; // Blue when the cell for this module group and all modules have not init value. } $alinkStart = ''; $alinkEnd = ''; } array_push($row, '" . __('Legend') . " | |
" . __("Orange cell when the module group and agent have at least one alarm fired.") . " | |
" . __("Red cell when the module group and agent have at least one module in critical status and the others in any status") . " | |
" . __("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") . " | |
" . __("Green cell when the module group and agent have all modules in OK status") . " | |
" . __("Grey cell when the module group and agent have at least one in unknown status and the others in green status") . " | |
" .__("Blue cell when the module group and agent have all modules in not init status.") . " |