当前位置: 首页>>代码示例>>PHP>>正文


PHP is_device_mib函数代码示例

本文整理汇总了PHP中is_device_mib函数的典型用法代码示例。如果您正苦于以下问题:PHP is_device_mib函数的具体用法?PHP is_device_mib怎么用?PHP is_device_mib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_device_mib函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

<?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;
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:cisco.inc.php

示例2: array_unique

    }
  }
  $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;
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:include-dir-mib.inc.php

示例3: print_debug

     }
     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']];
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:entity-sensor-mib.inc.php

示例4: print_debug

 * 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':
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:os.inc.php

示例5: snmpwalk_cache_oid

 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <adama@memetic.org>
 * @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']) {
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:q-bridge-mib.inc.php

示例6:

#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'];
    }
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:cisco-ipsec-flow-monitor.inc.php

示例7: none

 * 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
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:cisco-vpdn.inc.php

示例8: mib_dirs

 *
 *   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;
            }
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:entity-mib.inc.php

示例9: array

<?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';
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:entity-physical.inc.php

示例10: unset

<?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
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:22,代码来源:peakflow-sp-mib.inc.php

示例11: snmp_get

<?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
开发者ID:Natolumin,项目名称:observium,代码行数:25,代码来源:cambium-ptp.inc.php

示例12: enabled

<?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
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ospf.inc.php

示例13: snmp_get

$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
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:system.inc.php

示例14: snmpwalk_cache_twopart_oid

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <adama@observium.org>
 * @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
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:cisco-cdp-mib.inc.php

示例15: array

#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
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:cisco-remote-access-monitor.inc.php


注:本文中的is_device_mib函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。