2010-04-06 18:24:54 +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.
2011-05-30 19:04:34 +02:00
global $config ;
2015-06-11 12:08:02 +02:00
require_once ( $config [ 'homedir' ] . '/include/functions_agents.php' );
include_once ( $config [ 'homedir' ] . '/include/functions_reporting.php' );
2011-05-30 19:04:34 +02:00
enterprise_include_once ( 'include/functions_metaconsole.php' );
2010-04-06 18:24:54 +02:00
2015-06-11 12:08:02 +02:00
// Clean the possible blanks introduced by the included files
ob_clean ();
2010-04-06 18:24:54 +02:00
// Get list of agent + ip
// Params:
// * search_agents 1
// * id_agent
// * q
// * id_group
$search_agents = ( bool ) get_parameter ( 'search_agents' );
2012-03-12 17:23:50 +01:00
$get_agents_group = ( bool ) get_parameter ( 'get_agents_group' , false );
2012-12-11 18:39:48 +01:00
$force_local = ( bool ) get_parameter ( 'force_local' , false );
2015-09-09 15:01:12 +02:00
if ( https_is_running () ) {
header ( 'Content-type: application/json' );
}
2012-03-12 17:23:50 +01:00
if ( $get_agents_group ) {
2015-06-11 12:08:02 +02:00
$id_group = ( int ) get_parameter ( 'id_group' , - 1 );
$mode = ( string ) get_parameter ( 'mode' , 'json' );
$id_server = ( int ) get_parameter ( 'id_server' , 0 );
2015-08-05 10:36:35 +02:00
$serialized = ( bool ) get_parameter ( 'serialized' );
2012-03-12 17:23:50 +01:00
$return = array ();
if ( $id_group != - 1 ) {
2015-04-23 21:14:24 +02:00
$filter = array ();
2015-08-05 10:36:35 +02:00
if ( is_metaconsole () && ! empty ( $id_server )) {
2015-04-23 21:14:24 +02:00
$filter [ 'id_server' ] = $id_server ;
2015-07-08 16:39:52 +02:00
}
2015-04-23 21:14:24 +02:00
2015-08-05 10:36:35 +02:00
$return = agents_get_group_agents ( $id_group , $filter , " none " , false , false , $serialized );
2012-03-12 17:23:50 +01:00
}
switch ( $mode ) {
case 'json' :
2015-08-05 10:36:35 +02:00
default :
2012-03-12 17:23:50 +01:00
echo json_encode ( $return );
break ;
}
return ;
}
2010-04-06 18:24:54 +02:00
2015-08-05 10:36:35 +02:00
if ( $search_agents && ( ! is_metaconsole () || $force_local )) {
2012-09-12 17:53:58 +02:00
2015-06-11 12:08:02 +02:00
$id_agent = ( int ) get_parameter ( 'id_agent' );
$string = ( string ) get_parameter ( 'q' ); /* q is what autocomplete plugin gives */
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
$id_group = ( int ) get_parameter ( 'id_group' , - 1 );
$addedItems = html_entity_decode (( string ) get_parameter ( 'add' ));
$addedItems = json_decode ( $addedItems );
$all = ( string ) get_parameter ( 'all' , 'all' );
2012-09-12 17:53:58 +02:00
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
if ( $addedItems != null ) {
foreach ( $addedItems as $item ) {
echo $item . " | \n " ;
}
}
2012-09-12 17:53:58 +02:00
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
$filter = array ();
2012-09-12 17:53:58 +02:00
2012-12-20 11:09:52 +01:00
if ( $id_group != - 1 ) {
2013-07-16 11:09:50 +02:00
if ( $id_group == 0 ) {
2012-12-20 11:09:52 +01:00
$user_groups = users_get_groups ( $config [ 'id_user' ], " AR " , true );
2013-02-07 16:53:04 +01:00
2012-12-20 11:09:52 +01:00
$filter [ 'id_grupo' ] = array_keys ( $user_groups );
}
else {
$filter [ 'id_grupo' ] = $id_group ;
}
}
2012-09-12 17:53:58 +02:00
2016-05-25 15:30:46 +02:00
if ( $all === 'enabled' ) {
$filter [ 'disabled' ] = 1 ;
}
else {
$filter [ 'disabled' ] = 0 ;
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
}
2012-09-12 17:53:58 +02:00
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
$data = array ();
2017-02-24 13:41:59 +01:00
//Get agents for only the alias
$filter_alias = $filter ;
2013-02-07 16:53:04 +01:00
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_alias [] = '(alias LIKE "%' . $string . '%")' ;
2013-02-07 16:53:04 +01:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_alias [] = '(alias LIKE \'%' . $string . '%\')' ;
2013-02-07 16:53:04 +01:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_alias [] = '(UPPER(alias) LIKE UPPER(\'%' . $string . '%\'))' ;
2013-02-07 16:53:04 +01:00
break ;
}
2017-02-24 13:41:59 +01:00
$agents = agents_get_agents ( $filter_alias , array ( 'id_agente' , 'nombre' , 'direccion' , 'alias' ));
2013-02-07 16:53:04 +01:00
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
2017-02-24 13:41:59 +01:00
'alias' => io_safe_output ( $agent [ 'alias' ]),
2013-02-07 16:53:04 +01:00
'ip' => io_safe_output ( $agent [ 'direccion' ]),
2017-02-24 13:41:59 +01:00
'filter' => 'alias' );
2013-02-07 16:53:04 +01:00
}
}
2017-02-24 13:41:59 +01:00
//Get agents for only the name.
$filter_agents = $filter ;
2013-02-07 16:53:04 +01:00
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_agents [] = '(alias NOT LIKE "%' . $string . '%" AND nombre COLLATE utf8_general_ci LIKE "%' . $string . '%")' ;
2013-02-07 16:53:04 +01:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_agents [] = '(alias NOT LIKE \'%' . $string . '%\' AND nombre LIKE \'%' . $string . '%\')' ;
2013-02-07 16:53:04 +01:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_agents [] = '(UPPER(alias) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(nombre) LIKE UPPER(\'%' . $string . '%\'))' ;
2013-02-07 16:53:04 +01:00
break ;
}
2017-02-24 13:41:59 +01:00
$agents = agents_get_agents ( $filter_agents , array ( 'id_agente' , 'nombre' , 'direccion' , 'alias' ));
2013-02-07 16:53:04 +01:00
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
2017-02-24 13:41:59 +01:00
'alias' => io_safe_output ( $agent [ 'alias' ]),
2013-02-07 16:53:04 +01:00
'ip' => io_safe_output ( $agent [ 'direccion' ]),
2017-02-24 13:41:59 +01:00
'filter' => 'agent' );
2013-02-07 16:53:04 +01:00
}
}
2017-02-24 13:41:59 +01:00
//Get agents for only the address
$filter_address = $filter ;
2013-02-07 16:53:04 +01:00
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_address [] = '(alias NOT LIKE "%' . $string . '%" AND nombre COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND direccion LIKE "%' . $string . '%")' ;
2013-02-07 16:53:04 +01:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_address [] = '(alias NOT LIKE \'%' . $string . '%\' AND nombre NOT LIKE \'%' . $string . '%\' AND direccion LIKE \'%' . $string . '%\')' ;
2013-02-07 16:53:04 +01:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_address [] = '(UPPER(alias) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(nombre) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(direccion) LIKE UPPER(\'%' . $string . '%\'))' ;
2013-02-07 16:53:04 +01:00
break ;
}
2017-02-24 13:41:59 +01:00
$agents = agents_get_agents ( $filter_address , array ( 'id_agente' , 'nombre' , 'direccion' , 'alias' ));
2013-02-07 16:53:04 +01:00
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
2016-09-22 10:27:35 +02:00
'alias' => io_safe_output ( $agent [ 'alias' ]),
2013-02-07 16:53:04 +01:00
'ip' => io_safe_output ( $agent [ 'direccion' ]),
2017-02-24 13:41:59 +01:00
'filter' => 'address' );
2013-02-07 16:53:04 +01:00
}
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
}
2017-02-24 13:41:59 +01:00
//Get agents for only the description
2016-09-22 10:27:35 +02:00
$filter_description = $filter ;
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_description [] = '(alias NOT LIKE "%' . $string . '%" AND nombre COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND direccion NOT LIKE "%' . $string . '%" AND comentarios LIKE "%' . $string . '%")' ;
2016-09-22 10:27:35 +02:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_description [] = '(alias NOT LIKE \'%' . $string . '%\' AND nombre NOT LIKE \'%' . $string . '%\' AND direccion NOT LIKE \'%' . $string . '%\' AND comentarios LIKE \'%' . $string . '%\')' ;
2016-09-22 10:27:35 +02:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_description [] = '(UPPER(alias) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(nombre) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(direccion) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(comentarios) LIKE UPPER(\'%' . $string . '%\'))' ;
2016-09-22 10:27:35 +02:00
break ;
}
$agents = agents_get_agents ( $filter_description , array ( 'id_agente' , 'nombre' , 'direccion' , 'alias' ));
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
'alias' => io_safe_output ( $agent [ 'alias' ]),
'ip' => io_safe_output ( $agent [ 'direccion' ]),
2017-02-24 13:41:59 +01:00
'filter' => 'description' );
2016-09-22 10:27:35 +02:00
}
}
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
echo json_encode ( $data );
return ;
}
2015-08-05 10:36:35 +02:00
elseif ( $search_agents && is_metaconsole ()) {
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
2012-11-29 17:14:45 +01:00
$id_agent = ( int ) get_parameter ( 'id_agent' );
$string = ( string ) get_parameter ( 'q' ); /* q is what autocomplete plugin gives */
2012-12-20 11:09:52 +01:00
$id_group = ( int ) get_parameter ( 'id_group' , - 1 );
2012-11-29 17:14:45 +01:00
$addedItems = html_entity_decode (( string ) get_parameter ( 'add' ));
$addedItems = json_decode ( $addedItems );
2015-06-11 11:02:17 +02:00
$all = ( string ) get_parameter ( 'all' , 'all' );
2012-11-29 17:14:45 +01:00
if ( $addedItems != null ) {
foreach ( $addedItems as $item ) {
echo $item . " | \n " ;
}
}
2015-06-11 11:02:17 +02:00
$data = array ();
$fields = array (
2017-02-24 13:41:59 +01:00
'id_tagente AS id_agente' , 'nombre' , 'alias' ,
2015-06-11 11:02:17 +02:00
'direccion' , 'id_tmetaconsole_setup AS id_server'
);
2015-04-21 14:01:10 +02:00
$filter = array ();
2012-11-29 17:14:45 +01:00
2012-12-20 11:09:52 +01:00
if ( $id_group != - 1 ) {
2013-02-07 16:53:04 +01:00
if ( $id_group == 0 ) {
2012-12-20 11:09:52 +01:00
$user_groups = users_get_groups ( $config [ 'id_user' ], " AR " , true );
2013-02-07 16:53:04 +01:00
2012-12-20 11:09:52 +01:00
$filter [ 'id_grupo' ] = array_keys ( $user_groups );
}
else {
$filter [ 'id_grupo' ] = $id_group ;
}
}
2013-02-07 16:53:04 +01:00
2015-06-11 11:02:17 +02:00
switch ( $all ) {
case 'enabled' :
$filter [ 'disabled' ] = 0 ;
break ;
}
2015-04-21 14:01:10 +02:00
if ( ! empty ( $id_agent )) {
$filter [ 'id_agente' ] = $id_agent ;
}
if ( ! empty ( $string )) {
2017-02-24 13:41:59 +01:00
//Get agents for only the alias.
$filter_alias = $filter ;
switch ( $config [ 'dbtype' ]) {
case " mysql " :
$filter_alias [] = '(alias COLLATE utf8_general_ci LIKE "%' . $string . '%")' ;
break ;
case " postgresql " :
$filter_alias [] = '(alias LIKE \'%' . $string . '%\')' ;
break ;
case " oracle " :
$filter_alias [] = '(UPPER(alias) LIKE UPPER(\'%' . $string . '%\'))' ;
break ;
}
$agents = db_get_all_rows_filter ( 'tmetaconsole_agent' , $filter_alias , $fields );
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
'alias' => io_safe_output ( $agent [ 'alias' ]),
'ip' => io_safe_output ( $agent [ 'direccion' ]),
'id_server' => $agent [ 'id_server' ],
'filter' => 'alias' );
}
}
2013-02-07 16:53:04 +01:00
//Get agents for only the name.
2015-06-11 11:02:17 +02:00
$filter_agents = $filter ;
2013-02-07 16:53:04 +01:00
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_agents [] = '(alias COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND nombre COLLATE utf8_general_ci LIKE "%' . $string . '%")' ;
2013-02-07 16:53:04 +01:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_agents [] = '(alias NOT LIKE \'%' . $string . '%\' AND nombre LIKE \'%' . $string . '%\')' ;
2013-02-07 16:53:04 +01:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_agents [] = '(UPPER(alias) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(nombre) LIKE UPPER(\'%' . $string . '%\'))' ;
2013-02-07 16:53:04 +01:00
break ;
}
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
2015-06-11 11:02:17 +02:00
$agents = db_get_all_rows_filter ( 'tmetaconsole_agent' , $filter_agents , $fields );
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
2017-02-24 13:41:59 +01:00
'alias' => io_safe_output ( $agent [ 'alias' ]),
2015-06-11 11:02:17 +02:00
'ip' => io_safe_output ( $agent [ 'direccion' ]),
'id_server' => $agent [ 'id_server' ],
'filter' => 'agent' );
}
}
2013-02-07 16:53:04 +01:00
2015-06-11 11:02:17 +02:00
//Get agents for only the address
$filter_address = $filter ;
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_address [] = '(alias COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND nombre COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND direccion LIKE "%' . $string . '%")' ;
2015-06-11 11:02:17 +02:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_address [] = '(alias NOT LIKE \'%' . $string . '%\' AND nombre NOT LIKE \'%' . $string . '%\' AND direccion LIKE \'%' . $string . '%\')' ;
2015-06-11 11:02:17 +02:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_address [] = '(UPPER(alias) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(nombre) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(direccion) LIKE UPPER(\'%' . $string . '%\'))' ;
2015-06-11 11:02:17 +02:00
break ;
}
$agents = db_get_all_rows_filter ( 'tmetaconsole_agent' , $filter_address , $fields );
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
2017-02-24 13:41:59 +01:00
'alias' => io_safe_output ( $agent [ 'alias' ]),
2015-06-11 11:02:17 +02:00
'ip' => io_safe_output ( $agent [ 'direccion' ]),
'id_server' => $agent [ 'id_server' ],
'filter' => 'address' );
}
2015-04-21 14:01:10 +02:00
}
2015-06-11 11:02:17 +02:00
//Get agents for only the description
$filter_description = $filter ;
switch ( $config [ 'dbtype' ]) {
case " mysql " :
2017-02-24 13:41:59 +01:00
$filter_description [] = '(alias COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND nombre COLLATE utf8_general_ci NOT LIKE "%' . $string . '%" AND direccion NOT LIKE "%' . $string . '%" AND comentarios LIKE "%' . $string . '%")' ;
2015-06-11 11:02:17 +02:00
break ;
case " postgresql " :
2017-02-24 13:41:59 +01:00
$filter_description [] = '(alias NOT LIKE \'%' . $string . '%\' AND nombre NOT LIKE \'%' . $string . '%\' AND direccion NOT LIKE \'%' . $string . '%\' AND comentarios LIKE \'%' . $string . '%\')' ;
2015-06-11 11:02:17 +02:00
break ;
case " oracle " :
2017-02-24 13:41:59 +01:00
$filter_description [] = '(UPPER(alias) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(nombre) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(direccion) NOT LIKE UPPER(\'%' . $string . '%\') AND UPPER(comentarios) LIKE UPPER(\'%' . $string . '%\'))' ;
2015-06-11 11:02:17 +02:00
break ;
}
$agents = db_get_all_rows_filter ( 'tmetaconsole_agent' , $filter_description , $fields );
if ( $agents !== false ) {
foreach ( $agents as $agent ) {
$data [] = array ( 'id' => $agent [ 'id_agente' ],
'name' => io_safe_output ( $agent [ 'nombre' ]),
2017-02-24 13:41:59 +01:00
'alias' => io_safe_output ( $agent [ 'alias' ]),
2015-06-11 11:02:17 +02:00
'ip' => io_safe_output ( $agent [ 'direccion' ]),
'id_server' => $agent [ 'id_server' ],
'filter' => 'description' );
}
}
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
}
2012-09-12 17:53:58 +02:00
2012-06-12 11:21:02 +02:00
echo json_encode ( $data );
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
return ;
}
2015-06-11 12:08:02 +02:00
return ;
?>