<?php if (empty($os)) { if (strstr($sysDescr, 'Cisco Internetwork Operating System Software')) { $os = 'ios'; } elseif (strstr($sysDescr, 'IOS (tm)')) { $os = 'ios'; } elseif (strstr($sysDescr, 'Cisco IOS Software')) { $os = 'ios'; } elseif (strstr($sysDescr, 'Global Site Selector')) { $os = 'ios'; } if (strstr($sysDescr, 'IOS-XE')) { $os = 'iosxe'; } if (strstr($sysDescr, 'IOS XR')) { $os = 'iosxr'; } if (!empty($os)) { $extra_mibs = array("ciscoAAASessionMIB" => "CISCO-AAA-SESSION-MIB"); register_mibs($device, $extra_mibs, "includes/discovery/os/ios.inc.php"); } } // Fallback case // If we don't have an OS yet and if the object is in Cisco tree it's most likely an IOS device // if (empty($os) and substr($sysObjectId, 0, 17) == ".1.3.6.1.4.1.9.1.") { $os = "ios"; }
<?php if (!$os) { if (strstr($sysDescr, 'EMC SOHO-NAS Storage.')) { $os = 'lenovoemc'; $lenovoemc_mibs = array("fanValue" => "IOMEGANAS-MIB", "tempValue" => "IOMEGANAS-MIB", "raidStatus" => "IOMEGANAS-MIB", "diskStatus" => "IOMEGANAS-MIB"); register_mibs($device, $lenovoemc_mibs, "includes/discovery/os/lenovoemc.inc.php"); } }
function discover_device($device, $options = null) { global $config, $valid; $valid = array(); // Reset $valid array $attribs = get_dev_attribs($device['device_id']); $device['snmp_max_repeaters'] = $attribs['snmp_max_repeaters']; $device_start = microtime(true); // Start counting device poll time echo $device['hostname'] . ' ' . $device['device_id'] . ' ' . $device['os'] . ' '; if ($device['os'] == 'generic') { // verify if OS has changed from generic $device['os'] = getHostOS($device); if ($device['os'] != 'generic') { echo "\nDevice os was updated to " . $device['os'] . '!'; dbUpdate(array('os' => $device['os']), 'devices', '`device_id` = ?', array($device['device_id'])); } } // Set type to a predefined type for the OS if it's not already set if ($device['type'] == 'unknown' || $device['type'] == '') { if ($config['os'][$device['os']]['type']) { $device['type'] = $config['os'][$device['os']]['type']; } } if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; echo ' (' . $device['os_group'] . ')'; } echo "\n"; // If we've specified modules, use them, else walk the modules array $force_module = false; if ($options['m']) { $config['discovery_modules'] = array(); foreach (explode(',', $options['m']) as $module) { if (is_file("includes/discovery/{$module}.inc.php")) { $config['discovery_modules'][$module] = 1; $force_module = true; } } } foreach ($config['discovery_modules'] as $module => $module_status) { if ($force_module === true || $attribs['discover_' . $module] || $module_status && !isset($attribs['discover_' . $module])) { $module_start = microtime(true); echo "#### Load disco module {$module} ####\n"; include "includes/discovery/{$module}.inc.php"; $module_time = microtime(true) - $module_start; $module_time = substr($module_time, 0, 5); echo "\n>> Runtime for discovery module '{$module}': {$module_time} seconds\n"; echo "#### Unload disco module {$module} ####\n\n"; } elseif (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] == '0') { echo "Module [ {$module} ] disabled on host.\n\n"; } else { echo "Module [ {$module} ] disabled globally.\n\n"; } } if (is_mib_poller_enabled($device)) { $devicemib = array($device['sysObjectID'] => 'all'); register_mibs($device, $devicemib, "includes/discovery/functions.inc.php"); } $device_end = microtime(true); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5); dbUpdate(array('last_discovered' => array('NOW()'), 'type' => $device['type'], 'last_discovered_timetaken' => $device_time), 'devices', '`device_id` = ?', array($device['device_id'])); echo "Discovered in {$device_time} seconds\n"; global $discovered_devices; echo "\n"; $discovered_devices++; }
if (strpos(trim(snmp_get($device, 'dot11manufacturerProductName.6', '-Osqnv', 'IEEE802dot11-MIB')), 'UAP') !== false) { $os = 'unifi'; } else { if (trim(snmp_get($device, 'fwVersion.1', '-Osqnv', 'UBNT-AirFIBER-MIB')) != '') { $os = 'airos-af'; } } } } } } } else { if (snmp_get($device, 'GANDI-MIB::rxCounter.0', '-Osqnv', 'GANDI-MIB') !== false) { $os = 'pktj'; $pktj_mibs = array("rxCounter" => "GANDI-MIB", "txCounter" => "GANDI-MIB", "dropCounter" => "GANDI-MIB", "acldropCounter" => "GANDI-MIB", "ratedropCounter" => "GANDI-MIB", "KNIrxCounter" => "GANDI-MIB", "KNItxCounter" => "GANDI-MIB", "KNIdropCounter" => "GANDI-MIB"); register_mibs($device, $pktj_mibs, "include/discovery/os/linux.inc.php"); } elseif (stristr($sysObjectId, 'cumulusMib') || strstr($sysObjectId, '.1.3.6.1.4.1.40310')) { $os = 'cumulus'; } else { // Check for Synology DSM $hrSystemInitialLoadParameters = trim(snmp_get($device, 'HOST-RESOURCES-MIB::hrSystemInitialLoadParameters.0', '-Osqnv')); if (strpos($hrSystemInitialLoadParameters, 'syno_hw_version') !== false) { $os = 'dsm'; } else { // Check for Carel PCOweb $roomTemp = trim(snmp_get($device, 'roomTemp.0', '-OqvU', 'CAREL-ug40cdz-MIB')); if (is_numeric($roomTemp)) { $os = 'pcoweb'; } } }
<?php if (!$os) { if (preg_match('/ServerIron/', $sysDescr)) { $os = 'serveriron'; $serviron_mibs = array("snL4slbTotalConnections" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", "snL4slbLimitExceeds" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", "snL4slbForwardTraffic" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", "snL4slbReverseTraffic" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", "snL4slbFinished" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", "snL4FreeSessionCount" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB", "snL4unsuccessfulConn" => "FOUNDRY-SN-SW-L4-SWITCH-GROUP-MIB"); register_mibs($device, $serviron_mibs, "includes/discovery/os/serveriron.inc.php"); } }
<?php /* * LibreNMS Ruckus Wireless OS information module * * Copyright (c) 2015 Søren Friis Rosiak <*****@*****.**> * Copyright (c) 2015 Gear Consulting Pty Ltd <*****@*****.**> * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. Please see LICENSE.txt at the top level of * the source code distribution for details. */ if (!$os) { if (strstr($sysObjectId, '.1.3.6.1.4.1.25053.3.1')) { $os = 'ruckuswireless'; $ruckus_mibs = array("ruckusZDSystemStats" => "RUCKUS-ZD-SYSTEM-MIB", "ruckusZDWLANTable" => "RUCKUS-ZD-WLAN-MIB", "ruckusZDWLANAPTable" => "RUCKUS-ZD-WLAN-MIB", "ruckusZDWLANAPRadioStatsTable" => "RUCKUS-ZD-WLAN-MIB"); register_mibs($device, $ruckus_mibs, "includes/discovery/os/ruckuswireless.inc.php"); } }