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


PHP discover_processor函数代码示例

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


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

示例1: snmpwalk_cache_double_oid

<?php

// JUNOSe Processors
if ($device['os'] == "junose") {
    echo "JUNOSe : ";
    $processors_array = snmpwalk_cache_double_oid($device, "juniSystemModule", $processors_array, "Juniper-System-MIB", $config['install_dir'] . "/mibs/junose");
    if ($debug) {
        print_r($processors_array);
    }
    foreach ($processors_array as $index => $entry) {
        if ($entry['juniSystemModuleCpuUtilPct'] && $entry['juniSystemModuleCpuUtilPct'] != "-1") {
            $entPhysicalIndex = $entry['juniSystemModulePhysicalIndex'];
            $usage_oid = ".1.3.6.1.4.1.4874.2.2.2.1.3.5.1.3." . $index;
            $descr_oid = ".1.3.6.1.4.1.4874.2.2.2.1.3.5.1.6." . $index;
            $descr = $entry['juniSystemModuleDescr'];
            $usage = $entry['juniSystemModuleCpuFiveMinAvgPct'];
            if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") {
                discover_processor($valid['processor'], $device, $usage_oid, $index, "junose", $descr, "1", $usage, $entPhysicalIndex, NULL);
            }
        }
    }
}
// End JUNOSe Processors
unset($processors_array);
开发者ID:REAP720801,项目名称:librenms,代码行数:24,代码来源:junose.inc.php

示例2: snmpwalk_cache_oid

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$processors_array = snmpwalk_cache_oid($device, 'wlsxSysXProcessorTable', array(), $mib);
if (is_array($processors_array)) {
    foreach ($processors_array as $index => $entry) {
        if (is_numeric($entry['sysXProcessorLoad']) && is_numeric($index)) {
            $descr = $entry['sysXProcessorDescr'];
            $usage = $entry['sysXProcessorLoad'];
            $oid = "1.3.6.1.4.1.14823.2.2.1.1.1.9.1.3.{$index}";
            discover_processor($valid['processor'], $device, $oid, $index, 'WLSX-SWITCH-MIB', $descr, 1, $usage);
        }
    }
}
unset($processors_array, $index, $descr, $usage, $oid);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:25,代码来源:wlsx-switch-mib.inc.php

示例3: snmp_get

<?php

if ($device['os'] == 'screenos' && dbFetchCell("SELECT COUNT(*) FROM `processors` WHERE `device_id` = ? AND `processor_type` != 'screenos'", array($device['device_id'])) == '0') {
    // .1.3.6.1.4.1.3224.16.1.3.0 Cpu Last 5 Minutes
    // discover_processor(&$valid, $device, $oid, $index, $type, $descr, $precision = "1", $current = NULL, $entPhysicalIndex = NULL, $hrDeviceIndex = NULL)
    echo 'ScreenOS ';
    $percent = snmp_get($device, '.1.3.6.1.4.1.3224.16.1.3.0', '-OvQ');
    if (is_numeric($percent)) {
        discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.3224.16.1.3.0', '1', 'screenos', 'Processor', '1', $percent, null, null);
    }
}
开发者ID:samyscoub,项目名称:librenms,代码行数:11,代码来源:screenos.inc.php

示例4: snmpwalk_cache_oid

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// Force10 C-Series
// chRpmCpuUtil5Min.1 = Gauge32: 47
$processors_array = snmpwalk_cache_oid($device, 'chRpmCpuUtil5Min', array(), $mib);
if (is_array($processors_array)) {
    foreach ($processors_array as $index => $entry) {
        $descr = $index == 1 ? 'CP' : 'RP' . strval($index - 1);
        $oid = ".1.3.6.1.4.1.6027.3.8.1.3.7.1.5.{$index}";
        $usage = $entry['chRpmCpuUtil5Min'];
        discover_processor($valid['processor'], $device, $oid, $index, 'ftos-cseries', $descr, 1, $usage);
    }
}
unset($processors_array, $descr, $oid, $usage, $index, $entry);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:25,代码来源:f10-c-series-chassis-mib.inc.php

示例5: str_replace

                $descr = "Processor";
            }
            // Workaround to set fake description for Windows who use Unknown Processor Type
            if ($device['os'] == "windows" && $entry['hrDeviceDescr'] == "Unknown Processor Type") {
                $descr = "Processor";
            }
            $descr = str_replace("CPU ", "", $descr);
            $descr = str_replace("(TM)", "", $descr);
            $descr = str_replace("(R)", "", $descr);
            $old_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("hrProcessor-" . $index . ".rrd");
            $new_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("processor-hr-" . $index . ".rrd");
            if ($debug) {
                echo "{$old_rrd} {$new_rrd}";
            }
            if (is_file($old_rrd)) {
                rename($old_rrd, $new_rrd);
                echo "Moved RRD ";
            }
            if ($device['os'] == "arista-eos" && $index == "1") {
                unset($descr);
            }
            if (isset($descr) && $descr != "An electronic chip that makes the computer work.") {
                discover_processor($valid['processor'], $device, $usage_oid, $index, "hr", $descr, "1", $usage, NULL, $hrDeviceIndex);
            }
            unset($old_rrd, $new_rrd, $descr, $entry, $usage_oid, $index, $usage, $hrDeviceIndex, $descr_array);
        }
        unset($entry);
    }
    unset($hrDevice_oids, $hrDevice_array, $oid);
}
// End hrDevice Processors
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:hrdevice.inc.php

示例6: snmpwalk_cache_triple_oid

 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$processors_array = snmpwalk_cache_triple_oid($device, 'snAgentCpuUtilEntry', $processors_array, $mib);
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', $mib);
        $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);
        }
    }
}
unset($processors_array);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:foundry-sn-agent-mib.inc.php

示例7: array

<?php

#root@alpha:/home/observium/dev# snmpwalk -v2c -c // -M mibs -m +NS-ROOT-MIB netscaler.test nsCPUTable
#NS-ROOT-MIB::nsCPUname."cpu0" = STRING: "cpu0"
#NS-ROOT-MIB::nsCPUusage."cpu0" = Gauge32: 0
if ($device['os'] == "netscaler") {
    echo " NetScaler ";
    echo " Caching OIDs:";
    if (!is_array($nsaarray)) {
        $nsarray = array();
        echo " nsCPUTable ";
        $nsarray = snmpwalk_cache_multi_oid($device, "nsCPUTable", $nsarray, "NS-ROOT-MIB");
    }
    foreach ($nsarray as $descr => $data) {
        $current = $data['nsCPUusage'];
        $oid = ".1.3.6.1.4.1.5951.4.1.1.41.6.1.2." . string_to_oid($descr);
        $descr = $data['nsCPUname'];
        discover_processor($valid['processor'], $device, $oid, $descr, "netscaler", $descr, "1", $current, NULL, NULL);
    }
    unset($nsarray, $oid, $descr, $current);
}
开发者ID:REAP720801,项目名称:librenms,代码行数:21,代码来源:netscaler.inc.php

示例8: dbFetchCell

<?php

$count = dbFetchCell("SELECT COUNT(*) FROM `processors` WHERE `device_id` = ? AND `processor_type` != 'ucd-old'", array($device['device_id']));
if ($device['os_group'] == 'unix' && $count == '0') {
    echo 'UCD Old: ';
    $system = snmp_get($device, 'ssCpuSystem.0', '-OvQ', 'UCD-SNMP-MIB');
    $user = snmp_get($device, 'ssCpuUser.0', '-OvQ', 'UCD-SNMP-MIB');
    $idle = snmp_get($device, 'ssCpuIdle.0', '-OvQ', 'UCD-SNMP-MIB');
    if (is_numeric($system)) {
        $percent = $system + $user + $idle;
        discover_processor($valid['processor'], $device, 0, 0, 'ucd-old', 'CPU', '1', $system + $user, null, null);
    }
}
开发者ID:samyscoub,项目名称:librenms,代码行数:13,代码来源:processors-ucd-old.inc.php

