2014-03-31 Alejandro Gallardo <alejandro.gallardo@artica.es>
* include/functions_networkmap.php: Updated the function "networkmap_generate_dot" to fix a regex and delete the central node if the L2 network interfaces is true. * operation/agentes/estado_generalagente.php: Fixed some regex. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9690 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c975f63ca6
commit
f0bc21f91d
|
@ -1,3 +1,12 @@
|
||||||
|
2014-03-31 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||||
|
|
||||||
|
* include/functions_networkmap.php: Updated the function
|
||||||
|
"networkmap_generate_dot" to fix a regex and delete the
|
||||||
|
central node if the L2 network interfaces is true.
|
||||||
|
|
||||||
|
* operation/agentes/estado_generalagente.php: Fixed
|
||||||
|
some regex.
|
||||||
|
|
||||||
2014-03-31 Vanessa Gil <vanessa.gil@artica.es>
|
2014-03-31 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
|
|
||||||
* pandoradb.oracle.sql
|
* pandoradb.oracle.sql
|
||||||
|
|
|
@ -328,7 +328,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
||||||
$node_count ++;
|
$node_count ++;
|
||||||
|
|
||||||
// Try to get the interface name
|
// Try to get the interface name
|
||||||
if (preg_match ("/_(\w+)/" , (string)$module['nombre'], $matches)) {
|
if (preg_match ("/_(.+)$/" , (string)$module['nombre'], $matches)) {
|
||||||
if ($matches[1]) {
|
if ($matches[1]) {
|
||||||
$module['nombre'] = $matches[1];
|
$module['nombre'] = $matches[1];
|
||||||
}
|
}
|
||||||
|
@ -393,16 +393,6 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a central node if orphan nodes exist
|
|
||||||
if (count ($orphans) || empty ($nodes)) {
|
|
||||||
$graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple, $stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define edges for the module interfaces relations
|
// Define edges for the module interfaces relations
|
||||||
if ($l2_network) {
|
if ($l2_network) {
|
||||||
// Get the remote_snmp_proc relations
|
// Get the remote_snmp_proc relations
|
||||||
|
@ -418,6 +408,18 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Define edges for the orphan nodes
|
||||||
|
else {
|
||||||
|
// Create a central node if orphan nodes exist
|
||||||
|
if (count ($orphans) || empty ($nodes)) {
|
||||||
|
$graph .= networkmap_create_pandora_node ($pandora_name, $font_size, $simple, $stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close graph
|
// Close graph
|
||||||
$graph .= networkmap_close_graph ();
|
$graph .= networkmap_close_graph ();
|
||||||
|
|
|
@ -346,7 +346,7 @@ if (! empty($modules)) {
|
||||||
foreach ($modules as $key => $module) {
|
foreach ($modules as $key => $module) {
|
||||||
|
|
||||||
// Trying to get the interface name from the module name
|
// Trying to get the interface name from the module name
|
||||||
if (preg_match ("/_(\w+)/" , (string)$module['nombre'], $matches)) {
|
if (preg_match ("/_(.+)$/", (string)$module['nombre'], $matches)) {
|
||||||
if ($matches[1]) {
|
if ($matches[1]) {
|
||||||
$interface_name = $matches[1];
|
$interface_name = $matches[1];
|
||||||
|
|
||||||
|
@ -358,14 +358,16 @@ if (! empty($modules)) {
|
||||||
|
|
||||||
$ip_target = "--";
|
$ip_target = "--";
|
||||||
// Trying to get something like an IP from the description
|
// Trying to get something like an IP from the description
|
||||||
if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/" , (string)$module['ip_target'], $matches)) {
|
if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", (string)$module['descripcion'], $matches) ||
|
||||||
|
preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]|
|
||||||
|
(2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", (string)$module['descripcion'], $matches)) {
|
||||||
if ($matches[0]) {
|
if ($matches[0]) {
|
||||||
$ip_target = $matches[0];
|
$ip_target = $matches[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$description = "--";
|
$description = "--";
|
||||||
// Trying to get something like a mac from the description
|
// Trying to get something like a mac from the description
|
||||||
if (preg_match ("/([0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2})/i" , (string)$module['descripcion'], $matches)) {
|
if (preg_match ("/([0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2})/i", (string)$module['descripcion'], $matches)) {
|
||||||
if ($matches[0]) {
|
if ($matches[0]) {
|
||||||
$description = $matches[0];
|
$description = $matches[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue