• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mib_dirs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: snmp_translate

function snmp_translate($oid, $mib = NULL, $mibdir = NULL)
{
    // $rewrite_oids set in rewrites.php
    global $rewrite_oids, $config, $debug;
    if ($mib) {
        // If $mib::$oid known in $rewrite_oids use this value instead shell command snmptranslate.
        if (isset($rewrite_oids[$mib][$oid])) {
            if ($debug) {
                echo "TRANSLATE (REWRITE):[" . $rewrite_oids[$mib][$oid] . "]\n";
            }
            return $rewrite_oids[$mib][$oid];
        }
        $oid = "{$mib}::{$oid}";
    }
    $cmd = $config['snmptranslate'];
    if ($options) {
        $cmd .= ' ' . $options;
    } else {
        $cmd .= ' -On';
    }
    if ($mib) {
        $cmd .= ' -m ' . $mib;
    }
    if ($mibdir) {
        $cmd .= ' -M ' . $mibdir;
    } else {
        $cmd .= ' -M ' . mib_dirs();
    }
    $cmd .= ' ' . $oid;
    if (!$debug) {
        $cmd .= ' 2>/dev/null';
    }
    $data = trim(external_exec($cmd));
    if ($data && !strstr($data, 'Unknown')) {
        if ($debug) {
            echo "TRANSLATE (CMD): {$oid} [" . $data . "]";
        }
        return $data;
    } else {
        return '';
    }
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:42,代码来源:snmp.inc.php


示例2: snmpwalk_cache_oid

<?php

// Ignore this discovery module if we have already discovered things in CISCO-ENHANCED-MEMPOOL-MIB. Dirty duplication.
if (!isset($valid['mempool']['cisco-enhanced-mempool-mib'])) {
    $mib = 'CISCO-MEMORY-POOL-MIB';
    echo " {$mib} ";
    $mempool_array = snmpwalk_cache_oid($device, 'ciscoMemoryPool', NULL, $mib, mib_dirs('cisco'));
    if (is_array($mempool_array)) {
        foreach ($mempool_array as $index => $entry) {
            if (is_numeric($entry['ciscoMemoryPoolUsed']) && is_numeric($index)) {
                $descr = $entry['ciscoMemoryPoolName'];
                $used = $entry['ciscoMemoryPoolUsed'];
                $free = $entry['ciscoMemoryPoolFree'];
                $total = $used + $free;
                discover_mempool($valid['mempool'], $device, $index, $mib, $descr, 1, $total, $used);
            }
        }
    }
    unset($mempool_array, $index, $descr, $total, $used, $free);
}
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:21,代码来源:cisco-memory-pool-mib.inc.php


示例3: snmpwalk_cache_oid

<?php

# NETSWITCH-MIB::hpGlobalMemSlotIndex.1 = INTEGER: 1
# NETSWITCH-MIB::hpGlobalMemSlabCnt.1 = Counter32: 3966
# NETSWITCH-MIB::hpGlobalMemFreeSegCnt.1 = Counter32: 166
# NETSWITCH-MIB::hpGlobalMemAllocSegCnt.1 = Counter32: 3803
# NETSWITCH-MIB::hpGlobalMemTotalBytes.1 = INTEGER: 11337704
# NETSWITCH-MIB::hpGlobalMemFreeBytes.1 = INTEGER: 9669104
# NETSWITCH-MIB::hpGlobalMemAllocBytes.1 = INTEGER: 1668728
if (!is_array($mempool_cache['hpGlobal'])) {
    $mempool_cache['hpGlobal'] = snmpwalk_cache_oid($device, "hpGlobal", NULL, "NETSWITCH-MIB", mib_dirs('hp'));
    if ($debug) {
        print_r($mempool_cache);
    }
} else {
    if ($debug) {
        echo "Cached!";
    }
}
$entry = $mempool_cache['hpGlobal'][$mempool[mempool_index]];
$mempool['units'] = "1";
$mempool['used'] = $entry['hpGlobalMemAllocBytes'];
$mempool['total'] = $entry['hpGlobalMemTotalBytes'];
$mempool['free'] = $entry['hpGlobalMemFreeBytes'];
开发者ID:RomanBogachev,项目名称:observium,代码行数:24,代码来源:hpGlobal.inc.php


示例4: snmp_get

<?php

///
//  Hardcoded discovery of cpu usage on HP Procurve devices.
///
//  STATISTICS-MIB::hpSwitchCpuStat.0 = INTEGER: 10
if ($device['os'] == "procurve") {
    echo "Procurve : ";
    $descr = "Processor";
    $usage = snmp_get($device, ".1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "-OQUvs", "STATISTICS-MIB", mib_dirs('hp'));
    if (is_numeric($usage)) {
        discover_processor($valid['processor'], $device, "1.3.6.1.4.1.11.2.14.11.5.1.9.6.1.0", "0", "procurve-fixed", $descr, "1", $usage, NULL, NULL);
    }
}
unset($processors_array);
开发者ID:RomanBogachev,项目名称:observium,代码行数:15,代码来源:procurve.inc.php


示例5: str_replace

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
#NS-ROOT-MIB::sysHardwareVersionDesc.0 = STRING: "7000 v1 6*EZ+2*EM"
#NS-ROOT-MIB::sysBuildVersion.0 = STRING: "NetScaler NS8.1: Build 69.4, Date: Jan 28 2010, 02:00:43  "
$hardware = str_replace("\"", "", snmp_get($device, "sysHardwareVersionDesc.0", "-Osqv", "SNMPv2-MIB:NS-ROOT-MIB", mib_dirs('citrix')));
$version = str_replace("\"", "", snmp_get($device, "sysBuildVersion.0", "-Osqv", "SNMPv2-MIB:NS-ROOT-MIB", mib_dirs('citrix')));
$serial = str_replace("\"", "", snmp_get($device, "sysHardwareSerialNumber.0", "-Osqv", "SNMPv2-MIB:NS-ROOT-MIB", mib_dirs('citrix')));
list($version, $features) = explode(":", $version);
list(, $version) = explode(" ", $version);
list($features) = explode(",", trim($features));
// EOF
开发者ID:skive,项目名称:observium,代码行数:21,代码来源:netscaler.inc.php


示例6: trim

 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Yes, that's the Kenel version.
$version = "Kernel " . trim(snmp_get($device, "entKenelVersion.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" ');
$version .= " / Apps " . trim(snmp_get($device, "entAppVersion.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" ');
$serial = trim(snmp_get($device, "entSN.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" ');
// There doesn't seem to be a real hardware identification.. sysName will have to do?
$hardware = str_replace("EnGenius ", "", snmp_get($device, "sysName.0", "-OQv")) . " v" . trim(snmp_get($device, "entHwVersion.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao')), '" .');
$mode = snmp_get($device, "entSysMode.0", "-OQv", "SENAO-ENTERPRISE-INDOOR-AP-CB-MIB", mib_dirs('senao'));
switch ($mode) {
    case 0:
        $features = "Router mode";
        break;
    case 1:
        $features = "Universal repeater mode";
        break;
    case 2:
        $features = "Access Point mode";
        break;
    case 3:
        $features = "Client Bridge mode";
        break;
    case 4:
        $features = "Client router mode";
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:engenius.inc.php


示例7: trim

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$hardware = trim(snmp_get($device, "spManufName.0", "-OQv", "SPAGENT-MIB", mib_dirs('akcp')), '"');
$hardware .= ' ' . trim(snmp_get($device, "spProductName.0", "-OQv", "SPAGENT-MIB", mib_dirs('akcp')), '" ');
// EOF
开发者ID:skive,项目名称:observium,代码行数:15,代码来源:sensorprobe.inc.php


示例8: createHost

function createHost($hostname, $snmp_community = NULL, $snmp_version, $snmp_port = 161, $snmp_transport = 'udp', $snmp_v3 = array())
{
    $hostname = trim(strtolower($hostname));
    $device = array('hostname' => $hostname, 'sysName' => $hostname, 'status' => '1', 'snmp_community' => $snmp_community, 'snmp_port' => $snmp_port, 'snmp_transport' => $snmp_transport, 'snmp_version' => $snmp_version);
    // Add snmp v3 auth params
    foreach (array('authlevel', 'authname', 'authpass', 'authalgo', 'cryptopass', 'cryptoalgo') as $v3_key) {
        if (isset($snmp_v3['snmp_' . $v3_key])) {
            // Or $snmp_v3['snmp_authlevel']
            $device['snmp_' . $v3_key] = $snmp_v3['snmp_' . $v3_key];
        } else {
            if (isset($snmp_v3[$v3_key])) {
                // Or $snmp_v3['authlevel']
                $device['snmp_' . $v3_key] = $snmp_v3[$v3_key];
            }
        }
    }
    // This is compatibility code after refactor in r6306, for keep devices up before DB updated
    if (get_db_version() < 189) {
        // FIXME. Remove this in r7000
        $device['snmpver'] = $device['snmp_version'];
        unset($device['snmp_version']);
        foreach (array('transport', 'port', 'timeout', 'retries', 'community', 'authlevel', 'authname', 'authpass', 'authalgo', 'cryptopass', 'cryptoalgo') as $old_key) {
            if (isset($device['snmp_' . $old_key])) {
                // Convert to old device snmp keys
                $device[$old_key] = $device['snmp_' . $old_key];
                unset($device['snmp_' . $old_key]);
            }
        }
    }
    $device['os'] = get_device_os($device);
    $device['snmpEngineID'] = snmp_cache_snmpEngineID($device);
    $device['sysName'] = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['location'] = snmp_get($device, "sysLocation.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['sysContact'] = snmp_get($device, "sysContact.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    if ($device['os']) {
        $device_id = dbInsert($device, 'devices');
        if ($device_id) {
            log_event("设备添加: {$hostname}", $device_id, 'device', $device_id, 5);
            // severity 5, for logging user/console info
            if (is_cli()) {
                print_success("正在使用自动发现功能 " . $device['hostname'] . " (id = " . $device_id . ")");
                $device['device_id'] = $device_id;
                // Discover things we need when linking this to other hosts.
                discover_device($device, $options = array('m' => 'ports'));
                discover_device($device, $options = array('m' => 'ipv4-addresses'));
                discover_device($device, $options = array('m' => 'ipv6-addresses'));
                log_event("snmpEngineID -> " . $device['snmpEngineID'], $device, 'device', $device['device_id']);
                // Reset `last_discovered` for full rediscover device by cron
                dbUpdate(array('last_discovered' => 'NULL'), 'devices', '`device_id` = ?', array($device_id));
                array_push($GLOBALS['devices'], $device_id);
            }
            return $device_id;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:59,代码来源:functions.inc.php


示例9: snmpwalk_cache_multi_oid

 */
echo " GUDEADS-EPC8X-MIB ";
// GUDEADS-EPC8X-MIB::epc8TempSensor.1 = INTEGER: -9999 10th of degree Celsius
// GUDEADS-EPC8X-MIB::epc8TempSensor.2 = INTEGER: -9999 10th of degree Celsius
// GUDEADS-EPC8X-MIB::epc8HygroSensor.1 = INTEGER: -9999 10th of percentage humidity
// GUDEADS-EPC8X-MIB::epc8HygroSensor.2 = INTEGER: -9999 10th of percentage humidity
$cache['epc8x'] = snmpwalk_cache_multi_oid($device, "epc8SensorTable", array(), "GUDEADS-EPC8X-MIB", mib_dirs('gude'));
$scale = 0.1;
foreach ($cache['epc8x'] as $index => $entry) {
    $oid = ".1.3.6.1.4.1.28507.1.1.3.2.1.2.{$index}";
    $descr = "Temp Sensor {$index}";
    $value = $entry['epc8TempSensor'];
    if ($value != '' && $value != -9999) {
        discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'epc8TempSensor.' . $index, 'epc8x', $descr, $scale, $value * $scale);
    }
    $oid = ".1.3.6.1.4.1.28507.1.1.3.2.1.3.{$index}";
    $descr = "Hygro Sensor {$index}";
    $value = $entry['epc8HygroSensor'];
    if ($value != '' && $value != -9999) {
        discover_sensor($valid['sensor'], 'humidity', $device, $oid, 'epc8HygroSensor.' . $index, 'epc8x', $descr, $scale, $value * $scale);
    }
}
// GUDEADS-EPC8X-MIB::epc8Irms.0 = INTEGER: 3121 mA
$oid = ".1.3.6.1.4.1.28507.1.1.3.1.0";
$descr = "Output";
$value = snmp_get($device, "epc8Irms.0", "-Oqv", "GUDEADS-EPC8X-MIB", mib_dirs('gude'));
$scale = 0.001;
if ($value != '' && $value != -9999) {
    discover_sensor($valid['sensor'], 'current', $device, $oid, 'epc8Irms.0', 'epc8x', $descr, $scale, $value * $scale);
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:gudeads-epc8x-mib.inc.php


示例10: snmpwalk_cache_triple_oid

echo " FOUNDRY-SN-AGENT-MIB ";
$processors_array = snmpwalk_cache_triple_oid($device, "snAgentCpuUtilEntry", $processors_array, "FOUNDRY-SN-AGENT-MIB", mib_dirs('foundry'));
if ($debug) {
    print_vars($processors_array);
}
foreach ($processors_array as $index => $entry) {
    if ((isset($entry['snAgentCpuUtilValue']) || isset($entry['snAgentCpuUtil100thPercent'])) && $entry['snAgentCpuUtilInterval'] == "300") {
        #$entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex'];
        if ($entry['snAgentCpuUtil100thPercent']) {
            $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.6." . $index;
            $usage = $entry['snAgentCpuUtil100thPercent'];
            $precision = 100;
        } elseif ($entry['snAgentCpuUtilValue']) {
            $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.4." . $index;
            $usage = $entry['snAgentCpuUtilValue'];
            $precision = 100;
        }
        list($slot, $instance, $interval) = explode(".", $index);
        $descr_oid = "snAgentConfigModuleDescription." . $entry['snAgentCpuUtilSlotNum'];
        $descr = snmp_get($device, $descr_oid, "-Oqv", "FOUNDRY-SN-AGENT-MIB", mib_dirs('foundry'));
        $descr = str_replace("\"", "", $descr);
        list($descr) = explode(" ", $descr);
        $descr = "Slot " . $entry['snAgentCpuUtilSlotNum'] . " " . $descr;
        $descr = $descr . " [" . $instance . "]";
        if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") {
            discover_processor($valid['processor'], $device, $usage_oid, $index, "ironware", $descr, $precision, $usage, $entPhysicalIndex, NULL);
        }
    }
}
unset($processors_array);
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:foundry-sn-agent-mib.inc.php


示例11: snmp_get

<?php

//  Hardcoded discovery of cpu usage on WatchGuard devices.
//
//  WATCHGUARD-SYSTEM-STATISTICS-MIB::wgSystemCpuUtil5.0 = COUNTER: 123
echo " WATCHGUARD-SYSTEM-STATISTICS-MIB ";
$descr = "Processor";
$usage = snmp_get($device, ".1.3.6.1.4.1.3097.6.3.78.0", "-OQUvs", "WATCHGUARD-SYSTEM-STATISTICS-MIB", $config['mib_dir'] . ':' . mib_dirs('watchguard'));
if (is_numeric($usage)) {
    discover_processor($valid['processor'], $device, "1.3.6.1.4.1.3097.6.3.78.0", "0", "firebox-fixed", $descr, "100", $usage, NULL, NULL);
}
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:12,代码来源:watchguard-system-statistics-mib.inc.php


示例12: trim

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// This could do with a decent rewrite using SNMP multi functions, instead of trim() and str_replace() voodoo.
echo " FOUNDRY-SN-AGENT-MIB ";
$oids = trim(snmp_walk($device, "snAgentTempSensorDescr", "-Osqn", "FOUNDRY-SN-AGENT-MIB:FOUNDRY-SN-ROOT-MIB", mib_dirs('foundry')));
$oids = str_replace(".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.", "", $oids);
foreach (explode("\n", $oids) as $data) {
    $data = trim($data);
    if ($data != "") {
        list($oid) = explode(" ", $data);
        $temperature_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.4.{$oid}";
        $descr_oid = ".1.3.6.1.4.1.1991.1.1.2.13.1.1.3.{$oid}";
        $descr = snmp_get($device, $descr_oid, "-Oqv", "");
        $temperature = snmp_get($device, $temperature_oid, "-Oqv", "");
        if (!strstr($descr, "No") && !strstr($temperature, "No") && $descr != "" && $temperature != "0") {
            $descr = str_replace("\"", "", $descr);
            $descr = str_replace("temperature", "", $descr);
            $descr = str_replace("temperature", "", $descr);
            $descr = str_replace("sensor", "Sensor", $descr);
            $descr = str_replace("Line module", "Slot", $descr);
            $descr = str_replace("Switch Fabric module", "Fabric", $descr);
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:foundry-sn-agent-mib.inc.php


示例13: createHost

function createHost($host, $community = NULL, $snmpver, $port = 161, $transport = 'udp', $v3 = array())
{
    $host = trim(strtolower($host));
    $device = array('hostname' => $host, 'sysName' => $host, 'community' => $community, 'port' => $port, 'transport' => $transport, 'status' => '1', 'snmpver' => $snmpver);
    $device = array_merge($device, $v3);
    $device['os'] = get_device_os($device);
    $device['snmpEngineID'] = snmp_cache_snmpEngineID($device);
    $device['sysName'] = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['location'] = snmp_get($device, "sysLocation.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    $device['sysContact'] = snmp_get($device, "sysContact.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
    if ($device['os']) {
        $device_id = dbInsert($device, 'devices');
        if ($device_id) {
            log_event("Device added: {$host}", $device_id, 'device');
            if (is_cli()) {
                print_success("Now discovering " . $device['hostname'] . " (id = " . $device_id . ")");
                $device['device_id'] = $device_id;
                // Discover things we need when linking this to other hosts.
                discover_device($device, $options = array('m' => 'ports'));
                discover_device($device, $options = array('m' => 'ipv4-addresses'));
                discover_device($device, $options = array('m' => 'ipv6-addresses'));
                log_event("snmpEngineID -> " . $device['snmpEngineID'], $device, 'system');
                // Reset `last_discovered` for full rediscover device by cron
                dbUpdate(array('last_discovered' => 'NULL'), 'devices', '`device_id` = ?', array($device_id));
                array_push($GLOBALS['devices'], $device_id);
            }
            return $device_id;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
开发者ID:skive,项目名称:observium,代码行数:34,代码来源:functions.inc.php


示例14: snmpwalk_cache_oid

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$mib = 'HOST-RESOURCES-MIB';
echo " {$mib} ";
$mempool_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES", mib_dirs());
if (is_array($mempool_array)) {
    foreach ($mempool_array as $index => $entry) {
        $descr = $entry['hrStorageDescr'];
        $units = $entry['hrStorageAllocationUnits'];
        $total = $entry['hrStorageSize'] * $units;
        $used = $entry['hrStorageUsed'] * $units;
        $deny = TRUE;
        switch ($entry['hrStorageType']) {
            case 'hrStorageVirtualMemory':
            case 'hrStorageRam':
            case 'hrStorageOther':
            case 'hrStorageTypes.20':
            case 'nwhrStorageDOSMemory':
            case 'nwhrStorageMemoryAlloc':
            case 'nwhrStorageMemoryPermanent':
            case 'nwhrStorageCacheBuffers':
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:host-resources-mib.inc.php


示例15: snmpwalk_cache_oid

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


示例16: snmpwalk_cache_oid

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Note. $cache_discovery['ucd-snmp-mib'] - is cached 'UCD-SNMP-MIB::dskEntry' (see ucd-snmp-mib.inc.php in current directory)
$mib = 'HOST-RESOURCES-MIB';
if (!isset($cache_discovery['host-resources-mib'])) {
    $cache_discovery['host-resources-mib'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES", mib_dirs());
    if (OBS_DEBUG && count($cache_discovery['host-resources-mib'])) {
        print_vars($cache_discovery['host-resources-mib']);
    }
}
if (count($cache_discovery['host-resources-mib'])) {
    echo " {$mib} ";
    foreach ($cache_discovery['host-resources-mib'] as $index => $storage) {
        $hc = 0;
        $mib = 'HOST-RESOURCES-MIB';
        $fstype = $storage['hrStorageType'];
        $descr = $storage['hrStorageDescr'];
        $units = $storage['hrStorageAllocationUnits'];
        $deny = FALSE;
        switch ($fstype) {
            case 'hrStorageVirtualMemory':
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:host-resources-mib.inc.php


示例17: snmpwalk_numericoids

//.1.3.6.1.4.1.32050.2.1.27.5.0 = 303
//.1.3.6.1.4.1.32050.2.1.27.5.1 = -8
//.1.3.6.1.4.1.32050.2.1.27.5.2 = 529
//.1.3.6.1.4.1.32050.2.1.27.5.3 = 531
//.1.3.6.1.4.1.32050.2.1.27.5.4 = 0
//.1.3.6.1.4.1.32050.2.1.27.5.5 = 1000
//.1.3.6.1.4.1.32050.2.1.27.5.6 = -1000
//.1.3.6.1.4.1.32050.2.1.27.6.0 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.1 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.2 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.3 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.4 = 0
//.1.3.6.1.4.1.32050.2.1.27.6.5 = 1000
//.1.3.6.1.4.1.32050.2.1.27.6.6 = -1000
$index_analog = '.1.3.6.1.4.1.32050.2.1.27';
$packetflux_analog = snmpwalk_numericoids($device, $index_analog, array(), 'SNMPv2', mib_dirs());
$oids_analog[0] = array('class' => 'temperature', 'divisor' => 10);
$oids_analog[1] = array('class' => 'voltage', 'divisor' => 10000);
$oids_analog[2] = array('class' => 'voltage', 'divisor' => 10);
$oids_analog[3] = array('class' => 'voltage', 'divisor' => 10);
$oids_analog[4] = array('class' => 'current', 'divisor' => 1000);
$oids_analog[5] = array('class' => 'temperature', 'divisor' => 10);
// What is this?
$oids_analog[6] = array('class' => 'temperature', 'divisor' => 10);
// What is this?
foreach ($oids_analog as $index => $entry) {
    $oid = "{$index_analog}.5.{$index}";
    if (is_numeric($packetflux_analog[$oid])) {
        list($descr) = explode(' (', $packetflux_analog["{$index_analog}.2.{$index}"]);
        $class = $oids_analog[$index]['class'];
        $divisor = $oids_analog[$index]['divisor'];
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:packetflux-mib.inc.php


示例18: snmp_get

 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
echo " GEIST-MIB-V3 ";
$productTitle = snmp_get($device, 'productTitle.0', '-OQv', 'GEIST-MIB-V3', mib_dirs('geist'));
if ($productTitle) {
    // Insert chassis as index 1, everything hangs off of this.
    $system_index = 1;
    $inventory[$system_index] = array('entPhysicalDescr' => $productTitle, 'entPhysicalClass' => 'chassis', 'entPhysicalName' => 'Chassis', 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 0, 'entPhysicalParentRelPos' => -1, 'entPhysicalMfgName' => 'Geist');
    discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], 'geist-mib-v3');
    $relPos = 1;
    // Note: sensors without example SNMP output have not been tested.
    $geist_sensors = array(array('descr' => 'Climate Monitor', 'prefix' => 'climate', 'oid' => 2, 'class' => 'sensor'), array('descr' => 'Power Monitor', 'prefix' => 'powMon', 'oid' => 3, 'class' => 'powerSupply', 'avail' => 1), array('descr' => 'Temperature Sensor', 'prefix' => 'tempSensor', 'oid' => 4, 'class' => 'sensor'), array('descr' => 'AF/HTD Sensor', 'prefix' => 'airFlowSensor', 'oid' => 5, 'class' => 'airflowSensor'), array('descr' => 'DELTA 3 Channel Controller', 'prefix' => 'ctrl3ChDELTA', 'oid' => 6, 'class' => 'sensor'), array('descr' => 'Door Sensor', 'prefix' => 'doorSensor', 'oid' => 7, 'class' => 'sensor'), array('descr' => 'Water Sensor', 'prefix' => 'waterSensor', 'oid' => 8, 'class' => 'sensor'), array('descr' => 'Current Sensor', 'prefix' => 'currentSensor', 'oid' => 9, 'class' => 'sensor'), array('descr' => 'Millivolt Sensor', 'prefix' => 'millivoltSensor', 'oid' => 10, 'class' => 'sensor'), array('descr' => '3 Channel Power Sensor', 'prefix' => 'power3ChSensor', 'oid' => 11, 'class' => 'sensor'), array('descr' => 'Outlet', 'prefix' => 'outlet', 'oid' => 12, 'class' => 'outlet'), array('descr' => 'Fan Controller Monitor', 'prefix' => 'vsfc', 'oid' => 13, 'class' => 'sensor'), array('descr' => '3 Channel Power Monitor', 'prefix' => 'ctrl3Ch', 'oid' => 14, 'class' => 'sensor'), array('descr' => 'Amperage Controller', 'prefix' => 'analogSensor', 'oid' => 15, 'class' => 'powerSupply'), array('descr' => 'Controlled outlet', 'prefix' => 'ctrlOutlet', 'oid' => 16, 'class' => 'outlet', 'avail' => 1), array('descr' => 'Dew Point Sensor', 'prefix' => 'dewpointSensor', 'oid' => 17, 'class' => 'sensor'), array('descr' => 'Digital Sensor', 'prefix' => 'digitalSensor', 'oid' => 18, 'class' => 'sensor'), array('descr' => 'DSTS Controller Sensor', 'prefix' => 'dstsSensor', 'oid' => 19, 'class' => 'sensor'), array('descr' => 'City Power Sensor', 'prefix' => 'cpmSensor', 'oid' => 20, 'class' => 'sensor'), array('descr' => 'Smoke Alarm Sensor', 'prefix' => 'smokeAlarm', 'oid' => 21, 'class' => 'sensor'), array('descr' => '-48VDC Sensor', 'prefix' => 'neg48VdcSensor', 'oid' => 22, 'class' => 'sensor'), array('descr' => '+30VDC Sensor', 'prefix' => 'pos30VdcSensor', 'oid' => 23, 'class' => 'sensor'), array('descr' => 'Analog Sensor', 'prefix' => 'analogSensor', 'oid' => 24, 'class' => 'sensor'), array('descr' => '3 Channel IEC Power Monitor', 'prefix' => 'ctrl3ChIEC', 'oid' => 25, 'class' => 'powerSupply'), array('descr' => 'Climate Relay Monitor', 'prefix' => 'climateRelay', 'oid' => 26, 'class' => 'sensor'), array('descr' => 'Controlled Relay', 'prefix' => 'ctrlRelay', 'oid' => 27, 'class' => 'relay', 'avail' => 1), array('descr' => 'Airspeed Switch Sensor', 'prefix' => 'airSpeedSwitchSensor', 'oid' => 28, 'class' => 'sensor'), array('descr' => 'DM16/48 Current Sensor', 'prefix' => 'powerDM', 'oid' => 29, 'class' => 'sensor'), array('descr' => 'I/O Expander', 'prefix' => 'ioExpander', 'oid' => 30, 'class' => 'sensor'), array('descr' => 'T3HD Sensor', 'prefix' => 't3hdSensor', 'oid' => 31, 'class' => 'sensor'), array('descr' => 'THD Sensor', 'prefix' => 'thdSensor', 'oid' => 32, 'class' => 'sensor'), array('descr' => '+60VDC Sensor', 'prefix' => 'pos60VdcSensor', 'oid' => 33, 'class' => 'sensor'), array('descr' => '3Phase Outlet Control', 'prefix' => 'ctrl2CirTot', 'oid' => 34, 'class' => 'outlet'), array('descr' => 'SC10 Sensor', 'prefix' => 'sc10Sensor', 'oid' => 35, 'class' => 'sensor'));
    foreach ($geist_sensors as $sensor) {
        $cache['geist'][$sensor['prefix'] . 'Table'] = snmpwalk_cache_multi_oid($device, $sensor['prefix'] . 'Table', array(), "GEIST-MIB-V3", mib_dirs('geist'));
        foreach ($cache['geist'][$sensor['prefix'] . 'Table'] as $index => $entry) {
            // Index can only be int in the database, so we create our own from, this sensor is at 21239.2.$oid.
            $system_index = $sensor['oid'] * 256 + $index;
            if ($sensor['avail'] || $entry[$sensor['prefix'] . 'Avail']) {
                $inventory[$system_index] = array('entPhysicalDescr' => $sensor['descr'], 'entPhysicalClass' => $sensor['class'], 'entPhysicalName' => $entry[$sensor['prefix'] . 'Name'], 'entPhysicalSerialNum' => $entry[$sensor['prefix'] . 'Serial'], 'entPhysicalIsFRU' => 'true', 'entPhysicalContainedIn' => 1, 'entPhysicalParentRelPos' => $relPos, 'entPhysicalMfgName' => 'Geist');
                discover_inventory($valid['inventory'], $device, $system_index, $inventory[$system_index], 'geist-mib-v3');
                $relPos++;
            }
        }
    }
}
unset($geist_sensors);
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:geist-mib-v3.inc.php


示例19: list

            list($type_msg, $ten_ms) = explode(":", $hrSystemUptime);
            $uptime = $ten_ms / 100;
            echo "Found Wrong type: interpreting as seconds instead of timeticks ({$uptime} seconds)\n";
            $uptime_msg = "Using integer SNMP Agent hrSystemUptime";
        } else {
            // HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: (63050465) 7 days, 7:08:24.65
            $uptime = timeticks_to_sec($hrSystemUptime);
            $uptime_msg = "Using SNMP Agent hrSystemUptime";
        }
    } else {
        // SNMPv2-MIB::sysUpTime.0 = Timeticks: (2542831) 7:03:48.31
        $uptime = timeticks_to_sec($poll_device['sysUpTime']);
        $uptime_msg = "Using SNMP Agent sysUpTime";
        // Last check snmpEngineTime and fix if needed uptime (sysUpTime 68 year rollover issue)
        // SNMP-FRAMEWORK-MIB::snmpEngineTime.0 = INTEGER: 72393514 seconds
        $snmpEngineTime = snmp_get($device, "snmpEngineTime.0", "-OUqv", "SNMP-FRAMEWORK-MIB", mib_dirs());
        if ($device['os'] == 'aos' && strlen($snmpEngineTime) > 8) {
            // Some Alcatel have bug with snmpEngineTime
            // http://jira.observium.org/browse/OBSERVIUM-763
            $snmpEngineTime = 0;
        } else {
            if (is_numeric($snmpEngineTime) && $snmpEngineTime > 0 && $snmpEngineTime > $uptime) {
                $polled = time();
                $uptime = $snmpEngineTime;
                $uptime_msg = "Using SNMP Agent snmpEngineTime";
            }
        }
    }
}
print_debug("{$uptime_msg} ({$uptime} seconds)");
if (is_numeric($uptime)) {
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:system.inc.php


示例20: array

if (is_numeric($discover['dbm'][0]['remCurrentRSL'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.3.2.3.0';
    $limits = array('limit_high' => $discover['dbm'][0]['remMaxRSL'], 'limit_low' => $discover['dbm'][0]['remMinRSL']);
    discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'remCurrentRSL.0', 'exaltcomproducts', "Received Signal Level (Far end radio)", 1, $discover['dbm'][0]['remCurrentRSL'], $limits);
}
//ExaltComProducts::locLinkState.0 = INTEGER: almNORMAL(0)
//ExaltComProducts::locErrorDuration.0 = INTEGER: 30 Seconds
//ExaltComProducts::locErrorDurationStr.0 = STRING: 30 seconds.
//ExaltComProducts::locUnavailDuration.0 = INTEGER: 0 Seconds
//ExaltComProducts::locUnavailDurationStr.0 = STRING: 0 seconds.
//ExaltComProducts::remLinkState.0 = INTEGER: almNORMAL(0)
//ExaltComProducts::remErrorDuration.0 = INTEGER: 3 Seconds
//ExaltComProducts::remErrorDurationStr.0 = STRING: 3 seconds.
//ExaltComProducts::remUnavailDuration.0 = INTEGER: 0 Seconds
//ExaltComProducts::remUnavailDurationStr.0 = STRING: 0 seconds.
$discover['state'] = snmp_get_multi($device, 'locLinkState.0 locErrorDuration.0 locUnavailDuration.0 remLinkState.0 remErrorDuration.0 remUnavailDuration.0', '-OQUs', 'ExaltComProducts', mib_dirs('exalt'));
$sensor_state_type = 'exaltcomproducts-state';
$options = array('entPhysicalClass' => 'linkstate');
if (!empty($discover['state'][0]['locLinkState'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.2.3.1.1.0';
    $value = state_string_to_numeric($sensor_state_type, $discover['state'][0]['locLinkState']);
    discover_sensor($valid['sensor'], 'state', $device, $oid, 'locLinkState.0', $sensor_state_type, "Link Status (Internal)", NULL, $value, $options);
}
if (!empty($discover['state'][0]['remLinkState'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.2.4.1.1.0';
    $value = state_string_to_numeric($sensor_state_type, $discover['state'][0]['remLinkState']);
    discover_sensor($valid['sensor'], 'state', $device, $oid, 'remLinkState.0', $sensor_state_type, "Link Status (Far end radio)", NULL, $value, $options);
}
if (is_numeric($discover['state'][0]['locErrorDuration']) && is_numeric($discover['state'][0]['locUnavailDuration'])) {
    $oid = '.1.3.6.1.4.1.25651.1.2.4.3.1.5.0';
    discover_sensor($valid['sensor'], 'state', $device, $oid, 'locErrorDuration.0', 'exaltcomproducts', "Errored Seconds (Internal)", 1, $discover['state'][0]['locErrorDuration']);
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:exaltcomproducts.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP micropro函数代码示例发布时间:2022-05-15
下一篇:
PHP mhtmlspecialchars函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap