mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-06 13:34:56 +02:00
2013-07-10 Miguel de Dios <miguel.dedios@artica.es>
* godmode/modules/manage_network_components.php: improved the source code style. * include/functions_modules.php: added lost function "modules_get_type_id". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8503 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dcf07af0a8
commit
f1a3a453ca
@ -1,3 +1,11 @@
|
|||||||
|
2013-07-10 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* godmode/modules/manage_network_components.php: improved the source
|
||||||
|
code style.
|
||||||
|
|
||||||
|
* include/functions_modules.php: added lost function
|
||||||
|
"modules_get_type_id".
|
||||||
|
|
||||||
2013-07-09 Sergio Martin <sergio.martin@artica.es>
|
2013-07-09 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/functions_graph.php: Fix the alerts status pie graph
|
* include/functions_graph.php: Fix the alerts status pie graph
|
||||||
|
@ -544,7 +544,8 @@ else {
|
|||||||
echo '<form method="post" action="'.$url.'">';
|
echo '<form method="post" action="'.$url.'">';
|
||||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||||
html_print_input_hidden ('new_component', 1);
|
html_print_input_hidden ('new_component', 1);
|
||||||
html_print_select (array (2 => __('Create a new network component'),
|
html_print_select (array(
|
||||||
|
2 => __('Create a new network component'),
|
||||||
4 => __('Create a new plugin component'),
|
4 => __('Create a new plugin component'),
|
||||||
6 => __('Create a new WMI component')),
|
6 => __('Create a new WMI component')),
|
||||||
'id_component_type', '', '', '', '', '');
|
'id_component_type', '', '', '', '', '');
|
||||||
|
@ -721,7 +721,20 @@ function modules_get_agent_modules_count ($id_agent = 0) {
|
|||||||
* @return string The name of the given type.
|
* @return string The name of the given type.
|
||||||
*/
|
*/
|
||||||
function modules_get_type_name ($id_type) {
|
function modules_get_type_name ($id_type) {
|
||||||
return (string) db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
|
return (string) db_get_value ('nombre',
|
||||||
|
'ttipo_modulo', 'id_tipo', (int) $id_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the id of a module type
|
||||||
|
*
|
||||||
|
* @param int $id_type Type id
|
||||||
|
*
|
||||||
|
* @return string The name of the given type.
|
||||||
|
*/
|
||||||
|
function modules_get_type_id($name_type) {
|
||||||
|
return (int) db_get_value ('id_tipo',
|
||||||
|
'ttipo_modulo', 'nombre', $name_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -815,25 +828,27 @@ function modules_get_agentmodule_type ($id_agentmodule, $metaconsole = false, $i
|
|||||||
* @return string Module kind of the given agent module.
|
* @return string Module kind of the given agent module.
|
||||||
*/
|
*/
|
||||||
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 MODULE_DATA:
|
||||||
return 'dataserver';
|
return 'dataserver';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case MODULE_NETWORK:
|
||||||
|
case MODULE_SNMP:
|
||||||
return 'networkserver';
|
return 'networkserver';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case MODULE_PLUGIN:
|
||||||
return 'pluginserver';
|
return 'pluginserver';
|
||||||
break;
|
break;
|
||||||
case 5:
|
case MODULE_PREDICTION:
|
||||||
return 'predictionserver';
|
return 'predictionserver';
|
||||||
break;
|
break;
|
||||||
case 6:
|
case MODULE_WMI:
|
||||||
return 'wmiserver';
|
return 'wmiserver';
|
||||||
break;
|
break;
|
||||||
case 7:
|
case MODULE_WEB:
|
||||||
return 'webserver';
|
return 'webserver';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -872,7 +887,9 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||||||
|
|
||||||
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
|
||||||
`event_type` = 'monitor_down'
|
`event_type` = 'monitor_down'
|
||||||
AND `id_agentmodule` = %d
|
AND `id_agentmodule` = %d
|
||||||
AND `utimestamp` > %d
|
AND `utimestamp` > %d
|
||||||
@ -880,7 +897,9 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = sprintf ("SELECT COUNT(\"id_agentmodule\") FROM \"tevento\" WHERE
|
$sql = sprintf ("SELECT COUNT(\"id_agentmodule\")
|
||||||
|
FROM \"tevento\"
|
||||||
|
WHERE
|
||||||
\"event_type\" = 'monitor_down'
|
\"event_type\" = 'monitor_down'
|
||||||
AND \"id_agentmodule\" = %d
|
AND \"id_agentmodule\" = %d
|
||||||
AND \"utimestamp\" > %d
|
AND \"utimestamp\" > %d
|
||||||
@ -888,7 +907,9 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$sql = sprintf ("SELECT COUNT(id_agentmodule) FROM tevento WHERE
|
$sql = sprintf ("SELECT COUNT(id_agentmodule)
|
||||||
|
FROM tevento
|
||||||
|
WHERE
|
||||||
event_type = 'monitor_down'
|
event_type = 'monitor_down'
|
||||||
AND id_agentmodule = %d
|
AND id_agentmodule = %d
|
||||||
AND utimestamp > %d
|
AND utimestamp > %d
|
||||||
@ -1286,7 +1307,7 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0)
|
|||||||
|
|
||||||
$interval = modules_get_interval ($id_agent_module);
|
$interval = modules_get_interval ($id_agent_module);
|
||||||
$sql = sprintf ('SELECT *
|
$sql = sprintf ('SELECT *
|
||||||
FROM tagente_datos
|
FROM ' . $table . '
|
||||||
WHERE id_agente_modulo = %d
|
WHERE id_agente_modulo = %d
|
||||||
AND utimestamp <= %d
|
AND utimestamp <= %d
|
||||||
AND utimestamp >= %d
|
AND utimestamp >= %d
|
||||||
@ -1399,23 +1420,23 @@ function modules_get_status($id_agent_module, $db_status, $data, &$status, &$tit
|
|||||||
|
|
||||||
// This module is initialized ? (has real data)
|
// This module is initialized ? (has real data)
|
||||||
//$module_init = db_get_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $id_agent_module);
|
//$module_init = db_get_value ('utimestamp', 'tagente_estado', 'id_agente_modulo', $id_agent_module);
|
||||||
if ($db_status == 4) {
|
if ($db_status == AGENT_MODULE_STATUS_NO_DATA) {
|
||||||
$status = STATUS_MODULE_NO_DATA;
|
$status = STATUS_MODULE_NO_DATA;
|
||||||
$title = __('NOT INIT');
|
$title = __('NOT INIT');
|
||||||
}
|
}
|
||||||
elseif ($db_status == 1) {
|
elseif ($db_status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||||
$status = STATUS_MODULE_CRITICAL;
|
$status = STATUS_MODULE_CRITICAL;
|
||||||
$title = __('CRITICAL');
|
$title = __('CRITICAL');
|
||||||
}
|
}
|
||||||
elseif ($db_status == 2) {
|
elseif ($db_status == AGENT_MODULE_STATUS_WARNING) {
|
||||||
$status = STATUS_MODULE_WARNING;
|
$status = STATUS_MODULE_WARNING;
|
||||||
$title = __('WARNING');
|
$title = __('WARNING');
|
||||||
}
|
}
|
||||||
elseif ($db_status == 0) {
|
elseif ($db_status == AGENT_MODULE_STATUS_NORMAL) {
|
||||||
$status = STATUS_MODULE_OK;
|
$status = STATUS_MODULE_OK;
|
||||||
$title = __('NORMAL');
|
$title = __('NORMAL');
|
||||||
}
|
}
|
||||||
elseif ($db_status == 3) {
|
elseif ($db_status == AGENT_MODULE_STATUS_UNKNOW) {
|
||||||
$status = STATUS_AGENT_DOWN;
|
$status = STATUS_AGENT_DOWN;
|
||||||
$last_status = modules_get_agentmodule_last_status($id_agent_module);
|
$last_status = modules_get_agentmodule_last_status($id_agent_module);
|
||||||
switch($last_status) {
|
switch($last_status) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user