2009-08-28 18:52:10 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Pandora FMS- http://pandorafms.com
|
|
|
|
* ==================================================
|
2010-03-04 17:08:09 +01:00
|
|
|
* Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
2009-08-28 18:52:10 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* 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.
|
|
|
|
*/
|
2010-10-25 17:49:56 +02:00
|
|
|
// 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
|
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
|
|
|
WHERE t1.id_alert_template_module = ' . $template['id'] . '
|
|
|
|
OR t2.id = ' . $template['id_alert_action'] . ';';
|
2010-10-25 17:49:56 +02:00
|
|
|
|
|
|
|
$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 />';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-08-28 18:52:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate the array texts using gettext
|
|
|
|
*/
|
|
|
|
function translate(&$item, $key) {
|
|
|
|
$item = __($item);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The main function of module groups and the enter point to
|
|
|
|
* execute the code.
|
|
|
|
*/
|
|
|
|
function mainModuleGroups() {
|
|
|
|
global $config; //the useful global var of Pandora Console, it has many data can you use
|
2010-08-09 12:19:14 +02:00
|
|
|
|
|
|
|
require_once ('include/functions_reporting.php');
|
|
|
|
|
2009-08-28 18:52:10 +02:00
|
|
|
//The big query
|
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
|
|
|
$sql = "SELECT COUNT(id_agente) AS count, estado
|
2009-09-01 13:43:30 +02:00
|
|
|
FROM tagente_estado
|
|
|
|
WHERE utimestamp != 0 AND id_agente IN
|
|
|
|
(SELECT id_agente FROM tagente WHERE id_grupo = %d AND disabled IS FALSE)
|
|
|
|
AND id_agente_modulo IN
|
|
|
|
(SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_module_group = %d AND disabled IS FALSE AND delete_pending IS FALSE)
|
|
|
|
GROUP BY estado";
|
2009-08-28 18:52:10 +02:00
|
|
|
|
2010-02-19 Sancho Lerena <slerena@artica.es>
* functions_events.php: Fixed typo (switched meaning) in two labels.
* include/styles/pandora.css: Changed background color of th default style.
* include/functions_reporting.php: Improved function get_group_stats(). Now
supports stats from batch-mode and get realtime stats in a more efficient
way. Fixed get_fired_alerts_reporting_table() to avoid problems in external
reporting (PDF & XML).
* include/functions_servers.php: get_server_performance() now uses batch mode
stats reporting, and improved also the realtime stats generation. Same with
function get_server_info().
* include/functions_config.php: Added new config tokens (not fully
implemented yet) for event, trap, strings and audit automatic purge.
* include/functions_ui.php: Added new print_page_header() function to set
the new standard header in all pages, using the "tabbed" format to show
the title, subtitle and other options like help, or custom-tabs for the page
* pandoradb.sql: Added tserver.stat_utimestamp field. Added indexes to
tsession table. Fixed typo in field name in tgroup_stat: agents_uknown to
agents_unknown.
* extensions/ext_backup: New directory to place "deleted" extensions.
* extensions/dbmanager/dbmanager.css: Table names now are in it's original
lowercase/uppercase format.
* extensions/dbmanager.php: Updated headers, and now return "empty" when
a search is empty, instead "error" as before.
* extensions/users_connected.php
extensions/module_groups.php
extensions/plugin_registration.php
extensions/pandora_logs.php
operation/incidents/incident.php
operation/snmpconsole/snmp_view.php
operation/users/user.php
operation/users/user_edit.php
godmode/agentes/planned_downtime.php
operation/events/events.php
operation/visual_console/index.php
operation/agentes/estado_generalagente.php
operation/agentes/estado_agente.php
operation/agentes/exportdata.php
operation/agentes/ver_agente.php
operation/agentes/status_monitor.php
operation/agentes/alerts_status.php
operation/users/user_statistics.php: Added new header format.
* operation/agentes/estado_grupo.php: Removed old group view.
* operation/agentes/tactical.php: Adapted to use new realtime/batch
statistical system. Placed events above server info. Showing only pending
events and other minor changes.
* operation/agentes/group_view.php: NEW screen, replacing old one. Probably
most ugly, but much more useful than before.
* operation/agentes/networkmap.php: Added title.
* operation/messages/message.php: Added title and adding some exists in
code was missing before.
* operation/reporting/reporting_viewer.php: Added title.
* operation/reporting/graph_viewer.php: Added title.
* operation/reporting/custom_reporting.php: Added title.
* operation/servers/view_server.php:
* operation/menu.php: Replaced old group view with new (this has english
name). Removed autorefresh "by default" in server view.
* extras/pandoradb_migrate_v3.0_to_v3.1.sql: Fixed typo.
* extras/pandora_diag.php: Minor changes, removed some info and added other.
* general/logon_ok.php: Minor aesthetic changes.
* general/header.php: Fixed missing ";"
* operation/extensions.php,
godmode/extensions.php: Added support for delete extensions.
* godmode/menu.php: New setup items.
* godmode/setup/setup.php,
godmode/setup/performance.php,
godmode/setup/setup_visuals.php: Reordered setup options, new setup section
"Performance", added new performance options to set "realtime" statistics
or "batchmode" with it's own interval. Some setup info is now shared with
the servers (but it it's any change in setup, servers should be restarted
anyway).
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-02-19 16:16:03 +01:00
|
|
|
print_page_header (__("Combined table of agent group and module group"));
|
2009-08-28 18:52:10 +02:00
|
|
|
|
2009-11-21 14:53:10 +01:00
|
|
|
echo "<p>" . __("This table shows in columns the modules group and in rows agents group. The cell shows all modules") . "</p>";
|
2009-08-28 18:52:10 +02:00
|
|
|
|
|
|
|
|
2010-04-22 18:51:23 +02:00
|
|
|
$agentGroups = get_user_groups ($config['id_user'], "AR", false);
|
2009-08-28 18:52:10 +02:00
|
|
|
$modelGroups = get_all_model_groups();
|
|
|
|
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
|
2011-01-19 14:50:22 +01:00
|
|
|
|
|
|
|
foreach ($modelGroups as $i => $n) {
|
|
|
|
$modelGroups[$i] = printTruncateText($n, 20);
|
|
|
|
}
|
|
|
|
|
2009-08-28 18:52:10 +02:00
|
|
|
$head = $modelGroups;
|
|
|
|
array_unshift($head, ' ');
|
|
|
|
|
|
|
|
//Metaobject use in print_table
|
|
|
|
$table = null;
|
|
|
|
$table->align[0] = 'right'; //Align to right the first column.
|
|
|
|
$table->style[0] = 'color: #ffffff; background-color: #778866; font-weight: bolder;';
|
|
|
|
$table->head = $head;
|
2009-12-01 12:43:25 +01:00
|
|
|
$table->width = '95%';
|
2009-08-28 18:52:10 +02:00
|
|
|
|
|
|
|
//The content of table
|
|
|
|
$tableData = array();
|
2010-10-25 17:49:56 +02:00
|
|
|
|
2010-11-04 17:35:29 +01:00
|
|
|
$fired = false;
|
|
|
|
|
2010-10-25 17:49:56 +02:00
|
|
|
//Create rows and cells
|
2009-08-28 18:52:10 +02:00
|
|
|
foreach ($agentGroups as $idAgentGroup => $name) {
|
|
|
|
|
|
|
|
$row = array();
|
|
|
|
|
2011-01-17 18:03:38 +01:00
|
|
|
array_push($row, printTruncateText($name, 20));
|
2009-08-28 18:52:10 +02:00
|
|
|
|
|
|
|
foreach ($modelGroups as $idModelGroup => $modelGroup) {
|
|
|
|
$query = sprintf($sql,$idAgentGroup, $idModelGroup);
|
|
|
|
$rowsDB = get_db_all_rows_sql ($query);
|
|
|
|
|
2010-10-25 17:49:56 +02:00
|
|
|
|
|
|
|
$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']) {
|
|
|
|
if ($alert["times_fired"] > 0) {
|
|
|
|
$fired = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-28 18:52:10 +02:00
|
|
|
$states = array();
|
|
|
|
if ($rowsDB !== false) {
|
|
|
|
foreach ($rowsDB as $rowDB) {
|
|
|
|
$states[$rowDB['estado']] = $rowDB['count'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$count = 0;
|
|
|
|
foreach ($states as $idState => $state) {
|
2011-01-17 18:03:38 +01:00
|
|
|
$count += $state;
|
2009-08-28 18:52:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$color = 'transparent'; //Defaut color for cell
|
2010-04-22 18:51:23 +02:00
|
|
|
$font_color = '#000000'; //Default font color for cell
|
2009-08-28 18:52:10 +02:00
|
|
|
if ($count == 0) {
|
2010-08-09 12:19:14 +02:00
|
|
|
$color = '#eeeeee'; //Soft grey when the cell for this model group and agent group hasn't modules.
|
2009-09-01 13:43:30 +02:00
|
|
|
$alinkStart = '';
|
|
|
|
$alinkEnd = '';
|
2009-08-28 18:52:10 +02:00
|
|
|
}
|
2010-08-09 12:19:14 +02:00
|
|
|
else {
|
2010-10-25 17:49:56 +02:00
|
|
|
|
|
|
|
if ($fired) {
|
2010-08-09 12:19:14 +02:00
|
|
|
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
|
2010-10-25 17:49:56 +02:00
|
|
|
}
|
|
|
|
else if (array_key_exists(1,$states)) {
|
2009-08-28 18:52:10 +02:00
|
|
|
$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.
|
2010-04-22 18:51:23 +02:00
|
|
|
$font_color = '#ffffff';
|
2010-08-09 12:19:14 +02:00
|
|
|
}
|
|
|
|
elseif (array_key_exists(2,$states)) {
|
2009-08-28 18:52:10 +02:00
|
|
|
$color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
|
|
|
|
}
|
2010-08-09 12:19:14 +02:00
|
|
|
elseif (array_key_exists(3,$states)) {
|
|
|
|
$color = '#babdb6'; //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 = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
|
|
|
|
}
|
|
|
|
|
2010-04-22 18:51:23 +02:00
|
|
|
|
2010-10-25 17:49:56 +02:00
|
|
|
$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;";>';
|
2010-04-22 18:51:23 +02:00
|
|
|
$alinkEnd = '</a>';
|
2009-08-28 18:52:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
array_push($row,
|
|
|
|
'<div
|
2010-02-16 23:36:12 +01:00
|
|
|
style="background: ' . $color . ';
|
2010-04-22 18:51:23 +02:00
|
|
|
height: 25px;
|
2010-02-16 23:36:12 +01:00
|
|
|
margin-left: auto; margin-right: auto;
|
2010-04-22 18:51:23 +02:00
|
|
|
text-align: center; padding-top: 0px; font-size: 18px;">
|
|
|
|
' . $alinkStart . $count . $alinkEnd . '</div>');
|
2009-08-28 18:52:10 +02:00
|
|
|
}
|
|
|
|
array_push($tableData,$row);
|
|
|
|
}
|
|
|
|
$table->data = $tableData;
|
2011-01-19 14:50:22 +01:00
|
|
|
echo "<div style='width:98%; overflow-x:scroll;'>";
|
2009-08-28 18:52:10 +02:00
|
|
|
print_table($table);
|
2011-01-19 14:50:22 +01:00
|
|
|
echo "</div>";
|
2009-08-28 18:52:10 +02:00
|
|
|
|
|
|
|
echo "<p>" . __("The colours meaning:") .
|
2009-12-01 12:43:25 +01:00
|
|
|
"<ul style='float: left;'>" .
|
2010-10-25 17:49:56 +02:00
|
|
|
'<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") .
|
|
|
|
'</li>' .
|
|
|
|
'<li style="clear: both;">
|
|
|
|
<div style="float: left; background: #fce94f; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
|
|
|
__("Yellow cell when the module group and agent have at least one in warning status and the others in grey or green status") .
|
|
|
|
'</li>' .
|
|
|
|
'<li style="clear: both;">
|
|
|
|
<div style="float: left; background: #8ae234; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
|
|
|
__("Green cell when the module group and agent have all modules in OK status") .
|
|
|
|
'</li>' .
|
|
|
|
'<li style="clear: both;">
|
|
|
|
<div style="float: left; background: #babdb6; height: 20px; width: 80px;margin-right: 5px; margin-bottom: 5px;"> </div>' .
|
|
|
|
__("Grey cell when the module group and agent have at least one in unknown status and the others in green status") .
|
|
|
|
'</li>' .
|
2009-08-28 18:52:10 +02:00
|
|
|
"</ul>" .
|
2009-11-21 14:53:10 +01:00
|
|
|
"</p>";
|
2010-10-25 17:49:56 +02:00
|
|
|
|
|
|
|
require_css_file('cluetip');
|
|
|
|
require_jquery_file('cluetip');
|
|
|
|
?>
|
|
|
|
<script>
|
|
|
|
$(document).ready (function () {
|
|
|
|
$("a.info_cell").cluetip ({
|
|
|
|
arrows: true,
|
|
|
|
attribute: 'rel',
|
|
|
|
cluetipClass: 'default'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<?php
|
2009-08-28 18:52:10 +02:00
|
|
|
}
|
|
|
|
|
2010-02-08 18:58:25 +01:00
|
|
|
add_operation_menu_option(__("Modules groups"), 'estado', 'module_groups/icon_menu.png');
|
2009-08-28 18:52:10 +02:00
|
|
|
add_extension_main_function('mainModuleGroups');
|
|
|
|
?>
|