本文整理汇总了PHP中discover_mempool函数的典型用法代码示例。如果您正苦于以下问题:PHP discover_mempool函数的具体用法?PHP discover_mempool怎么用?PHP discover_mempool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了discover_mempool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: snmp_get
<?php
if ($device['os'] == "aos") {
echo "Alcatel-Lucent OS: ";
$total = snmp_get($device, "systemHardwareMemorySize.0", "-OvQ", "ALCATEL-IND1-SYSTEM-MIB", mib_dirs('aos'));
$percent = snmp_get($device, "healthDeviceMemoryLatest.0", "-OvQ", "ALCATEL-IND1-HEALTH-MIB", mib_dirs('aos'));
$used = $total / 100 * $perc_used;
$free = $total - $used;
if (is_numeric($total) && is_numeric($used)) {
discover_mempool($valid_mempool, $device, 0, "aos-device", "Device Memory", "1", NULL, NULL);
}
}
示例2: d_echo
<?php
/*
* LibreNMS Ubiquiti EdgeSwitch memory information module
*
* Copyright (c) 2016 Cercel Valentin <crc@nuamchefazi.ro>
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if ($device['os'] == "edgeswitch") {
d_echo('EdgeSwitch Memory:');
//EdgeSwitch-SWITCHING-MIB::agentSwitchCpuProcessMemFree
$avail = snmp_get($device, '.1.3.6.1.4.1.4413.1.1.1.1.4.1.0', '-Oqv');
//EdgeSwitch-SWITCHING-MIB::agentSwitchCpuProcessMemAvailable
$total = snmp_get($device, '.1.3.6.1.4.1.4413.1.1.1.1.4.2.0', '-Oqv');
$used = $total - $avail;
$percent = $used / $total * 100;
if (is_numeric($total) && is_numeric($avail)) {
discover_mempool($valid_mempool, $device, 0, 'edgeswitch', 'Memory', '1', null, null);
}
}
示例3: preg_match
<?php
if ($device['os'] == 'pbn') {
echo 'PBN-MEMORY-POOL: ';
// find out wich build number we have
preg_match('/^.* Build (?<build>\\d+)/', $device['version'], $version);
d_echo($version);
// specified MIB supported since build 16607
if ($version[build] >= 16607) {
$mibdir = $config['mibdir'] . '/pbn' . ':' . $config['mibdir'];
$usage = snmp_get($device, 'nmsMemoryPoolUtilization.0', '-OUvQ', 'NMS-MEMORY-POOL-MIB', $mibdir);
if (is_numeric($usage)) {
discover_mempool($valid_mempool, $device, 0, 'pbn-mem', 'Main Memory', '100', null, null);
}
}
}
示例4: snmp_get
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if ($device['os'] == 'zywall') {
echo 'Zywall mempool: ';
$oid = '.1.3.6.1.4.1.890.1.6.22.1.2.0';
$usage = snmp_get($device, $oid, '-Ovq');
if (is_numeric($usage)) {
discover_mempool($valid_mempool, $device, $oid, 'zywall', 'Memory', '1', null, null);
}
}
示例5: d_echo
continue;
}
d_echo($index . ' ' . $entry['jnxOperatingDescr'] . ' -> ' . $entry['jnxOperatingBuffer'] . ' -> ' . $entry['jnxOperatingDRAMSize'] . "\n");
$usage_oid = '.1.3.6.1.4.1.2636.3.1.13.1.8.' . $index;
$descr = $entry['jnxOperatingDescr'];
$usage = $entry['jnxOperatingBuffer'];
if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') {
discover_mempool($valid_mempool, $device, $index, 'junos', $descr, '1', null, null);
}
}
//end if
}
//end foreach
} else {
$srx_mempools_array = snmpwalk_cache_multi_oid($device, 'jnxJsSPUMonitoringMemoryUsage', $srx_mempools_array, 'JUNIPER-SRX5000-SPU-MONITORING-MIB', 'junos');
if (is_array($srx_mempools_array)) {
foreach ($srx_mempools_array as $index => $entry) {
if ($index) {
$usage_oid = '.1.3.6.1.4.1.2636.3.39.1.12.1.1.1.5.' . $index;
$descr = 'Memory';
// No description in the table?
$usage = $entry['jnxJsSPUMonitoringMemoryUsage'];
discover_mempool($valid_mempool, $device, $index, 'junos', $descr, '1', null, null);
}
}
}
}
}
//end if
unset($mempools_array);
unset($srx_mempools_array);
示例6: snmp_walk
<?php
# lookup for memory data
$data = snmp_walk($device, "extremeMemoryMonitorSystemTable", "-Oqs", "EXTREME-BASE-MIB", mib_dirs('extreme'));
if (strstr($data, 'extremeMemoryMonitorSystemTotal')) {
discover_mempool($valid_mempool, $device, 0, "xos", "Memory", "1024", NULL, NULL);
if ($debug) {
foreach (explode("\n", $data) as $entry) {
$t = explode(" ", $entry, 2);
if (strstr($t[0], 'extremeMemoryMonitorSystemTotal')) {
echo sprintf("Memory: Total %d (KB)", $t[1]);
}
}
}
}
示例7: snmp_get
<?php
// TRAPEZE-NETWORKS-SYSTEM-MIB::trpzSysCpuMemorySize.0
// TRAPEZE-NETWORKS-SYSTEM-MIB::trpzSysCpuMemoryLast5MinutesUsage.0
$mib = 'TRAPEZE-NETWORKS-SYSTEM-MIB';
echo " {$mib} ";
$descr = "Memory";
$used = snmp_get($device, "trpzSysCpuMemoryLast5MinutesUsage.0", "-OQUvs", $mib, mib_dirs('trapeze'));
$total = snmp_get($device, "trpzSysCpuMemorySize.0", "-OQUvs", $mib, mib_dirs('trapeze'));
$used *= 1024;
$total *= 1024;
if (is_numeric($used) && is_numeric($total)) {
discover_mempool($valid['mempool'], $device, 0, $mib, $descr, 1024, $total, $used);
}
unset($descr, $total, $used);
// EOF
示例8: snmpwalk_cache_oid
<?php
// NETSWITCH-MIB::hpLocalMemSlotIndex.1 = INTEGER: 1
// NETSWITCH-MIB::hpLocalMemSlabCnt.1 = Counter32: 3966
// NETSWITCH-MIB::hpLocalMemFreeSegCnt.1 = Counter32: 166
// NETSWITCH-MIB::hpLocalMemAllocSegCnt.1 = Counter32: 3803
// NETSWITCH-MIB::hpLocalMemTotalBytes.1 = INTEGER: 11337704
// NETSWITCH-MIB::hpLocalMemFreeBytes.1 = INTEGER: 9669100
// NETSWITCH-MIB::hpLocalMemAllocBytes.1 = INTEGER: 1668732
// 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
$array = snmpwalk_cache_oid($device, 'hpLocal', null, 'NETSWITCH-MIB', $config['mibdir'] . ':' . $config['mibdir'] . '/hp');
$array = snmpwalk_cache_oid($device, 'hpGlobal', $array, 'NETSWITCH-MIB', $config['mibdir'] . ':' . $config['mibdir'] . '/hp');
if (is_array($array)) {
echo 'Procurve : ';
foreach ($array as $index => $mempool) {
if (is_numeric($index) && is_numeric($mempool['hpLocalMemTotalBytes'])) {
discover_mempool($valid_mempool, $device, $index, 'hpLocal', 'Local Memory ' . $index, null, null, null);
}
if (is_numeric($index) && is_numeric($mempool['hpGlobalMemTotalBytes'])) {
discover_mempool($valid_mempool, $device, $index, 'hpGlobal', 'Global Memory ' . $index, null, null, null);
}
unset($deny, $fstype, $descr, $size, $used, $units);
}
unset($array);
}
示例9: snmpwalk_cache_multi_oid
// Huawei VRP mempools
if ($device['os'] == "vrp") {
echo "VRP : ";
$mempools_array = snmpwalk_cache_multi_oid($device, "hwEntityMemUsage", $mempools_array, "HUAWEI-ENTITY-EXTENT-MIB", mib_dirs('huawei'));
$mempools_array = snmpwalk_cache_multi_oid($device, "hwEntityMemSize", $mempools_array, "HUAWEI-ENTITY-EXTENT-MIB", mib_dirs('huawei'));
$mempools_array = snmpwalk_cache_multi_oid($device, "hwEntityBomEnDesc", $mempools_array, "HUAWEI-ENTITY-EXTENT-MIB", mib_dirs('huawei'));
if ($debug) {
print_r($mempools_array);
}
if (is_array($mempools_array)) {
foreach ($mempools_array as $index => $entry) {
if ($entry['hwEntityMemSize'] != 0) {
if ($debug) {
echo $index . " " . $entry['hwEntityBomEnDesc'] . " -> " . $entry['hwEntityMemUsage'] . " -> " . $entry['hwEntityMemSize'] . "\n";
}
$usage_oid = ".1.3.6.1.4.1.2011.5.25.31.1.1.1.1.7." . $index;
$descr = $entry['hwEntityBomEnDesc'];
$usage = $entry['hwEntityMemUsage'];
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") {
discover_mempool($valid_mempool, $device, $index, "vrp", $descr, "1", NULL, NULL);
}
}
// End if checks
}
// End Foreach
}
// End if array
}
// End VRP mempools
unset($mempools_array);
示例10: str_replace
<?php
if ($device['os'] == 'ciscowlc') {
echo 'Cisco WLC';
$total = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.14179.1.1.5.3.0", '-OvQ'));
$avail = str_replace('"', "", snmp_get($device, "1.3.6.1.4.1.14179.1.1.5.2.0", '-OvQ'));
if (is_numeric($total) && is_numeric($avail)) {
discover_mempool($valid_mempool, $device, 0, 'ciscowlc', 'Memory', '1', null, null);
}
}
示例11: value
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
//TIMETRA-SYSTEM-MIB::sgiMemoryUsed.0 = Gauge32: 300145144 bytes
//TIMETRA-SYSTEM-MIB::sgiMemoryAvailable.0 = Gauge32: 518611632 bytes
//TIMETRA-SYSTEM-MIB::sgiMemoryPoolAllocated.0 = Gauge32: 320917080 bytes
//TIMETRA-SYSTEM-MIB::sgiMemoryUsed.0 = Gauge32: 305605608 bytes
//TIMETRA-SYSTEM-MIB::sgiMemoryAvailable.0 = Gauge32: 600985024 bytes
//TIMETRA-SYSTEM-MIB::sgiMemoryPoolAllocated.0 = Gauge32: 325038952 bytes
/*
If the value is greater than the maximum value reportable by this
object then this object reports its maximum value (4,294,967,295)
and sgiKbMemoryPoolAllocated must be used to determine the total
memory allocated in memory-pools.
FIXME: sgiKbMemoryUsed, sgiKbMemoryAvailable, sgiKbMemoryPoolAllocated (use HC bit)
*/
echo " TIMETRA-SYSTEM-MIB ";
$mempool_array = snmpwalk_cache_multi_oid($device, "sgiMemoryAvailable", NULL, "TIMETRA-SYSTEM-MIB");
$mempool_array = snmpwalk_cache_multi_oid($device, "sgiMemoryUsed", $mempool_array, "TIMETRA-SYSTEM-MIB");
if (is_numeric($mempool_array[0]['sgiMemoryUsed'])) {
discover_mempool($valid['mempool'], $device, 0, "TIMETRA-SYSTEM-MIB", "Memory", 1, $mempool_array[0]['sgiMemoryAvailable'], $mempool_array[0]['sgiMemoryUsed']);
}
unset($mempool_array);
// EOF
示例12: snmpwalk_cache_oid
<?php
#NETSWITCH-MIB::hpLocalMemSlotIndex.1 = INTEGER: 1
#NETSWITCH-MIB::hpLocalMemSlabCnt.1 = Counter32: 3966
#NETSWITCH-MIB::hpLocalMemFreeSegCnt.1 = Counter32: 166
#NETSWITCH-MIB::hpLocalMemAllocSegCnt.1 = Counter32: 3803
#NETSWITCH-MIB::hpLocalMemTotalBytes.1 = INTEGER: 11337704
#NETSWITCH-MIB::hpLocalMemFreeBytes.1 = INTEGER: 9669100
#NETSWITCH-MIB::hpLocalMemAllocBytes.1 = INTEGER: 1668732
#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
$array = snmpwalk_cache_oid($device, "hpLocal", NULL, "NETSWITCH-MIB", mib_dirs('hp'));
$array = snmpwalk_cache_oid($device, "hpGlobal", $array, "NETSWITCH-MIB", mib_dirs('hp'));
if (is_array($array)) {
echo "Procurve : ";
foreach ($array as $index => $mempool) {
if (is_numeric($index) && is_numeric($mempool['hpLocalMemTotalBytes'])) {
discover_mempool($valid_mempool, $device, $index, "hpLocal", "Local Memory " . $index, NULL, NULL, NULL);
}
if (is_numeric($index) && is_numeric($mempool['hpGlobalMemTotalBytes'])) {
discover_mempool($valid_mempool, $device, $index, "hpGlobal", "Global Memory " . $index, NULL, NULL, NULL);
}
unset($deny, $fstype, $descr, $size, $used, $units);
}
unset($array);
}
示例13: snmp_get
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// NOTE. Because Alcatel changed their MIBs content (same oid names have different indexes), here used only numeric OIDs.
$total = snmp_get($device, '.1.3.6.1.4.1.6486.800.1.1.1.2.1.1.3.4.0', '-OvQ', 'ALCATEL-IND1-SYSTEM-MIB', mib_dirs('aos'));
// systemHardwareMemorySize
$percent = snmp_get($device, '.1.3.6.1.4.1.6486.800.1.2.1.16.1.1.1.10.0', '-OvQ', $mib, mib_dirs('aos'));
// healthModuleMemory1MinAvg
$used = $total / 100 * $percent;
if (is_numeric($total) && is_numeric($percent)) {
discover_mempool($valid['mempool'], $device, 0, $mib, 'Memory', 1, $total, $used);
}
unset($total, $used, $percent);
// New AOS 7
$total = snmp_get($device, '.1.3.6.1.4.1.6486.801.1.1.1.2.1.1.3.4.0', '-OvQ', 'ALCATEL-IND1-SYSTEM-MIB', mib_dirs('aos7'));
// systemHardwareMemorySize
$percent = snmp_get($device, '.1.3.6.1.4.1.6486.801.1.2.1.16.1.1.1.1.1.8.0', '-OvQ', $mib, mib_dirs('aos7'));
// healthModuleMemory1MinAvg
$used = $total / 100 * $percent;
if (is_numeric($total) && is_numeric($percent)) {
$total *= 1024;
// AOS7 reports total memory in MB
// Use HC bit for new aos
discover_mempool($valid['mempool'], $device, 0, $mib, 'Memory', 1, $total, $used, 1);
}
unset($total, $used, $percent);
// EOF
示例14: snmp_cache_oid
<?php
$storage_array = snmp_cache_oid("hrStorageEntry", $device, array(), "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES");
if (is_array($storage_array)) {
echo "hrStorage : ";
foreach ($storage_array[$device[device_id]] as $index => $storage) {
$fstype = $storage['hrStorageType'];
$descr = $storage['hrStorageDescr'];
$size = $storage['hrStorageSize'] * $storage['hrStorageAllocationUnits'];
$used = $storage['hrStorageUsed'] * $storage['hrStorageAllocationUnits'];
$units = $storage['hrStorageAllocationUnits'];
$deny = 1;
if ($fstype == "hrStorageVirtualMemory" || $fstype == "hrStorageRam") {
$deny = 0;
}
if (strstr($descr, "MALLOC") || strstr($descr, "UMA")) {
$deny = 1;
}
## Ignore FreeBSD INSANITY
if (!$deny && is_numeric($index)) {
discover_mempool($valid_mempool, $device, $index, "hrstorage", $descr, $units, NULL, NULL);
}
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $storage_array);
}
}
示例15: snmp_get
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// GBNPlatformOAM-MIB::memorySize.0 = INTEGER: 128
// GBNPlatformOAM-MIB::memoryIdle.0 = INTEGER: 51
$descr = 'Memory';
$free = snmp_get($device, 'memoryIdle.0', '-OQUvs', $mib);
$total = snmp_get($device, 'memorySize.0', '-OQUvs', $mib);
if (is_numeric($free) && is_numeric($total)) {
//$total *= 1024*1024;
//$free *= 1024*1024;
$used = $total - $free;
discover_mempool($valid['mempool'], $device, 0, strtolower('GBNPlatformOAM-MIB'), $descr, 1024 * 1024, $total, $used);
// ^ FIXME why strtolower?
}
unset($descr, $total, $used);
// EOF