2009-04-13 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/agent_manager.php: Fixed an error when an agent was created without name. Added support for new server assignment via server name instead of lot of comboboxes. Added os preview. * godmode/agentes/configurar_agente.php: Added support for new server assignment via server name. Do not show tabs on creation mode. Some translatable strings replaced with common ones. * godmode/agentes/modificar_agente.php: Use Pandora agents. * godmode/modules/manage_nc_groups.php, godmode/setup/news.php, godmode/modules/manage_network_components.php, godmode/reporting/map_builder.php, godmode/agentes/planned_downtime.php: Some translatable strings replaced with common ones. * godmode/servers/modificar_server.php: Updated to changes in tserver. Use get_server_info() for that. * include/functions_db.php: Updated to changes in tserver about server_type field on get_server_info(). Style correction. * include/functions_servers.php: Added to repository. Servers API. * operation/servers/view_server.php: Style correction. * extras/pandoradb_migrate_v2.x_to_v3.0.sql, pandoradb.sql: Less space on server_name field on tagente. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1615 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
88e97f3739
commit
4d5db04d77
|
@ -1,8 +1,40 @@
|
||||||
2009-04-13 Sancho Lerena
|
2009-04-13 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/agent_manager.php: Fixed an error when an agent was
|
||||||
|
created without name. Added support for new server assignment via server
|
||||||
|
name instead of lot of comboboxes. Added os preview.
|
||||||
|
|
||||||
|
* godmode/agentes/configurar_agente.php: Added support for new server
|
||||||
|
assignment via server name. Do not show tabs on creation mode. Some
|
||||||
|
translatable strings replaced with common ones.
|
||||||
|
|
||||||
|
* godmode/agentes/modificar_agente.php: Use Pandora agents.
|
||||||
|
|
||||||
|
* godmode/modules/manage_nc_groups.php,
|
||||||
|
godmode/setup/news.php,
|
||||||
|
godmode/modules/manage_network_components.php,
|
||||||
|
godmode/reporting/map_builder.php,
|
||||||
|
godmode/agentes/planned_downtime.php: Some translatable strings replaced
|
||||||
|
with common ones.
|
||||||
|
|
||||||
|
* godmode/servers/modificar_server.php: Updated to changes in tserver. Use
|
||||||
|
get_server_info() for that.
|
||||||
|
|
||||||
|
* include/functions_db.php: Updated to changes in tserver about
|
||||||
|
server_type field on get_server_info(). Style correction.
|
||||||
|
|
||||||
|
* include/functions_servers.php: Added to repository. Servers API.
|
||||||
|
|
||||||
|
* operation/servers/view_server.php: Style correction.
|
||||||
|
|
||||||
|
* extras/pandoradb_migrate_v2.x_to_v3.0.sql, pandoradb.sql: Less space on
|
||||||
|
server_name field on tagente.
|
||||||
|
|
||||||
|
2009-04-13 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* images/console/icons/server_warning.png: Added missing icon.
|
* images/console/icons/server_warning.png: Added missing icon.
|
||||||
|
|
||||||
2009-04-13 <jorgegonz@artica.es>
|
2009-04-13 Jorge Gonzalez <jorgegonz@artica.es>
|
||||||
|
|
||||||
* images/console/icons/smalldot.png: Modified icon for the maps.
|
* images/console/icons/smalldot.png: Modified icon for the maps.
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ ALTER TABLE `tmensajes` CHANGE `timestamp` `timestamp` BIGINT( 20 ) UNSIGNED
|
||||||
|
|
||||||
ALTER TABLE `tevento` CHANGE `event_type` `event_type` ENUM( 'unknown', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error', 'new_agent', 'going_up_warning', 'going_up_critical', 'going_down_warning', 'going_down_normal', 'going_down_critical', 'going_up_normal' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'unknown';
|
ALTER TABLE `tevento` CHANGE `event_type` `event_type` ENUM( 'unknown', 'alert_fired', 'alert_recovered', 'alert_ceased', 'alert_manual_validation', 'recon_host_detected', 'system', 'error', 'new_agent', 'going_up_warning', 'going_up_critical', 'going_down_warning', 'going_down_normal', 'going_down_critical', 'going_up_normal' ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'unknown';
|
||||||
|
|
||||||
ALTER TABLE tagente ADD `server_name` varchar(255) default '';
|
ALTER TABLE tagente ADD `server_name` varchar(100) default '';
|
||||||
ALTER TABLE tevento ADD `user_comment` varchar(255) NOT NULL default '';
|
ALTER TABLE tevento ADD `user_comment` varchar(255) NOT NULL default '';
|
||||||
ALTER TABLE tusuario ADD `language` varchar(10) default NULL;
|
ALTER TABLE tusuario ADD `language` varchar(10) default NULL;
|
||||||
ALTER TABLE tserver ADD `server_type` tinyint(3) unsigned NOT NULL default '0';
|
ALTER TABLE tserver ADD `server_type` tinyint(3) unsigned NOT NULL default '0';
|
||||||
|
|
|
@ -19,42 +19,45 @@
|
||||||
// Load global vars
|
// Load global vars
|
||||||
enterprise_include ('godmode/agentes/agent_manager.php');
|
enterprise_include ('godmode/agentes/agent_manager.php');
|
||||||
|
|
||||||
if (!isset ($id_agente)) {
|
require_once ('include/functions_servers.php');
|
||||||
|
|
||||||
|
$new_agent = (bool) get_parameter ('new_agent');
|
||||||
|
|
||||||
|
if (! isset ($id_agente) && ! $new_agent) {
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access agent manager witout an agent");
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access agent manager witout an agent");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================
|
echo "<h2>".__('Agent configuration')." » ";
|
||||||
// AGENT GENERAL DATA FORM
|
|
||||||
// ========================
|
|
||||||
|
|
||||||
echo "<h2>".__('Agent configuration');
|
if ($id_agente) {
|
||||||
$new_agent = (bool) get_parameter ('new_agent');
|
echo __('Update agent');
|
||||||
if ($new_agent) {
|
|
||||||
echo " » ".__('Create agent');
|
|
||||||
} else {
|
} else {
|
||||||
echo " » ".__('Update agent');
|
echo __('Create agent');
|
||||||
}
|
}
|
||||||
echo "</h2>";
|
echo "</h2>";
|
||||||
echo '<div style="height: 5px"> </div>';
|
echo '<div style="height: 5px"> </div>';
|
||||||
|
|
||||||
// Agent remote configuration editor
|
// Agent remote configuration editor
|
||||||
$agent_md5 = md5 ($nombre_agente, false);
|
$agent_md5 = md5 ($nombre_agente, false);
|
||||||
$filename['md5'] = $config["remote_config"] . "/" . $agent_md5 . ".md5";
|
$filename['md5'] = $config["remote_config"]."/".$agent_md5.".md5";
|
||||||
$filename['conf'] = $config["remote_config"] . "/" . $agent_md5 . ".conf";
|
$filename['conf'] = $config["remote_config"]."/".$agent_md5.".conf";
|
||||||
|
|
||||||
if (isset ($_GET["disk_conf"])) {
|
$disk_conf = (bool) get_parameter ('disk_conf');
|
||||||
|
|
||||||
|
if ($disk_conf) {
|
||||||
require ("agent_disk_conf_editor.php");
|
require ("agent_disk_conf_editor.php");
|
||||||
exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$disk_conf_delete = (bool) get_parameter ('disk_conf_delete');
|
||||||
// Agent remote configuration DELETE
|
// Agent remote configuration DELETE
|
||||||
if (isset($_GET["disk_conf_delete"])) {
|
if ($disk_conf_delete) {
|
||||||
//TODO: Get this working on computers where the Pandora server(s) are not on the webserver
|
//TODO: Get this working on computers where the Pandora server(s) are not on the webserver
|
||||||
//TODO: Get a remote_config editor working in the open version
|
//TODO: Get a remote_config editor working in the open version
|
||||||
unlink ($filename['md5']);
|
@unlink ($filename['md5']);
|
||||||
unlink ($filename['conf']);
|
@unlink ($filename['conf']);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
echo '<form name="conf_agent" method="post" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente">';
|
||||||
|
@ -70,7 +73,7 @@ $table->data = array ();
|
||||||
$table->data[0][0] = __('Agent name').print_help_tip (__("The agent's name must be the same as the one defined at the console"), true);
|
$table->data[0][0] = __('Agent name').print_help_tip (__("The agent's name must be the same as the one defined at the console"), true);
|
||||||
$table->data[0][1] = print_input_text ('agente', $nombre_agente, '', 30, 100,true);
|
$table->data[0][1] = print_input_text ('agente', $nombre_agente, '', 30, 100,true);
|
||||||
|
|
||||||
if (isset ($id_agente) && $id_agente != "") {
|
if ($id_agente) {
|
||||||
$table->data[0][1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
$table->data[0][1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||||
$table->data[0][1] .= print_image ("images/lupa.png", true, array ("border" => 0, "title" => __('Agent detail')));
|
$table->data[0][1] .= print_image ("images/lupa.png", true, array ("border" => 0, "title" => __('Agent detail')));
|
||||||
$table->data[0][1] .= '</a>';
|
$table->data[0][1] .= '</a>';
|
||||||
|
@ -86,7 +89,7 @@ if (file_exists ($filename['md5'])) {
|
||||||
$table->data[1][0] = __('IP Address');
|
$table->data[1][0] = __('IP Address');
|
||||||
$table->data[1][1] = print_input_text ('direccion', $direccion_agente, '', 16, 100, true);
|
$table->data[1][1] = print_input_text ('direccion', $direccion_agente, '', 16, 100, true);
|
||||||
|
|
||||||
if (! $new_agent) {
|
if ($id_agente) {
|
||||||
$table->data[1][1] .= ' ';
|
$table->data[1][1] .= ' ';
|
||||||
|
|
||||||
$ip_all = get_agent_addresses ($id_agente);
|
$ip_all = get_agent_addresses ($id_agente);
|
||||||
|
@ -108,67 +111,67 @@ $table->data[4][0] = __('Interval');
|
||||||
$table->data[4][1] = print_input_text ('intervalo', $intervalo, '', 16, 100, true);
|
$table->data[4][1] = print_input_text ('intervalo', $intervalo, '', 16, 100, true);
|
||||||
|
|
||||||
$table->data[5][0] = __('OS');
|
$table->data[5][0] = __('OS');
|
||||||
$table->data[5][1] = print_select_from_sql ('SELECT id_os, name FROM tconfig_os ORDER BY name', 'id_os', $id_os, '', '', '0', true);
|
$table->data[5][1] = print_select_from_sql ('SELECT id_os, name FROM tconfig_os',
|
||||||
|
'id_os', $id_os, '', '', '0', true);
|
||||||
|
$table->data[5][1] .= ' <span id="os_preview">';
|
||||||
|
$table->data[5][1] .= print_os_icon ($id_os, false, true);
|
||||||
|
$table->data[5][1] .= '</span>';
|
||||||
|
|
||||||
// Network server
|
// Network server
|
||||||
$table->data[6][0] = __('Network Server').print_help_tip (__('You must select a Network Server for the Agent, so it can work properly with this kind of modules'), true);
|
|
||||||
$table->data[6][1] = print_select_from_sql ('SELECT id_server, name FROM tserver WHERE network_server = 1 ORDER BY name', 'network_server', $id_network_server, '', '', 0, true);
|
|
||||||
|
|
||||||
// Plugin server
|
$table->data[6][0] = __('Server');
|
||||||
$table->data[7][0] = __('Plugin Server').print_help_tip (__('You must select a Plugin Server for the Agent, so it can work properly with this kind of modules'), true);
|
$table->data[6][1] = print_select (get_server_names (),
|
||||||
$table->data[7][1] = print_select_from_sql ('SELECT id_server, name FROM tserver WHERE plugin_server = 1 ORDER BY name', 'plugin_server', $id_plugin_server, '', '', 0, true);
|
'server_name', $server_name, '', '', 0, true);
|
||||||
|
|
||||||
// WMI Server
|
|
||||||
$table->data[8][0] = __('WMI Server').print_help_tip (__('You must select a WMI Server for the Agent, so it can work properly with this kind of modules'), true);
|
|
||||||
$table->data[8][1] = print_select_from_sql ('SELECT id_server, name FROM tserver WHERE wmi_server = 1 ORDER BY name', 'wmi_server', $id_wmi_server, '', '', 0, true);
|
|
||||||
|
|
||||||
// Prediction Server
|
|
||||||
$table->data[9][0] = __('Prediction Server').print_help_tip (__('You must select a Prediction Server for the Agent, so it can work properly with this kind of modules'), true);
|
|
||||||
$table->data[9][1] = print_select_from_sql ('SELECT id_server, name FROM tserver WHERE prediction_server = 1 ORDER BY name', 'prediction_server', $id_prediction_server, '', '', 0, true);
|
|
||||||
|
|
||||||
// 10
|
|
||||||
enterprise_hook ('inventory_server');
|
|
||||||
|
|
||||||
// Custom ID
|
// Custom ID
|
||||||
$table->data[11][0] = __('Custom ID');
|
$table->data[7][0] = __('Custom ID');
|
||||||
$table->data[11][1] = print_input_text ('custom_id', $custom_id, '', 16, 255, true);
|
$table->data[7][1] = print_input_text ('custom_id', $custom_id, '', 16, 255, true);
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
$table->data[12][0] = __('Description');
|
$table->data[8][0] = __('Description');
|
||||||
$table->data[12][1] = print_input_text ('comentarios', $comentarios, '', 45, 255, true);
|
$table->data[8][1] = print_input_text ('comentarios', $comentarios, '', 45, 255, true);
|
||||||
|
|
||||||
// Learn mode / Normal mode
|
// Learn mode / Normal mode
|
||||||
$table->data[13][0] = __('Module definition').print_help_icon("module_definition", true);
|
$table->data[9][0] = __('Module definition').print_help_icon("module_definition", true);
|
||||||
$table->data[13][1] = __('Learning mode').' '.print_radio_button_extended ("modo", 1, '', $modo, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[9][1] = __('Learning mode').' '.print_radio_button_extended ("modo", 1, '', $modo, false, '', 'style="margin-right: 40px;"', true);
|
||||||
$table->data[13][1] .= __('Normal mode').' '.print_radio_button_extended ("modo", 0, '', $modo, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[9][1] .= __('Normal mode').' '.print_radio_button_extended ("modo", 0, '', $modo, false, '', 'style="margin-right: 40px;"', true);
|
||||||
|
|
||||||
// Status (Disabled / Enabled)
|
// Status (Disabled / Enabled)
|
||||||
$table->data[14][0] = __('Status');
|
$table->data[10][0] = __('Status');
|
||||||
$table->data[14][1] = __('Disabled').' '.print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[10][1] = __('Disabled').' '.print_radio_button_extended ("disabled", 1, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||||
$table->data[14][1] .= __('Active').' '.print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
$table->data[10][1] .= __('Active').' '.print_radio_button_extended ("disabled", 0, '', $disabled, false, '', 'style="margin-right: 40px;"', true);
|
||||||
|
|
||||||
// Remote configuration
|
// Remote configuration
|
||||||
$table->data[15][0] = __('Remote configuration');
|
$table->data[11][0] = __('Remote configuration');
|
||||||
|
|
||||||
if (file_exists ($filename['md5'])) {
|
if (file_exists ($filename['md5'])) {
|
||||||
$table->data[15][1] = date ("F d Y H:i:s.", fileatime ($filename['md5']));
|
$table->data[11][1] = date ("F d Y H:i:s", fileatime ($filename['md5']));
|
||||||
// Delete remote configuration
|
// Delete remote configuration
|
||||||
$table->data[15][1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente.'">';
|
$table->data[11][1] .= '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&disk_conf_delete=1&id_agente='.$id_agente.'">';
|
||||||
$table->data[15][1] .= print_image ("images/cross.png", true).'</a>';
|
$table->data[11][1] .= print_image ("images/cross.png", true).'</a>';
|
||||||
} else {
|
} else {
|
||||||
$table->data[15][1] = '<em>'.__('Not available').'</em>';
|
$table->data[11][1] = '<em>'.__('Not available').'</em>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print_table ($table);
|
print_table ($table);
|
||||||
|
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
if ($new_agent) {
|
if ($id_agente) {
|
||||||
print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
|
||||||
print_input_hidden ('create_agent', 1);
|
|
||||||
} else {
|
|
||||||
print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||||
print_input_hidden ('update_agent', 1);
|
print_input_hidden ('update_agent', 1);
|
||||||
print_input_hidden ('id_agente', $id_agente);
|
print_input_hidden ('id_agente', $id_agente);
|
||||||
|
} else {
|
||||||
|
print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
|
||||||
|
print_input_hidden ('create_agent', 1);
|
||||||
}
|
}
|
||||||
echo '</div></form>';
|
echo '</div></form>';
|
||||||
|
|
||||||
|
require_jquery_file ('pandora.controls');
|
||||||
?>
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
|
$(document).ready (function () {
|
||||||
|
$("select#id_os").pandoraSelectOS ();
|
||||||
|
});
|
||||||
|
/* ]]> */
|
||||||
|
</script>
|
||||||
|
|
|
@ -24,9 +24,10 @@ enterprise_include ('godmode/agentes/configurar_agente.php');
|
||||||
check_login ();
|
check_login ();
|
||||||
|
|
||||||
//See if id_agente is set (either POST or GET, otherwise -1
|
//See if id_agente is set (either POST or GET, otherwise -1
|
||||||
$id_agente = (int) get_parameter ("id_agente", -1);
|
$id_agente = (int) get_parameter ("id_agente");
|
||||||
|
$group = 0;
|
||||||
$group = get_agent_group ($id_agente);
|
if ($id_agente)
|
||||||
|
$group = get_agent_group ($id_agente);
|
||||||
|
|
||||||
if (! give_acl ($config["id_user"], $group, "AW")) {
|
if (! give_acl ($config["id_user"], $group, "AW")) {
|
||||||
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
|
||||||
|
@ -98,12 +99,9 @@ $alert_d6 = 1;
|
||||||
$alert_d7 = 1;
|
$alert_d7 = 1;
|
||||||
$alert_recovery = 0;
|
$alert_recovery = 0;
|
||||||
$alert_priority = 0;
|
$alert_priority = 0;
|
||||||
$id_network_server = 0;
|
$server_name = '';
|
||||||
$id_plugin_server = 0;
|
|
||||||
$id_prediction_server = 0;
|
|
||||||
$id_wmi_server = 0;
|
|
||||||
$grupo = 0;
|
$grupo = 0;
|
||||||
$id_os = 0;
|
$id_os = 9; // Windows
|
||||||
$custom_id = "";
|
$custom_id = "";
|
||||||
|
|
||||||
$create_agent = (bool) get_parameter ('create_agent');
|
$create_agent = (bool) get_parameter ('create_agent');
|
||||||
|
@ -117,10 +115,7 @@ if ($create_agent) {
|
||||||
$comentarios = (string)get_parameter_post ("comentarios");
|
$comentarios = (string)get_parameter_post ("comentarios");
|
||||||
$modo = (int) get_parameter_post ("modo");
|
$modo = (int) get_parameter_post ("modo");
|
||||||
$id_parent = (int) get_parameter_post ("id_parent");
|
$id_parent = (int) get_parameter_post ("id_parent");
|
||||||
$id_network_server = (int) get_parameter_post ("network_server");
|
$server_name = (string) get_parameter_post ("server_name");
|
||||||
$id_plugin_server = (int) get_parameter_post ("plugin_server");
|
|
||||||
$id_prediction_server = (int) get_parameter_post ("prediction_server");
|
|
||||||
$id_wmi_server = (int) get_parameter_post ("wmi_server");
|
|
||||||
$id_os = (int) get_parameter_post ("id_os");
|
$id_os = (int) get_parameter_post ("id_os");
|
||||||
$disabled = (int) get_parameter_post ("disabled");
|
$disabled = (int) get_parameter_post ("disabled");
|
||||||
$custom_id = (string) get_parameter_post ("custom_id");
|
$custom_id = (string) get_parameter_post ("custom_id");
|
||||||
|
@ -139,10 +134,7 @@ if ($create_agent) {
|
||||||
'id_grupo' => $grupo, 'intervalo' => $intervalo,
|
'id_grupo' => $grupo, 'intervalo' => $intervalo,
|
||||||
'comentarios' => $comentarios, 'modo' => $modo,
|
'comentarios' => $comentarios, 'modo' => $modo,
|
||||||
'id_os' => $id_os, 'disabled' => $disabled,
|
'id_os' => $id_os, 'disabled' => $disabled,
|
||||||
'id_network_server' => $id_network_server,
|
'server_name' => $server_name,
|
||||||
'id_plugin_server' => $id_plugin_server,
|
|
||||||
'id_wmi_server' => $id_wmi_server,
|
|
||||||
'id_prediction_server' => $id_prediction_server,
|
|
||||||
'id_parent' => $id_parent, 'custom_id' => $custom_id));
|
'id_parent' => $id_parent, 'custom_id' => $custom_id));
|
||||||
enterprise_hook ('update_agent', array ($id_agente));
|
enterprise_hook ('update_agent', array ($id_agente));
|
||||||
if ($id_agente !== false) {
|
if ($id_agente !== false) {
|
||||||
|
@ -180,8 +172,8 @@ if ($create_agent) {
|
||||||
$agent_created_ok = false;
|
$agent_created_ok = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$id_agente = -1;
|
$id_agente = 0;
|
||||||
$agent_creation_error = __("There was a problem creating the agent");
|
$agent_creation_error = __('Could not be created');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,50 +181,52 @@ if ($create_agent) {
|
||||||
// Show tabs
|
// Show tabs
|
||||||
$img_style = array ("class" => "top", "width" => 16);
|
$img_style = array ("class" => "top", "width" => 16);
|
||||||
|
|
||||||
echo '<div id="menu_tab_frame"><div id="menu_tab_left"><ul class="mn">';
|
if ($id_agente) {
|
||||||
echo '<li class="nomn"><a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">';
|
echo '<div id="menu_tab_frame"><div id="menu_tab_left"><ul class="mn">';
|
||||||
print_image ("images/setup.png", false, $img_style);
|
echo '<li class="nomn"><a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">';
|
||||||
echo ' '.mb_substr (get_agent_name ($id_agente),0,21).'</a>';
|
print_image ("images/setup.png", false, $img_style);
|
||||||
echo "</li></ul></div>";
|
echo ' '.mb_substr (get_agent_name ($id_agente), 0, 21).'</a>';
|
||||||
|
echo "</li></ul></div>";
|
||||||
|
|
||||||
echo '<div id="menu_tab"><ul class="mn"><li class="nomn">';
|
echo '<div id="menu_tab"><ul class="mn"><li class="nomn">';
|
||||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
echo '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">';
|
||||||
print_image ("images/zoom.png", false, $img_style);
|
print_image ("images/zoom.png", false, $img_style);
|
||||||
echo ' '.__('View').'</a></li>';
|
echo ' '.__('View').'</a></li>';
|
||||||
|
|
||||||
echo '<li class="'.($tab == "main" ? 'nomn_high' : 'nomn').'">';
|
echo '<li class="'.($tab == "main" ? 'nomn_high' : 'nomn').'">';
|
||||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">';
|
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">';
|
||||||
print_image ("images/cog.png", false, $img_style);
|
print_image ("images/cog.png", false, $img_style);
|
||||||
echo ' '.__('Setup').'</a></li>';
|
echo ' '.__('Setup').'</a></li>';
|
||||||
|
|
||||||
echo '<li class="'.($tab == "module" ? 'nomn_high' : 'nomn').'">';
|
echo '<li class="'.($tab == "module" ? 'nomn_high' : 'nomn').'">';
|
||||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">';
|
||||||
print_image ("images/lightbulb.png", false, $img_style);
|
print_image ("images/lightbulb.png", false, $img_style);
|
||||||
echo ' '.__('Modules').'</a></li>';
|
echo ' '.__('Modules').'</a></li>';
|
||||||
|
|
||||||
echo '<li class="'.($tab == "alert" ? 'nomn_high' : 'nomn').'">';
|
echo '<li class="'.($tab == "alert" ? 'nomn_high' : 'nomn').'">';
|
||||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'">';
|
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'">';
|
||||||
print_image ("images/bell.png", false, $img_style);
|
print_image ("images/bell.png", false, $img_style);
|
||||||
echo ' '.__('Alerts').'</a></li>';
|
echo ' '.__('Alerts').'</a></li>';
|
||||||
|
|
||||||
echo '<li class="'.($tab == "template" ? 'nomn_high' : 'nomn').'">';
|
echo '<li class="'.($tab == "template" ? 'nomn_high' : 'nomn').'">';
|
||||||
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
|
echo '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">';
|
||||||
print_image ("images/network.png", false, $img_style);
|
print_image ("images/network.png", false, $img_style);
|
||||||
echo ' '.__('Net. Templates').'</a></li>';
|
echo ' '.__('Net. Templates').'</a></li>';
|
||||||
|
|
||||||
enterprise_hook ('inventory_tab');
|
enterprise_hook ('inventory_tab');
|
||||||
|
|
||||||
echo "</ul></div></div>";
|
echo "</ul></div></div>";
|
||||||
|
|
||||||
// Make some space between tabs and title
|
// Make some space between tabs and title
|
||||||
// IE might not always show an empty div, added space
|
// IE might not always show an empty div, added space
|
||||||
echo '<div style="height: 25px;"> </div>';
|
echo '<div style="height: 25px;"> </div>';
|
||||||
|
}
|
||||||
|
|
||||||
// Show agent creation results
|
// Show agent creation results
|
||||||
if ($create_agent) {
|
if ($create_agent) {
|
||||||
print_result_message ($agent_created_ok,
|
print_result_message ($agent_created_ok,
|
||||||
__('Agent successfully created'),
|
__('Successfully created'),
|
||||||
__('There was a problem creating the agent'));
|
__('Could not be created'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix / Normalize module data
|
// Fix / Normalize module data
|
||||||
|
@ -261,7 +255,7 @@ if (isset($_GET["fix_module"])){
|
||||||
// Update AGENT
|
// Update AGENT
|
||||||
// ================
|
// ================
|
||||||
if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
||||||
$id_agente = (int) get_parameter_post ("id_agente", 0);
|
$id_agente = (int) get_parameter_post ("id_agente");
|
||||||
$nombre_agente = (string) get_parameter_post ("agente");
|
$nombre_agente = (string) get_parameter_post ("agente");
|
||||||
$direccion_agente = (string) get_parameter_post ("direccion");
|
$direccion_agente = (string) get_parameter_post ("direccion");
|
||||||
$address_list = (string) get_parameter_post ("address_list");
|
$address_list = (string) get_parameter_post ("address_list");
|
||||||
|
@ -278,10 +272,7 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
||||||
$modo = (bool) get_parameter_post ("modo", 0); //Mode: Learning or Normal
|
$modo = (bool) get_parameter_post ("modo", 0); //Mode: Learning or Normal
|
||||||
$id_os = (int) get_parameter_post ("id_os");
|
$id_os = (int) get_parameter_post ("id_os");
|
||||||
$disabled = (bool) get_parameter_post ("disabled");
|
$disabled = (bool) get_parameter_post ("disabled");
|
||||||
$id_network_server = (int) get_parameter_post ("network_server", 0);
|
$server_name = (string) get_parameter_post ("server_name");
|
||||||
$id_plugin_server = (int) get_parameter_post ("plugin_server", 0);
|
|
||||||
$id_wmi_server = (int) get_parameter_post ("wmi_server", 0);
|
|
||||||
$id_prediction_server = (int) get_parameter_post ("prediction_server", 0);
|
|
||||||
$id_parent = (int) get_parameter_post ("id_parent", 0);
|
$id_parent = (int) get_parameter_post ("id_parent", 0);
|
||||||
$custom_id = (string) get_parameter_post ("custom_id", "");
|
$custom_id = (string) get_parameter_post ("custom_id", "");
|
||||||
|
|
||||||
|
@ -302,18 +293,19 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
||||||
agent_delete_address ($id_agente, $delete_ip);
|
agent_delete_address ($id_agente, $delete_ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now update the thing
|
$result = process_sql_update ('tagente',
|
||||||
$sql = sprintf ("UPDATE tagente
|
array ('disabled' => $disabled,
|
||||||
SET disabled = %d, id_parent = %d, id_os = %d, modo = %d,
|
'id_parent' => $id_parent,
|
||||||
nombre = '%s', direccion = '%s', id_grupo = %d,
|
'id_os' => $id_os,
|
||||||
intervalo = %d, comentarios = '%s', id_network_server = %d,
|
'modo' => $modo,
|
||||||
id_plugin_server = %d, id_wmi_server = %d, id_prediction_server = %d,
|
'nombre' => $nombre_agente,
|
||||||
custom_id = '%s' WHERE id_agente = %d",
|
'direccion' => $direccion_agente,
|
||||||
$disabled, $id_parent, $id_os, $modo, $nombre_agente,
|
'id_grupo' => $grupo,
|
||||||
$direccion_agente, $grupo, $intervalo, $comentarios,
|
'intervalo' => $intervalo,
|
||||||
$id_network_server, $id_plugin_server, $id_wmi_server,
|
'comentarios' => $comentarios,
|
||||||
$id_prediction_server, $custom_id, $id_agente);
|
'server_name' => $server_name,
|
||||||
$result = process_sql ($sql);
|
'custom_id' => $custom_id),
|
||||||
|
array ('id_agente' => $id_agente));
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
echo '<h3 class="error">'.__('There was a problem updating agent').'</h3>';
|
echo '<h3 class="error">'.__('There was a problem updating agent').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -325,7 +317,7 @@ if (isset($_POST["update_agent"])) { // if modified some agent paramenter
|
||||||
|
|
||||||
// Read agent data
|
// Read agent data
|
||||||
// This should be at the end of all operation checks, to read the changes - $id_agente doesn't have to be retrieved
|
// This should be at the end of all operation checks, to read the changes - $id_agente doesn't have to be retrieved
|
||||||
if ($id_agente > 0) {
|
if ($id_agente) {
|
||||||
//This has been done in the beginning of the page, but if an agent was created, this id might change
|
//This has been done in the beginning of the page, but if an agent was created, this id might change
|
||||||
$id_grupo = get_agent_group ($id_agente);
|
$id_grupo = get_agent_group ($id_agente);
|
||||||
if (give_acl ($config["id_user"], $id_grupo, "AW") != 1) {
|
if (give_acl ($config["id_user"], $id_grupo, "AW") != 1) {
|
||||||
|
@ -347,10 +339,7 @@ if ($id_agente > 0) {
|
||||||
$grupo = $agent["id_grupo"];
|
$grupo = $agent["id_grupo"];
|
||||||
$ultima_act = $agent["ultimo_contacto"];
|
$ultima_act = $agent["ultimo_contacto"];
|
||||||
$comentarios = $agent["comentarios"];
|
$comentarios = $agent["comentarios"];
|
||||||
$id_plugin_server = $agent["id_plugin_server"];
|
$server_name = $agent["server_name"];
|
||||||
$id_network_server = $agent["id_network_server"];
|
|
||||||
$id_prediction_server = $agent["id_prediction_server"];
|
|
||||||
$id_wmi_server = $agent["id_wmi_server"];
|
|
||||||
$modo = $agent["modo"];
|
$modo = $agent["modo"];
|
||||||
$id_os = $agent["id_os"];
|
$id_os = $agent["id_os"];
|
||||||
$disabled = $agent["disabled"];
|
$disabled = $agent["disabled"];
|
||||||
|
@ -415,20 +404,33 @@ if ($update_module) {
|
||||||
|
|
||||||
$result = process_sql_update ('tagente_modulo',
|
$result = process_sql_update ('tagente_modulo',
|
||||||
array ('descripcion' => $description,
|
array ('descripcion' => $description,
|
||||||
'id_module_group' => $id_module_group, 'nombre' => $name,
|
'id_module_group' => $id_module_group,
|
||||||
'max' => $maxvalue, 'min' => $minvalue, 'module_interval' => $interval,
|
'nombre' => $name,
|
||||||
'tcp_port' => $tcp_port, 'tcp_send' => $tcp_send,
|
'max' => $maxvalue,
|
||||||
'tcp_rcv' => $tcp_rcv, 'snmp_community' => $snmp_community,
|
'min' => $minvalue,
|
||||||
'snmp_oid' => $snmp_oid, 'ip_target' => $ip_target,
|
'module_interval' => $interval,
|
||||||
'flag' => $flag, 'disabled' => $disabled,
|
'tcp_port' => $tcp_port,
|
||||||
'id_export' => $id_export, 'plugin_user' => $plugin_user,
|
'tcp_send' => $tcp_send,
|
||||||
'plugin_pass' => $plugin_pass, 'plugin_parameter' => $plugin_parameter,
|
'tcp_rcv' => $tcp_rcv,
|
||||||
'id_plugin' => $id_plugin, 'post_process' => $post_process,
|
'snmp_community' => $snmp_community,
|
||||||
|
'snmp_oid' => $snmp_oid,
|
||||||
|
'ip_target' => $ip_target,
|
||||||
|
'flag' => $flag,
|
||||||
|
'disabled' => $disabled,
|
||||||
|
'id_export' => $id_export,
|
||||||
|
'plugin_user' => $plugin_user,
|
||||||
|
'plugin_pass' => $plugin_pass,
|
||||||
|
'plugin_parameter' => $plugin_parameter,
|
||||||
|
'id_plugin' => $id_plugin,
|
||||||
|
'post_process' => $post_process,
|
||||||
'prediction_module' => $prediction_module,
|
'prediction_module' => $prediction_module,
|
||||||
'max_timeout' => $max_timeout, 'custom_id' => $custom_id,
|
'max_timeout' => $max_timeout,
|
||||||
|
'custom_id' => $custom_id,
|
||||||
'history_data' => $history_data,
|
'history_data' => $history_data,
|
||||||
'min_warning' => $min_warning, 'max_warning' => $max_warning,
|
'min_warning' => $min_warning,
|
||||||
'min_critical' => $min_critical, 'max_critical' => $max_critical,
|
'max_warning' => $max_warning,
|
||||||
|
'min_critical' => $min_critical,
|
||||||
|
'max_critical' => $max_critical,
|
||||||
'min_ff_event' => $ff_event
|
'min_ff_event' => $ff_event
|
||||||
),
|
),
|
||||||
'id_agente_modulo = '.$id_agent_module);
|
'id_agente_modulo = '.$id_agent_module);
|
||||||
|
@ -456,21 +458,35 @@ if ($create_module) {
|
||||||
$id_agent_module = process_sql_insert ('tagente_modulo',
|
$id_agent_module = process_sql_insert ('tagente_modulo',
|
||||||
array ('id_agente' => $id_agente,
|
array ('id_agente' => $id_agente,
|
||||||
'id_tipo_modulo' => $id_module_type,
|
'id_tipo_modulo' => $id_module_type,
|
||||||
'nombre' => $name, 'descripcion' => $description, 'max' => $maxvalue,
|
'nombre' => $name,
|
||||||
'min' => $minvalue, 'snmp_oid' => $snmp_oid,
|
'descripcion' => $description,
|
||||||
|
'max' => $maxvalue,
|
||||||
|
'min' => $minvalue,
|
||||||
|
'snmp_oid' => $snmp_oid,
|
||||||
'snmp_community' => $snmp_community,
|
'snmp_community' => $snmp_community,
|
||||||
'id_module_group' => $id_module_group, 'module_interval' => $interval,
|
'id_module_group' => $id_module_group,
|
||||||
'ip_target' => $ip_target, 'tcp_port' => $tcp_port,
|
'module_interval' => $interval,
|
||||||
'tcp_rcv' => $tcp_rcv, 'tcp_send' => $tcp_send,
|
'ip_target' => $ip_target,
|
||||||
'id_export' => $id_export, 'plugin_user' => $plugin_user,
|
'tcp_port' => $tcp_port,
|
||||||
'plugin_pass' => $plugin_pass, 'plugin_parameter' => $plugin_parameter,
|
'tcp_rcv' => $tcp_rcv,
|
||||||
'id_plugin' => $id_plugin, 'post_process' => $post_process,
|
'tcp_send' => $tcp_send,
|
||||||
|
'id_export' => $id_export,
|
||||||
|
'plugin_user' => $plugin_user,
|
||||||
|
'plugin_pass' => $plugin_pass,
|
||||||
|
'plugin_parameter' => $plugin_parameter,
|
||||||
|
'id_plugin' => $id_plugin,
|
||||||
|
'post_process' => $post_process,
|
||||||
'prediction_module' => $id_prediction_module,
|
'prediction_module' => $id_prediction_module,
|
||||||
'max_timeout' => $max_timeout, 'disabled' => $disabled,
|
'max_timeout' => $max_timeout,
|
||||||
'id_modulo' => $id_module, 'custom_id' => $custom_id,
|
'disabled' => $disabled,
|
||||||
'history_data' => $history_data, 'min_warning' => $min_warning,
|
'id_modulo' => $id_module,
|
||||||
'max_warning' => $max_warning, 'min_critical' => $min_critical,
|
'custom_id' => $custom_id,
|
||||||
'max_critical' => $max_critical, 'min_ff_event' => $ff_event
|
'history_data' => $history_data,
|
||||||
|
'min_warning' => $min_warning,
|
||||||
|
'max_warning' => $max_warning,
|
||||||
|
'min_critical' => $min_critical,
|
||||||
|
'max_critical' => $max_critical,
|
||||||
|
'min_ff_event' => $ff_event
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($id_agent_module === false) {
|
if ($id_agent_module === false) {
|
||||||
|
|
|
@ -113,9 +113,9 @@ if ($create_downtime || $update_downtime) {
|
||||||
|
|
||||||
$result = process_sql ($sql);
|
$result = process_sql ($sql);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
echo '<h3 class="error">'.__('Not created. Error inserting data').'</h3>';
|
echo '<h3 class="error">'.__('Could not be created').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
echo '<h3 class="suc">'.__('Created successfully').'</h3>';
|
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ if ($create) {
|
||||||
array ('name' => $name,
|
array ('name' => $name,
|
||||||
'parent' => $parent));
|
'parent' => $parent));
|
||||||
print_result_message ($result,
|
print_result_message ($result,
|
||||||
__('Created successfully'),
|
__('Successfully created'),
|
||||||
__('Not created. Error inserting data'));
|
__('Could not be created'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
|
|
|
@ -73,9 +73,9 @@ if (isset($_GET["create"])){ // Create module
|
||||||
|
|
||||||
$id_module = process_sql ($sql, 'insert_id');
|
$id_module = process_sql ($sql, 'insert_id');
|
||||||
if ($id_module === false)
|
if ($id_module === false)
|
||||||
echo "<h3 class='error'>".__('Not created. Error inserting data')."</h3>";
|
echo "<h3 class='error'>".__('Could not be created')."</h3>";
|
||||||
else {
|
else {
|
||||||
echo "<h3 class='suc'>".__('Created successfully')."</h3>";
|
echo "<h3 class='suc'>".__('Successfully created')."</h3>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,9 @@ if ($create_layout) {
|
||||||
|
|
||||||
$id_layout = process_sql_insert ('tlayout', $values);
|
$id_layout = process_sql_insert ('tlayout', $values);
|
||||||
if ($id_layout !== false) {
|
if ($id_layout !== false) {
|
||||||
echo '<h3 class="suc">'.__('Created successfully').'</h3>';
|
echo '<h3 class="suc">'.__('Successfully ').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
echo '<h3 class="err">'.__('Not created. Error inserting data').'</h3>';
|
echo '<h3 class="err">'.__('Could not be created').'</h3>';
|
||||||
}
|
}
|
||||||
if (is_ajax ()) {
|
if (is_ajax ()) {
|
||||||
exit;
|
exit;
|
||||||
|
@ -172,9 +172,9 @@ if ($create_layout_data) {
|
||||||
$result = process_sql_insert ('tlayout_data', $values);
|
$result = process_sql_insert ('tlayout_data', $values);
|
||||||
|
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
echo '<h3 class="suc">'.__('Created successfully').'</h3>';
|
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
||||||
} else {
|
} else {
|
||||||
echo '<h3 class="error">'.__('Not created. Error inserting data').'</h3>';
|
echo '<h3 class="error">'.__('Could not be created').'</h3>';
|
||||||
}
|
}
|
||||||
if (is_ajax ()) {
|
if (is_ajax ()) {
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -75,52 +75,53 @@ if (isset($_GET["server"])) {
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$result = get_db_all_rows_in_table ("tserver");
|
$servers = get_server_info ();
|
||||||
echo "<h2>".__('Pandora servers')." » ".__('Manage servers')."</h2>";
|
echo "<h2>".__('Pandora servers')." » ".__('Manage servers')."</h2>";
|
||||||
|
|
||||||
if ($result !== false) {
|
if ($result !== false) {
|
||||||
$table->cellpadding = 4;
|
|
||||||
$table->cellspacing = 4;
|
|
||||||
$table->width = "90%";
|
$table->width = "90%";
|
||||||
$table->class = "databox";
|
$table->class = "databox";
|
||||||
$table->align = array ('',"center","center","center","center","center","center","center");
|
$table->data = array ();
|
||||||
$table->head = array (__('Name'),__('Status'),__('Description'),__('Type'),__('Started'),__('Updated'),__('Delete'));
|
|
||||||
|
|
||||||
foreach ($result as $row) {
|
$table->align = array ();
|
||||||
$server = "";
|
$table->align[1] = "center";
|
||||||
if($row["network_server"] == 1) {
|
$table->align[2] = "center";
|
||||||
$server .= '<img src="images/network.png" /> ';
|
$table->align[3] = "center";
|
||||||
}
|
$table->align[4] = "center";
|
||||||
if ($row["data_server"] == 1) {
|
$table->align[5] = "center";
|
||||||
$server .= '<img src="images/data.png" /> ';
|
$table->align[6] = "center";
|
||||||
}
|
$table->align[7] = "center";
|
||||||
if ($row["snmp_server"] == 1) {
|
$table->style = array ();
|
||||||
$server .= '<img src="images/snmp.png" /> ';
|
$table->style[0] = 'font-weight: bold';
|
||||||
}
|
$table->head = array ();
|
||||||
if ($row["master"] == 1) {
|
$table->head[0] = __('Name');
|
||||||
$server .= '<img src="images/master.png" /> ';
|
$table->head[1] = __('Status');
|
||||||
}
|
$table->head[2] = __('Description');
|
||||||
if ($row["checksum"] == 1) {
|
$table->head[3] = __('Type');
|
||||||
$server .= '<img src="images/binary.png" /> ';
|
$table->head[4] = __('Started');
|
||||||
}
|
$table->head[5] = __('Updated');
|
||||||
|
$table->head[6] = __('Delete');
|
||||||
|
|
||||||
if ($row['status'] == 0) {
|
foreach ($servers as $server) {
|
||||||
$server_status = print_status_image(STATUS_SERVER_DOWN, '', true);
|
if ($server['status'] == 0) {
|
||||||
|
$server_status = print_status_image (STATUS_SERVER_DOWN, '', true);
|
||||||
} else {
|
} else {
|
||||||
$server_status = print_status_image(STATUS_SERVER_OK, '', true);
|
$server_status = print_status_image (STATUS_SERVER_OK, '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->data[] = array (
|
$data = array ();
|
||||||
'<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$row["id_server"].'"><b>'.$row["name"].'</b></a>',
|
|
||||||
$server_status,
|
$data[0] = '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server["id_server"].'">'.$server["name"].'</a>';
|
||||||
substr($row["description"],0,25),
|
$data[1] = $server_status;
|
||||||
$server,
|
$data[2] = substr ($server["description"], 0, 25);
|
||||||
human_time_comparation ($row["laststart"]),
|
$data[3] = $server['img'];
|
||||||
human_time_comparation ($row["keepalive"]),
|
$data[4] = human_time_comparation ($server["laststart"]);
|
||||||
'<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$row["id_server"].'&delete"><img src="images/cross.png" border="0">'
|
$data[5] = human_time_comparation ($server["keepalive"]);
|
||||||
);
|
$data[6] = '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server["id_server"].'&delete=1">';
|
||||||
|
$data[6] .= print_image ('images/cross.png', true, array ('title' => __('Delete')));
|
||||||
|
$data[6] .= '</a>';
|
||||||
|
|
||||||
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
print_table ($table);
|
print_table ($table);
|
||||||
|
|
||||||
|
@ -133,7 +134,6 @@ if (isset($_GET["server"])) {
|
||||||
echo '<td><span class="binary">'.__('MD5 Check').'</span></td>';
|
echo '<td><span class="binary">'.__('MD5 Check').'</span></td>';
|
||||||
echo '<td><span class="snmp">'.__('SNMP Console').'</span></td>';
|
echo '<td><span class="snmp">'.__('SNMP Console').'</span></td>';
|
||||||
echo "</tr></table>";
|
echo "</tr></table>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
|
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ if (isset ($_POST["create"])) { // If create
|
||||||
$id_link = process_sql ($sql, "insert_id");
|
$id_link = process_sql ($sql, "insert_id");
|
||||||
|
|
||||||
print_result_message ($id_link,
|
print_result_message ($id_link,
|
||||||
__('Created successfully'),
|
__('Successfully created'),
|
||||||
__('Not created. Error inserting data'));
|
__('Could not be created'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($_POST["update"])) { // if update
|
if (isset ($_POST["update"])) { // if update
|
||||||
|
|
|
@ -1214,8 +1214,8 @@ function get_users_info ($order = "fullname", $info = "fullname") {
|
||||||
*
|
*
|
||||||
* @return array A list of the groups the user has certain privileges.
|
* @return array A list of the groups the user has certain privileges.
|
||||||
*/
|
*/
|
||||||
function get_user_groups ($id_user = 0, $privilege = "AR") {
|
function get_user_groups ($id_user = false, $privilege = "AR") {
|
||||||
if ($id_user == 0) {
|
if (empty ($id_user)) {
|
||||||
global $config;
|
global $config;
|
||||||
$id_user = $config['id_user'];
|
$id_user = $config['id_user'];
|
||||||
}
|
}
|
||||||
|
@ -2674,10 +2674,10 @@ function get_server_info ($id_server = -1) {
|
||||||
$modules_info = array ();
|
$modules_info = array ();
|
||||||
$modules_total = array ();
|
$modules_total = array ();
|
||||||
$result = get_db_all_rows_sql ("SELECT DISTINCT(tagente_estado.running_by), COUNT(*) AS modules, id_modulo
|
$result = get_db_all_rows_sql ("SELECT DISTINCT(tagente_estado.running_by), COUNT(*) AS modules, id_modulo
|
||||||
FROM tagente_estado, tagente_modulo
|
FROM tagente_estado, tagente_modulo
|
||||||
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
WHERE tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0
|
AND tagente_modulo.disabled = 0
|
||||||
AND tagente_modulo.delete_pending = 0 GROUP BY running_by");
|
AND tagente_modulo.delete_pending = 0 GROUP BY running_by");
|
||||||
if (empty ($result)) {
|
if (empty ($result)) {
|
||||||
$result = array ();
|
$result = array ();
|
||||||
}
|
}
|
||||||
|
@ -2703,46 +2703,62 @@ function get_server_info ($id_server = -1) {
|
||||||
|
|
||||||
$return = array ();
|
$return = array ();
|
||||||
foreach ($result as $server) {
|
foreach ($result as $server) {
|
||||||
if ($server['network_server'] == 1) {
|
switch ($server['server_type']) {
|
||||||
$server["img"] = print_image ("images/network.png", true, array ("title" => __('Network Server')));
|
case 0:
|
||||||
$server["type"] = "network";
|
|
||||||
$id_modulo = 2;
|
|
||||||
} elseif ($server['data_server'] == 1) {
|
|
||||||
$server["img"] = print_image ("images/data.png", true, array ("title" => __('Data Server')));
|
$server["img"] = print_image ("images/data.png", true, array ("title" => __('Data Server')));
|
||||||
$server["type"] = "data";
|
$server["type"] = "data";
|
||||||
$id_modulo = 1;
|
$id_modulo = 1;
|
||||||
} elseif ($server['snmp_server'] == 1) {
|
break;
|
||||||
|
case 1:
|
||||||
|
$server["img"] = print_image ("images/network.png", true, array ("title" => __('Network Server')));
|
||||||
|
$server["type"] = "network";
|
||||||
|
$id_modulo = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
$server["img"] = print_image ("images/snmp.png", true, array ("title" => __('SNMP Server')));
|
$server["img"] = print_image ("images/snmp.png", true, array ("title" => __('SNMP Server')));
|
||||||
$server["type"] = "snmp";
|
$server["type"] = "snmp";
|
||||||
$id_modulo = 0;
|
$id_modulo = 0;
|
||||||
} elseif ($server['recon_server'] == 1) {
|
break;
|
||||||
|
case 3:
|
||||||
$server["img"] = print_image ("images/recon.png", true, array ("title" => __('Recon Server')));
|
$server["img"] = print_image ("images/recon.png", true, array ("title" => __('Recon Server')));
|
||||||
$server["type"] = "recon";
|
$server["type"] = "recon";
|
||||||
$id_modulo = 0;
|
$id_modulo = 0;
|
||||||
} elseif ($server['export_server'] == 1) {
|
break;
|
||||||
$server["img"] = print_image ("images/database_refresh.png", true, array ("title" => __('Export Server')));
|
case 4:
|
||||||
$server["type"] = "export";
|
|
||||||
$id_modulo = 0;
|
|
||||||
} elseif ($server['wmi_server'] == 1) {
|
|
||||||
$server["img"] = print_image ("images/wmi.png", true, array ("title" => __('WMI Server')));
|
|
||||||
$server["type"] = "wmi";
|
|
||||||
$id_modulo = 6;
|
|
||||||
} elseif ($server['prediction_server'] == 1) {
|
|
||||||
$server["img"] = print_image ("images/chart_bar.png", true, array ("title" => __('Prediction Server')));
|
|
||||||
$server["type"] = "prediction";
|
|
||||||
$id_modulo = 5;
|
|
||||||
} elseif ($server['plugin_server'] == 1) {
|
|
||||||
$server["img"] = print_image ("images/plugin.png", true, array ("title" => __('Plugin Server')));
|
$server["img"] = print_image ("images/plugin.png", true, array ("title" => __('Plugin Server')));
|
||||||
$server["type"] = "plugin";
|
$server["type"] = "plugin";
|
||||||
$id_modulo = 4;
|
$id_modulo = 4;
|
||||||
} elseif ($server['inventory_server'] == 1) {
|
break;
|
||||||
$server["img"] = print_image ("images/page_white_text.png", true, array ("title" => __('Inventory Server')));
|
case 5:
|
||||||
$server["type"] = "inventory";
|
$server["img"] = print_image ("images/chart_bar.png", true, array ("title" => __('Prediction Server')));
|
||||||
$id_modulo = 0;
|
$server["type"] = "prediction";
|
||||||
} else {
|
$id_modulo = 5;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
$server["img"] = print_image ("images/wmi.png", true, array ("title" => __('WMI Server')));
|
||||||
|
$server["type"] = "wmi";
|
||||||
|
$id_modulo = 6;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
$server["img"] = print_image ("images/bullet_go.png", true, array ("title" => __('Export Server')));
|
||||||
|
$server["type"] = "export";
|
||||||
|
$id_modulo = 0;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
$server["img"] = print_image ("images/page_white_text.png", true, array ("title" => __('Inventory Server')));
|
||||||
|
$server["type"] = "inventory";
|
||||||
|
$id_modulo = 0;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
$server["img"] = print_image ("images/world.png", true, array ("title" => __('Web Server')));
|
||||||
|
$server["type"] = "web";
|
||||||
|
$id_modulo = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
$server["img"] = '';
|
$server["img"] = '';
|
||||||
$server["type"] = "unknown";
|
$server["type"] = "unknown";
|
||||||
$id_modulo = 0;
|
$id_modulo = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($server['master'] == 1) {
|
if ($server['master'] == 1) {
|
||||||
|
@ -2767,10 +2783,10 @@ function get_server_info ($id_server = -1) {
|
||||||
if ($id_modulo > 0 && $server["modules"] > 0) {
|
if ($id_modulo > 0 && $server["modules"] > 0) {
|
||||||
//If the server doesn't have modules, it doesn't have lag so nothing to calculate. If it's not a module server, don't go here either
|
//If the server doesn't have modules, it doesn't have lag so nothing to calculate. If it's not a module server, don't go here either
|
||||||
$result = get_db_row_sql ("SELECT COUNT(*) AS module_lag, MAX(last_execution_try - current_interval) AS lag FROM tagente_estado
|
$result = get_db_row_sql ("SELECT COUNT(*) AS module_lag, MAX(last_execution_try - current_interval) AS lag FROM tagente_estado
|
||||||
WHERE last_execution_try > 0
|
WHERE last_execution_try > 0
|
||||||
AND current_interval > 0
|
AND current_interval > 0
|
||||||
AND running_by = ".$server["id_server"]."
|
AND running_by = ".$server["id_server"]."
|
||||||
AND (UNIX_TIMESTAMP() - last_execution_try - current_interval < current_interval * 2)");
|
AND (UNIX_TIMESTAMP() - last_execution_try - current_interval < current_interval * 2)");
|
||||||
|
|
||||||
// Lag over current_interval * 2 is not lag, it's a timed out module
|
// Lag over current_interval * 2 is not lag, it's a timed out module
|
||||||
// And we can't check current_interval = 0 (data modules) because they come as they want
|
// And we can't check current_interval = 0 (data modules) because they come as they want
|
||||||
|
@ -2783,35 +2799,35 @@ function get_server_info ($id_server = -1) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch ($server["type"]) {
|
switch ($server["type"]) {
|
||||||
case "recon":
|
case "recon":
|
||||||
$server["name"] = '<a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$server["id_server"].'">'.$server["name"].'</a>';
|
$server["name"] = '<a href="index.php?sec=estado_server&sec2=operation/servers/view_server_detail&server_id='.$server["id_server"].'">'.$server["name"].'</a>';
|
||||||
|
|
||||||
//Get recon taks info
|
//Get recon taks info
|
||||||
$tasks = get_db_all_rows_sql ("SELECT status, utimestamp FROM trecon_task WHERE id_recon_server = ".$server["id_server"]);
|
$tasks = get_db_all_rows_sql ("SELECT status, utimestamp FROM trecon_task WHERE id_recon_server = ".$server["id_server"]);
|
||||||
if (empty ($tasks)) {
|
if (empty ($tasks)) {
|
||||||
$tasks = array ();
|
$tasks = array ();
|
||||||
}
|
}
|
||||||
//Total jobs running on this recon server
|
//Total jobs running on this recon server
|
||||||
$server["modules"] = count ($tasks);
|
$server["modules"] = count ($tasks);
|
||||||
|
|
||||||
//Total recon jobs (all servers)
|
//Total recon jobs (all servers)
|
||||||
$server["modules_total"] = $recon_total;
|
$server["modules_total"] = $recon_total;
|
||||||
|
|
||||||
//Lag (take average active time of all active tasks)
|
//Lag (take average active time of all active tasks)
|
||||||
$server["module_lag"] = 0;
|
$server["module_lag"] = 0;
|
||||||
$lags = array ();
|
$lags = array ();
|
||||||
foreach ($tasks as $task) {
|
foreach ($tasks as $task) {
|
||||||
if ($task["status"] > 0 && $task["status"] <= 100) {
|
if ($task["status"] > 0 && $task["status"] <= 100) {
|
||||||
$lags[] = $time - $task["utimestamp"];
|
$lags[] = $time - $task["utimestamp"];
|
||||||
//Module lag is actually the number of jobs that is currently running
|
//Module lag is actually the number of jobs that is currently running
|
||||||
$server["module_lag"]++;
|
$server["module_lag"]++;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count ($lags) > 0) {
|
|
||||||
$server["lag"] = (int) array_sum ($lags) / count ($lags);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (count ($lags) > 0) {
|
||||||
|
$server["lag"] = (int) array_sum ($lags) / count ($lags);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Pandora FMS - the Flexible Monitoring System
|
||||||
|
// ============================================
|
||||||
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||||
|
// Please see http://pandora.sourceforge.net 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 (LGPL)
|
||||||
|
// 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.
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a server.
|
||||||
|
*
|
||||||
|
* @param int Server id to get.
|
||||||
|
* @param array Extra filter.
|
||||||
|
* @param array Fields to get.
|
||||||
|
*
|
||||||
|
* @return Server with the given id. False if not available.
|
||||||
|
*/
|
||||||
|
function get_server ($id_server, $filter = false, $fields = false) {
|
||||||
|
if (empty ($id_server))
|
||||||
|
return false;
|
||||||
|
if (! is_array ($filter))
|
||||||
|
$filter = array ();
|
||||||
|
$filter['id_server'] = $id_server;
|
||||||
|
|
||||||
|
return @get_db_row_filter ('tserver', $filter, $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the server availables.
|
||||||
|
*
|
||||||
|
* @return All the servers available.
|
||||||
|
*/
|
||||||
|
function get_server_names () {
|
||||||
|
$all_servers = @get_db_all_rows_filter ('tserver', false, array ('DISTINCT(`name`) as name'));
|
||||||
|
if ($all_servers === false)
|
||||||
|
return array ();
|
||||||
|
|
||||||
|
$servers = array ();
|
||||||
|
foreach ($all_servers as $server) {
|
||||||
|
$servers[$server['name']] = $server['name'];
|
||||||
|
}
|
||||||
|
return $servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -32,7 +32,6 @@ $modules_server = 0;
|
||||||
$total_modules_network = 0;
|
$total_modules_network = 0;
|
||||||
$total_modules_data = 0;
|
$total_modules_data = 0;
|
||||||
|
|
||||||
|
|
||||||
echo "<h2>".__('Pandora servers')." » ".__('Configuration detail')."</h2>";
|
echo "<h2>".__('Pandora servers')." » ".__('Configuration detail')."</h2>";
|
||||||
|
|
||||||
$total_modules = (int) get_db_value ('COUNT(*)', 'tagente_modulo', 'disabled', 0);
|
$total_modules = (int) get_db_value ('COUNT(*)', 'tagente_modulo', 'disabled', 0);
|
||||||
|
@ -42,6 +41,9 @@ $table->width = '98%';
|
||||||
$table->size = array ();
|
$table->size = array ();
|
||||||
$table->size[6] = '60';
|
$table->size[6] = '60';
|
||||||
|
|
||||||
|
$table->style = array ();
|
||||||
|
$table->style[0] = 'font-weight: bold';
|
||||||
|
|
||||||
$table->align = array ();
|
$table->align = array ();
|
||||||
$table->align[1] = 'center';
|
$table->align[1] = 'center';
|
||||||
$table->align[6] = 'center';
|
$table->align[6] = 'center';
|
||||||
|
@ -60,12 +62,12 @@ $table->data = array ();
|
||||||
|
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[0] = "<b>".$server['name']."</b>";
|
$data[0] = $server['name'];
|
||||||
|
|
||||||
if ($server['status'] == 0) {
|
if ($server['status'] == 0) {
|
||||||
$data[1] = print_status_image(STATUS_SERVER_DOWN, '', true);
|
$data[1] = print_status_image (STATUS_SERVER_DOWN, '', true);
|
||||||
} else {
|
} else {
|
||||||
$data[1] = print_status_image(STATUS_SERVER_OK, '', true);
|
$data[1] = print_status_image (STATUS_SERVER_OK, '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
|
@ -79,7 +81,7 @@ foreach ($servers as $server) {
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty ($table->data)) {
|
if (! empty ($table->data)) {
|
||||||
print_table ($table);
|
print_table ($table);
|
||||||
} else {
|
} else {
|
||||||
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
|
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
|
||||||
|
|
|
@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
|
||||||
`id_wmi_server` smallint(4) unsigned default '0',
|
`id_wmi_server` smallint(4) unsigned default '0',
|
||||||
`id_parent` int(10) unsigned default '0',
|
`id_parent` int(10) unsigned default '0',
|
||||||
`custom_id` varchar(255) default '',
|
`custom_id` varchar(255) default '',
|
||||||
`server_name` varchar(255) default '',
|
`server_name` varchar(100) default '',
|
||||||
PRIMARY KEY (`id_agente`),
|
PRIMARY KEY (`id_agente`),
|
||||||
KEY `nombre` (`nombre`),
|
KEY `nombre` (`nombre`),
|
||||||
KEY `direccion` (`direccion`),
|
KEY `direccion` (`direccion`),
|
||||||
|
|
Loading…
Reference in New Issue