<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2014 Adam Armstrong * */ if (is_device_mib($device, 'CISCO-CONFIG-MAN-MIB')) { // Check Cisco configuration age $oids = "sysUpTime.0 ccmHistoryRunningLastChanged.0 ccmHistoryRunningLastSaved.0 ccmHistoryStartupLastChanged.0"; $data = snmp_get_multi($device, $oids, "-OQUst", "SNMPv2-MIB:CISCO-CONFIG-MAN-MIB", mib_dirs(array("cisco"))); $config_age = $data[0]; foreach ($config_age as $key => $val) { $config_age[$key] = $val / 100; } $RunningLastChanged = $config_age['sysUpTime'] - $config_age['ccmHistoryRunningLastChanged']; $RunningLastChangedTS = time() - $RunningLastChanged; $RunningLastSaved = $config_age['sysUpTime'] - $config_age['ccmHistoryRunningLastSaved']; $RunningLastSavedTS = time() - $RunningLastSaved; $StartupLastChanged = $config_age['sysUpTime'] - $config_age['ccmHistoryStartupLastChanged']; $StartupLastChangedTS = time() - $StartupLastChanged; $sysUptimeTS = time() - $config_age['sysUpTime']; print_message("Cisco configuration ages\n"); //FIXME. print_message() & sprintf() here echo ' sysUptime : ' . format_unixtime($sysUptimeTS) . ' | ' . formatUptime($config_age['sysUpTime']) . PHP_EOL; echo ' Running : ' . format_unixtime($RunningLastChangedTS) . ' | ' . formatUptime($RunningLastChanged) . PHP_EOL;
} } $config['os'][$device['os']]['mibs'] = array_unique($detect_mibs); var_dump($config['os'][$device['os']]['mibs']); } */ // This is an include so that we don't lose variable scope. $include_lib = isset($include_lib) && $include_lib; if (!isset($include_order)) { // Order for include MIBs definitions, default: 'model,os,group,default' $include_order = NULL; } foreach (get_device_mibs($device, TRUE, $include_order) as $mib) { $inc_dir = $config['install_dir'] . '/' . $include_dir . '/' . strtolower($mib); $inc_file = $inc_dir . '.inc.php'; if (is_device_mib($device, $mib)) { if (is_file($inc_file)) { echo "{$mib} "; include $inc_file; if ($include_lib && is_file($inc_dir . '.lib.php')) { // separated functions include, for exclude fatal redeclare errors include_once $inc_dir . '.lib.php'; } } else { if (is_dir($inc_dir)) { if (OBS_DEBUG) { echo "[[{$mib}]]"; } foreach (glob($inc_dir . '/*.inc.php') as $dir_file) { if (is_file($dir_file)) { include $dir_file;
} print_debug('ENTITY-MIB already cached'); } else { $oids = array('entPhysicalDescr', 'entPhysicalName', 'entPhysicalClass', 'entPhysicalContainedIn', 'entPhysicalParentRelPos'); if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) { $oids[] = 'entPhysicalAlias'; } foreach ($oids as $oid) { $entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB'); if (!$GLOBALS['snmp_status']) { break; } } $entity_array = snmpwalk_cache_twopart_oid($device, 'entAliasMappingIdentifier', $entity_array, 'ENTITY-MIB:IF-MIB'); } if (is_device_mib($device, 'ARISTA-ENTITY-SENSOR-MIB')) { $oids_arista = array('aristaEntSensorThresholdLowWarning', 'aristaEntSensorThresholdLowCritical', 'aristaEntSensorThresholdHighWarning', 'aristaEntSensorThresholdHighCritical'); foreach ($oids_arista as $oid) { $entity_array = snmpwalk_cache_multi_oid($device, $oid, $entity_array, 'ARISTA-ENTITY-SENSOR-MIB'); if (!$GLOBALS['snmp_status']) { break; } } } $entitysensor = array('voltsDC' => 'voltage', 'voltsAC' => 'voltage', 'amperes' => 'current', 'watts' => 'power', 'hertz' => 'frequency', 'percentRH' => 'humidity', 'rpm' => 'fanspeed', 'celsius' => 'temperature', 'dBm' => 'dbm'); foreach ($entity_array as $index => $entry) { if ($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index) && $entry['entPhySensorOperStatus'] != 'unavailable' && $entry['entPhySensorOperStatus'] != 'nonoperational') { $ok = TRUE; $options = array('entPhysicalIndex' => $index); $oid = ".1.3.6.1.2.1.99.1.1.1.4.{$index}"; $type = $entitysensor[$entry['entPhySensorType']];
* Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ // Force rediscover os if os definition changed if (!isset($config['os'][$device['os']])) { print_debug('OS name change detected, forced os rediscover.'); force_discovery($device, 'os'); } // Cache hardware/version/serial info from ENTITY-MIB (if possible use inventory module data) if (is_device_mib($device, 'ENTITY-MIB') && (in_array($device['os_group'], array('unix', 'cisco')) || in_array($device['os'], array('acme', 'nos', 'ibmnos', 'acsw', 'fabos', 'wlc', 'h3c', 'hh3c', 'hpuww')))) { // Get entPhysical tables for some OS and OS groups if ($config['discovery_modules']['inventory']) { $entPhysical = dbFetchRow('SELECT * FROM `entPhysical` WHERE `device_id` = ? AND `entPhysicalContainedIn` = ?', array($device['device_id'], '0')); } else { switch (TRUE) { case $device['os_group'] == 'cisco' || in_array($device['os'], array('acme', 'h3c', 'hh3c')): $oids = 'entPhysicalDescr.1 entPhysicalSerialNum.1 entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1'; break; case $device['os'] == 'qnap': $oids = 'entPhysicalDescr.1 entPhysicalName.1 entPhysicalSerialNum.1 entPhysicalFirmwareRev.1'; break; case $device['os'] == 'ibmnos': $oids = 'entPhysicalName.1 entPhysicalSerialNum.1 entPhysicalSoftwareRev.1'; break; case $device['os'] == 'wlc':
* * @package observium * @subpackage discovery * @author Adam Armstrong <*****@*****.**> * @copyright (C) 2006-2014 Adam Armstrong * */ echo " Q-BRIDGE-MIB "; $vtpdomain_id = "1"; //$q_bridge_index = snmpwalk_cache_oid($device, "dot1qPortVlanTable", array(), "Q-BRIDGE-MIB"); $vlans = snmpwalk_cache_oid($device, "dot1qVlanStaticTable", array(), "Q-BRIDGE-MIB", mib_dirs()); if ($vlans) { $vlan_ifindex_map = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "Q-BRIDGE-MIB", mib_dirs()); $vlan_ifindex_min = $vlan_ifindex_map[key($vlan_ifindex_map)]['dot1dBasePortIfIndex']; } if (is_device_mib($device, 'JUNIPER-VLAN-MIB')) { // Fetch Juniper VLAN table for correct tag $vlans = snmpwalk_cache_oid($device, "jnxExVlanTable", $vlans, "JUNIPER-VLAN-MIB", mib_dirs('junos')); } foreach ($vlans as $vlan_id => $vlan) { if ($device['os'] == 'ftos') { $vlan_id = rewrite_ftos_vlanid($device, $vlan_id); } if (isset($vlan['jnxExVlanTag'])) { $vlan_id = $vlan['jnxExVlanTag']; } unset($vlan_update); if (is_array($vlans_db[$vtpdomain_id][$vlan_id]) && $vlans_db[$vtpdomain_id][$vlan_id]['vlan_name'] != $vlan['dot1qVlanStaticName']) { $vlan_update['vlan_name'] = $vlan['dot1qVlanStaticName']; } if (is_array($vlans_db[$vtpdomain_id][$vlan_id]) && $vlans_db[$vtpdomain_id][$vlan_id]['vlan_status'] != $vlan['dot1qVlanStaticRowStatus']) {
#CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalHcOutOctets.0 = Counter64: 544652047992 #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutOctWraps.0 = Counter32: 126 Integral units #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutUncompOctets.0 = Counter32: 3486168696 Octets #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalHcOutUncompOctets.0 = Counter64: 544652047992 Octets #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutUncompOctWraps.0 = Counter32: 126 Integral units #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutPkts.0 = Counter32: 828696339 Packets #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutDrops.0 = Counter32: 4520 Packets #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutAuths.0 = Counter32: 828696339 Events #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutAuthFails.0 = Counter32: 0 Failures #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutEncrypts.0 = Counter32: 828696318 Packets #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalOutEncryptFails.0 = Counter32: 0 Failures #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalProtocolUseFails.0 = Counter32: 0 Failures #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalNoSaFails.0 = Counter32: 5 Failures #CISCO-IPSEC-FLOW-MONITOR-MIB::cipSecGlobalSysCapFails.0 = Counter32: 0 Failures // FIXME. Candidate for migrate to graphs module with table_collect() if (is_device_mib($device, 'CISCO-IPSEC-FLOW-MONITOR-MIB')) { $data = snmpwalk_cache_oid($device, "cipSecGlobalStats", NULL, "CISCO-IPSEC-FLOW-MONITOR-MIB", mib_dirs('cisco')); $data = $data[0]; // Use HC Counters if they exist if (is_numeric($data['cipSecGlobalHcInOctets'])) { $data['cipSecGlobalInOctets'] = $data['cipSecGlobalHcInOctets']; } if (is_numeric($data['cipSecGlobalHcOutOctets'])) { $data['cipSecGlobalOutOctets'] = $data['cipSecGlobalHcOutOctets']; } if (is_numeric($data['cipSecGlobalHcInDecompOctets'])) { $data['cipSecGlobalInDecompOctets'] = $data['cipSecGlobalHcInDecompOctets']; } if (is_numeric($data['cipSecGlobalHcOutUncompOctets'])) { $data['cipSecGlobalOutUncompOctets'] = $data['cipSecGlobalHcOutUncompOctets']; }
* Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ #CISCO-VPDN-MGMT-MIB::cvpdnTunnelTotal.0 = Gauge32: 0 tunnels #CISCO-VPDN-MGMT-MIB::cvpdnSessionTotal.0 = Gauge32: 0 users #CISCO-VPDN-MGMT-MIB::cvpdnDeniedUsersTotal.0 = Counter32: 0 attempts #CISCO-VPDN-MGMT-MIB::cvpdnSystemTunnelTotal.l2tp = Gauge32: 437 tunnels #CISCO-VPDN-MGMT-MIB::cvpdnSystemSessionTotal.l2tp = Gauge32: 1029 sessions #CISCO-VPDN-MGMT-MIB::cvpdnSystemDeniedUsersTotal.l2tp = Counter32: 0 attempts #CISCO-VPDN-MGMT-MIB::cvpdnSystemClearSessions.0 = INTEGER: none(1) // FIXME. Candidate for migrate to graphs module with table_collect() // ^ will need to be able to set $graphs[], not sure this is possible yet? if (is_device_mib($device, 'CISCO-VPDN-MGMT-MIB')) { $data = snmpwalk_cache_oid($device, "cvpdnSystemEntry", NULL, "CISCO-VPDN-MGMT-MIB"); foreach ($data as $type => $vpdn) { if ($vpdn['cvpdnSystemTunnelTotal'] || $vpdn['cvpdnSystemSessionTotal']) { rrdtool_update_ng($device, 'cisco-vpdn', array('tunnels' => $vpdn['cvpdnSystemTunnelTotal'], 'sessions' => $vpdn['cvpdnSystemSessionTotal'], 'denied' => $vpdn['cvpdnSystemDeniedUsersTotal']), $type); $graphs['vpdn_sessions_' . $type] = TRUE; $graphs['vpdn_tunnels_' . $type] = TRUE; echo " Cisco VPDN ({$type}) "; } } unset($data, $vpdn, $type); } // EOF
* * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ echo "ENTITY-MIB "; $mibs = 'ENTITY-MIB'; $mib_dirs = mib_dirs(); // Vendor specific MIBs $vendor_mibs = array('ACMEPACKET-ENTITY-VENDORTYPE-OID-MIB', 'HUAWEI-TC-MIB', 'HPN-ICF-ENTITY-VENDORTYPE-OID-MIB', 'H3C-ENTITY-VENDORTYPE-OID-MIB', 'HH3C-ENTITY-VENDORTYPE-OID-MIB', 'CISCO-STACK-MIB', 'CISCO-ENTITY-VENDORTYPE-OID-MIB'); // Leave this mib always last foreach ($vendor_mibs as $vendor_mib) { if (is_device_mib($device, $vendor_mib, FALSE)) { $mibs .= ':' . $vendor_mib; $mib_dirs = mib_dirs($config['mibs'][$vendor_mib]['mib_dir']); break; } } $entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", array(), $mibs, $mib_dirs); if ($GLOBALS['snmp_status']) { $entity_array = snmpwalk_cache_twopart_oid($device, "entAliasMappingIdentifier", $entity_array, 'ENTITY-MIB:IF-MIB'); $GLOBALS['cache']['entity-mib'] = $entity_array; // Cache this array for sensors discovery (see in cisco-entity-sensor-mib or entity-sensor-mib) foreach ($entity_array as $entPhysicalIndex => $entry) { if ($device['os'] == "hpuww") { if ($entPhysicalIndex == 1) { $entry['entPhysicalContainedIn'] = 0; }
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2015 Adam Armstrong * */ if (is_device_mib($device, 'CISCO-CAT6K-CROSSBAR-MIB')) { if (preg_match('/[a-z](60|65|76)\\d{2}/i', $device['hardware'])) { // MIBs supported by the Catalyst 6000 series switches (WS-C6006, WS-C6009, WS-C6503, // WS-C6506, WS-C6509, WS-C6509NEB, WS-C6513, CISCO7603, CISCO7606, OS-R7609) echo "Cisco Cat6xxx/76xx Crossbar: "; $mod_stats = snmpwalk_cache_oid($device, "cc6kxbarModuleModeTable", array(), "CISCO-CAT6K-CROSSBAR-MIB", mib_dirs("cisco")); if ($GLOBALS['snmp_status']) { $chan_stats = snmpwalk_cache_oid($device, "cc6kxbarModuleChannelTable", array(), "CISCO-CAT6K-CROSSBAR-MIB", mib_dirs("cisco")); $chan_stats = snmpwalk_cache_oid($device, "cc6kxbarStatisticsTable", $chan_stats, "CISCO-CAT6K-CROSSBAR-MIB", mib_dirs("cisco")); foreach ($mod_stats as $index => $entry) { $group = 'c6kxbar'; foreach ($entry as $key => $value) { $subindex = NULL; $entPhysical_state[$index][$subindex][$group][$key] = $value; } } foreach ($chan_stats as $index => $entry) { list($index, $subindex) = explode(".", $index, 2); $group = 'c6kxbar';
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2015 Adam Armstrong * */ //PEAKFLOW-SP-MIB::devicePhysicalMemory.0 = INTEGER: 8293156 //PEAKFLOW-SP-MIB::devicePhysicalMemoryInUse.0 = INTEGER: 2493368 //PEAKFLOW-SP-MIB::devicePhysicalMemoryUsage.0 = INTEGER: 30 if (!is_device_mib($device, 'HOST-RESOURCES-MIB')) { echo " PEAKFLOW-SP-MIB "; $mempool_array = snmp_get_multi($device, "devicePhysicalMemory.0 devicePhysicalMemoryInUse.0", "-OQUs", "PEAKFLOW-SP-MIB"); discover_mempool($valid['mempool'], $device, 0, "PEAKFLOW-SP-MIB", "Physical Memory", 1024, $mempool_array[0]['devicePhysicalMemory'], $mempool_array[0]['devicePhysicalMemoryInUse']); unset($mempool_array); } // EOF
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ if (is_device_mib($device, 'CAMBIUM-PTP800-MIB')) { $version = snmp_get($device, 'softwareVersion.0', '-OQv', 'CAMBIUM-PTP800-MIB'); $hardware = snmp_get($device, 'productName.0', '-OQv', 'CAMBIUM-PTP800-MIB'); $serial = snmp_get($device, 'rFUSerial.0', '-OQv', 'CAMBIUM-PTP800-MIB'); } else { if (is_device_mib($device, 'MOTOROLA-PTP-MIB')) { $version = snmp_get($device, 'softwareVersion.0', '-OQv', 'MOTOROLA-PTP-MIB'); $hardware = snmp_get($device, 'productName.0', '-OQv', 'MOTOROLA-PTP-MIB'); } else { $hardware = rewrite_definition_hardware($device, $poll_device['sysObjectID']); } } // EOF
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ /// FIXME. Rewrite (clean), add discovery module with check ospf exist on device, clean stale entries (after disable) // Pre-polling checks if (!$config['enable_ospf'] || !is_device_mib($device, 'OSPF-MIB')) { // OSPF not enabled or MIB excluded return; } /* OSPF-MIB::ospfRouterId.0 = IpAddress: 1.185.1.113 OSPF-MIB::ospfAdminStat.0 = INTEGER: enabled(1) OSPF-MIB::ospfVersionNumber.0 = INTEGER: version2(2) OSPF-MIB::ospfAreaBdrRtrStatus.0 = INTEGER: false(2) OSPF-MIB::ospfASBdrRtrStatus.0 = INTEGER: true(1) OSPF-MIB::ospfExternLsaCount.0 = Gauge32: 104 OSPF-MIB::ospfExternLsaCksumSum.0 = INTEGER: 3322892 OSPF-MIB::ospfTOSSupport.0 = INTEGER: false(2) OSPF-MIB::ospfOriginateNewLsas.0 = Counter32: 11993 OSPF-MIB::ospfRxNewLsas.0 = Counter32: 553365 OSPF-MIB::ospfExtLsdbLimit.0 = INTEGER: -1 OSPF-MIB::ospfMulticastExtensions.0 = INTEGER: 0
$poll_device['sysObjectID'] = snmp_get($device, "sysObjectID.0", "-Oqvn", "SNMPv2-MIB", mib_dirs()); if (strpos($poll_device['sysObjectID'], 'Wrong Type') !== FALSE) { // Wrong Type (should be OBJECT IDENTIFIER): "1.3.6.1.4.1.25651.1.2" list(, $poll_device['sysObjectID']) = explode(':', $poll_device['sysObjectID']); $poll_device['sysObjectID'] = '.' . trim($poll_device['sysObjectID'], ' ."'); } $poll_device['snmpEngineID'] = snmp_cache_snmpEngineID($device); $poll_device['sysName'] = strtolower($poll_device['sysName']); if (isset($agent_data['uptime'])) { list($agent_data['uptime']) = explode(' ', $agent_data['uptime']); } if (is_numeric($agent_data['uptime']) && $agent_data['uptime'] > 0) { $uptime = round($agent_data['uptime']); $uptime_msg = "正在使用 UNIX 代理运行时间"; } else { if ($device['os'] != 'windows' && $device['snmp_version'] != 'v1' && is_device_mib($device, 'HOST-RESOURCES-MIB')) { $hrSystemUptime = snmp_get($device, "hrSystemUptime.0", "-Oqv", "HOST-RESOURCES-MIB", mib_dirs()); $hrSystemUptime = timeticks_to_sec($hrSystemUptime); } else { $hrSystemUptime = FALSE; } if (is_numeric($hrSystemUptime) && $hrSystemUptime > 0) { $agent_uptime = $uptime; // Move uptime into agent_uptime // HOST-RESOURCES-MIB::hrSystemUptime.0 = Wrong Type (should be Timeticks): 1632295600 // HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65 $polled = time(); $uptime = $hrSystemUptime; $uptime_msg = "正在使用 SNMP 代理 hrSystemUptime"; } else { // SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @author Adam Armstrong <*****@*****.**> * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $cdp_array = snmpwalk_cache_twopart_oid($device, "cdpCache", array(), "CISCO-CDP-MIB"); // If we get timeout error and device has 'CISCO-FLASH-MIB', sleep and try re-walk if ($GLOBALS['snmp_status'] === FALSE && $GLOBALS['snmp_error_code'] == 1002 && is_device_mib($device, 'CISCO-FLASH-MIB')) { print_debug('Try to re-walk "CISCO-CDP-MIB"..'); sleep(5); // Additional sleep, see comments in includes/discovery/storage/cisco-flash-mib-inc.php $cdp_array = snmpwalk_cache_twopart_oid($device, "cdpCache", array(), "CISCO-CDP-MIB"); } if ($cdp_array) { foreach ($cdp_array as $ifIndex => $port_neighbours) { $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $ifIndex)); foreach ($port_neighbours as $entry_id => $cdp_entry) { list($cdp_entry['cdpCacheDeviceId']) = explode('(', $cdp_entry['cdpCacheDeviceId']); // Fix for Nexus CDP neighbors: <hostname>(serial number) $remote_device_id = FALSE; if (is_valid_hostname($cdp_entry['cdpCacheDeviceId'])) { if (isset($GLOBALS['cache']['discovery-protocols'][$cdp_entry['cdpCacheDeviceId']])) { // This hostname already checked, skip discover
#CISCO-REMOTE-ACCESS-MONITOR-MIB::crasEmailNumSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasEmailCumulateSessions.0 = Counter32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasEmailPeakConcurrentSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasIPSecNumSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasIPSecCumulateSessions.0 = Counter32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasIPSecPeakConcurrentSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasL2LNumSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasL2LCumulateSessions.0 = Counter32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasL2LPeakConcurrentSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasLBNumSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasLBCumulateSessions.0 = Counter32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasLBPeakConcurrentSessions.0 = Gauge32: 0 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasSVCNumSessions.0 = Gauge32: 7 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasSVCCumulateSessions.0 = Counter32: 53 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasSVCPeakConcurrentSessions.0 = Gauge32: 9 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasWebvpnNumSessions.0 = Gauge32: 7 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasWebvpnCumulateSessions.0 = Counter32: 29 Sessions #CISCO-REMOTE-ACCESS-MONITOR-MIB::crasWebvpnPeakConcurrentSessions.0 = Gauge32: 9 Sessions // FIXME. Candidate for migrate to graphs module with table_collect() if (is_device_mib($device, 'CISCO-REMOTE-ACCESS-MONITOR-MIB')) { $oid_list = "crasEmailNumSessions.0 crasIPSecNumSessions.0 crasL2LNumSessions.0 crasLBNumSessions.0 crasSVCNumSessions.0 crasWebvpnNumSessions.0"; $data = snmp_get_multi($device, $oid_list, "-OUQs", "CISCO-REMOTE-ACCESS-MONITOR-MIB"); $data = $data[0]; if ($data['crasEmailNumSessions'] || $data['crasIPSecNumSessions'] || $data['crasL2LNumSessions'] || $data['crasLBNumSessions'] || $data['crasSVCNumSessions'] || $data['crasWebvpnSessions']) { rrdtool_update_ng($device, 'cisco-cras-sessions', array('email' => $data['crasEmailNumSessions'], 'ipsec' => $data['crasIPSecNumSessions'], 'l2l' => $data['crasL2LNumSessions'], 'lb' => $data['crasLBNumSessions'], 'svc' => $data['crasSVCNumSessions'], 'webvpn' => $data['crasWebvpnNumSessions'])); $graphs['cras_sessions'] = TRUE; echo " CRAS Sessions"; } unset($data); } // EOF
dbUpdate($q_update, 'vlans_fdb', '`device_id` = ? AND `vlan_id` = ? AND `mac_address` = ?', array($device['device_id'], $vlan, $mac)); //echo('U'); } else { } // remove it from the existing list unset($fdbs_db[$vlan][$mac]); } $fdb_count++; if (is_numeric($port_id)) { $fdb_portcount[$port_id]++; } //echo(PHP_EOL); } } // FDB count for HP ProCurve if (!$fdb_count && is_device_mib($device, 'STATISTICS-MIB')) { $fdb_count = snmp_get($device, 'hpSwitchFdbAddressCount.0', '-Ovqn', 'STATISTICS-MIB'); } if (is_numeric($fdb_count) && $fdb_count > 0) { rrdtool_update_ng($device, 'fdb_count', array('value' => $fdb_count)); $graphs['fdb_count'] = TRUE; } else { $graphs['fdb_count'] = FALSE; } // FIXME should non-global fdb count be in the ports poller? $fdbcount_module = 'enable_ports_fdbcount'; if ($attribs[$fdbcount_module] || $config[$fdbcount_module] && !isset($attribs[$fdbcount_module])) { foreach ($fdb_portcount as $port => $count) { $port_info = $port_table[$port]; if (!$port_info) { print_debug("No entry in port table for {$port}");
break; case 'hrStorageNetworkDisk': if (isset($config['ignore_mount_network']) && $config['ignore_mount_network']) { $deny = TRUE; print_debug("skip(network)"); } break; case 'hrStorageCompactDisc': if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical']) { $deny = TRUE; print_debug("skip(cd)"); } break; } // Another 'hack' for isilon devices with very big array size if ($descr == '/ifs' && is_device_mib($device, 'ISILON-MIB')) { $deny = TRUE; // Remove from polling by HOST-RESOURCES-MIB } if (!$deny) { //32bit counters $size = snmp_dewrap32bit($storage['hrStorageSize']) * $units; $used = snmp_dewrap32bit($storage['hrStorageUsed']) * $units; $path = rewrite_storage($descr); // Find index from 'UCD-SNMP-MIB::dskTable' foreach ($cache_discovery['ucd-snmp-mib'] as $dsk) { if ($dsk['dskPath'] === $path) { // Using 64bit counters if available if (isset($dsk['dskTotalLow'])) { $dsk['units'] = 1024; $dsk['size'] = snmp_size64_high_low($dsk['dskTotalHigh'], $dsk['dskTotalLow']);
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage discovery * @copyright (C) 2006-2015 Adam Armstrong * */ /// FIXME. Make this module generic, not only cisco-like if ($config['enable_sla'] && is_device_mib($device, 'CISCO-RTTMON-MIB')) { echo "SLAs : "; $valid['slas'] = array(); $sla_table = snmpwalk_cache_multi_oid($device, "rttMonCtrl", array(), 'CISCO-RTTMON-MIB', mib_dirs('cisco')); if (OBS_DEBUG > 1) { print_vars($sla_table); } // Get existing SLAs $sla_db = array(); //$sla_ids = array(); foreach (dbFetchRows("SELECT * FROM `slas` WHERE `device_id` = ?", array($device['device_id'])) as $entry) { $sla_db[$entry['sla_index']] = $entry; //$sla_ids[$entry['sla_id']] = $entry['sla_id']; } foreach ($sla_table as $sla_index => $entry) { if (!isset($entry['rttMonCtrlAdminStatus'])) { continue; }
if ($oid == "jnxMacHCOutOctets") { $oid = "bytes"; $dir = "output"; } if ($oid == "jnxMacHCInOctets") { $oid = "bytes"; $dir = "input"; } $ma_array[$ifIndex . '-' . $vlan . '-' . $mac]['ifIndex'] = $ifIndex; $ma_array[$ifIndex . '-' . $vlan . '-' . $mac]['vlan'] = $vlan; $ma_array[$ifIndex . '-' . $vlan . '-' . $mac]['mac'] = $mac; $ma_array[$ifIndex . '-' . $vlan . '-' . $mac][$oid][$dir] = $value; } } // Cisco MAC Accounting if (is_device_mib($device, 'CISCO-IP-STAT-MIB')) { echo "Cisco "; $datas = snmp_walk($device, "CISCO-IP-STAT-MIB::cipMacHCSwitchedBytes", "-OUqsX", "CISCO-IP-STAT-MIB"); $datas .= "\n" . snmp_walk($device, "CISCO-IP-STAT-MIB::cipMacHCSwitchedPkts", "-OUqsX", "CISCO-IP-STAT-MIB"); // No 64-bit counters? Try 32-bit. How necessary is this? How lacking is 64-bit support? if (strlen($datas) == 0) { $datas = snmp_walk($device, "CISCO-IP-STAT-MIB::cipMacSwitchedBytes", "-OUqsX", "CISCO-IP-STAT-MIB"); $datas .= "\n" . snmp_walk($device, "CISCO-IP-STAT-MIB::cipMacSwitchedPkts", "-OUqsX", "CISCO-IP-STAT-MIB"); } foreach (explode("\n", $datas) as $data) { list($oid, $ifIndex, $dir, $mac, $value) = parse_oid2($data); list($a_a, $a_b, $a_c, $a_d, $a_e, $a_f) = explode(":", $mac); $ah_a = zeropad($a_a); $ah_b = zeropad($a_b); $ah_c = zeropad($a_c); $ah_d = zeropad($a_d);
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ if (is_device_mib($device, 'CISCO-CEF-MIB')) { echo 'Cisco CEF Switching Path: '; $cefs_query = dbFetchRows('SELECT * FROM `cef_switching` WHERE `device_id` = ?', array($device['device_id'])); foreach ($cefs_query as $ceftmp) { $cef_id = $device['device_id'] . '-' . $ceftmp['entPhysicalIndex'] . '-' . $ceftmp['afi'] . '-' . $ceftmp['cef_index']; $cefs_db[$cef_id] = $ceftmp['cef_switching_id']; } $cef_pfxs_query = dbFetchRows('SELECT * FROM `cef_prefix` WHERE `device_id` = ?', array($device['device_id'])); foreach ($cef_pfxs_query as $pfx) { $cef_pfxs_db[$pfx['entPhysicalIndex']][$pfx['afi']] = $pfx['cef_pfx_id']; } unset($cefs_query, $cef_pfxs_query); $device_context = $device; if (!count($cefs_db)) { // Set retries to 0 for speedup first walking, only if previously polling also empty (DB empty) $device_context['snmp_retries'] = 0; } $cefs = snmpwalk_cache_threepart_oid($device_context, 'cefSwitchingStatsEntry', array(), 'CISCO-CEF-MIB'); unset($device_context);
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ if (is_device_mib($device, 'UCD-SNMP-MIB')) { $load_rrd = "ucd_load.rrd"; $cpu_rrd = "ucd_cpu.rrd"; $mem_rrd = "ucd_mem.rrd"; // Poll systemStats from UNIX-like hosts running UCD/Net-SNMPd #UCD-SNMP-MIB::ssIndex.0 = INTEGER: 1 #UCD-SNMP-MIB::ssErrorName.0 = STRING: systemStats #UCD-SNMP-MIB::ssSwapIn.0 = INTEGER: 0 kB #UCD-SNMP-MIB::ssSwapOut.0 = INTEGER: 0 kB #UCD-SNMP-MIB::ssIOSent.0 = INTEGER: 1864 blocks/s #UCD-SNMP-MIB::ssIOReceive.0 = INTEGER: 7 blocks/s #UCD-SNMP-MIB::ssSysInterrupts.0 = INTEGER: 7572 interrupts/s #UCD-SNMP-MIB::ssSysContext.0 = INTEGER: 10254 switches/s #UCD-SNMP-MIB::ssCpuUser.0 = INTEGER: 4 #UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 3 #UCD-SNMP-MIB::ssCpuIdle.0 = INTEGER: 77 #UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 194386556 #UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 15673 #UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 65382910
if ($bgpLocalAs != $device['bgpLocalAs']) { if (!$device['bgpLocalAs']) { log_event('BGP Local ASN added: AS' . $bgpLocalAs, $device, 'device', $device['device_id']); } elseif (!$bgpLocalAs) { log_event('BGP Local ASN removed: AS' . $device['bgpLocalAs'], $device, 'device', $device['device_id']); } else { log_event('BGP ASN changed: AS' . $device['bgpLocalAs'] . ' -> AS' . $bgpLocalAs, $device, 'device', $device['device_id']); } dbUpdate(array('bgpLocalAs' => $bgpLocalAs), 'devices', 'device_id = ?', array($device['device_id'])); print_cli_data("Updated ASN", $device['bgpLocalAs'] . " -> {$bgpLocalAs}", 2); //print_message('Updated ASN (from '.$device['bgpLocalAs']." -> $bgpLocalAs)"); } print_cli_data_field("Caching", 2); print_debug("BGP4-MIB "); $cisco_version = FALSE; if (is_device_mib($device, 'CISCO-BGP4-MIB')) { $cisco_version = 1; // Check Cisco cbgpPeer2Table $cisco_peers = snmpwalk_cache_oid($device, 'cbgpPeer2RemoteAs', array(), 'CISCO-BGP4-MIB'); if (count($cisco_peers) > 0) { echo "CISCO-BGP4-MIB "; $cisco_version = 2; $cisco_peers = snmpwalk_cache_oid($device, 'cbgpPeer2LocalAddr', $cisco_peers, 'CISCO-BGP4-MIB'); // Cisco vendor mib LocalAddr issue: // cbgpPeer2LocalAddr.ipv4."10.0.1.1" = "0B 8E 95 38 " --> 11.142.149.56 // but should: // bgpPeerLocalAddr.10.0.1.1 = 10.0.1.3 // Yah, Cisco you again added extra work for me? What mean this random numbers? $cisco_fix = snmpwalk_cache_oid($device, 'bgpPeerLocalAddr', array(), 'BGP4-MIB'); $cisco_peers = snmpwalk_cache_oid($device, 'cbgpPeer2RemoteIdentifier', $cisco_peers, 'CISCO-BGP4-MIB'); $cisco_peers = snmpwalk_cache_oid($device, 'cbgpPeer2AdminStatus', $cisco_peers, 'CISCO-BGP4-MIB');
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ if (is_device_mib($device, 'EATON-EPDU-MA-MIB')) { //EATON-EPDU-MA-MIB::firmwareVersion.0 = STRING: 01.01.01 //EATON-EPDU-MA-MIB::serialNumber.0 = STRING: ADZC050100 //EATON-EPDU-MA-MIB::hardwareRev.0 = INTEGER: 26 //EATON-EPDU-MA-MIB::objectName.0 = STRING: PW104MA1UB44 //EATON-EPDU-MA-MIB::objectInstance.0 = STRING: Master_Switch_2 $data = snmpget_cache_multi($device, 'firmwareVersion.0 serialNumber.0 objectName.0', array(), 'EATON-EPDU-MA-MIB'); if (is_array($data[0])) { $hardware = $data[0]['objectName']; $version = $data[0]['firmwareVersion']; $serial = $data[0]['serialNumber']; } } else { //EATON-EPDU-MIB::productName.0 = STRING: "EPDU MI 40U-A IN: CS8365 35A 3P OUT: 42XC13" //EATON-EPDU-MIB::partNumber.0 = STRING: "EMI315-10" //EATON-EPDU-MIB::serialNumber.0 = STRING: "B6xxxxx180" //EATON-EPDU-MIB::firmwareVersion.0 = STRING: "02.00.0041" //EATON-EPDU-MIB::unitName.0 = STRING: "PDU" //EATON-EPDU-MIB::lcdControl.0 = INTEGER: notApplicable(0)
// cEigrpMcastExcepts.0.1.12 = 5 // cEigrpCRpkts.0.1.12 = 1 // cEigrpAcksSuppressed.0.1.12 = 1 // cEigrpRetransSent.0.1.12 = 22 // cEigrpOOSrvcd.0.1.12 = 0 // cEigrpAuthMode.0.1.12 = none // cEigrpAuthKeyChain.0.1.12 = // Only run this on Cisco kit. // Seems this MIB supported only in IOS Catalyst 6k/7k. See ftp://ftp.cisco.com/pub/mibs/supportlists/ // IOS 3560: ftp://ftp.cisco.com/pub/mibs/supportlists/cat3560/cat3560-supportlist.html // IOS 6k/7k: ftp://ftp.cisco.com/pub/mibs/supportlists/cisco7606/cisco7606-supportlist.html // IOS-XE: ftp://ftp.cisco.com/pub/mibs/supportlists/cat4000/cat4000-supportlist.html // ftp://ftp.cisco.com/pub/mibs/supportlists/asr1000/asr1000-supportlist.html // IOS-XR: ftp://ftp.cisco.com/pub/mibs/supportlists/asr9000/asr9000-supportlist.html // ASA: ftp://ftp.cisco.com/pub/mibs/supportlists/asa/asa-supportlist.html if (is_device_mib($device, 'CISCO-EIGRP-MIB')) { $port_db_q = dbFetchRows('SELECT * FROM `eigrp_ports` WHERE `device_id` = ?', array($device['device_id'])); $port_db = array(); foreach ($port_db_q as $db_port) { $port_db[$db_port['eigrp_vpn'] . '-' . $db_port['eigrp_as'] . '-' . $db_port['eigrp_ifIndex']] = $db_port; } if (OBS_DEBUG && count($port_db)) { print_vars($port_db); } $device_context = $device; if (!count($port_db) && !preg_match('/[a-z](60|65|76)\\d{2}/i', $device['hardware'])) { // Since I'm not sure that this MIB supported on other platforms, set retry to 0 for speedup $device_context['snmp_retries'] = 0; } $ports_poll = snmpwalk_cache_oid($device_context, 'CEigrpInterfaceEntry', array(), 'CISCO-EIGRP-MIB'); unset($device_context);
<?php /** * Observium * * This file is part of Observium. * * @package observium * @subpackage poller * @copyright (C) 2006-2015 Adam Armstrong * */ /// FIXME. Make this module generic, not only cisco-like if (is_device_mib($device, 'CISCO-RTTMON-MIB')) { echo "SLAs : "; $sla_oids = array('jitter' => array('rttMonLatestJitterOperRTTMin', 'rttMonLatestJitterOperRTTMax', 'rttMonLatestJitterOperNumOfRTT', 'rttMonLatestJitterOperPacketLossSD', 'rttMonLatestJitterOperPacketLossDS'), 'icmpjitter' => array('rttMonLatestIcmpJitterRTTMin', 'rttMonLatestIcmpJitterRTTMax', 'rttMonLatestIcmpJitterNumRTT', 'rttMonLatestIcmpJitterPktLoss')); // WARNING. Discovered all SLAs, but polled only 'active' $sla_db = dbFetchRows("SELECT * FROM `slas` LEFT JOIN `slas-state` USING (`sla_id`) WHERE `device_id` = ? AND `deleted` = 0 AND `sla_status` = 'active';", array($device['device_id'])); if (count($sla_db)) { $sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestRttOperEntry", array(), "CISCO-RTTMON-MIB", mib_dirs('cisco')); foreach (dbFetchColumn("SELECT DISTINCT `rtt_type` FROM `slas` WHERE `device_id` = ? AND `rtt_type` != ? AND `deleted` = 0 AND `sla_status` = 'active';", array($device['device_id'], 'echo')) as $rtt_type) { switch ($rtt_type) { case 'jitter': // Additional data for Jitter $sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestJitterOperEntry", $sla_poll, "CISCO-RTTMON-MIB", mib_dirs('cisco')); break; case 'icmpjitter': // Additional data for ICMP jitter $sla_poll = snmpwalk_cache_multi_oid($device, "rttMonLatestIcmpJitterOperEntry", $sla_poll, "CISCO-RTTMON-ICMP-MIB", mib_dirs('cisco')); break; }
* * @package observium * @subpackage discovery * @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited * */ $mib = 'DISMAN-PING-MIB'; $flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP; // Additional mibs for vendor specific Types if (is_device_mib($device, 'JUNIPER-PING-MIB')) { // JUNIPER-PING-MIB $vendor_mib = 'JUNIPER-PING-MIB'; echo "{$vendor_mib} "; $mibs = $mib . ':' . $vendor_mib; } else { if (is_device_mib($device, 'HH3C-NQA-MIB')) { // HH3C-NQA-MIB $vendor_mib = 'HH3C-NQA-MIB'; echo "{$vendor_mib} "; $mibs = $mib . ':' . $vendor_mib; } else { $mibs = $mib; } } $oids = snmpwalk_cache_twopart_oid($device, "pingCtlEntry", array(), $mibs, NULL, $flags); //print_vars($oids); if ($GLOBALS['snmp_status'] === FALSE) { return; } $mib_lower = strtolower($mib); foreach ($oids as $sla_owner => $entry2) {
$entry['ipAddressPrefix'] = end(explode('.', $entry['ipAddressPrefix'])); if (!is_numeric($entry['ipAddressPrefix'])) { $entry['ipAddressPrefix'] = '128'; } if (is_ipv6_valid($ip_address, $entry['ipAddressPrefix']) === FALSE) { continue; } foreach ($oids_ip as $oid) { $ip_data[$ifIndex][$ip_address][$oid] = $entry[$oid]; } } if (OBS_DEBUG && $ip_data) { echo "IP-MIB\n"; print_vars($ip_data); } if (is_device_mib($device, 'CISCO-IETF-IP-MIB') && !count($ip_data)) { // Get IP addresses from CISCO-IETF-IP-MIB //cIpAddressIfIndex.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:02" = 450 //cIpAddressPrefix.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:02" = cIpAddressPfxOrigin.450.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:00".64 //cIpAddressOrigin.ipv6."20:01:04:70:00:15:00:bb:00:00:00:00:00:00:00:02" = manual //Origins: 1:other, 2:manual, 4:dhcp, 5:linklayer, 6:random $ip_data = array(); foreach ($oids_ip as $oid) { $oid_data = snmpwalk_cache_oid($device, 'c' . ucfirst($oid) . '.' . $ip_version, $oid_data, 'CISCO-IETF-IP-MIB', mib_dirs('cisco')); } // Rewrite CISCO-IETF-IP-MIB array foreach ($oid_data as $key => $entry) { $ip_address = hex2ip(str_replace($ip_version . '.', '', $key)); $ifIndex = $entry['cIpAddressIfIndex']; $entry['cIpAddressPrefix'] = end(explode('.', $entry['cIpAddressPrefix'])); if (!is_numeric($entry['cIpAddressPrefix'])) {