$parent_id) { $graph .= create_edge ($node, $parent_id); } // Define edges for orphan nodes foreach (array_keys($orphans) as $node) { $graph .= create_edge ('0', $node); } // Close graph $graph .= close_graph (); return $graph; } // Returns an edge definition function create_edge ($head, $tail) { $edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false];'; return $edge; } // Returns a node definition function create_node ($agent, $simple = 0, $font_size = 10) { $sql = sprintf ('SELECT COUNT(tagente_modulo.id_agente) FROM tagente_estado, tagente_modulo WHERE tagente_modulo.id_agente = %d AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100) AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_estado.estado = 1', $agent['id_agente']); $bad_modules = get_db_sql ($sql); // Set node status if ($bad_modules) { $status_color = '#FF1D1D'; } else { $status_color = '#8DFF1D'; } // Check for alert $sql = sprintf ('SELECT COUNT(talerta_agente_modulo.id_aam) FROM talerta_agente_modulo, tagente_modulo, tagente WHERE tagente.id_agente = %d AND tagente.disabled = 0 AND tagente.id_agente = tagente_modulo.id_agente AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente_modulo = talerta_agente_modulo.id_agente_modulo AND talerta_agente_modulo.times_fired > 0 ', $agent['id_agente']); $alert_modules = get_db_sql ($sql); if ($alert_modules) $status_color = '#FFE308'; // Short name $name = strtolower ($agent["nombre"]); if (strlen ($name) > 16) $name = substr ($name, 0, 16); if ($simple == 0){ // Set node icon if (file_exists ('images/networkmap/'.$agent['id_os'].'.png')) { $img_node = 'images/networkmap/'.$agent['id_os'].'.png'; } else { $img_node = 'images/networkmap/0.png'; } $node = $agent['id_agente'].' [ color="'.$status_color.'", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<
'.$name.' |
'.$name.' |
system()
call (PHP Safe Mode or SELinux)";
return;
}
?>