diff --git a/doc/Support/SNMP-Configuration-Examples.md b/doc/Support/SNMP-Configuration-Examples.md index d71e48925b..c24d008e29 100644 --- a/doc/Support/SNMP-Configuration-Examples.md +++ b/doc/Support/SNMP-Configuration-Examples.md @@ -128,6 +128,13 @@ syscontact Your Name #Distro Detection extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro ``` + +``` +#If you have 'dmidecode' installed on your host, you can add the following lines for additional hardware detection +extend .1.3.6.1.4.1.2021.7890.2 hardware '/usr/sbin/dmidecode -s system-product-name' +extend .1.3.6.1.4.1.2021.7890.3 manufacturer '/usr/sbin/dmidecode -s system-manufacturer' +extend .1.3.6.1.4.1.2021.7890.4 serial '/usr/sbin/dmidecode -s system-serial-number' +``` The LibreNMS server include a copy of this example here: ``` diff --git a/includes/polling/os/unix.inc.php b/includes/polling/os/unix.inc.php index b80f94311e..4187739b70 100644 --- a/includes/polling/os/unix.inc.php +++ b/includes/polling/os/unix.inc.php @@ -41,11 +41,30 @@ if ($device['os'] == "linux" || $device['os'] == "endian") { $hw = trim(str_replace("\"", "", $hw)); if ($hw) { $hardware = "Dell " . $hw; + } else { + # Try detect using the extended option (dmidecode) + $version_dmide = str_replace("\"", "", snmp_get($device, ".1.3.6.1.4.1.2021.7890.2.4.1.2.8.104.97.114.100.119.97.114.101.1", "-Oqv")); + $version_dmide = trim(str_replace("\"", "", $version_dmide)); + + $hardware_dmide = str_replace("\"", "", snmp_get($device, ".1.3.6.1.4.1.2021.7890.3.4.1.2.12.109.97.110.117.102.97.99.116.117.114.101.114.1", "-Oqv")); + $hardware_dmide = trim(str_replace("\"", "", $hardware_dmide)); + if ($hardware_dmide) { + $hardware = $hardware_dmide; + if ($version_dmide) { + $hardware = $hardware . " [" . $version_dmide . "]"; + } + } } $serial = snmp_get($device, ".1.3.6.1.4.1.674.10892.1.300.10.1.11.1", "-Oqv", "MIB-Dell-10892"); $serial = trim(str_replace("\"", "", $serial)); + # Try detect using the SNMP Extend option (dmidecode) + if (!$serial) { + $serial = str_replace("\"", "", snmp_get($device, ".1.3.6.1.4.1.2021.7890.4.4.1.2.6.115.101.114.105.97.108.1", "-Oqv")); + $serial = trim(str_replace("\"", "", $serial)); + } + # Use agent DMI data if available if (isset($agent_data['dmi'])) { if ($agent_data['dmi']['system-product-name']) {