mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Syntax update
This commit is contained in:
@@ -736,8 +736,8 @@ $config['discovery_modules']['vlans'] = 1;
|
|||||||
$config['discovery_modules']['cisco-mac-accounting'] = 1;
|
$config['discovery_modules']['cisco-mac-accounting'] = 1;
|
||||||
$config['discovery_modules']['cisco-pw'] = 1;
|
$config['discovery_modules']['cisco-pw'] = 1;
|
||||||
$config['discovery_modules']['cisco-vrf'] = 1;
|
$config['discovery_modules']['cisco-vrf'] = 1;
|
||||||
$config['discovery_modules']['cisco-vrf-lite'] = 1;
|
$config['discovery_modules']['cisco-vrf-lite'] = 1;
|
||||||
// $config['discovery_modules']['cisco-cef'] = 1;
|
//$config['discovery_modules']['cisco-cef'] = 1;
|
||||||
$config['discovery_modules']['cisco-sla'] = 1;
|
$config['discovery_modules']['cisco-sla'] = 1;
|
||||||
$config['discovery_modules']['vmware-vminfo'] = 1;
|
$config['discovery_modules']['vmware-vminfo'] = 1;
|
||||||
$config['discovery_modules']['libvirt-vminfo'] = 1;
|
$config['discovery_modules']['libvirt-vminfo'] = 1;
|
||||||
|
@@ -7,9 +7,10 @@ echo 'ARP Table : ';
|
|||||||
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
||||||
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$vrfs_lite_cisco = array(array('context_name'=>null));
|
$vrfs_lite_cisco = array(array('context_name'=>null));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($vrfs_lite_cisco as $vrf) {
|
foreach ($vrfs_lite_cisco as $vrf) {
|
||||||
$device['context_name']=$vrf['context_name'];
|
$device['context_name']=$vrf['context_name'];
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ foreach ($vrfs_lite_cisco as $vrf) {
|
|||||||
dbUpdate(array('mac_address' => $clean_mac), 'ipv4_mac', 'port_id=? AND ipv4_address=? AND `context_name`= ?', array($interface['port_id'], $ip, $device['context_name']));
|
dbUpdate(array('mac_address' => $clean_mac), 'ipv4_mac', 'port_id=? AND ipv4_address=? AND `context_name`= ?', array($interface['port_id'], $ip, $device['context_name']));
|
||||||
echo '.';
|
echo '.';
|
||||||
}
|
}
|
||||||
else if (isset($interface['port_id'])) {
|
elseif (isset($interface['port_id'])) {
|
||||||
echo '+';
|
echo '+';
|
||||||
// echo("Add MAC $mac\n");
|
// echo("Add MAC $mac\n");
|
||||||
$insert_data = array(
|
$insert_data = array(
|
||||||
|
@@ -7,7 +7,7 @@ if ($config['enable_bgp']) {
|
|||||||
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
||||||
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$vrfs_lite_cisco = array(array('context_name'=>null));
|
$vrfs_lite_cisco = array(array('context_name'=>null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,6 @@ if ($config['enable_bgp']) {
|
|||||||
echo '-';
|
echo '-';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($peerlist);
|
unset($peerlist);
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
@@ -24,10 +24,8 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
|
|
||||||
// For the moment only will be cisco and the version 3
|
// For the moment only will be cisco and the version 3
|
||||||
if ($device['os_group'] == "cisco" && $device['snmpver'] == 'v3') {
|
if ($device['os_group'] == "cisco" && $device['snmpver'] == 'v3') {
|
||||||
|
|
||||||
echo ("VRF lite cisco : \n");
|
echo ("VRF lite cisco : \n");
|
||||||
$mib = "SNMP-COMMUNITY-MIB";
|
$mib = "SNMP-COMMUNITY-MIB";
|
||||||
|
|
||||||
$mib = "CISCO-CONTEXT-MAPPING-MIB";
|
$mib = "CISCO-CONTEXT-MAPPING-MIB";
|
||||||
//-Osq because if i put the n the oid from the first command is not the same of this one
|
//-Osq because if i put the n the oid from the first command is not the same of this one
|
||||||
$listVrf = snmp_walk($device, "cContextMappingVrfName", "-Osq -Ln", $mib, NULL);
|
$listVrf = snmp_walk($device, "cContextMappingVrfName", "-Osq -Ln", $mib, NULL);
|
||||||
@@ -35,10 +33,8 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
$listVrf = str_replace('"', "", $listVrf);
|
$listVrf = str_replace('"', "", $listVrf);
|
||||||
$listVrf = trim($listVrf);
|
$listVrf = trim($listVrf);
|
||||||
|
|
||||||
if ($debug) {
|
d_echo("\n[DEBUG]\nUsing $mib\n[/DEBUG]\n");
|
||||||
echo ("\n[DEBUG]\nUsing $mib\n[/DEBUG]\n");
|
d_echo("\n[DEBUG List Vrf only name]\n$listVrf\n[/DEBUG]\n");
|
||||||
echo ("\n[DEBUG List Vrf only name]\n$listVrf\n[/DEBUG]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
$tableVrf;
|
$tableVrf;
|
||||||
foreach (explode("\n", $listVrf) as $lineVrf) {
|
foreach (explode("\n", $listVrf) as $lineVrf) {
|
||||||
@@ -48,20 +44,16 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
$tableVrf[$tmpVrf[0]]['vrf_name'] = $tmpVrf[1];
|
$tableVrf[$tmpVrf[0]]['vrf_name'] = $tmpVrf[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($listVrf);
|
unset($listVrf);
|
||||||
|
|
||||||
$listIntance = snmp_walk($device, "cContextMappingProtoInstName", "-Osq -Ln", $mib, NULL);
|
$listIntance = snmp_walk($device, "cContextMappingProtoInstName", "-Osq -Ln", $mib, NULL);
|
||||||
$listIntance = str_replace("cContextMappingProtoInstName.", "", $listIntance);
|
$listIntance = str_replace("cContextMappingProtoInstName.", "", $listIntance);
|
||||||
$listIntance = str_replace('"', "", $listIntance);
|
$listIntance = str_replace('"', "", $listIntance);
|
||||||
$listIntance = trim($listIntance);
|
$listIntance = trim($listIntance);
|
||||||
|
|
||||||
if ($debug) {
|
d_echo ("\n[DEBUG]\nUsing $mib\n[/DEBUG]\n");
|
||||||
echo ("\n[DEBUG]\nUsing $mib\n[/DEBUG]\n");
|
d_echo ("\n[DEBUG]\n List Intance only names\n$listIntance\n[/DEBUG]\n");
|
||||||
echo ("\n[DEBUG]\n List Intance only names\n$listIntance\n[/DEBUG]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach (explode("\n", $listIntance) as $lineIntance) {
|
foreach (explode("\n", $listIntance) as $lineIntance) {
|
||||||
$tmpIntance = explode(" ", $lineIntance, 2);
|
$tmpIntance = explode(" ", $lineIntance, 2);
|
||||||
//the $tmpIntance[0] will be the context and $tmpIntance[1] the intance
|
//the $tmpIntance[0] will be the context and $tmpIntance[1] the intance
|
||||||
@@ -70,14 +62,9 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($listIntance);
|
unset($listIntance);
|
||||||
|
|
||||||
|
|
||||||
foreach ($tableVrf as $context => $vrf) {
|
foreach ($tableVrf as $context => $vrf) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
|
|
||||||
echo ("\n[DEBUG]\nRelation:t" . $context . "t" . $vrf['intance'] . "t" . $vrf['vrf'] . "\n[/DEBUG]\n");
|
echo ("\n[DEBUG]\nRelation:t" . $context . "t" . $vrf['intance'] . "t" . $vrf['vrf'] . "\n[/DEBUG]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,9 +73,7 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
$context
|
$context
|
||||||
));
|
));
|
||||||
if (!empty($tmpVrf)) {
|
if (!empty($tmpVrf)) {
|
||||||
|
|
||||||
$ids[$tmpVrf['vrf_lite_cisco_id']] = $tmpVrf['vrf_lite_cisco_id'];
|
$ids[$tmpVrf['vrf_lite_cisco_id']] = $tmpVrf['vrf_lite_cisco_id'];
|
||||||
|
|
||||||
$vrfUpdate=array();
|
$vrfUpdate=array();
|
||||||
|
|
||||||
foreach ($vrfUpdate as $key => $value) {
|
foreach ($vrfUpdate as $key => $value) {
|
||||||
@@ -102,25 +87,21 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$id = dbInsert(array(
|
$id = dbInsert(array(
|
||||||
'device_id' => $device ['device_id'],
|
'device_id' => $device ['device_id'],
|
||||||
'context_name' => $context,
|
'context_name' => $context,
|
||||||
'intance_name' => $vrf['intance_name'],
|
'intance_name' => $vrf['intance_name'],
|
||||||
'vrf_name' => $vrf['vrf_name']
|
'vrf_name' => $vrf['vrf_name']
|
||||||
), 'vrf_lite_cisco');
|
), 'vrf_lite_cisco');
|
||||||
|
|
||||||
$ids[$id] = $id;
|
$ids[$id] = $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($tableVrf);
|
unset($tableVrf);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get all vrf_lite_cisco, this will used where the value depend of the context, be careful with the order that you call this module, if the module is disabled the context search will not work
|
//get all vrf_lite_cisco, this will used where the value depend of the context, be careful with the order that you call this module, if the module is disabled the context search will not work
|
||||||
$tmpVrfC = dbFetchRows("SELECT * FROM vrf_lite_cisco WHERE device_id = ? ", array(
|
$tmpVrfC = dbFetchRows("SELECT * FROM vrf_lite_cisco WHERE device_id = ? ", array(
|
||||||
$device ['device_id']));
|
$device ['device_id']));
|
||||||
|
|
||||||
$device['vrf_lite_cisco'] = $tmpVrfC;
|
$device['vrf_lite_cisco'] = $tmpVrfC;
|
||||||
|
|
||||||
//Delete all vrf that chaged
|
//Delete all vrf that chaged
|
||||||
@@ -129,14 +110,10 @@ if ($config['enable_vrf_lite_cisco']) {
|
|||||||
}
|
}
|
||||||
if (!empty($ids)) {
|
if (!empty($ids)) {
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
|
dbDelete('vrf_lite_cisco', 'vrf_lite_cisco_id = ? ', array($id));
|
||||||
dbDelete('vrf_lite_cisco', 'vrf_lite_cisco_id = ? ', array(
|
|
||||||
$id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unset($ids);
|
unset($ids);
|
||||||
unset($tmpVrfC);
|
unset($tmpVrfC);
|
||||||
} // enable_vrf_lite_cisco
|
} // enable_vrf_lite_cisco
|
||||||
?>
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo 'IPv4 Addresses : ';
|
echo 'IPv4 Addresses : ';
|
||||||
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!= 0) ){
|
||||||
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$vrfs_lite_cisco = array(array('context_name'=>null));
|
$vrfs_lite_cisco = array(array('context_name'=>null));
|
||||||
}
|
}
|
||||||
foreach ($vrfs_lite_cisco as $vrf) {
|
foreach ($vrfs_lite_cisco as $vrf) {
|
||||||
|
@@ -4,7 +4,7 @@ echo 'IPv6 Addresses : ';
|
|||||||
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
if( key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco'])!=0) ){
|
||||||
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$vrfs_lite_cisco = array(array('context_name'=>null));
|
$vrfs_lite_cisco = array(array('context_name'=>null));
|
||||||
}
|
}
|
||||||
foreach ($vrfs_lite_cisco as $vrf) {
|
foreach ($vrfs_lite_cisco as $vrf) {
|
||||||
|
Reference in New Issue
Block a user