mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
newdevice: Added Coriant support (#6026)
* Added Coriant TNMS MIB and MEF (Metro Ethernet Forum) MIB * Coriant Logo * Added Basic Librenms Support and MEF support * Forgot snmpsim * Better like this * Spaces ! * Renamed sql file * Space * Fix spaces * svgo optimized logo * Removed modules that are by default to 0 * Added sysDescr as requested * Fix conflict file * Setting right severity id in the discovery log_event() * Since MEF-EVC can be used on other devices than Coriant's one, lets this be used by the poller/discovery itself * Fixed spaces * Rename 173.sql to 174.sql * Moved logo from os/ to logos/ Addd Icon * Fix name * minimize file * Change l/w to viewbox and minify * Renamed mef-evc to mef on request from @laf * Rename 174.sql to 175.sql
This commit is contained in:
committed by
Tony Murray
parent
872eb225dd
commit
fa29839d36
70
includes/discovery/mef.inc.php
Normal file
70
includes/discovery/mef.inc.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Try to discover any MEF Links
|
||||
*/
|
||||
|
||||
/*
|
||||
* Variable to hold the discovered MEF Links.
|
||||
*/
|
||||
|
||||
$mef_list = array();
|
||||
|
||||
/*
|
||||
* Fetch information about MEF Links.
|
||||
*/
|
||||
|
||||
$oids = snmpwalk_cache_multi_oid($device, 'MefServiceEvcCfgEntry', $oids, 'MEF-UNI-EVC-MIB');
|
||||
|
||||
echo "MEF : ";
|
||||
foreach ($oids as $index => $entry) {
|
||||
$mefIdent = $entry['mefServiceEvcCfgIdentifier'];
|
||||
$mefType = $entry['mefServiceEvcCfgServiceType'];
|
||||
$mefMtu = $entry['mefServiceEvcCfgMtuSize'];
|
||||
$mefAdmState = $entry['mefServiceEvcCfgAdminState'];
|
||||
$mefRowState = $entry['mefServiceEvcCfgRowStatus'];
|
||||
|
||||
/*
|
||||
* Coriant MEF-EVC is quite strange, MTU is sometime set to 0 setting it to "strange" default value
|
||||
* According to Coriant this should be fixed in Nov 2017.
|
||||
*/
|
||||
if (($mefMtu == 0) && ($device['os'] == 'coriant')) {
|
||||
$mefMtu = 1600;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the MEF is already known for this host
|
||||
*/
|
||||
if (dbFetchCell("SELECT COUNT(id) FROM `mefinfo` WHERE `device_id` = ? AND `mefID` = ?", array($device['device_id'], $index)) == 0) {
|
||||
$mefid = dbInsert(array('device_id' => $device['device_id'], 'mefID' => $index, 'mefType' => mres($mefType), 'mefIdent' => mres($mefIdent), 'mefMTU' => mres($mefMtu), 'mefAdmState' => mres($mefAdmState), 'mefRowState' => mres($mefRowState)), 'mefinfo');
|
||||
log_event("MEF link: ". mres($mefIdent) . " (" . $index . ") Discovered", $device, 'system', 2);
|
||||
echo '+';
|
||||
} else {
|
||||
echo '.';
|
||||
}
|
||||
/*
|
||||
* Save the discovered MEF Link
|
||||
*/
|
||||
$mef_list[] = $index;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a list of all the known MEF Links for this host
|
||||
*/
|
||||
|
||||
$sql = "SELECT id, mefID, mefIdent FROM mefinfo WHERE device_id = '".$device['device_id']."'";
|
||||
foreach (dbFetchRows($sql) as $db_mef) {
|
||||
/*
|
||||
* Delete the MEF Link that are removed from the host.
|
||||
*/
|
||||
if (!in_array($db_mef['mefID'], $mef_list)) {
|
||||
dbDelete('mefinfo', '`id` = ?', array($db_mef['id']));
|
||||
log_event("MEF link: ".mres($db_mef['mefIdent']).' Removed', $device, 'system', 3);
|
||||
echo '-';
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Finished MEF information
|
||||
*/
|
||||
unset($mef_list, $oids, $db_mef);
|
||||
echo PHP_EOL;
|
Reference in New Issue
Block a user