mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2012-07-23 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor_prediction.php, include/functions_modules.php, include/functions_agents.php, operation/tree.php, operation/agentes/estado_agente.php: fixed typo bug in the name of "agetns_tree_view_status_img" for "agents_tree_view_status_img". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6797 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
64ef168466
commit
7e8201c2ac
@ -1,3 +1,11 @@
|
|||||||
|
2012-07-23 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/module_manager_editor_prediction.php,
|
||||||
|
include/functions_modules.php,
|
||||||
|
include/functions_agents.php, operation/tree.php,
|
||||||
|
operation/agentes/estado_agente.php: fixed typo bug in the name of
|
||||||
|
"agetns_tree_view_status_img" for "agents_tree_view_status_img".
|
||||||
|
|
||||||
2012-07-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
2012-07-20 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
* include/db/mysql.php
|
* include/db/mysql.php
|
||||||
|
@ -109,8 +109,9 @@ $data[1] .= html_print_label(__("Module"),'prediction_module',true);
|
|||||||
if($id_agente) {
|
if($id_agente) {
|
||||||
$sql = "SELECT id_agente_modulo, nombre
|
$sql = "SELECT id_agente_modulo, nombre
|
||||||
FROM tagente_modulo
|
FROM tagente_modulo
|
||||||
WHERE delete_pending = 0 AND history_data = 1 AND id_agente = ".$id_agente;
|
WHERE delete_pending = 0
|
||||||
$data[1] .= html_print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true);
|
AND history_data = 1 AND id_agente = ".$id_agente;
|
||||||
|
$data[1] .= html_print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
$data[1] .= '<select id="prediction_module" name="custom_integer_1" disabled="disabled"><option value="0">Select an Agent first</option></select>';
|
||||||
|
@ -1240,7 +1240,7 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
|||||||
$where .= $filter;
|
$where .= $filter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($details)) {
|
if (empty ($details)) {
|
||||||
$details = "nombre";
|
$details = "nombre";
|
||||||
}
|
}
|
||||||
@ -1630,11 +1630,12 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
|||||||
$filter_modules['disabled'] = 0;
|
$filter_modules['disabled'] = 0;
|
||||||
$filter_modules['delete_pending'] = 0;
|
$filter_modules['delete_pending'] = 0;
|
||||||
// Get all non disabled modules of the agent
|
// Get all non disabled modules of the agent
|
||||||
$all_modules = db_get_all_rows_filter('tagente_modulo', $filter_modules, 'id_agente_modulo');
|
$all_modules = db_get_all_rows_filter('tagente_modulo',
|
||||||
|
$filter_modules, 'id_agente_modulo');
|
||||||
|
|
||||||
$result_modules = array();
|
$result_modules = array();
|
||||||
// Skip non init modules
|
// Skip non init modules
|
||||||
foreach ($all_modules as $module){
|
foreach ($all_modules as $module) {
|
||||||
if (modules_get_agentmodule_is_init($module['id_agente_modulo'])){
|
if (modules_get_agentmodule_is_init($module['id_agente_modulo'])){
|
||||||
$modules[] = $module['id_agente_modulo'];
|
$modules[] = $module['id_agente_modulo'];
|
||||||
}
|
}
|
||||||
@ -1647,7 +1648,8 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
|||||||
$modules_status[] = modules_get_agentmodule_status($module);
|
$modules_status[] = modules_get_agentmodule_status($module);
|
||||||
|
|
||||||
$module_type = modules_get_agentmodule_type($module);
|
$module_type = modules_get_agentmodule_type($module);
|
||||||
if(($module_type >= 21 && $module_type <= 23) || $module_type == 100) {
|
if (($module_type >= 21 && $module_type <= 23) ||
|
||||||
|
$module_type == 100) {
|
||||||
$modules_async++;
|
$modules_async++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1700,7 +1702,6 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
|||||||
else {
|
else {
|
||||||
return AGENT_MODULE_STATUS_NORMAL;
|
return AGENT_MODULE_STATUS_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1989,8 +1990,7 @@ function agents_tree_view_alert_img ($alert_fired) {
|
|||||||
|
|
||||||
//Returns the status image to display tree view
|
//Returns the status image to display tree view
|
||||||
|
|
||||||
function agetns_tree_view_status_img ($critical, $warning, $unknown) {
|
function agents_tree_view_status_img ($critical, $warning, $unknown) {
|
||||||
|
|
||||||
if ($critical > 0) {
|
if ($critical > 0) {
|
||||||
return ui_print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
|
return ui_print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
|
||||||
}
|
}
|
||||||
|
@ -37,17 +37,17 @@ include_once($config['homedir'] . '/include/functions_tags.php');
|
|||||||
*/
|
*/
|
||||||
function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $forced_name = false) {
|
function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent, $forced_name = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$module = modules_get_agentmodule ($id_agent_module);
|
$module = modules_get_agentmodule ($id_agent_module);
|
||||||
if ($module === false)
|
if ($module === false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if($forced_name !== false)
|
if ($forced_name !== false)
|
||||||
$module['nombre'] = $forced_name;
|
$module['nombre'] = $forced_name;
|
||||||
|
|
||||||
$modules = agents_get_modules ($id_destiny_agent, false,
|
$modules = agents_get_modules ($id_destiny_agent, false,
|
||||||
array ('nombre' => $module['nombre'], 'disabled' => false));
|
array ('nombre' => $module['nombre'], 'disabled' => false));
|
||||||
|
|
||||||
// These are the modules that exists in the target
|
// These are the modules that exists in the target
|
||||||
if (! empty ($modules))
|
if (! empty ($modules))
|
||||||
return array_pop (array_keys ($modules));
|
return array_pop (array_keys ($modules));
|
||||||
@ -119,7 +119,7 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent
|
|||||||
case "oracle":
|
case "oracle":
|
||||||
$id_new_module = db_process_sql_insert ('tagente_modulo',
|
$id_new_module = db_process_sql_insert ('tagente_modulo',
|
||||||
$new_module, false);
|
$new_module, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($id_new_module === false) {
|
if ($id_new_module === false) {
|
||||||
return false;
|
return false;
|
||||||
@ -130,10 +130,10 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent
|
|||||||
}
|
}
|
||||||
|
|
||||||
$values['id_agente'] = $id_destiny_agent;
|
$values['id_agente'] = $id_destiny_agent;
|
||||||
|
|
||||||
switch ($config['dbtype']) {
|
switch ($config['dbtype']) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$result = db_process_sql_insert ('tagente_estado', $values);
|
$result = db_process_sql_insert ('tagente_estado', $values);
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
@ -195,9 +195,9 @@ function modules_copy_agent_module_to_agent ($id_agent_module, $id_destiny_agent
|
|||||||
* @return True if the module was deleted. False if not.
|
* @return True if the module was deleted. False if not.
|
||||||
*/
|
*/
|
||||||
function modules_delete_agent_module ($id_agent_module) {
|
function modules_delete_agent_module ($id_agent_module) {
|
||||||
if(!$id_agent_module)
|
if (!$id_agent_module)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$where = array ('id_agent_module' => $id_agent_module);
|
$where = array ('id_agent_module' => $id_agent_module);
|
||||||
|
|
||||||
enterprise_hook('config_agents_delete_module_in_conf', array(modules_get_agentmodule_agent($id_agent_module), modules_get_agentmodule_name($id_agent_module)));
|
enterprise_hook('config_agents_delete_module_in_conf', array(modules_get_agentmodule_agent($id_agent_module), modules_get_agentmodule_name($id_agent_module)));
|
||||||
@ -230,7 +230,7 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false
|
|||||||
if (!is_array ($values) || empty ($values)) {
|
if (!is_array ($values) || empty ($values)) {
|
||||||
return ERR_GENERIC;
|
return ERR_GENERIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset ($values['nombre'])) {
|
if (isset ($values['nombre'])) {
|
||||||
if(empty ($values['nombre'])) {
|
if(empty ($values['nombre'])) {
|
||||||
return ERR_INCOMPLETE;
|
return ERR_INCOMPLETE;
|
||||||
@ -239,7 +239,7 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false
|
|||||||
$id_agent = modules_get_agentmodule_agent($id);
|
$id_agent = modules_get_agentmodule_agent($id);
|
||||||
|
|
||||||
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $values['nombre'], 'id_agente' => $id_agent, 'id_agente_modulo' => "<>$id"));
|
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $values['nombre'], 'id_agente' => $id_agent, 'id_agente_modulo' => "<>$id"));
|
||||||
|
|
||||||
if($exists) {
|
if($exists) {
|
||||||
return ERR_EXIST;
|
return ERR_EXIST;
|
||||||
}
|
}
|
||||||
@ -249,19 +249,19 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false
|
|||||||
if ($tags !== false) {
|
if ($tags !== false) {
|
||||||
$return_tag = tags_update_module_tag ($id, $tags);
|
$return_tag = tags_update_module_tag ($id, $tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($return_tag === false){
|
if ($return_tag === false){
|
||||||
return ERR_DB;
|
return ERR_DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = array();
|
$where = array();
|
||||||
$where['id_agente_modulo'] = $id;
|
$where['id_agente_modulo'] = $id;
|
||||||
if ($onlyNoDeletePending) {
|
if ($onlyNoDeletePending) {
|
||||||
$where['delete_pending'] = 0;
|
$where['delete_pending'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = @db_process_sql_update ('tagente_modulo', $values, $where);
|
$result = @db_process_sql_update ('tagente_modulo', $values, $where);
|
||||||
|
|
||||||
if($result === false) {
|
if($result === false) {
|
||||||
return ERR_DB;
|
return ERR_DB;
|
||||||
}
|
}
|
||||||
@ -284,12 +284,12 @@ function modules_update_agent_module ($id, $values, $onlyNoDeletePending = false
|
|||||||
function modules_create_agent_module ($id_agent, $name, $values = false, $disableACL = false,
|
function modules_create_agent_module ($id_agent, $name, $values = false, $disableACL = false,
|
||||||
$tags = false) {
|
$tags = false) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (!$disableACL) {
|
if (!$disableACL) {
|
||||||
if (empty ($id_agent) || ! users_access_to_agent ($id_agent, 'AW'))
|
if (empty ($id_agent) || ! users_access_to_agent ($id_agent, 'AW'))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty ($name)) {
|
if (empty ($name)) {
|
||||||
return ERR_INCOMPLETE;
|
return ERR_INCOMPLETE;
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||||||
$values['id_agente'] = (int) $id_agent;
|
$values['id_agente'] = (int) $id_agent;
|
||||||
|
|
||||||
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $name, 'id_agente' => (int)$id_agent));
|
$exists = (bool)db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('nombre' => $name, 'id_agente' => (int)$id_agent));
|
||||||
|
|
||||||
if($exists) {
|
if($exists) {
|
||||||
return ERR_EXIST;
|
return ERR_EXIST;
|
||||||
}
|
}
|
||||||
@ -309,18 +309,18 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||||||
|
|
||||||
if ($id_agent_module === false)
|
if ($id_agent_module === false)
|
||||||
return ERR_DB;
|
return ERR_DB;
|
||||||
|
|
||||||
$return_tag = true;
|
$return_tag = true;
|
||||||
if (($tags !== false) || (empty($tags)))
|
if (($tags !== false) || (empty($tags)))
|
||||||
$return_tag = tags_insert_module_tag ($id_agent_module, $tags);
|
$return_tag = tags_insert_module_tag ($id_agent_module, $tags);
|
||||||
|
|
||||||
if ($return_tag === false){
|
if ($return_tag === false){
|
||||||
db_process_sql_delete ('tagente_modulo',
|
db_process_sql_delete ('tagente_modulo',
|
||||||
array ('id_agente_modulo' => $id_agent_module));
|
array ('id_agente_modulo' => $id_agent_module));
|
||||||
|
|
||||||
return ERR_DB;
|
return ERR_DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$result = db_process_sql_insert ('tagente_estado',
|
$result = db_process_sql_insert ('tagente_estado',
|
||||||
@ -422,7 +422,8 @@ function modules_format_data($data)
|
|||||||
{
|
{
|
||||||
if (is_numeric ($data)) {
|
if (is_numeric ($data)) {
|
||||||
$data = format_numeric($data, 2);
|
$data = format_numeric($data, 2);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$data = io_safe_input ($data);
|
$data = io_safe_input ($data);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
@ -452,7 +453,7 @@ function modules_format_verbatim($data){
|
|||||||
function modules_format_timestamp($ts)
|
function modules_format_timestamp($ts)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// This returns data with absolute user-defined timestamp format
|
// This returns data with absolute user-defined timestamp format
|
||||||
// and numeric by data managed with 2 decimals, and not using Graph format
|
// and numeric by data managed with 2 decimals, and not using Graph format
|
||||||
// (replacing 1000 by K and 1000000 by G, like version 2.x
|
// (replacing 1000 by K and 1000000 by G, like version 2.x
|
||||||
@ -469,9 +470,9 @@ function modules_format_timestamp($ts)
|
|||||||
function modules_format_delete($id)
|
function modules_format_delete($id)
|
||||||
{
|
{
|
||||||
global $period, $module_id, $config, $group;
|
global $period, $module_id, $config, $group;
|
||||||
|
|
||||||
$txt = "";
|
$txt = "";
|
||||||
|
|
||||||
if (check_acl ($config['id_user'], $group, "AW") ==1) {
|
if (check_acl ($config['id_user'], $group, "AW") ==1) {
|
||||||
$txt = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete='.$id.'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
$txt = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete='.$id.'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||||
}
|
}
|
||||||
@ -488,9 +489,9 @@ function modules_format_delete($id)
|
|||||||
function modules_format_delete_string($id)
|
function modules_format_delete_string($id)
|
||||||
{
|
{
|
||||||
global $period, $module_id, $config, $group;
|
global $period, $module_id, $config, $group;
|
||||||
|
|
||||||
$txt = "";
|
$txt = "";
|
||||||
|
|
||||||
if (check_acl ($config['id_user'], $group, "AW") ==1) {
|
if (check_acl ($config['id_user'], $group, "AW") ==1) {
|
||||||
$txt = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete_string='.$id.'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
$txt = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete_string='.$id.'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||||
}
|
}
|
||||||
@ -507,9 +508,9 @@ function modules_format_delete_string($id)
|
|||||||
function modules_format_delete_log4x($id)
|
function modules_format_delete_log4x($id)
|
||||||
{
|
{
|
||||||
global $period, $module_id, $config, $group;
|
global $period, $module_id, $config, $group;
|
||||||
|
|
||||||
$txt = "";
|
$txt = "";
|
||||||
|
|
||||||
if (check_acl ($config['id_user'], $group, "AW") ==1) {
|
if (check_acl ($config['id_user'], $group, "AW") ==1) {
|
||||||
$txt = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete_log4x='.$id.'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
$txt = '<a href="index.php?sec=estado&sec2=operation/agentes/datos_agente&period='.$period.'&id='.$module_id.'&delete_log4x='.$id.'">' . html_print_image("images/cross.png", true, array("border" => '0')) . '</a>';
|
||||||
}
|
}
|
||||||
@ -525,8 +526,8 @@ function modules_format_delete_log4x($id)
|
|||||||
*/
|
*/
|
||||||
function modules_get_agentmodule ($id_agentmodule) {
|
function modules_get_agentmodule ($id_agentmodule) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
switch ($config['dbtype']){
|
switch ($config['dbtype']) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
return db_get_row ('tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||||
@ -579,7 +580,7 @@ function modules_get_agentmodule_is_init ($id_agentmodule) {
|
|||||||
function modules_get_agent_modules_count ($id_agent = 0) {
|
function modules_get_agent_modules_count ($id_agent = 0) {
|
||||||
//Make sure we're all int's and filter out bad stuff
|
//Make sure we're all int's and filter out bad stuff
|
||||||
$id_agent = safe_int ($id_agent, 1);
|
$id_agent = safe_int ($id_agent, 1);
|
||||||
|
|
||||||
if (empty ($id_agent)) {
|
if (empty ($id_agent)) {
|
||||||
//If the array proved empty or the agent is less than 1 (eg. -1)
|
//If the array proved empty or the agent is less than 1 (eg. -1)
|
||||||
$filter = '';
|
$filter = '';
|
||||||
@ -587,7 +588,7 @@ function modules_get_agent_modules_count ($id_agent = 0) {
|
|||||||
else {
|
else {
|
||||||
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent));
|
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) db_get_sql ("SELECT COUNT(*) FROM tagente_modulo" . $filter);
|
return (int) db_get_sql ("SELECT COUNT(*) FROM tagente_modulo" . $filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,7 +669,7 @@ function modules_get_agentmodule_type ($id_agentmodule) {
|
|||||||
*/
|
*/
|
||||||
function modules_get_agentmodule_kind($id_agentmodule) {
|
function modules_get_agentmodule_kind($id_agentmodule) {
|
||||||
$id_modulo = (int) db_get_value ('id_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
$id_modulo = (int) db_get_value ('id_modulo', 'tagente_modulo', 'id_agente_modulo', (int) $id_agentmodule);
|
||||||
|
|
||||||
switch($id_modulo) {
|
switch($id_modulo) {
|
||||||
case 1:
|
case 1:
|
||||||
return 'dataserver';
|
return 'dataserver';
|
||||||
@ -718,7 +719,7 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
}
|
}
|
||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
||||||
@ -745,7 +746,7 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db_get_sql ($sql);
|
return db_get_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,7 +761,7 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||||||
*/
|
*/
|
||||||
function modules_get_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) {
|
function modules_get_last_down_timestamp_in_period ($id_agent_module, $period, $date = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if ($date == 0) {
|
if ($date == 0) {
|
||||||
$date = get_system_time ();
|
$date = get_system_time ();
|
||||||
}
|
}
|
||||||
@ -768,31 +769,34 @@ function modules_get_last_down_timestamp_in_period ($id_agent_module, $period, $
|
|||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE
|
$sql = sprintf ("SELECT MAX(`timestamp`)
|
||||||
event_type = 'monitor_down'
|
FROM `tevento`
|
||||||
AND `id_agentmodule` = %d
|
WHERE event_type = 'monitor_down'
|
||||||
AND `utimestamp` > %d
|
AND `id_agentmodule` = %d
|
||||||
AND `utimestamp` <= %d",
|
AND `utimestamp` > %d
|
||||||
|
AND `utimestamp` <= %d",
|
||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = sprintf ("SELECT MAX(\"timestamp\") FROM \"tevento\" WHERE
|
$sql = sprintf ("SELECT MAX(\"timestamp\")
|
||||||
event_type = 'monitor_down'
|
FROM \"tevento\"
|
||||||
AND \"id_agentmodule\" = %d
|
WHERE event_type = 'monitor_down'
|
||||||
AND \"utimestamp\" > %d
|
AND \"id_agentmodule\" = %d
|
||||||
AND \"utimestamp\" <= %d",
|
AND \"utimestamp\" > %d
|
||||||
|
AND \"utimestamp\" <= %d",
|
||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = sprintf ("SELECT MAX(timestamp) FROM tevento WHERE
|
$sql = sprintf ("SELECT MAX(timestamp)
|
||||||
event_type = 'monitor_down'
|
FROM tevento
|
||||||
AND id_agentmodule = %d
|
WHERE event_type = 'monitor_down'
|
||||||
AND utimestamp > %d
|
AND id_agentmodule = %d
|
||||||
AND utimestamp <= %d",
|
AND utimestamp > %d
|
||||||
|
AND utimestamp <= %d",
|
||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db_get_sql ($sql);
|
return db_get_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,29 +815,33 @@ function modules_get_monitors_in_group ($id_group) {
|
|||||||
global $config;
|
global $config;
|
||||||
$id_group = array_keys (users_get_groups ($config['id_user']));
|
$id_group = array_keys (users_get_groups ($config['id_user']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array ($id_group)) {
|
if (is_array ($id_group)) {
|
||||||
$id_group = implode (",",$id_group);
|
$id_group = implode (",",$id_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
$sql = sprintf ("SELECT `tagente_modulo`.* FROM `tagente_modulo`, `ttipo_modulo`, `tagente` WHERE
|
$sql = sprintf ("SELECT `tagente_modulo`.*
|
||||||
`id_tipo_modulo` = `id_tipo`
|
FROM `tagente_modulo`, `ttipo_modulo`, `tagente`
|
||||||
|
WHERE `id_tipo_modulo` = `id_tipo`
|
||||||
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
|
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
|
||||||
AND `ttipo_modulo`.`nombre` LIKE '%%_proc'
|
AND `ttipo_modulo`.`nombre` LIKE '%%_proc'
|
||||||
AND `tagente`.`id_grupo` IN (%s) ORDER BY `tagente`.`nombre`", $id_group);
|
AND `tagente`.`id_grupo` IN (%s)
|
||||||
|
ORDER BY `tagente`.`nombre`", $id_group);
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = sprintf ("SELECT tagente_modulo.* FROM tagente_modulo, ttipo_modulo, tagente WHERE
|
$sql = sprintf ("SELECT tagente_modulo.*
|
||||||
id_tipo_modulo = id_tipo
|
FROM tagente_modulo, ttipo_modulo, tagente
|
||||||
|
WHERE id_tipo_modulo = id_tipo
|
||||||
AND tagente.id_agente = tagente_modulo.id_agente
|
AND tagente.id_agente = tagente_modulo.id_agente
|
||||||
AND ttipo_modulo.nombre LIKE '%%_proc'
|
AND ttipo_modulo.nombre LIKE '%%_proc'
|
||||||
AND tagente.id_grupo IN (%s) ORDER BY tagente.nombre", $id_group);
|
AND tagente.id_grupo IN (%s)
|
||||||
|
ORDER BY tagente.nombre", $id_group);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db_get_all_rows_sql ($sql);
|
return db_get_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
if ($get_actions_alert_template) {
|
if ($get_actions_alert_template) {
|
||||||
$id_template = get_parameter("id_template");
|
$id_template = get_parameter("id_template");
|
||||||
|
|
||||||
$own_info = get_user_info ($config['id_user']);
|
$own_info = get_user_info ($config['id_user']);
|
||||||
$usr_groups = array();
|
$usr_groups = array();
|
||||||
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
|
$usr_groups = users_get_groups($config['id_user'], 'LW', true);
|
||||||
@ -152,12 +152,12 @@ $onheader = array();
|
|||||||
if (check_acl ($config['id_user'], 0, "AW")) {
|
if (check_acl ($config['id_user'], 0, "AW")) {
|
||||||
// Prepare the tab system to the future
|
// Prepare the tab system to the future
|
||||||
$tab = 'setup';
|
$tab = 'setup';
|
||||||
|
|
||||||
/* Setup tab */
|
/* Setup tab */
|
||||||
$setuptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'
|
$setuptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'
|
||||||
. html_print_image ("images/setup.png", true, array ("title" =>__('Setup')))
|
. html_print_image ("images/setup.png", true, array ("title" =>__('Setup')))
|
||||||
. '</a>';
|
. '</a>';
|
||||||
|
|
||||||
if($tab == 'setup')
|
if($tab == 'setup')
|
||||||
$setuptab['active'] = true;
|
$setuptab['active'] = true;
|
||||||
else
|
else
|
||||||
@ -174,7 +174,7 @@ if (isset($result_delete)) {
|
|||||||
ui_print_success_message(__("Sucessfully deleted agent"));
|
ui_print_success_message(__("Sucessfully deleted agent"));
|
||||||
else
|
else
|
||||||
ui_print_error_message(__("There was an error message deleting the agent"));
|
ui_print_error_message(__("There was an error message deleting the agent"));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<form method="post" action="?sec=estado&sec2=operation/agentes/estado_agente&group_id=' . $group_id . '">';
|
echo '<form method="post" action="?sec=estado&sec2=operation/agentes/estado_agente&group_id=' . $group_id . '">';
|
||||||
|
|
||||||
@ -437,9 +437,9 @@ foreach ($agents as $agent) {
|
|||||||
$table->rowclass[$iterator] = 'rowOdd';
|
$table->rowclass[$iterator] = 'rowOdd';
|
||||||
$rowPair = !$rowPair;
|
$rowPair = !$rowPair;
|
||||||
$iterator++;
|
$iterator++;
|
||||||
|
|
||||||
$agent_info["monitor_alertsfired"] = agents_get_alerts_fired ($agent["id_agente"]);
|
$agent_info["monitor_alertsfired"] = agents_get_alerts_fired ($agent["id_agente"]);
|
||||||
|
|
||||||
$agent_info["monitor_critical"] = agents_monitor_critical ($agent["id_agente"]);
|
$agent_info["monitor_critical"] = agents_monitor_critical ($agent["id_agente"]);
|
||||||
$agent_info["monitor_warning"] = agents_monitor_warning ($agent["id_agente"]);
|
$agent_info["monitor_warning"] = agents_monitor_warning ($agent["id_agente"]);
|
||||||
$agent_info["monitor_unknown"] = agents_monitor_unknown ($agent["id_agente"]);
|
$agent_info["monitor_unknown"] = agents_monitor_unknown ($agent["id_agente"]);
|
||||||
@ -447,10 +447,9 @@ foreach ($agents as $agent) {
|
|||||||
|
|
||||||
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
||||||
|
|
||||||
$agent_info["status_img"] = agetns_tree_view_status_img ($agent_info["monitor_critical"],
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"],
|
||||||
$agent_info["monitor_warning"],
|
$agent_info["monitor_warning"], $agent_info["monitor_unknown"]);
|
||||||
$agent_info["monitor_unknown"]);
|
|
||||||
|
|
||||||
//Count all modules
|
//Count all modules
|
||||||
$agent_info["modules"] = $agent_info["monitor_critical"] + $agent_info["monitor_warning"] + $agent_info["monitor_unknown"] + $agent_info["monitor_normal"];
|
$agent_info["modules"] = $agent_info["monitor_critical"] + $agent_info["monitor_warning"] + $agent_info["monitor_unknown"] + $agent_info["monitor_normal"];
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ if (is_ajax ())
|
|||||||
|
|
||||||
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
||||||
|
|
||||||
$agent_info["status_img"] = agetns_tree_view_status_img ($agent_info["monitor_critical"],
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"],
|
||||||
$agent_info["monitor_warning"],
|
$agent_info["monitor_warning"],
|
||||||
$agent_info["monitor_unknown"]);
|
$agent_info["monitor_unknown"]);
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ if (is_ajax ())
|
|||||||
|
|
||||||
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
||||||
|
|
||||||
$agent_info["status_img"] = agetns_tree_view_status_img ($agent_info["monitor_critical"],
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"],
|
||||||
$agent_info["monitor_warning"],
|
$agent_info["monitor_warning"],
|
||||||
$agent_info["monitor_unknown"]);
|
$agent_info["monitor_unknown"]);
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ if (is_ajax ())
|
|||||||
|
|
||||||
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
||||||
|
|
||||||
$agent_info["status_img"] = agetns_tree_view_status_img ($agent_info["monitor_critical"],
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"],
|
||||||
$agent_info["monitor_warning"],
|
$agent_info["monitor_warning"],
|
||||||
$agent_info["monitor_unknown"]);
|
$agent_info["monitor_unknown"]);
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ if (is_ajax ())
|
|||||||
|
|
||||||
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
||||||
|
|
||||||
$agent_info["status_img"] = agetns_tree_view_status_img ($agent_info["monitor_critical"],
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"],
|
||||||
$agent_info["monitor_warning"],
|
$agent_info["monitor_warning"],
|
||||||
$agent_info["monitor_unknown"]);
|
$agent_info["monitor_unknown"]);
|
||||||
|
|
||||||
@ -506,7 +506,7 @@ if (is_ajax ())
|
|||||||
|
|
||||||
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
$agent_info["alert_img"] = agents_tree_view_alert_img ($agent_info["monitor_alertsfired"]);
|
||||||
|
|
||||||
$agent_info["status_img"] = agetns_tree_view_status_img ($agent_info["monitor_critical"],
|
$agent_info["status_img"] = agents_tree_view_status_img ($agent_info["monitor_critical"],
|
||||||
$agent_info["monitor_warning"],
|
$agent_info["monitor_warning"],
|
||||||
$agent_info["monitor_unknown"]);
|
$agent_info["monitor_unknown"]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user