diff --git a/includes/callback.php b/includes/callback.php index 9dbb3c58d5..0687d3939f 100644 --- a/includes/callback.php +++ b/includes/callback.php @@ -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']); diff --git a/includes/definitions/allied.yaml b/includes/definitions/allied.yaml index 161837972a..2031f8ab2a 100644 --- a/includes/definitions/allied.yaml +++ b/includes/definitions/allied.yaml @@ -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 diff --git a/includes/definitions/openindiana.yaml b/includes/definitions/openindiana.yaml index f476f822a4..5918f96a74 100644 --- a/includes/definitions/openindiana.yaml +++ b/includes/definitions/openindiana.yaml @@ -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/' diff --git a/includes/definitions/opensolaris.yaml b/includes/definitions/opensolaris.yaml index ccc4c083b5..87c9b3f0b6 100644 --- a/includes/definitions/opensolaris.yaml +++ b/includes/definitions/opensolaris.yaml @@ -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]/' diff --git a/includes/definitions/solaris.yaml b/includes/definitions/solaris.yaml index 5698136d9a..e1bdcbf5fb 100644 --- a/includes/definitions/solaris.yaml +++ b/includes/definitions/solaris.yaml @@ -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/' diff --git a/includes/discovery/os/allied.inc.php b/includes/discovery/os/allied.inc.php deleted file mode 100644 index ce073ab206..0000000000 --- a/includes/discovery/os/allied.inc.php +++ /dev/null @@ -1,5 +0,0 @@ -')) { - if (str_contains($sysDescr, 'oi_')) { - $os = 'openindiana'; - } - } -} - -if (starts_with($sysObjectId, '.1.3.6.1.4.1.42.2.1.1')) { - $os = 'solaris'; -} diff --git a/includes/discovery/os/opensolaris.inc.php b/includes/discovery/os/opensolaris.inc.php deleted file mode 100644 index af7a94aa93..0000000000 --- a/includes/discovery/os/opensolaris.inc.php +++ /dev/null @@ -1,11 +0,0 @@ -')) { - if (!str_contains($sysDescr, 'oi_')) { - $os = 'opensolaris'; - } - } -} diff --git a/includes/discovery/os/solaris.inc.php b/includes/discovery/os/solaris.inc.php deleted file mode 100644 index 5f7c73688c..0000000000 --- a/includes/discovery/os/solaris.inc.php +++ /dev/null @@ -1,14 +0,0 @@ -')) { - unset($os); - } -} - -if (starts_with($sysObjectId, '.1.3.6.1.4.1.42.2.1.1')) { - $os = 'solaris'; -} diff --git a/tests/snmpsim/openindiana.snmprec b/tests/snmpsim/openindiana.snmprec index 4bad905216..9eac992fd4 100644 --- a/tests/snmpsim/openindiana.snmprec +++ b/tests/snmpsim/openindiana.snmprec @@ -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 diff --git a/tests/snmpsim/solaris.snmprec b/tests/snmpsim/solaris.snmprec index 7e64a074ab..c669771f3e 100644 --- a/tests/snmpsim/solaris.snmprec +++ b/tests/snmpsim/solaris.snmprec @@ -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 diff --git a/tests/snmpsim/solaris_11.snmprec b/tests/snmpsim/solaris_11.snmprec new file mode 100644 index 0000000000..f16700aeb3 --- /dev/null +++ b/tests/snmpsim/solaris_11.snmprec @@ -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