mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 17:25:26 +02:00
Merge branch 'ent-2886-consolas-visuales-static-graphs-en-metaconsola-carrefour' into 'develop'
Removed unused code (meta static graphs) See merge request artica/pandorafms!1953
This commit is contained in:
commit
3f02447271
@ -29,7 +29,6 @@ if ($get_image_path_status){
|
|||||||
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src);
|
$result['bad'] = html_print_image($img_src . '_bad.png', true, '', $only_src);
|
||||||
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
|
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
|
||||||
$result['warning'] = html_print_image($img_src . '_warning.png', true, '', $only_src);
|
$result['warning'] = html_print_image($img_src . '_warning.png', true, '', $only_src);
|
||||||
$result['ok'] = html_print_image($img_src . '_ok.png', true, '', $only_src);
|
|
||||||
$result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
|
$result['normal'] = html_print_image($img_src . '.png', true, '', $only_src);
|
||||||
|
|
||||||
echo json_encode($result);
|
echo json_encode($result);
|
||||||
|
@ -1633,78 +1633,11 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
break;
|
break;
|
||||||
case STATIC_GRAPH:
|
case STATIC_GRAPH:
|
||||||
case GROUP_ITEM:
|
case GROUP_ITEM:
|
||||||
|
|
||||||
|
|
||||||
if (! defined ('METACONSOLE')) {
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// For each server defined and not disabled:
|
|
||||||
$servers = db_get_all_rows_sql ('SELECT *
|
|
||||||
FROM tmetaconsole_setup
|
|
||||||
WHERE disabled = 0');
|
|
||||||
if ($servers === false)
|
|
||||||
$servers = array();
|
|
||||||
|
|
||||||
$result = array();
|
|
||||||
$count_modules = 0;
|
|
||||||
foreach ($servers as $server) {
|
|
||||||
// If connection was good then retrieve all data server
|
|
||||||
if (metaconsole_connect($server) == NOERR)
|
|
||||||
$connection = true;
|
|
||||||
else
|
|
||||||
$connection = false;
|
|
||||||
|
|
||||||
$result_server = db_get_all_rows_sql ($sql);
|
|
||||||
|
|
||||||
if (!empty($result_server)) {
|
|
||||||
|
|
||||||
// Create HASH login info
|
|
||||||
$pwd = $server['auth_token'];
|
|
||||||
$auth_serialized = json_decode($pwd,true);
|
|
||||||
|
|
||||||
if (is_array($auth_serialized)) {
|
|
||||||
$pwd = $auth_serialized['auth_token'];
|
|
||||||
$api_password = $auth_serialized['api_password'];
|
|
||||||
$console_user = $auth_serialized['console_user'];
|
|
||||||
$console_password = $auth_serialized['console_password'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = $config['id_user'];
|
|
||||||
$user_rot13 = str_rot13($config['id_user']);
|
|
||||||
$hashdata = $user.$pwd;
|
|
||||||
$hashdata = md5($hashdata);
|
|
||||||
$url_hash = '&' .
|
|
||||||
'loginhash=auto&' .
|
|
||||||
'loginhash_data=' . $hashdata . '&' .
|
|
||||||
'loginhash_user=' . $user_rot13;
|
|
||||||
|
|
||||||
foreach ($result_server as $result_element_key => $result_element_value) {
|
|
||||||
|
|
||||||
$result_server[$result_element_key]['server_id'] = $server['id'];
|
|
||||||
$result_server[$result_element_key]['server_name'] = $server['server_name'];
|
|
||||||
$result_server[$result_element_key]['server_url'] = $server['server_url'].'/';
|
|
||||||
$result_server[$result_element_key]['hashdata'] = $hashdata;
|
|
||||||
$result_server[$result_element_key]['user'] = $config['id_user'];
|
|
||||||
|
|
||||||
$count_modules++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = array_merge($result, $result_server);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($connection) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
|
if (($layoutData['image'] != null && $layoutData['image'] != 'none') || $layoutData['show_statistics'] == 1) {
|
||||||
|
|
||||||
$img_style_title = strip_tags($label);
|
$img_style_title = strip_tags($label);
|
||||||
if ($layoutData['type'] == STATIC_GRAPH) {
|
if ($layoutData['type'] == STATIC_GRAPH) {
|
||||||
if ($layoutData['id_agente_modulo'] != 0) {
|
if ($layoutData['id_agente_modulo'] != 0) {
|
||||||
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
if ($layoutData['id_metaconsole'] != 0) {
|
||||||
//Metaconsole db connection
|
//Metaconsole db connection
|
||||||
$connection = db_get_row_filter ('tmetaconsole_setup',
|
$connection = db_get_row_filter ('tmetaconsole_setup',
|
||||||
@ -1780,68 +1713,71 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
else if($layoutData['label_position']=='right'){
|
else if($layoutData['label_position']=='right'){
|
||||||
$imgpos = 'float:left';
|
$imgpos = 'float:left';
|
||||||
}
|
}
|
||||||
|
|
||||||
$varsize = getimagesize($config['homedir'] . '/' . $img);
|
$varsize = getimagesize($config['homedir'] . '/' . $img);
|
||||||
|
|
||||||
|
if($layoutData['show_statistics'] == 1) {
|
||||||
if($layoutData['show_statistics'] == 1){
|
|
||||||
|
|
||||||
if (get_parameter('action') == 'edit') {
|
if (get_parameter('action') == 'edit') {
|
||||||
|
|
||||||
if ($width == 0 || $height == 0) {
|
if ($width == 0 || $height == 0) {
|
||||||
|
|
||||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:520px;height:80px;'.$imgpos.'">';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
echo '<img id="image_'.$id.'" src="images/console/signes/group_status.png" style="width:'.$width.'px;height:'.$height.'px;'.$imgpos.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
$agents_critical = agents_get_agents(
|
||||||
$agents_critical = agents_get_agents(array (
|
array (
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
'id_grupo' => $layoutData['id_group'],
|
'id_grupo' => $layoutData['id_group'],
|
||||||
'status' => AGENT_STATUS_CRITICAL),
|
'status' => AGENT_STATUS_CRITICAL
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
),
|
||||||
|
array ('COUNT(*) as total'),
|
||||||
$agents_warning = agents_get_agents(array (
|
'AR',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
$agents_warning = agents_get_agents(
|
||||||
|
array (
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
'id_grupo' => $layoutData['id_group'],
|
'id_grupo' => $layoutData['id_group'],
|
||||||
'status' => AGENT_STATUS_WARNING),
|
'status' => AGENT_STATUS_WARNING
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
),
|
||||||
|
array ('COUNT(*) as total'),
|
||||||
$agents_unknown = agents_get_agents(array (
|
'AR',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
$agents_unknown = agents_get_agents(
|
||||||
|
array (
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
'id_grupo' => $layoutData['id_group'],
|
'id_grupo' => $layoutData['id_group'],
|
||||||
'status' => AGENT_STATUS_UNKNOWN),
|
'status' => AGENT_STATUS_UNKNOWN
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
),
|
||||||
|
array ('COUNT(*) as total'),
|
||||||
$agents_ok = agents_get_agents(array (
|
'AR',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
$agents_ok = agents_get_agents(
|
||||||
|
array (
|
||||||
'disabled' => 0,
|
'disabled' => 0,
|
||||||
'id_grupo' => $layoutData['id_group'],
|
'id_grupo' => $layoutData['id_group'],
|
||||||
'status' => AGENT_STATUS_OK),
|
'status' => AGENT_STATUS_OK
|
||||||
array ('COUNT(*) as total'), 'AR', false);
|
),
|
||||||
|
array ('COUNT(*) as total'),
|
||||||
|
'AR',
|
||||||
|
false
|
||||||
|
);
|
||||||
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
$total_agents = $agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total'];
|
||||||
|
|
||||||
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
$stat_agent_ok = $agents_ok[0]['total']/$total_agents*100;
|
||||||
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
$stat_agent_wa = $agents_warning[0]['total']/$total_agents*100;
|
||||||
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
$stat_agent_cr = $agents_critical[0]['total']/$total_agents*100;
|
||||||
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
$stat_agent_un = $agents_unknown[0]['total']/$total_agents*100;
|
||||||
|
|
||||||
if($width == 0 || $height == 0){
|
if($width == 0 || $height == 0){
|
||||||
$dyn_width = 520;
|
$dyn_width = 520;
|
||||||
$dyn_height = 80;
|
$dyn_height = 80;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$dyn_width = $width;
|
$dyn_width = $width;
|
||||||
$dyn_height = $height;
|
$dyn_height = $height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
echo '<table cellpadding="0" cellspacing="0" border="0" class="databox" style="width:'.$dyn_width.'px;height:'.$dyn_height.'px;text-align:center;';
|
||||||
|
|
||||||
if($layoutData['label_position'] == 'left'){
|
if($layoutData['label_position'] == 'left'){
|
||||||
echo "float:right;";
|
echo "float:right;";
|
||||||
}
|
}
|
||||||
@ -1850,10 +1786,8 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '">';
|
echo '">';
|
||||||
|
|
||||||
echo "<tr style='height:10%;'>";
|
echo "<tr style='height:10%;'>";
|
||||||
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
echo "<th style='text-align:center;background-color:#9d9ea0;color:black;font-weight:bold;'>" .groups_get_name($layoutData['id_group'],true) . "</th>";
|
||||||
|
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
echo "<tr style='background-color:whitesmoke;height:90%;'>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
@ -1865,68 +1799,38 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
|
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Normal</div>";
|
||||||
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
|
echo "<div style='margin-left:2%;color: #FFF;font-size: 12px;display:inline;background-color:#9d9ea0;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>". remove_right_zeros(number_format($stat_agent_un, 2)) ."%</div>";
|
||||||
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
|
echo "<div style='background-color:white;color: black ;font-size: 12px;display:inline;position:relative;height:80%;width:9.4%;height:80%;border-radius:2px;text-align:center;padding:5px;'>Unknown</div>";
|
||||||
|
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
$options = array(
|
||||||
else{
|
"class" => "image",
|
||||||
|
"id" => "image_" . $id,
|
||||||
|
"title" => $img_style_title,
|
||||||
|
"style" => $borderStyle.$imgpos
|
||||||
|
);
|
||||||
if ($width == 0 || $height == 0) {
|
if ($width == 0 || $height == 0) {
|
||||||
if($varsize[0] > 150 || $varsize[1] > 150){
|
if($varsize[0] > 150 || $varsize[1] > 150){
|
||||||
echo html_print_image($img, true,
|
$options['width'] = "70px";
|
||||||
array("class" => "image",
|
$options['height'] = "70px";
|
||||||
"id" => "image_" . $id,
|
|
||||||
"width" => "70px",
|
|
||||||
"height" => "70px",
|
|
||||||
"title" => $img_style_title,
|
|
||||||
"style" => $borderStyle.$imgpos), false,
|
|
||||||
false, false, $isExternalLink);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
echo html_print_image($img, true,
|
|
||||||
array("class" => "image",
|
|
||||||
"id" => "image_" . $id,
|
|
||||||
"title" => $img_style_title,
|
|
||||||
"style" => $borderStyle.$imgpos), false,
|
|
||||||
false, false, $isExternalLink);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo html_print_image($img, true,
|
$options['width'] = $width;
|
||||||
array("class" => "image",
|
$options['height'] = $height;
|
||||||
"id" => "image_" . $id,
|
}
|
||||||
"width" => $width,
|
echo html_print_image($img, true, $options,
|
||||||
"height" => $height,
|
false, false, false, $isExternalLink);
|
||||||
"title" => $img_style_title,
|
}
|
||||||
"style" => $borderStyle.$imgpos), false,
|
|
||||||
false, false, $isExternalLink);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if ($layoutData['label_position'] != 'up') {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if($layoutData['label_position']=='down'){
|
|
||||||
echo io_safe_output($text);
|
|
||||||
}
|
|
||||||
else if($layoutData['label_position']=='left' || $layoutData['label_position']=='right'){
|
|
||||||
echo io_safe_output($text);
|
echo io_safe_output($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! defined ('METACONSOLE')) {
|
if (is_metaconsole()) metaconsole_restore_db();
|
||||||
}
|
|
||||||
else {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PERCENTILE_BAR:
|
case PERCENTILE_BAR:
|
||||||
if (($layoutData['image'] == 'value') && ($value_text !== false)) {
|
if (($layoutData['image'] == 'value') && ($value_text !== false)) {
|
||||||
$unit_text = db_get_sql ('SELECT unit
|
$unit_text = db_get_sql ('SELECT unit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user