2008-02-11 00:15:46 +01:00
< ? php
2008-08-22 20:07:32 +02:00
2009-06-08 20:21:21 +02:00
// Pandora FMS - http://pandorafms.com
// ==================================================
2010-06-01 18:24:39 +02:00
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
2009-06-08 20:21:21 +02:00
// Please see http://pandorafms.org for full contribution list
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
2008-08-22 20:07:32 +02:00
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
2019-01-30 16:18:44 +01:00
// You can redefine $url and unset $id_agente to reuse the form. Dirty (hope temporal) hack
if ( isset ( $id_agente )) {
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=' . $id_agente ;
} else {
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module' ;
2009-01-07 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions.php: Removed safe_sql_string. Cleaned documenation so
it would be parsed without errors by phpdoc
* include/functions_exportserver.php: Aggregate all exportserver functions
here.
* include/functions_db.php: Cleaned up documentation. Added
get_modulegroups and get_modulegroup_name.
* godmode/db/db_refine.php: Fixed the selection box.
* godmode/agentes/agent_disk_conf_editor.php: Added todo. Don't handle
the footer anymore
* godmode/agentes/agent_template.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/module_manager_editor_data.php,
godmode/agentes/alert_manager_editor.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager.php, godmode/agentes/agent_manager.php,
godmode/agentes/alert_manager.php:
Removed the ACL part since it was redundant due to the inclusion.
Just made sure that it was included (checking on $id_agente)
* godmode/agentes/manage_config.php,
godmode/agentes/manage_config_remote.php,
godmode/agentes/planned_downtime.php: Style fix
* godmode/agentes/configurar_agente.php
godmode/agentes/module_manager_editor_prediction.php: Fixed prediction
module creation/update bugs
* godmode/setup/links.php: No more relying on antique (PHP4) functions
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1321 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-07 16:57:33 +01:00
}
2007-02-27 20:03:56 +01:00
2019-01-30 16:18:44 +01:00
enterprise_include ( 'godmode/agentes/module_manager.php' );
$isFunctionPolicies = enterprise_include_once ( 'include/functions_policies.php' );
require_once $config [ 'homedir' ] . '/include/functions_modules.php' ;
require_once $config [ 'homedir' ] . '/include/functions_agents.php' ;
require_once $config [ 'homedir' ] . '/include/functions_servers.php' ;
2009-03-24 Esteban Sanchez <estebans@artica.es>
* general/pandora_help.php: Added support for enterprise help files.
* include/javascript/pandora.js: Renamed pandora_help() to
open_help().
* include/functions_ui.php: Renamed event function on
print_help_icon(). Removed deprecated pandora_help().
* godmode/agentes/module_manager.php: Added enterprise hooks.
* godmode/agentes/module_manager_editor.php: Added categories
construction here. Added enterprise hooks.
* godmode/agentes/module_manager_editor_common.php: Replaced
deprecated pandora_help() with print_help_icon(). Moved categories
construction to module_manager_editor.
* include/config_process.php: Updated build version.
* include/styles/pandora.css: Fixed textarea height.
* godmode/agentes/manage_config_remote.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_edit_modules.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/planned_downtime.php, godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_compound.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/map_builder.php,
godmode/servers/manage_export_form.php,
godmode/servers/manage_recontask_form.php, godmode/servers/plugin.php,
godmode/setup/setup.php, operation/agentes/alerts_status.php,
operation/agentes/tactical.php,
godmode/agentes/agent_manager.php: Replaced deprecated pandora_help()
with print_help_icon().
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1557 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-24 16:38:54 +01:00
2019-01-30 16:18:44 +01:00
$search_string = io_safe_output ( urldecode ( trim ( get_parameter ( 'search_string' , '' ))));
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
2016-08-17 11:59:06 +02:00
global $policy_page ;
2019-01-30 16:18:44 +01:00
if ( ! isset ( $policy_page )) {
$policy_page = false ;
}
2016-08-17 11:59:06 +02:00
2012-05-14 16:24:29 +02:00
// Search string filter form
2019-01-30 16:18:44 +01:00
if (( $policy_page ) || ( isset ( $agent ))) {
echo '<form id="" method="post" action="">' ;
} else {
echo '<form id="create_module_type" method="post" action="' . $url . '">' ;
}
2015-04-01 13:24:53 +02:00
echo '<table width="100%" cellpadding="2" cellspacing="2" class="databox filters" >' ;
2015-04-23 17:52:16 +02:00
echo " <tr><td class='datos' style='width:20%; font-weight: bold;'> " ;
2019-01-30 16:18:44 +01:00
echo __ ( 'Search' ) . ' ' . html_print_input_text ( 'search_string' , $search_string , '' , 15 , 255 , true );
html_print_input_hidden ( 'search' , 1 );
echo '</td>' ;
2017-10-04 18:01:01 +02:00
echo " <td class='datos' style='width:10%'> " ;
2019-01-30 16:18:44 +01:00
html_print_submit_button ( __ ( 'Filter' ), 'filter' , false , 'class="sub search"' );
echo '</td>' ;
2017-10-04 18:01:01 +02:00
echo " <td class='datos' style='width:10%'></td> " ;
2016-08-17 11:59:06 +02:00
echo '</form>' ;
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo
2019-01-30 16:18:44 +01:00
$network_available = db_get_sql (
' SELECT count ( * )
2013-02-13 18:47:43 +01:00
FROM tserver
2019-01-30 16:18:44 +01:00
WHERE server_type = 1 '
);
// POSTGRESQL AND ORACLE COMPATIBLE
$wmi_available = db_get_sql (
' SELECT count ( * )
2013-02-13 18:47:43 +01:00
FROM tserver
2019-01-30 16:18:44 +01:00
WHERE server_type = 6 '
);
// POSTGRESQL AND ORACLE COMPATIBLE
$plugin_available = db_get_sql (
' SELECT count ( * )
2013-02-13 18:47:43 +01:00
FROM tserver
2019-01-30 16:18:44 +01:00
WHERE server_type = 4 '
);
// POSTGRESQL AND ORACLE COMPATIBLE
$prediction_available = db_get_sql (
' SELECT count ( * )
2013-02-13 18:47:43 +01:00
FROM tserver
2019-01-30 16:18:44 +01:00
WHERE server_type = 5 '
);
// POSTGRESQL AND ORACLE COMPATIBLE
2008-03-06 Sancho Lerena <slerena@gmail.com>
Pandora FMS 2.0 development first commit. 1.4 version is now 2.0
* pandoradb_data.sql: Added correct tnetwork_components, fixed
ttipo_modulo (categoria values).
* include/styles/pandora.css: Added some server icons, tab style
for module editor has been improved.
* include/functions_db.php: added new functions, lang_string and
check_login, and a first review of several functions that currently
need change for new config session parameters in array $config[]
* include/javascript/pandora.js: Added a new global include for
spare javascript functions before included into a few pages.
* include/languages/language_en.php: New tokens.
* include/help*: New contextual help system.
* include/config_process.php: New way to manage config.
* include/functions.php: Added new functions to manage global
* operation/agentes/estado_ultimopaquete.php: removed old javascript
code from there.
* operation/agentes/estado_agente.php: Removed references to deprecated
field "agent_type".
* operation/agentes/tactical.php: Some code cleanup and progressbar
issues merged from 1.3.1 branch. Need to add support to new server
types and new module types.
* operation/servers/view_server.php: Added support to new servers, code
cleanup.
* reporting/fgraph.php: Code cleanup, changes to use new config method,
and a lot of style change.
* general/pandora_help.php: New source for contextual help in the way
of moodle.
* general/footer.php, general/noaccess.php: Code cleanup and uses of
new config.
* module_manager_editor: New editors for each module family. Need
finish and implement EDITION of data, now only inserts data.
* godmode/agentes/agent_manager.php: Implemented new server assigment
and edition.
* godmode/agentes/configurar_agente.php: Small changes that affects
module management, visualization and agent management.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@739 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-03-07 17:22:16 +01:00
// Development mode to use all servers
2018-07-13 11:56:37 +02:00
if ( $develop_bypass || is_metaconsole ()) {
2019-01-30 16:18:44 +01:00
$network_available = 1 ;
$wmi_available = 1 ;
$plugin_available = 1 ;
// FIXME when prediction predictions server modules can be configured
// on metaconsole
$prediction_available = is_metaconsole () ? 0 : 1 ;
2007-03-12 18:58:52 +01:00
}
2019-01-30 16:18:44 +01:00
$modules = [];
2009-03-24 Esteban Sanchez <estebans@artica.es>
* general/pandora_help.php: Added support for enterprise help files.
* include/javascript/pandora.js: Renamed pandora_help() to
open_help().
* include/functions_ui.php: Renamed event function on
print_help_icon(). Removed deprecated pandora_help().
* godmode/agentes/module_manager.php: Added enterprise hooks.
* godmode/agentes/module_manager_editor.php: Added categories
construction here. Added enterprise hooks.
* godmode/agentes/module_manager_editor_common.php: Replaced
deprecated pandora_help() with print_help_icon(). Moved categories
construction to module_manager_editor.
* include/config_process.php: Updated build version.
* include/styles/pandora.css: Fixed textarea height.
* godmode/agentes/manage_config_remote.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_edit_modules.php,
godmode/agentes/module_manager_editor_network.php,
godmode/agentes/module_manager_editor_plugin.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/module_manager_editor_wmi.php,
godmode/agentes/planned_downtime.php, godmode/alerts/alert_list.php,
godmode/alerts/configure_alert_compound.php,
godmode/modules/manage_network_components_form_network.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/map_builder.php,
godmode/servers/manage_export_form.php,
godmode/servers/manage_recontask_form.php, godmode/servers/plugin.php,
godmode/setup/setup.php, operation/agentes/alerts_status.php,
operation/agentes/tactical.php,
godmode/agentes/agent_manager.php: Replaced deprecated pandora_help()
with print_help_icon().
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1557 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-03-24 16:38:54 +01:00
$modules [ 'dataserver' ] = __ ( 'Create a new data server module' );
2019-01-30 16:18:44 +01:00
if ( $network_available ) {
$modules [ 'networkserver' ] = __ ( 'Create a new network server module' );
}
if ( $plugin_available ) {
$modules [ 'pluginserver' ] = __ ( 'Create a new plugin server module' );
}
if ( $wmi_available ) {
$modules [ 'wmiserver' ] = __ ( 'Create a new WMI server module' );
}
if ( $prediction_available ) {
$modules [ 'predictionserver' ] = __ ( 'Create a new prediction server module' );
}
2009-05-07 16:44:26 +02:00
2013-08-07 10:26:26 +02:00
if ( enterprise_installed ()) {
2019-01-30 16:18:44 +01:00
set_enterprise_module_types ( $modules );
2013-08-07 10:26:26 +02:00
}
2011-02-15 12:41:28 +01:00
$sec2 = get_parameter ( 'sec2' , '' );
2019-01-30 16:18:44 +01:00
if ( strstr ( $sec2 , 'enterprise/godmode/policies/policies' ) !== false ) {
// It is unset because the policies haven't a table tmodule_synth and the
// some part of code to apply this kind of modules in policy agents.
// But in the future maybe will be good to make this feature, but remember
// the modules to show in syntetic module policy form must be the policy
// modules from the same policy.
unset ( $modules [ 'predictionserver' ]);
if ( enterprise_installed ()) {
unset ( $modules [ 'webux' ]);
}
2011-02-15 12:41:28 +01:00
}
2013-05-24 12:30:03 +02:00
$show_creation = false ;
2019-01-30 16:18:44 +01:00
$checked = get_parameter ( 'checked' );
2013-05-24 12:30:03 +02:00
2013-02-05 10:13:41 +01:00
if (( $policy_page ) || ( isset ( $agent ))) {
2019-01-30 16:18:44 +01:00
if ( $policy_page ) {
$show_creation = ! is_central_policies_on_node ();
} else {
if ( ! isset ( $all_groups )) {
$all_groups = agents_get_all_groups_agent (
$agent [ 'id_agente' ],
$agent [ 'id_grupo' ]
);
}
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
$show_creation = true ;
}
}
if ( $show_creation ) {
// Create module/type combo
echo '<form id="create_module_type" method="post" action="' . $url . '">' ;
if ( ! $policy_page ) {
echo '<td class="datos" style="font-weight: bold; width:20%;">' ;
echo __ ( 'Show in hierachy mode' );
if ( $checked == 'true' ) {
$checked = true ;
} else {
$checked = false ;
}
html_print_checkbox ( 'status_hierachy_mode' , '' , $checked , false , false , 'onChange=change_mod_filter();' );
echo '</td>' ;
}
echo '<td class="datos" style="font-weight: bold; width:20%;">' ;
echo __ ( '<p>Type</p>' );
html_print_select ( $modules , 'moduletype' , '' , '' , '' , '' , false , false , false , '' , false , 'max-width:300px;' );
html_print_input_hidden ( 'edit_module' , 1 );
echo '</td>' ;
echo '<td class="datos" style="width:10%;">' ;
echo '<input align="right" name="updbutton" type="submit" class="sub next" value="' . __ ( 'Create' ) . '">' ;
echo '</td>' ;
echo '</tr>' ;
echo '</form>' ;
}
2013-01-14 16:11:07 +01:00
}
2019-01-30 16:18:44 +01:00
echo '</table>' ;
2015-12-30 11:16:11 +01:00
2018-05-25 10:29:40 +02:00
if ( ! $config [ 'disable_help' ]) {
2019-01-30 16:18:44 +01:00
echo '<div style="text-align: right; width: 100%;padding-top:10px;padding-bottom:10px">' ;
echo '<strong>' ;
echo " <a style='color: #373737;' target='_blank' href='http://pandorafms.com/Library/Library/'> " . __ ( 'Get more modules on Monitoring Library' ) . '</a>' ;
echo '</strong>' ;
echo '</div>' ;
2018-05-25 10:29:40 +02:00
}
2013-05-24 12:30:03 +02:00
2019-01-30 16:18:44 +01:00
if ( ! isset ( $id_agente )) {
return ;
}
2012-07-25 11:59:03 +02:00
2009-09-25 18:04:14 +02:00
2010-10-14 19:07:50 +02:00
$multiple_delete = ( bool ) get_parameter ( 'multiple_delete' );
2009-09-25 18:04:14 +02:00
if ( $multiple_delete ) {
2019-01-30 16:18:44 +01:00
$id_agent_modules_delete = ( array ) get_parameter ( 'id_delete' );
$count_correct_delete_modules = 0 ;
foreach ( $id_agent_modules_delete as $id_agent_module_del ) {
$id_grupo = ( int ) agents_get_agent_group ( $id_agente );
$all_groups = agents_get_all_groups_agent ( $id_agente , $id_grupo );
if ( ! check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
db_pandora_audit (
'ACL Violation' ,
'Trying to delete a module without admin rights'
);
include 'general/noaccess.php' ;
exit ;
}
if ( $id_agent_module_del < 1 ) {
db_pandora_audit (
'HACK Attempt' ,
'Expected variable from form is not correct'
);
die ( __ ( 'Nice try buddy' ));
exit ;
}
enterprise_include_once ( 'include/functions_config_agents.php' );
enterprise_hook ( 'config_agents_delete_module_in_conf' , [ modules_get_agentmodule_agent ( $id_agent_module_del ), modules_get_agentmodule_name ( $id_agent_module_del )]);
$error = 0 ;
// First delete from tagente_modulo -> if not successful, increment
// error. NOTICE that we don't delete all data here, just marking for deletion
// and delete some simple data.
$status = '' ;
$agent_id_of_module = db_get_value ( 'id_agente' , 'tagente_modulo' , 'id_agente_modulo' , ( int ) $id_agent_module_del );
if ( db_process_sql (
" UPDATE tagente_modulo
2013-06-07 11:36:26 +02:00
SET nombre = 'pendingdelete' , disabled = 1 , delete_pending = 1
2019-01-30 16:18:44 +01:00
WHERE id_agente_modulo = " . $id_agent_module_del ,
'affected_rows' ,
'' ,
true ,
$status ,
false
) === false
) {
$error ++ ;
} else {
// Set flag to update module status count
if ( $agent_id_of_module !== false ) {
db_process_sql (
' UPDATE tagente
2013-09-05 18:35:49 +02:00
SET update_module_count = 1 , update_alert_count = 1
2019-01-30 16:18:44 +01:00
WHERE id_agente = ' . $agent_id_of_module
);
}
}
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
case 'postgresql' :
$result = db_process_sql_delete (
'tagente_estado' ,
[ 'id_agente_modulo' => $id_agent_module_del ]
);
if ( $result === false ) {
$error ++ ;
}
$result = db_process_sql_delete (
'tagente_datos_inc' ,
[ 'id_agente_modulo' => $id_agent_module_del ]
);
if ( $result === false ) {
$error ++ ;
}
break ;
case 'oracle' :
$result = db_process_delete_temp (
'tagente_estado' ,
'id_agente_modulo' ,
$id_agent_module_del
);
if ( $result === false ) {
$error ++ ;
}
$result = db_process_delete_temp (
'tagente_datos_inc' ,
'id_agente_modulo' ,
$id_agent_module_del
);
if ( $result === false ) {
$error ++ ;
}
break ;
}
// Trick to detect if we are deleting a synthetic module (avg or arithmetic)
// If result is empty then module doesn't have this type of submodules
$ops_json = enterprise_hook ( 'modules_get_synthetic_operations' , [ $id_agent_module_del ]);
$result_ops_synthetic = json_decode ( $ops_json );
if ( ! empty ( $result_ops_synthetic )) {
$result = enterprise_hook ( 'modules_delete_synthetic_operations' , [ $id_agent_module_del ]);
if ( $result === false ) {
$error ++ ;
}
} //end if
else {
$result_components = enterprise_hook ( 'modules_get_synthetic_components' , [ $id_agent_module_del ]);
$count_components = 1 ;
if ( ! empty ( $result_components )) {
// Get number of components pending to delete to know when it's needed to update orders
$num_components = count ( $result_components );
$last_target_module = 0 ;
foreach ( $result_components as $id_target_module ) {
// Detects change of component or last component to update orders
if (( $count_components == $num_components ) or ( $last_target_module != $id_target_module )) {
$update_orders = true ;
} else {
$update_orders = false ;
}
$result = enterprise_hook ( 'modules_delete_synthetic_operations' , [ $id_target_module , $id_agent_module_del , $update_orders ]);
if ( $result === false ) {
$error ++ ;
}
$count_components ++ ;
$last_target_module = $id_target_module ;
}
}
}
// Check for errors
if ( $error != 0 ) {
} else {
$count_correct_delete_modules ++ ;
}
}
$count_modules_to_delete = count ( $id_agent_modules_delete );
if ( $count_correct_delete_modules == 0 ) {
ui_print_error_message (
sprintf (
__ ( 'There was a problem deleting %s modules, none deleted.' ),
$count_modules_to_delete
)
);
} else {
if ( $count_correct_delete_modules == $count_modules_to_delete ) {
ui_print_success_message ( __ ( 'All Modules deleted succesfully' ));
} else {
ui_print_error_message (
sprintf (
__ ( 'There was a problem only deleted %s modules of %s total.' ),
count_correct_delete_modules ,
$count_modules_to_delete
)
);
}
}
2009-09-25 18:04:14 +02:00
}
2010-10-14 17:09:29 +02:00
2012-08-21 Miguel de Dios <miguel.dedios@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/module_manager.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_monitores.php,
operation/agentes/ver_agente.php: added in the modules the same
feature to set agent in "Quiet" mode.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6898 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-08-21 20:57:48 +02:00
// ==================
// TABLE LIST MODULES
// ==================
2019-01-30 16:18:44 +01:00
$url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=' . $id_agente ;
2019-04-05 13:18:38 +02:00
$selectNameUp = false ;
$selectNameDown = false ;
$selectServerUp = false ;
$selectServerDown = false ;
$selectTypeUp = false ;
$selectTypeDown = false ;
$selectIntervalUp = false ;
$selectIntervalDown = false ;
2010-07-21 20:07:21 +02:00
$sortField = get_parameter ( 'sort_field' );
$sort = get_parameter ( 'sort' , 'none' );
2019-04-05 13:18:38 +02:00
$selected = true ;
2010-07-21 20:07:21 +02:00
2019-01-30 16:18:44 +01:00
$order [] = [
'field' => 'tmodule_group.name' ,
'order' => 'ASC' ,
];
2010-07-21 20:07:21 +02:00
switch ( $sortField ) {
2019-01-30 16:18:44 +01:00
case 'name' :
switch ( $sort ) {
case 'up' :
$selectNameUp = $selected ;
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
case 'postgresql' :
$order [] = [
'field' => 'tagente_modulo.nombre' ,
'order' => 'ASC' ,
];
break ;
case 'oracle' :
$order [] = [
'field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)' ,
'order' => 'ASC' ,
];
break ;
}
break ;
case 'down' :
$selectNameDown = $selected ;
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
case 'postgresql' :
$order [] = [
'field' => 'tagente_modulo.nombre' ,
'order' => 'DESC' ,
];
break ;
case 'oracle' :
$order [] = [
'field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)' ,
'order' => 'DESC' ,
];
break ;
}
break ;
}
break ;
case 'server' :
switch ( $sort ) {
case 'up' :
$selectServerUp = $selected ;
$order [] = [
'field' => 'id_modulo' ,
'order' => 'ASC' ,
];
break ;
case 'down' :
$selectServerDown = $selected ;
$order [] = [
'field' => 'id_modulo' ,
'order' => 'DESC' ,
];
break ;
}
break ;
case 'type' :
switch ( $sort ) {
case 'up' :
$selectTypeUp = $selected ;
$order [] = [
'field' => 'id_tipo_modulo' ,
'order' => 'ASC' ,
];
break ;
case 'down' :
$selectTypeDown = $selected ;
$order [] = [
'field' => 'id_tipo_modulo' ,
'order' => 'DESC' ,
];
break ;
}
break ;
case 'interval' :
switch ( $sort ) {
case 'up' :
$selectIntervalUp = $selected ;
$order [] = [
'field' => 'module_interval' ,
'order' => 'ASC' ,
];
break ;
case 'down' :
$selectIntervalDown = $selected ;
$order [] = [
'field' => 'module_interval' ,
'order' => 'DESC' ,
];
break ;
}
break ;
default :
$selectNameUp = $selected ;
2019-04-05 13:18:38 +02:00
$selectNameDown = false ;
$selectServerUp = false ;
$selectServerDown = false ;
$selectTypeUp = false ;
$selectTypeDown = false ;
$selectIntervalUp = false ;
$selectIntervalDown = false ;
2019-01-30 16:18:44 +01:00
switch ( $config [ 'dbtype' ]) {
case 'mysql' :
case 'postgresql' :
$order [] = [
'field' => 'nombre' ,
'order' => 'ASC' ,
];
break ;
case 'oracle' :
$order [] = [
'field' => 'dbms_lob.substr(nombre,4000,1)' ,
'order' => 'ASC' ,
];
break ;
}
break ;
2010-07-21 20:07:21 +02:00
}
2013-08-07 12:59:09 +02:00
2011-11-24 19:19:09 +01:00
// Build the order sql
2012-07-25 11:59:03 +02:00
if ( ! empty ( $order )) {
2019-01-30 16:18:44 +01:00
$order_sql = ' ORDER BY ' ;
2011-11-24 19:19:09 +01:00
}
2019-01-30 16:18:44 +01:00
2011-11-24 19:19:09 +01:00
$first = true ;
2012-07-25 11:59:03 +02:00
foreach ( $order as $ord ) {
2019-01-30 16:18:44 +01:00
if ( $first ) {
$first = false ;
} else {
$order_sql .= ',' ;
}
$order_sql .= $ord [ 'field' ] . ' ' . $ord [ 'order' ];
2011-11-24 19:19:09 +01:00
}
// Get limit and offset parameters
2019-01-30 16:18:44 +01:00
$limit = ( int ) $config [ 'block_size' ];
$offset = ( int ) get_parameter ( 'offset' );
$params = ( $checked ) ? 'tagente_modulo.*, tmodule_group.*' : implode (
',' ,
[
'tagente_modulo.id_agente_modulo' ,
'id_tipo_modulo' ,
'descripcion' ,
'nombre' ,
'max' ,
'min' ,
'module_interval' ,
'id_modulo' ,
'id_module_group' ,
'disabled' ,
'max_warning' ,
'min_warning' ,
'str_warning' ,
'max_critical' ,
'min_critical' ,
'str_critical' ,
'quiet' ,
'critical_inverse' ,
'warning_inverse' ,
'id_policy_module' ,
]
);
$where = sprintf ( 'delete_pending = 0 AND id_agente = %s' , $id_agente );
2012-05-14 16:24:29 +02:00
$search_string_entities = io_safe_input ( $search_string );
$basic_where = sprintf ( " (nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND " , $search_string , $search_string_entities , $search_string , $search_string_entities );
2018-10-03 11:13:25 +02:00
// Tags acl
$agent_tags = tags_get_user_applied_agent_tags ( $id_agente );
if ( $agent_tags !== true ) {
2019-01-30 16:18:44 +01:00
$where_tags = ' AND ttag_module.id_tag IN (' . implode ( ',' , $agent_tags ) . ')' ;
2018-10-03 11:13:25 +02:00
}
2013-01-10 17:00:30 +01:00
2014-05-27 10:57:20 +02:00
$paginate_module = false ;
2019-01-30 16:18:44 +01:00
if ( isset ( $config [ 'paginate_module' ])) {
$paginate_module = $config [ 'paginate_module' ];
}
2014-05-27 10:57:20 +02:00
2018-10-03 11:13:25 +02:00
if ( $paginate_module ) {
2019-01-30 16:18:44 +01:00
if ( ! isset ( $limit_sql )) {
$limit_sql = " LIMIT $offset , $limit " ;
}
} else {
$limit_sql = '' ;
2018-10-03 11:13:25 +02:00
}
2019-01-30 16:18:44 +01:00
$sql = sprintf (
' SELECT tagente_modulo .* , tmodule_group .*
2018-10-03 11:13:25 +02:00
FROM tagente_modulo
LEFT JOIN tmodule_group
ON tagente_modulo . id_module_group = tmodule_group . id_mg
LEFT JOIN ttag_module
ON ttag_module . id_agente_modulo = tagente_modulo . id_agente_modulo
WHERE % s % s % s
GROUP BY tagente_modulo . id_agente_modulo
2019-01-30 16:18:44 +01:00
% s % s ' ,
$basic_where ,
$where ,
$where_tags ,
$order_sql ,
$limit_sql
2018-10-03 11:13:25 +02:00
);
$modules = db_get_all_rows_sql ( $sql );
$sql_total_modules = sprintf (
2019-01-30 16:18:44 +01:00
' SELECT count ( DISTINCT ( tagente_modulo . id_agente_modulo ))
2012-07-25 11:59:03 +02:00
FROM tagente_modulo
2018-10-03 11:13:25 +02:00
LEFT JOIN ttag_module
ON ttag_module . id_agente_modulo = tagente_modulo . id_agente_modulo
2019-01-30 16:18:44 +01:00
WHERE % s % s % s ' ,
$basic_where ,
$where ,
$where_tags
2018-10-03 11:13:25 +02:00
);
2011-11-24 19:19:09 +01:00
$total_modules = db_get_value_sql ( $sql_total_modules );
2019-01-30 16:18:44 +01:00
$total_modules = isset ( $total_modules ) ? $total_modules : 0 ;
2009-03-17 16:15:55 +01:00
if ( $modules === false ) {
2019-01-30 16:18:44 +01:00
ui_print_empty_data ( __ ( 'No available data to show' ));
return ;
2009-03-17 16:15:55 +01:00
}
2011-11-07 13:59:26 +01:00
// Prepare pagination
2019-01-30 16:18:44 +01:00
$url = '?' . 'sec=gagente&' . 'tab=module&' . 'sec2=godmode/agentes/configurar_agente&' . 'id_agente=' . $id_agente . '&' . 'sort_field=' . $sortField . '&' . '&sort=' . $sort . '&' . 'search_string=' . urlencode ( $search_string );
2014-05-23 09:29:47 +02:00
2014-05-27 10:57:20 +02:00
if ( $paginate_module ) {
2019-01-30 16:18:44 +01:00
ui_pagination ( $total_modules , $url );
2014-05-23 09:29:47 +02:00
}
2011-11-07 13:59:26 +01:00
2019-04-05 13:18:38 +02:00
$url_name = $url . '&sort_field=name&sort=' ;
$url_server = $url . '&sort_field=server&sort=' ;
$url_type = $url . '&sort_field=type&sort=' ;
$url_interval = $url . '&sort_field=interval&sort=' ;
2015-07-21 13:04:27 +02:00
$table = new stdClass ();
2015-04-01 13:24:53 +02:00
$table -> width = '100%' ;
2019-04-05 13:18:38 +02:00
$table -> class = 'info_table' ;
2019-01-30 16:18:44 +01:00
$table -> head = [];
2019-04-05 13:18:38 +02:00
$table -> head [ 'checkbox' ] = html_print_checkbox ( 'all_delete' , 0 , false , true , false );
$table -> head [ 0 ] = __ ( 'Name' ) . ui_get_sorting_arrows ( $url_name . 'up' , $url_name . 'down' , $selectNameUp , $selectNameDown );
2013-01-14 16:11:07 +01:00
// The access to the policy is granted only with AW permission
2019-01-30 16:18:44 +01:00
if ( $isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl ( $config [ 'id_user' ], $agent [ 'id_grupo' ], 'AW' )) {
$table -> head [ 1 ] = " <span title=' " . __ ( 'Policy' ) . " '> " . __ ( 'P.' ) . '</span>' ;
2013-01-14 16:11:07 +01:00
}
2019-04-05 13:18:38 +02:00
$table -> head [ 2 ] = " <span title=' " . __ ( 'Server' ) . " '> " . __ ( 'S.' ) . '</span>' . ui_get_sorting_arrows ( $url_server . 'up' , $url_server . 'down' , $selectServerUp , $selectServerDown );
$table -> head [ 3 ] = __ ( 'Type' ) . ui_get_sorting_arrows ( $url_type . 'up' , $url_type . 'down' , $selectTypeUp , $selectTypeDown );
$table -> head [ 4 ] = __ ( 'Interval' ) . ui_get_sorting_arrows ( $url_interval . 'up' , $url_interval . 'down' , $selectIntervalUp , $selectIntervalDown );
2009-10-20 17:23:26 +02:00
$table -> head [ 5 ] = __ ( 'Description' );
2011-12-07 15:19:05 +01:00
$table -> head [ 6 ] = __ ( 'Status' );
$table -> head [ 7 ] = __ ( 'Warn' );
2011-06-22 19:21:50 +02:00
2011-12-07 15:19:05 +01:00
$table -> head [ 8 ] = __ ( 'Action' );
2019-04-05 13:18:38 +02:00
$table -> head [ 9 ] = '<span title="' . __ ( 'Delete' ) . '">' . __ ( 'Del.' ) . '</span>' ;
2009-03-17 16:15:55 +01:00
2019-01-30 16:18:44 +01:00
$table -> rowstyle = [];
$table -> style = [];
2009-03-17 16:15:55 +01:00
$table -> style [ 0 ] = 'font-weight: bold' ;
2019-01-30 16:18:44 +01:00
$table -> size = [];
2019-04-05 13:18:38 +02:00
$table -> size [ 'checkbox' ] = '20px' ;
2015-04-23 17:52:16 +02:00
$table -> size [ 2 ] = '70px' ;
2019-01-30 16:18:44 +01:00
$table -> align = [];
2013-02-13 18:47:43 +01:00
$table -> align [ 2 ] = 'left' ;
$table -> align [ 8 ] = 'left' ;
$table -> align [ 9 ] = 'left' ;
2019-01-30 16:18:44 +01:00
$table -> data = [];
2009-03-17 16:15:55 +01:00
2019-01-30 16:18:44 +01:00
$agent_interval = agents_get_interval ( $id_agente );
$last_modulegroup = '0' ;
2009-09-15 14:02:06 +02:00
2019-01-30 16:18:44 +01:00
// Extract the ids only numeric modules for after show the normalize link.
$tempRows = db_get_all_rows_sql (
" SELECT *
2009-09-15 14:02:06 +02:00
FROM ttipo_modulo
2019-01-30 16:18:44 +01:00
WHERE nombre NOT LIKE '%string%' AND nombre NOT LIKE '%proc%' "
);
$numericModules = [];
foreach ( $tempRows as $row ) {
$numericModules [ $row [ 'id_tipo' ]] = true ;
2009-09-15 14:02:06 +02:00
}
2017-01-18 17:33:28 +01:00
if ( $checked ) {
2019-01-30 16:18:44 +01:00
$modules_hierachy = [];
$modules_hierachy = get_hierachy_modules_tree ( $modules );
2017-01-18 17:33:28 +01:00
2019-01-30 16:18:44 +01:00
$modules_dt = get_dt_from_modules_tree ( $modules_hierachy );
2017-01-18 17:33:28 +01:00
2019-01-30 16:18:44 +01:00
$modules = $modules_dt ;
2017-01-18 17:33:28 +01:00
}
2009-03-17 16:15:55 +01:00
foreach ( $modules as $module ) {
2019-01-30 16:18:44 +01:00
if ( ! check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' ) && ! check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AD' )) {
continue ;
}
$type = $module [ 'id_tipo_modulo' ];
$id_module = $module [ 'id_modulo' ];
$nombre_modulo = $module [ 'nombre' ];
$descripcion = $module [ 'descripcion' ];
$module_max = $module [ 'max' ];
$module_min = $module [ 'min' ];
$module_interval2 = $module [ 'module_interval' ];
$module_group2 = $module [ 'id_module_group' ];
2020-05-25 17:06:20 +02:00
if ( $module [ 'id_modulo' ] == MODULE_DATA && $module [ 'id_policy_module' ] != 0 ) {
$nombre_modulo = utf8_decode ( $module [ 'nombre' ]);
}
2019-01-30 16:18:44 +01:00
$data = [];
if ( ! $checked ) {
if ( $module [ 'id_module_group' ] != $last_modulegroup ) {
$last_modulegroup = $module [ 'id_module_group' ];
$data [ 0 ] = '<strong>' . modules_get_modulegroup_name ( $last_modulegroup ) . '</strong>' ;
$i = array_push ( $table -> data , $data );
$table -> rowstyle [( $i - 1 )] = 'text-align: center' ;
$table -> rowclass [( $i - 1 )] = 'datos3' ;
if ( $isFunctionPolicies !== ENTERPRISE_NOT_HOOK ) {
2019-04-05 13:18:38 +02:00
$table -> colspan [( $i - 1 )][ 0 ] = 11 ;
2019-01-30 16:18:44 +01:00
} else {
2019-04-05 13:18:38 +02:00
$table -> colspan [( $i - 1 )][ 0 ] = 10 ;
2019-01-30 16:18:44 +01:00
}
$data = [];
}
}
2019-04-05 13:18:38 +02:00
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
$data [ 'checkbox' ] = html_print_checkbox ( 'id_delete[]' , $module [ 'id_agente_modulo' ], false , true );
}
2019-01-30 16:18:44 +01:00
$data [ 0 ] = '' ;
if ( isset ( $module [ 'deep' ]) && ( $module [ 'deep' ] != 0 )) {
$data [ 0 ] .= str_repeat ( ' ' , $module [ 'deep' ]);
$data [ 0 ] .= html_print_image ( 'images/icono_escuadra.png' , true , [ 'style' => 'padding-bottom: inherit;' ]) . ' ' ;
}
if ( $module [ 'quiet' ]) {
$data [ 0 ] .= html_print_image (
'images/dot_blue.png' ,
true ,
[
'border' => '0' ,
'title' => __ ( 'Quiet' ),
'alt' => '' ,
]
) . ' ' ;
}
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
$data [ 0 ] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '&tab=module&edit_module=1&id_agent_module=' . $module [ 'id_agente_modulo' ] . '">' ;
}
if ( $module [ 'disabled' ]) {
$data [ 0 ] .= '<em class="disabled_module">' . ui_print_truncate_text ( $module [ 'nombre' ], 'module_medium' , false , true , true , '[…]' , 'font-size: 7.2pt' ) . '</em>' ;
} else {
$data [ 0 ] .= ui_print_truncate_text ( $module [ 'nombre' ], 'module_medium' , false , true , true , '[…]' , 'font-size: 7.2pt' );
}
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
$data [ 0 ] .= '</a>' ;
}
// The access to the policy is granted only with AW permission
if ( $isFunctionPolicies !== ENTERPRISE_NOT_HOOK && check_acl ( $config [ 'id_user' ], $agent [ 'id_grupo' ], 'AW' )) {
$policyInfo = policies_info_module_policy ( $module [ 'id_agente_modulo' ]);
if ( $policyInfo === false ) {
$data [ 1 ] = '' ;
} else {
$linked = policies_is_module_linked ( $module [ 'id_agente_modulo' ]);
$adopt = false ;
if ( policies_is_module_adopt ( $module [ 'id_agente_modulo' ])) {
$adopt = true ;
}
if ( $linked ) {
if ( $adopt ) {
$img = 'images/policies_brick.png' ;
$title = '(' . __ ( 'Adopted' ) . ') ' . $policyInfo [ 'name_policy' ];
} else {
$img = 'images/policies.png' ;
$title = $policyInfo [ 'name_policy' ];
}
} else {
if ( $adopt ) {
$img = 'images/policies_not_brick.png' ;
$title = '(' . __ ( 'Unlinked' ) . ') (' . __ ( 'Adopted' ) . ') ' . $policyInfo [ 'name_policy' ];
} else {
$img = 'images/unlinkpolicy.png' ;
$title = '(' . __ ( 'Unlinked' ) . ') ' . $policyInfo [ 'name_policy' ];
}
}
$data [ 1 ] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo [ 'id_policy' ] . '">' . html_print_image ( $img , true , [ 'title' => $title ]) . '</a>' ;
}
}
// Module type (by server type )
$data [ 2 ] = '' ;
if ( $module [ 'id_modulo' ] > 0 ) {
$data [ 2 ] = servers_show_type ( $module [ 'id_modulo' ]);
}
$module_status = db_get_row ( 'tagente_estado' , 'id_agente_modulo' , $module [ 'id_agente_modulo' ]);
modules_get_status ( $module [ 'id_agente_modulo' ], $module_status [ 'estado' ], $module_status [ 'datos' ], $status , $title );
// This module is initialized ? (has real data)
if ( $status == STATUS_MODULE_NO_DATA ) {
$data [ 2 ] .= html_print_image (
'images/error.png' ,
true ,
[ 'title' => __ ( 'Non initialized module' )]
);
}
// Module type (by data type)
$data [ 3 ] = '' ;
if ( $type ) {
$data [ 3 ] = ui_print_moduletype_icon ( $type , true );
}
// Module interval
if ( $module [ 'module_interval' ]) {
$data [ 4 ] = human_time_description_raw ( $module [ 'module_interval' ]);
} else {
$data [ 4 ] = human_time_description_raw ( $agent_interval );
}
if ( $module [ 'id_modulo' ] == MODULE_DATA && $module [ 'id_policy_module' ] != 0 ) {
$data [ 4 ] .= ui_print_help_tip ( __ ( 'The policy modules of data type will only update their intervals when policy is applied.' ), true );
}
2020-04-02 14:30:02 +02:00
$data [ 5 ] = ui_print_truncate_text ( $module [ 'descripcion' ], 'description' , false );
2019-01-30 16:18:44 +01:00
2020-01-31 11:53:42 +01:00
$data [ 6 ] = ui_print_status_image ( $status , htmlspecialchars ( $title ), true );
2019-01-30 16:18:44 +01:00
2020-05-25 17:06:20 +02:00
// MAX / MIN values.
2019-01-30 16:18:44 +01:00
if ( $module [ 'id_tipo_modulo' ] != 25 ) {
$data [ 7 ] = ui_print_module_warn_value (
$module [ 'max_warning' ],
$module [ 'min_warning' ],
$module [ 'str_warning' ],
$module [ 'max_critical' ],
$module [ 'min_critical' ],
2019-10-17 11:50:50 +02:00
$module [ 'str_critical' ],
$module [ 'warning_inverse' ],
$module [ 'critical_inverse' ]
2019-01-30 16:18:44 +01:00
);
} else {
$data [ 7 ] = '' ;
}
if ( $module [ 'disabled' ]) {
$data [ 8 ] = " <a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente= " . $id_agente . '&enable_module=' . $module [ 'id_agente_modulo' ] . " '> " . html_print_image (
'images/lightbulb_off.png' ,
true ,
[
'alt' => __ ( 'Enable module' ),
'title' => __ ( 'Enable module' ),
]
) . '</a>' ;
} else {
$data [ 8 ] = " <a href='index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente= " . $id_agente . '&disable_module=' . $module [ 'id_agente_modulo' ] . " '> " . html_print_image (
'images/lightbulb.png' ,
true ,
[
'alt' => __ ( 'Disable module' ),
'title' => __ ( 'Disable module' ),
]
) . '</a>' ;
}
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' ) && $module [ 'id_tipo_modulo' ] != 25 ) {
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '&duplicate_module=' . $module [ 'id_agente_modulo' ] . ' "
2019-01-30 16:18:44 +01:00
onClick = " if (!confirm( \ ' '.__('Are you sure?').' \ ')) return false; " > ' ;
$data [ 8 ] .= html_print_image (
'images/copy.png' ,
true ,
[ 'title' => __ ( 'Duplicate' )]
);
$data [ 8 ] .= '</a> ' ;
// Make a data normalization
if ( isset ( $numericModules [ $type ])) {
if ( $numericModules [ $type ] === true ) {
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '&tab=module&fix_module=' . $module [ 'id_agente_modulo' ] . '" onClick="if (!confirm(\' ' . __ ( 'Are you sure?' ) . '\')) return false;">' ;
2019-01-30 16:18:44 +01:00
$data [ 8 ] .= html_print_image (
'images/chart_curve.png' ,
true ,
[ 'title' => __ ( 'Normalize' )]
);
$data [ 8 ] .= '</a>' ;
}
} else {
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= html_print_image (
2019-01-30 16:18:44 +01:00
'images/chart_curve.disabled.png' ,
true ,
[ 'title' => __ ( 'Normalize (Disabled)' )]
);
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= ' ' ;
2019-01-30 16:18:44 +01:00
}
// create network component action
if (( is_user_admin ( $config [ 'id_user' ]))
&& ( $module [ 'id_modulo' ] == MODULE_NETWORK )
) {
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_components&create_network_from_module=1&id_agente=' . $id_agente . '&create_module_from=' . $module [ 'id_agente_modulo' ] . ' "
2013-01-14 16:11:07 +01:00
onClick = " if (!confirm( \ ' '.__('Are you sure?').' \ ')) return false; " > ' ;
2019-01-30 16:18:44 +01:00
$data [ 8 ] .= html_print_image (
'images/network.png' ,
true ,
[ 'title' => __ ( 'Create network component' )]
);
$data [ 8 ] .= '</a> ' ;
} else {
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= html_print_image (
2019-01-30 16:18:44 +01:00
'images/network.disabled.png' ,
true ,
[ 'title' => __ ( 'Create network component (Disabled)' )]
);
2019-04-05 13:18:38 +02:00
$data [ 8 ] .= ' ' ;
2019-01-30 16:18:44 +01:00
}
}
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
// Delete module
$data [ 9 ] = '<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . '&delete_module=' . $module [ 'id_agente_modulo' ] . ' "
2013-02-13 18:47:43 +01:00
onClick = " if (!confirm( \ ' '.__('Are you sure?').' \ ')) return false; " > ' ;
2019-01-30 16:18:44 +01:00
$data [ 9 ] .= html_print_image (
'images/cross.png' ,
true ,
[ 'title' => __ ( 'Delete' )]
);
$data [ 9 ] .= '</a> ' ;
}
2019-04-05 13:18:38 +02:00
$table -> cellclass [] = [
8 => 'action_buttons' ,
9 => 'action_buttons' ,
];
2019-01-30 16:18:44 +01:00
array_push ( $table -> data , $data );
2019-04-05 13:18:38 +02:00
$table -> cellclass [] = [
8 => 'action_buttons' ,
9 => 'action_buttons' ,
];
2009-01-12 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/alert_manager.php: Complete rewritten of the alert
system when assigned alerts to an agent.
* pandoradb.sql: New tables for alert system. These are:
talert_commands, talert_actions, talert_templates,
talert_template_modules, talert_template_module_actions. No migration
tool is available yet.
* godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php: Added to repository. Administration
interface to new alert system.
* godmode/alerts/modify_alert.php: Deleted from repository.
* godmode/setup/setup.php: Added an example of the date format. Main
table has now percentage width.
* godmode/menu.php, operation/menu.php: Added new alert options.
Removed refr value when it's not neccesary.
* include/styles/pandora.css: Added width to textarea elements. Style
correction and cleanup. Tables doesn't have a odd-even pattern, but
the hovered row now changes its colour. New styles for alert pages.
* include/functions_custom_graphs.php: Added to repository. custom
graphs functions moved here.
* include/functions_incidents.php, include/functions_events.php: Moved
to LGPL. Style comment corrections.
* include/functions_html.php: Documentation style correction. Added
print_input_file() and print_label().
* include/functions_ui.php: Doc style correction.
* operation/reporting/graph_viewer.php: Include new function file with
custom graphs. Use generic functions.
* index.php: Unset pass from POST and REQUEST arrays.
* include/functions_db.php: Some documentation updated to new format.
Added format_array_to_update_sql() to generate SQL sentences for
updates. Style correction.
* godmode/agentes/configurar_agente.php: Variables renamed to have a
meaning.
* extensions/update_manager/main.php: Mark an string translatable.
* extensions/update_manager/lib/libupdate_manager_client.php,
godmode/alerts/configure_alert.php, include/functions.php,
godmode/agentes/module_manager.php, operation/agentes/networkmap.php,
operation/reporting/reporting_viewer.php,
godmode/agentes/manage_config.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
}
2009-03-17 16:15:55 +01:00
2019-01-30 16:18:44 +01:00
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
echo '<form method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $id_agente . ' & tab = module "
onsubmit = " if (! confirm ( \ ''.__('Are you sure?').' \ ')) return false " > ' ;
2013-01-14 16:11:07 +01:00
}
2013-02-05 10:13:41 +01:00
2019-01-30 16:18:44 +01:00
html_print_table ( $table );
2013-01-14 16:11:07 +01:00
2019-01-30 16:18:44 +01:00
if ( check_acl_one_of_groups ( $config [ 'id_user' ], $all_groups , 'AW' )) {
echo '<div class="action-buttons" style="width: ' . $table -> width . '">' ;
html_print_input_hidden ( 'multiple_delete' , 1 );
html_print_submit_button ( __ ( 'Delete' ), 'multiple_delete' , false , 'class="sub delete"' );
echo '</div>' ;
echo '</form>' ;
2013-01-14 16:11:07 +01:00
}
2012-11-14 19:54:27 +01:00
?>
2017-01-18 17:33:28 +01:00
< script type = " text/javascript " >
2017-02-27 14:28:09 +01:00
2019-01-30 16:18:44 +01:00
$ ( document ) . ready ( function () {
$ ( '[id^=checkbox-id_delete]' ) . change ( function (){
if ( $ ( this ) . parent () . parent () . hasClass ( 'checkselected' )){
$ ( this ) . parent () . parent () . removeClass ( 'checkselected' );
}
else {
$ ( this ) . parent () . parent () . addClass ( 'checkselected' );
}
});
$ ( '[id^=checkbox-all_delete]' ) . change ( function (){
if ( $ ( " #checkbox-all_delete " ) . prop ( " checked " )) {
$ ( '[id^=checkbox-id_delete]' ) . parent () . parent () . addClass ( 'checkselected' );
$ ( " [name^=id_delete " ) . prop ( " checked " , true );
}
else {
$ ( '[id^=checkbox-id_delete]' ) . parent () . parent () . removeClass ( 'checkselected' );
$ ( " [name^=id_delete " ) . prop ( " checked " , false );
}
});
});
function change_mod_filter () {
var checked = $ ( " #checkbox-status_hierachy_mode " ) . is ( " :checked " );
if ( / checked /. test ( window . location )) {
var url = window . location . toString ();
if ( checked ) {
window . location = url . replace ( " checked=false " , " checked=true " );
}
else {
window . location = url . replace ( " checked=true " , " checked=false " );
}
}
else {
window . location = window . location + " &checked=true " ;
}
}
2017-01-18 17:33:28 +01:00
</ script >