2012-04-12 18:49:33 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org 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
|
|
|
|
// as published by the Free Software Foundation; 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.
|
|
|
|
|
|
|
|
define('ALL', -1);
|
|
|
|
define('NORMAL', 0);
|
|
|
|
define('WARNING', 2);
|
|
|
|
define('CRITICAL', 1);
|
|
|
|
define('UNKNOWN', 3);
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
require_once ('include/functions_treeview.php');
|
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
if (is_ajax ())
|
|
|
|
{
|
|
|
|
require_once ('include/functions_reporting.php');
|
|
|
|
require_once ('include/functions_users.php');
|
|
|
|
require_once ('include/functions_servers.php');
|
2012-08-22 16:09:05 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
global $config;
|
|
|
|
|
2012-04-16 12:18:41 +02:00
|
|
|
$enterpriseEnable = false;
|
|
|
|
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
|
|
|
|
$enterpriseEnable = true;
|
|
|
|
require_once ('enterprise/include/functions_policies.php');
|
|
|
|
}
|
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
$type = get_parameter('type');
|
|
|
|
$id = get_parameter('id');
|
|
|
|
$id_father = get_parameter('id_father');
|
|
|
|
$statusSel = get_parameter('status');
|
|
|
|
$search_free = get_parameter('search_free', '');
|
|
|
|
$printTable = get_parameter('printTable', 0);
|
2012-08-22 16:09:05 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
if ($printTable) {
|
|
|
|
$id_agente = get_parameter('id_agente');
|
2012-08-22 16:09:05 +02:00
|
|
|
treeview_printTable($id_agente);
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* It's a binary for branch (0 show - 1 hide)
|
|
|
|
* and there are 2 position
|
|
|
|
* 0 0 - show 2 branch
|
|
|
|
* 0 1 - hide the 2º branch
|
|
|
|
* 1 0 - hide the 1º branch
|
|
|
|
* 1 1 - hide 2 branch
|
2012-08-22 16:09:05 +02:00
|
|
|
*/
|
2012-04-12 18:49:33 +02:00
|
|
|
$lessBranchs = get_parameter('less_branchs');
|
|
|
|
|
|
|
|
switch ($type) {
|
|
|
|
case 'group':
|
|
|
|
case 'os':
|
|
|
|
case 'module_group':
|
|
|
|
case 'policies':
|
|
|
|
case 'module':
|
|
|
|
$avariableGroups = users_get_groups();
|
|
|
|
$avariableGroupsIds = array_keys($avariableGroups);
|
|
|
|
|
|
|
|
$countRows = 0;
|
|
|
|
|
|
|
|
if (!empty($avariableGroupsIds)) {
|
2012-07-24 12:10:34 +02:00
|
|
|
//TODO CHANGE POLICY ACL FOR TAG ACL
|
2012-07-12 20:10:44 +02:00
|
|
|
$extra_sql = '';
|
2012-04-12 18:49:33 +02:00
|
|
|
if($extra_sql != '') {
|
|
|
|
$extra_sql .= ' OR';
|
|
|
|
}
|
|
|
|
$groups_sql = implode(', ', $avariableGroupsIds);
|
|
|
|
|
|
|
|
if ($search_free != '') {
|
2012-06-07 13:44:08 +02:00
|
|
|
$search_sql = " AND nombre COLLATE utf8_general_ci LIKE '%$search_free%'";
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
|
|
|
else {
|
2012-04-12 18:49:33 +02:00
|
|
|
$search_sql = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
//Extract all rows of data for each type
|
|
|
|
switch ($type) {
|
2012-07-18 16:31:58 +02:00
|
|
|
case 'group':
|
|
|
|
|
2012-07-16 17:20:56 +02:00
|
|
|
//Skip agents which only have not init modules
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
$search_sql .= " AND total_count<>notinit_count";
|
2012-07-12 20:10:44 +02:00
|
|
|
|
2012-07-18 16:31:58 +02:00
|
|
|
$sql = agents_get_agents(array (
|
|
|
|
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
|
|
|
'id_grupo' => $id,
|
|
|
|
'disabled' => 0,
|
|
|
|
'status' => $statusSel,
|
|
|
|
'search' => $search_sql),
|
|
|
|
array ('*'),
|
|
|
|
'AR',
|
|
|
|
false,
|
|
|
|
true);
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 'os':
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
//Skip agents which only have not init modules
|
|
|
|
$search_sql .= " AND total_count<>notinit_count";
|
2012-07-18 16:31:58 +02:00
|
|
|
|
|
|
|
|
2012-07-12 20:10:44 +02:00
|
|
|
$sql = agents_get_agents(array (
|
2012-07-18 16:31:58 +02:00
|
|
|
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
|
|
|
'id_os' => $id,
|
|
|
|
'disabled' => 0,
|
|
|
|
'status' => $statusSel,
|
|
|
|
'search' => $search_sql),
|
|
|
|
array ('*'),
|
|
|
|
'AR',
|
|
|
|
false,
|
|
|
|
true);
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 'module_group':
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
//Skip agents which only have not init modules
|
|
|
|
$search_sql .= " AND total_count<>notinit_count";
|
2012-07-12 20:10:44 +02:00
|
|
|
|
|
|
|
$sql = agents_get_agents(array (
|
2012-07-18 16:31:58 +02:00
|
|
|
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
|
|
|
'disabled' => 0,
|
|
|
|
'status' => $statusSel,
|
|
|
|
'search' => $search_sql),
|
|
|
|
array ('*'),
|
|
|
|
'AR',
|
|
|
|
false,
|
|
|
|
true);
|
2012-07-12 20:10:44 +02:00
|
|
|
|
|
|
|
// Skip agents without modules
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
$sql .= ' AND total_count>0 AND disabled=0 AND id_agente IN
|
|
|
|
(SELECT DISTINCT (id_agente)
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE id_module_group = ' . $id . ')';
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 'policies':
|
2012-06-11 17:48:49 +02:00
|
|
|
|
2012-07-12 20:10:44 +02:00
|
|
|
$sql = agents_get_agents(array (
|
2012-07-18 16:31:58 +02:00
|
|
|
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
|
|
|
'disabled' => 0,
|
|
|
|
'search' => $search_sql),
|
|
|
|
|
|
|
|
array ('*'),
|
|
|
|
'AR',
|
|
|
|
false,
|
|
|
|
true);
|
|
|
|
|
2012-07-16 19:02:54 +02:00
|
|
|
if ($id != 0) {
|
2012-07-16 15:48:59 +02:00
|
|
|
// Skip agents without modules
|
|
|
|
$sql .= ' AND tagente.id_agente IN
|
2012-07-18 16:31:58 +02:00
|
|
|
(SELECT tagente.id_agente
|
|
|
|
FROM tagente, tagente_modulo, tagente_estado, tpolicy_modules
|
|
|
|
WHERE tagente.id_agente = tagente_modulo.id_agente
|
|
|
|
AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
|
|
|
AND tagente_modulo.id_policy_module = tpolicy_modules.id
|
|
|
|
AND tagente.disabled = 0
|
|
|
|
AND tagente_modulo.disabled = 0
|
|
|
|
AND tagente_estado.utimestamp != 0
|
|
|
|
AND tagente_modulo.id_policy_module != 0
|
|
|
|
AND tpolicy_modules.id_policy = ' . $id . '
|
|
|
|
group by tagente.id_agente
|
|
|
|
having COUNT(*) > 0)';
|
2012-07-16 19:02:54 +02:00
|
|
|
}
|
|
|
|
else if ($statusSel == 0) {
|
|
|
|
|
|
|
|
// If status filter is NORMAL add void agents
|
|
|
|
$sql .= " UNION SELECT * FROM tagente
|
2012-07-18 16:31:58 +02:00
|
|
|
WHERE tagente.disabled = 0
|
|
|
|
AND tagente.id_agente NOT IN (SELECT tagente_estado.id_agente
|
|
|
|
FROM tagente_estado)";
|
2012-07-16 15:48:59 +02:00
|
|
|
}
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 'module':
|
|
|
|
//Replace separator token "articapandora_32_pandoraartica_" for " "
|
|
|
|
//example:
|
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-19 16:45:59 +02:00
|
|
|
//"Load_articapandora_32_pandoraartica_Average"
|
|
|
|
//result -> "Load Average"
|
2012-06-11 17:08:25 +02:00
|
|
|
$name = str_replace(array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_','_articapandora_'.ord('/').'_pandoraartica_'),array(' ','#','/'),$id);
|
|
|
|
|
|
|
|
$name = io_safe_input($name);
|
|
|
|
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-07-12 20:10:44 +02:00
|
|
|
$sql = agents_get_agents(array (
|
2012-07-18 16:31:58 +02:00
|
|
|
'order' => 'nombre COLLATE utf8_general_ci ASC',
|
|
|
|
'disabled' => 0,
|
|
|
|
'status' => $statusSel,
|
|
|
|
'search' => $search_sql),
|
|
|
|
|
|
|
|
array ('*'),
|
|
|
|
'AR',
|
|
|
|
false,
|
|
|
|
true);
|
2012-07-12 20:10:44 +02:00
|
|
|
$sql .= sprintf('AND id_agente IN (
|
2012-07-18 16:31:58 +02:00
|
|
|
SELECT id_agente
|
|
|
|
FROM tagente_modulo
|
|
|
|
WHERE nombre = \'%s\' AND disabled = 0
|
|
|
|
)
|
|
|
|
', $name);
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-06-12 13:02:36 +02:00
|
|
|
$sql .= ' AND tagente.disabled = 0'. $search_sql;
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
|
|
|
|
$rows = db_get_all_rows_sql($sql);
|
|
|
|
$countRows = count ($rows);
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
//Empty Branch
|
2012-04-12 18:49:33 +02:00
|
|
|
if ($countRows === 0) {
|
|
|
|
echo "<ul style='margin: 0; padding: 0;'>\n";
|
|
|
|
echo "<li style='margin: 0; padding: 0;'>";
|
|
|
|
if ($lessBranchs == 1)
|
2012-04-16 19:26:01 +02:00
|
|
|
echo html_print_image ("operation/tree/no_branch.png", true, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
else
|
2012-04-16 19:26:01 +02:00
|
|
|
echo html_print_image ("operation/tree/branch.png", true, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
echo "<i>" . __("Empty") . "</i>";
|
|
|
|
echo "</li>";
|
|
|
|
echo "</ul>";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
//Branch with items
|
2012-04-12 18:49:33 +02:00
|
|
|
$count = 0;
|
|
|
|
echo "<ul style='margin: 0; padding: 0;'>\n";
|
2012-06-12 13:02:36 +02:00
|
|
|
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
foreach ($rows as $row) {
|
2012-04-12 18:49:33 +02:00
|
|
|
$count++;
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
|
|
|
|
$agent_info["monitor_alertsfired"] = $row["fired_count"];
|
|
|
|
$agent_info["monitor_critical"] = $row["critical_count"];
|
|
|
|
$agent_info["monitor_warning"] = $row["warning_count"];
|
|
|
|
$agent_info["monitor_unknown"] = $row["unknown_count"];
|
|
|
|
$agent_info["monitor_normal"] = $row["normal_count"];
|
|
|
|
$agent_info["modules"] = $row["total_count"];
|
|
|
|
|
|
|
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
|
|
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"], $agent_info["monitor_warning"], $agent_info["monitor_unknown"]);
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-07-16 19:02:54 +02:00
|
|
|
// Filter by status (only in policy view)
|
|
|
|
if ($type == 'policies') {
|
|
|
|
|
|
|
|
if ($statusSel == NORMAL) {
|
|
|
|
if (strpos($agent_info["status_img"], 'ok') === false)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if ($statusSel == WARNING) {
|
|
|
|
if (strpos($agent_info["status_img"], 'warning') === false)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if ($statusSel == CRITICAL) {
|
|
|
|
if (strpos($agent_info["status_img"], 'critical') === false)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if ($statusSel == UNKNOWN) {
|
|
|
|
if (strpos($agent_info["status_img"], 'down') === false)
|
|
|
|
continue;
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
2012-07-16 19:02:54 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
$less = $lessBranchs;
|
|
|
|
if ($count != $countRows)
|
2012-04-16 19:26:01 +02:00
|
|
|
$img = html_print_image ("operation/tree/closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image" . $id . "_agent_" . $type . "_" . $row["id_agente"], "pos_tree" => "2"));
|
2012-04-12 18:49:33 +02:00
|
|
|
else {
|
|
|
|
$less = $less + 2; // $less = $less or 0b10
|
2012-04-16 19:26:01 +02:00
|
|
|
$img = html_print_image ("operation/tree/last_closed.png", true, array ("style" => 'vertical-align: middle;', "id" => "tree_image" . $id . "_agent_" . $row["id_agente"], "pos_tree" => "3"));
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
|
|
|
echo "<li style='margin: 0; padding: 0;'>";
|
|
|
|
echo "<a onfocus='JavaScript: this.blur()'
|
|
|
|
href='javascript: loadSubTree(\"agent_" . $type . "\"," . $row["id_agente"] . ", " . $less . ", \"" . $id . "\")'>";
|
|
|
|
|
|
|
|
if ($lessBranchs == 1)
|
2012-04-16 19:26:01 +02:00
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
else
|
2012-09-18 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js,
godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_list.list.php,
godmode/gis_maps/configure_gis_map.php,
include/functions_visual_map_editor.php, include/functions_ui.php,
operation/tree.php, operation/agentes/exportdata.excel.php,
operation/agentes/exportdata.php, operation/agentes/ver_agente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/ajax.php, operation/events/events_validate.php,
operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/reporting_viewer.php,
operation/netflow/nf_live_view.php,
operation/incidents/incident.php, operation/search_modules.php:
started to use the new function "ui_print_agent_autocomplete_input"
to make more easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6983 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-18 13:28:09 +02:00
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
echo $img;
|
|
|
|
echo "</a>";
|
|
|
|
echo " ";
|
|
|
|
echo str_replace('.png' ,'_ball.png',
|
|
|
|
str_replace('img', 'img style="vertical-align: middle;"', $agent_info["status_img"])
|
|
|
|
);
|
|
|
|
echo " ";
|
|
|
|
echo str_replace('.png' ,'_ball.png',
|
|
|
|
str_replace('img', 'img style="vertical-align: middle;"', $agent_info["alert_img"])
|
|
|
|
);
|
|
|
|
echo "<a onfocus='JavaScript: this.blur()'
|
2012-04-19 11:54:03 +02:00
|
|
|
href='javascript: loadTable(\"agent_" . $type . "\"," . $row["id_agente"] . ", " . $less . ", \"" . $id . "\")'>";
|
2012-04-12 18:49:33 +02:00
|
|
|
echo " ";
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
echo $row["nombre"];
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
echo " (";
|
|
|
|
echo '<b>';
|
|
|
|
echo $agent_info["modules"];
|
|
|
|
echo '</b>';
|
|
|
|
if ($agent_info["monitor_alertsfired"] > 0)
|
|
|
|
echo ' : <span class="orange">'.$agent_info["monitor_alertsfired"].'</span>';
|
|
|
|
if ($agent_info["monitor_critical"] > 0)
|
|
|
|
echo ' : <span class="red">'.$agent_info["monitor_critical"].'</span>';
|
|
|
|
if ($agent_info["monitor_warning"] > 0)
|
|
|
|
echo ' : <span class="yellow">'.$agent_info["monitor_warning"].'</span>';
|
|
|
|
if ($agent_info["monitor_unknown"] > 0)
|
|
|
|
echo ' : <span class="grey">'.$agent_info["monitor_unknown"].'</span>';
|
|
|
|
if ($agent_info["monitor_normal"] > 0)
|
|
|
|
echo ' : <span class="green">'.$agent_info["monitor_normal"].'</span>';
|
|
|
|
echo ")";
|
|
|
|
if ($agent_info["last_contact"]!='') {
|
|
|
|
echo " (";
|
|
|
|
ui_print_timestamp ($agent_info["last_contact"]);
|
|
|
|
echo ")";
|
|
|
|
}
|
2012-08-22 16:09:05 +02:00
|
|
|
if ($row['quiet']) {
|
|
|
|
echo " ";
|
|
|
|
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
|
|
|
|
}
|
2012-04-12 18:49:33 +02:00
|
|
|
echo "</a>";
|
|
|
|
echo "<div hiddenDiv='1' loadDiv='0' style='margin: 0px; padding: 0px;' class='tree_view' id='tree_div" . $id . "_agent_" . $type . "_" . $row["id_agente"] . "'></div>";
|
|
|
|
echo "</li>";
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
echo "</ul>\n";
|
|
|
|
break;
|
2012-08-22 16:09:05 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
//also aknolegment as second subtree/branch
|
|
|
|
case 'agent_group':
|
2012-06-08 14:11:58 +02:00
|
|
|
case 'agent_module_group':
|
2012-04-12 18:49:33 +02:00
|
|
|
case 'agent_os':
|
|
|
|
case 'agent_policies':
|
|
|
|
case 'agent_module':
|
|
|
|
$fatherType = str_replace('agent_', '', $type);
|
|
|
|
|
|
|
|
switch ($fatherType) {
|
|
|
|
case 'group':
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM tagente_modulo AS t1
|
|
|
|
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
|
|
|
WHERE t1.id_agente = ' . $id;
|
|
|
|
break;
|
|
|
|
case 'os':
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM tagente_modulo AS t1
|
|
|
|
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
|
|
|
WHERE t1.id_agente = ' . $id;
|
|
|
|
break;
|
|
|
|
case 'module_group':
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM tagente_modulo AS t1
|
|
|
|
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
|
|
|
WHERE t1.id_agente = ' . $id . ' AND id_module_group = ' . $id_father;
|
|
|
|
break;
|
|
|
|
case 'policies':
|
|
|
|
$whereQuery = '';
|
|
|
|
if ($id_father != 0)
|
|
|
|
$whereQuery = ' AND t1.id_policy_module IN
|
|
|
|
(SELECT id FROM tpolicy_modules WHERE id_policy = ' . $id_father . ')';
|
2012-07-16 15:48:59 +02:00
|
|
|
else
|
|
|
|
$whereQuery = ' AND t1.id_policy_module = 0 ';
|
2012-04-12 18:49:33 +02:00
|
|
|
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM tagente_modulo AS t1
|
|
|
|
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
|
|
|
WHERE t1.id_agente = ' . $id . $whereQuery;
|
|
|
|
break;
|
|
|
|
case 'module':
|
2012-06-11 17:48:49 +02:00
|
|
|
$name = str_replace(array('_articapandora_'.ord(' ').'_pandoraartica_', '_articapandora_'.ord('#').'_pandoraartica_','_articapandora_'.ord('/').'_pandoraartica_'),array(' ','#','/'),$id_father);
|
2012-04-12 18:49:33 +02:00
|
|
|
switch ($config["dbtype"]) {
|
|
|
|
case "mysql":
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM tagente_modulo AS t1
|
|
|
|
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
2012-06-11 17:48:49 +02:00
|
|
|
WHERE t1.id_agente = ' . $id . ' AND nombre = \'' . io_safe_input($name) . '\'';
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case "postgresql":
|
|
|
|
case "oracle":
|
|
|
|
$sql = 'SELECT *
|
|
|
|
FROM tagente_modulo AS t1
|
|
|
|
INNER JOIN tagente_estado AS t2 ON t1.id_agente_modulo = t2.id_agente_modulo
|
2012-06-11 17:48:49 +02:00
|
|
|
WHERE t1.id_agente = ' . $id . ' AND nombre = \'' . io_safe_input($name) . '\'';
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// This line checks for initializated modules or (non-initialized) asyncronous modules
|
|
|
|
$sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23))';
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
|
|
|
|
$rows = db_get_all_rows_sql($sql);
|
|
|
|
$countRows = count ($rows);
|
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
if ($countRows === 0) {
|
|
|
|
echo "<ul style='margin: 0; padding: 0;'>\n";
|
|
|
|
echo "<li style='margin: 0; padding: 0;'>";
|
|
|
|
switch ($lessBranchs) {
|
|
|
|
case 0:
|
2012-09-18 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js,
godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_list.list.php,
godmode/gis_maps/configure_gis_map.php,
include/functions_visual_map_editor.php, include/functions_ui.php,
operation/tree.php, operation/agentes/exportdata.excel.php,
operation/agentes/exportdata.php, operation/agentes/ver_agente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/ajax.php, operation/events/events_validate.php,
operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/reporting_viewer.php,
operation/netflow/nf_live_view.php,
operation/incidents/incident.php, operation/search_modules.php:
started to use the new function "ui_print_agent_autocomplete_input"
to make more easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6983 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-18 13:28:09 +02:00
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2012-09-18 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js,
godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_list.list.php,
godmode/gis_maps/configure_gis_map.php,
include/functions_visual_map_editor.php, include/functions_ui.php,
operation/tree.php, operation/agentes/exportdata.excel.php,
operation/agentes/exportdata.php, operation/agentes/ver_agente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/ajax.php, operation/events/events_validate.php,
operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/reporting_viewer.php,
operation/netflow/nf_live_view.php,
operation/incidents/incident.php, operation/search_modules.php:
started to use the new function "ui_print_agent_autocomplete_input"
to make more easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6983 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-18 13:28:09 +02:00
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-09-18 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js,
godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_list.list.php,
godmode/gis_maps/configure_gis_map.php,
include/functions_visual_map_editor.php, include/functions_ui.php,
operation/tree.php, operation/agentes/exportdata.excel.php,
operation/agentes/exportdata.php, operation/agentes/ver_agente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/ajax.php, operation/events/events_validate.php,
operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/reporting_viewer.php,
operation/netflow/nf_live_view.php,
operation/incidents/incident.php, operation/search_modules.php:
started to use the new function "ui_print_agent_autocomplete_input"
to make more easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6983 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-18 13:28:09 +02:00
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2012-09-18 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js,
godmode/alerts/alert_list.builder.php,
godmode/alerts/alert_list.list.php,
godmode/gis_maps/configure_gis_map.php,
include/functions_visual_map_editor.php, include/functions_ui.php,
operation/tree.php, operation/agentes/exportdata.excel.php,
operation/agentes/exportdata.php, operation/agentes/ver_agente.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
operation/gis_maps/ajax.php, operation/events/events_validate.php,
operation/messages/message_edit.php,
operation/messages/message_list.php,
operation/reporting/reporting_viewer.php,
operation/netflow/nf_live_view.php,
operation/incidents/incident.php, operation/search_modules.php:
started to use the new function "ui_print_agent_autocomplete_input"
to make more easy (and standar) the autocomplete agent input.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6983 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-09-18 13:28:09 +02:00
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
echo "<i>" . __("Empty") . "</i>";
|
|
|
|
echo "</li>";
|
|
|
|
echo "</ul>";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$count = 0;
|
|
|
|
echo "<ul style='margin: 0; padding: 0;'>\n";
|
2012-11-20 Ramon Novoa <rnovoa@artica.es>
* include/functions_groups.php,
include/functions_agents.php,
include/functions_modules.php,
include/functions_treeview.php,
include/functions_os.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
install.php,
pandoradb.oracle.sql,
operation/tree.php,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql: Improved tree
view performance.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-11-20 17:14:45 +01:00
|
|
|
foreach ($rows as $row) {
|
2012-04-12 18:49:33 +02:00
|
|
|
$count++;
|
|
|
|
echo "<li style='margin: 0; padding: 0;'><span style='min-width: 300px; display: inline-block;'>";
|
2012-07-18 16:31:58 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
switch ($lessBranchs) {
|
|
|
|
case 0:
|
2012-09-21 13:24:16 +02:00
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2012-09-21 13:24:16 +02:00
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-09-21 13:24:16 +02:00
|
|
|
html_print_image ("operation/tree/branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2012-09-21 13:24:16 +02:00
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
|
|
|
html_print_image ("operation/tree/no_branch.png", false, array ("style" => 'vertical-align: middle;'));
|
2012-04-12 18:49:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($countRows != $count)
|
2012-04-16 19:26:01 +02:00
|
|
|
html_print_image ("operation/tree/leaf.png", false, array ("style" => 'vertical-align: middle;', "id" => "tree_image_os_" . $row["id_agente"], "pos_tree" => "1" ));
|
2012-04-12 18:49:33 +02:00
|
|
|
else
|
2012-04-16 19:26:01 +02:00
|
|
|
html_print_image ("operation/tree/last_leaf.png", false, array ("style" => 'vertical-align: middle;', "id" => "tree_image_os_" . $row["id_agente"], "pos_tree" => "2" ));
|
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/reporting/reporting_xml.php,
operation/netflow/nf_live_view.php, operation/netflow/nf_view.php,
operation/tree.php, operation/agentes/gis_view.php,
operation/agentes/estado_monitores.php,
operation/agentes/networkmap.php,
operation/agentes/datos_agente.php,
operation/agentes/alerts_status.php, operation/menu.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/servers/manage_recontask.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_special_days.php, godmode/setup/links.php,
godmode/setup/os.php, godmode/users/configure_profile.php,
godmode/events/events.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/graph_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_menu.php, include/functions_visual_map.php,
include/functions_db.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
// This line checks for (non-initialized) asyncronous modules
|
|
|
|
if ($row["estado"] == 0 AND $row["utimestamp"] == 0 AND ($row["id_tipo_modulo"] >= 21 AND $row["id_tipo_modulo"] <= 23)){
|
|
|
|
$status = STATUS_MODULE_NO_DATA;
|
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/reporting/reporting_xml.php,
operation/netflow/nf_live_view.php, operation/netflow/nf_view.php,
operation/tree.php, operation/agentes/gis_view.php,
operation/agentes/estado_monitores.php,
operation/agentes/networkmap.php,
operation/agentes/datos_agente.php,
operation/agentes/alerts_status.php, operation/menu.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/servers/manage_recontask.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_special_days.php, godmode/setup/links.php,
godmode/setup/os.php, godmode/users/configure_profile.php,
godmode/events/events.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/graph_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_menu.php, include/functions_visual_map.php,
include/functions_db.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
|
|
|
$title = __('UNKNOWN');
|
|
|
|
} // Else checks module status
|
2012-04-12 18:49:33 +02:00
|
|
|
elseif ($row["estado"] == 1) {
|
|
|
|
$status = STATUS_MODULE_CRITICAL;
|
|
|
|
$title = __('CRITICAL');
|
|
|
|
}
|
|
|
|
elseif ($row["estado"] == 2) {
|
|
|
|
$status = STATUS_MODULE_WARNING;
|
|
|
|
$title = __('WARNING');
|
|
|
|
}
|
|
|
|
elseif ($row["estado"] == 3) {
|
|
|
|
$status = STATUS_MODULE_NO_DATA;
|
|
|
|
$title = __('UNKNOWN');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$status = STATUS_MODULE_OK;
|
|
|
|
$title = __('NORMAL');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_numeric($row["datos"])) {
|
|
|
|
$title .= " : " . format_for_graph($row["datos"]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$title .= " : " . substr(io_safe_output($row["datos"]),0,42);
|
|
|
|
}
|
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/reporting/reporting_xml.php,
operation/netflow/nf_live_view.php, operation/netflow/nf_view.php,
operation/tree.php, operation/agentes/gis_view.php,
operation/agentes/estado_monitores.php,
operation/agentes/networkmap.php,
operation/agentes/datos_agente.php,
operation/agentes/alerts_status.php, operation/menu.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/servers/manage_recontask.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_special_days.php, godmode/setup/links.php,
godmode/setup/os.php, godmode/users/configure_profile.php,
godmode/events/events.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/graph_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_menu.php, include/functions_visual_map.php,
include/functions_db.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
echo str_replace('.png' ,'_ball.png',
|
|
|
|
str_replace('img', 'img style="vertical-align: middle;"', ui_print_status_image($status, $title,true))
|
|
|
|
);
|
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/reporting/reporting_xml.php,
operation/netflow/nf_live_view.php, operation/netflow/nf_view.php,
operation/tree.php, operation/agentes/gis_view.php,
operation/agentes/estado_monitores.php,
operation/agentes/networkmap.php,
operation/agentes/datos_agente.php,
operation/agentes/alerts_status.php, operation/menu.php,
operation/snmpconsole/snmp_view.php, operation/users/user_edit.php,
godmode/groups/configure_group.php,
godmode/groups/configure_modu_group.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/servers/manage_recontask.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_special_days.php, godmode/setup/links.php,
godmode/setup/os.php, godmode/users/configure_profile.php,
godmode/events/events.php,
godmode/massive/massive_delete_modules.php,
godmode/massive/massive_edit_modules.php,
godmode/massive/massive_standby_alerts.php,
godmode/massive/massive_add_action_alerts.php,
godmode/massive/massive_enable_disable_alerts.php,
godmode/massive/massive_operations.php,
godmode/massive/massive_delete_profiles.php,
godmode/modules/manage_network_components.php,
godmode/modules/manage_nc_groups.php,
godmode/reporting/graph_builder.php,
godmode/reporting/reporting_builder.item_editor.php,
include/functions_menu.php, include/functions_visual_map.php,
include/functions_db.php: cleaned source code style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6759 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-07-10 12:38:02 +02:00
|
|
|
echo " ";
|
2012-04-12 18:49:33 +02:00
|
|
|
echo str_replace('img', 'img style="vertical-align: middle;"', servers_show_type ($row['id_modulo']));
|
|
|
|
echo " ";
|
|
|
|
$graph_type = return_graphtype ($row["id_tipo_modulo"]);
|
|
|
|
$win_handle=dechex(crc32($row["id_agente_modulo"] . $row["nombre"]));
|
|
|
|
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=86400&id=".$row["id_agente_modulo"]."&label=".base64_encode($row["nombre"])."&refresh=600','day_".$win_handle."')";
|
|
|
|
echo '<a href="javascript:'.$link.'">' . html_print_image ("images/chart_curve.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . '</a>';
|
|
|
|
echo " ";
|
|
|
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" . $row['id_agente'] . "&tab=data_view&period=86400&id=".$row["id_agente_modulo"]."'>" . html_print_image ("images/binary.png", true, array ("style" => 'vertical-align: middle;', "border" => "0" )) . "</a>";
|
|
|
|
echo " ";
|
|
|
|
echo io_safe_output($row['nombre']);
|
2012-08-22 16:09:05 +02:00
|
|
|
if ($row['quiet']) {
|
|
|
|
echo " ";
|
|
|
|
html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => ""));
|
|
|
|
}
|
2012-04-12 18:49:33 +02:00
|
|
|
|
|
|
|
if (is_numeric($row["datos"]))
|
|
|
|
$data = format_numeric($row["datos"]);
|
|
|
|
else
|
|
|
|
$data = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(io_safe_output($row["datos"]),0,12)."</span>";
|
|
|
|
|
|
|
|
echo "</span><span style='margin-left: 20px;'>";
|
|
|
|
echo $data;
|
2012-04-24 18:53:11 +02:00
|
|
|
if ($row['unit'] != '') {
|
|
|
|
echo " ";
|
|
|
|
echo '('.$row['unit'].')';
|
|
|
|
}
|
2012-04-12 18:49:33 +02:00
|
|
|
if ($row['utimestamp'] != '') {
|
2012-04-19 11:54:03 +02:00
|
|
|
echo " ";
|
2012-04-16 19:26:01 +02:00
|
|
|
ui_print_help_tip ($row["timestamp"], '', 'images/clock2.png');
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
|
|
|
echo "</span></li>";
|
|
|
|
}
|
|
|
|
echo "</ul>\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2012-08-22 16:09:05 +02:00
|
|
|
//End of AJAX code.
|
2012-04-16 09:46:13 +02:00
|
|
|
|
2012-04-12 18:49:33 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_groups.php");
|
2012-06-07 13:44:08 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_os.php");
|
2012-06-07 16:29:00 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_modules.php");
|
2012-04-12 18:49:33 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_servers.php");
|
|
|
|
include_once($config['homedir'] . "/include/functions_reporting.php");
|
2012-04-16 12:18:41 +02:00
|
|
|
include_once($config['homedir'] . "/include/functions_ui.php");
|
2012-04-12 18:49:33 +02:00
|
|
|
|
2012-04-16 19:26:01 +02:00
|
|
|
global $config;
|
|
|
|
|
|
|
|
$enterpriseEnable = false;
|
|
|
|
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
|
|
|
|
$enterpriseEnable = true;
|
|
|
|
}
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
///////// INI MENU AND TABS /////////////
|
2012-04-16 19:26:01 +02:00
|
|
|
$img_style = array ("class" => "top", "width" => 16);
|
|
|
|
$activeTab = get_parameter('sort_by','group');
|
|
|
|
|
|
|
|
$os_tab = array('text' => "<a href='index.php?sec=estado&sec2=operation/tree&refr=0&sort_by=os'>"
|
2012-07-18 16:31:58 +02:00
|
|
|
. html_print_image ("images/computer.png", true, array ("title" => __('OS'))) . "</a>", 'active' => $activeTab == "os");
|
2012-04-16 19:26:01 +02:00
|
|
|
|
|
|
|
$group_tab = array('text' => "<a href='index.php?sec=estado&sec2=operation/tree&refr=0&sort_by=group'>"
|
2012-07-18 16:31:58 +02:00
|
|
|
. html_print_image ("images/group.png", true, array ("title" => __('Groups'))) . "</a>", 'active' => $activeTab == "group");
|
2012-04-16 19:26:01 +02:00
|
|
|
|
|
|
|
$module_group_tab = array('text' => "<a href='index.php?sec=estado&sec2=operation/tree&refr=0&sort_by=module_group'>"
|
2012-07-18 16:31:58 +02:00
|
|
|
. html_print_image ("images/agents_group.png", true, array ("title" => __('Module groups'))) . "</a>", 'active' => $activeTab == "module_group");
|
2012-04-16 19:26:01 +02:00
|
|
|
|
|
|
|
if ($enterpriseEnable) {
|
|
|
|
$policies_tab = array('text' => "<a href='index.php?sec=estado&sec2=operation/tree&refr=0&sort_by=policies'>"
|
2012-07-18 16:31:58 +02:00
|
|
|
. html_print_image ("images/policies.png", true, array ("title" => __('Policies'))) . "</a>", 'active' => $activeTab == "policies");
|
|
|
|
}
|
|
|
|
else {
|
2012-04-16 19:26:01 +02:00
|
|
|
$policies_tab = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$module_tab = array('text' => "<a href='index.php?extension_in_menu=estado&sec=estado&sec2=operation/tree&refr=0&sort_by=module'>"
|
2012-07-18 16:31:58 +02:00
|
|
|
. html_print_image ("images/brick.png", true, array ("title" => __('Modules'))) . "</a>", 'active' => $activeTab == "module");
|
2012-04-16 19:26:01 +02:00
|
|
|
|
|
|
|
$onheader = array('os' => $os_tab, 'group' => $group_tab, 'module_group' => $module_group_tab, 'policies' => $policies_tab, 'module' => $module_tab);
|
2012-06-20 17:50:15 +02:00
|
|
|
|
|
|
|
switch ($activeTab) {
|
|
|
|
case 'group':
|
|
|
|
$order = __('groups');
|
|
|
|
break;
|
|
|
|
case 'module_group':
|
|
|
|
$order = __('module groups');
|
|
|
|
break;
|
|
|
|
case 'policies':
|
|
|
|
$order = __('policies');
|
|
|
|
break;
|
|
|
|
case 'module':
|
|
|
|
$order = __('modules');
|
|
|
|
break;
|
|
|
|
case 'os':
|
|
|
|
$order = __('OS');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ui_print_page_header (__('Tree view')." - ".__('Sort the agents by ') .$order, "images/extensions.png", false, "", false, $onheader);
|
2012-04-16 19:26:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
echo "<br>";
|
2012-07-12 20:10:44 +02:00
|
|
|
echo '<form id="tree_search" method="post" action="index.php?extension_in_menu=estado&sec=estado&sec2=operation/tree&refr=0&sort_by='.$activeTab.'">';
|
|
|
|
echo "<b>" . __('Agent status') . "</b>";
|
2012-04-16 19:26:01 +02:00
|
|
|
|
|
|
|
$search_free = get_parameter('search_free', '');
|
|
|
|
$select_status = get_parameter('status', -1);
|
|
|
|
|
|
|
|
$fields = array ();
|
|
|
|
$fields[ALL] = __('All'); //default
|
|
|
|
$fields[NORMAL] = __('Normal');
|
|
|
|
$fields[WARNING] = __('Warning');
|
|
|
|
$fields[CRITICAL] = __('Critical');
|
|
|
|
$fields[UNKNOWN] = __('Unknown');
|
|
|
|
|
|
|
|
html_print_select ($fields, "status", $select_status);
|
|
|
|
|
|
|
|
echo " ";
|
2012-07-12 20:10:44 +02:00
|
|
|
echo "<b>" . __('Search agent') . "</b>";
|
2012-04-16 19:26:01 +02:00
|
|
|
echo " ";
|
|
|
|
html_print_input_text ("search_free", $search_free, '', 40,30, false);
|
|
|
|
echo " ";
|
|
|
|
html_print_submit_button (__('Show'), "uptbutton", false, 'class="sub search"');
|
|
|
|
echo "</form>";
|
|
|
|
echo "<div class='pepito' id='a'></div>";
|
|
|
|
echo "<div class='pepito' id='b'></div>";
|
|
|
|
echo "<div class='pepito' id='c'></div>";
|
2012-08-22 16:09:05 +02:00
|
|
|
///////// END MENU AND TABS /////////////
|
|
|
|
|
|
|
|
|
2012-04-16 19:26:01 +02:00
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
treeview_printTree($activeTab);
|
2012-04-16 19:26:01 +02:00
|
|
|
?>
|
|
|
|
|
|
|
|
<script language="javascript" type="text/javascript">
|
2012-04-12 18:49:33 +02:00
|
|
|
|
2012-06-20 10:28:34 +02:00
|
|
|
var status = $('#status').val();
|
|
|
|
var search_free = $('#text-search_free').val();
|
2012-07-18 16:31:58 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* loadSubTree asincronous load ajax the agents or modules (pass type, id to search and binary structure of branch),
|
|
|
|
* change the [+] or [-] image (with same more or less div id) of tree and anime (for show or hide)
|
|
|
|
* the div with id "div[id_father]_[type]_[div_id]"
|
|
|
|
*
|
|
|
|
* type string use in js and ajax php
|
|
|
|
* div_id int use in js and ajax php
|
|
|
|
* less_branchs int use in ajax php as binary structure 0b00, 0b01, 0b10 and 0b11
|
|
|
|
* id_father int use in js and ajax php, its useful when you have a two subtrees with same agent for diferent each one
|
|
|
|
*/
|
|
|
|
function loadSubTree(type, div_id, less_branchs, id_father) {
|
|
|
|
hiddenDiv = $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('hiddenDiv');
|
|
|
|
loadDiv = $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('loadDiv');
|
2012-09-21 13:24:16 +02:00
|
|
|
pos = parseInt($('#tree_image'+id_father+'_'+type+'_'+div_id).attr('pos_tree'));
|
2012-07-18 16:31:58 +02:00
|
|
|
|
|
|
|
//If has yet ajax request running
|
|
|
|
if (loadDiv == 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (loadDiv == 0) {
|
2012-04-12 18:49:33 +02:00
|
|
|
|
2012-07-18 16:31:58 +02:00
|
|
|
//Put an spinner to simulate loading process
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).html("<img style='padding-top:10px;padding-bottom:10px;padding-left:20px;' src=images/spinner.gif>");
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).show('normal');
|
2012-04-12 18:49:33 +02:00
|
|
|
|
2012-07-18 16:31:58 +02:00
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).attr('loadDiv', 2);
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "ajax.php",
|
|
|
|
data: "page=<?php echo $_GET['sec2']; ?>&ajax_treeview=1&type=" +
|
|
|
|
type + "&id=" + div_id + "&less_branchs=" + less_branchs + "&id_father=" + id_father + "&status=" + status + "&search_free=" + search_free,
|
|
|
|
success: function(msg){
|
|
|
|
if (msg.length != 0) {
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).hide();
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).html(msg);
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).show('normal');
|
|
|
|
|
|
|
|
//change image of tree [+] to [-]
|
|
|
|
switch (pos) {
|
|
|
|
case 0:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/first_expanded.png');
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/one_expanded.png');
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/expanded.png');
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/last_expanded.png');
|
|
|
|
break;
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).attr('hiddendiv',0);
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).attr('loadDiv', 1);
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
});
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
else {
|
|
|
|
if (hiddenDiv == 0) {
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).hide('normal');
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).attr('hiddenDiv',1);
|
|
|
|
|
|
|
|
//change image of tree [-] to [+]
|
|
|
|
switch (pos) {
|
|
|
|
case 0:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/first_closed.png');
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/one_closed.png');
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/closed.png');
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/last_closed.png');
|
|
|
|
break;
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
//change image of tree [+] to [-]
|
|
|
|
switch (pos) {
|
|
|
|
case 0:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/first_expanded.png');
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/one_expanded.png');
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/expanded.png');
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
$('#tree_image'+id_father+'_'+type+'_'+div_id).attr('src','operation/tree/last_expanded.png');
|
|
|
|
break;
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).show('normal');
|
|
|
|
$('#tree_div'+id_father+'_'+type+'_'+div_id).attr('hiddenDiv',0);
|
|
|
|
}
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function changeStatus(newStatus) {
|
|
|
|
status = newStatus;
|
2012-04-12 18:49:33 +02:00
|
|
|
|
2012-07-18 16:31:58 +02:00
|
|
|
//reset all subtree
|
|
|
|
$(".tree_view").each(
|
|
|
|
function(i) {
|
|
|
|
$(this).attr('loadDiv', 0);
|
|
|
|
$(this).attr('hiddenDiv',1);
|
|
|
|
$(this).hide();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
//clean all subtree
|
|
|
|
$(".tree_view").each(
|
|
|
|
function(i) {
|
|
|
|
$(this).html('');
|
|
|
|
}
|
|
|
|
);
|
2012-04-12 18:49:33 +02:00
|
|
|
}
|
2012-07-18 16:31:58 +02:00
|
|
|
|
|
|
|
function loadTable(type, div_id, less_branchs, id_father) {
|
|
|
|
id_agent = div_id;
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "ajax.php",
|
|
|
|
data: "page=<?php echo $_GET['sec2']; ?>&printTable=1&id_agente=" +
|
|
|
|
id_agent, success: function(data){
|
2012-08-22 16:09:05 +02:00
|
|
|
$('#cont').html(data);
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-08-22 16:09:05 +02:00
|
|
|
loadSubTree(type, div_id, less_branchs, id_father);
|
2012-07-18 16:31:58 +02:00
|
|
|
}
|
|
|
|
</script>
|