本文整理汇总了PHP中snmp_get_multi函数的典型用法代码示例。如果您正苦于以下问题:PHP snmp_get_multi函数的具体用法?PHP snmp_get_multi怎么用?PHP snmp_get_multi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmp_get_multi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValues
function getValues($port)
{
global $config, $device;
if ($device['snmpver'] == "1") {
$oids = "IF-MIB::ifInOctets." . $port['ifIndex'] . " IF-MIB::ifOutOctets." . $port['ifIndex'];
} else {
$oids = "IF-MIB::ifHCInOctets." . $port['ifIndex'] . " IF-MIB::ifHCOutOctets." . $port['ifIndex'];
}
$data = snmp_get_multi($port, $oids, "-OQUs", "IF-MIB");
$data = $data[$port['ifIndex']];
if (is_numeric($data['ifHCInOctets']) && is_numeric($data['ifHCOutOctets'])) {
return array('in' => $data['ifHCInOctets'], 'out' => $data['ifHCOutOctets']);
} elseif (is_numeric($data['ifInOctets']) && is_numeric($data['ifOutOctets'])) {
return array('in' => $data['ifInOctets'], 'out' => $data['ifOutOctets']);
} else {
return FALSE;
}
}
示例2: collect_table
/**
* Poll a table or oids from SNMP and build an RRD based on an array of arguments.
*
* Current limitations:
* - single MIB and RRD file for all graphs
* - single table per MIB
* - if set definition 'call_function', than poll used specific function for snmp walk/get,
* else by default used snmpwalk_cache_oid()
* - allowed oids only with simple numeric index (oid.0, oid.33), NOT allowed (oid.1.2.23)
* - only numeric data
*
* Example of (full) args array:
* array(
* 'file' => 'someTable.rrd', // [MANDATORY] RRD filename, but if not set used MIB_table.rrd as filename
* 'call_function' => 'snmpwalk_cache_oid' // [OPTIONAL] Which function to use for snmp poll, bu default snmpwalk_cache_oid()
* 'mib' => 'SOMETHING-MIB', // [OPTIONAL] MIB or list of MIBs separated by a colon
* 'mib_dir' => 'something', // [OPTIONAL] OS MIB directory or array of directories
* 'graphs' => array('one','two'), // [OPTIONAL] List of graph_types that this table provides
* 'table' => 'someTable', // [RECOMENDED] Table name for OIDs
* 'numeric' => '.1.3.6.1.4.1.555.4.1.1.48', // [OPTIONAL] Numeric table OID
* 'ds_rename' => array('http' => ''), // [OPTIONAL] Array for renaming OIDs to DSes
* 'oids' => array( // List of OIDs you can use as key: full OID name
* 'someOid' => array( // OID name (You can use OID name, like 'cpvIKECurrSAs')
* 'descr' => 'Current IKE SAs', // [OPTIONAL] Description of the OID contents
* 'numeric' => '.1.3.6.1.4.1.555.4.1.1.48.45', // [OPTIONAL] Numeric OID
* 'index' => '0', // [OPTIONAL] OID index, if not set equals '0'
* 'ds_name' => 'IKECurrSAs', // [OPTIONAL] DS name, if not set used OID name truncated to 19 chars
* 'ds_type' => 'GAUGE', // [OPTIONAL] DS type, if not set equals 'COUNTER'
* 'ds_min' => '0', // [OPTIONAL] Min value for DS, if not set equals 'U'
* 'ds_max' => '30000' // [OPTIONAL] Max value for DS, if not set equals '100000000000'
* )
* )
*
*/
function collect_table($device, $oids_def, &$graphs)
{
$rrd = array();
$mib = NULL;
$mib_dirs = NULL;
$use_walk = isset($oids_def['table']) && $oids_def['table'];
// Use snmpwalk by default
$call_function = strtolower($oids_def['call_function']);
switch ($call_function) {
case 'snmp_get_multi':
$use_walk = FALSE;
break;
case 'snmpwalk_cache_oid':
default:
$call_function = 'snmpwalk_cache_oid';
if (!$use_walk) {
// Break because we should use snmpwalk, but walking table not set
return FALSE;
}
}
if (isset($oids_def['numeric'])) {
$oids_def['numeric'] = '.' . trim($oids_def['numeric'], '. ');
}
// Remove trailing dot
if (isset($oids_def['mib'])) {
$mib = $oids_def['mib'];
}
if (isset($oids_def['mib_dir'])) {
$mib_dirs = mib_dirs($oids_def['mib_dir']);
}
if (isset($oids_def['file'])) {
$rrd_file = $oids_def['file'];
} else {
if ($mib && isset($oids_def['table'])) {
// Try to use MIB & tableName as rrd_file
$rrd_file = strtolower(safename($mib . '_' . $oids_def['table'])) . '.rrd';
} else {
print_debug(" WARNING, not have rrd filename.");
return FALSE;
// Not have RRD filename
}
}
// Get MIBS/Tables/OIDs permissions
if ($use_walk) {
// if use table walk, than check only this table permission (not oids)
if (dbFetchCell("SELECT COUNT(*) FROM `devices_mibs` WHERE `device_id` = ? AND `mib` = ? AND `table_name` = ?\n AND (`oid` = '' OR `oid` IS NULL) AND `disabled` = '1'", array($device['device_id'], $mib, $oids_def['table']))) {
print_debug(" WARNING, table '" . $oids_def['table'] . "' for '{$mib}' disabled and skipped.");
return FALSE;
// table disabled, exit
}
$oids_ok = TRUE;
} else {
// if use multi_get, than get all disabled oids
$oids_disabled = dbFetchColumn("SELECT `oid` FROM `devices_mibs` WHERE `device_id` = ? AND `mib` = ?\n AND (`oid` != '' AND `oid` IS NOT NULL) AND `disabled` = '1'", array($device['device_id'], $mib));
$oids_ok = empty($oids_disabled);
// if empty disabled, than set to TRUE
}
$search = array();
$replace = array();
if (is_array($oids_def['ds_rename'])) {
foreach ($oids_def['ds_rename'] as $s => $r) {
$search[] = $s;
$replace[] = $r;
}
}
// rrd DS limit is 20 bytes (19 chars + NULL terminator)
//.........这里部分代码省略.........
示例3: elseif
<?php
if (preg_match('/^Cisco IOS Software, .+? Software \\([^\\-]+-([\\w\\d]+)-\\w\\), Version ([^,]+)/', $poll_device['sysDescr'], $regexp_result)) {
$features = $regexp_result[1];
$version = $regexp_result[2];
} elseif (false) {
# Placeholder
# Other regexp for other type of string
}
echo "\n" . $poll_device['sysDescr'] . "\n";
$oids = "entPhysicalModelName.1 entPhysicalContainedIn.1 entPhysicalName.1 entPhysicalSoftwareRev.1 entPhysicalModelName.1001 entPhysicalContainedIn.1001 cardDescr.1 cardSlotNumber.1";
$data = snmp_get_multi($device, $oids, "-OQUs", "ENTITY-MIB:OLD-CISCO-CHASSIS-MIB");
if ($data[1]['entPhysicalContainedIn'] == "0") {
if (!empty($data[1]['entPhysicalSoftwareRev'])) {
$version = $data[1]['entPhysicalSoftwareRev'];
}
if (!empty($data[1]['entPhysicalName'])) {
$hardware = $data[1]['entPhysicalName'];
}
if (!empty($data[1]['entPhysicalModelName'])) {
$hardware = $data[1]['entPhysicalModelName'];
}
}
# if ($slot_1 == "-1" && strpos($descr_1, "No") === FALSE) { $ciscomodel = $descr_1; }
# if (($contained_1 == "0" || $name_1 == "Chassis") && strpos($model_1, "No") === FALSE) { $ciscomodel = $model_1; list($version_1) = explode(",",$ver_1); }
# if ($contained_1001 == "0" && strpos($model_1001, "No") === FALSE) { $ciscomodel = $model_1001; }
# $ciscomodel = str_replace("\"","",$ciscomodel);
# if ($ciscomodel) { $hardware = $ciscomodel; unset($ciscomodel); }
if (empty($hardware)) {
$hardware = snmp_get($device, "sysObjectID.0", "-Osqv", "SNMPv2-MIB:CISCO-PRODUCTS-MIB");
}
示例4: get_main_serial
function get_main_serial($device)
{
if ($device['os_group'] == 'cisco') {
$serial_output = snmp_get_multi($device, 'entPhysicalSerialNum.1 entPhysicalSerialNum.1001', '-OQUs', 'ENTITY-MIB:OLD-CISCO-CHASSIS-MIB');
if (!empty($serial_output[1]['entPhysicalSerialNum'])) {
return $serial_output[1]['entPhysicalSerialNum'];
} else {
if (!empty($serial_output[1001]['entPhysicalSerialNum'])) {
return $serial_output[1001]['entPhysicalSerialNum'];
}
}
}
}
示例5: unset
* (at your option) any later version.
*
* See COPYING for more details.
*/
unset($poll_device);
$snmpdata = snmp_get_multi($device, 'sysUpTime.0 sysLocation.0 sysContact.0 sysName.0 sysObjectID.0', '-OQnUst', 'SNMPv2-MIB:HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB');
$poll_device = $snmpdata[0];
$poll_device['sysName'] = strtolower($poll_device['sysName']);
$poll_device['sysDescr'] = snmp_get($device, 'sysDescr.0', '-OvQ', 'SNMPv2-MIB:HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB');
if (!empty($agent_data['uptime'])) {
list($uptime) = explode(' ', $agent_data['uptime']);
$uptime = round($uptime);
echo "Using UNIX Agent Uptime ({$uptime})\n";
}
if (empty($uptime)) {
$snmp_data = snmp_get_multi($device, 'snmpEngineTime.0 hrSystemUptime.0', '-OQnUst', 'HOST-RESOURCES-MIB:SNMP-FRAMEWORK-MIB');
$uptime_data = $snmp_data[0];
$snmp_uptime = (int) $uptime_data['snmpEngineTime'];
$hrSystemUptime = $uptime_data['hrSystemUptime'];
if (!empty($hrSystemUptime) && !strpos($hrSystemUptime, 'No') && $device['os'] != 'windows') {
// Move uptime into agent_uptime
$agent_uptime = $uptime;
$uptime = floor($hrSystemUptime / 100);
echo 'Using hrSystemUptime (' . $uptime . "s)\n";
} else {
$uptime = floor($poll_device['sysUpTime'] / 100);
echo 'Using SNMP Agent Uptime (' . $uptime . "s)\n ";
}
//end if
}
//end if
示例6: unset
<?php
/* Observium Network Management and Monitoring System
* Copyright (C) 2006-2014, Observium Developers - http://www.observium.org
*
* @package observium
* @subpackage poller
* @author Adam Armstrong <adama@memetic.org>
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
unset($poll_device, $cache['devices']['uptime'][$device['device_id']]);
$snmpdata = snmp_get_multi($device, "sysUpTime.0 sysLocation.0 sysContact.0 sysName.0", "-OQUs", "SNMPv2-MIB", mib_dirs());
$polled = time();
$poll_device = $snmpdata[0];
$poll_device['sysDescr'] = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB", mib_dirs());
$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'])) {
$uptime = round($agent_data['uptime']);
$uptime_msg = "Using UNIX Agent Uptime";
} else {
示例7: get_port_by_id
*
* This file is part of Observium.
*
* @package observium
* @subpackage webinterface
* @author Adam Armstrong <adama@memetic.org>
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
// FIXME - fewer includes!
include_once "../includes/defaults.inc.php";
include_once "../config.php";
include_once "../includes/definitions.inc.php";
include_once "../includes/common.inc.php";
include_once "../includes/dbFacile.php";
include_once "../includes/rewrites.inc.php";
include_once "includes/functions.inc.php";
include_once "includes/authenticate.inc.php";
include_once "../includes/snmp.inc.php";
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id']))) {
$port = get_port_by_id($_GET['id']);
$device = device_by_id_cache($port['device_id']);
$title = generate_device_link($device);
$title .= " :: Port " . generate_port_link($port);
$auth = TRUE;
}
$time = time();
$HC = $port['port_64bit'] ? 'HC' : '';
$data = snmp_get_multi($device, "if{$HC}InOctets." . $port['ifIndex'] . " if{$HC}OutOctets." . $port['ifIndex'], "-OQUs", "IF-MIB", mib_dirs());
printf("%lf|%s|%s\n", time(), $data[$port['ifIndex']]["if{$HC}InOctets"], $data[$port['ifIndex']]["if{$HC}OutOctets"]);
// EOF
示例8: rewrite_ceraos_hardware
$hardware = rewrite_ceraos_hardware($ceragon_type, $device);
// function in ./includes/rewrites.php
if (stristr('IP10', $hardware)) {
$serial = snmp_get($device, 'genEquipUnitIDUSerialNumber.0', '-Oqv', 'MWRM-UNIT-MIB');
} else {
$serial = snmp_get($device, 'genEquipInventorySerialNumber.127', '-Oqv', 'MWRM-UNIT-MIB');
}
$multi_get_array = snmp_get_multi($device, 'genEquipMngSwIDUVersionsRunningVersion.1 genEquipUnitLatitude.0 genEquipUnitLongitude.0', '-OQU', 'MWRM-RADIO-MIB');
d_echo($multi_get_array);
$version = $multi_get_array[1]['MWRM-UNIT-MIB::genEquipMngSwIDUVersionsRunningVersion'];
$latitude = $multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLatitude'];
$longitude = $multi_get_array[0]['MWRM-UNIT-MIB::genEquipUnitLongitude'];
$ifIndex_array = array();
$ifIndex_array = explode("\n", snmp_walk($device, 'ifIndex', '-Oqv', 'IF-MIB'));
d_echo($ifIndex_array);
$snmp_get_oids = "";
foreach ($ifIndex_array as $ifIndex) {
$snmp_get_oids .= "ifDescr.{$ifIndex} ifName.{$ifIndex} ";
}
$num_radios = 0;
$ifDescr_array = array();
$ifDescr_array = snmp_get_multi($device, $snmp_get_oids, '-OQU', 'IF-MIB');
d_echo($ifDescr_array);
foreach ($ifIndex_array as $ifIndex) {
d_echo("\$ifDescr_array[{$ifIndex}]['IF-MIB::ifDescr'] = " . $ifDescr_array[$ifIndex]['IF-MIB::ifDescr'] . "\n");
if (stristr($ifDescr_array[$ifIndex]['IF-MIB::ifDescr'], "Radio")) {
$num_radios = $num_radios + 1;
}
}
$features = $num_radios . " radios in unit";
unset($ceragon_type, $multi_get_array, $ifIndex_array, $ifIndex, $ifDescr_array, $ifDescr, $num_radios);
示例9: snmp_get_multi
// 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
if ($device['os_group'] == 'cisco') {
$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];
$rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('cras_sessions.rrd');
$rrd_create .= ' DS:email:GAUGE:600:0:U';
$rrd_create .= ' DS:ipsec:GAUGE:600:0:U';
$rrd_create .= ' DS:l2l:GAUGE:600:0:U';
$rrd_create .= ' DS:lb:GAUGE:600:0:U';
$rrd_create .= ' DS:svc:GAUGE:600:0:U';
$rrd_create .= ' DS:webvpn:GAUGE:600:0:U';
$rrd_create .= $config['rrd_rra'];
if (is_file($rrd_filename) || $data['crasEmailNumSessions'] || $data['crasIPSecNumSessions'] || $data['crasL2LNumSessions'] || $data['crasLBNumSessions'] || $data['crasSVCNumSessions'] || $data['crasWebvpnSessions']) {
if (!file_exists($rrd_filename)) {
rrdtool_create($rrd_filename, $rrd_create);
}
$fields = array('email' => $data['crasEmailNumSessions'], 'ipsec' => $data['crasIPSecNumSessions'], 'l2l' => $data['crasL2LNumSessions'], 'lb' => $data['crasLBNumSessions'], 'svc' => $data['crasSVCNumSessions'], 'webvpn' => $data['crasWebvpnNumSessions']);
rrdtool_update($rrd_filename, $fields);
示例10: foreach
foreach ($temp_data as $k => $v) {
$cbgp_data .= "{$v}\n";
}
d_echo("{$cbgp_data}\n");
} else {
// FIXME - move to function
$oids = " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
$oids .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".{$afi}.{$safi}";
d_echo("{$oids}\n");
$cbgp_data = snmp_get_multi($device, $oids, '-OUQs ', 'CISCO-BGP4-MIB');
$cbgp_data = array_pop($cbgp_data);
d_echo("{$cbgp_data}\n");
}
//end if
$cbgpPeerAcceptedPrefixes = $cbgp_data['cbgpPeerAcceptedPrefixes'];
$cbgpPeerDeniedPrefixes = $cbgp_data['cbgpPeerDeniedPrefixes'];
$cbgpPeerPrefixAdminLimit = $cbgp_data['cbgpPeerPrefixAdminLimit'];
$cbgpPeerPrefixThreshold = $cbgp_data['cbgpPeerPrefixThreshold'];
$cbgpPeerPrefixClearThreshold = $cbgp_data['cbgpPeerPrefixClearThreshold'];
$cbgpPeerAdvertisedPrefixes = $cbgp_data['cbgpPeerAdvertisedPrefixes'];
$cbgpPeerSuppressedPrefixes = $cbgp_data['cbgpPeerSuppressedPrefixes'];
$cbgpPeerWithdrawnPrefixes = $cbgp_data['cbgpPeerWithdrawnPrefixes'];
unset($cbgp_data);
}
//end if
示例11: d_echo
**/
d_echo($oids . "\n");
if (!empty($oids)) {
echo 'EQLCONTROLLER-MIB ';
foreach (explode("\n", $oids) as $data) {
$data = trim($data);
if (!empty($data)) {
list($oid, $descr) = explode(' = ', $data, 2);
$split_oid = explode('.', $oid);
$num_index = $split_oid[count($split_oid) - 1];
$index = $num_index;
$part_oid = $split_oid[count($split_oid) - 2];
$num_index = $part_oid . '.' . $num_index;
$base_oid = '.1.3.6.1.4.1.12740.2.1.7.1.3.1.';
$oid = $base_oid . $num_index;
$extra = snmp_get_multi($device, "eqlMemberHealthDetailsFanValue.1.{$num_index} eqlMemberHealthDetailsFanCurrentState.1.{$num_index} eqlMemberHealthDetailsFanHighCriticalThreshold.1.{$num_index} eqlMemberHealthDetailsFanHighWarningThreshold.1.{$num_index} eqlMemberHealthDetailsFanLowCriticalThreshold.1.{$num_index} eqlMemberHealthDetailsFanLowWarningThreshold.1.{$num_index}", '-OQUs', 'EQLMEMBER-MIB', $config['install_dir'] . '/mibs/equallogic');
$keys = array_keys($extra);
$temperature = $extra[$keys[0]]['eqlMemberHealthDetailsFanValue'];
$low_limit = $extra[$keys[0]]['eqlMemberHealthDetailsFanLowCriticalThreshold'];
$low_warn = $extra[$keys[0]]['eqlMemberHealthDetailsFanLowWarningThreshold'];
$high_limit = $extra[$keys[0]]['eqlMemberHealthDetailsFanHighCriticalThreshold'];
$high_warn = $extra[$keys[0]]['eqlMemberHealthDetailsFanHighWarningThreshold'];
$index = 100 + $index;
if ($extra[$keys[0]]['eqlMemberHealthDetailsFanCurrentState'] != 'unknown') {
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, $low_limit, $low_warn, $high_limit, $high_warn, $temperature);
}
}
//end if
}
//end foreach
}
示例12: snmp_get_multi
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$cache_mempool = snmp_get_multi($device, 'rcSysDramSize.0 rcSysDramFree.0', '-OQUs', 'RAPID-CITY');
$mempool['total'] = $cache_mempool[$index]['rcSysDramSize'] * 1024;
$mempool['free'] = $cache_mempool[$index]['rcSysDramFree'];
// EOF
示例13: array
<?php
if (!starts_with($device['os'], array('Snom', 'asa'))) {
echo ' UDP';
// These are at the start of large trees that we don't want to walk the entirety of, so we snmpget_multi them
$oids = array('udpInDatagrams', 'udpOutDatagrams', 'udpInErrors', 'udpNoPorts');
$rrd_def = array();
$snmpstring = '';
foreach ($oids as $oid) {
$oid_ds = substr($oid, 0, 19);
$rrd_def[] = " DS:{$oid_ds}:COUNTER:600:U:1000000";
// Limit to 1MPPS?
$snmpstring .= ' UDP-MIB::' . $oid . '.0';
}
$data = snmp_get_multi($device, $snmpstring, '-OQUs', 'UDP-MIB');
$fields = array();
foreach ($oids as $oid) {
if (is_numeric($data[0][$oid])) {
$value = $data[0][$oid];
} else {
$value = 'U';
}
$fields[$oid] = $value;
}
if (isset($data[0]['udpInDatagrams']) && isset($data[0]['udpOutDatagrams'])) {
$tags = compact('rrd_def');
data_update($device, 'netstats-udp', $tags, $fields);
$graphs['netstat_udp'] = true;
}
}
//end if
示例14: snmp_get_multi
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2015 Adam Armstrong
*
*/
$mib = 'PEAKFLOW-SP-MIB';
$cache_mempool = snmp_get_multi($device, "devicePhysicalMemory.0 devicePhysicalMemoryInUse.0", "-OQUs", $mib);
$mempool['total'] = $cache_mempool[$index]['devicePhysicalMemory'];
$mempool['used'] = $cache_mempool[$index]['devicePhysicalMemoryInUse'];
// EOF
示例15: snmp_get_multi
<?php
// HOST-RESOURCES-MIB
// Generic System Statistics
$oid_list = "hrSystemProcesses.0 hrSystemNumUsers.0";
$hrSystem = snmp_get_multi($device, $oid_list, "-OUQs", "HOST-RESOURCES-MIB");
echo "HR Stats:";
if (is_numeric($hrSystem[0]['hrSystemProcesses'])) {
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_processes.rrd";
if (!is_file($rrd_file)) {
rrdtool_create($rrd_file, "--step 300 \\\n DS:procs:GAUGE:600:0:U " . $config['rrd_rra']);
}
rrdtool_update($rrd_file, "N:" . $hrSystem[0]['hrSystemProcesses']);
$graphs['hr_processes'] = TRUE;
echo " Processes";
}
if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) {
$rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/hr_users.rrd";
if (!is_file($rrd_file)) {
rrdtool_create($rrd_file, "--step 300 \\\n DS:users:GAUGE:600:0:U " . $config['rrd_rra']);
}
rrdtool_update($rrd_file, "N:" . $hrSystem[0]['hrSystemNumUsers']);
$graphs['hr_users'] = TRUE;
echo " Users";
}
echo "\n";