2012-07-16 Miguel de Dios <miguel.dedios@artica.es>
* extensions/agents_modules.php, extensions/users_connected.php, extensions/agents_alerts.php, operation/visual_console/render_view.php, operation/visual_console/public_console.php, operation/agentes/networkmap.groups.php, operation/agentes/estado_ultimopaquete.php, operation/agentes/networkmap.topology.php, general/header.php, godmode/db/db_refine.php, godmode/agentes/configurar_agente.php, godmode/alerts/configure_alert_compound.php, godmode/setup/setup_visuals.php, godmode/snmpconsole/snmp_alert.php, godmode/modules/manage_network_components_form_wmi.php, include/functions_config.php, include/functions_api.php, include/functions_agents.php, include/functions_forecast.php: cleaned source code style and change magic numbers for time constants. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6773 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dbf98363f4
commit
b967940c41
|
@ -1,3 +1,21 @@
|
||||||
|
2012-07-16 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* extensions/agents_modules.php, extensions/users_connected.php,
|
||||||
|
extensions/agents_alerts.php,
|
||||||
|
operation/visual_console/render_view.php,
|
||||||
|
operation/visual_console/public_console.php,
|
||||||
|
operation/agentes/networkmap.groups.php,
|
||||||
|
operation/agentes/estado_ultimopaquete.php,
|
||||||
|
operation/agentes/networkmap.topology.php, general/header.php,
|
||||||
|
godmode/db/db_refine.php, godmode/agentes/configurar_agente.php,
|
||||||
|
godmode/alerts/configure_alert_compound.php,
|
||||||
|
godmode/setup/setup_visuals.php, godmode/snmpconsole/snmp_alert.php,
|
||||||
|
godmode/modules/manage_network_components_form_wmi.php,
|
||||||
|
include/functions_config.php, include/functions_api.php,
|
||||||
|
include/functions_agents.php, include/functions_forecast.php:
|
||||||
|
cleaned source code style and change magic numbers for time
|
||||||
|
constants.
|
||||||
|
|
||||||
2012-07-16 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
2012-07-16 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
* operation/tree.php: Removed trace.
|
* operation/tree.php: Removed trace.
|
||||||
|
|
|
@ -76,7 +76,13 @@ function mainAgentsAlerts() {
|
||||||
|
|
||||||
$comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => 0, 'hor_offset' => 0)).'">';
|
$comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => 0, 'hor_offset' => 0)).'">';
|
||||||
$comborefr .= '<b>'.__('Refresh').'</b>';
|
$comborefr .= '<b>'.__('Refresh').'</b>';
|
||||||
$comborefr .= html_print_select (array('30' => '30 '.__('seconds'), '60' => '1 '.__('minute'), '120' => '2 '.__('minutes'), '300' => '5 '.__('minutes'), '600' => '10 '.__('minutes')) , 'refr', $config['refr'], $script = 'this.form.submit()', '', 0, true, false, false, '', false, 'width: 100px; margin-right: 10px; margin-top: 5px;');
|
$comborefr .= html_print_select (
|
||||||
|
array('30' => '30 '.__('seconds'),
|
||||||
|
(string)SECONDS_1MINUTE => __('1 minute'),
|
||||||
|
(string)SECONDS_2MINUTES => __('2 minutes'),
|
||||||
|
(string)SECONDS_5MINUTES => __('5 minutes'),
|
||||||
|
(string)SECONDS_10MINUTES => __('10 minutes'))
|
||||||
|
, 'refr', $config['refr'], $script = 'this.form.submit()', '', 0, true, false, false, '', false, 'width: 100px; margin-right: 10px; margin-top: 5px;');
|
||||||
$comborefr .= "</form>";
|
$comborefr .= "</form>";
|
||||||
|
|
||||||
if ($config["pure"] == 0) {
|
if ($config["pure"] == 0) {
|
||||||
|
@ -92,9 +98,9 @@ function mainAgentsAlerts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen,
|
$onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen,
|
||||||
'combo_groups' => $filter_groups);
|
'combo_groups' => $filter_groups);
|
||||||
|
|
||||||
if($config['pure'] == 1) {
|
if ($config['pure'] == 1) {
|
||||||
$onheader['combo_refr'] = $comborefr;
|
$onheader['combo_refr'] = $comborefr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,25 +111,28 @@ function mainAgentsAlerts() {
|
||||||
// Prepare old-style table
|
// Prepare old-style table
|
||||||
|
|
||||||
$filter = array ('offset' => (int) $offset,
|
$filter = array ('offset' => (int) $offset,
|
||||||
'limit' => (int) $config['block_size']);
|
'limit' => (int) $config['block_size']);
|
||||||
$filter_count = array();
|
$filter_count = array();
|
||||||
|
|
||||||
if($group_id > 0) {
|
if ($group_id > 0) {
|
||||||
$filter['id_grupo'] = $group_id;
|
$filter['id_grupo'] = $group_id;
|
||||||
$filter_count['id_grupo'] = $group_id;
|
$filter_count['id_grupo'] = $group_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the id of all agents with alerts
|
// Get the id of all agents with alerts
|
||||||
$sql = 'SELECT DISTINCT(id_agente) FROM tagente_modulo WHERE id_agente_modulo IN
|
$sql = 'SELECT DISTINCT(id_agente)
|
||||||
(SELECT id_agent_module FROM talert_template_modules)';
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente_modulo IN
|
||||||
|
(SELECT id_agent_module
|
||||||
|
FROM talert_template_modules)';
|
||||||
$agents_with_alerts_raw = db_get_all_rows_sql($sql);
|
$agents_with_alerts_raw = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
if($agents_with_alerts_raw === false) {
|
if ($agents_with_alerts_raw === false) {
|
||||||
$agents_with_alerts_raw = array();
|
$agents_with_alerts_raw = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$agents_with_alerts = array();
|
$agents_with_alerts = array();
|
||||||
foreach($agents_with_alerts_raw as $awar) {
|
foreach ($agents_with_alerts_raw as $awar) {
|
||||||
$agents_with_alerts[] = $awar['id_agente'];
|
$agents_with_alerts[] = $awar['id_agente'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,8 +143,8 @@ function mainAgentsAlerts() {
|
||||||
|
|
||||||
$nagents = count(agents_get_agents ($filter_count));
|
$nagents = count(agents_get_agents ($filter_count));
|
||||||
|
|
||||||
if($agents == false) {
|
if ($agents == false) {
|
||||||
echo "<div class='nf'>".__('There are no agents with alerts')."</div>";
|
echo "<div class='nf'>" . __('There are no agents with alerts')."</div>";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +156,7 @@ function mainAgentsAlerts() {
|
||||||
|
|
||||||
$templates = array();
|
$templates = array();
|
||||||
$agent_alerts = array();
|
$agent_alerts = array();
|
||||||
foreach($all_alerts as $alert) {
|
foreach ($all_alerts as $alert) {
|
||||||
$templates[$alert['id_alert_template']] = '';
|
$templates[$alert['id_alert_template']] = '';
|
||||||
$agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert;
|
$agent_alerts[$alert['agent_name']][$alert['id_alert_template']][] = $alert;
|
||||||
}
|
}
|
||||||
|
@ -159,53 +168,54 @@ function mainAgentsAlerts() {
|
||||||
echo '<table cellpadding="4" cellspacing="4" border="0" width=98%>';
|
echo '<table cellpadding="4" cellspacing="4" border="0" width=98%>';
|
||||||
echo "<th width='140px' height='25px'>".__("Agents")." / ".__("Alert templates")."</th>";
|
echo "<th width='140px' height='25px'>".__("Agents")." / ".__("Alert templates")."</th>";
|
||||||
|
|
||||||
if($hor_offset > 0) {
|
if ($hor_offset > 0) {
|
||||||
$new_hor_offset = $hor_offset-$block;
|
$new_hor_offset = $hor_offset-$block;
|
||||||
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_alerts&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous templates')))."</a> </th>";
|
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_alerts&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous templates')))."</a> </th>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($templates)) {
|
if (!empty($templates)) {
|
||||||
$sql = sprintf('SELECT id, name FROM talert_templates WHERE id IN (%s)',implode(',',array_keys($templates)));
|
$sql = sprintf('SELECT id, name
|
||||||
|
FROM talert_templates WHERE id IN (%s)',implode(',',array_keys($templates)));
|
||||||
|
|
||||||
$templates_raw = db_get_all_rows_sql($sql);
|
$templates_raw = db_get_all_rows_sql($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$alerts = array();
|
$alerts = array();
|
||||||
$ntemplates = 0;
|
$ntemplates = 0;
|
||||||
foreach($templates_raw as $temp) {
|
foreach ($templates_raw as $temp) {
|
||||||
if(isset($templates[$temp['id']]) && $templates[$temp['id']] == '') {
|
if (isset($templates[$temp['id']]) && $templates[$temp['id']] == '') {
|
||||||
$ntemplates++;
|
$ntemplates++;
|
||||||
if($ntemplates <= $hor_offset || $ntemplates > ($hor_offset+$block)) {
|
if ($ntemplates <= $hor_offset || $ntemplates > ($hor_offset+$block)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$templates[$temp['id']] = $temp['name'];
|
$templates[$temp['id']] = $temp['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($templates as $tid => $tname) {
|
foreach ($templates as $tid => $tname) {
|
||||||
if($tname == '') {
|
if ($tname == '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo '<th width="20px" >'. html_print_image('images/information.png', true, array('title' => io_safe_output($tname))) ."</th>";
|
echo '<th width="20px" >'. html_print_image('images/information.png', true, array('title' => io_safe_output($tname))) ."</th>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($hor_offset + $block) < $ntemplates) {
|
if (($hor_offset + $block) < $ntemplates) {
|
||||||
$new_hor_offset = $hor_offset+$block;
|
$new_hor_offset = $hor_offset+$block;
|
||||||
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."'>".html_print_image("images/darrowright.png",true, array('title' => __('More templates')))."</a> </th>";
|
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_alerts&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."'>".html_print_image("images/darrowright.png",true, array('title' => __('More templates')))."</a> </th>";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($agents as $agent) {
|
foreach ($agents as $agent) {
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
// Name of the agent
|
// Name of the agent
|
||||||
echo '<td style="font-weight:bold;">'.$agent['nombre'].'</td>';
|
echo '<td style="font-weight:bold;">'.$agent['nombre'].'</td>';
|
||||||
|
|
||||||
// Alerts of the agent
|
// Alerts of the agent
|
||||||
$anyfired = false;
|
$anyfired = false;
|
||||||
foreach($templates as $tid => $tname) {
|
foreach ($templates as $tid => $tname) {
|
||||||
if($tname == '') {
|
if ($tname == '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(isset($agent_alerts[$agent['nombre']][$tid])) {
|
if (isset($agent_alerts[$agent['nombre']][$tid])) {
|
||||||
foreach($agent_alerts[$agent['nombre']][$tid] as $alert) {
|
foreach($agent_alerts[$agent['nombre']][$tid] as $alert) {
|
||||||
if($alert["times_fired"] > 0) {
|
if($alert["times_fired"] > 0) {
|
||||||
$anyfired = true;
|
$anyfired = true;
|
||||||
|
|
|
@ -84,7 +84,13 @@ function mainAgentsModules() {
|
||||||
|
|
||||||
$comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => 0, 'hor_offset' => 0)).'">';
|
$comborefr = '<form method="post" action="' . ui_get_url_refresh (array ('offset' => 0, 'hor_offset' => 0)).'">';
|
||||||
$comborefr .= '<b>'.__('Refresh').'</b>';
|
$comborefr .= '<b>'.__('Refresh').'</b>';
|
||||||
$comborefr .= html_print_select (array('30' => '30 '.__('seconds'), '60' => '1 '.__('minute'), '120' => '2 '.__('minutes'), '300' => '5 '.__('minutes'), '600' => '10 '.__('minutes')) , 'refr', $config['refr'], $script = 'this.form.submit()', '', 0, true, false, false, '', false, 'width: 100px; margin-right: 10px; margin-top: 5px;');
|
$comborefr .= html_print_select (
|
||||||
|
array('30' => '30 '.__('seconds'),
|
||||||
|
(string)SECONDS_1MINUTE => __('1 minute'),
|
||||||
|
(string)SECONDS_2MINUTES => __('2 minutes'),
|
||||||
|
(string)SECONDS_5MINUTES => __('5 minutes'),
|
||||||
|
(string)SECONDS_10MINUTES => __('10 minutes')),
|
||||||
|
'refr', $config['refr'], $script = 'this.form.submit()', '', 0, true, false, false, '', false, 'width: 100px; margin-right: 10px; margin-top: 5px;');
|
||||||
$comborefr .= "</form>";
|
$comborefr .= "</form>";
|
||||||
|
|
||||||
if ($config["pure"] == 0) {
|
if ($config["pure"] == 0) {
|
||||||
|
@ -100,10 +106,10 @@ function mainAgentsModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen,
|
$onheader = array('updated_time' => $updated_time, 'fullscreen' => $fullscreen,
|
||||||
'combo_module_groups' => $filter_module_groups,
|
'combo_module_groups' => $filter_module_groups,
|
||||||
'combo_groups' => $filter_groups);
|
'combo_groups' => $filter_groups);
|
||||||
|
|
||||||
if($config['pure'] == 1) {
|
if ($config['pure'] == 1) {
|
||||||
$onheader['combo_refr'] = $comborefr;
|
$onheader['combo_refr'] = $comborefr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,14 +120,14 @@ function mainAgentsModules() {
|
||||||
// Prepare old-style table
|
// Prepare old-style table
|
||||||
|
|
||||||
$agents = '';
|
$agents = '';
|
||||||
if($group_id > 0) {
|
if ($group_id > 0) {
|
||||||
$agents = agents_get_group_agents($group_id);
|
$agents = agents_get_group_agents($group_id);
|
||||||
$agents = array_keys($agents);
|
$agents = array_keys($agents);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_module_groups = false;
|
$filter_module_groups = false;
|
||||||
|
|
||||||
if($modulegroup > 0) {
|
if ($modulegroup > 0) {
|
||||||
$filter_module_groups['id_module_group'] = $modulegroup;
|
$filter_module_groups['id_module_group'] = $modulegroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +154,7 @@ function mainAgentsModules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$filter_groups = array ('offset' => (int) $offset,
|
$filter_groups = array ('offset' => (int) $offset,
|
||||||
'limit' => (int) $config['block_size']);
|
'limit' => (int) $config['block_size']);
|
||||||
|
|
||||||
if($group_id > 0) {
|
if($group_id > 0) {
|
||||||
$filter_groups['id_grupo'] = $group_id;
|
$filter_groups['id_grupo'] = $group_id;
|
||||||
|
@ -171,10 +177,10 @@ function mainAgentsModules() {
|
||||||
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))."</a> </th>";
|
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))."</a> </th>";
|
||||||
}
|
}
|
||||||
$nmodules = 0;
|
$nmodules = 0;
|
||||||
foreach($modules_by_name as $module) {
|
foreach ($modules_by_name as $module) {
|
||||||
$nmodules++;
|
$nmodules++;
|
||||||
|
|
||||||
if($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) {
|
if ($nmodules <= $hor_offset || $nmodules > ($hor_offset+$block)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,4 +314,3 @@ extensions_add_operation_menu_option(__("Agents/Modules view"), 'estado', 'agent
|
||||||
extensions_add_main_function('mainAgentsModules');
|
extensions_add_main_function('mainAgentsModules');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -35,17 +35,20 @@ function users_extension_main_god ($god = true) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$sql = "SELECT id_user, last_connect
|
$sql = "SELECT id_user, last_connect
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - 300) ORDER BY last_connect DESC";
|
WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - " . SECONDS_5MINUTES . ")
|
||||||
|
ORDER BY last_connect DESC";
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = "SELECT id_user, last_connect
|
$sql = "SELECT id_user, last_connect
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - 300) ORDER BY last_connect DESC";
|
WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_5MINUTES . ")
|
||||||
|
ORDER BY last_connect DESC";
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = "SELECT id_user, last_connect
|
$sql = "SELECT id_user, last_connect
|
||||||
FROM tusuario
|
FROM tusuario
|
||||||
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (86400)) - 300) ORDER BY last_connect DESC";
|
WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_5MINUTES . ")
|
||||||
|
ORDER BY last_connect DESC";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,17 +81,17 @@ function users_extension_main_god ($god = true) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$ip_origin = db_get_value_sql(sprintf("SELECT ip_origen
|
$ip_origin = db_get_value_sql(sprintf("SELECT ip_origen
|
||||||
FROM tsesion
|
FROM tsesion
|
||||||
WHERE id_usuario = '%s'
|
WHERE id_usuario = '%s'
|
||||||
AND descripcion = '" . io_safe_input('Logged in') . "'
|
AND descripcion = '" . io_safe_input('Logged in') . "'
|
||||||
ORDER BY fecha DESC",$row["id_user"]));
|
ORDER BY fecha DESC",$row["id_user"]));
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$ip_origin = db_get_value_sql(sprintf("SELECT ip_origen
|
$ip_origin = db_get_value_sql(sprintf("SELECT ip_origen
|
||||||
FROM tsesion
|
FROM tsesion
|
||||||
WHERE id_usuario = '%s'
|
WHERE id_usuario = '%s'
|
||||||
AND to_char(descripcion) = '" . io_safe_input('Logged in') . "'
|
AND to_char(descripcion) = '" . io_safe_input('Logged in') . "'
|
||||||
ORDER BY fecha DESC",$row["id_user"]));
|
ORDER BY fecha DESC",$row["id_user"]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,10 @@ config_check();
|
||||||
<td rowspan="2">
|
<td rowspan="2">
|
||||||
<a href="index.php?sec=main">
|
<a href="index.php?sec=main">
|
||||||
<?php
|
<?php
|
||||||
if (!defined ('PANDORA_ENTERPRISE')){
|
if (!defined ('PANDORA_ENTERPRISE')) {
|
||||||
echo html_print_image('images/pandora_header_logo.png', true, array("alt" => 'Pandora FMS Opensource', "border" => '0'));
|
echo html_print_image('images/pandora_header_logo.png', true, array("alt" => 'Pandora FMS Opensource', "border" => '0'));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
echo html_print_image('images/pandora_header_logo_enterprise.png', true, array("alt" => 'Pandora FMS Enterprise', "border" => '0'));
|
echo html_print_image('images/pandora_header_logo_enterprise.png', true, array("alt" => 'Pandora FMS Enterprise', "border" => '0'));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -98,11 +99,11 @@ config_check();
|
||||||
echo " ";
|
echo " ";
|
||||||
html_print_image("images/application_double.png", false, array("alt" => __('Metaconsole activated'), "class" => 'bot', "title" => __('You are using metaconsole')));
|
html_print_image("images/application_double.png", false, array("alt" => __('Metaconsole activated'), "class" => 'bot', "title" => __('You are using metaconsole')));
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
echo '</td>';
|
</td>
|
||||||
echo '<td width="20%">';
|
<td width="20%">
|
||||||
|
<?php
|
||||||
if ($config["metaconsole"] == 0){
|
if ($config["metaconsole"] == 0) {
|
||||||
echo '<a class="white_bold" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
echo '<a class="white_bold" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
|
||||||
|
|
||||||
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
|
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
|
||||||
|
@ -123,8 +124,7 @@ config_check();
|
||||||
unset ($servers); // Since this is the header, we don't like to trickle down variables.
|
unset ($servers); // Since this is the header, we don't like to trickle down variables.
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
?>
|
|
||||||
</td>
|
</td>
|
||||||
<td width="20%">
|
<td width="20%">
|
||||||
<?php
|
<?php
|
||||||
|
@ -140,82 +140,76 @@ config_check();
|
||||||
$ignored_params['refr'] = '';
|
$ignored_params['refr'] = '';
|
||||||
echo '<a id="autorefresh" class="white_bold" href="' . ui_get_url_refresh ($ignored_params).'">' . html_print_image("images/page_refresh.png", true, array("class" => 'bot', "alt" => 'lightning')) . ' '. __('Autorefresh').'</a>';
|
echo '<a id="autorefresh" class="white_bold" href="' . ui_get_url_refresh ($ignored_params).'">' . html_print_image("images/page_refresh.png", true, array("class" => 'bot', "alt" => 'lightning')) . ' '. __('Autorefresh').'</a>';
|
||||||
$values = array (
|
$values = array (
|
||||||
'5' => '5 '.__('seconds'),
|
'5' => __('5 seconds'),
|
||||||
'10' => '10 '.__('seconds'),
|
'10' => __('10 seconds'),
|
||||||
'15' => '15 '.__('seconds'),
|
'15' => __('15 seconds'),
|
||||||
'30' => '30 '.__('seconds'),
|
'30' => __('30 seconds'),
|
||||||
'60' => '1 '.__('minute'),
|
(string)SECONDS_1MINUTE => __('1 minute'),
|
||||||
'120' => '2 '.__('minutes'),
|
(string)SECONDS_2MINUTES => __('2 minutes'),
|
||||||
'300' => '5 '.__('minutes'),
|
(string)SECONDS_5MINUTES => __('5 minutes'),
|
||||||
'900' => '15 '.__('minutes'),
|
(string)SECONDS_15MINUTES => __('15 minutes'),
|
||||||
'1800' => '30 '.__('minutes'),
|
(string)SECONDS_30MINUTES => __('30 minutes'),
|
||||||
'3600' => '1 '.__('hour'));
|
(string)SECONDS_1HOUR => __('1 hour'));
|
||||||
echo '<span id="combo_refr" style="display: none">';
|
echo '<span id="combo_refr" style="display: none">';
|
||||||
html_print_select ($values, 'ref', '', '', __('Select'), '0', false, false, false);
|
html_print_select ($values, 'ref', '', '', __('Select'), '0', false, false, false);
|
||||||
unset ($values);
|
unset ($values);
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
}
|
}
|
||||||
echo "</td>";
|
?>
|
||||||
echo "<td width='20%' rowspan='2'>";
|
</td>
|
||||||
echo "<a href='index.php?sec=main'>";
|
<td width='20%' rowspan='2'>
|
||||||
if (isset($config["custom_logo"]))
|
<?php
|
||||||
echo html_print_image("images/custom_logo/" . $config["custom_logo"], true,array("height" => '60', "width" => '139', "alt" => 'Logo'));
|
echo "<a href='index.php?sec=main'>";
|
||||||
echo "</a>";
|
if (isset($config["custom_logo"]))
|
||||||
?>
|
echo html_print_image("images/custom_logo/" . $config["custom_logo"], true,array("height" => '60', "width" => '139', "alt" => 'Logo'));
|
||||||
|
echo "</a>";
|
||||||
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($config["metaconsole"] == 0){
|
if ($config["metaconsole"] == 0) {
|
||||||
?>
|
?>
|
||||||
<form method="get" style="" name="quicksearch" action="">
|
<form method="get" style="" name="quicksearch" action="">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var fieldKeyWordEmpty = true;
|
var fieldKeyWordEmpty = true;
|
||||||
</script>
|
</script>
|
||||||
<input type="text" id="keywords" name="keywords"
|
<input type="text" id="keywords" name="keywords"
|
||||||
|
<?php
|
||||||
|
if (!isset($config['search_keywords']))
|
||||||
|
echo "value='" . __("Enter keywords to search") . "'";
|
||||||
|
else if (strlen($config['search_keywords']) == 0)
|
||||||
|
echo "value='" . __("Enter keywords to search") . "'";
|
||||||
|
else echo "value='" . $config['search_keywords'] . "'";
|
||||||
|
?>
|
||||||
|
onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');"
|
||||||
|
size="100" style="background: white url('images/lupa_15x15.png') no-repeat right; padding: 0; padding-left:0px; margin: 0; width: 90%; height: 19px; margin-bottom: 5px; margin-left: 2px;" />
|
||||||
|
<!-- onClick="javascript: document.quicksearch.submit()" -->
|
||||||
|
<input type='hidden' name='head_search_keywords' value='abc' />
|
||||||
<?php
|
<?php
|
||||||
if (!isset($config['search_keywords']))
|
ui_print_help_tip (__("Blank characters are used as AND conditions"));
|
||||||
echo "value='" . __("Enter keywords to search") . "'";
|
|
||||||
else if (strlen($config['search_keywords']) == 0)
|
|
||||||
echo "value='" . __("Enter keywords to search") . "'";
|
|
||||||
else echo "value='" . $config['search_keywords'] . "'";
|
|
||||||
?>
|
?>
|
||||||
onfocus="javascript: if (fieldKeyWordEmpty) $('#keywords').val('');"
|
</form>
|
||||||
size="100" style="background: white url('images/lupa_15x15.png') no-repeat right; padding: 0; padding-left:0px; margin: 0; width: 90%; height: 19px; margin-bottom: 5px; margin-left: 2px;" />
|
|
||||||
<!-- onClick="javascript: document.quicksearch.submit()" -->
|
|
||||||
<input type='hidden' name='head_search_keywords' value='abc' />
|
|
||||||
<?php
|
|
||||||
ui_print_help_tip (__("Blank characters are used as AND conditions"));
|
|
||||||
?>
|
|
||||||
</form>
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if ($config["metaconsole"] == 0){
|
if ($config["metaconsole"] == 0){
|
||||||
echo '<a class="white_bold" href="index.php?sec=eventos&sec2=operation/events/events">' . html_print_image("images/lightning_go.png", true, array("alt" => 'lightning_go', "class" => 'bot')) . ' '.__('Events').'</a>';
|
echo '<a class="white_bold" href="index.php?sec=eventos&sec2=operation/events/events">' . html_print_image("images/lightning_go.png", true, array("alt" => 'lightning_go', "class" => 'bot')) . ' '.__('Events').'</a>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
ui_require_jquery_file ('countdown');
|
ui_require_jquery_file ('countdown');
|
||||||
ui_require_css_file ('jquery-ui-1.8.17.custom');
|
ui_require_css_file ('jquery-ui-1.8.17.custom');
|
||||||
ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
|
ui_require_jquery_file('jquery-ui-1.8.17.custom.min');
|
||||||
?>
|
?>
|
||||||
<!--
|
|
||||||
<script type="text/javascript" src="include/javascript/jquery.ui.dialog.js "></script>
|
|
||||||
<script type="text/javascript" src="include/javascript/jquery.ui.draggable.js "></script>
|
|
||||||
<script type="text/javascript" src="include/javascript/jquery.ui.droppable.js "></script>
|
|
||||||
<script type="text/javascript" src="include/javascript/jquery.ui.resizable.js "></script>
|
|
||||||
-->
|
|
||||||
<script type="text/javascript" src="include/javascript/webchat.js "></script>
|
<script type="text/javascript" src="include/javascript/webchat.js "></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
var new_chat = <?php echo (int)$_SESSION['new_chat'];?>;
|
var new_chat = <?php echo (int)$_SESSION['new_chat'];?>;
|
||||||
|
@ -230,13 +224,28 @@ if ($config["metaconsole"] == 0){
|
||||||
$("#agent_access").css("display","");
|
$("#agent_access").css("display","");
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php if ($msg_cnt > 0): ?>
|
|
||||||
|
<?php
|
||||||
|
if ($msg_cnt > 0) {
|
||||||
|
?>
|
||||||
$("#yougotmail").pulsate ();
|
$("#yougotmail").pulsate ();
|
||||||
<?php endif; ?>
|
<?php
|
||||||
<?php if ($config["alert_cnt"] > 0): ?>
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($config["alert_cnt"] > 0) {
|
||||||
|
?>
|
||||||
$("#yougotalert").pulsate ();
|
$("#yougotalert").pulsate ();
|
||||||
<?php endif; ?>
|
<?php
|
||||||
<?php if ($config["refr"]): ?>
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($config["refr"]) {
|
||||||
|
?>
|
||||||
t = new Date();
|
t = new Date();
|
||||||
t.setTime (t.getTime () + <?php echo $config["refr"] * 1000; ?>);
|
t.setTime (t.getTime () + <?php echo $config["refr"] * 1000; ?>);
|
||||||
$("#refrcounter").countdown ({until: t,
|
$("#refrcounter").countdown ({until: t,
|
||||||
|
@ -246,7 +255,10 @@ if ($config["metaconsole"] == 0){
|
||||||
$(this).text ("...");
|
$(this).text ("...");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<?php else: ?>
|
<?php
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
?>
|
||||||
$("a#autorefresh").click (function () {
|
$("a#autorefresh").click (function () {
|
||||||
var a = this;
|
var a = this;
|
||||||
|
|
||||||
|
@ -259,7 +271,9 @@ if ($config["metaconsole"] == 0){
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
<?php endif; ?>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
</script>
|
</script>
|
|
@ -62,7 +62,7 @@ $maximo = 0;
|
||||||
$minimo = 0;
|
$minimo = 0;
|
||||||
$nombre_agente = "";
|
$nombre_agente = "";
|
||||||
$direccion_agente = get_parameter ('direccion', '');
|
$direccion_agente = get_parameter ('direccion', '');
|
||||||
$intervalo = 300;
|
$intervalo = SECONDS_5MINUTES;
|
||||||
$ff_interval = 0;
|
$ff_interval = 0;
|
||||||
$id_server = "";
|
$id_server = "";
|
||||||
$max_alerts = 0;
|
$max_alerts = 0;
|
||||||
|
@ -131,7 +131,7 @@ if ($create_agent) {
|
||||||
$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",'');
|
||||||
$grupo = (int) get_parameter_post ("grupo");
|
$grupo = (int) get_parameter_post ("grupo");
|
||||||
$intervalo = (string) get_parameter_post ("intervalo", 300);
|
$intervalo = (string) get_parameter_post ("intervalo", SECONDS_5MINUTES);
|
||||||
$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 = (string) get_parameter_post ("id_parent",'');
|
$id_parent = (string) get_parameter_post ("id_parent",'');
|
||||||
|
@ -148,11 +148,11 @@ if ($create_agent) {
|
||||||
|
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
|
||||||
if($fields === false) $fields = array();
|
if ($fields === false) $fields = array();
|
||||||
|
|
||||||
$field_values = array();
|
$field_values = array();
|
||||||
|
|
||||||
foreach($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
|
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,8 @@ if ($create_agent) {
|
||||||
$agent_created_ok = 0;
|
$agent_created_ok = 0;
|
||||||
}
|
}
|
||||||
elseif (agents_get_agent_id ($nombre_agente)) {
|
elseif (agents_get_agent_id ($nombre_agente)) {
|
||||||
$agent_creation_error = __('There is already an agent in the database with this name');
|
$agent_creation_error =
|
||||||
|
__('There is already an agent in the database with this name');
|
||||||
$agent_created_ok = 0;
|
$agent_created_ok = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -181,7 +182,7 @@ if ($create_agent) {
|
||||||
enterprise_hook ('update_agent', array ($id_agente));
|
enterprise_hook ('update_agent', array ($id_agente));
|
||||||
if ($id_agente !== false) {
|
if ($id_agente !== false) {
|
||||||
// Create custom fields for this agent
|
// Create custom fields for this agent
|
||||||
foreach($field_values as $key => $value) {
|
foreach ($field_values as $key => $value) {
|
||||||
db_process_sql_insert ('tagent_custom_data',
|
db_process_sql_insert ('tagent_custom_data',
|
||||||
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
||||||
}
|
}
|
||||||
|
@ -217,28 +218,27 @@ if ($id_agente) {
|
||||||
|
|
||||||
/* View tab */
|
/* View tab */
|
||||||
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'
|
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'">'
|
||||||
. html_print_image ("images/zoom.png", true, array ("title" =>__('View')))
|
. html_print_image ("images/zoom.png", true, array ("title" =>__('View')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
if($tab == 'view')
|
if ($tab == 'view')
|
||||||
$viewtab['active'] = true;
|
$viewtab['active'] = true;
|
||||||
else
|
else
|
||||||
$viewtab['active'] = false;
|
$viewtab['active'] = false;
|
||||||
|
|
||||||
/* Main tab */
|
/* Main tab */
|
||||||
$maintab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">'
|
$maintab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agente.'">'
|
||||||
. html_print_image ("images/cog.png", true, array ("title" =>__('Setup')))
|
. html_print_image ("images/cog.png", true, array ("title" =>__('Setup')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
if($tab == 'main')
|
if ($tab == 'main')
|
||||||
|
|
||||||
$maintab['active'] = true;
|
$maintab['active'] = true;
|
||||||
else
|
else
|
||||||
$maintab['active'] = false;
|
$maintab['active'] = false;
|
||||||
|
|
||||||
/* Module tab */
|
/* Module tab */
|
||||||
$moduletab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">'
|
$moduletab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente.'">'
|
||||||
. html_print_image ("images/brick.png", true, array ("title" =>__('Modules')))
|
. html_print_image ("images/brick.png", true, array ("title" =>__('Modules')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
if($tab == 'module')
|
if($tab == 'module')
|
||||||
$moduletab['active'] = true;
|
$moduletab['active'] = true;
|
||||||
|
@ -247,20 +247,20 @@ if ($id_agente) {
|
||||||
|
|
||||||
/* Alert tab */
|
/* Alert tab */
|
||||||
$alerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'">'
|
$alerttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'">'
|
||||||
. html_print_image ("images/bell.png", true, array ("title" =>__('Alerts')))
|
. html_print_image ("images/bell.png", true, array ("title" =>__('Alerts')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
if($tab == 'alert')
|
if ($tab == 'alert')
|
||||||
$alerttab['active'] = true;
|
$alerttab['active'] = true;
|
||||||
else
|
else
|
||||||
$alerttab['active'] = false;
|
$alerttab['active'] = false;
|
||||||
|
|
||||||
/* Template tab */
|
/* Template tab */
|
||||||
$templatetab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">'
|
$templatetab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=template&id_agente='.$id_agente.'">'
|
||||||
. html_print_image ("images/network.png", true, array ("title" =>__('Module templates')))
|
. html_print_image ("images/network.png", true, array ("title" =>__('Module templates')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
if($tab == 'template')
|
if ($tab == 'template')
|
||||||
$templatetab['active'] = true;
|
$templatetab['active'] = true;
|
||||||
else
|
else
|
||||||
$templatetab['active'] = false;
|
$templatetab['active'] = false;
|
||||||
|
@ -281,8 +281,8 @@ if ($id_agente) {
|
||||||
/* Group tab */
|
/* Group tab */
|
||||||
|
|
||||||
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'
|
$grouptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">'
|
||||||
. html_print_image ("images/agents_group.png", true, array( "title" => __('Group')))
|
. html_print_image ("images/agents_group.png", true, array( "title" => __('Group')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
$grouptab['active'] = false;
|
$grouptab['active'] = false;
|
||||||
|
|
||||||
|
@ -304,27 +304,34 @@ if ($id_agente) {
|
||||||
$total_incidents = agents_get_count_incidents($id_agente);
|
$total_incidents = agents_get_count_incidents($id_agente);
|
||||||
|
|
||||||
/* Incident tab */
|
/* Incident tab */
|
||||||
if ($config['integria_enabled'] == 0 and $total_incidents > 0){
|
if ($config['integria_enabled'] == 0 and $total_incidents > 0) {
|
||||||
$incidenttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente.'">'
|
$incidenttab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=incident&id_agente='.$id_agente.'">'
|
||||||
. html_print_image ("images/book_edit.png", true, array ("title" =>__('Incidents')))
|
. html_print_image ("images/book_edit.png", true, array ("title" =>__('Incidents')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
if($tab == 'incident')
|
if ($tab == 'incident')
|
||||||
$incidenttab['active'] = true;
|
$incidenttab['active'] = true;
|
||||||
else
|
else
|
||||||
$incidenttab['active'] = false;
|
$incidenttab['active'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$onheader = array('view' => $viewtab, 'separator' => "", 'main' => $maintab,
|
$onheader = array('view' => $viewtab,
|
||||||
'module' => $moduletab, 'alert' => $alerttab, 'template' => $templatetab,
|
'separator' => "",
|
||||||
'inventory' => $inventorytab, 'collection'=> $collectiontab, 'group' => $grouptab, 'gis' => $gistab);
|
'main' => $maintab,
|
||||||
|
'module' => $moduletab,
|
||||||
|
'alert' => $alerttab,
|
||||||
|
'template' => $templatetab,
|
||||||
|
'inventory' => $inventorytab,
|
||||||
|
'collection'=> $collectiontab,
|
||||||
|
'group' => $grouptab,
|
||||||
|
'gis' => $gistab);
|
||||||
|
|
||||||
// Only if the agent has incidents associated show incidents tab
|
// Only if the agent has incidents associated show incidents tab
|
||||||
if ($total_incidents){
|
if ($total_incidents) {
|
||||||
$onheader['incident'] = $incidenttab;
|
$onheader['incident'] = $incidenttab;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($config['extensions'] as $extension) {
|
foreach ($config['extensions'] as $extension) {
|
||||||
if (isset($extension['extension_god_tab'])) {
|
if (isset($extension['extension_god_tab'])) {
|
||||||
$image = $extension['extension_god_tab']['icon'];
|
$image = $extension['extension_god_tab']['icon'];
|
||||||
$name = $extension['extension_god_tab']['name'];
|
$name = $extension['extension_god_tab']['name'];
|
||||||
|
@ -375,10 +382,11 @@ if ($id_agente) {
|
||||||
break;
|
break;
|
||||||
case "extension":
|
case "extension":
|
||||||
$id_extension = get_parameter('id_extension', '');
|
$id_extension = get_parameter('id_extension', '');
|
||||||
switch ($id_extension){
|
switch ($id_extension) {
|
||||||
case "snmp_explorer":
|
case "snmp_explorer":
|
||||||
$tab_description = '- ' . __('SNMP explorer') . ui_print_help_icon('snmp_explorer', true);
|
$tab_description = '- ' . __('SNMP explorer') . ui_print_help_icon('snmp_explorer', true);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -401,12 +409,12 @@ if ($delete_conf_file) {
|
||||||
if (isset ($config["remote_config"])) {
|
if (isset ($config["remote_config"])) {
|
||||||
$agent_md5 = md5 (agents_get_name ($id_agente,'none'), FALSE);
|
$agent_md5 = md5 (agents_get_name ($id_agente,'none'), FALSE);
|
||||||
|
|
||||||
if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) {
|
if (file_exists ($config["remote_config"] . "/md5/" . $agent_md5 . ".md5")) {
|
||||||
// Agent remote configuration editor
|
// Agent remote configuration editor
|
||||||
$file_name = $config["remote_config"]."/conf/".$agent_md5.".conf";
|
$file_name = $config["remote_config"] . "/conf/" . $agent_md5 . ".conf";
|
||||||
$correct = @unlink ($file_name);
|
$correct = @unlink ($file_name);
|
||||||
|
|
||||||
$file_name = $config["remote_config"]."/md5/".$agent_md5.".md5";
|
$file_name = $config["remote_config"] . "/md5/" . $agent_md5 . ".md5";
|
||||||
$correct = @unlink ($file_name);
|
$correct = @unlink ($file_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -440,7 +448,7 @@ if (isset( $_GET["fix_module"])) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = false;
|
$result = false;
|
||||||
$error = " - ".__('No data to normalize');
|
$error = " - " . __('No data to normalize');
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_print_result_message ($result,
|
ui_print_result_message ($result,
|
||||||
|
@ -465,7 +473,7 @@ if ($update_agent) { // if modified some agent paramenter
|
||||||
$direccion_agente = $address_list;
|
$direccion_agente = $address_list;
|
||||||
}
|
}
|
||||||
$grupo = (int) get_parameter_post ("grupo", 0);
|
$grupo = (int) get_parameter_post ("grupo", 0);
|
||||||
$intervalo = (int) get_parameter_post ("intervalo", 300);
|
$intervalo = (int) get_parameter_post ("intervalo", SECONDS_5MINUTES);
|
||||||
$comentarios = str_replace('`','‘',(string) get_parameter_post ("comentarios", ""));
|
$comentarios = str_replace('`','‘',(string) get_parameter_post ("comentarios", ""));
|
||||||
$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");
|
||||||
|
@ -481,42 +489,45 @@ if ($update_agent) { // if modified some agent paramenter
|
||||||
|
|
||||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||||
|
|
||||||
if($fields === false) $fields = array();
|
if ($fields === false) $fields = array();
|
||||||
|
|
||||||
$field_values = array();
|
$field_values = array();
|
||||||
|
|
||||||
foreach($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
|
$field_values[$field['id_field']] = (string) get_parameter_post ('customvalue_'.$field['id_field'], '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach($field_values as $key => $value) {
|
foreach ($field_values as $key => $value) {
|
||||||
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agente, 'id_field' => $key));
|
$old_value = db_get_all_rows_filter('tagent_custom_data', array('id_agent' => $id_agente, 'id_field' => $key));
|
||||||
|
|
||||||
if($old_value === false) {
|
if ($old_value === false) {
|
||||||
// Create custom field if not exist
|
// Create custom field if not exist
|
||||||
db_process_sql_insert ('tagent_custom_data',
|
db_process_sql_insert ('tagent_custom_data',
|
||||||
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
array('id_field' => $key,'id_agent' => $id_agente, 'description' => $value));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_process_sql_update ('tagent_custom_data',
|
db_process_sql_update ('tagent_custom_data',
|
||||||
array('description' => $value),
|
array('description' => $value),
|
||||||
array('id_field' => $key,'id_agent' => $id_agente));
|
array('id_field' => $key,'id_agent' => $id_agente));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Verify if there is another agent with the same name but different ID
|
//Verify if there is another agent with the same name but different ID
|
||||||
if ($nombre_agente == "") {
|
if ($nombre_agente == "") {
|
||||||
echo '<h3 class="error">'.__('No agent name specified').'</h3>';
|
ui_print_error_message(__('No agent name specified'));
|
||||||
//If there is an agent with the same name, but a different ID
|
//If there is an agent with the same name, but a different ID
|
||||||
}
|
}
|
||||||
elseif (agents_get_agent_id ($nombre_agente) > 0 && agents_get_agent_id ($nombre_agente) != $id_agente) {
|
elseif (agents_get_agent_id ($nombre_agente) > 0 &&
|
||||||
echo '<h3 class="error">'.__('There is already an agent in the database with this name').'</h3>';
|
agents_get_agent_id ($nombre_agente) != $id_agente) {
|
||||||
|
ui_print_error_message(__('There is already an agent in the database with this name'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//If different IP is specified than previous, add the IP
|
//If different IP is specified than previous, add the IP
|
||||||
if ($direccion_agente != '' && $direccion_agente != agents_get_address ($id_agente))
|
if ($direccion_agente != '' &&
|
||||||
|
$direccion_agente != agents_get_address ($id_agente)) {
|
||||||
agents_add_address ($id_agente, $direccion_agente);
|
agents_add_address ($id_agente, $direccion_agente);
|
||||||
|
}
|
||||||
|
|
||||||
//If IP is set for deletion, delete first
|
//If IP is set for deletion, delete first
|
||||||
if (isset ($_POST["delete_ip"])) {
|
if (isset ($_POST["delete_ip"])) {
|
||||||
|
@ -543,7 +554,8 @@ if ($update_agent) { // if modified some agent paramenter
|
||||||
array ('id_agente' => $id_agente));
|
array ('id_agente' => $id_agente));
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
ui_print_error_message (__('There was a problem updating the agent'));
|
ui_print_error_message(
|
||||||
|
__('There was a problem updating the agent'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$info = 'Group: ' . $grupo . ' Interval: ' . $intervalo .
|
$info = 'Group: ' . $grupo . ' Interval: ' . $intervalo .
|
||||||
|
@ -558,7 +570,6 @@ if ($update_agent) { // if modified some agent paramenter
|
||||||
ui_print_success_message (__('Successfully updated'));
|
ui_print_success_message (__('Successfully updated'));
|
||||||
db_pandora_audit("Agent management",
|
db_pandora_audit("Agent management",
|
||||||
"Updated agent $nombre_agente", false, false, $info);
|
"Updated agent $nombre_agente", false, false, $info);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,7 +581,7 @@ if ($id_agente) {
|
||||||
$id_grupo = agents_get_agent_group ($id_agente);
|
$id_grupo = agents_get_agent_group ($id_agente);
|
||||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||||
|
|
||||||
if($is_extra === ENTERPRISE_NOT_HOOK) {
|
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||||
$is_extra = false;
|
$is_extra = false;
|
||||||
}
|
}
|
||||||
if (!check_acl ($config["id_user"], $id_grupo, "AW") && !$is_extra) {
|
if (!check_acl ($config["id_user"], $id_grupo, "AW") && !$is_extra) {
|
||||||
|
@ -617,7 +628,7 @@ if ($update_module || $create_module) {
|
||||||
|
|
||||||
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
|
||||||
|
|
||||||
if($is_extra === ENTERPRISE_NOT_HOOK) {
|
if ($is_extra === ENTERPRISE_NOT_HOOK) {
|
||||||
$is_extra = false;
|
$is_extra = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,7 +671,7 @@ if ($update_module || $create_module) {
|
||||||
$custom_integer_2 = (int) get_parameter ('custom_integer_2');
|
$custom_integer_2 = (int) get_parameter ('custom_integer_2');
|
||||||
|
|
||||||
// Services are an enterprise feature,
|
// Services are an enterprise feature,
|
||||||
// so we got the parameters using this function.
|
// so we got the parameters using this function.
|
||||||
|
|
||||||
enterprise_hook ('get_service_synthetic_parameters');
|
enterprise_hook ('get_service_synthetic_parameters');
|
||||||
|
|
||||||
|
@ -674,7 +685,7 @@ if ($update_module || $create_module) {
|
||||||
$snmp_oid = (string) get_parameter ('select_snmp_oid');
|
$snmp_oid = (string) get_parameter ('select_snmp_oid');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_module_type >= 15 && $id_module_type <= 18){
|
if ($id_module_type >= 15 && $id_module_type <= 18) {
|
||||||
// New support for snmp v3
|
// New support for snmp v3
|
||||||
$tcp_send = (string) get_parameter ('snmp_version');
|
$tcp_send = (string) get_parameter ('snmp_version');
|
||||||
$plugin_user = (string) get_parameter ('snmp3_auth_user');
|
$plugin_user = (string) get_parameter ('snmp3_auth_user');
|
||||||
|
@ -691,7 +702,6 @@ if ($update_module || $create_module) {
|
||||||
$plugin_pass = (int) get_parameter ('plugin_pass');
|
$plugin_pass = (int) get_parameter ('plugin_pass');
|
||||||
else
|
else
|
||||||
$plugin_pass = (string) get_parameter ('plugin_pass');
|
$plugin_pass = (string) get_parameter ('plugin_pass');
|
||||||
|
|
||||||
$plugin_parameter = (string) get_parameter ('plugin_parameter');
|
$plugin_parameter = (string) get_parameter ('plugin_parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,14 +719,14 @@ if ($update_module || $create_module) {
|
||||||
$id_tag = (array) get_parameter('id_tag_selected');
|
$id_tag = (array) get_parameter('id_tag_selected');
|
||||||
$serialize_ops = (string) get_parameter('serialize_ops');
|
$serialize_ops = (string) get_parameter('serialize_ops');
|
||||||
|
|
||||||
if($prediction_module != 3) {
|
if ($prediction_module != 3) {
|
||||||
unset($serialize_ops);
|
unset($serialize_ops);
|
||||||
enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module));
|
enterprise_hook('modules_delete_synthetic_operations', array($id_agent_module));
|
||||||
}
|
}
|
||||||
|
|
||||||
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
$active_snmp_v3 = get_parameter('active_snmp_v3');
|
||||||
if ($active_snmp_v3) {
|
if ($active_snmp_v3) {
|
||||||
//
|
//LOST CODE?
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make changes in the conf file if necessary
|
// Make changes in the conf file if necessary
|
||||||
|
@ -730,45 +740,45 @@ if ($update_module) {
|
||||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||||
|
|
||||||
$values = array ('descripcion' => $description,
|
$values = array ('descripcion' => $description,
|
||||||
'id_module_group' => $id_module_group,
|
'id_module_group' => $id_module_group,
|
||||||
'nombre' => $name,
|
'nombre' => $name,
|
||||||
'max' => $max,
|
'max' => $max,
|
||||||
'min' => $min,
|
'min' => $min,
|
||||||
'module_interval' => $interval,
|
'module_interval' => $interval,
|
||||||
'module_ff_interval' => $ff_interval,
|
'module_ff_interval' => $ff_interval,
|
||||||
'tcp_port' => $tcp_port,
|
'tcp_port' => $tcp_port,
|
||||||
'tcp_send' => $tcp_send,
|
'tcp_send' => $tcp_send,
|
||||||
'tcp_rcv' => $tcp_rcv,
|
'tcp_rcv' => $tcp_rcv,
|
||||||
'snmp_community' => $snmp_community,
|
'snmp_community' => $snmp_community,
|
||||||
'snmp_oid' => $snmp_oid,
|
'snmp_oid' => $snmp_oid,
|
||||||
'ip_target' => $ip_target,
|
'ip_target' => $ip_target,
|
||||||
'flag' => $flag,
|
'flag' => $flag,
|
||||||
'disabled' => $disabled,
|
'disabled' => $disabled,
|
||||||
'id_export' => $id_export,
|
'id_export' => $id_export,
|
||||||
'plugin_user' => $plugin_user,
|
'plugin_user' => $plugin_user,
|
||||||
'plugin_pass' => $plugin_pass,
|
'plugin_pass' => $plugin_pass,
|
||||||
'plugin_parameter' => $plugin_parameter,
|
'plugin_parameter' => $plugin_parameter,
|
||||||
'id_plugin' => $id_plugin,
|
'id_plugin' => $id_plugin,
|
||||||
'post_process' => $post_process,
|
'post_process' => $post_process,
|
||||||
'prediction_module' => $prediction_module,
|
'prediction_module' => $prediction_module,
|
||||||
'max_timeout' => $max_timeout,
|
'max_timeout' => $max_timeout,
|
||||||
'custom_id' => $custom_id,
|
'custom_id' => $custom_id,
|
||||||
'history_data' => $history_data,
|
'history_data' => $history_data,
|
||||||
'min_warning' => $min_warning,
|
'min_warning' => $min_warning,
|
||||||
'max_warning' => $max_warning,
|
'max_warning' => $max_warning,
|
||||||
'str_warning' => $str_warning,
|
'str_warning' => $str_warning,
|
||||||
'min_critical' => $min_critical,
|
'min_critical' => $min_critical,
|
||||||
'max_critical' => $max_critical,
|
'max_critical' => $max_critical,
|
||||||
'str_critical' => $str_critical,
|
'str_critical' => $str_critical,
|
||||||
'custom_string_1' => $custom_string_1,
|
'custom_string_1' => $custom_string_1,
|
||||||
'custom_string_2' => $custom_string_2,
|
'custom_string_2' => $custom_string_2,
|
||||||
'custom_string_3' => $custom_string_3,
|
'custom_string_3' => $custom_string_3,
|
||||||
'custom_integer_1' => $custom_integer_1,
|
'custom_integer_1' => $custom_integer_1,
|
||||||
'custom_integer_2' => $custom_integer_2,
|
'custom_integer_2' => $custom_integer_2,
|
||||||
'min_ff_event' => $ff_event,
|
'min_ff_event' => $ff_event,
|
||||||
'unit' => $unit);
|
'unit' => $unit);
|
||||||
|
|
||||||
if($prediction_module == 3 && $serialize_ops == '') {
|
if ($prediction_module == 3 && $serialize_ops == '') {
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -777,26 +787,24 @@ if ($update_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_error($result)) {
|
if (is_error($result)) {
|
||||||
$msg = __('There was a problem updating module').'. ';
|
|
||||||
|
|
||||||
switch($result) {
|
switch($result) {
|
||||||
case ERR_EXIST:
|
case ERR_EXIST:
|
||||||
$msg .= __('Another module already exists with the same name').'.';
|
$msg = __('There was a problem updating module. Another module already exists with the same name.');
|
||||||
break;
|
break;
|
||||||
case ERR_INCOMPLETE:
|
case ERR_INCOMPLETE:
|
||||||
$msg .= __('Some required fields are missed').': ('.__('name').')';
|
$msg = __('There was a problem updating module. Some required fields are missed: (name)');
|
||||||
break;
|
break;
|
||||||
case ERR_NOCHANGES:
|
case ERR_NOCHANGES:
|
||||||
$msg .= __('"No change"');
|
$msg = __('There was a problem updating module. "No change"');
|
||||||
break;
|
break;
|
||||||
case ERR_DB:
|
case ERR_DB:
|
||||||
case ERR_GENERIC:
|
case ERR_GENERIC:
|
||||||
default:
|
default:
|
||||||
$msg .= __('Processing error');
|
$msg = __('There was a problem updating module. Processing error');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$result = false;
|
$result = false;
|
||||||
echo '<h3 class="error">'.$msg.'</h3>';
|
ui_print_error_message($msg);
|
||||||
|
|
||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
|
|
||||||
|
@ -804,10 +812,10 @@ if ($update_module) {
|
||||||
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
"Fail to try update module '$name' for agent ".$agent["nombre"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($prediction_module == 3) {
|
if ($prediction_module == 3) {
|
||||||
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
||||||
}
|
}
|
||||||
echo '<h3 class="suc">'.__('Module successfully updated').'</h3>';
|
ui_print_success_message(__('Module successfully updated'));
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
|
|
||||||
|
@ -824,7 +832,7 @@ if ($create_module) {
|
||||||
if (isset ($_POST["combo_snmp_oid"])) {
|
if (isset ($_POST["combo_snmp_oid"])) {
|
||||||
$combo_snmp_oid = get_parameter_post ("combo_snmp_oid");
|
$combo_snmp_oid = get_parameter_post ("combo_snmp_oid");
|
||||||
}
|
}
|
||||||
if ($snmp_oid == ""){
|
if ($snmp_oid == "") {
|
||||||
$snmp_oid = $combo_snmp_oid;
|
$snmp_oid = $combo_snmp_oid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,44 +847,44 @@ if ($create_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = array ('id_tipo_modulo' => $id_module_type,
|
$values = array ('id_tipo_modulo' => $id_module_type,
|
||||||
'descripcion' => $description,
|
'descripcion' => $description,
|
||||||
'max' => $max,
|
'max' => $max,
|
||||||
'min' => $min,
|
'min' => $min,
|
||||||
'snmp_oid' => $snmp_oid,
|
'snmp_oid' => $snmp_oid,
|
||||||
'snmp_community' => $snmp_community,
|
'snmp_community' => $snmp_community,
|
||||||
'id_module_group' => $id_module_group,
|
'id_module_group' => $id_module_group,
|
||||||
'module_interval' => $interval,
|
'module_interval' => $interval,
|
||||||
'module_ff_interval' => $ff_interval,
|
'module_ff_interval' => $ff_interval,
|
||||||
'ip_target' => $ip_target,
|
'ip_target' => $ip_target,
|
||||||
'tcp_port' => $tcp_port,
|
'tcp_port' => $tcp_port,
|
||||||
'tcp_rcv' => $tcp_rcv,
|
'tcp_rcv' => $tcp_rcv,
|
||||||
'tcp_send' => $tcp_send,
|
'tcp_send' => $tcp_send,
|
||||||
'id_export' => $id_export,
|
'id_export' => $id_export,
|
||||||
'plugin_user' => $plugin_user,
|
'plugin_user' => $plugin_user,
|
||||||
'plugin_pass' => $plugin_pass,
|
'plugin_pass' => $plugin_pass,
|
||||||
'plugin_parameter' => $plugin_parameter,
|
'plugin_parameter' => $plugin_parameter,
|
||||||
'id_plugin' => $id_plugin,
|
'id_plugin' => $id_plugin,
|
||||||
'post_process' => $post_process,
|
'post_process' => $post_process,
|
||||||
'prediction_module' => $prediction_module,
|
'prediction_module' => $prediction_module,
|
||||||
'max_timeout' => $max_timeout,
|
'max_timeout' => $max_timeout,
|
||||||
'disabled' => $disabled,
|
'disabled' => $disabled,
|
||||||
'id_modulo' => $id_module,
|
'id_modulo' => $id_module,
|
||||||
'custom_id' => $custom_id,
|
'custom_id' => $custom_id,
|
||||||
'history_data' => $history_data,
|
'history_data' => $history_data,
|
||||||
'min_warning' => $min_warning,
|
'min_warning' => $min_warning,
|
||||||
'max_warning' => $max_warning,
|
'max_warning' => $max_warning,
|
||||||
'str_warning' => $str_warning,
|
'str_warning' => $str_warning,
|
||||||
'min_critical' => $min_critical,
|
'min_critical' => $min_critical,
|
||||||
'max_critical' => $max_critical,
|
'max_critical' => $max_critical,
|
||||||
'str_critical' => $str_critical,
|
'str_critical' => $str_critical,
|
||||||
'custom_string_1' => $custom_string_1,
|
'custom_string_1' => $custom_string_1,
|
||||||
'custom_string_2' => $custom_string_2,
|
'custom_string_2' => $custom_string_2,
|
||||||
'custom_string_3' => $custom_string_3,
|
'custom_string_3' => $custom_string_3,
|
||||||
'custom_integer_1' => $custom_integer_1,
|
'custom_integer_1' => $custom_integer_1,
|
||||||
'custom_integer_2' => $custom_integer_2,
|
'custom_integer_2' => $custom_integer_2,
|
||||||
'min_ff_event' => $ff_event,
|
'min_ff_event' => $ff_event,
|
||||||
'unit' => $unit
|
'unit' => $unit);
|
||||||
);
|
|
||||||
if($prediction_module == 3 && $serialize_ops == '') {
|
if($prediction_module == 3 && $serialize_ops == '') {
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
}
|
}
|
||||||
|
@ -885,22 +893,21 @@ if ($create_module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_error($id_agent_module)) {
|
if (is_error($id_agent_module)) {
|
||||||
$msg = __('There was a problem adding module').'. ';
|
|
||||||
switch($id_agent_module) {
|
switch($id_agent_module) {
|
||||||
case ERR_EXIST:
|
case ERR_EXIST:
|
||||||
$msg .= __('Another module already exists with the same name').'.';
|
$msg __('There was a problem adding module. Another module already exists with the same name.');
|
||||||
break;
|
break;
|
||||||
case ERR_INCOMPLETE:
|
case ERR_INCOMPLETE:
|
||||||
$msg .= __('Some required fields are missed').': ('.__('name').')';
|
$msg __('There was a problem adding module. Some required fields are missed : (name)');
|
||||||
break;
|
break;
|
||||||
case ERR_DB:
|
case ERR_DB:
|
||||||
case ERR_GENERIC:
|
case ERR_GENERIC:
|
||||||
default:
|
default:
|
||||||
$msg .= __('Processing error');
|
$msg __('There was a problem adding module. Processing error');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
echo '<h3 class="error">'.$msg.'</h3>';
|
ui_print_error_message($msg);
|
||||||
$edit_module = true;
|
$edit_module = true;
|
||||||
$moduletype = $id_module;
|
$moduletype = $id_module;
|
||||||
db_pandora_audit("Agent management",
|
db_pandora_audit("Agent management",
|
||||||
|
@ -911,7 +918,7 @@ if ($create_module) {
|
||||||
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<h3 class="suc">'.__('Module added successfully').'</h3>';
|
ui_print_success_message(__('Module added successfully'));
|
||||||
$id_agent_module = false;
|
$id_agent_module = false;
|
||||||
$edit_module = false;
|
$edit_module = false;
|
||||||
|
|
||||||
|
@ -982,12 +989,12 @@ if ($delete_module) { // DELETE agent module !
|
||||||
// If result is empty then module doesn't have this type of submodules
|
// If result is empty then module doesn't have this type of submodules
|
||||||
$ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_borrar_modulo));
|
$ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_borrar_modulo));
|
||||||
$result_ops_synthetic = json_decode($ops_json);
|
$result_ops_synthetic = json_decode($ops_json);
|
||||||
if (!empty($result_ops_synthetic)){
|
if (!empty($result_ops_synthetic)) {
|
||||||
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_borrar_modulo));
|
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_borrar_modulo));
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
$error++;
|
$error++;
|
||||||
} // Trick to detect if we are deleting components of synthetics modules (avg or arithmetic)
|
} // Trick to detect if we are deleting components of synthetics modules (avg or arithmetic)
|
||||||
else{
|
else {
|
||||||
$result_components = enterprise_hook('modules_get_synthetic_components', array($id_borrar_modulo));
|
$result_components = enterprise_hook('modules_get_synthetic_components', array($id_borrar_modulo));
|
||||||
$count_components = 1;
|
$count_components = 1;
|
||||||
if (!empty($result_components)){
|
if (!empty($result_components)){
|
||||||
|
@ -996,8 +1003,10 @@ if ($delete_module) { // DELETE agent module !
|
||||||
$last_target_module = 0;
|
$last_target_module = 0;
|
||||||
foreach ($result_components as $id_target_module){
|
foreach ($result_components as $id_target_module){
|
||||||
// Detects change of component or last component to update orders
|
// Detects change of component or last component to update orders
|
||||||
if (($count_components == $num_components) or ($last_target_module != $id_target_module))
|
if (($count_components == $num_components) or
|
||||||
|
($last_target_module != $id_target_module)) {
|
||||||
$update_orders = true;
|
$update_orders = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$update_orders = false;
|
$update_orders = false;
|
||||||
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_target_module, $id_borrar_modulo, $update_orders));
|
$result = enterprise_hook('modules_delete_synthetic_operations', array($id_target_module, $id_borrar_modulo, $update_orders));
|
||||||
|
@ -1013,11 +1022,11 @@ if ($delete_module) { // DELETE agent module !
|
||||||
//Check for errors
|
//Check for errors
|
||||||
if ($error != 0) {
|
if ($error != 0) {
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
ui_print_error_message (__('There was a problem deleting the module'));
|
ui_print_error_message(__('There was a problem deleting the module'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_process_sql_commit ();
|
db_process_sql_commit ();
|
||||||
ui_print_success_message (__('Module deleted succesfully'));
|
ui_print_success_message(__('Module deleted succesfully'));
|
||||||
|
|
||||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||||
db_pandora_audit("Agent management",
|
db_pandora_audit("Agent management",
|
||||||
|
@ -1031,7 +1040,7 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
||||||
$id_duplicate_module = $duplicate_module;
|
$id_duplicate_module = $duplicate_module;
|
||||||
|
|
||||||
$original_name = modules_get_agentmodule_name($id_duplicate_module);
|
$original_name = modules_get_agentmodule_name($id_duplicate_module);
|
||||||
$copy_name = io_safe_input(__('copy of') . ' ') . $original_name;
|
$copy_name = sprintf(__('copy of %s'), $original_name);
|
||||||
|
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
$exists = true;
|
$exists = true;
|
||||||
|
@ -1040,8 +1049,7 @@ if (!empty($duplicate_module)) { // DUPLICATE agent module !
|
||||||
'nombre', $copy_name);
|
'nombre', $copy_name);
|
||||||
if ($exists) {
|
if ($exists) {
|
||||||
$cont++;
|
$cont++;
|
||||||
$copy_name = io_safe_input(__('copy of') . ' ') . $original_name
|
$copy_name = sprintf(__('copy of %s (%d)'), $original_name, $cont);
|
||||||
. io_safe_input(' (' . $cont . ')');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1085,7 +1093,7 @@ if ($updateGIS) {
|
||||||
"altitude" => $previusAgentGISData['stored_altitude'],
|
"altitude" => $previusAgentGISData['stored_altitude'],
|
||||||
"start_timestamp" => $previusAgentGISData['start_timestamp'],
|
"start_timestamp" => $previusAgentGISData['start_timestamp'],
|
||||||
"end_timestamp" => date( 'Y-m-d H:i:s'),
|
"end_timestamp" => date( 'Y-m-d H:i:s'),
|
||||||
"description" => "Save by Pandora Console",
|
"description" => __('Save by Pandora Console'),
|
||||||
"manual_placement" => $previusAgentGISData['manual_placement'],
|
"manual_placement" => $previusAgentGISData['manual_placement'],
|
||||||
"number_of_packages" => $previusAgentGISData['number_of_packages'],
|
"number_of_packages" => $previusAgentGISData['number_of_packages'],
|
||||||
"tagente_id_agente" => $previusAgentGISData['tagente_id_agente']
|
"tagente_id_agente" => $previusAgentGISData['tagente_id_agente']
|
||||||
|
@ -1100,7 +1108,7 @@ if ($updateGIS) {
|
||||||
"stored_altitude" => $lastAltitude,
|
"stored_altitude" => $lastAltitude,
|
||||||
"start_timestamp" => date( 'Y-m-d H:i:s'),
|
"start_timestamp" => date( 'Y-m-d H:i:s'),
|
||||||
"manual_placement" => 1,
|
"manual_placement" => 1,
|
||||||
"description" => "Update by Pandora Console"),
|
"description" => __('Update by Pandora Console')),
|
||||||
array("tagente_id_agente" => $idAgente));
|
array("tagente_id_agente" => $idAgente));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1113,7 +1121,7 @@ if ($updateGIS) {
|
||||||
"stored_latitude" => $lastLatitude,
|
"stored_latitude" => $lastLatitude,
|
||||||
"stored_altitude" => $lastAltitude,
|
"stored_altitude" => $lastAltitude,
|
||||||
"manual_placement" => 1,
|
"manual_placement" => 1,
|
||||||
"description" => "Insert by Pandora Console"
|
"description" => __('Insert by Pandora Console')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
db_process_sql_commit();
|
db_process_sql_commit();
|
||||||
|
@ -1165,13 +1173,15 @@ switch ($tab) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
ui_print_error_message ("Invalid tab specified");
|
ui_print_error_message (__('Invalid tab specified'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (enterprise_hook ('switch_agent_tab', array ($tab)))
|
if (enterprise_hook ('switch_agent_tab', array ($tab))) {
|
||||||
//This will make sure that blank pages will have at least some
|
//This will make sure that blank pages will have at least some
|
||||||
//debug info in them - do not translate debug
|
//debug info in them - do not translate debug
|
||||||
ui_print_error_message ("Invalid tab specified");
|
ui_print_error_message (__('Invalid tab specified'));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -236,7 +236,7 @@ $field2 = '';
|
||||||
$field3 = '';
|
$field3 = '';
|
||||||
$min_alerts = 0;
|
$min_alerts = 0;
|
||||||
$max_alerts = 1;
|
$max_alerts = 1;
|
||||||
$threshold = 300;
|
$threshold = SECONDS_5MINUTES;
|
||||||
$recovery_notify = false;
|
$recovery_notify = false;
|
||||||
$field2_recovery = '';
|
$field2_recovery = '';
|
||||||
$field3_recovery = '';
|
$field3_recovery = '';
|
||||||
|
@ -287,7 +287,8 @@ if ($create_compound) {
|
||||||
/* Go to previous step in case of error */
|
/* Go to previous step in case of error */
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
$step = $step - 1;
|
$step = $step - 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$id = $result;
|
$id = $result;
|
||||||
$alerts = (array) get_parameter ('conditions');
|
$alerts = (array) get_parameter ('conditions');
|
||||||
$operations = (array) get_parameter ('operations');
|
$operations = (array) get_parameter ('operations');
|
||||||
|
@ -329,7 +330,8 @@ if ($step == 2) {
|
||||||
$table->style['other_label'] = 'display:none; font-weight: bold';
|
$table->style['other_label'] = 'display:none; font-weight: bold';
|
||||||
$table->style['other_input'] = 'display:none';
|
$table->style['other_input'] = 'display:none';
|
||||||
$threshold_selected = $threshold;
|
$threshold_selected = $threshold;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$table->style['other_label'] = 'font-weight: bold';
|
$table->style['other_label'] = 'font-weight: bold';
|
||||||
$threshold_selected = -1;
|
$threshold_selected = -1;
|
||||||
}
|
}
|
||||||
|
@ -581,7 +583,7 @@ echo '</form>';
|
||||||
|
|
||||||
/* Show alert search when we're on the first step */
|
/* Show alert search when we're on the first step */
|
||||||
if ($step == 1) {
|
if ($step == 1) {
|
||||||
echo '<h3>'.__('Add condition').'</h3>';
|
echo '<h3>'. __('Add condition') . '</h3>';
|
||||||
|
|
||||||
$id_group = (int) get_parameter ('id_group');
|
$id_group = (int) get_parameter ('id_group');
|
||||||
|
|
||||||
|
|
|
@ -86,14 +86,15 @@ html_print_select ($modules, "origen_modulo[]", $module_selected, '', '', '0', f
|
||||||
|
|
||||||
echo '</div>'; //Left div
|
echo '</div>'; //Left div
|
||||||
|
|
||||||
echo '<div style="float:left; width:\'98%\'; margin-left:20% "><b>'.__('Purge data out of these limits').'</b><br /><br />';
|
echo '<div style="float:left; width:\'98%\'; margin-left:20% ">
|
||||||
|
<b>'.__('Purge data out of these limits').'</b><br /><br />';
|
||||||
echo '<table><tr><td>';
|
echo '<table><tr><td>';
|
||||||
echo __('Minimum').': ';
|
echo __('Minimum').': ';
|
||||||
echo '</td><td>';
|
echo '</td><td>';
|
||||||
html_print_input_text ("min", 0, __('Minimum'), 4, 0, false);
|
html_print_input_text ("min", 0, __('Minimum'), 4, 0, false);
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
echo '<tr><td>';
|
echo '<tr><td>';
|
||||||
echo __('Maximum').': ';
|
echo __('Maximum').': ';
|
||||||
echo '</td><td>';
|
echo '</td><td>';
|
||||||
html_print_input_text ("max", 0, __('Maximum'), 4, 0, false);
|
html_print_input_text ("max", 0, __('Maximum'), 4, 0, false);
|
||||||
echo '</td></tr>';
|
echo '</td></tr>';
|
||||||
|
|
|
@ -63,7 +63,7 @@ push_table_row($data, 'field_process');
|
||||||
return;
|
return;
|
||||||
// Update an existing component
|
// Update an existing component
|
||||||
if (! $id) {
|
if (! $id) {
|
||||||
$module_interval = 300;
|
$module_interval = SECONDS_5MINUTES;
|
||||||
$tcp_port = "";
|
$tcp_port = "";
|
||||||
$tcp_rcv = "";
|
$tcp_rcv = "";
|
||||||
$tcp_send = "";
|
$tcp_send = "";
|
||||||
|
|
|
@ -51,7 +51,8 @@ $table->data[1][1] .= html_print_input_text ('date_format', $config["date_format
|
||||||
if($config['prominent_time'] == 'comparation') {
|
if($config['prominent_time'] == 'comparation') {
|
||||||
$timestamp = false;
|
$timestamp = false;
|
||||||
$comparation = true;
|
$comparation = true;
|
||||||
} else if ($config['prominent_time'] == 'timestamp') {
|
}
|
||||||
|
else if ($config['prominent_time'] == 'timestamp') {
|
||||||
$timestamp = true;
|
$timestamp = true;
|
||||||
$comparation = false;
|
$comparation = false;
|
||||||
}
|
}
|
||||||
|
@ -111,11 +112,11 @@ $table->data[14][1] = html_print_select (list_files ('images/custom_logo', "png"
|
||||||
$values = array ();
|
$values = array ();
|
||||||
$values[5] = human_time_description_raw (5);
|
$values[5] = human_time_description_raw (5);
|
||||||
$values[30] = human_time_description_raw (30);
|
$values[30] = human_time_description_raw (30);
|
||||||
$values[60] = human_time_description_raw (60);
|
$values[SECONDS_1MINUTE] = human_time_description_raw(SECONDS_1MINUTE);
|
||||||
$values[120] = human_time_description_raw (120);
|
$values[SECONDS_2MINUTES] = human_time_description_raw(SECONDS_2MINUTES);
|
||||||
$values[300] = human_time_description_raw (300);
|
$values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES);
|
||||||
$values[600] = human_time_description_raw (600);
|
$values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES);
|
||||||
$values[1800] = human_time_description_raw (1800);
|
$values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES);
|
||||||
|
|
||||||
$table->data[15][0] = __('Global default interval for refresh') . ui_print_help_tip(__('This interval will affect all pages'), true);
|
$table->data[15][0] = __('Global default interval for refresh') . ui_print_help_tip(__('This interval will affect all pages'), true);
|
||||||
$table->data[15][1] = html_print_select ($values, 'refr', $config["refr"], '', 'N/A', 0, true, false, false);
|
$table->data[15][1] = html_print_select ($values, 'refr', $config["refr"], '', 'N/A', 0, true, false, false);
|
||||||
|
|
|
@ -43,7 +43,7 @@ else if (isset ($_GET["submit"])) {
|
||||||
$description = (string) get_parameter_post ("description");
|
$description = (string) get_parameter_post ("description");
|
||||||
$oid = (string) get_parameter_post ("oid");
|
$oid = (string) get_parameter_post ("oid");
|
||||||
$custom_value = (string) get_parameter_post ("custom_value");
|
$custom_value = (string) get_parameter_post ("custom_value");
|
||||||
$time_threshold = (int) get_parameter_post ("time_threshold", 300);
|
$time_threshold = (int) get_parameter_post ("time_threshold", SECONDS_5MINUTES);
|
||||||
$time_other = (int) get_parameter_post ("time_other", -1);
|
$time_other = (int) get_parameter_post ("time_other", -1);
|
||||||
$al_field1 = (string) get_parameter_post ("al_field1");
|
$al_field1 = (string) get_parameter_post ("al_field1");
|
||||||
$al_field2 = (string) get_parameter_post ("al_field2");
|
$al_field2 = (string) get_parameter_post ("al_field2");
|
||||||
|
@ -91,33 +91,39 @@ else if (isset ($_GET["submit"])) {
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
db_pandora_audit("SNMP management", "Fail try to create snmp alert");
|
db_pandora_audit("SNMP management", "Fail try to create snmp alert");
|
||||||
echo '<h3 class="error">'.__('There was a problem creating the alert').'</h3>';
|
ui_print_error_message(__('There was a problem creating the alert'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("SNMP management", "Create snmp alert #$result");
|
db_pandora_audit("SNMP management", "Create snmp alert #$result");
|
||||||
echo '<h3 class="suc">'.__('Successfully created').'</h3>';
|
ui_print_success_message(__('Successfully created'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql = sprintf ("UPDATE talert_snmp SET
|
$sql = sprintf ("UPDATE talert_snmp SET
|
||||||
priority = %d, id_alert = %d, al_field1 = '%s', al_field2 = '%s', al_field3 = '%s', description = '%s', agent = '%s', custom_oid = '%s',
|
priority = %d, id_alert = %d, al_field1 = '%s',
|
||||||
oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d, _snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s', _snmp_f4_ = '%s',
|
al_field2 = '%s', al_field3 = '%s', description = '%s',
|
||||||
_snmp_f5_ = '%s', _snmp_f6_ = '%s', trap_type = %d, single_value = '%s'
|
agent = '%s', custom_oid = '%s', oid = '%s',
|
||||||
WHERE id_as = %d",
|
time_threshold = %d, max_alerts = %d, min_alerts = %d,
|
||||||
$priority, $alert_type, $al_field1, $al_field2, $al_field3, $description, $source_ip, $custom_value,
|
_snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s',
|
||||||
$oid, $time_threshold, $max_alerts, $min_alerts, $custom_oid_data_1, $custom_oid_data_2, $custom_oid_data_3,
|
_snmp_f4_ = '%s', _snmp_f5_ = '%s', _snmp_f6_ = '%s',
|
||||||
$custom_oid_data_4, $custom_oid_data_5, $custom_oid_data_6, $trap_type, $single_value, $id_as);
|
trap_type = %d, single_value = '%s'
|
||||||
|
WHERE id_as = %d",
|
||||||
|
$priority, $alert_type, $al_field1, $al_field2, $al_field3,
|
||||||
|
$description, $source_ip, $custom_value, $oid, $time_threshold,
|
||||||
|
$max_alerts, $min_alerts, $custom_oid_data_1, $custom_oid_data_2,
|
||||||
|
$custom_oid_data_3, $custom_oid_data_4, $custom_oid_data_5,
|
||||||
|
$custom_oid_data_6, $trap_type, $single_value, $id_as);
|
||||||
|
|
||||||
$result = db_process_sql ($sql);
|
$result = db_process_sql ($sql);
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
db_pandora_audit("SNMP management", "Fail try to update snmp alert #$id_as");
|
db_pandora_audit("SNMP management", "Fail try to update snmp alert #$id_as");
|
||||||
echo '<h3 class="error">'.__('There was a problem updating the alert').'</h3>';
|
ui_print_error_message(__('There was a problem updating the alert'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("SNMP management", "Update snmp alert #$id_as");
|
db_pandora_audit("SNMP management", "Update snmp alert #$id_as");
|
||||||
echo '<h3 class="suc">'.__('Successfully updated').'</h3>';
|
ui_print_success_message(__('Successfully updated'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +166,7 @@ elseif (isset ($_GET["update_alert"])) {
|
||||||
$description = "";
|
$description = "";
|
||||||
$oid = "";
|
$oid = "";
|
||||||
$custom_value = "";
|
$custom_value = "";
|
||||||
$time_threshold = 300;
|
$time_threshold = SECONDS_5MINUTES;
|
||||||
$al_field1 = "";
|
$al_field1 = "";
|
||||||
$al_field2 = "";
|
$al_field2 = "";
|
||||||
$al_field3 = "";
|
$al_field3 = "";
|
||||||
|
@ -187,11 +193,11 @@ if (isset ($_GET["delete_alert"])) { // Delete alert
|
||||||
$result = db_process_sql_delete('talert_snmp', array('id_as' => $alert_delete));
|
$result = db_process_sql_delete('talert_snmp', array('id_as' => $alert_delete));
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
db_pandora_audit("SNMP management", "Fail try to delete snmp alert #$alert_delete");
|
db_pandora_audit("SNMP management", "Fail try to delete snmp alert #$alert_delete");
|
||||||
echo '<h3 class="error">'.__('There was a problem deleting the alert').'</h3>';
|
ui_print_error_message(__('There was a problem deleting the alert'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_pandora_audit("SNMP management", "Delete snmp alert #$alert_delete");
|
db_pandora_audit("SNMP management", "Delete snmp alert #$alert_delete");
|
||||||
echo '<h3 class="suc">'.__('Successfully deleted').'</h3>';
|
ui_print_success_message(__('Successfully deleted'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ function agents_create_agent ($name, $id_group, $interval, $ip_address, $values
|
||||||
return false;
|
return false;
|
||||||
if (empty ($ip_address))
|
if (empty ($ip_address))
|
||||||
return false;
|
return false;
|
||||||
$interval = safe_int ($interval,1, 300);
|
$interval = safe_int ($interval,1, SECONDS_5MINUTES);
|
||||||
if (empty ($interval))
|
if (empty ($interval))
|
||||||
return false;
|
return false;
|
||||||
if (! is_array ($values))
|
if (! is_array ($values))
|
||||||
|
@ -76,16 +76,16 @@ function agents_create_agent ($name, $id_group, $interval, $ip_address, $values
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = db_process_sql_insert ('tagente_estado',
|
$result = db_process_sql_insert ('tagente_estado',
|
||||||
array ('id_agente_modulo' => $id_agent_module,
|
array ('id_agente_modulo' => $id_agent_module,
|
||||||
'datos' => '',
|
'datos' => '',
|
||||||
'timestamp' => 0,
|
'timestamp' => 0,
|
||||||
'estado' => 0,
|
'estado' => 0,
|
||||||
'id_agente' => $id_agent,
|
'id_agente' => $id_agent,
|
||||||
'last_try' => 0,
|
'last_try' => 0,
|
||||||
'utimestamp' => 0,
|
'utimestamp' => 0,
|
||||||
'current_interval' => 0,
|
'current_interval' => 0,
|
||||||
'running_by' => 0,
|
'running_by' => 0,
|
||||||
'last_execution_try' => 0));
|
'last_execution_try' => 0));
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
db_process_sql_rollback ();
|
db_process_sql_rollback ();
|
||||||
|
@ -145,6 +145,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$filter .= '';
|
$filter .= '';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array ($options)) {
|
if (is_array ($options)) {
|
||||||
|
@ -196,14 +197,14 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
|
||||||
$extra_sql = '';
|
$extra_sql = '';
|
||||||
|
|
||||||
$sql = sprintf ("SELECT %s
|
$sql = sprintf ("SELECT %s
|
||||||
FROM talert_template_modules
|
FROM talert_template_modules
|
||||||
INNER JOIN tagente_modulo t2
|
INNER JOIN tagente_modulo t2
|
||||||
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
ON talert_template_modules.id_agent_module = t2.id_agente_modulo
|
||||||
INNER JOIN tagente t3
|
INNER JOIN tagente t3
|
||||||
ON t2.id_agente = t3.id_agente
|
ON t2.id_agente = t3.id_agente
|
||||||
INNER JOIN talert_templates t4
|
INNER JOIN talert_templates t4
|
||||||
ON talert_template_modules.id_alert_template = t4.id
|
ON talert_template_modules.id_alert_template = t4.id
|
||||||
WHERE (%s id_agent_module in (%s)) %s %s %s",
|
WHERE (%s id_agent_module in (%s)) %s %s %s",
|
||||||
$selectText, $extra_sql, $subQuery, $where, $filter, $orderbyText);
|
$selectText, $extra_sql, $subQuery, $where, $filter, $orderbyText);
|
||||||
|
|
||||||
$alerts = db_get_all_rows_sql ($sql);
|
$alerts = db_get_all_rows_sql ($sql);
|
||||||
|
@ -254,7 +255,8 @@ function agents_get_alerts_compound ($id_agent = false, $filter = '', $options =
|
||||||
|
|
||||||
if (($id_agent !== false) && ($idGroup !== false)) {
|
if (($id_agent !== false) && ($idGroup !== false)) {
|
||||||
if ($idGroup != 0) { //All group
|
if ($idGroup != 0) { //All group
|
||||||
$subQuery = 'SELECT id_agente FROM tagente WHERE id_grupo = ' . $idGroup;
|
$subQuery = 'SELECT id_agente
|
||||||
|
FROM tagente WHERE id_grupo = ' . $idGroup;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$subQuery = 'SELECT id_agente FROM tagente';
|
$subQuery = 'SELECT id_agente FROM tagente';
|
||||||
|
@ -275,7 +277,8 @@ function agents_get_alerts_compound ($id_agent = false, $filter = '', $options =
|
||||||
$selectText = 'COUNT(id) AS count';
|
$selectText = 'COUNT(id) AS count';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf ("SELECT %s FROM talert_compound
|
$sql = sprintf ("SELECT %s
|
||||||
|
FROM talert_compound
|
||||||
WHERE id_agent IN (%s) %s %s",
|
WHERE id_agent IN (%s) %s %s",
|
||||||
$selectText, $subQuery, $where, $filter);
|
$selectText, $subQuery, $where, $filter);
|
||||||
|
|
||||||
|
@ -307,62 +310,67 @@ function agents_get_alerts_compound ($id_agent = false, $filter = '', $options =
|
||||||
* @return mixed An array with all alerts defined for an agent or false in case no allowed groups are specified.
|
* @return mixed An array with all alerts defined for an agent or false in case no allowed groups are specified.
|
||||||
*/
|
*/
|
||||||
function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $order = array('field' => 'nombre', 'order' => 'ASC'), $return = false) {
|
function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $order = array('field' => 'nombre', 'order' => 'ASC'), $return = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (! is_array ($filter)) {
|
if (! is_array ($filter)) {
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($filter['search'])) {
|
if (isset($filter['search'])) {
|
||||||
$search = $filter['search'];
|
$search = $filter['search'];
|
||||||
unset($filter['search']);
|
unset($filter['search']);
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$search = '';
|
$search = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($filter['offset'])) {
|
if (isset($filter['offset'])) {
|
||||||
$offset = $filter['offset'];
|
$offset = $filter['offset'];
|
||||||
unset($filter['offset']);
|
unset($filter['offset']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($filter['limit'])) {
|
if (isset($filter['limit'])) {
|
||||||
$limit = $filter['limit'];
|
$limit = $filter['limit'];
|
||||||
unset($filter['limit']);
|
unset($filter['limit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_sql = ' 1 = 1';
|
$status_sql = ' 1 = 1';
|
||||||
if(isset($filter['status'])) {
|
if (isset($filter['status'])) {
|
||||||
$normal_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
$normal_modules = 'SELECT tagente.id_agente
|
||||||
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0 AND estado = 0
|
AND tagente_modulo.disabled = 0 AND estado = 0
|
||||||
AND (utimestamp != 0)' /*OR tagente_modulo.id_tipo_modulo IN (21,22,23))
|
AND (utimestamp != 0)' /*OR tagente_modulo.id_tipo_modulo IN (21,22,23))
|
||||||
AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'*/;
|
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'*/;
|
||||||
|
|
||||||
$warning_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
$warning_modules = 'SELECT tagente.id_agente
|
||||||
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0 AND estado = 2 AND tagente_estado.utimestamp != 0';
|
AND tagente_modulo.disabled = 0 AND estado = 2 AND tagente_estado.utimestamp != 0';
|
||||||
/* AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
/* AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';*/
|
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))';*/
|
||||||
|
|
||||||
$critical_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
$critical_modules = 'SELECT tagente.id_agente
|
||||||
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0 AND tagente_estado.id_agente = tagente.id_agente
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0 AND estado = 1 AND tagente_estado.utimestamp != 0';
|
AND tagente_modulo.disabled = 0 AND estado = 1 AND tagente_estado.utimestamp != 0';
|
||||||
/* AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
/* AND (utimestamp >= ( UNIX_TIMESTAMP() - (current_interval * 2))
|
||||||
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'; */
|
OR tagente_modulo.id_tipo_modulo IN (21,22,23,100))'; */
|
||||||
|
|
||||||
$unknown_modules = 'SELECT tagente.id_agente FROM tagente_estado, tagente, tagente_modulo
|
$unknown_modules = 'SELECT tagente.id_agente
|
||||||
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0 AND estado = 3 AND utimestamp != 0' /*AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)
|
AND tagente_modulo.disabled = 0 AND estado = 3 AND utimestamp != 0' /*AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)
|
||||||
AND utimestamp < ( UNIX_TIMESTAMP() - (current_interval * 2)) AND utimestamp != 0'*/;
|
AND utimestamp < ( UNIX_TIMESTAMP() - (current_interval * 2)) AND utimestamp != 0'*/;
|
||||||
|
|
||||||
$notinit_modules = 'SELECT tagente_estado.id_agente FROM tagente_estado, tagente, tagente_modulo
|
$notinit_modules = 'SELECT tagente_estado.id_agente
|
||||||
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
FROM tagente_estado, tagente, tagente_modulo
|
||||||
|
WHERE tagente.disabled = 0 AND tagente.id_agente = tagente_estado.id_agente
|
||||||
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND tagente_modulo.disabled = 0
|
AND tagente_modulo.disabled = 0
|
||||||
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23)
|
AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23)
|
||||||
|
@ -399,7 +407,6 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
||||||
$status_sql = "id_agente NOT IN ($warning_modules) &&
|
$status_sql = "id_agente NOT IN ($warning_modules) &&
|
||||||
id_agente NOT IN ($critical_modules) && id_agente NOT IN ($unknown_modules) && id_agente NOT IN ($normal_modules)";
|
id_agente NOT IN ($critical_modules) && id_agente NOT IN ($unknown_modules) && id_agente NOT IN ($normal_modules)";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
unset($filter['status']);
|
unset($filter['status']);
|
||||||
}
|
}
|
||||||
|
@ -472,21 +479,24 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
||||||
|
|
||||||
// TODO: CLEAN extra_sql
|
// TODO: CLEAN extra_sql
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
if ($all_groups){
|
if ($all_groups) {
|
||||||
$where_nogroup = '1 = 1';
|
$where_nogroup = '1 = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($extra) {
|
if($extra) {
|
||||||
$where = sprintf('(%s OR (%s)) AND (%s) AND (%s) %s', $sql_extra, $where, $where_nogroup, $status_sql, $search);
|
$where = sprintf('(%s OR (%s)) AND (%s) AND (%s) %s', $sql_extra, $where, $where_nogroup, $status_sql, $search);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$where = sprintf('%s AND %s AND (%s) %s', $where, $where_nogroup, $status_sql, $search);
|
$where = sprintf('%s AND %s AND (%s) %s', $where, $where_nogroup, $status_sql, $search);
|
||||||
}
|
}
|
||||||
$sql = sprintf('SELECT %s FROM tagente WHERE %s %s', implode(',',$fields), $where, $order);
|
$sql = sprintf('SELECT %s
|
||||||
|
FROM tagente
|
||||||
|
WHERE %s %s', implode(',',$fields), $where, $order);
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$limit_sql = '';
|
$limit_sql = '';
|
||||||
if(isset($offset) && isset($limit)) {
|
if (isset($offset) && isset($limit)) {
|
||||||
$limit_sql = " LIMIT $offset, $limit ";
|
$limit_sql = " LIMIT $offset, $limit ";
|
||||||
}
|
}
|
||||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||||
|
@ -498,7 +508,7 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$limit_sql = '';
|
$limit_sql = '';
|
||||||
if(isset($offset) && isset($limit)) {
|
if (isset($offset) && isset($limit)) {
|
||||||
$limit_sql = " OFFSET $offset LIMIT $limit ";
|
$limit_sql = " OFFSET $offset LIMIT $limit ";
|
||||||
}
|
}
|
||||||
$sql = sprintf("%s %s", $sql, $limit_sql);
|
$sql = sprintf("%s %s", $sql, $limit_sql);
|
||||||
|
@ -510,7 +520,7 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$set = array();
|
$set = array();
|
||||||
if(isset($offset) && isset($limit)) {
|
if (isset($offset) && isset($limit)) {
|
||||||
$set['limit'] = $limit;
|
$set['limit'] = $limit;
|
||||||
$set['offset'] = $offset;
|
$set['offset'] = $offset;
|
||||||
}
|
}
|
||||||
|
@ -588,7 +598,7 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
|
||||||
|
|
||||||
if (empty ($target_modules)) {
|
if (empty ($target_modules)) {
|
||||||
if (! $copy_alerts) {
|
if (! $copy_alerts) {
|
||||||
echo '<h3 class="error">'.__('No modules have been selected').'</h3>';
|
ui_print_error_message(__('No modules have been selected'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$target_modules = array ();
|
$target_modules = array ();
|
||||||
|
@ -619,7 +629,6 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
|
||||||
$repeated_modules = array();
|
$repeated_modules = array();
|
||||||
foreach ($destiny_id_agents as $id_destiny_agent) {
|
foreach ($destiny_id_agents as $id_destiny_agent) {
|
||||||
foreach ($target_modules as $id_agent_module) {
|
foreach ($target_modules as $id_agent_module) {
|
||||||
|
|
||||||
// Check the module name exists in target
|
// Check the module name exists in target
|
||||||
$module = modules_get_agentmodule ($id_agent_module);
|
$module = modules_get_agentmodule ($id_agent_module);
|
||||||
if ($module === false)
|
if ($module === false)
|
||||||
|
@ -635,7 +644,6 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
|
||||||
$repeated_modules[] = $modules_repeated;
|
$repeated_modules[] = $modules_repeated;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$result = modules_copy_agent_module_to_agent ($id_agent_module,
|
$result = modules_copy_agent_module_to_agent ($id_agent_module,
|
||||||
$id_destiny_agent);
|
$id_destiny_agent);
|
||||||
|
|
||||||
|
@ -694,7 +702,8 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error) {
|
if ($error) {
|
||||||
echo '<h3 class="error">'.__('There was an error copying the agent configuration, the copy has been cancelled').'</h3>';
|
ui_print_error_message(
|
||||||
|
__('There was an error copying the agent configuration, the copy has been cancelled'));
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
|
@ -704,8 +713,9 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
|
||||||
db_process_sql_rollback();
|
db_process_sql_rollback();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
echo '<h3 class="suc">'.__('Successfully copied').'</h3>';
|
else {
|
||||||
|
ui_print_success_message(__('Successfully copied'));
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
|
@ -725,8 +735,9 @@ function agents_process_manage_config ($source_id_agent, $destiny_id_agents, $co
|
||||||
}
|
}
|
||||||
|
|
||||||
function agents_get_next_contact($idAgent, $maxModules = false) {
|
function agents_get_next_contact($idAgent, $maxModules = false) {
|
||||||
|
$agent = db_get_row_sql("SELECT *
|
||||||
$agent = db_get_row_sql("SELECT * FROM tagente WHERE id_agente = " . $idAgent);
|
FROM tagente
|
||||||
|
WHERE id_agente = " . $idAgent);
|
||||||
|
|
||||||
|
|
||||||
$difference = get_system_time () - strtotime ($agent["ultimo_contacto"]);
|
$difference = get_system_time () - strtotime ($agent["ultimo_contacto"]);
|
||||||
|
@ -734,7 +745,9 @@ function agents_get_next_contact($idAgent, $maxModules = false) {
|
||||||
|
|
||||||
$max = $agent["intervalo"];
|
$max = $agent["intervalo"];
|
||||||
if ($maxModules) {
|
if ($maxModules) {
|
||||||
$sql = sprintf ("SELECT MAX(module_interval) FROM tagente_modulo WHERE id_agente = %d", $id_agente);
|
$sql = sprintf ("SELECT MAX(module_interval)
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente = %d", $id_agente);
|
||||||
$maxModules = (int) db_get_sql ($sql);
|
$maxModules = (int) db_get_sql ($sql);
|
||||||
if ($maxModules > 0)
|
if ($maxModules > 0)
|
||||||
$max = $maxModules;
|
$max = $maxModules;
|
||||||
|
@ -855,11 +868,11 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge
|
||||||
$where = '';
|
$where = '';
|
||||||
if (! empty ($id_agent)) {
|
if (! empty ($id_agent)) {
|
||||||
$where = sprintf (' WHERE delete_pending = 0 AND id_agente IN (%s)
|
$where = sprintf (' WHERE delete_pending = 0 AND id_agente IN (%s)
|
||||||
AND (
|
AND (
|
||||||
SELECT count(nombre)
|
SELECT count(nombre)
|
||||||
FROM tagente_modulo t2
|
FROM tagente_modulo t2
|
||||||
WHERE delete_pending = 0 AND t1.nombre = t2.nombre
|
WHERE delete_pending = 0 AND t1.nombre = t2.nombre
|
||||||
AND id_agente IN (%s)) = (%s)', implode (",", (array) $id_agent), implode (",", (array) $id_agent), count($id_agent));
|
AND id_agente IN (%s)) = (%s)', implode (",", (array) $id_agent), implode (",", (array) $id_agent), count($id_agent));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty ($filter)) {
|
if (! empty ($filter)) {
|
||||||
|
@ -1337,6 +1350,7 @@ function agents_get_name ($id_agent, $case = "none") {
|
||||||
case "none":
|
case "none":
|
||||||
default:
|
default:
|
||||||
return ($agent);
|
return ($agent);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1491,7 +1505,8 @@ function agents_add_address ($id_agent, $ip_address) {
|
||||||
function agents_delete_address ($id_agent, $ip_address) {
|
function agents_delete_address ($id_agent, $ip_address) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$sql = sprintf ("SELECT id_ag FROM taddress_agent, taddress
|
$sql = sprintf ("SELECT id_ag
|
||||||
|
FROM taddress_agent, taddress
|
||||||
WHERE taddress_agent.id_a = taddress.id_a AND ip = '%s'
|
WHERE taddress_agent.id_a = taddress.id_a AND ip = '%s'
|
||||||
AND id_agent = %d", $ip_address, $id_agent);
|
AND id_agent = %d", $ip_address, $id_agent);
|
||||||
$id_ag = db_get_sql ($sql);
|
$id_ag = db_get_sql ($sql);
|
||||||
|
@ -1593,7 +1608,7 @@ function agents_get_addresses ($id_agent) {
|
||||||
function agents_get_status($id_agent = 0, $noACLs = false) {
|
function agents_get_status($id_agent = 0, $noACLs = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (!$noACLs){
|
if (!$noACLs) {
|
||||||
$modules = agents_get_modules ($id_agent, 'id_agente_modulo', array('disabled' => 0), true, false);
|
$modules = agents_get_modules ($id_agent, 'id_agente_modulo', array('disabled' => 0), true, false);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -1624,7 +1639,7 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all the modules are asynchronous or keep alive, the group cannot be unknown
|
// If all the modules are asynchronous or keep alive, the group cannot be unknown
|
||||||
if($modules_async < count($modules)) {
|
if ($modules_async < count($modules)) {
|
||||||
$time = get_system_time ();
|
$time = get_system_time ();
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
|
@ -1654,19 +1669,19 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
||||||
|
|
||||||
// Status is 0 for normal, 1 for critical, 2 for warning and 3 for unknown. 4 for alert fired
|
// Status is 0 for normal, 1 for critical, 2 for warning and 3 for unknown. 4 for alert fired
|
||||||
// Checking if any module has alert fired (4)
|
// Checking if any module has alert fired (4)
|
||||||
if(is_int(array_search(4,$modules_status))){
|
if (is_int(array_search(4,$modules_status))) {
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
// Checking if any module has critical status (1)
|
// Checking if any module has critical status (1)
|
||||||
elseif(is_int(array_search(1,$modules_status))){
|
elseif (is_int(array_search(1,$modules_status))) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Checking if any module has warning status (2)
|
// Checking if any module has warning status (2)
|
||||||
elseif(is_int(array_search(2,$modules_status))){
|
elseif (is_int(array_search(2,$modules_status))) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
// Checking if any module has unknown status (3)
|
// Checking if any module has unknown status (3)
|
||||||
elseif(is_int(array_search(3,$modules_status))){
|
elseif (is_int(array_search(3,$modules_status))) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1920,7 +1935,8 @@ function agents_tree_view_alert_img ($alert_fired) {
|
||||||
|
|
||||||
if ($alert_fired) {
|
if ($alert_fired) {
|
||||||
return ui_print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
|
return ui_print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return ui_print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
|
return ui_print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1942,6 +1958,4 @@ function agetns_tree_view_status_img ($critical, $warning, $unknown) {
|
||||||
return ui_print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true);
|
return ui_print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -4643,7 +4643,8 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
|
||||||
$sql_post .= " AND utimestamp <= " . $utimestamp_bottom;
|
$sql_post .= " AND utimestamp <= " . $utimestamp_bottom;
|
||||||
|
|
||||||
if ($event_view_hr > 0) {
|
if ($event_view_hr > 0) {
|
||||||
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
|
//Put hours in seconds
|
||||||
|
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR);
|
||||||
$sql_post .= " AND (utimestamp > " . $unixtime . " OR estado = 2)";
|
$sql_post .= " AND (utimestamp > " . $unixtime . " OR estado = 2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ function config_process_config () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config["stats_interval"])) {
|
if (!isset ($config["stats_interval"])) {
|
||||||
config_update_value ('stats_interval', 300);
|
config_update_value ('stats_interval', SECONDS_5MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config["realtimestats"])) {
|
if (!isset ($config["realtimestats"])) {
|
||||||
|
@ -424,7 +424,7 @@ function config_process_config () {
|
||||||
config_update_value ( 'flash_charts', true);
|
config_update_value ( 'flash_charts', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config["custom_logo"])){
|
if (!isset ($config["custom_logo"])) {
|
||||||
config_update_value ('custom_logo', 'none.png');
|
config_update_value ('custom_logo', 'none.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ function config_process_config () {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config['netflow_interval'])) {
|
if (!isset ($config['netflow_interval'])) {
|
||||||
config_update_value ( 'netflow_interval', 300);
|
config_update_value ( 'netflow_interval', SECONDS_5MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($config['netflow_daemon'])) {
|
if (!isset ($config['netflow_daemon'])) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
$sum_yi2 = 0;
|
$sum_yi2 = 0;
|
||||||
$sum_diff_dates = 0;
|
$sum_diff_dates = 0;
|
||||||
$last_timestamp = get_system_time();
|
$last_timestamp = get_system_time();
|
||||||
$agent_interval = 300;
|
$agent_interval = SECONDS_5MINUTES;
|
||||||
$cont = 1;
|
$cont = 1;
|
||||||
$data = array();
|
$data = array();
|
||||||
//$table->data = array();
|
//$table->data = array();
|
||||||
|
@ -76,7 +76,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
$data[5] = $utimestamp * $row['sum'];
|
$data[5] = $utimestamp * $row['sum'];
|
||||||
$data[6] = $utimestamp * $utimestamp;
|
$data[6] = $utimestamp * $utimestamp;
|
||||||
$data[7] = $row['sum'] * $row['sum'];
|
$data[7] = $row['sum'] * $row['sum'];
|
||||||
if ($cont == 1){
|
if ($cont == 1) {
|
||||||
$data[8] = 0;
|
$data[8] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -92,8 +92,6 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
$sum_diff_dates = $sum_diff_dates + $data[8];
|
$sum_diff_dates = $sum_diff_dates + $data[8];
|
||||||
$last_timestamp = $utimestamp;
|
$last_timestamp = $utimestamp;
|
||||||
$cont++;
|
$cont++;
|
||||||
|
|
||||||
//array_push($table->data, $data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$cont--;
|
$cont--;
|
||||||
|
@ -117,11 +115,16 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
$dev_x = sqrt(($sum_xi2/$cont) - ($avg_x*$avg_x));
|
$dev_x = sqrt(($sum_xi2/$cont) - ($avg_x*$avg_x));
|
||||||
$dev_y = sqrt(($sum_yi2/$cont) - ($avg_y*$avg_y));
|
$dev_y = sqrt(($sum_yi2/$cont) - ($avg_y*$avg_y));
|
||||||
// Prevents division by zero
|
// Prevents division by zero
|
||||||
if ($dev_x != 0 and $dev_y != 0){
|
if ($dev_x != 0 and $dev_y != 0) {
|
||||||
$linear_coef = $covariance / ($dev_x * $dev_y);
|
$linear_coef = $covariance / ($dev_x * $dev_y);
|
||||||
}
|
}
|
||||||
// Agent interval could be zero, 300 is the predefined
|
// Agent interval could be zero, 300 is the predefined
|
||||||
($sum_obs == 0)? $agent_interval = 300 : $agent_interval = $sum_diff_dates / $sum_obs;
|
if ($sum_obs == 0) {
|
||||||
|
$agent_interval = SECONDS_5MINUTES;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$agent_interval = $sum_diff_dates / $sum_obs;
|
||||||
|
}
|
||||||
|
|
||||||
// Could be a inverse correlation coefficient
|
// Could be a inverse correlation coefficient
|
||||||
// if $linear_coef < 0.0
|
// if $linear_coef < 0.0
|
||||||
|
@ -141,7 +144,8 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
|
|
||||||
$b_num = (($cont * $sum_xi_yi) - ($sum_xi * $sum_yi));
|
$b_num = (($cont * $sum_xi_yi) - ($sum_xi * $sum_yi));
|
||||||
$b_den = (($cont * $sum_xi2) - ($sum_xi * $sum_xi));
|
$b_den = (($cont * $sum_xi2) - ($sum_xi * $sum_xi));
|
||||||
if ($b_den == 0) return;
|
if ($b_den == 0)
|
||||||
|
return;
|
||||||
$b = $b_num / $b_den;
|
$b = $b_num / $b_den;
|
||||||
|
|
||||||
$a_num = ($sum_yi) - ($b * $sum_xi);
|
$a_num = ($sum_yi) - ($b * $sum_xi);
|
||||||
|
@ -149,7 +153,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
|
|
||||||
// Data inicialization
|
// Data inicialization
|
||||||
$output_data = array();
|
$output_data = array();
|
||||||
if ($prediction_period != false){
|
if ($prediction_period != false) {
|
||||||
$limit_timestamp = $last_timestamp + $prediction_period;
|
$limit_timestamp = $last_timestamp + $prediction_period;
|
||||||
}
|
}
|
||||||
$current_ts = $last_timestamp;
|
$current_ts = $last_timestamp;
|
||||||
|
@ -160,17 +164,17 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
if ($period < $prediction_period)
|
if ($period < $prediction_period)
|
||||||
$temp_range = $prediction_period;
|
$temp_range = $prediction_period;
|
||||||
|
|
||||||
if ($temp_range <= 21600) {
|
if ($temp_range <= SECONDS_6HOURS) {
|
||||||
$time_format = 'H:i:s';
|
$time_format = 'H:i:s';
|
||||||
}
|
}
|
||||||
elseif ($temp_range < 86400) {
|
elseif ($temp_range < SECONDS_1DAY) {
|
||||||
$time_format = 'H:i';
|
$time_format = 'H:i';
|
||||||
}
|
}
|
||||||
elseif ($temp_range < 1296000) {
|
elseif ($temp_range < SECONDS_15DAYS) {
|
||||||
$time_format = 'M d';
|
$time_format = 'M d';
|
||||||
$time_format_2 = 'H\h';
|
$time_format_2 = 'H\h';
|
||||||
}
|
}
|
||||||
elseif ($temp_range <= 2592000) {
|
elseif ($temp_range <= SECONDS_1MONTH) {
|
||||||
$time_format = 'M d';
|
$time_format = 'M d';
|
||||||
$time_format_2 = 'H\h';
|
$time_format_2 = 'H\h';
|
||||||
}
|
}
|
||||||
|
@ -182,23 +186,23 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
$output_data = array();
|
$output_data = array();
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
// Create data in graph format like
|
// Create data in graph format like
|
||||||
while ($in_range){
|
while ($in_range) {
|
||||||
$timestamp_f = date($time_format, $current_ts);
|
$timestamp_f = date($time_format, $current_ts);
|
||||||
|
|
||||||
//$timestamp_f = date($time_format, $current_ts);
|
//$timestamp_f = date($time_format, $current_ts);
|
||||||
$timestamp_f = graph_get_formatted_date($current_ts, $time_format, $time_format_2);
|
$timestamp_f = graph_get_formatted_date($current_ts, $time_format, $time_format_2);
|
||||||
|
|
||||||
if ($csv){
|
if ($csv) {
|
||||||
$output_data[$idx]['date'] = $current_ts;
|
$output_data[$idx]['date'] = $current_ts;
|
||||||
$output_data[$idx]['data'] = ($a + ($b * $current_ts));
|
$output_data[$idx]['data'] = ($a + ($b * $current_ts));
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$output_data[$timestamp_f] = ($a + ($b * $current_ts));
|
$output_data[$timestamp_f] = ($a + ($b * $current_ts));
|
||||||
}
|
}
|
||||||
// Using this function for prediction_date
|
// Using this function for prediction_date
|
||||||
if ($prediction_period == false){
|
if ($prediction_period == false) {
|
||||||
// These statements stop the prediction when interval is greater than 2 years
|
// These statements stop the prediction when interval is greater than 2 years
|
||||||
if ($current_ts - $last_timestamp >= 94608000){
|
if ($current_ts - $last_timestamp >= 94608000) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
|
//html_debug_print(" Date " . $timestamp_f . " data: " . $output_data[$timestamp_f]);
|
||||||
|
@ -207,7 +211,8 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){
|
if ($max_value >= $output_data[$timestamp_f] and $min_value <= $output_data[$timestamp_f]){
|
||||||
return $current_ts;
|
return $current_ts;
|
||||||
}
|
}
|
||||||
}else if ($current_ts > $limit_timestamp){
|
}
|
||||||
|
else if ($current_ts > $limit_timestamp) {
|
||||||
$in_range = false;
|
$in_range = false;
|
||||||
}
|
}
|
||||||
$current_ts = $current_ts + $agent_interval;
|
$current_ts = $current_ts + $agent_interval;
|
||||||
|
@ -229,7 +234,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
||||||
*/
|
*/
|
||||||
function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0, $min_value = 0){
|
function forecast_prediction_date ($module_id, $period = 5184000, $max_value = 0, $min_value = 0){
|
||||||
// Checks interval
|
// Checks interval
|
||||||
if ($min_value > $max_value){
|
if ($min_value > $max_value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,12 +180,12 @@ $extra_sql = '';
|
||||||
|
|
||||||
|
|
||||||
// Build the order sql
|
// Build the order sql
|
||||||
if(!empty($order)) {
|
if (!empty($order)) {
|
||||||
$order_sql = ' ORDER BY ';
|
$order_sql = ' ORDER BY ';
|
||||||
}
|
}
|
||||||
$first = true;
|
$first = true;
|
||||||
foreach($order as $ord) {
|
foreach ($order as $ord) {
|
||||||
if($first) {
|
if ($first) {
|
||||||
$first = false;
|
$first = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -232,14 +232,14 @@ switch ($config["dbtype"]) {
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$limit_sql = " LIMIT $limit OFFSET $offset ";
|
$limit_sql = " LIMIT $limit OFFSET $offset ";
|
||||||
case "mysql":
|
case "mysql":
|
||||||
if(!isset($limit_sql)) {
|
if (!isset($limit_sql)) {
|
||||||
$limit_sql = " LIMIT $offset, $limit ";
|
$limit_sql = " LIMIT $offset, $limit ";
|
||||||
}
|
}
|
||||||
|
|
||||||
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
$order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC');
|
||||||
|
|
||||||
$sql = sprintf("SELECT %s FROM tagente_modulo, tagente_estado WHERE %s (%s %s) %s %s",
|
$sql = sprintf("SELECT %s FROM tagente_modulo, tagente_estado WHERE %s (%s %s) %s %s",
|
||||||
$params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql);
|
$params, $basic_where, $extra_sql, $where, $order_sql, $limit_sql);
|
||||||
|
|
||||||
$modules = db_get_all_rows_sql($sql);
|
$modules = db_get_all_rows_sql($sql);
|
||||||
break;
|
break;
|
||||||
|
@ -276,16 +276,16 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||||
echo "<th><span title='" . __('Policy') . "'>".__('P.')."</span></th>";
|
echo "<th><span title='" . __('Policy') . "'>".__('P.')."</span></th>";
|
||||||
}
|
}
|
||||||
echo "<th>".__('Module name') . ' ' .
|
echo "<th>".__('Module name') . ' ' .
|
||||||
'<a href="' . $url . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
'<a href="' . $url . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp, "alt" => "up")) . '</a>' .
|
||||||
'<a href="' . $url . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
'<a href="' . $url . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown, "alt" => "down")) . '</a>';
|
||||||
echo "</th>";
|
echo "</th>";
|
||||||
echo "<th>".__('Type') . ' ' .
|
echo "<th>".__('Type') . ' ' .
|
||||||
'<a href="' . $url . '&sort_field=type&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
|
'<a href="' . $url . '&sort_field=type&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectTypeUp, "alt" => "up")) . '</a>' .
|
||||||
'<a href="' . $url . '&sort_field=type&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
|
'<a href="' . $url . '&sort_field=type&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectTypeDown, "alt" => "down")) . '</a>';
|
||||||
echo "</th>";
|
echo "</th>";
|
||||||
echo "<th>".__('int') . ' ' .
|
echo "<th>".__('int') . ' ' .
|
||||||
'<a href="' . $url . '&sort_field=interval&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '</a>' .
|
'<a href="' . $url . '&sort_field=interval&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp, "alt" => "up")) . '</a>' .
|
||||||
'<a href="' . $url . '&sort_field=interval&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . '</a>';
|
'<a href="' . $url . '&sort_field=interval&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown, "alt" => "down")) . '</a>';
|
||||||
echo "</th>";
|
echo "</th>";
|
||||||
echo "<th>".__('Description') . "</th>";
|
echo "<th>".__('Description') . "</th>";
|
||||||
echo "<th>".__('Data') . ' ' .
|
echo "<th>".__('Data') . ' ' .
|
||||||
|
@ -303,7 +303,7 @@ $color = 1;
|
||||||
$write = check_acl ($config['id_user'], $agent['id_grupo'], "AW");
|
$write = check_acl ($config['id_user'], $agent['id_grupo'], "AW");
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
// Calculate table line color
|
// Calculate table line color
|
||||||
if ($color == 1){
|
if ($color == 1) {
|
||||||
$tdcolor = "datos";
|
$tdcolor = "datos";
|
||||||
$color = 0;
|
$color = 0;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ foreach ($modules as $module) {
|
||||||
$color = 1;
|
$color = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($module["id_module_group"] != $last_modulegroup ){
|
if ($module["id_module_group"] != $last_modulegroup ) {
|
||||||
// Render module group names (fixed code)
|
// Render module group names (fixed code)
|
||||||
$nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]);
|
$nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]);
|
||||||
$last_modulegroup = $module["id_module_group"];
|
$last_modulegroup = $module["id_module_group"];
|
||||||
|
@ -338,7 +338,7 @@ foreach ($modules as $module) {
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
|
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||||
if($module["id_policy_module"] != 0) {
|
if ($module["id_policy_module"] != 0) {
|
||||||
$linked = policies_is_module_linked($module['id_agente_modulo']);
|
$linked = policies_is_module_linked($module['id_agente_modulo']);
|
||||||
$id_policy = db_get_value_sql('SELECT id_policy FROM tpolicy_modules WHERE id = '.$module["id_policy_module"]);
|
$id_policy = db_get_value_sql('SELECT id_policy FROM tpolicy_modules WHERE id = '.$module["id_policy_module"]);
|
||||||
$name_policy = db_get_value_sql('SELECT name FROM tpolicies WHERE id = '.$id_policy);
|
$name_policy = db_get_value_sql('SELECT name FROM tpolicies WHERE id = '.$id_policy);
|
||||||
|
@ -382,7 +382,7 @@ foreach ($modules as $module) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]);
|
$nombre_grupomodulo = modules_get_modulegroup_name ($module["id_module_group"]);
|
||||||
if ($nombre_grupomodulo != ""){
|
if ($nombre_grupomodulo != "") {
|
||||||
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
|
if (($label_group == 0) || ($last_label != $nombre_grupomodulo)){ // Show label module group
|
||||||
$label_group = -1;
|
$label_group = -1;
|
||||||
$last_label = $nombre_grupomodulo;
|
$last_label = $nombre_grupomodulo;
|
||||||
|
@ -416,7 +416,7 @@ foreach ($modules as $module) {
|
||||||
echo ui_print_truncate_text(io_safe_output($module["descripcion"]), 'description', false);
|
echo ui_print_truncate_text(io_safe_output($module["descripcion"]), 'description', false);
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
echo "<td></td>";
|
echo "<td></td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,8 @@ $filename_map .= "_".$id_networkmap.".map";
|
||||||
$filename_img .= "_".$id_networkmap.".png";
|
$filename_img .= "_".$id_networkmap.".png";
|
||||||
$filename_dot .= "_".$id_networkmap.".dot";
|
$filename_dot .= "_".$id_networkmap.".dot";
|
||||||
|
|
||||||
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
|
if ($regen != 1 && file_exists ($filename_img) &&
|
||||||
|
filemtime ($filename_img) > get_system_time () - SECONDS_5MINUTES) {
|
||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -37,6 +37,7 @@ $graph = networkmap_generate_dot (__('Pandora FMS'), $group, $simple, $font_size
|
||||||
if ($graph === false) {
|
if ($graph === false) {
|
||||||
ui_print_error_message (__('Map could not be generated'));
|
ui_print_error_message (__('Map could not be generated'));
|
||||||
echo '<div class="nf">' . __('No agents found') . '</div>';
|
echo '<div class="nf">' . __('No agents found') . '</div>';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,8 @@ $filename_map .= "_".$id_networkmap.".map";
|
||||||
$filename_img .= "_".$id_networkmap.".png";
|
$filename_img .= "_".$id_networkmap.".png";
|
||||||
$filename_dot .= "_".$id_networkmap.".dot";
|
$filename_dot .= "_".$id_networkmap.".dot";
|
||||||
|
|
||||||
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
|
if ($regen != 1 && file_exists ($filename_img) &&
|
||||||
|
filemtime ($filename_img) > get_system_time () - SECONDS_5MINUTES) {
|
||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -83,6 +85,7 @@ if ($result !== false) {
|
||||||
echo "<div class='warn'>Apparently something went wrong reading the output.</div>";
|
echo "<div class='warn'>Apparently something went wrong reading the output.</div>";
|
||||||
echo "<br />Is ".$config["attachment_store"]." readable by the webserver process?";
|
echo "<br />Is ".$config["attachment_store"]." readable by the webserver process?";
|
||||||
echo "<br /><br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
|
echo "<br /><br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
html_print_image ($filename_img, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
|
html_print_image ($filename_img, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
|
||||||
|
@ -95,6 +98,7 @@ else {
|
||||||
echo "<br />Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
|
echo "<br />Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
|
||||||
echo "<br /><br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
|
echo "<br /><br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
|
||||||
echo "<br /><br /> Is ".$config["attachment_store"]." writeable by the webserver process? To change this do the following (POSIX-based systems): chown <apache user> ".$config["attachment_store"];
|
echo "<br /><br /> Is ".$config["attachment_store"]." writeable by the webserver process? To change this do the following (POSIX-based systems): chown <apache user> ".$config["attachment_store"];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,11 +80,11 @@ visual_map_print_visual_map ($id_layout, true, true, null, null, '../../');
|
||||||
$values = array ();
|
$values = array ();
|
||||||
$values[5] = human_time_description_raw (5);
|
$values[5] = human_time_description_raw (5);
|
||||||
$values[30] = human_time_description_raw (30);
|
$values[30] = human_time_description_raw (30);
|
||||||
$values[60] = human_time_description_raw (60);
|
$values[SECONDS_1MINUTE] = human_time_description_raw(SECONDS_1MINUTE);
|
||||||
$values[120] = human_time_description_raw (120);
|
$values[SECONDS_2MINUTES] = human_time_description_raw(SECONDS_2MINUTES);
|
||||||
$values[300] = human_time_description_raw (300);
|
$values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES);
|
||||||
$values[600] = human_time_description_raw (600);
|
$values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES);
|
||||||
$values[1800] = human_time_description_raw (1800);
|
$values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES);
|
||||||
|
|
||||||
$table->width = '90%';
|
$table->width = '90%';
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
@ -92,7 +92,7 @@ $table->style = array ();
|
||||||
$table->style[2] = 'text-align: center';
|
$table->style[2] = 'text-align: center';
|
||||||
$table->data[0][0] = __('Autorefresh time');
|
$table->data[0][0] = __('Autorefresh time');
|
||||||
|
|
||||||
if (empty($config["vc_refr"])){
|
if (empty($config["vc_refr"])) {
|
||||||
$vc_refr = true;
|
$vc_refr = true;
|
||||||
$config["vc_refr"] = $refr;
|
$config["vc_refr"] = $refr;
|
||||||
}
|
}
|
||||||
|
@ -134,12 +134,16 @@ $(document).ready (function () {
|
||||||
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php if ($config["pure"] && $config["refr"] > 0): ?>
|
<?php
|
||||||
t = new Date();
|
if ($config["pure"] && $config["refr"] > 0) {
|
||||||
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>);
|
?>
|
||||||
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'});
|
t = new Date();
|
||||||
|
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>);
|
||||||
|
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'});
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
draw_lines (lines, 'layout_map');
|
draw_lines (lines, 'layout_map');
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
|
|
|
@ -88,11 +88,11 @@ visual_map_print_visual_map ($id_layout);
|
||||||
$values = array ();
|
$values = array ();
|
||||||
$values[5] = human_time_description_raw (5);
|
$values[5] = human_time_description_raw (5);
|
||||||
$values[30] = human_time_description_raw (30);
|
$values[30] = human_time_description_raw (30);
|
||||||
$values[60] = human_time_description_raw (60);
|
$values[SECONDS_1MINUTE] = human_time_description_raw(SECONDS_1MINUTE);
|
||||||
$values[120] = human_time_description_raw (120);
|
$values[SECONDS_2MINUTES] = human_time_description_raw(SECONDS_2MINUTES);
|
||||||
$values[300] = human_time_description_raw (300);
|
$values[SECONDS_5MINUTES] = human_time_description_raw(SECONDS_5MINUTES);
|
||||||
$values[600] = human_time_description_raw (600);
|
$values[SECONDS_10MINUTES] = human_time_description_raw(SECONDS_10MINUTES);
|
||||||
$values[1800] = human_time_description_raw (1800);
|
$values[SECONDS_30MINUTES] = human_time_description_raw(SECONDS_30MINUTES);
|
||||||
|
|
||||||
$table->width = '90%';
|
$table->width = '90%';
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
@ -100,7 +100,7 @@ $table->style = array ();
|
||||||
$table->style[2] = 'text-align: center';
|
$table->style[2] = 'text-align: center';
|
||||||
$table->data[0][0] = __('Autorefresh time');
|
$table->data[0][0] = __('Autorefresh time');
|
||||||
|
|
||||||
if (empty($config["vc_refr"])){
|
if (empty($config["vc_refr"])) {
|
||||||
$vc_refr = true;
|
$vc_refr = true;
|
||||||
$config["vc_refr"] = $refr;
|
$config["vc_refr"] = $refr;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ $table->data[0][1] = html_print_select ($values, 'refr', $config["vc_refr"], '',
|
||||||
$table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
|
$table->data[0][2] = html_print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
|
||||||
$table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true);
|
$table->data[0][2] .= html_print_input_hidden ('vc_refr', $config["vc_refr"], true);
|
||||||
|
|
||||||
if ($vc_refr){
|
if ($vc_refr) {
|
||||||
$config["vc_refr"] = 0;
|
$config["vc_refr"] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,12 +141,16 @@ $(document).ready (function () {
|
||||||
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
||||||
});
|
});
|
||||||
|
|
||||||
<?php if ($config["pure"] && $config["refr"] > 0): ?>
|
<?php
|
||||||
t = new Date();
|
if ($config["pure"] && $config["refr"] > 0) {
|
||||||
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>);
|
?>
|
||||||
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'});
|
t = new Date();
|
||||||
|
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>);
|
||||||
|
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'});
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
draw_lines (lines, 'layout_map');
|
draw_lines (lines, 'layout_map');
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
|
|
Loading…
Reference in New Issue