mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
newdevice: Added better hardware and version identification for SAF (#7378)
* Proper hardware and version identification * Replaced str_replace with preg_match
This commit is contained in:
committed by
Neil Lathwood
parent
0713963ed4
commit
554b40eb3f
@ -23,6 +23,8 @@
|
||||
* @author Neil Lathwood <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
$saf_integra = preg_split('/;/', $poll_device['sysDescr']);
|
||||
preg_match('/Prod: ([A-Za-z-_]+);Vers: ([0-9.]+);.*;S\/N: ([0-9]+)/', $poll_device['sysDescr'], $matches);
|
||||
|
||||
$serial = str_replace('S/N: ', '', $saf_integra[8]);
|
||||
$hardware = $matches[1];
|
||||
$version = $matches[2];
|
||||
$serial = $matches[3];
|
||||
|
@ -23,6 +23,8 @@
|
||||
* @author Neil Lathwood <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
$saf_integra = preg_split('/;/', $poll_device['sysDescr']);
|
||||
preg_match('/Prod: ([A-Za-z-_]+);Vers: ([0-9.]+-(mux|esw));.*;S\/N: ([0-9]+)/', $poll_device['sysDescr'], $matches);
|
||||
|
||||
$serial = str_replace('S/N: ', '', $saf_integra[8]);
|
||||
$hardware = $matches[1];
|
||||
$version = $matches[2];
|
||||
$serial = $matches[4];
|
||||
|
@ -12,6 +12,8 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
list(,$version,,$hardware,$serial,,) = explode(";", $poll_device['sysDescr']);
|
||||
list(,$hardware) = explode(":", $hardware);
|
||||
list(,$serial) = explode(":", $serial);
|
||||
preg_match('/ radio;(.*) v([0-9.]*);.*;SN: ([0-9]+);/', $poll_device['sysDescr'], $matches);
|
||||
|
||||
$hardware = $matches[1];
|
||||
$version = $matches[2];
|
||||
$serial = $matches[3];
|
||||
|
Reference in New Issue
Block a user