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
136504b5a2
commit
8d66b9247c
|
@ -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>
|
||||
|
||||
* include/functions_graph.php: Fix the alerts status pie graph
|
||||
|
|
|
@ -500,7 +500,7 @@ foreach ($components as $component) {
|
|||
$data[0] .= io_safe_output($component['name']);
|
||||
$data[0] .= '</a>';
|
||||
$data[1] = ui_print_moduletype_icon ($component['type'], true);
|
||||
switch($component['id_modulo']) {
|
||||
switch ($component['id_modulo']) {
|
||||
case MODULE_NETWORK:
|
||||
$data[1] .= html_print_image('images/network.png', true, array('title' => __('Network module')));
|
||||
break;
|
||||
|
@ -538,13 +538,14 @@ if (isset($data)) {
|
|||
echo "</form>";
|
||||
}
|
||||
else {
|
||||
echo "<div class='nf'>".__('There are no defined network components')."</div>";
|
||||
echo "<div class='nf'>" . __('There are no defined network components') . "</div>";
|
||||
}
|
||||
|
||||
echo '<form method="post" action="'.$url.'">';
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
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'),
|
||||
6 => __('Create a new WMI component')),
|
||||
'id_component_type', '', '', '', '', '');
|
||||
|
@ -556,12 +557,12 @@ enterprise_hook('close_meta_frame');
|
|||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function check_all_checkboxes() {
|
||||
function check_all_checkboxes() {
|
||||
if ($("input[name=all_delete]").attr('checked')) {
|
||||
$(".check_delete").attr('checked', true);
|
||||
}
|
||||
else {
|
||||
$(".check_delete").attr('checked', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -721,7 +721,20 @@ function modules_get_agent_modules_count ($id_agent = 0) {
|
|||
* @return string The name of the given 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.
|
||||
*/
|
||||
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) {
|
||||
case 1:
|
||||
case MODULE_DATA:
|
||||
return 'dataserver';
|
||||
break;
|
||||
case 2:
|
||||
case MODULE_NETWORK:
|
||||
case MODULE_SNMP:
|
||||
return 'networkserver';
|
||||
break;
|
||||
case 4:
|
||||
case MODULE_PLUGIN:
|
||||
return 'pluginserver';
|
||||
break;
|
||||
case 5:
|
||||
case MODULE_PREDICTION:
|
||||
return 'predictionserver';
|
||||
break;
|
||||
case 6:
|
||||
case MODULE_WMI:
|
||||
return 'wmiserver';
|
||||
break;
|
||||
case 7:
|
||||
case MODULE_WEB:
|
||||
return 'webserver';
|
||||
break;
|
||||
default:
|
||||
|
@ -872,7 +887,9 @@ function modules_get_monitor_downs_in_period ($id_agent_module, $period, $date =
|
|||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
||||
$sql = sprintf ("SELECT COUNT(`id_agentmodule`)
|
||||
FROM `tevento`
|
||||
WHERE
|
||||
`event_type` = 'monitor_down'
|
||||
AND `id_agentmodule` = %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);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT COUNT(\"id_agentmodule\") FROM \"tevento\" WHERE
|
||||
$sql = sprintf ("SELECT COUNT(\"id_agentmodule\")
|
||||
FROM \"tevento\"
|
||||
WHERE
|
||||
\"event_type\" = 'monitor_down'
|
||||
AND \"id_agentmodule\" = %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);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("SELECT COUNT(id_agentmodule) FROM tevento WHERE
|
||||
$sql = sprintf ("SELECT COUNT(id_agentmodule)
|
||||
FROM tevento
|
||||
WHERE
|
||||
event_type = 'monitor_down'
|
||||
AND id_agentmodule = %d
|
||||
AND utimestamp > %d
|
||||
|
@ -1091,7 +1112,7 @@ function modules_get_moduletypes ($type = "all", $rows = "nombre") {
|
|||
$rows = (array) $rows; //Cast as array
|
||||
$row_cnt = count ($rows);
|
||||
if ($type == "remote") {
|
||||
return array_merge (range (6,18), (array) 100);
|
||||
return array_merge (range (6,18), (array)100);
|
||||
}
|
||||
elseif ($type == "agent") {
|
||||
return array_merge (range (1,4), range (19,24));
|
||||
|
@ -1286,7 +1307,7 @@ function modules_get_next_data ($id_agent_module, $utimestamp = 0, $string = 0)
|
|||
|
||||
$interval = modules_get_interval ($id_agent_module);
|
||||
$sql = sprintf ('SELECT *
|
||||
FROM tagente_datos
|
||||
FROM ' . $table . '
|
||||
WHERE id_agente_modulo = %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)
|
||||
//$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;
|
||||
$title = __('NOT INIT');
|
||||
}
|
||||
elseif ($db_status == 1) {
|
||||
elseif ($db_status == AGENT_MODULE_STATUS_CRITICAL_BAD) {
|
||||
$status = STATUS_MODULE_CRITICAL;
|
||||
$title = __('CRITICAL');
|
||||
}
|
||||
elseif ($db_status == 2) {
|
||||
elseif ($db_status == AGENT_MODULE_STATUS_WARNING) {
|
||||
$status = STATUS_MODULE_WARNING;
|
||||
$title = __('WARNING');
|
||||
}
|
||||
elseif ($db_status == 0) {
|
||||
elseif ($db_status == AGENT_MODULE_STATUS_NORMAL) {
|
||||
$status = STATUS_MODULE_OK;
|
||||
$title = __('NORMAL');
|
||||
}
|
||||
elseif ($db_status == 3) {
|
||||
elseif ($db_status == AGENT_MODULE_STATUS_UNKNOW) {
|
||||
$status = STATUS_AGENT_DOWN;
|
||||
$last_status = modules_get_agentmodule_last_status($id_agent_module);
|
||||
switch($last_status) {
|
||||
|
|
Loading…
Reference in New Issue