示例9: array

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCpuUsage.30 = INTEGER: 16
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCpuUsage.36 = INTEGER: 5
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCpuUsage.42 = INTEGER: 5
// HPN-ICF-ENTITY-EXT-MIB::hpnicfEntityExtCpuUsage.48 = INTEGER: 12
$oids = array('hpnicfEntityExtCpuUsage', 'entPhysicalName');
$processors_array = array();
foreach ($oids as $oid) {
    $processors_array = snmpwalk_cache_multi_oid($device, $oid, $processors_array, 'ENTITY-MIB:HPN-ICF-ENTITY-EXT-MIB');
}
foreach ($processors_array as $index => $entry) {
    if ($entry['hpnicfEntityExtCpuUsage'] != 0) {
        $oid = ".1.3.6.1.4.1.11.2.14.11.15.2.6.1.1.1.1.6.{$index}";
        $descr = $entry['entPhysicalName'];
        $usage = $entry['hpnicfEntityExtCpuUsage'];
        discover_processor($valid['processor'], $device, $oid, $index, 'hh3c-fixed', $descr, 1, $usage);
    }
}
unset($processors_array);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:hpn-icf-entity-ext-mib.inc.php

示例10: snmp_get

<?php

//
// Hardcoded discovery of cpu usage on Fortigate devices.
//
// FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0
if ($device['os'] == 'fortigate') {
    echo 'Fortigate : ';
    $descr = 'Processor';
    $usage = snmp_get($device, '.1.3.6.1.4.1.12356.101.4.1.3.0', '-Ovq');
    if (is_numeric($usage)) {
        discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.12356.101.4.1.3.0', '0', 'fortigate-fixed', $descr, '1', $usage, null, null);
    }
}
unset($processors_array);
开发者ID:sfromm,项目名称:librenms,代码行数:15,代码来源:fortigate.inc.php

示例11: foreach

        foreach ($processors_array as $index => $entry) {
            if (strlen(strstr($entry['jnxOperatingDescr'], 'Routing Engine')) || $entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], 'sensor') && !strstr($entry['jnxOperatingDescr'], 'fan')) {
                if (stripos($entry['jnxOperatingDescr'], 'sensor') || stripos($entry['jnxOperatingDescr'], 'fan')) {
                    continue;
                }
                d_echo($index . ' ' . $entry['jnxOperatingDescr'] . ' -> ' . $entry['jnxOperatingCPU'] . ' -> ' . $entry['jnxOperatingDRAMSize'] . "\n");
                $usage_oid = '.1.3.6.1.4.1.2636.3.1.13.1.8.' . $index;
                $descr = $entry['jnxOperatingDescr'];
                $usage = $entry['jnxOperatingCPU'];
                if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') {
                    discover_processor($valid['processor'], $device, $usage_oid, $index, 'junos', $descr, '1', $usage, null, null);
                }
            }
        }
    }
    $srx_processors_array = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringCPUUsage', $srx_processors_array, 'JUNIPER-SRX5000-SPU-MONITORING-MIB', '+' . $config['install_dir'] . '/mibs/junos');
    d_echo($processors_array);
    if (is_array($srx_processors_array)) {
        foreach ($srx_processors_array as $index => $entry) {
            if (isset($index) && $index >= 0) {
                $usage_oid = '.1.3.6.1.4.1.2636.3.39.1.12.1.1.1.4.' . $index;
                $descr = 'CPU';
                // No description in the table?
                $usage = $entry['jnxJsSPUMonitoringCPUUsage'];
                discover_processor($valid['processor'], $device, $usage_oid, $index, 'junos', $descr, '1', $usage, null, null);
            }
        }
    }
}
unset($processors_array);
unset($srx_processors_array);
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:junos.inc.php

