/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
//  Polling of AP and radios status for Juniper Wireless (ex Trapeze)
//
//  TRAPEZE-NETWORKS-AP-STATUS-MIB
echo " TRAPEZE-NETWORKS-AP-STATUS-MIB ";
// getting APs and radios
$radios_snmp = snmpwalk_cache_twopart_oid($device, "trpzApStatRadioOpStatisticsTable", $radios_snmp, "TRAPEZE-NETWORKS-AP-STATUS-MIB", mib_dirs('trapeze'));
if (OBS_DEBUG > 1 && count($radios_snmp)) {
    print_vars($radios_snmp);
}
// OIDs to graph
$oids_counter = array('TxUniPkt', 'TxUniOctet', 'TxMultiPkt', 'TxMultiOctet', 'RxPkt', 'RxOctet', 'UndcrptPkt', 'UndcrptOctet', 'PhyErr', 'ResetCount', 'AutoTuneChannelChangeCount', 'TxRetriesCount', 'ClientAssociations', 'ClientFailedAssociations', 'ClientReAssociations', 'SignalingPkt', 'ReTransmitOctet', 'RefusedConnectionCount', 'RxDataPkt', 'RxAuthPkt', 'RxAssocPkt', 'TxDataPkt', 'TxAuthRespPkt', 'TxAssocRespPkt');
$oids_gauge = array('UserSessions', 'NoiseFloor');
// Goes through the SNMP radio data
foreach ($radios_snmp as $ap_serial => $ap_radios) {
    foreach ($ap_radios as $radio_number => $radio) {
        $rrdupdate = "N";
        $rrd_create = "";
        if ($radio_number == "radio-1") {
            $radio_number = 1;
        } else {
            if ($radio_number == "radio-2") {
             $entity_array[$index] = $entry;
         }
     }
     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);
<?php

echo "Port Stacks: ";
$query = "SELECT * FROM `ports_stack` WHERE `device_id` = ?";
foreach (dbFetchRows($query, array($device['device_id'])) as $entry) {
    $stack_db_array[$entry['port_id_high']][$entry['port_id_low']]['ifStackStatus'] = $entry['ifStackStatus'];
}
$stack_poll_array = snmpwalk_cache_twopart_oid($device, "ifStackStatus", array());
foreach ($stack_poll_array as $port_id_high => $entry_high) {
    $port_high = get_port_by_index_cache($device, $port_id_high);
    if ($port_high['ifType'] == 'propVirtual') {
        continue;
    }
    //Skip stacking on Vlan ports (F.u. Cisco SB)
    foreach ($entry_high as $port_id_low => $entry_low) {
        $port_low = get_port_by_index_cache($device, $port_id_low);
        if ($port_low['ifType'] == 'propVirtual') {
            continue;
        }
        //Skip stacking on Vlan ports (F.u. Cisco SB)
        $ifStackStatus = $entry_low['ifStackStatus'];
        if (isset($stack_db_array[$port_id_high][$port_id_low])) {
            if ($stack_db_array[$port_id_high][$port_id_low]['ifStackStatus'] == $ifStackStatus) {
                echo ".";
            } else {
                $update_array = array('ifStackStatus' => $ifStackStatus);
                dbUpdate($update_array, 'ports_stack', "`device_id` = ? AND `port_id_high` = ? AND `port_id_low` = ?", array($device['device_id'], $port_id_high, $port_id_low));
                echo "U";
            }
            unset($stack_db_array[$port_id_high][$port_id_low]);
        } else {
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
if (!isset($cache_discovery['timetra-chassis-mib'])) {
    $cache_discovery['timetra-chassis-mib'] = snmpwalk_cache_twopart_oid($device, 'tmnxHwTable', NULL, 'TIMETRA-CHASSIS-MIB');
}
foreach ($cache_discovery['timetra-chassis-mib'] as $chassis => $entries) {
    foreach ($entries as $index => $entry) {
        $inventory[$index] = array('entPhysicalDescr' => $entry['tmnxHwName'], 'entPhysicalClass' => $entry['tmnxHwClass'], 'entPhysicalName' => $entry['tmnxHwName'], 'entPhysicalAlias' => $entry['tmnxHwAlias'], 'entPhysicalAssetID' => $entry['tmnxHwAssetID'], 'entPhysicalIsFRU' => $entry['tmnxHwIsFRU'], 'entPhysicalSerialNum' => $entry['tmnxHwSerialNumber'], 'entPhysicalContainedIn' => $entry['tmnxHwContainedIn'], 'entPhysicalParentRelPos' => $entry['tmnxHwParentRelPos'], 'entPhysicalMfgName' => $entry['tmnxHwMfgString']);
        if ($entry['tmnxHwContainedIn'] === '0' && $entry['tmnxHwParentRelPos'] == '-1') {
            $inventory[$index]['entPhysicalName'] .= ' ' . $chassis;
        }
        discover_inventory($valid['inventory'], $device, $index, $inventory[$index], 'timetra-chassis-mib');
    }
}
// EOF
Esempio n. 5
0
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$ip_version = 'ipv6';
if ($check_ipv6_mib || !count($ip_data[$ip_version])) {
    // Get IP addresses from IPV6-MIB
    //ipv6AddrPfxLength.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = 64
    //ipv6AddrPfxLength.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = 126
    //ipv6AddrType.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = stateful
    //ipv6AddrType.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = stateful
    //ipv6AddrAnycastFlag.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = false
    //ipv6AddrAnycastFlag.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = false
    //ipv6AddrStatus.20.254.192.0.0.0.0.0.0.0.10.0.0.0.0.0.4 = preferred
    //ipv6AddrStatus.573.42.1.183.64.0.1.130.32.0.0.0.0.0.0.0.2 = preferred
    //Types: stateless(1), stateful(2), unknown(3)
    $oid_data = snmpwalk_cache_twopart_oid($device, 'ipv6AddrEntry', array(), 'IPV6-MIB', NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
    //print_vars($oid_data);
    // Rewrite IPV6-MIB array
    foreach ($oid_data as $ifIndex => $entry1) {
        foreach ($entry1 as $ip_snmp => $entry) {
            $ip_address = snmp2ipv6($ip_snmp);
            $ip_data[$ip_version][$ifIndex][$ip_address] = array('ifIndex' => $ifIndex, 'ip' => $ip_address, 'prefix' => $entry['ipv6AddrPfxLength'], 'origin' => $entry['ipv6AddrType']);
        }
    }
}
unset($ifIndex, $ip_address, $ip_snmp, $entry1, $oid_data);
// EOF
Esempio n. 6
0
/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// CLEANME rename code can go in r6000
echo " Sentry3-MIB ";
$scale = 0.01;
$scale_voltage = 0.1;
$sentry3_InfeedEntry = snmpwalk_cache_twopart_oid($device, 'InfeedEntry', array(), 'Sentry3-MIB');
$sentry3_OutletEntry = snmpwalk_cache_threepart_oid($device, 'OutletEntry', array(), 'Sentry3-MIB');
foreach ($sentry3_InfeedEntry as $tower => $feeds) {
    foreach ($feeds as $feed => $entry) {
        $descr = str_replace('_', ', ', $entry['infeedName']);
        $index = "{$tower}.{$feed}";
        //infeedLoadValue
        $oid = '.1.3.6.1.4.1.1718.3.2.2.1.7.' . $index;
        if (isset($entry['infeedLoadValue']) && $entry['infeedLoadValue'] >= 0) {
            $limits = array('limit_high' => $entry['infeedCapacity'], 'limit_high_warn' => $entry['infeedLoadHighThresh']);
            $value = $entry['infeedLoadValue'];
            ## Rename code for older revisions
            $old_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("sensor-current-sentry3-{$tower}.rrd");
            $new_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("sensor-current-sentry3-infeedLoad.{$index}.rrd");
            if (is_file($old_rrd)) {
                rename($old_rrd, $new_rrd);
Esempio n. 7
0
// foreach ($pagp_oids as $oid)      { $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, "CISCO-PAGP-MIB"); }
if ($device['os_group'] == 'cisco') {
    $port_stats = snmp_cache_portIfIndex($device, $port_stats);
    $port_stats = snmp_cache_portName($device, $port_stats);
    foreach ($pagp_oids as $oid) {
        $port_stats = snmpwalk_cache_oid($device, $oid, $port_stats, 'CISCO-PAGP-MIB');
    }
    $data_oids[] = 'portName';
    // Grab data to put ports into vlans or make them trunks
    // FIXME we probably shouldn't be doing this from the VTP MIB, right?
    $port_stats = snmpwalk_cache_oid($device, 'vmVlan', $port_stats, 'CISCO-VLAN-MEMBERSHIP-MIB');
    $port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortEncapsulationOperType', $port_stats, 'CISCO-VTP-MIB');
    $port_stats = snmpwalk_cache_oid($device, 'vlanTrunkPortNativeVlan', $port_stats, 'CISCO-VTP-MIB');
} else {
    $port_stats = snmpwalk_cache_oid($device, 'dot1qPortVlanTable', $port_stats, 'Q-BRIDGE-MIB');
    $vlan_ports = snmpwalk_cache_twopart_oid($device, 'dot1qVlanCurrentEgressPorts', $vlan_stats, 'Q-BRIDGE-MIB');
    $vlan_ifindex_map = snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', $vlan_stats, 'Q-BRIDGE-MIB');
    foreach ($vlan_ports as $instance) {
        foreach (array_keys($instance) as $vlan_id) {
            $parts = explode(' ', $instance[$vlan_id]['dot1qVlanCurrentEgressPorts']);
            $binary = '';
            foreach ($parts as $part) {
                $binary .= zeropad(decbin($part), 8);
            }
            for ($i = 0; $i < strlen($binary); $i++) {
                if ($binary[$i]) {
                    $ifindex = $i;
                    // FIXME $vlan_ifindex_map[$i]
                    $q_bridge_mib[$ifindex][] = $vlan_id;
                }
            }
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
echo " FOUNDRY-SN-SWITCH-GROUP-MIB ";
$fdp_array = snmpwalk_cache_twopart_oid($device, "snFdpCacheEntry", array(), "FOUNDRY-SN-SWITCH-GROUP-MIB", mib_dirs('foundry'));
if ($fdp_array) {
    unset($fdp_links);
    foreach (array_keys($fdp_array) as $key) {
        $port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?", array($device['device_id'], $key));
        $fdp_if_array = $fdp_array[$key];
        foreach (array_keys($fdp_if_array) as $entry_key) {
            $fdp = $fdp_if_array[$entry_key];
            $remote_device_id = FALSE;
            if (is_valid_hostname($fdp['snFdpCacheDeviceId'])) {
                if (isset($GLOBALS['cache']['discovery-protocols'][$fdp['snFdpCacheDeviceId']])) {
                    // This hostname already checked, skip discover
                    $remote_device_id = $GLOBALS['cache']['discovery-protocols'][$fdp['snFdpCacheDeviceId']];
                } else {
                    $remote_device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDeviceId']));
                    if (!$remote_device_id && !is_bad_xdp($fdp['snFdpCacheDeviceId'], $fdp['snFdpCachePlatform'])) {
                        $remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId'], 'xdp', 'FDP', $device, $port);
Esempio n. 9
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// HWG-PWR-MIB
echo "HWG-PWR-MIB ";
$meters = snmpwalk_cache_oid($device, 'mtEntry', array(), 'HWG-PWR-MIB');
$oids = snmpwalk_cache_twopart_oid($device, 'mtvalEntry', array(), 'HWG-PWR-MIB');
if (OBS_DEBUG > 1 && count($oids)) {
    print_vars($meters);
    print_vars($oids);
}
foreach ($oids as $meter => $entry1) {
    $name = $meters[$meter]['mtName'];
    foreach ($entry1 as $idx => $entry) {
        $index = "{$meter}.{$idx}";
        $descr = $entry['mtvalName'];
        if ($name) {
            $descr .= ' - ' . $name;
        }
        $oid_name = 'mtvalMbusValue';
        $oid_num = ".1.3.6.1.4.1.21796.4.6.1.3.1.6.{$index}";
        $type = $mib . '-' . $oid_name;
     $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", mib_dirs(array("cisco")));
 unset($device_context);
 if ($GLOBALS['snmp_status']) {
     $cef_pfxs = snmpwalk_cache_twopart_oid($device, "cefFIBSummaryEntry", array(), "CISCO-CEF-MIB", mib_dirs(array("cisco")));
     if (!is_array($entity_array)) {
         echo "Caching OIDs: ";
         $entity_array = array();
         echo " entPhysicalDescr";
         $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "ENTITY-MIB");
         echo " entPhysicalName";
         $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "ENTITY-MIB");
         echo " entPhysicalModelName";
         $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalModelName", $entity_array, "ENTITY-MIB");
     }
     $polled = time();
 }
 if (OBS_DEBUG > 1 && count($cefs)) {
     print_vars($cefs);
 }
Esempio n. 11
0
}
$service_policies = snmpwalk_cache_oid($device_context, "cbQosIfType", array(), "CISCO-CLASS-BASED-QOS-MIB");
unset($device_context);
if (count($service_policies)) {
    // Continue populating service policies
    $service_policies = snmpwalk_cache_oid($device, "cbQosPolicyDirection", $service_policies, "CISCO-CLASS-BASED-QOS-MIB");
    $service_policies = snmpwalk_cache_oid($device, "cbQosIfIndex", $service_policies, "CISCO-CLASS-BASED-QOS-MIB");
    # $policy_maps = snmpwalk_cache_oid($device, "cbQosPolicyMapCfgEntry", array(), "CISCO-CLASS-BASED-QOS-MIB");
    # $class_maps  = snmpwalk_cache_oid($device, "cbQosCMCfgEntry", array(), "CISCO-CLASS-BASED-QOS-MIB");
    # $object_indexes = snmpwalk_cache_twopart_oid($device, "cbQosConfigIndex", array(), "CISCO-CLASS-BASED-QOS-MIB");
    #print_r($policy_maps);
    #print_r($class_maps);
    #print_r($object_indexes);
    $cm_stats = array();
    foreach ($oids as $oid) {
        $cm_stats = snmpwalk_cache_twopart_oid($device, $oid, $cm_stats, "CISCO-CLASS-BASED-QOS-MIB");
    }
    foreach ($cm_stats as $policy_index => $policy_entry) {
        foreach ($policy_entry as $object_index => $object_entry) {
            $port = get_port_by_ifIndex($device['device_id'], $service_policies[$policy_index]['cbQosIfIndex']);
            $object_entry['port_id'] = $port['port_id'];
            $object_entry['direction'] = $service_policies[$policy_index]['cbQosPolicyDirection'];
            $object_entry['policy_index'] = $policy_index;
            $object_entry['object_index'] = $object_index;
            $object_entry['cm_cfg_index'] = $object_indexes[$policy_index][$object_index]['cbQosConfigIndex'];
            $object_entry['pm_cfg_index'] = $object_indexes[$policy_index][$policy_index]['cbQosConfigIndex'];
            if (!is_numeric($object_entry['pm_cfg_index'])) {
                $object_entry['pm_cfg_index'] = $object_indexes[$policy_index]['1']['cbQosConfigIndex'];
            }
            $object_entry['policy_name'] = $policy_maps[$object_entry['pm_cfg_index']]['cbQosPolicyMapName'];
            $object_entry['policy_desc'] = $policy_maps[$object_entry['pm_cfg_index']]['cbQosPolicyMapDesc'];
Esempio n. 12
0
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
echo 'Port Stacks: ';
// FIXME. Add here discovery CISCO-STACK-MIB::portTable, CISCO-PAGP-MIB::pagpProtocolConfigTable
$query = 'SELECT * FROM `ports_stack` WHERE `device_id` = ?';
foreach (dbFetchRows($query, array($device['device_id'])) as $entry) {
    $stack_db_array[$entry['port_id_high']][$entry['port_id_low']]['ifStackStatus'] = $entry['ifStackStatus'];
}
$stack_poll_array = snmpwalk_cache_twopart_oid($device, 'ifStackStatus', array(), 'IF-MIB');
foreach ($stack_poll_array as $port_id_high => $entry_high) {
    if (is_numeric($port_id_high)) {
        $port_high = get_port_by_index_cache($device, $port_id_high);
        if ($device['os'] == 'ciscosb' && $port_high['ifType'] == 'propVirtual') {
            continue;
        }
        //Skip stacking on Vlan ports (F.u. Cisco SB)
        foreach ($entry_high as $port_id_low => $entry_low) {
            if (is_numeric($port_id_low)) {
                $port_low = get_port_by_index_cache($device, $port_id_low);
                if ($device['os'] == 'ciscosb' && $port_low['ifType'] == 'propVirtual') {
                    continue;
                }
                //Skip stacking on Vlan ports (F.u. Cisco SB)
                $ifStackStatus = $entry_low['ifStackStatus'];
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
//  Polling of AP and radios status for Juniper Wireless (ex Trapeze)
// getting APs and radios
$radios_snmp = snmpwalk_cache_twopart_oid($device, 'trpzApStatRadioOpStatisticsTable', $radios_snmp, 'TRAPEZE-NETWORKS-AP-STATUS-MIB');
if (OBS_DEBUG > 1 && count($radios_snmp)) {
    print_vars($radios_snmp);
}
// OIDs to graph
$oids_counter = array('TxUniPkt', 'TxUniOctet', 'TxMultiPkt', 'TxMultiOctet', 'RxPkt', 'RxOctet', 'UndcrptPkt', 'UndcrptOctet', 'PhyErr', 'ResetCount', 'AutoTuneChannelChangeCount', 'TxRetriesCount', 'ClientAssociations', 'ClientFailedAssociations', 'ClientReAssociations', 'SignalingPkt', 'ReTransmitOctet', 'RefusedConnectionCount', 'RxDataPkt', 'RxAuthPkt', 'RxAssocPkt', 'TxDataPkt', 'TxAuthRespPkt', 'TxAssocRespPkt');
$oids_gauge = array('UserSessions', 'NoiseFloor');
// Goes through the SNMP radio data
foreach ($radios_snmp as $ap_serial => $ap_radios) {
    foreach ($ap_radios as $radio_number => $radio) {
        $rrdupdate = 'N';
        $rrd_create = '';
        if ($radio_number == 'radio-1') {
            $radio_number = 1;
        } else {
            if ($radio_number == 'radio-2') {
                $radio_number = 2;
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$ip_version = 'ipv6';
if (!count($ip_data[$ip_version])) {
    // 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
    $flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP;
    $oid_data = array();
    foreach (array('cIpAddressIfIndex', 'cIpAddressPrefix', 'cIpAddressType', 'cIpAddressOrigin') as $oid) {
        $oid_data = snmpwalk_cache_twopart_oid($device, $oid . '.' . $ip_version, $oid_data, 'CISCO-IETF-IP-MIB', NULL, $flags);
        if ($oid == 'cIpAddressIfIndex' && $GLOBALS['snmp_status'] === FALSE) {
            break;
            // Stop walk, not exist table
        }
    }
    //print_vars($oid_data);
    // Rewrite CISCO-IETF-IP-MIB array
    foreach ($oid_data[$ip_version] as $ip_snmp => $entry) {
        $ip_address = hex2ip($ip_snmp);
        $ifIndex = $entry['cIpAddressIfIndex'];
        $tmp_prefix = explode('.', $entry['cIpAddressPrefix']);
        $entry['cIpAddressPrefix'] = end($tmp_prefix);
        $ip_data[$ip_version][$ifIndex][$ip_address] = array('ifIndex' => $ifIndex, 'ip' => $ip_address, 'prefix' => $entry['cIpAddressPrefix'], 'type' => $entry['cIpAddressType'], 'origin' => $entry['cIpAddressOrigin']);
    }
}
 $oids = snmpwalk_cache_multi_oid($device, "entSensorType", $oids, "CISCO-ENTITY-SENSOR-MIB");
 echo " entSensorScale";
 $oids = snmpwalk_cache_multi_oid($device, "entSensorScale", $oids, "CISCO-ENTITY-SENSOR-MIB");
 echo " entSensorValue";
 $oids = snmpwalk_cache_multi_oid($device, "entSensorValue", $oids, "CISCO-ENTITY-SENSOR-MIB");
 echo " entSensorMeasuredEntity";
 $oids = snmpwalk_cache_multi_oid($device, "entSensorMeasuredEntity", $oids, "CISCO-ENTITY-SENSOR-MIB");
 echo " entSensorPrecision";
 $oids = snmpwalk_cache_multi_oid($device, "entSensorPrecision", $oids, "CISCO-ENTITY-SENSOR-MIB");
 $t_oids = array();
 echo " entSensorThresholdSeverity";
 $t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdSeverity", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
 echo " entSensorThresholdRelation";
 $t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdRelation", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
 echo " entSensorThresholdValue";
 $t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdValue", $t_oids, "CISCO-ENTITY-SENSOR-MIB");
 if ($debug) {
     print_r($oids);
 }
 $entitysensor['voltsDC'] = "voltage";
 $entitysensor['voltsAC'] = "voltage";
 $entitysensor['amperes'] = "current";
 $entitysensor['watt'] = "power";
 $entitysensor['hertz'] = "freq";
 $entitysensor['percentRH'] = "humidity";
 $entitysensor['rpm'] = "fanspeed";
 $entitysensor['celsius'] = "temperature";
 $entitysensor['watts'] = "power";
 $entitysensor['dBm'] = "dbm";
 if (is_array($oids)) {
     foreach ($oids as $index => $entry) {
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
echo " CISCO-CDP-MIB ";
$cdp_array = snmpwalk_cache_twopart_oid($device, "cdpCache", array(), "CISCO-CDP-MIB", mib_dirs('cisco'));
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
                    $remote_device_id = $GLOBALS['cache']['discovery-protocols'][$cdp_entry['cdpCacheDeviceId']];
                } else {
                    $remote_device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($cdp_entry['cdpCacheDeviceId'], $cdp_entry['cdpCacheDeviceId']));
                    // FIXME do LLDP-code-style hostname overwrite here as well? (see below)
                    if (!$remote_device_id && is_valid_hostname($cdp_entry['cdpCacheDeviceId']) && !is_bad_xdp($cdp_entry['cdpCacheDeviceId'], $cdp_entry['cdpCachePlatform'])) {
                        $remote_device_id = discover_new_device($cdp_entry['cdpCacheDeviceId'], 'xdp', 'CDP', $device, $port);
<?php

echo "Physical Inventory : ";
if ($config['enable_inventory']) {
    echo "\nCaching OIDs:";
    $entity_array = array();
    echo " entPhysicalEntry";
    $entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, "ENTITY-MIB:CISCO-ENTITY-VENDORTYPE-OID-MIB");
    echo " entAliasMappingIdentifier";
    $entity_array = snmpwalk_cache_twopart_oid($device, "entAliasMappingIdentifier", $entity_array, "ENTITY-MIB:IF-MIB");
    foreach ($entity_array as $entPhysicalIndex => $entry) {
        $entPhysicalDescr = $entry['entPhysicalDescr'];
        $entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
        $entPhysicalClass = $entry['entPhysicalClass'];
        $entPhysicalName = $entry['entPhysicalName'];
        $entPhysicalSerialNum = $entry['entPhysicalSerialNum'];
        $entPhysicalModelName = $entry['entPhysicalModelName'];
        $entPhysicalMfgName = $entry['entPhysicalMfgName'];
        $entPhysicalVendorType = $entry['entPhysicalVendorType'];
        $entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
        $entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
        $entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
        $entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
        $entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
        $entPhysicalAlias = $entry['entPhysicalAlias'];
        $entPhysicalAssetID = $entry['entPhysicalAssetID'];
        if (isset($entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier'])) {
            $ifIndex = $entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier'];
        }
        if (!strpos($ifIndex, "fIndex") || $ifIndex == "") {
            unset($ifIndex);
<?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
 *
 */
$isdp_array = snmpwalk_cache_twopart_oid($device, "agentIsdpCache", array(), "FASTPATH-ISDP-MIB");
// FIXME, make this code generic for all *-ISDP-MIB
if ($isdp_array) {
    foreach ($isdp_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 => $isdp_entry) {
            list($isdp_entry['agentIsdpCacheDeviceId']) = explode('(', $isdp_entry['agentIsdpCacheDeviceId']);
            // Fix for Nexus ISDP neighbors: <hostname>(serial number)
            $remote_device_id = FALSE;
            if (is_valid_hostname($isdp_entry['agentIsdpCacheDeviceId'])) {
                if (isset($GLOBALS['cache']['discovery-protocols'][$isdp_entry['agentIsdpCacheDeviceId']])) {
                    // This hostname already checked, skip discover
                    $remote_device_id = $GLOBALS['cache']['discovery-protocols'][$isdp_entry['agentIsdpCacheDeviceId']];
                } else {
                    $remote_device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($isdp_entry['agentIsdpCacheDeviceId'], $isdp_entry['agentIsdpCacheDeviceId']));
                    // FIXME do LLDP-code-style hostname overwrite here as well? (see below)
                    if (!$remote_device_id && is_valid_hostname($isdp_entry['agentIsdpCacheDeviceId']) && !is_bad_xdp($isdp_entry['agentIsdpCacheDeviceId'], $isdp_entry['agentIsdpCachePlatform'])) {
                        // For now it's a Cisco so CDP discovery is ok
 $oids = snmpwalk_cache_multi_oid($device, 'entSensorType', $oids, 'CISCO-ENTITY-SENSOR-MIB');
 echo ' entSensorScale';
 $oids = snmpwalk_cache_multi_oid($device, 'entSensorScale', $oids, 'CISCO-ENTITY-SENSOR-MIB');
 echo ' entSensorValue';
 $oids = snmpwalk_cache_multi_oid($device, 'entSensorValue', $oids, 'CISCO-ENTITY-SENSOR-MIB');
 echo ' entSensorMeasuredEntity';
 $oids = snmpwalk_cache_multi_oid($device, 'entSensorMeasuredEntity', $oids, 'CISCO-ENTITY-SENSOR-MIB');
 echo ' entSensorPrecision';
 $oids = snmpwalk_cache_multi_oid($device, 'entSensorPrecision', $oids, 'CISCO-ENTITY-SENSOR-MIB');
 $t_oids = array();
 echo ' entSensorThresholdSeverity';
 $t_oids = snmpwalk_cache_twopart_oid($device, 'entSensorThresholdSeverity', $t_oids, 'CISCO-ENTITY-SENSOR-MIB');
 echo ' entSensorThresholdRelation';
 $t_oids = snmpwalk_cache_twopart_oid($device, 'entSensorThresholdRelation', $t_oids, 'CISCO-ENTITY-SENSOR-MIB');
 echo ' entSensorThresholdValue';
 $t_oids = snmpwalk_cache_twopart_oid($device, 'entSensorThresholdValue', $t_oids, 'CISCO-ENTITY-SENSOR-MIB');
 d_echo($oids);
 $entitysensor['voltsDC'] = 'voltage';
 $entitysensor['voltsAC'] = 'voltage';
 $entitysensor['amperes'] = 'current';
 $entitysensor['watt'] = 'power';
 $entitysensor['hertz'] = 'freq';
 $entitysensor['percentRH'] = 'humidity';
 $entitysensor['rpm'] = 'fanspeed';
 $entitysensor['celsius'] = 'temperature';
 $entitysensor['watts'] = 'power';
 $entitysensor['dBm'] = 'dbm';
 if (is_array($oids)) {
     foreach ($oids as $index => $entry) {
         // echo("[" . $entry['entSensorType'] . "|" . $entry['entSensorValue']. "|" . $index . "]");
         if ($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index)) {
<?php

echo " E7-Calix-MIB ";
// This device not have self Indexes.
// Use workaround ($base_vendor_index * 100000) + ($e7CardBank * 1000) + $e7CardIndex
$base_vendor_index = 6321;
$inventory_mib = 'e7-calix';
// System
$e7SystemId = snmp_get($device, 'e7SystemId.0', '-OQUs', 'E7-Calix-MIB', mib_dirs('calix'));
if ($e7SystemId) {
    $e7SystemChassisSerialNumber = snmp_get($device, '.1.3.6.1.4.1.6321.1.2.2.2.1.7.10.0', '-Oqvn');
    $system_index = $base_vendor_index * 100000;
    $inventory[$system_index] = array('entPhysicalDescr' => 'Calix Networks, E7 Ethernet Service Access Platform', 'entPhysicalClass' => 'chassis', 'entPhysicalName' => 'E7 ESAP', 'entPhysicalSerialNum' => $e7SystemChassisSerialNumber, 'entPhysicalAssetID' => $e7SystemId, 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 0, 'entPhysicalParentRelPos' => 0, 'entPhysicalMfgName' => 'Calix');
    discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], $inventory_mib);
    // Cards
    $E7CardEntry = snmpwalk_cache_twopart_oid($device, 'E7CardEntry', array(), 'E7-Calix-MIB', mib_dirs('calix'));
    foreach ($E7CardEntry as $e7CardBank => $entries) {
        $bank_index = $system_index + $e7CardBank * 1000;
        $inventory[$bank_index] = array('entPhysicalDescr' => 'E7 ESAP Bank', 'entPhysicalClass' => 'container', 'entPhysicalName' => 'Bank ' . $e7CardBank, 'entPhysicalIsFRU' => 'false', 'entPhysicalContainedIn' => $system_index, 'entPhysicalParentRelPos' => $e7CardBank, 'entPhysicalMfgName' => 'Calix');
        discover_inventory($valid['inventory'], $device, $bank_index, $inventory[$bank_index], $inventory_mib);
        foreach ($entries as $e7CardIndex => $entry) {
            $card_index = $bank_index + $e7CardIndex;
            $inventory[$card_index] = array('entPhysicalDescr' => 'E7 ESAP Card', 'entPhysicalClass' => 'other', 'entPhysicalName' => 'Card ' . ucfirst($entry['e7CardActualType']), 'entPhysicalVendorType' => $entry['e7CardActualType'], 'entPhysicalSerialNum' => $entry['e7CardSerialNumber'], 'entPhysicalSoftwareRev' => $entry['e7CardSoftwareVersion'], 'entPhysicalIsFRU' => 'false', 'entPhysicalContainedIn' => $bank_index, 'entPhysicalParentRelPos' => $e7CardIndex, 'entPhysicalMfgName' => 'Calix');
            discover_inventory($valid['inventory'], $device, $card_index, $inventory[$card_index], $inventory_mib);
        }
    }
    if ($debug && count($inventory)) {
        print_vars($inventory);
    }
}
// EOF
Esempio n. 21
0
     $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);
 if ($GLOBALS['snmp_status']) {
     $cef_pfxs = snmpwalk_cache_twopart_oid($device, 'cefFIBSummaryEntry', array(), 'CISCO-CEF-MIB');
     if (!is_array($entity_array)) {
         echo 'Caching OIDs: ';
         $entity_array = array();
         echo ' entPhysicalDescr';
         $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalDescr', $entity_array, 'ENTITY-MIB');
         echo ' entPhysicalName';
         $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalName', $entity_array, 'ENTITY-MIB');
         echo ' entPhysicalModelName';
         $entity_array = snmpwalk_cache_multi_oid($device, 'entPhysicalModelName', $entity_array, 'ENTITY-MIB');
     }
     $polled = time();
 }
 if (OBS_DEBUG > 1 && count($cefs)) {
     print_vars($cefs);
 }
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$mib = "RITTAL-CMC-III-MIB";
echo " {$mib} ";
$cache['rittalcmc3'] = snmpwalk_cache_twopart_oid($device, "cmcIIIVarTable", array(), $mib);
#print_r($cache['rittalcmc3']);
foreach ($cache['rittalcmc3'] as $deviceIndex => $sensors) {
    foreach ($sensors as $sensorIndex => $sensor) {
        $scale_s = $sensor['cmcIIIVarScale'];
        switch ($scale_s[0]) {
            case '-':
                $scale = 1 / (int) substr($scale_s, 1);
                break;
            case '+':
                $scale = (int) substr($scale_s, 1);
                break;
            default:
                $scale = 1;
        }
        $unit = $sensor['cmcIIIVarUnit'];
        $type = $sensor['cmcIIIVarType'];
Esempio n. 23
0
<?php

if ($device['os_group'] == 'cisco') {
    echo 'Cisco VLANs : ';
    // Not sure why we check for VTP, but this data comes from that MIB, so...
    $vtpversion = snmp_get($device, 'vtpVersion.0', '-OnvQ', 'CISCO-VTP-MIB');
    if ($vtpversion == '1' || $vtpversion == '2' || $vtpversion == '3' || $vtpversion == 'one' || $vtpversion == 'two' || $vtpversion == 'three' || $vtpversion == 'none') {
        // FIXME - can have multiple VTP domains.
        $vtpdomains = snmpwalk_cache_oid($device, 'vlanManagementDomains', array(), 'CISCO-VTP-MIB');
        $vlans = snmpwalk_cache_twopart_oid($device, 'vtpVlanEntry', array(), 'CISCO-VTP-MIB');
        foreach ($vtpdomains as $vtpdomain_id => $vtpdomain) {
            echo 'VTP Domain  ' . $vtpdomain_id . ' ' . $vtpdomain['managementDomainName'] . ' ';
            foreach ($vlans[$vtpdomain_id] as $vlan_id => $vlan) {
                echo " {$vlan_id}";
                if (is_array($vlans_db[$vtpdomain_id][$vlan_id])) {
                    echo '.';
                } else {
                    dbInsert(array('device_id' => $device['device_id'], 'vlan_domain' => $vtpdomain_id, 'vlan_vlan' => $vlan_id, 'vlan_name' => $vlan['vtpVlanName'], 'vlan_type' => $vlan['vtpVlanType']), 'vlans');
                    echo '+';
                }
                $device['vlans'][$vtpdomain_id][$vlan_id] = $vlan_id;
            }
        }
    }
    echo "\n";
}
 *
 */
echo " CISCO-VTP-MIB ";
// Not sure why we check for VTP, but this data comes from that MIB, so...
$vtpversion = snmp_get($device, "vtpVersion.0", "-OnvQ", "CISCO-VTP-MIB");
switch ($vtpversion) {
    case 'none':
    case '1':
    case '2':
    case '3':
    case 'one':
    case 'two':
    case 'three':
        // FIXME - can have multiple VTP domains.
        $vtpdomains = snmpwalk_cache_oid($device, "vlanManagementDomains", array(), "CISCO-VTP-MIB");
        $vlans = snmpwalk_cache_twopart_oid($device, "vtpVlanEntry", array(), "CISCO-VTP-MIB");
        foreach ($vtpdomains as $vtpdomain_id => $vtpdomain) {
            echo "VTP Domain  " . $vtpdomain_id . " " . $vtpdomain['managementDomainName'] . " ";
            foreach ($vlans[$vtpdomain_id] as $vlan_id => $vlan) {
                unset($vlan_update);
                if (is_array($vlans_db[$vtpdomain_id][$vlan_id]) && $vlans_db[$vtpdomain_id][$vlan_id]['vlan_name'] != $vlan['vtpVlanName']) {
                    $vlan_update['vlan_name'] = $vlan['vtpVlanName'];
                }
                if (is_array($vlans_db[$vtpdomain_id][$vlan_id]) && $vlans_db[$vtpdomain_id][$vlan_id]['vlan_mtu'] != $vlan['vtpVlanMtu']) {
                    $vlan_update['vlan_mtu'] = $vlan['vtpVlanMtu'];
                }
                if (is_array($vlans_db[$vtpdomain_id][$vlan_id]) && $vlans_db[$vtpdomain_id][$vlan_id]['vlan_status'] != $vlan['vtpVlanState']) {
                    $vlan_update['vlan_status'] = $vlan['vtpVlanState'];
                }
                echo " {$vlan_id}";
                if (is_array($vlan_update)) {
                $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '" . $fdp['snFdpCacheDeviceId'] . "' OR `hostname`='" . $fdp['snFdpCacheDeviceId'] . "'"), 0);
                if ($remote_device_id) {
                    $if = $fdp['snFdpCacheDevicePort'];
                    $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '{$if}' OR `ifName`='{$if}') AND `device_id` = '" . $remote_device_id . "'"), 0);
                } else {
                    $remote_interface_id = "0";
                }
                discover_link($interface['interface_id'], $fdp['snFdpCacheVendorId'], $remote_interface_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']);
            }
        }
    }
}
if ($device['os_group'] == "ios") {
    echo " CISCO-CDP-MIB: ";
    unset($cdp_array);
    $cdp_array = snmpwalk_cache_twopart_oid("cdpCache", $device, array(), "CISCO-CDP-MIB");
    $cdp_array = $cdp_array[$device['device_id']];
    if ($cdp_array) {
        unset($cdp_links);
        foreach (array_keys($cdp_array) as $key) {
            $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE device_id = '" . $device['device_id'] . "' AND `ifIndex` = '" . $key . "'"));
            $cdp_if_array = $cdp_array[$key];
            foreach (array_keys($cdp_if_array) as $entry_key) {
                $cdp = $cdp_if_array[$entry_key];
                $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '" . $cdp['cdpCacheDeviceId'] . "' OR `hostname`='" . $cdp['cdpCacheDeviceId'] . "'"), 0);
                if ($remote_device_id) {
                    $if = $cdp['cdpCacheDevicePort'];
                    $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '{$if}' OR `ifName`='{$if}') AND `device_id` = '" . $remote_device_id . "'"), 0);
                } else {
                    $remote_interface_id = "0";
                }
Esempio n. 26
0
if (count($port_stats) == 0) {
    // If not has standard IF-MIB table, use NETAPP specific tables
    $mib = 'NETAPP-MIB';
    //NETAPP-MIB::netifDescr.11 = STRING: "vega-01:MGMT_PORT_ONLY e0P"
    //NETAPP-MIB::netifDescr.12 = STRING: "vega-01:MGMT_PORT_ONLY e0M"
    //NETAPP-MIB::netifDescr.15 = STRING: "vega-01:a0m"
    //NETAPP-MIB::netifDescr.16 = STRING: "vega-01:a0m-40"
    print_cli($mib . '::netifDescr ');
    $netif_stat = snmpwalk_cache_oid($device, 'netifDescr', array(), $mib);
    if (OBS_DEBUG > 1 && count($netif_stat)) {
        print_vars($netif_stat);
    }
    $flags = OBS_SNMP_ALL ^ OBS_QUOTES_STRIP;
    $netport_stat = snmpwalk_cache_twopart_oid($device, 'netportLinkState', array(), $mib, NULL, $flags);
    print_cli($mib . '::netportLinkState ');
    $netport_stat = snmpwalk_cache_twopart_oid($device, 'netportType', $netport_stat, $mib, NULL, $flags);
    print_cli($mib . '::netportType ');
    if (OBS_DEBUG > 1 && count($netport_stat)) {
        print_vars($netport_stat);
    }
    $mib_config =& $config['mibs'][$mib]['ports']['oids'];
    // Attach MIB options/translations
    //print_vars($mib_config);
    // Now rewrite to standard IF-MIB array
    foreach ($netif_stat as $ifIndex => $port) {
        list($port['netportNode'], $port['netportPort']) = explode(':', $port['netifDescr'], 2);
        $port['netportPort'] = str_ireplace('MGMT_PORT_ONLY ', '', $port['netportPort']);
        if (isset($netport_stat[$port['netportNode']][$port['netportPort']])) {
            // ifDescr
            $oid = 'ifDescr';
            $port[$oid] = $port[$mib_config[$oid]['oid']];
Esempio n. 27
0
                    $remote_port_id = dbFetchCell('SELECT port_id FROM `ports` WHERE (`ifDescr` = ? OR `ifName` = ?) AND `device_id` = ?', array($if, $if, $remote_device_id));
                } else {
                    $remote_port_id = '0';
                }
                discover_link($interface['port_id'], $fdp['snFdpCacheVendorId'], $remote_port_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion'], $device['device_id'], $remote_device_id);
            }
        }
        //end foreach
    }
    //end if
}
//end if
echo ' CISCO-CDP-MIB: ';
unset($cdp_array);
if ($config['autodiscovery']['xdp'] === true) {
    $cdp_array = snmpwalk_cache_twopart_oid($device, 'cdpCache', array(), 'CISCO-CDP-MIB');
    d_echo($cdp_array);
    if ($cdp_array) {
        unset($cdp_links);
        foreach (array_keys($cdp_array) as $key) {
            $interface = dbFetchRow('SELECT * FROM `ports` WHERE device_id = ? AND `ifIndex` = ?', array($device['device_id'], $key));
            $cdp_if_array = $cdp_array[$key];
            d_echo($cdp_if_array);
            foreach (array_keys($cdp_if_array) as $entry_key) {
                $cdp = $cdp_if_array[$entry_key];
                if (is_valid_hostname($cdp['cdpCacheDeviceId'])) {
                    $remote_device_id = dbFetchCell('SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?', array($cdp['cdpCacheDeviceId'], $cdp['cdpCacheDeviceId']));
                    if (!$remote_device_id) {
                        $skip_discovery = false;
                        if ($skip_discovery === false) {
                            $skip_discovery = can_skip_discovery($config['autodiscovery']['cdp_exclude']['platform_regexp'], $cdp['cdpCachePlatform'], $cdp['cdpCacheDeviceId']);
Esempio n. 28
0
<?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
 *
 */
$isdp_array = snmpwalk_cache_twopart_oid($device, "agentIsdpCache", array(), "NETGEAR-ISDP-MIB");
// FIXME, make this code generic for all *-ISDP-MIB
if ($isdp_array) {
    foreach ($isdp_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 => $isdp_entry) {
            list($isdp_entry['agentIsdpCacheDeviceId']) = explode('(', $isdp_entry['agentIsdpCacheDeviceId']);
            // Fix for Nexus ISDP neighbors: <hostname>(serial number)
            $remote_device_id = FALSE;
            if (is_valid_hostname($isdp_entry['agentIsdpCacheDeviceId'])) {
                if (isset($GLOBALS['cache']['discovery-protocols'][$isdp_entry['agentIsdpCacheDeviceId']])) {
                    // This hostname already checked, skip discover
                    $remote_device_id = $GLOBALS['cache']['discovery-protocols'][$isdp_entry['agentIsdpCacheDeviceId']];
                } else {
                    $remote_device_id = dbFetchCell("SELECT `device_id` FROM `devices` WHERE `sysName` = ? OR `hostname` = ?", array($isdp_entry['agentIsdpCacheDeviceId'], $isdp_entry['agentIsdpCacheDeviceId']));
                    // FIXME do LLDP-code-style hostname overwrite here as well? (see below)
                    if (!$remote_device_id && is_valid_hostname($isdp_entry['agentIsdpCacheDeviceId']) && !is_bad_xdp($isdp_entry['agentIsdpCacheDeviceId'], $isdp_entry['agentIsdpCachePlatform'])) {
                        // For now it's a Cisco so CDP discovery is ok
Esempio n. 29
0
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) {
    foreach ($entry2 as $sla_name => $entry) {
        if (!isset($entry['pingCtlAdminStatus']) || $sla_owner == 'imclinktopologypleaseignore') {
            continue;
        }
        // Get full index
        $sla_index = snmp_translate('pingCtlRowStatus."' . $sla_owner . '"."' . $sla_name . '"', $mib);
        $sla_index = str_replace('.1.3.6.1.2.1.80.1.2.1.23.', '', $sla_index);
        $data = array('device_id' => $device['device_id'], 'sla_mib' => $mib, 'sla_index' => $sla_name, 'sla_owner' => $sla_owner, 'sla_tag' => $entry['pingCtlTargetAddress'], 'sla_status' => $entry['pingCtlRowStatus'], 'sla_graph' => 'jitter', 'deleted' => 0);
        if ($entry['pingCtlAdminStatus'] == 'disabled') {
Esempio n. 30
0
                    $value = $entry['inputPowerFactor'];
                    discover_sensor($valid['sensor'], 'powerfactor', $device, $oid, "inputPowerFactor.{$entry_oid}", 'eaton-epdu-mib', $descr, 0.001, $value);
                }
                if (isset($entry['inputVAR']) && is_numeric($entry['inputVAR'])) {
                    $descr = "Unit {$unit_id} Input {$input_id} " . $entry['inputPowerMeasType'];
                    $oid = ".1.3.6.1.4.1.534.6.6.7.3.4.1.8." . $entry_oid;
                    $value = $entry['inputVAR'];
                    discover_sensor($valid['sensor'], 'rpower', $device, $oid, "inputVAR.{$entry_oid}", 'eaton-epdu-mib', $descr, 1, $value);
                }
            }
        }
    }
}
// Collect data about outputs
$outlets = snmpwalk_cache_twopart_oid($device, 'outletTable', array(), 'EATON-EPDU-MIB');
$outlets = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
// Power statistics currently not collected.
//$outlets      = snmpwalk_cache_twopart_oid($device, 'outletCurrentTable', $outlets, 'EATON-EPDU-MIB');
foreach ($outlets as $unit_id => $unit_data) {
    foreach ($unit_data as $outlet_id => $outlet) {
        $outlet_index = $unit_id . "." . $outlet_id;
        $outlet_descr = "Unit {$unit_id} " . $outlet['outletName'] . " (" . $outlet['outletType'] . ")";
        $outlet_capacity = $outlet['outletCurrentCapacity'] * 0.001;
        $current_value = $outlet['outletCurrent'];
        $percent_value = $outlet['outletCurrentPercentLoad'];
        $status_value = $outlet['outletCurrentThStatus'];
        $crest_value = $outlet['outletCurrentCrestFactor'];
        $current_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.3.' . $outlet_index;
        $percent_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.10.' . $outlet_index;
        $status_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.4.' . $outlet_index;
        $crest_oid = '.1.3.6.1.4.1.534.6.6.7.6.4.1.9.' . $outlet_index;