mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Fixed the static graph status shown into the Metaconsole Visual Maps
This commit is contained in:
parent
4d9ebb90b1
commit
d49cfea9f4
@ -247,8 +247,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
|
|
||||||
|
|
||||||
if (!isset($layoutData['status_calculated'])) {
|
if (!isset($layoutData['status_calculated'])) {
|
||||||
$layoutData['status_calculated'] =
|
$layoutData['status_calculated'] = visual_map_get_status_element($layoutData);
|
||||||
visual_map_get_status_element($layoutData);
|
|
||||||
}
|
}
|
||||||
$status = $layoutData['status_calculated'];
|
$status = $layoutData['status_calculated'];
|
||||||
|
|
||||||
@ -812,50 +811,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case STATIC_GRAPH:
|
case STATIC_GRAPH:
|
||||||
case GROUP_ITEM:
|
case GROUP_ITEM:
|
||||||
//Enter the correct img if the graph has a module selected or not
|
|
||||||
if ($type == STATIC_GRAPH) {
|
|
||||||
//Module
|
|
||||||
if ($layoutData['id_agente_modulo'] != 0) {
|
|
||||||
$module_status = db_get_sql ('SELECT estado
|
|
||||||
FROM tagente_estado
|
|
||||||
WHERE id_agente_modulo = ' . $layoutData['id_agente_modulo']);
|
|
||||||
switch($module_status) {
|
|
||||||
case AGENT_STATUS_NORMAL:
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_NORMAL;
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_WARNING:
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_WARNING;
|
|
||||||
break;
|
|
||||||
case AGENT_STATUS_CRITICAL:
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_CRITICAL;
|
|
||||||
break;
|
|
||||||
case AGENT_MODULE_STATUS_NO_DATA:
|
|
||||||
default:
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_UNKNOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//No module
|
|
||||||
else if ($layoutData['id_agent'] != 0) {
|
|
||||||
$agent = db_get_row ("tagente", "id_agente", $layoutData['id_agent']);
|
|
||||||
if ($agent['total_count'] == 0 || $agent['total_count'] == $agent['notinit_count']) {
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_UNKNOWN;
|
|
||||||
}
|
|
||||||
else if ($agent['critical_count'] > 0) {
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_CRITICAL;
|
|
||||||
}
|
|
||||||
else if ($agent['warning_count'] > 0) {
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_WARNING;
|
|
||||||
}
|
|
||||||
else if ($agent['unknown_count'] > 0) {
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_UNKNOWN;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$layoutData['status_calculated'] = AGENT_STATUS_NORMAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($layoutData['image'] != null) {
|
if ($layoutData['image'] != null) {
|
||||||
$img = visual_map_get_image_status_element($layoutData,
|
$img = visual_map_get_image_status_element($layoutData,
|
||||||
$layoutData['status_calculated']);
|
$layoutData['status_calculated']);
|
||||||
@ -3210,7 +3165,18 @@ function visual_map_get_status_element($layoutData) {
|
|||||||
else {
|
else {
|
||||||
switch ($layoutData["type"]) {
|
switch ($layoutData["type"]) {
|
||||||
case STATIC_GRAPH:
|
case STATIC_GRAPH:
|
||||||
//Enter the correct img if the graph has a module selected or not
|
// Open metaconsole connection
|
||||||
|
if ($layoutData['id_metaconsole'] != 0) {
|
||||||
|
//Metaconsole db connection
|
||||||
|
$connection = db_get_row_filter ('tmetaconsole_setup',
|
||||||
|
array('id' => $layoutData['id_metaconsole']));
|
||||||
|
if (metaconsole_load_external_db($connection) != NOERR) {
|
||||||
|
//ui_print_error_message ("Error connecting to ".$server_name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Enter the correct img if the graph has a module selected or not
|
||||||
//Module
|
//Module
|
||||||
if ($layoutData['id_agente_modulo'] != 0) {
|
if ($layoutData['id_agente_modulo'] != 0) {
|
||||||
$module_status = db_get_sql ('SELECT estado
|
$module_status = db_get_sql ('SELECT estado
|
||||||
@ -3257,15 +3223,7 @@ function visual_map_get_status_element($layoutData) {
|
|||||||
}
|
}
|
||||||
$status = $layoutData['status_calculated'];
|
$status = $layoutData['status_calculated'];
|
||||||
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
// Close metaconsole connection
|
||||||
//Metaconsole db connection
|
|
||||||
$connection = db_get_row_filter ('tmetaconsole_setup',
|
|
||||||
array('id' => $layoutData['id_metaconsole']));
|
|
||||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
|
||||||
//ui_print_error_message ("Error connecting to ".$server_name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
if ($layoutData['id_metaconsole'] != 0) {
|
||||||
//Restore db connection
|
//Restore db connection
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user