示例12: round

                    $precision = round(1 / $entry['scale'], 0);
                }
                $usage = snmp_get($device, $entry['oid'], '-OQUvs', $mib);
                $usage = snmp_fix_numeric($usage);
                if (is_numeric($usage)) {
                    if (empty($entry['oid_num'])) {
                        // Use snmptranslate if oid_num not set
                        $entry['oid_num'] = snmp_translate($entry['oid'], $mib);
                    }
                    if (isset($entry['rename_rrd'])) {
                        $old_rrd = 'processor-' . $entry['rename_rrd'];
                        $new_rrd = 'processor-' . $entry_name . '-' . $index;
                        rename_rrd($device, $old_rrd, $new_rrd);
                        unset($old_rrd, $new_rrd);
                    }
                    discover_processor($valid['processor'], $device, $entry['oid_num'], $index, $entry_name, $descr, $precision, $usage, NULL, NULL, $idle);
                    $entry['found'] = TRUE;
                }
            }
            unset($processors_array, $processor, $dot_index, $descr, $i);
            // Clean up
            if (isset($entry['stop_if_found']) && $entry['stop_if_found'] && $entry['found']) {
                break;
            }
            // Stop loop if processor found
        }
    }
}
// Remove processors which weren't redetected here
foreach (dbFetchRows('SELECT * FROM `processors` WHERE `device_id` = ?', array($device['device_id'])) as $test_processor) {
    $processor_index = $test_processor['processor_index'];
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:processors.inc.php

示例13: foreach

 *
 */
echo "处理器 : ";
// Include all discovery modules by supported MIB
$include_dir = "includes/discovery/processors";
include "includes/include-dir-mib.inc.php";
// Detect processors by simple MIB-based discovery :
// FIXME - this should also be extended to understand multiple entries in a table, and take descr from an OID but this is all I need right now :)
foreach ($config['os'][$device['os']]['mibs'] as $mib) {
    if (is_array($config['mibs'][$mib]['processor'])) {
        echo ' ' . $mib . ': ';
        foreach ($config['mibs'][$mib]['processor'] as $entry_name => $entry) {
            echo $entry_name . ' ';
            $usage = snmp_get($device, $entry['oid'], '-OQUvs', $mib, mib_dirs($config['mibs'][$mib]['mib_dir']));
            if (is_numeric($usage)) {
                discover_processor($valid['processor'], $device, $entry['oid_num'], 0, $entry_name, $entry['descr'], 1, $usage);
            }
        }
    }
}
if (OBS_DEBUG && count($valid['processor'])) {
    print_vars($valid['processor']);
}
// Remove processors which weren't redetected here
foreach (dbFetchRows('SELECT * FROM `processors` WHERE `device_id` = ?', array($device['device_id'])) as $test_processor) {
    $processor_index = $test_processor['processor_index'];
    $processor_type = $test_processor['processor_type'];
    $processor_descr = $test_processor['processor_descr'];
    print_debug($processor_index . " -> " . $processor_type);
    if (!$valid['processor'][$processor_type][$processor_index]) {
        echo '-';
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:processors.inc.php

示例14: foreach

}
foreach ($processors_array as $index => $entry) {
    if (is_numeric($entry['cpmCPUTotal5minRev']) || is_numeric($entry['cpmCPUTotal5min'])) {
        $entPhysicalIndex = $entry['cpmCPUTotalPhysicalIndex'];
        if (isset($entry['cpmCPUTotal5minRev'])) {
            $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8." . $index;
            $usage = $entry['cpmCPUTotal5minRev'];
        } elseif (isset($entry['cpmCPUTotal5min'])) {
            $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5." . $index;
            $usage = $entry['cpmCPUTotal5min'];
        }
        if ($entPhysicalIndex) {
            $descr_oid = "entPhysicalName." . $entPhysicalIndex;
            $descr = snmp_get($device, $descr_oid, "-Oqv", "ENTITY-MIB");
        }
        if (!$descr) {
            $descr = "Processor {$index}";
        }
        if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") {
            discover_processor($valid['processor'], $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL);
        }
    }
}
if (!is_array($valid['processor']['cpm'])) {
    $avgBusy5 = snmp_get($device, ".1.3.6.1.4.1.9.2.1.58.0", "-Oqv");
    if (is_numeric($avgBusy5)) {
        discover_processor($valid['processor'], $device, ".1.3.6.1.4.1.9.2.1.58.0", "0", "ios", "Processor", "1", $avgBusy5, NULL, NULL);
    }
}
unset($processors_array);
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:cisco-process-mib.inc.php

示例15: snmp_get

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
// Hardcoded discovery of cpu usage on SmartEdge devices.
//
// RBN-CPU-METER-MIB::rbnCpuMeterFiveMinuteAvg.0
echo " RBN-CPU-METER-MIB ";
$descr = "Processor";
$usage = snmp_get($device, ".1.3.6.1.4.1.2352.2.6.1.3.0", "-Ovq");
if (is_numeric($usage)) {
    discover_processor($valid['processor'], $device, ".1.3.6.1.4.1.2352.2.6.1.3.0", "0", "seos", $descr, "1", $usage, NULL, NULL);
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:22,代码来源:rbn-cpu-meter-mib.inc.php


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