2010-08-31 09:27:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2010-08-31 09:27:22 +02:00
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
2011-03-23 Raul Mateos <raulofpandora@gmail.com>
* extensions/ssh_console.php, extensions/vnc_view.php,
extensions/update_manager.php, extensions/users_connected.php,
extensions/extension_uploader.php, extensions/insert_data.php,
extensions/module_groups.php, extensions/plugin_registration.php,
extensions/agent_modules.php, extensions/resource_registration.php,
extensions/resource_exportation.php, extensions/dbmanager.php,
extensions/pandora_logs.php, general/*.php, ajax.php,
operation/search_*.php, operation/menu.php, operation/extensions.php,
godmode/menu.php, godmode/extensions.php, godmode/admin_access_logs.php:
CReverted unwanted license changes.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4126 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-23 17:13:28 +01:00
|
|
|
// modify it under the terms of the GNU General Public License
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
2010-08-31 09:27:22 +02:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-08-31 09:27:22 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
include_once('include/functions_alerts.php');
|
|
|
|
|
|
|
|
$searchAlerts = check_acl($config['id_user'], 0, "AR");
|
|
|
|
|
|
|
|
$selectDisabledUp = '';
|
|
|
|
$selectDisabledDown = '';
|
|
|
|
$selectAgentUp = '';
|
|
|
|
$selectAgentDown = '';
|
|
|
|
$selectModuleUp = '';
|
|
|
|
$selectModuleDown = '';
|
|
|
|
$selectTemplateUp = '';
|
|
|
|
$selectTemplateDown = '';
|
|
|
|
|
|
|
|
switch ($sortField) {
|
|
|
|
case 'disabled':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectAgentUp = $selected;
|
|
|
|
$order = array('field' => 'disabled', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectAgentDown = $selected;
|
|
|
|
$order = array('field' => 'disabled', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'agent':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectAgentUp = $selected;
|
|
|
|
$order = array('field' => 'agent_name', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectAgentDown = $selected;
|
|
|
|
$order = array('field' => 'agent_name', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'module':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectModuleUp = $selected;
|
|
|
|
$order = array('field' => 'module_name', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectModuleDown = $selected;
|
|
|
|
$order = array('field' => 'module_name', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'template':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectTemplateUp = $selected;
|
|
|
|
$order = array('field' => 'template_name', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectTemplateDown = $selected;
|
|
|
|
$order = array('field' => 'template_name', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$selectDisabledUp = '';
|
|
|
|
$selectDisabledDown = '';
|
|
|
|
$selectAgentUp = $selected;
|
|
|
|
$selectAgentDown = '';
|
|
|
|
$selectModuleUp = '';
|
|
|
|
$selectModuleDown = '';
|
|
|
|
$selectTemplateUp = '';
|
|
|
|
$selectTemplateDown = '';
|
|
|
|
|
|
|
|
$order = array('field' => 'agent_name', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$alerts = false;
|
|
|
|
|
|
|
|
if($searchAlerts) {
|
|
|
|
$agents = array_keys(get_group_agents(array_keys(get_user_groups($config["id_user"], 'AR', false))));
|
|
|
|
|
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
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
|
|
|
$whereAlerts = 'AND (
|
|
|
|
id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE "%' . $stringSearchSQL . '%") OR
|
|
|
|
id_alert_template IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_templates
|
|
|
|
WHERE id_alert_action IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_actions
|
|
|
|
WHERE name LIKE "%' . $stringSearchSQL . '%")) OR
|
|
|
|
talert_template_modules.id IN (
|
|
|
|
SELECT id_alert_template_module
|
|
|
|
FROM talert_template_module_actions
|
|
|
|
WHERE id_alert_action IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_actions
|
|
|
|
WHERE name LIKE "%' . $stringSearchSQL . '%")) OR
|
|
|
|
id_agent_module IN (
|
|
|
|
SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE nombre LIKE "%' . $stringSearchSQL . '%") OR
|
|
|
|
id_agent_module IN (
|
|
|
|
SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_agente IN (
|
|
|
|
SELECT id_agente
|
|
|
|
FROM tagente
|
|
|
|
WHERE nombre LIKE "%' . $stringSearchSQL . '%"))
|
|
|
|
)';
|
|
|
|
break;
|
|
|
|
case "postgresql":
|
2011-04-11 19:05:20 +02:00
|
|
|
case "oracle":
|
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
|
|
|
$whereAlerts = 'AND (
|
|
|
|
id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE \'%' . $stringSearchSQL . '%\') OR
|
|
|
|
id_alert_template IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_templates
|
|
|
|
WHERE id_alert_action IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_actions
|
|
|
|
WHERE name LIKE \'%' . $stringSearchSQL . '%\')) OR
|
|
|
|
talert_template_modules.id IN (
|
|
|
|
SELECT id_alert_template_module
|
|
|
|
FROM talert_template_module_actions
|
|
|
|
WHERE id_alert_action IN (
|
|
|
|
SELECT id
|
|
|
|
FROM talert_actions
|
|
|
|
WHERE name LIKE \'%' . $stringSearchSQL . '%\')) OR
|
|
|
|
id_agent_module IN (
|
|
|
|
SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE nombre LIKE \'%' . $stringSearchSQL . '%\') OR
|
|
|
|
id_agent_module IN (
|
|
|
|
SELECT id_agente_modulo
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_agente IN (
|
|
|
|
SELECT id_agente
|
|
|
|
FROM tagente
|
|
|
|
WHERE nombre LIKE \'%' . $stringSearchSQL . '%\'))
|
|
|
|
)';
|
|
|
|
break;
|
|
|
|
}
|
2010-08-31 09:27:22 +02:00
|
|
|
|
|
|
|
$alertsraw = get_agent_alerts_simple ($agents, "all_enabled", array('offset' => get_parameter ('offset',0), 'limit' => $config['block_size'], 'order' => $order['field'] . " " . $order['order']), $whereAlerts);
|
|
|
|
|
|
|
|
$stringSearchPHP = substr($stringSearchSQL,1,strlen($stringSearchSQL)-2);
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
|
2010-08-31 09:27:22 +02:00
|
|
|
$alerts = array();
|
|
|
|
foreach($alertsraw as $key => $alert){
|
|
|
|
$finded = false;
|
|
|
|
$alerts[$key]['disabled'] = $alert['disabled'];
|
|
|
|
$alerts[$key]['id_agente'] = get_agentmodule_agent($alert['id_agent_module']);
|
|
|
|
$alerts[$key]['agent_name'] = $alert['agent_name'];
|
|
|
|
$alerts[$key]['module_name'] = $alert['agent_module_name'];
|
|
|
|
$alerts[$key]['template_name'] = $alert['template_name'];
|
|
|
|
$actions = get_alert_agent_module_actions($alert['id']);
|
|
|
|
|
2011-02-03 14:12:16 +01:00
|
|
|
$actions_name = array();
|
2010-08-31 09:27:22 +02:00
|
|
|
foreach($actions as $action) {
|
|
|
|
$actions_name[] = $action['name'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$alerts[$key]['actions'] = implode(',',$actions_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
$totalAlerts = count($alerts);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($alerts === false || $totalAlerts == 0) {
|
|
|
|
echo "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$table->cellpadding = 4;
|
|
|
|
$table->cellspacing = 4;
|
|
|
|
$table->width = "98%";
|
|
|
|
$table->class = "databox";
|
|
|
|
|
|
|
|
$table->head = array ();
|
|
|
|
$table->head[0] = '' . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=disabled&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectDisabledUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=disabled&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectDisabledDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[1] = __('Agent') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=agent&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=agent&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[2] = __('Module') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=module&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=module&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[3] = __('Template') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=template&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=alerts&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=template&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[4] = __('Action');
|
|
|
|
|
|
|
|
$table->align = array ();
|
|
|
|
$table->align[0] = "center";
|
|
|
|
$table->align[1] = "left";
|
|
|
|
$table->align[2] = "left";
|
|
|
|
$table->align[3] = "left";
|
|
|
|
$table->align[4] = "left";
|
|
|
|
|
|
|
|
$table->valign = array ();
|
|
|
|
$table->valign[0] = "top";
|
|
|
|
$table->valign[1] = "top";
|
|
|
|
$table->valign[2] = "top";
|
|
|
|
$table->valign[3] = "top";
|
|
|
|
$table->valign[4] = "top";
|
|
|
|
|
|
|
|
$table->data = array ();
|
|
|
|
foreach ($alerts as $alert) {
|
|
|
|
if ($alert['disabled'])
|
|
|
|
$disabledCell = print_image ('images/lightbulb_off.png', true, array('title' => 'disable', 'alt' => 'disable'));
|
|
|
|
else
|
|
|
|
$disabledCell = print_image ('images/lightbulb.png', true, array('alt' => 'enable', 'title' => 'enable'));
|
|
|
|
|
|
|
|
$actionCell = '';
|
|
|
|
if (strlen($alert["actions"]) > 0) {
|
|
|
|
$arrayActions = explode(',', $alert["actions"]);
|
|
|
|
$actionCell = '<ul class="action_list">';
|
|
|
|
foreach ($arrayActions as $action)
|
|
|
|
$actionCell .= '<li><div><span class="action_name">' . $action . '</span></div><br /></li>';
|
|
|
|
$actionCell .= '</ul>';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
array_push($table->data, array(
|
|
|
|
$disabledCell,
|
|
|
|
print_agent_name ($alert["id_agente"], true, "upper"),
|
|
|
|
$alert["module_name"],
|
|
|
|
$alert["template_name"],$actionCell
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2011-04-13 18:11:02 +02:00
|
|
|
echo "<br />";ui_pagination ($totalAlerts);
|
2010-08-31 09:27:22 +02:00
|
|
|
print_table ($table); unset($table);
|
2011-04-13 18:11:02 +02:00
|
|
|
ui_pagination ($totalAlerts);
|
2010-08-31 09:27:22 +02:00
|
|
|
}
|
|
|
|
?>
|