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


PHP snmp_get函数代码示例

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


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

示例1: discover_new_device_ip

function discover_new_device_ip($host)
{
    global $config;
    if (match_network($config['autodiscovery']['ip_nets'], $host)) {
        if (isPingable($host)) {
            echo "Pingable ";
            foreach ($config['snmp']['community'] as $community) {
                $device = deviceArray($host, $community, "v2c", "161", "udp", NULL);
                print_message("Trying community {$community} ...");
                if (isSNMPable($device)) {
                    echo "SNMPable ";
                    $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB");
                    if (dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE sysName = ?", array($snmphost)) == '0') {
                        $device_id = createHost($snmphost, $community, "v2c", "161", "udp");
                        $device = device_by_id_cache($device_id, 1);
                        array_push($GLOBALS['devices'], $device);
                        return $device_id;
                    } else {
                        echo "Already have host with sysName {$snmphost}\n";
                    }
                }
            }
        }
    }
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:25,代码来源:functions.inc.php

示例2: getValue

function getValue($host, $port, $id, $inout)
{
    global $config;
    $oid = 'IF-MIB::ifHC' . $inout . 'Octets.' . $id;
    $device = dbFetchRow("SELECT * from `devices` WHERE `hostname` = '" . mres($host) . "' LIMIT 1");
    $value = snmp_get($device, $oid, '-O qv');
    if (!is_numeric($value)) {
        $oid = 'IF-MIB::if' . $inout . 'Octets.' . $id;
        $value = snmp_get($device, $oid, '-Oqv');
    }
    return $value;
}
开发者ID:Tatermen,项目名称:librenms,代码行数:12,代码来源:billing.php

示例3: discover_new_device_ip

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @subpackage functions
 * @author     Adam Armstrong <adama@memetic.org>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
function discover_new_device_ip($host, $source = 'xdp', $protocol = NULL, $device = NULL, $port = NULL)
{
    global $config;
    print_debug("Discovering possible new device on {$host}");
    if ($config['autodiscovery'][$source]) {
        if (match_network($config['autodiscovery']['ip_nets'], $host)) {
            $db = dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS P, devices AS D WHERE A.ipv4_address = ? AND P.port_id = A.port_id AND D.device_id = P.device_id", array($host));
            if (is_array($db)) {
                print_debug("Already have {$host} on " . $db['hostname']);
            } else {
                if (isPingable($host)) {
                    echo "Pingable ";
                    foreach ($config['snmp']['community'] as $community) {
                        $newdevice = deviceArray($host, $community, "v2c", "161", "udp", NULL);
                        print_message("Trying community {$community} ...");
                        if (isSNMPable($newdevice)) {
                            echo "SNMPable ";
                            $snmphost = snmp_get($newdevice, "sysName.0", "-Oqv", "SNMPv2-MIB");
                            if (dbFetchCell("SELECT COUNT(device_id) FROM devices WHERE sysName = ?", array($snmphost)) == '0') {
                                $device_id = createHost($snmphost, $community, "v2c", "161", "udp");
                                $newdevice = device_by_id_cache($device_id, 1);
                                array_push($GLOBALS['devices'], $newdevice);
                                if (!$protocol) {
                                    $protocol = strtoupper($source);
                                }
                                if ($port) {
                                    humanize_port($port);
                                    log_event("Device autodiscovered through {$protocol} on " . $device['hostname'] . " (port " . $port['label'] . ")", $remote_device_id, 'interface', $port['port_id']);
                                } else {
                                    log_event("Device autodiscovered through {$protocol} on " . $device['hostname'], $remote_device_id);
                                }
                                return $device_id;
                            } else {
                                echo "Already have host with sysName {$snmphost}\n";
                            }
                        }
                    }
                } else {
                    print_debug("IP not pingable.");
                }
            }
        } else {
            print_debug("Host does not match configured nets");
        }
    } else {
        print_debug("Source {$source} disabled for autodiscovery!");
    }
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:60,代码来源:functions.inc.php

示例4: notreadable

<?php

#ALCATEL-IND1-SYSTEM-MIB::systemHardwareMemoryMfg.0 = INTEGER: notreadable(12)
#ALCATEL-IND1-SYSTEM-MIB::systemHardwareMemorySize.0 = Gauge32: 268435456
#ALCATEL-IND1-HEALTH-MIB::healthDeviceMemoryLatest.0 = INTEGER: 74
#ALCATEL-IND1-HEALTH-MIB::healthDeviceMemory1MinAvg.0 = INTEGER: 74
#ALCATEL-IND1-HEALTH-MIB::healthDeviceMemory1HrAvg.0 = INTEGER: 74
#ALCATEL-IND1-HEALTH-MIB::healthDeviceMemory1HrMax.0 = INTEGER: 74
$mempool['units'] = "1";
$mempool['total'] = snmp_get($device, "systemHardwareMemorySize.0", "-OvQ", "ALCATEL-IND1-SYSTEM-MIB", "+" . $config['install_dir'] . "/mibs/aos");
$percent = snmp_get($device, "healthDeviceMemoryLatest.0", "-OvQ", "ALCATEL-IND1-HEALTH-MIB", "+" . $config['install_dir'] . "/mibs/aos");
$mempool['used'] = $mempool['total'] * ($percent / 100);
$mempool['free'] = $mempool['total'] - $mempool['used'];
开发者ID:REAP720801,项目名称:librenms,代码行数:13,代码来源:aos-device.inc.php

示例5: snmp_get

<?php

if ($device['os'] == 'qnap') {
    echo 'QNAP temperature ';
    // Turbo NAS Temperature
    $turbonas_temperature_oid = '.1.3.6.1.4.1.24681.1.3.6.0';
    // Turbo NAS Disk Temperature
    $disk_temperature_oid = '.1.3.6.1.4.1.24681.1.2.11.1.3.';
    // Get Turbo NAS temperature
    $turbonas_temperature = snmp_get($device, $turbonas_temperature_oid, '-Oqv');
    // Save the Turbo NAS temperature
    discover_sensor($valid['sensor'], 'temperature', $device, $turbonas_temperature_oid, '99', 'snmp', 'System Temperature', '1', '1', null, null, null, null, $turbonas_temperature);
    // Get all disks in the device
    $disks = snmpwalk_cache_multi_oid($device, 'SystemHdTable', array(), 'NAS-MIB');
    // Parse all disks in the device to get the temperatures
    if (is_array($disks)) {
        foreach ($disks as $disk_number => $entry) {
            // Get the disk temperature full oid
            $disk_oid = $disk_temperature_oid . $disk_number;
            // Get the temperature for the disk
            $disk_temperature = $entry['HdTemperature'];
            // Getting the disk information (Number and model)
            $disk_information = $entry['HdDescr'] . ' ' . $entry['HdModel'];
            // Save the temperature for the disk
            discover_sensor($valid['sensor'], 'temperature', $device, $disk_oid, $disk_number, 'snmp', $disk_information, '1', '1', null, null, null, null, $disk_temperature);
        }
    }
}
开发者ID:greggcz,项目名称:librenms,代码行数:28,代码来源:qnap.inc.php

示例6: snmp_get

<?php

if (!empty($agent_data['app']['nginx'])) {
    $nginx = $agent_data['app']['nginx'];
} else {
    // Polls nginx statistics from script via SNMP
    $nginx = snmp_get($device, 'nsExtendOutputFull.5.110.103.105.110.120', '-Ovq', 'NET-SNMP-EXTEND-MIB');
}
$nginx_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/app-nginx-' . $app['app_id'] . '.rrd';
echo ' nginx';
list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx);
if (!is_file($nginx_rrd)) {
    rrdtool_create($nginx_rrd, '--step 300 
        DS:Requests:DERIVE:600:0:125000000000 
        DS:Active:GAUGE:600:0:125000000000 
        DS:Reading:GAUGE:600:0:125000000000 
        DS:Writing:GAUGE:600:0:125000000000 
        DS:Waiting:GAUGE:600:0:125000000000 ' . $config['rrd_rra']);
}
d_echo("active: {$active} reading: {$reading} writing: {$writing} waiting: {$waiting} Requests: {$req}");
$fields = array('Requests' => $req, 'Active' => $active, 'Reading' => $reading, 'Writing' => $writing, 'Waiting' => $waiting);
rrdtool_update($nginx_rrd, $fields);
$tags = array('name' => 'nginx', 'app_id' => $app['app_id']);
influx_update($device, 'app', $tags, $fields);
// Unset the variables we set here
unset($nginx);
unset($nginx_rrd);
unset($active);
unset($reading);
unset($writing);
unset($req);
开发者ID:wiad,项目名称:librenms,代码行数:31,代码来源:nginx.inc.php

示例7: snmp_get

<?php

$Descr_string = snmp_get($device, 'sysDescr.0', '-Oqv', 'SNMPv2-MIB');
$Descr_chopper = preg_split('/[ ]+/', "{$Descr_string}");
$version = 'Firmware ' . $Descr_chopper[1];
$hardware = $Descr_chopper[0] . ' Rev. ' . str_replace('"', '', snmp_get($device, '1.3.6.1.4.1.171.10.76.10.1.2.0', '-Oqv'));
开发者ID:samyscoub,项目名称:librenms,代码行数:6,代码来源:dlink.inc.php

示例8: elseif

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");
}
#if(isset($cisco_hardware_oids[$poll_device['sysObjectID']])) { $hardware = $cisco_hardware_oids[$poll_device['sysObjectID']]; }
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:30,代码来源:cisco.inc.php

示例9: snmp_get

<?php

// Polls powerdns statistics from script via SNMP
$rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/app-powerdns-' . $app['app_id'] . '.rrd';
$options = '-O qv';
$mib = 'NET-SNMP-EXTEND-MIB';
$oid = 'nsExtendOutputFull.8.112.111.119.101.114.100.110.115';
if ($agent_data['app']['powerdns']) {
    $powerdns = $agent_data['app']['powerdns'];
} else {
    $powerdns = snmp_get($device, $oid, $options, $mib);
}
echo ' powerdns';
list($corrupt, $def_cacheInserts, $def_cacheLookup, $latency, $pc_hit, $pc_miss, $pc_size, $qsize, $qc_hit, $qc_miss, $rec_answers, $rec_questions, $servfail, $tcp_answers, $tcp_queries, $timedout, $udp_answers, $udp_queries, $udp4_answers, $udp4_queries, $udp6_answers, $udp6_queries) = explode("\n", $powerdns);
if (!is_file($rrd_filename)) {
    rrdtool_create($rrd_filename, '--step 300 
        DS:corruptPackets:DERIVE:600:0:125000000000 
        DS:def_cacheInserts:DERIVE:600:0:125000000000 
        DS:def_cacheLookup:DERIVE:600:0:125000000000 
        DS:latency:DERIVE:600:0:125000000000 
        DS:pc_hit:DERIVE:600:0:125000000000 
        DS:pc_miss:DERIVE:600:0:125000000000 
        DS:pc_size:DERIVE:600:0:125000000000 
        DS:qsize:DERIVE:600:0:125000000000 
        DS:qc_hit:DERIVE:600:0:125000000000 
        DS:qc_miss:DERIVE:600:0:125000000000 
        DS:rec_answers:DERIVE:600:0:125000000000 
        DS:rec_questions:DERIVE:600:0:125000000000 
        DS:servfailPackets:DERIVE:600:0:125000000000 
        DS:q_tcpAnswers:DERIVE:600:0:125000000000 
        DS:q_tcpQueries:DERIVE:600:0:125000000000 
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:powerdns.inc.php

示例10: trim

<?php

echo 'IPv4 Addresses : ';
$oids = trim(snmp_walk($device, 'ipAdEntIfIndex', '-Osq', 'IP-MIB'));
$oids = str_replace('ipAdEntIfIndex.', '', $oids);
foreach (explode("\n", $oids) as $data) {
    $data = trim($data);
    list($oid, $ifIndex) = explode(' ', $data);
    $mask = trim(snmp_get($device, "ipAdEntNetMask.{$oid}", '-Oqv', 'IP-MIB'));
    $addr = Net_IPv4::parseAddress("{$oid}/{$mask}");
    $network = $addr->network . '/' . $addr->bitmask;
    $cidr = $addr->bitmask;
    if (dbFetchCell('SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifIndex` = ?', array($device['device_id'], $ifIndex)) != '0' && $oid != '0.0.0.0' && $oid != 'ipAdEntIfIndex') {
        $port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $ifIndex));
        if (dbFetchCell('SELECT COUNT(*) FROM `ipv4_networks` WHERE `ipv4_network` = ?', array($network)) < '1') {
            dbInsert(array('ipv4_network' => $network), 'ipv4_networks');
            // echo("Create Subnet $network\n");
            echo 'S';
        }
        $ipv4_network_id = dbFetchCell('SELECT `ipv4_network_id` FROM `ipv4_networks` WHERE `ipv4_network` = ?', array($network));
        if (dbFetchCell('SELECT COUNT(*) FROM `ipv4_addresses` WHERE `ipv4_address` = ? AND `ipv4_prefixlen` = ? AND `port_id` = ?', array($oid, $cidr, $port_id)) == '0') {
            dbInsert(array('ipv4_address' => $oid, 'ipv4_prefixlen' => $cidr, 'ipv4_network_id' => $ipv4_network_id, 'port_id' => $port_id), 'ipv4_addresses');
            // echo("Added $oid/$cidr to $port_id ( $hostname $ifIndex )\n $i_query\n");
            echo '+';
        } else {
            echo '.';
        }
        $full_address = "{$oid}/{$cidr}|{$ifIndex}";
        $valid_v4[$full_address] = 1;
    } else {
        echo '!';
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:ipv4-addresses.inc.php

示例11: snmp_get

        $current = snmp_get($device, $freq_oid, '-Oqv') / 10;
        $type = 'rfc1628';
        $divisor = 10;
        if ($device['os'] == 'huaweiups') {
            $divisor = 100;
        }
        $index = '3.2.0.' . $i;
        discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
    }
    $freq_oid = '1.3.6.1.2.1.33.1.4.2.0';
    $descr = 'Output';
    $current = snmp_get($device, $freq_oid, '-Oqv') / 10;
    $type = 'rfc1628';
    $divisor = 10;
    if ($device['os'] == 'huaweiups') {
        $divisor = 100;
    }
    $index = '4.2.0';
    discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
    $freq_oid = '1.3.6.1.2.1.33.1.5.1.0';
    $descr = 'Bypass';
    $current = snmp_get($device, $freq_oid, '-Oqv') / 10;
    $type = 'rfc1628';
    $divisor = 10;
    if ($device['os'] == 'huaweiups') {
        $divisor = 100;
    }
    $index = '5.1.0';
    discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}
//end if
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:rfc1628.inc.php

示例12: preg_match

 if ($device['os'] == 'pbn') {
     preg_match('/^.* Build (?<build>\\d+)/', $device['version'], $version);
     if ($version[build] <= 16607) {
         // Buggy version :-(
         $tm = '1';
     }
 }
 // read the 802.1D subtree
 $stp_raw = snmpwalk_cache_oid($device, 'dot1dStp', array(), 'RSTP-MIB');
 $stp = array('protocolSpecification' => $stp_raw[0]['dot1dStpProtocolSpecification'], 'priority' => $stp_raw[0]['dot1dStpPriority'], 'topChanges' => $stp_raw[0]['dot1dStpTopChanges'], 'rootCost' => $stp_raw[0]['dot1dStpRootCost'], 'rootPort' => $stp_raw[0]['dot1dStpRootPort'], 'maxAge' => $stp_raw[0]['dot1dStpMaxAge'] * $tm, 'helloTime' => $stp_raw[0]['dot1dStpHelloTime'] * $tm, 'holdTime' => $stp_raw[0]['dot1dStpHoldTime'] * $tm, 'forwardDelay' => $stp_raw[0]['dot1dStpForwardDelay'] * $tm, 'bridgeMaxAge' => $stp_raw[0]['dot1dStpBridgeMaxAge'] * $tm, 'bridgeHelloTime' => $stp_raw[0]['dot1dStpBridgeHelloTime'] * $tm, 'bridgeForwardDelay' => $stp_raw[0]['dot1dStpBridgeForwardDelay'] * $tm);
 // set device binding
 $stp['device_id'] = $device['device_id'];
 // read the 802.1D bridge address and set as MAC in database
 $mac_raw = snmp_get($device, 'dot1dBaseBridgeAddress.0', '-Oqv', 'RSTP-MIB');
 // read Time as timetics (in hundredths of a seconds) since last topology change and convert to seconds
 $time_since_change = snmp_get($device, 'dot1dStpTimeSinceTopologyChange.0', '-Ovt', 'RSTP-MIB');
 if ($time_since_change > '100') {
     $time_since_change = substr($time_since_change, 0, -2);
     // convert to seconds since change
 } else {
     $time_since_change = '0';
 }
 $stp['timeSinceTopologyChange'] = $time_since_change;
 // designated root is stored in format 2 octet bridge priority + MAC address, so we need to normalize it
 $dr = str_replace(array(' ', ':', '-'), '', strtolower($stp_raw[0]['dot1dStpDesignatedRoot']));
 $dr = substr($dr, -12);
 //remove first two octets
 $stp['designatedRoot'] = $dr;
 // normalize the MAC
 $mac_array = explode(':', $mac_raw);
 foreach ($mac_array as &$octet) {
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:stp.inc.php

示例13: snmpwalk_cache_oid

 *   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, 'isDeviceConfigTable', array(), 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorTemperatureTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigTemperatureTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorHumidityTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigHumidityTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceMonitorDigitalInTable', $oids, 'ISPRO-MIB');
$oids = snmpwalk_cache_oid($device, 'isDeviceConfigDigitalInTable', $oids, 'ISPRO-MIB');
// isConfigTemperatureUnit.0 = INTEGER: celsius(1)
$isConfigTemperatureUnit = snmp_get($device, 'isConfigTemperatureUnit.0', '-Oqv', 'ISPRO-MIB');
foreach ($oids as $index => $entry) {
    // Skip if this sensor has been disabled for display in the web interface
    if ($entry['isDeviceConfigDisplay'] == 'enabled') {
        // Temperature
        // isDeviceConfigTemperatureIndex.1 = INTEGER: 1
        // isDeviceMonitorTemperatureName.1 = STRING: "Temperature1"
        // isDeviceMonitorTemperature.1 = INTEGER: 3121
        // isDeviceConfigTemperatureName.1 = STRING: "Temperature1"
        $descr = $entry['isDeviceMonitorTemperatureName'];
        $oid = ".1.3.6.1.4.1.19011.1.3.2.1.3.1.1.1.3.{$index}";
        $value = $entry['isDeviceMonitorTemperature'];
        // Warning/Critical limits can be enabled/disabled in the web interface. Use them as supplied if enabled, calculate our own if not enabled.
        //
        // isDeviceConfigTemperatureLowWarning.1 = INTEGER: 2300
        // isDeviceConfigTemperatureLowCritical.1 = INTEGER: 2000
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ispro-mib.inc.php

示例14: snmp_get

<?php

// Simple hard-coded poller for Fortinet Fortigate
// Yes, it really can be this simple.
echo "Fortigate MemPool";
$mempool['perc'] = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemUsage.0", "-OvQ");
$mempool['total'] = snmp_get($device, "FORTINET-FORTIGATE-MIB::fgSysMemCapacity.0", "-OvQ");
$mempool['used'] = $mempool['total'] * ($mempool['perc'] / 100);
$mempool['free'] = $mempool['total'] - $mempool['used'];
echo "(U: " . $mempool['used'] . " T: " . $mempool['total'] . " F: " . $mempool['free'] . ") ";
开发者ID:REAP720801,项目名称:librenms,代码行数:10,代码来源:fortigate.inc.php

示例15: 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


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