";
if (empty($graph)) {
echo "var graph = null;\n";
return;
} else {
echo "var graph = \n";
}
}
echo "{\n";
echo "'nodes' : \n";
echo "[\n";
$first = true;
foreach ($graph['nodes'] as $id => $node) {
if ($first === false) {
echo ",\n";
}
$first = false;
echo "{
'id' : ".$id.",
'name' : '".$node['label']."',
'url' : '".$node['url']."',
'tooltip' : '".$node['tooltip']."',
'default_tooltip' : 1,
'tooltip_content' : ' ".html_print_image('images/spinner.gif', true)."',
'color' : '".$node['color']."'}\n";
}
echo "],\n";
echo "'links' : \n";
echo "[\n";
$first = true;
foreach ($graph['lines'] as $line) {
if ($first === false) {
echo ",\n";
}
$first = false;
echo "{
'source' : ".$line['source'].",
'target' : ".$line['target']."}\n";
}
echo "]\n";
echo "}\n";
if ($js_tags === true) {
echo ";\n";
echo '';
}
}
function networkmap_generate_hash(
$pandora_name,
$group=0,
$simple=0,
$font_size=12,
$layout='radial',
$nooverlap=0,
$zoom=1,
$ranksep=2.5,
$center=0,
$regen=1,
$pure=0,
$id_networkmap=0,
$show_snmp_modules=0,
$cut_names=true,
$relative=false,
$text_filter=''
) {
$graph = networkmap_generate_dot(
$pandora_name,
$group,
$simple,
$font_size,
$layout,
$nooverlap,
$zoom,
$ranksep,
$center,
$regen,
$pure,
$id_networkmap,
$show_snmp_modules,
$cut_names,
$relative,
$text_filter,
false,
null,
false
);
$return = [];
if (empty($graph) === false) {
$graph = str_replace("\r", "\n", $graph);
$graph = str_replace("\n", ' ', $graph);
// Removed the head.
preg_match('/graph networkmap {(.*)}/', $graph, $matches);
$graph = $matches[1];
// Get the lines and nodes.
$tokens = preg_split('/; /', $graph);
foreach ($tokens as $token) {
if (empty($token)) {
continue;
}
// Ignore the head rests.
if (preg_match('/(.+)\s*\[(.*)\]/', $token) != 0) {
$items[] = $token;
}
}
$lines = [];
$nodes = [];
foreach ($items as $item) {
$matches = null;
preg_match('/(.+)\s*\[(.*)\]/', $item, $matches);
if (empty($matches) === true) {
continue;
}
$id_item = trim($matches[1]);
$content_item = trim($matches[2]);
// Check if is a edge or node.
if (strstr($id_item, '--') !== false) {
// Edge.
$lines[$id_item] = $content_item;
} else {
// Node.
$id_item = (int) $id_item;
$nodes[$id_item] = $content_item;
}
}
foreach ($nodes as $key => $node) {
if ($key != 0) {
// Get label.
$matches = null;
preg_match('/label=(.*),/', $node, $matches);
$label = $matches[1];
$matches = null;
preg_match(
'/\
\(.*?)\<\/TD\>\<\/TR\>/',
$label,
$matches
);
$label = $matches[1];
// Get color.
$matches = null;
preg_match('/color="([^"]*)/', $node, $matches);
$color = $matches[1];
// Get tooltip.
$matches = null;
preg_match('/tooltip="([^"]*)/', $node, $matches);
$tooltip = $matches[1];
// Get URL.
$matches = null;
preg_match('/URL="([^"]*)/', $node, $matches);
$url = $matches[1];
$return['nodes'][$key]['label'] = $label;
$return['nodes'][$key]['color'] = $color;
$return['nodes'][$key]['tooltip'] = $tooltip;
$return['nodes'][$key]['url'] = $url;
} else {
// Get tooltip.
$matches = null;
preg_match('/tooltip="([^"]*)/', $node, $matches);
$tooltip = $matches[1];
// Get URL.
$matches = null;
preg_match('/URL="([^"]*)/', $node, $matches);
$url = $matches[1];
$return['nodes'][$key]['label'] = 'Pandora FMS';
$return['nodes'][$key]['color'] = '#7EBE3F';
$return['nodes'][$key]['tooltip'] = $tooltip;
$return['nodes'][$key]['url'] = $url;
}
}
ksort($return['nodes']);
foreach ($lines as $key => $line) {
$data = [];
$points = explode(' -- ', $key);
$data['source'] = (int) $points[0];
$data['target'] = (int) $points[1];
$return['lines'][] = $data;
}
}
return $return;
}
function networkmap_generate_dot(
$pandora_name,
$group=0,
$simple=0,
$font_size=12,
$layout='radial',
$nooverlap=0,
$zoom=1,
$ranksep=2.5,
$center=0,
$regen=1,
$pure=0,
$id_networkmap=0,
$show_snmp_modules=0,
$cut_names=true,
$relative=false,
$text_filter='',
$ip_mask=null,
$dont_show_subgroups=false,
$strict_user=false,
$size_canvas=null,
$old_mode=false,
$map_filter=[]
) {
global $config;
$nooverlap = 1;
$parents = [];
$orphans = [];
$filter = [];
$filter['disabled'] = 0;
if (empty($text_filter) === false) {
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$text_filter.'%")';
}
/*
* Select data origin.
* group
* discovery task
* - Cloud
* - Application
* - Standar or custom
* network/mask
*/
if ($group >= 0 && empty($ip_mask)) {
if ($dont_show_subgroups) {
$filter['id_grupo'] = $group;
} else {
$childrens = groups_get_children($group, null, true);
if (empty($childrens) === false) {
$childrens = array_keys($childrens);
$filter['id_grupo'] = $childrens;
$filter['id_grupo'][] = $group;
} else {
$filter['id_grupo'] = $group;
}
}
// Order by id_parent ascendant for to avoid the bugs
// because the first agents to process in the next
// foreach loop are without parent (id_parent = 0)
// Get agents data.
$agents = agents_get_agents(
$filter,
[
'id_grupo',
'nombre',
'id_os',
'id_parent',
'id_agente',
'normal_count',
'warning_count',
'critical_count',
'unknown_count',
'total_count',
'notinit_count',
],
'AR',
[
'field' => 'id_parent',
'order' => 'ASC',
]
);
} else if ($group == -666) {
$agents = false;
} else if (empty($ip_mask) === false) {
$agents = networkmap_get_nodes_from_ip_mask(
$ip_mask
);
} else {
$agents = agents_get_agents(
$filter,
[
'id_grupo',
'nombre',
'id_os',
'id_parent',
'id_agente',
'normal_count',
'warning_count',
'critical_count',
'unknown_count',
'total_count',
'notinit_count',
],
'AR',
[
'field' => 'id_parent',
'order' => 'ASC',
]
);
}
if ($agents === false) {
$agents = [];
}
// Open Graph.
$graph = networkmap_open_graph(
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$font_size,
$size_canvas,
$map_filter
);
// Parse agents.
$nodes = [];
// Add node refs.
$node_ref = [];
$modules_node_ref = [];
$node_count = 0;
foreach ($agents as $agent) {
$node_count++;
$node_ref[$agent['id_agente']] = $node_count;
$agent['id_node'] = $node_count;
$agent['type'] = 'agent';
// Add node.
$nodes[$node_count] = $agent;
$filter = [];
$filter['disabled'] = 0;
// Get agent modules data.
$modules = agents_get_modules($agent['id_agente'], '*', $filter, true, true);
if ($modules === false) {
$modules = [];
}
// Parse modules.
foreach ($modules as $key => $module) {
$node_count++;
$modules_node_ref[$module['id_agente_modulo']] = $node_count;
$module['id_node'] = $node_count;
$module['type'] = 'module';
// Try to get the interface name.
if (preg_match('/(.+)_ifOperStatus$/', (string) $module['nombre'], $matches)) {
if ($matches[1]) {
$module['nombre'] = $matches[1];
// Save node parent information to define edges later.
$parents[$node_count] = $module['parent'] = $agent['id_node'];
// Add node.
$nodes[$node_count] = $module;
}
} else {
$sql_a = sprintf(
'SELECT id
FROM tmodule_relationship
WHERE module_a = %d AND type = "direct"',
$module['id_agente_modulo']
);
$sql_b = sprintf(
'SELECT id
FROM tmodule_relationship
WHERE module_b = %d AND type = "direct"',
$module['id_agente_modulo']
);
$have_relations_a = db_get_value_sql($sql_a);
$have_relations_b = db_get_value_sql($sql_b);
if ($have_relations_a || $have_relations_b) {
// Save node parent information to define edges later.
$parents[$node_count] = $module['parent'] = $agent['id_node'];
// Add node.
$nodes[$node_count] = $module;
}
}
}
}
foreach ($modules_node_ref as $id_module => $node_count) {
$module_type = modules_get_agentmodule_type($id_module);
}
// Addded the relationship of parents of agents.
foreach ($agents as $agent) {
if ($agent['id_parent'] != '0' && array_key_exists($agent['id_parent'], $node_ref)) {
$parents[$node_ref[$agent['id_agente']]] = $node_ref[$agent['id_parent']];
} else {
$orphans[$node_ref[$agent['id_agente']]] = 1;
}
}
// Create a central node if orphan nodes exist.
if (count($orphans) > 0 || empty($nodes) === true) {
$graph .= networkmap_create_pandora_node($pandora_name, $font_size, $simple);
}
// Define edges for orphan nodes.
foreach (array_keys($orphans) as $node) {
$graph .= networkmap_create_edge('0', $node, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap);
}
// Create void statistics array.
$stats = [];
// Create nodes.
foreach ($nodes as $node_id => $node) {
if ($center > 0 && networkmap_is_descendant($node_id, $center, $parents) === false) {
unset($parents[$node_id]);
unset($orphans[$node_id]);
unset($nodes[$node_id]);
continue;
}
switch ($node['type']) {
case 'agent':
$graph .= networkmap_create_agent_node(
$node,
$simple,
$font_size,
$cut_names,
$relative
)."\n\t\t";
$stats['agents'][] = $node['id_agente'];
break;
case 'module':
$graph .= networkmap_create_module_node(
$node,
$simple,
$font_size
)."\n\t\t";
$stats['modules'][] = $node['id_agente_modulo'];
break;
default:
// Do none.
break;
}
}
// Define edges.
foreach ($parents as $node => $parent_id) {
// Verify that the parent is in the graph.
if (isset($nodes[$parent_id]) === true) {
$graph .= networkmap_create_edge(
$parent_id,
$node,
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$simple,
$regen,
$font_size,
$group,
'operation/agentes/networkmap',
'topology',
$id_networkmap
);
} else {
$orphans[$node] = 1;
}
}
// Define edges for the module interfaces relations
// Get the remote_snmp_proc relations.
$relations = modules_get_relations();
if ($relations === false) {
$relations = [];
}
foreach ($relations as $relation) {
$module_a = $relation['module_a'];
$agent_a = modules_get_agentmodule_agent($module_a);
$module_b = $relation['module_b'];
$agent_b = modules_get_agentmodule_agent($module_b);
if (isset($modules_node_ref[$module_a]) === true && isset($modules_node_ref[$module_b]) === true) {
$graph .= networkmap_create_edge(
$modules_node_ref[$module_a],
$modules_node_ref[$module_b],
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$simple,
$regen,
$font_size,
$group,
'operation/agentes/networkmap',
'topology',
$id_networkmap
);
} else if (isset($node_ref[$agent_a]) === true && isset($modules_node_ref[$module_b]) === true) {
$graph .= networkmap_create_edge(
$node_ref[$agent_a],
$modules_node_ref[$module_b],
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$simple,
$regen,
$font_size,
$group,
'operation/agentes/networkmap',
'topology',
$id_networkmap
);
} else if (isset($node_ref[$agent_b]) === true && isset($modules_node_ref[$module_a]) === true) {
$graph .= networkmap_create_edge(
$node_ref[$agent_b],
$modules_node_ref[$module_a],
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$simple,
$regen,
$font_size,
$group,
'operation/agentes/networkmap',
'topology',
$id_networkmap
);
} else if (isset($node_ref[$agent_a]) === true && isset($node_ref[$agent_b]) === true) {
$graph .= networkmap_create_edge(
$node_ref[$agent_a],
$node_ref[$agent_b],
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$simple,
$regen,
$font_size,
$group,
'operation/agentes/networkmap',
'topology',
$id_networkmap
);
}
}
// Close graph.
$graph .= networkmap_close_graph();
return $graph;
}
/**
* Returns an edge definition.
*
* @param mixed $head Head.
* @param mixed $tail Tail.
* @param string $layout Layout.
* @param string $nooverlap Nooverlap.
* @param integer $pure Pure.
* @param float $zoom Zoom.
* @param float $ranksep Ranksep.
* @param integer $simple Simple.
* @param integer $regen Regen.
* @param integer $font_size Font_size.
* @param integer $group Group.
* @param string $sec2 Sec2.
* @param string $tab Tab.
* @param integer $id_networkmap Id_networkmap.
*
* @return string Dot string.
*/
function networkmap_create_edge(
$head,
$tail,
$layout,
$nooverlap,
$pure,
$zoom,
$ranksep,
$simple,
$regen,
$font_size,
$group,
$sec2='operation/agentes/networkmap',
$tab='topology',
$id_networkmap=0
) {
if (is_metaconsole() === true) {
$url = '';
} else {
$url = 'index.php?sec=estado&sec2='.$sec2.'&tab='.$tab.'&';
$url .= 'recenter_networkmap=1¢er='.$head.'&';
$url .= 'layout='.$layout.'&nooverlap='.$nooverlap.'&';
$url .= 'pure='.$pure.'&zoom='.$zoom.'&ranksep='.$ranksep.'&';
$url .= 'simple='.$simple.'®en=1&font_size='.$font_size.'&';
$url .= 'group='.$group.'&id_networkmap='.$id_networkmap;
}
// Option edgeURL allows node navigation.
$edge = "\n".$head.' -- '.$tail;
$edge .= '[len='.$ranksep.', color="#BDBDBD", headclip=false, tailclip=false, edgeURL="'.$url.'"];';
$edge .= "\n";
return $edge;
}
/**
* Returns a node definition.
*
* @param boolean $agent Id Agent.
* @param integer $simple Iapa.
* @param integer $font_size Iapa.
* @param boolean $cut_names Iapa.
* @param boolean $relative Iapa.
* @param boolean $metaconsole Iapa.
* @param integer $id_server Iapa.
* @param boolean $strict_user Iapa.
*
* @return string
*/
function networkmap_create_agent_node(
$agent,
$simple=0,
$font_size=10,
$cut_names=true,
$relative=false,
$metaconsole=false,
$id_server=null,
$strict_user=false
) {
global $config;
global $hack_networkmap_mobile;
if ($strict_user === true) {
include_once $config['homedir'].'/include/functions_tags.php';
$acltags = tags_get_user_groups_and_tags($config['id_user'], 'AR', $strict_user);
$agent_filter = ['id' => $agent['id_agente']];
$strict_data['normal_count'] = (int) groups_get_normal_monitors($agent['id_grupo'], $agent_filter, [], $strict_user, $acltags);
$strict_data['warning_count'] = (int) groups_get_warning_monitors($agent['id_grupo'], $agent_filter, [], $strict_user, $acltags);
$strict_data['critical_count'] = (int) groups_get_critical_monitors($agent['id_grupo'], $agent_filter, [], $strict_user, $acltags);
$strict_data['unknown_count'] = (int) groups_get_unknown_monitors($agent['id_grupo'], $agent_filter, [], $strict_user, $acltags);
$strict_data['notinit_count'] = (int) groups_get_not_init_monitors($agent['id_grupo'], $agent_filter, [], $strict_user, $acltags);
$strict_data['total_count'] = (int) groups_get_total_monitors($agent['id_grupo'], $agent_filter, [], $strict_user, $acltags);
$status = agents_get_status_from_counts($strict_data);
} else {
$status = agents_get_status_from_counts($agent);
}
if (is_metaconsole() === true) {
$server_data = db_get_row(
'tmetaconsole_setup',
'id',
$agent['id_server']
);
}
if (empty($server_data) === true) {
$server_name = '';
$server_id = '';
$url_hash = '';
$console_url = '';
} else {
$server_name = $server_data['server_name'];
$server_id = $server_data['id'];
$console_url = $server_data['server_url'].'/';
$url_hash = metaconsole_get_servers_url_hash($server_data);
}
// Set node status.
switch ($status) {
case AGENT_STATUS_NORMAL:
$status_color = COL_NORMAL;
break;
case AGENT_STATUS_CRITICAL:
$status_color = COL_CRITICAL;
break;
case AGENT_STATUS_WARNING:
$status_color = COL_WARNING;
break;
case AGENT_STATUS_ALERT_FIRED:
$status_color = COL_ALERTFIRED;
break;
case AGENT_STATUS_NOT_INIT:
$status_color = COL_NOTINIT;
break;
default:
$status_color = COL_UNKNOWN;
break;
}
// Short name.
$name = io_safe_output($agent['nombre']);
if ((strlen($name) > 16) && ($cut_names)) {
$name = ui_print_truncate_text($name, 16, false, true, false);
}
if ((int) $simple === 0) {
if ($hack_networkmap_mobile) {
$img_node = ui_print_os_icon($agent['id_os'], false, true, true, true, true, true);
$img_node = $config['homedir'].'/'.$img_node;
$img_node = '';
} else {
// Set node icon.
$img_node = ui_print_os_icon($agent['id_os'], false, true, true, true, true, $relative);
$img_node = str_replace($config['homeurl'].'/', '', $img_node);
$img_node = str_replace($config['homeurl'], '', $img_node);
if (is_metaconsole() === true) {
$img_node = str_replace('../../', '', $img_node);
}
if ($relative === true) {
$img_node = html_print_image($img_node, true, false, false, true);
} else {
$img_node = html_print_image($img_node, true, false, false, false);
}
}
if (is_metaconsole() === true) {
if (can_user_access_node()) {
$url = ui_meta_get_url_console_child(
$id_server,
'estado',
'operation/agentes/ver_agente&id_agente='.$agent['id_agente']
);
} else {
$url = '';
}
$url_tooltip = '../../ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'&metaconsole=1&id_server='.$agent['id_server'];
} else {
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'];
$url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'];
}
$node = "\n".$agent['id_node'].' [ parent="'.$agent['id_parent'].'", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<'.$img_node.' |
'.io_safe_input($name).' | >,
shape="doublecircle", URL="'.$url.'",
tooltip="'.$url_tooltip.'"];'."\n";
} else {
$ajax_prefix = '';
$meta_params = '';
if (is_metaconsole() === true) {
$ajax_prefix = '../../';
$meta_params = '&metaconsole=1&id_server='.$id_server;
}
if (can_user_access_node()) {
$url_node_link = ', URL="'.$console_url.'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].$url_hash.'"';
} else {
$url_node_link = '';
}
$node = $agent['id_node'].' [ parent="'.$agent['id_parent'].'", color="'.$status_color.'", fontsize='.$font_size.', shape="doublecircle"'.$url_node_link.', style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="'.$ajax_prefix.'ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].$meta_params.'"];'."\n";
}
return $node;
}
/**
* Returns a module node definition.
*
* @param array $module Module definition.
* @param integer $simple Simple.
* @param integer $font_size Font size.
* @param boolean $metaconsole Metaconsole.
* @param integer $id_server Id server.
*
* @return string
*/
function networkmap_create_module_node(
$module,
$simple=0,
$font_size=10,
$metaconsole=false,
$id_server=null
) {
global $config;
global $hack_networkmap_mobile;
if (isset($module['status']) === true) {
$status = $module['status'];
} else {
$status = modules_get_agentmodule_status(
$module['id_agente_modulo'],
false,
$metaconsole,
$id_server
);
}
// Set node status.
switch ($status) {
case AGENT_MODULE_STATUS_NORMAL:
// Normal monitor.
$status_color = COL_NORMAL;
break;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
// Critical monitor.
$status_color = COL_CRITICAL;
break;
case AGENT_MODULE_STATUS_WARNING:
// Warning monitor.
$status_color = COL_WARNING;
break;
case AGENT_STATUS_ALERT_FIRED:
// Alert fired.
$status_color = COL_ALERTFIRED;
break;
default:
// Unknown monitor.
$status_color = COL_UNKNOWN;
break;
}
if ($hack_networkmap_mobile) {
$img_node = ui_print_moduletype_icon($module['id_tipo_modulo'], true, true, false, true);
$img_node = $config['homedir'].'/'.$img_node;
$img_node = '';
} else {
$img_node = ui_print_moduletype_icon($module['id_tipo_modulo'], true, true, false);
}
if ($simple == 0) {
if (is_metaconsole() === true) {
$url = '';
$url_tooltip = '../../ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'].'&metaconsole=1&id_server='.$module['id_server'];
} else {
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente'];
$url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'];
}
$node = $module['id_node'].' [ id_agent="'.$module['id_agente'].'", color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.30, height=0.30, label=<'.$img_node.' |
'.io_safe_output($module['nombre']).' | >,
shape="circle", URL="'.$url.'",
tooltip="'.$url_tooltip.'"];';
} else {
if (is_metaconsole() === true) {
$url = 'TODO';
$url_tooltip = '../../ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'].'&metaconsole=1&id_server='.$module['id_server'];
} else {
$url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$module['id_agente'];
$url_tooltip = 'ajax.php?page=operation/agentes/ver_agente&get_agentmodule_status_tooltip=1&id_module='.$module['id_agente_modulo'];
}
$node = $module['id_node'].' [ id_agent="'.$module['id_agente'].'", color="'.$status_color.'", fontsize='.$font_size.', shape="circle", URL="'.$url.'", style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="'.$url_tooltip.'"];';
}
return $node;
}
/**
* Returns the definition of the central module.
*
* @param string $name Name.
* @param integer $font_size Font size.
* @param integer $simple Simple.
* @param array $stats Stats.
*
* @return string
*/
function networkmap_create_pandora_node(
$name,
$font_size=10,
$simple=0,
$stats=[]
) {
global $hack_networkmap_mobile;
global $config;
$summary = [];
if (isset($stats['policies'])) {
$summary['policies'] = count($stats['policies']);
}
if (isset($stats['groups']) === true) {
// TODO: GET STATUS OF THE GROUPS AND ADD IT TO SUMMARY.
$summary['groups'] = count($stats['groups']);
}
if (isset($stats['agents']) === true) {
// TODO: GET STATUS OF THE AGENTS AND ADD IT TO SUMMARY.
$summary['agents'] = count($stats['agents']);
}
if (isset($stats['modules']) === true) {
// TODO: GET STATUS OF THE MODULES AND ADD IT TO SUMMARY.
$summary['modules'] = count($stats['modules']);
}
$stats_json = base64_encode(json_encode($summary));
$img_src = ui_get_logo_to_center_networkmap();
if (is_metaconsole() === true) {
$url_tooltip = '../../ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'&metaconsole=1';
$url = '';
$color = '#052938';
} else {
$url_tooltip = 'ajax.php?page=include/ajax/networkmap.ajax&action=get_networkmap_summary&stats='.$stats_json.'", URL="index.php?sec=estado&sec2=operation/agentes/group_view';
$url = 'index.php?sec=estado&sec2=operation/agentes/group_view';
$color = '#373737';
}
if ($hack_networkmap_mobile) {
$img = ' |