本文整理汇总了PHP中print_vars函数的典型用法代码示例。如果您正苦于以下问题:PHP print_vars函数的具体用法?PHP print_vars怎么用?PHP print_vars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_vars函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: custom_port_parser
function custom_port_parser($port)
{
global $debug;
if ($debug) {
echo $port['ifAlias'];
}
list($type, $descr) = preg_split("/[\\:\\[\\]\\{\\}\\(\\)]/", $port['ifAlias']);
list(, $circuit) = preg_split("/[\\{\\}]/", $port['ifAlias']);
list(, $notes) = preg_split("/[\\(\\)]/", $port['ifAlias']);
list(, $speed) = preg_split("/[\\[\\]]/", $port['ifAlias']);
$descr = trim($descr);
$port_ifAlias = array();
if ($type && $descr) {
$type = strtolower($type);
$port_ifAlias['type'] = $type;
$port_ifAlias['descr'] = $descr;
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['speed'] = $speed;
$port_ifAlias['notes'] = $notes;
}
if ($debug && count($port_ifAlias)) {
print_vars($port_ifAlias);
}
return $port_ifAlias;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:25,代码来源:port-descr-parser.inc.php
示例2: api_show_debug
/**
* Show the debug information
*
* @param txt
* @param value
*
*/
function api_show_debug($txt, $value)
{
global $vars;
if ($vars['debug']) {
echo "<pre>\n";
echo "DEBUG " . $txt . ":\n";
print_vars($value);
echo "</pre>\n";
}
}
开发者ID:skive,项目名称:observium,代码行数:17,代码来源:functions.inc.php
示例3: print_vars
function print_vars($obj)
{
$arr = get_object_vars($obj);
while (list($prop, $val) = each($arr)) {
if (class_exists($val)) {
print_vars($val);
} else {
echo "\t {$prop} = {$val}\n<br />";
}
}
}
开发者ID:rdegennaro,项目名称:Check-It,代码行数:11,代码来源:admin.booklibrary.class.impexp.php
示例4: print_sql
function print_sql($query)
{
if ($GLOBALS['cli']) {
print_vars($query);
} else {
if (class_exists('SqlFormatter')) {
// Hide it under a "database icon" popup.
#echo overlib_link('#', '<i class="oicon-databases"> </i>', SqlFormatter::highlight($query));
echo '<p>', SqlFormatter::highlight($query), '</p>';
} else {
print_vars($query);
}
}
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:14,代码来源:common.php
示例5: getLastMeasurement
function getLastMeasurement($bill_id)
{
$row = dbFetchRow("SELECT timestamp,delta,in_delta,out_delta FROM bill_data WHERE bill_id='" . mres($bill_id) . "' ORDER BY timestamp DESC LIMIT 0,1");
print_vars($row);
if (is_numeric($row['delta'])) {
$return['delta'] = $row['delta'];
$return['delta_in'] = $row['delta_in'];
$return['delta_out'] = $row['delta_out'];
$return['timestamp'] = $row['timestamp'];
$return['state'] = "ok";
} else {
$return['state'] = "failed";
}
return $return;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:15,代码来源:billing.php
示例6: custom_port_parser
function custom_port_parser($port)
{
global $config;
print_debug($port['ifAlias']);
// Pull out Type and Description or abort
if (!preg_match('/^([^:]+):([^\\[\\]\\(\\)\\{\\}]+)/', $port['ifAlias'], $matches)) {
return array();
}
// Munge and Validate type
$types = array('core', 'peering', 'transit', 'cust', 'server', 'l2tp');
foreach ($config['int_groups'] as $custom_type) {
$types[] = strtolower(trim($custom_type));
}
$type = strtolower(trim($matches[1], " \t\n\r\v\\/\"'"));
if (!in_array($type, $types)) {
return array();
}
# Munge and Validate description
$descr = trim($matches[2]);
if ($descr == '') {
return array();
}
if (preg_match('/\\{(.*)\\}/', $port['ifAlias'], $matches)) {
$circuit = $matches[1];
}
if (preg_match('/\\[(.*)\\]/', $port['ifAlias'], $matches)) {
$speed = $matches[1];
}
if (preg_match('/\\((.*)\\)/', $port['ifAlias'], $matches)) {
$notes = $matches[1];
}
$port_ifAlias = array();
$port_ifAlias['type'] = $type;
$port_ifAlias['descr'] = $descr;
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['speed'] = $speed;
$port_ifAlias['notes'] = $notes;
if (OBS_DEBUG > 1) {
print_vars($port_ifAlias);
}
return $port_ifAlias;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:42,代码来源:port-descr-parser.inc.php
示例7: mydebug
function mydebug($line, $file, $vars)
{
$debug = $GLOBALS['debug'];
if ($debug) {
print "<i>Debugging line {$line} of script {$file}</i>.<br>";
$type = gettype($vars);
switch ($type) {
case 'array':
foreach ($vars as $k => $v) {
print "{$k}: {$v}<br>";
}
break;
case 'object':
print_vars($vars);
break;
default:
print $vars;
}
}
}
开发者ID:eguicciardi,项目名称:ada,代码行数:20,代码来源:utilities.inc.php
示例8: snmpwalk_cache_oid
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticTemperature', array(), 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticVcc', $oids, 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticTxBias', $oids, 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticTxPower', $oids, 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticRxPower', $oids, 'OA-SFP-MIB');
if (OBS_DEBUG > 1) {
print_vars($oids);
}
foreach ($oids as $index => $entry) {
list($mrvslot, $mrvport) = explode('.', $index);
$xdescr = "Slot {$mrvslot} port {$mrvport}";
unset($mrvslot, $mrvport);
if ($entry['oaSfpDiagnosticTemperature'] != 'empty') {
$descr = $xdescr . ' DOM Temperature';
$scale = 0.1;
$oid = ".1.3.6.1.4.1.6926.1.18.1.1.3.1.3.{$index}";
$value = intval($entry['oaSfpDiagnosticTemperature']);
if ($value != 0) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'lambdadriver-dom-temp', $descr, $scale, $value);
}
}
if ($entry['oaSfpDiagnosticVcc'] != 'empty') {
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:oa-sfp-mib.inc.php
示例9: snmpwalk_cache_threepart_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <[email protected]>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB", NULL, OBS_SNMP_ALL | OBS_SNMP_CONCAT);
if ($lldp_array) {
if (OBS_DEBUG > 1) {
print_vars($lldp_array);
}
$dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB");
$lldp_local_array = snmpwalk_cache_oid($device, "lldpLocalSystemData", array(), "LLDP-MIB");
foreach ($lldp_array as $key => $lldp_if_array) {
foreach ($lldp_if_array as $entry_key => $lldp_instance) {
if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex']) && $device['os'] != "junos") {
$ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
} else {
$ifIndex = $entry_key;
}
// Get the port using BRIDGE-MIB
$port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ? AND `ifDescr` NOT LIKE 'Vlan%'", array($device['device_id'], $ifIndex));
// If BRIDGE-MIB failed, get the port using pure LLDP-MIB
if (!$port) {
$ifName = $lldp_local_array[$entry_key]['lldpLocPortDesc'];
开发者ID:Natolumin,项目名称:observium,代码行数:30,代码来源:lldp-mib.inc.php
示例10: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// EMBEDDED-NGX-MIB
if (!is_array($cache_storage['embedded-ngx-mib'])) {
$cache_storage['embedded-ngx-mib'] = snmpwalk_cache_oid($device, "swStorage", NULL, "EMBEDDED-NGX-MIB");
if (OBS_DEBUG && count($cache_storage['embedded-ngx-mib'])) {
print_vars($cache_storage['embedded-ngx-mib']);
}
}
$entry = $cache_storage['embedded-ngx-mib'][$storage['storage_index']];
$storage['units'] = 1024;
$storage['size'] = $entry['swStorageConfigTotal'] * $storage['units'];
$storage['free'] = $entry['swStorageConfigFree'] * $storage['units'];
$storage['used'] = $storage['size'] - $storage['free'];
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:25,代码来源:embedded-ngx-mib.inc.php
示例11: snmpwalk_cache_oid
/**
* 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':
case 'hrStorageRam':
case 'hrStorageOther':
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:host-resources-mib.inc.php
示例12: print_r
echo '<td><i class="icon-remove-sign red"></i></td>';
}
if (is_array($config['graph_types']['device'][$graph_entry['graph']])) {
echo '<td><i class="icon-ok-sign green"></i></td>';
} else {
echo '<td><i class="icon-remove-sign red"></i></td>';
}
if ($graph_entry['enabled']) {
echo '<td><i class="icon-ok-sign green"></i></td>';
} else {
echo '<td><i class="icon-remove-sign red"></i></td>';
}
echo '<td>' . print_r($config['graph_types']['device'][$graph_entry['graph']], TRUE) . '</td>';
echo '</tr>';
}
?>
</table>
</div>
<div class="well info_box">
<?php
print_vars($device);
?>
</div>
</div>
</div>
<?php
} else {
include "includes/error-no-perm.inc.php";
}
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:showtech.inc.php
示例13: strtotime
$vars['from'] = strtotime($vars['timestamp_from']);
unset($vars['timestamp_from']);
}
if (isset($vars['timestamp_to']) && preg_match($timestamp_pattern, $vars['timestamp_to'])) {
$vars['to'] = strtotime($vars['timestamp_to']);
unset($vars['timestamp_to']);
}
if (!is_numeric($vars['from'])) {
$vars['from'] = $config['time']['day'];
}
if (!is_numeric($vars['to'])) {
$vars['to'] = $config['time']['now'];
}
preg_match('/^(?P<type>[a-z0-9A-Z-]+)_(?P<subtype>.+)/', $vars['type'], $graphtype);
if (OBS_DEBUG) {
print_vars($graphtype);
}
$type = $graphtype['type'];
$subtype = $graphtype['subtype'];
if (is_numeric($vars['device'])) {
$device = device_by_id_cache($vars['device']);
} elseif (!empty($vars['device'])) {
$device = device_by_name($vars['device']);
}
if (is_file($config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php")) {
include $config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php";
}
if (!$auth) {
print_error_permission();
return;
}
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:graphs.inc.php
示例14: snmpwalk_cache_oid
if ($GLOBALS['snmp_status']) {
$radios_snmp = snmpwalk_cache_oid($device, 'ruckusRadioStatsTable', array(), 'RUCKUS-RADIO-MIB');
if (OBS_DEBUG > 1) {
print_vars($radios_snmp);
}
}
$polled = time();
// Goes through the SNMP radio data
foreach ($radios_snmp as $radio_number => $radio) {
$radio['polled'] = $polled;
$radio['radio_number'] = $radio_number;
$radio['radio_ap'] = 0;
// Hardcoded since the AP is self.
$radio['radio_clients'] = $radio['ruckusRadioStatsNumSta'];
if (OBS_DEBUG && count($radio)) {
print_vars($radio);
}
// FIXME -- This is Ruckus only and subject to change. RRD files may be wiped as we modify this format to fit everything.
$dses = array('assoc_fail_rate' => array('oid' => 'ruckusRadioStatsAssocFailRate', 'type' => 'gauge'), 'auth_success_rate' => array('oid' => 'ruckusRadioStatsAssocSuccessRate', 'type' => 'gauge'), 'auth_fail_rate' => array('oid' => 'ruckusRadioStatsAuthFailRate', 'type' => 'gauge'), 'max_stations' => array('oid' => 'ruckusRadioStatsMaxSta', 'type' => 'gauge'), 'assoc_fail' => array('oid' => 'ruckusRadioStatsNumAssocFail'), 'assoc_req' => array('oid' => 'ruckusRadioStatsNumAssocReq'), 'assoc_resp' => array('oid' => 'ruckusRadioStatsNumAssocResp'), 'assoc_success' => array('oid' => 'ruckusRadioStatsNumAssocSuccess'), 'auth_fail' => array('oid' => 'ruckusRadioStatsNumAuthFail'), 'auth_req' => array('oid' => 'ruckusRadioStatsNumAuthReq'), 'auth_resp' => array('oid' => 'ruckusRadioStatsNumAuthResp'), 'auth_stations' => array('oid' => 'ruckusRadioStatsNumAuthSta', 'type' => 'gauge'), 'auth_success' => array('oid' => 'ruckusRadioStatsNumAuthSuccess'), 'num_stations' => array('oid' => 'ruckusRadioStatsNumSta', 'type' => 'gauge'), 'resource_util' => array('oid' => 'ruckusRadioStatsResourceUtil', 'type' => 'gauge'), 'rx_bytes' => array('oid' => 'ruckusRadioStatsRxBytes'), 'rx_decrypt_crcerr' => array('oid' => 'ruckusRadioStatsRxDecryptCRCError'), 'rx_errors' => array('oid' => 'ruckusRadioStatsRxErrors'), 'rx_frames' => array('oid' => 'ruckusRadioStatsRxFrames'), 'rx_mic_error' => array('oid' => 'ruckusRadioStatsRxMICError'), 'rx_wep_fail' => array('oid' => 'ruckusRadioStatsRxWEPFail'), 'tx_bytes' => array('oid' => 'ruckusRadioStatsTxBytes'), 'tx_frames' => array('oid' => 'ruckusRadioStatsTxFrames'), 'total_airtime' => array('oid' => 'ruckusRadioStatsTotalAirtime'), 'total_assoc_time' => array('oid' => 'ruckusRadioStatsTotalAssocTime'), 'busy_airtime' => array('oid' => 'ruckusRadioStatsBusyAirtime'));
$rrd_file = 'wifi-radio-' . $radio['radio_ap'] . '-' . $radio['radio_number'] . '.rrd';
$rrd_update = 'N';
$rrd_create = '';
foreach ($dses as $ds => $ds_data) {
$oid = $ds_data['oid'];
$radio[$ds] = $radio[$oid];
if ($ds_data['type'] == 'gauge') {
$rrd_create .= ' DS:' . $ds . ':GAUGE:600:U:100000000000';
} else {
$rrd_create .= ' DS:' . $ds . ':COUNTER:600:U:100000000000';
}
if (is_numeric($radio[$oid])) {
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ruckus-radio-mib.inc.php
示例15: unset
}
}
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'];
$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]) {
$GLOBALS['module_stats'][$module]['deleted']++;
//echo('-');
dbDelete('processors', '`processor_id` = ?', array($test_processor['processor_id']));
log_event("Processor removed: type " . $processor_type . " index " . $processor_index . " descr " . $processor_descr, $device, 'processor', $test_processor['processor_id']);
}
unset($processor_oid);
unset($processor_type);
}
$GLOBALS['module_stats'][$module]['status'] = count($valid['processor']);
if (OBS_DEBUG && $GLOBALS['module_stats'][$module]['status']) {
print_vars($valid['processor']);
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:processors.inc.php
示例16: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2015 Adam Armstrong
*
*/
// ProxyAV devices hide their CPUs/Memory/Interfaces in here
echo " BLUECOAT-SG-USAGE-MIB ";
$av_array = snmpwalk_cache_oid($device, "deviceUsage", array(), "BLUECOAT-SG-USAGE-MIB", mib_dirs('bluecoat'));
if (OBS_DEBUG > 1) {
print_vars($av_array);
}
if (is_array($av_array)) {
foreach ($av_array as $index => $entry) {
if (strpos($entry['deviceUsageName'], "Memory") !== false) {
$descr = $entry['deviceUsageName'];
$oid = ".1.3.6.1.4.1.3417.2.4.1.1.1.4." . $index;
$perc = $entry['deviceUsagePercent'];
discover_mempool($valid['mempool'], $device, $index, $mib, $descr, 1, 100, $perc);
}
}
}
unset($av_array);
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:30,代码来源:bluecoat-sg-usage-mib.inc.php
示例17: check_entity
/**
* Check an entity against all relevant alerts
*
* @param string type
* @param array entity
* @param array data
* @return NULL
*/
function check_entity($type, $entity, $data)
{
global $config, $alert_rules, $alert_table, $device;
echo "\nChecking alerts\n";
if ($GLOBALS['debug']) {
print_vars($data);
}
list($entity_table, $entity_id_field, $entity_name_field, $entity_ignore_field) = entity_type_translate($type);
foreach ($alert_table[$type][$entity[$entity_id_field]] as $alert_test_id => $alert_args) {
if ($alert_rules[$alert_test_id]['and']) {
$alert = TRUE;
} else {
$alert = FALSE;
}
$update_array = array();
if (is_array($alert_rules[$alert_test_id])) {
echo "Checking alert " . $alert_test_id . " associated by " . $alert_args['alert_assocs'] . "\n";
foreach ($alert_rules[$alert_test_id]['conditions'] as $test_key => $test) {
if (substr($test['value'], 0, 1) == "@") {
$ent_val = substr($test['value'], 1);
$test['value'] = $entity[$ent_val];
echo " replaced @" . $ent_val . " with " . $test['value'] . " from entity. ";
}
echo "Testing: " . $test['metric'] . " " . $test['condition'] . " " . $test['value'];
$update_array['state']['metrics'][$test['metric']] = $data[$test['metric']];
if (isset($data[$test['metric']])) {
echo " (value: " . $data[$test['metric']] . ")";
if (test_condition($data[$test['metric']], $test['condition'], $test['value'])) {
// A test has failed. Set the alert variable and make a note of what failed.
echo " FAIL ";
$update_array['state']['failed'][] = $test;
if ($alert_rules[$alert_test_id]['and']) {
$alert = $alert && TRUE;
} else {
$alert = $alert || TRUE;
}
} else {
if ($alert_rules[$alert_test_id]['and']) {
$alert = $alert && FALSE;
} else {
$alert = $alert || FALSE;
}
echo " OK ";
}
} else {
echo " Metric is not present on entity.\n";
if ($alert_rules[$alert_test_id]['and']) {
$alert = $alert && FALSE;
} else {
$alert = $alert || FALSE;
}
}
}
if ($alert) {
// Check to see if this alert has been suppressed by anything
## FIXME -- not all of this is implemented
// Have all alerts on the device been suppressed?
if ($device['ignore']) {
$alert_suppressed = TRUE;
$suppressed[] = "DEV";
}
if (is_numeric($device['ignore_until']) && $device['ignore_until'] > time()) {
$alert_suppressed = TRUE;
$suppressed[] = "DEV_UNTIL";
}
// Have all alerts on the entity been suppressed?
if ($entity[$entity_ignore_field]) {
$alert_suppressed = TRUE;
$suppressed[] = "ENTITY";
}
if (is_numeric($entity['ignore_until']) && $entity['ignore_until'] > time()) {
$alert_suppressed = TRUE;
$suppressed[] = "ENTITY_UNTIL";
}
// Have alerts from this alerter been suppressed?
if ($alert_rules[$alert_test_id]['ignore']) {
$alert_suppressed = TRUE;
$suppressed[] = "CHECK";
}
if (is_numeric($alert_rules[$alert_test_id]['ignore_until']) && $alert_rules[$alert_test_id]['ignore_until'] > time()) {
$alert_suppressed = TRUE;
$suppressed[] = "CHECK_UNTIL";
}
// Has this specific alert been suppressed?
if ($alert_args['ignore']) {
$alert_suppressed = TRUE;
$suppressed[] = "ENTRY";
}
if (is_numeric($alert_args['ignore_until']) && $alert_args['ignore_until'] > time()) {
$alert_suppressed = TRUE;
$suppressed[] = "ENTRY_UNTIL";
}
//.........这里部分代码省略.........
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:101,代码来源:alerts.inc.php
示例18: snmpwalk_cache_oid
* @subpackage discovery
* @copyright (C) 2006-2015 Adam Armstrong
*
*/
// Force10 E-Series
// FIXME. Need snmpwalk for total size: F10-CHASSIS-MIB::chSysProcessorMemSize
#F10-CHASSIS-MIB::chRpmMemUsageUtil.1 = 5
#F10-CHASSIS-MIB::chRpmMemUsageUtil.2 = 36
#F10-CHASSIS-MIB::chRpmMemUsageUtil.3 = 9
$mib = 'F10-CHASSIS-MIB';
echo " {$mib} ";
$mempool_array = snmpwalk_cache_oid($device, "chRpmMemUsageUtil", NULL, $mib, mib_dirs('force10'));
if (is_array($mempool_array)) {
$total_array = snmpwalk_cache_oid($device, "chSysProcessorMemSize.1", NULL, $mib, mib_dirs('force10'));
if (OBS_DEBUG > 1 && count($total_array)) {
print_vars($total_array);
}
foreach ($mempool_array as $index => $entry) {
if (is_numeric($entry['chRpmMemUsageUtil'])) {
if (is_numeric($total_array['1.' . $index]['chSysProcessorMemSize'])) {
$precision = 1024 * 1024;
$total = $total_array['1.' . $index]['chSysProcessorMemSize'];
// FTOS display memory in MB
$total *= $precision;
} else {
$precision = 1;
$total = 1090519040;
// Hardcoded total. See FIXME above.
}
$percent = $entry['chRpmMemUsageUtil'];
$used = $total * $percent / 100;
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:f10-chassis-mib.inc.php
示例19: var_dump
var_dump($GLOBALS['cache']['discovery-protocols']);
}
$table_rows = array();
$neighbours_db = dbFetchRows('SELECT * FROM `neighbours` LEFT JOIN `ports` USING(`port_id`) WHERE `device_id` = ?', array($device['device_id']));
foreach ($neighbours_db as $neighbour) {
$local_port_id = $neighbour['port_id'];
$remote_hostname = $neighbour['remote_hostname'];
$remote_port = $neighbour['remote_port'];
print_debug("{$local_port_id} -> {$remote_hostname} -> {$remote_port}");
if (!$valid['neighbours'][$local_port_id][$remote_hostname][$remote_port]) {
dbDelete('neighbours', '`neighbour_id` = ?', array($neighbour['neighbour_id']));
$GLOBALS['module_stats'][$module]['deleted']++;
} else {
$port = get_port_by_id_cache($local_port_id);
if (is_numeric($neighbour['remote_port_id'])) {
$remote_port_array = get_port_by_id_cache($neighbour['remote_port_id']);
$remote_port = $remote_port_array['port_label'];
}
$table_rows[] = array(nicecase($neighbour['protocol']), $port['port_label'], $remote_hostname, $remote_port, truncate($neighbour['remote_platform'], 20), truncate($neighbour['remote_version'], 40));
}
}
echo PHP_EOL;
$table_headers = array('%WProtocol%n', '%WifName%n', '%WRemote: hostname%n', '%Wport%n', '%Wplatform%n', '%Wversion%n');
print_cli_table($table_rows, $table_headers);
$GLOBALS['module_stats'][$module]['status'] = count($valid[$module]);
if (OBS_DEBUG && $GLOBALS['module_stats'][$module]['status']) {
print_vars($valid[$module]);
}
unset($valid['neighbours']);
echo PHP_EOL;
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:neighbours.inc.php
示例20: log_event
}
# Vendors
} else {
echo "No BGP on host";
if (is_numeric($device['bgpLocalAs'])) {
log_event('BGP ASN removed: AS' . $device['bgpLocalAs'], $device, 'bgp');
dbUpdate(array('bgpLocalAs' => array('NULL')), 'devices', 'device_id = ?', array($device['device_id']));
print_message('Removed ASN (' . $device['bgpLocalAs'] . ')');
}
# End if
}
# End if
// Process discovered peers
$table_rows = array();
if (OBS_DEBUG > 1) {
print_vars($peerlist);
}
if (isset($peerlist)) {
// Walk vendor oids
if ($vendor_mib) {
if (!isset($vendor_use_index[$vendor_PeerRemoteAddrType])) {
$vendor_bgp = snmpwalk_cache_oid($device, $vendor_PeerRemoteAddrType, $vendor_bgp, $vendor_mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
if ($vendor_PeerIndex && !isset($vendor_use_index[$vendor_PeerIndex])) {
$vendor_bgp = snmpwalk_cache_oid($device, $vendor_PeerIndex, $vendor_bgp, $vendor_mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
$vendor_counters = snmpwalk_cache_oid($device, $vendor_PrefixCountersSafi, array(), $vendor_mib, NULL, OBS_SNMP_ALL_NUMERIC_INDEX);
}
echo PHP_EOL;
foreach ($peerlist as $peer) {
$astext = get_astext($peer['as']);
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:bgp-peers.inc.php
注:本文中的print_vars函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论