mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
newdevice: Changed Solaris and Allied discovery to yaml (#6900)
Add SunOS to callback sanitize
This commit is contained in:
committed by
Neil Lathwood
parent
092f6922a9
commit
d47b58bf6d
@@ -79,8 +79,8 @@ if ($enabled == 1) {
|
||||
|
||||
// sanitize sysDescr
|
||||
$device_info = array_map(function ($entry) {
|
||||
// remove hostnames from linux and macosx
|
||||
$entry['sysDescr'] = preg_replace_callback('/^(Linux |Darwin |FreeBSD )[A-Za-z0-9._\-]+ ([0-9.]{3,9})/', function ($matches) {
|
||||
// remove hostnames from linux, macosx, and SunOS
|
||||
$entry['sysDescr'] = preg_replace_callback('/^(Linux |Darwin |FreeBSD |SunOS )[A-Za-z0-9._\-]+ ([0-9.]{3,9})/', function ($matches) {
|
||||
return $matches[1] . 'hostname ' .$matches[2];
|
||||
}, $entry['sysDescr']);
|
||||
|
||||
|
||||
@@ -4,3 +4,7 @@ type: network
|
||||
ifname: 1
|
||||
over:
|
||||
- { graph: device_bits, text: Traffic }
|
||||
discovery:
|
||||
-
|
||||
sysObjectId: .1.3.6.1.4.1.207.
|
||||
sysObjectId_except: .1.3.6.1.4.1.207.1.4.126
|
||||
|
||||
@@ -6,3 +6,7 @@ processor_stacked: 1
|
||||
over:
|
||||
- { graph: device_processor, text: 'Processor Usage' }
|
||||
- { graph: device_ucd_memory, text: 'Memory Usage' }
|
||||
discovery:
|
||||
-
|
||||
sysObjectId: .1.3.6.1.4.1.8072.3.2.3
|
||||
sysDescr_regex: '/^SunOS oi_.* 5\.11/'
|
||||
|
||||
@@ -6,3 +6,7 @@ processor_stacked: 1
|
||||
over:
|
||||
- { graph: device_processor, text: 'Processor Usage' }
|
||||
- { graph: device_ucd_memory, text: 'Memory Usage' }
|
||||
discovery:
|
||||
-
|
||||
sysObjectId: .1.3.6.1.4.1.8072.3.2.3
|
||||
sysDescr_regex: '/^SunOS .+ 5\.11 [^1]/'
|
||||
|
||||
@@ -6,3 +6,11 @@ processor_stacked: 1
|
||||
over:
|
||||
- { graph: device_processor, text: 'Processor Usage' }
|
||||
- { graph: device_ucd_memory, text: 'Memory Usage' }
|
||||
discovery:
|
||||
- sysObjectId: .1.3.6.1.4.1.42.2.1.1
|
||||
-
|
||||
sysObjectId: .1.3.6.1.4.1.8072.3.2.3
|
||||
sysDescr_regex: '/^SunOS .+ 5\.10/'
|
||||
-
|
||||
sysObjectId: .1.3.6.1.4.1.8072.3.2.3
|
||||
sysDescr_regex: '/^SunOS .+ 5\.11 11/'
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (starts_with($sysObjectId, '.1.3.6.1.4.1.207') && !starts_with($sysObjectId, '.1.3.6.1.4.1.207.1.4.126')) {
|
||||
$os = 'allied';
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (starts_with($sysDescr, 'SunOS')) {
|
||||
list(,,$version) = explode(' ', $sysDescr);
|
||||
|
||||
if (version_compare($version, '5.10', '>')) {
|
||||
if (str_contains($sysDescr, 'oi_')) {
|
||||
$os = 'openindiana';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (starts_with($sysObjectId, '.1.3.6.1.4.1.42.2.1.1')) {
|
||||
$os = 'solaris';
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (starts_with($sysDescr, 'SunOS')) {
|
||||
list(,,$version) = explode(' ', $sysDescr);
|
||||
|
||||
if (version_compare($version, '5.10', '>')) {
|
||||
if (!str_contains($sysDescr, 'oi_')) {
|
||||
$os = 'opensolaris';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (starts_with($sysDescr, 'SunOS')) {
|
||||
$os = 'solaris';
|
||||
list(,,$version) = explode(' ', $sysDescr);
|
||||
|
||||
if (version_compare($version, '5.10', '>')) {
|
||||
unset($os);
|
||||
}
|
||||
}
|
||||
|
||||
if (starts_with($sysObjectId, '.1.3.6.1.4.1.42.2.1.1')) {
|
||||
$os = 'solaris';
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
1.3.6.1.2.1.1.1.0|4|SunOS oi_ 5.11
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.3
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
1.3.6.1.2.1.1.1.0|4|SunOS Something 5.10
|
||||
1.3.6.1.2.1.1.1.0|4|SunOS host-name 5.10 Generic_144488-06 sun4u
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.3
|
||||
|
||||
2
tests/snmpsim/solaris_11.snmprec
Normal file
2
tests/snmpsim/solaris_11.snmprec
Normal file
@@ -0,0 +1,2 @@
|
||||
1.3.6.1.2.1.1.1.0|4|SunOS hostname 5.11 11.3 i86pc
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.3
|
||||
Reference in New Issue
Block a user