mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Cisco OTV cast issue building empty adj (#9968)
This commit is contained in:
@@ -132,48 +132,50 @@ if ($device['os_group'] == 'cisco') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add each adjacency to the array.
|
// Add each adjacency to the array.
|
||||||
foreach ((array)$tblAdjacentDevName as $key => $value) {
|
if ($tblAdjacentDevName) {
|
||||||
preg_match('/^1.3.6.1.4.1.9.9.810.1.3.1.1.4.(\d+).1.4.(\d+.\d+.\d+.\d+)$/', $key, $matches);
|
foreach ((array)$tblAdjacentDevName as $key => $value) {
|
||||||
$result = array();
|
preg_match('/^1.3.6.1.4.1.9.9.810.1.3.1.1.4.(\d+).1.4.(\d+.\d+.\d+.\d+)$/', $key, $matches);
|
||||||
$result['index'] = $matches[1];
|
$result = array();
|
||||||
$result['endpoint'] = $matches[2];
|
$result['index'] = $matches[1];
|
||||||
$tblEndpoints[$value] = true;
|
$result['endpoint'] = $matches[2];
|
||||||
$result['otvtype'] = 'adjacency';
|
$tblEndpoints[$value] = true;
|
||||||
$result['UID'] = $result['otvtype']."-".$result['index']."-".str_replace(' ', '', $tblAdjacencyDatabaseEntry['1.3.6.1.4.1.9.9.810.1.3.1.1.3.'.$result['index'].'.1.4.'.$result['endpoint']]);
|
$result['otvtype'] = 'adjacency';
|
||||||
$result['uptime'] = $tblAdjacencyDatabaseEntry['1.3.6.1.4.1.9.9.810.1.3.1.1.6.'.$result['index'].'.1.4.'.$result['endpoint']];
|
$result['UID'] = $result['otvtype']."-".$result['index']."-".str_replace(' ', '', $tblAdjacencyDatabaseEntry['1.3.6.1.4.1.9.9.810.1.3.1.1.3.'.$result['index'].'.1.4.'.$result['endpoint']]);
|
||||||
$message = false;
|
$result['uptime'] = $tblAdjacencyDatabaseEntry['1.3.6.1.4.1.9.9.810.1.3.1.1.6.'.$result['index'].'.1.4.'.$result['endpoint']];
|
||||||
if ($tblAdjacencyDatabaseEntry['1.3.6.1.4.1.9.9.810.1.3.1.1.5.'.$result['index'].'.1.4.'.$result['endpoint']] != 1) {
|
$message = false;
|
||||||
$message .= "Adjacency is Down\n";
|
if ($tblAdjacencyDatabaseEntry['1.3.6.1.4.1.9.9.810.1.3.1.1.5.'.$result['index'].'.1.4.'.$result['endpoint']] != 1) {
|
||||||
}
|
$message .= "Adjacency is Down\n";
|
||||||
|
|
||||||
// If we have set a message, we have an error, activate alert.
|
|
||||||
if ($message !== false) {
|
|
||||||
$result['error'] = $message;
|
|
||||||
$result['status'] = 1;
|
|
||||||
} else {
|
|
||||||
$result['error'] = "";
|
|
||||||
$result['status'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set a default name, if for some unknown reason we cant find the parent VPN.
|
|
||||||
$result['label'] = "Unknown (".$result['index'].") - ".$value;
|
|
||||||
// We need to search the existing array to build the name
|
|
||||||
foreach ($tblOTV as $item) {
|
|
||||||
if (($item['otvtype'] == 'overlay') && ($item['index'] == $result['index'])) {
|
|
||||||
$result['label'] = $item['label']." - ".$value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have set a message, we have an error, activate alert.
|
||||||
|
if ($message !== false) {
|
||||||
|
$result['error'] = $message;
|
||||||
|
$result['status'] = 1;
|
||||||
|
} else {
|
||||||
|
$result['error'] = "";
|
||||||
|
$result['status'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set a default name, if for some unknown reason we cant find the parent VPN.
|
||||||
|
$result['label'] = "Unknown (".$result['index'].") - ".$value;
|
||||||
|
// We need to search the existing array to build the name
|
||||||
|
foreach ($tblOTV as $item) {
|
||||||
|
if (($item['otvtype'] == 'overlay') && ($item['index'] == $result['index'])) {
|
||||||
|
$result['label'] = $item['label']." - ".$value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's log some debugging
|
||||||
|
d_echo("\n\nAdjacency: ".$result['label']."\n");
|
||||||
|
d_echo(" Endpoint: ".$result['endpoint']."\n");
|
||||||
|
d_echo(" Index: ".$result['index']."\n");
|
||||||
|
d_echo(" UID: ".$result['UID']."\n");
|
||||||
|
d_echo(" Status: ".$result['status']."\n");
|
||||||
|
d_echo(" Message: ".$result['error']."\n");
|
||||||
|
|
||||||
|
// Add the result to the parent array.
|
||||||
|
$tblOTV[] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's log some debugging
|
|
||||||
d_echo("\n\nAdjacency: ".$result['label']."\n");
|
|
||||||
d_echo(" Endpoint: ".$result['endpoint']."\n");
|
|
||||||
d_echo(" Index: ".$result['index']."\n");
|
|
||||||
d_echo(" UID: ".$result['UID']."\n");
|
|
||||||
d_echo(" Status: ".$result['status']."\n");
|
|
||||||
d_echo(" Message: ".$result['error']."\n");
|
|
||||||
|
|
||||||
// Add the result to the parent array.
|
|
||||||
$tblOTV[] = $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We retain a list of all endpoints to tie the RRD to.
|
// We retain a list of all endpoints to tie the RRD to.
|
||||||
|
|||||||
Reference in New Issue
Block a user