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


PHP snmp2_get函数代码示例

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


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

示例1: Get

function Get($ip, $ver, $cm, $oid, $t = 1000000, $r = 2)
{
    global $debug, $comms;
    if ($ver == 3 and $comms[$cm]['pprot']) {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpget -v3 -c{$cm} " . $comms[$cm]['aprot'] . "/" . $comms[$cm]['pprot'] . " {$ip} {$oid} ({$t} usec * {$r})</div>";
        }
        return snmp3_get($ip, $cm, 'authPriv', $comms[$cm]['aprot'], $comms[$cm]['apass'], $comms[$cm]['pprot'], $comms[$cm]['ppass'], ".{$oid}", $t, $r);
    } elseif ($ver == 3 and $comms[$cm]['aprot']) {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpget -v3 -c{$cm} " . $comms[$cm]['aprot'] . " {$ip} {$oid} ({$t} usec * {$r})</div>";
        }
        return snmp3_get($ip, $cm, 'authNoPriv', $comms[$cm]['aprot'], $comms[$cm]['apass'], 'DES', '', ".{$oid}", $t, $r);
    } elseif ($ver == 2) {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpget -v2c -c{$cm} {$ip} {$oid} ({$t} usec * {$r})</div>";
        }
        return snmp2_get($ip, $cm, ".{$oid}", $t, $r);
    } else {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpget -v1 -c{$cm} {$ip} {$oid} ({$t} usec * {$r})</div>";
        }
        return snmpget($ip, $cm, ".{$oid}", $t, $r);
    }
}
开发者ID:pl0o0f,项目名称:nedi-puppet,代码行数:25,代码来源:libsnmp.php

示例2: cacti_snmp_get

function cacti_snmp_get($hostname, $community, $oid, $version, $username, $password, $port = 161, $timeout = 500, $retries = 0, $environ = SNMP_POLLER)
{
    global $config;
    /* determine default retries */
    if ($retries == 0 || !is_numeric($retries)) {
        $retries = read_config_option("snmp_retries");
        if ($retries == "") {
            $retries = 3;
        }
    }
    /* do not attempt to poll invalid combinations */
    if ($version == 0 || $community == "" && $version != 3) {
        return "U";
    }
    if (snmp_get_method($version) == SNMP_METHOD_PHP) {
        /* make sure snmp* is verbose so we can see what types of data
        		we are getting back */
        snmp_set_quick_print(0);
        if ($version == "1") {
            $snmp_value = @snmpget("{$hostname}:{$port}", "{$community}", "{$oid}", $timeout * 1000, $retries);
        } elseif ($version == "2") {
            $snmp_value = @snmp2_get("{$hostname}:{$port}", "{$community}", "{$oid}", $timeout * 1000, $retries);
        } else {
            $snmp_value = @snmp3_get("{$hostname}:{$port}", $username, "authNoPriv", "MD5", $password, "", "", $oid, $timeout * 1000, $retries);
        }
    } else {
        /* ucd/net snmp want the timeout in seconds */
        $timeout = ceil($timeout / 1000);
        if ($version == "1") {
            $snmp_auth = read_config_option("snmp_version") == "ucd-snmp" ? SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER : "-c " . SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER;
            /* v1/v2 - community string */
        } elseif ($version == "2") {
            $snmp_auth = read_config_option("snmp_version") == "ucd-snmp" ? SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER : "-c " . SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER;
            /* v1/v2 - community string */
            $version = "2c";
            /* ucd/net snmp prefers this over '2' */
        } elseif ($version == "3") {
            $snmp_auth = "-u {$username} -l authNoPriv -a MD5 -A {$password}";
            /* v3 - username/password */
        }
        /* no valid snmp version has been set, get out */
        if (empty($snmp_auth)) {
            return;
        }
        if (read_config_option("snmp_version") == "ucd-snmp") {
            exec(read_config_option("path_snmpget") . " -O vt -v{$version} -t {$timeout} -r {$retries} {$hostname}:{$port} {$snmp_auth} {$oid}", $snmp_value);
        } else {
            exec(read_config_option("path_snmpget") . " -O fntev {$snmp_auth} -v {$version} -t {$timeout} -r {$retries} {$hostname}:{$port} {$oid}", $snmp_value);
        }
    }
    if (isset($snmp_value)) {
        /* fix for multi-line snmp output */
        if (is_array($snmp_value)) {
            $snmp_value = implode(" ", $snmp_value);
        }
    }
    /* strip out non-snmp data */
    $snmp_value = format_snmp_string($snmp_value);
    return $snmp_value;
}
开发者ID:songchin,项目名称:Cacti,代码行数:60,代码来源:snmp.php

示例3: get

 function get($oid)
 {
     if ($this->version == "1") {
         $snmp_result = snmpget($this->ip, $this->community, $oid);
     } else {
         if ($this->version == "2c") {
             $snmp_result = snmp2_get($this->ip, $this->community, $oid);
         }
     }
     $result = $this->clear_snmp_string($snmp_result);
     return $result;
 }
开发者ID:engeld,项目名称:snmphp,代码行数:12,代码来源:snmputils.php

示例4: cacti_snmp_get

function cacti_snmp_get($hostname, $community, $oid, $version, $username, $password, $port = 161, $timeout = 500, $environ = SNMP_POLLER) {
	global $config;
	/* determine default retries */
	$retries = read_config_option("snmp_retries");
	if ($retries == "") $retries = 3;

	if (snmp_get_method($version) == SNMP_METHOD_PHP) {
		/* make sure snmp* is verbose so we can see what types of data
		we are getting back */
		snmp_set_quick_print(0);

		if ($version == "1") {
			$snmp_value = @snmpget("$hostname:$port", $community, $oid, ($timeout * 1000), $retries);
		}else {
			$snmp_value = @snmp2_get("$hostname:$port", $community, $oid, ($timeout * 1000), $retries);
		}
	}else {
		/* ucd/net snmp want the timeout in seconds */
		$timeout = ceil($timeout / 1000);

		if ($version == "1") {
			$snmp_auth = (read_config_option("snmp_version") == "ucd-snmp") ? SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER : "-c " . SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER; /* v1/v2 - community string */
		}elseif ($version == "2") {
			$snmp_auth = (read_config_option("snmp_version") == "ucd-snmp") ? SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER : "-c " . SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER; /* v1/v2 - community string */
			$version = "2c"; /* ucd/net snmp prefers this over '2' */
		}elseif ($version == "3") {
			$snmp_auth = "-u $username -l authPriv -a MD5 -A $password -x DES -X $password"; /* v3 - username/password */
		}

		/* no valid snmp version has been set, get out */
		if (empty($snmp_auth)) { return; }

		if (read_config_option("snmp_version") == "ucd-snmp") {
			exec(read_config_option("path_snmpget") . " -O vt -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid", $snmp_value);
		}else {
			exec(read_config_option("path_snmpget") . " -O fntUev $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid", $snmp_value);
		}
	}

	if (isset($snmp_value)) {
		/* fix for multi-line snmp output */
		if (is_array($snmp_value)) {
			$snmp_value = implode(" ", $snmp_value);
		}
	}

	/* strip out non-snmp data */
	$snmp_value = format_snmp_string($snmp_value);

	return $snmp_value;
}
开发者ID:songchin,项目名称:Cacti,代码行数:51,代码来源:snmp.php

示例5: rf2_conf2_read

function rf2_conf2_read()
{
    global $frequency2, $acquisitionBandwidth2, $symbolRate2, $goldCode2, $isi2, $lnbPower2, $signal22KHz2, $compensation2, $profileName2;
    global $oid, $device_IP;
    $profileName2 = substr(snmp2_get($device_IP, "public", $oid['profileName4']), 9);
    $frequency2 = substr(snmp2_get($device_IP, "public", $oid['frequency4']), 9) / 1000;
    $acquisitionBandwidth2 = substr(snmp2_get($device_IP, "public", $oid['acquisitionBandwidth4']), 9) / 1000;
    $symbolRate2 = substr(snmp2_get($device_IP, "public", $oid['symbolRate4']), 9) / 1000;
    $goldCode2 = substr(snmp2_get($device_IP, "public", $oid['goldCode4']), 9);
    $isi2 = substr(snmp2_get($device_IP, "public", $oid['isi4']), 9);
    $lnbPower2 = substr(snmp2_get($device_IP, "public", $oid['lnbPower4']), 9);
    $signal22KHz2 = substr(snmp2_get($device_IP, "public", $oid['signal22KHz4']), 9);
    $compensation2 = substr(snmp2_get($device_IP, "public", $oid['compensation4']), 9);
}
开发者ID:gunawanwibisono,项目名称:WebInterface,代码行数:14,代码来源:rf_functions.php

示例6: asi_read

function asi_read()
{
    global $egrAsiEnabled, $egrAsiDstIpAddress, $egrAsiDstEthAddress, $egrAsiDstUdpPort, $egrAsiDscp, $egrAsiSrcIpAddress, $egrAsiSrcEthAddress, $egrAsiSrcUdpPort, $egrAsiTSoIPContainerSize, $egrAsiPcrAwareness, $egrAsiMaxTimeout;
    global $oid, $device_IP;
    $egrAsiEnabled = substr(snmp2_get($device_IP, "public", $oid['egrAsiEnabled']), 9);
    $egrAsiDstIpAddress = substr(snmp2_get($device_IP, "public", $oid['egrAsiDstIpAddress']), 11);
    $egrAsiDstEthAddress = substr(snmp2_get($device_IP, "public", $oid['egrAsiDstEthAddress']), 11);
    $egrAsiDstUdpPort = substr(snmp2_get($device_IP, "public", $oid['egrAsiDstUdpPort']), 9);
    $egrAsiDscp = substr(snmp2_get($device_IP, "public", $oid['egrAsiDscp']), 9);
    $egrAsiSrcIpAddress = substr(snmp2_get($device_IP, "public", $oid['egrAsiSrcIpAddress']), 11);
    $egrAsiSrcEthAddress = substr(snmp2_get($device_IP, "public", $oid['egrAsiSrcEthAddress']), 11);
    $egrAsiSrcUdpPort = substr(snmp2_get($device_IP, "public", $oid['egrAsiSrcUdpPort']), 11);
    $egrAsiTSoIPContainerSize = substr(snmp2_get($device_IP, "public", $oid['egrAsiTSoIPContainerSize']), 9);
    $egrAsiPcrAwareness = substr(snmp2_get($device_IP, "public", $oid['egrAsiPcrAwareness']), 9);
    $egrAsiMaxTimeout = substr(snmp2_get($device_IP, "public", $oid['egrAsiMaxTimeout']), 9);
}
开发者ID:gunawanwibisono,项目名称:WebInterface,代码行数:16,代码来源:egress_functions.php

示例7: get

 static function get($host, $object_id, $cache_ttl = null)
 {
     if ($cache_ttl) {
         $cache_var = str_replace('.', '_', $host->ip . $object_id);
         $cache = new CacheAPC();
         $resultCache = $cache->load($cache_var);
         if ($resultCache !== null) {
             return $resultCache;
         }
     }
     snmp_set_oid_output_format(self::$oid_format);
     $snmp = $host->snmpTemplate;
     if ($snmp instanceof SnmpTemplate) {
         switch ($snmp->version) {
             case "1":
                 $result = @snmpget($host->ip, $snmp->community, $object_id, $snmp->timeout, $snmp->retries);
                 break;
             case "2":
             case "2c":
                 $result = @snmp2_get($host->ip, $snmp->community, $object_id, $snmp->timeout, $snmp->retries);
                 break;
             case "3":
                 $result = @snmp3_get($host->ip, $snmp->security_name, $snmp->security_level, $snmp->auth_protocol, $snmp->auth_passphrase, $snmp->priv_protocol, $snmp->priv_passphrase, $object_id, $snmp->timeout, $snmp->retries);
                 break;
             default:
                 throw new Exception('SNMP Template not implemented yet');
         }
     }
     if ($result) {
         // retira 'STRING: ' do inicio do texto
         $result = trim(preg_replace('/^[^:]+: ?/', '', $result));
         if ($cache_var && $cache_ttl) {
             $cache->save($cache_var, $result, $cache_ttl);
         }
         return $result;
     } else {
         //throw new Exception("Sem resposta SNMP");
         return null;
     }
 }
开发者ID:romero1989,项目名称:phpnetmap,代码行数:40,代码来源:PNMSnmp.php

示例8: cacti_snmp_get

function cacti_snmp_get($hostname, $community, $oid, $version, $v3username, $v3password, $v3authproto = "", $v3privpassphrase = "", $v3privproto = "", $port = 161, $timeout = 500, $environ = SNMP_POLLER) {
	/* determine default retries */
	$retries = read_config_option("snmp_retries");
	if ($retries == "") $retries = 3;

	/* do not attempt to poll invalid combinations */
	if (($version == 0) || (($community == "") && ($version != 3))) {
		return "U";
	}

	/* get rid of quotes in privacy passphrase */
	$v3privpassphrase = str_replace("#space#", " ", $v3privpassphrase);

	if ($v3privproto == "[None]") {
		$v3privproto = "";
	}

	if (snmp_get_method($version) == SNMP_METHOD_PHP) {
		/* make sure snmp* is verbose so we can see what types of data
		we are getting back */
		snmp_set_quick_print(0);

		if ($version == "1") {
			$snmp_value = @snmpget("$hostname:$port", $community, trim($oid), ($timeout * 1000), $retries);
		}elseif ($version == "2") {
			$snmp_value = @snmp2_get("$hostname:$port", $community, $oid, ($timeout * 1000), $retries);
		}else{
			$snmp_value = @snmp3_get("$hostname:$port", $v3username, snmp_get_v3authpriv($v3privproto), $v3authproto,
				$v3password, $v3privproto, $v3privpassphrase, trim($oid), ($timeout * 1000), $retries);
		}
	}else{
		/* ucd/net snmp want the timeout in seconds */
		$timeout = ceil($timeout / 1000);

		if ($version == "1") {
			$snmp_auth = (read_config_option("snmp_version") == "ucd-snmp") ? SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER : "-c " . SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER; /* v1/v2 - community string */
		}elseif ($version == "2") {
			$snmp_auth = (read_config_option("snmp_version") == "ucd-snmp") ? SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER : "-c " . SNMP_ESCAPE_CHARACTER . $community . SNMP_ESCAPE_CHARACTER; /* v1/v2 - community string */
			$version = "2c"; /* ucd/net snmp prefers this over '2' */
		}elseif ($version == "3") {
			$snmp_auth = "-u $v3username -A $v3password -a $v3authproto -X $v3privpassphrase -x $v3privproto -l " . snmp_get_v3authpriv($v3privproto); /* v3 - username/password/etc... */
		}

		/* no valid snmp version has been set, get out */
		if (empty($snmp_auth)) { return; }

		if (read_config_option("snmp_version") == "ucd-snmp") {
			exec(read_config_option("path_snmpget") . " -O vt -v$version -t $timeout -r $retries $hostname:$port $snmp_auth $oid", $snmp_value);
		}else {
			exec(read_config_option("path_snmpget") . " -O fntev $snmp_auth -v $version -t $timeout -r $retries $hostname:$port $oid", $snmp_value);
		}
	}

	if (isset($snmp_value)) {
		/* fix for multi-line snmp output */
		if (is_array($snmp_value)) {
			$snmp_value = implode(" ", $snmp_value);
		}
	}
	/* strip out non-snmp data */
	$snmp_value = format_snmp_string($snmp_value);

	return $snmp_value;
}
开发者ID:songchin,项目名称:Cacti,代码行数:64,代码来源:snmp.php

示例9: substr

        $frequency3 = substr(snmp2_get($device_IP, "public", $oid['frequency3']), 9) / 1000;
        $esno2 = substr(snmp2_get($device_IP, "public", $oid['esno2']), 9) / 10;
        $powerLevel2 = substr(snmp2_get($device_IP, "public", $oid['powerLevel2']), 9) / 10;
        $ber2 = substr(snmp2_get($device_IP, "public", $oid['ber2']), 9);
        $frequencyOffset2 = substr(snmp2_get($device_IP, "public", $oid['frequencyOffset2']), 9) / 1000;
        $badPacketCount2 = substr(snmp2_get($device_IP, "public", $oid['badPacketCount2']), 9);
        $modcodStatus2 = substr(snmp2_get($device_IP, "public", $oid['modcodStatus2']), 9);
        $rollOffStatus2 = substr(snmp2_get($device_IP, "public", $oid['rollOffStatus2']), 9);
        $pilotsStatus2 = substr(snmp2_get($device_IP, "public", $oid['pilotsStatus2']), 9);
        $rx2CfgSet1Status = substr(snmp2_get($device_IP, "public", $oid['rx2CfgSet1Status']), 9);
        $rx2CfgSet2Status = substr(snmp2_get($device_IP, "public", $oid['rx2CfgSet2Status']), 9);
        if ($rx2CfgSet1Status == 0) {
            $rx2ActiveProfile = '"' . substr(snmp2_get($device_IP, "public", $oid['profileName3']), 9);
        }
        if ($rx2CfgSet2Status == 0) {
            $rx2ActiveProfile = '"' . substr(snmp2_get($device_IP, "public", $oid['profileName4']), 9);
        }
    }
}
?>

<!doctype html>

<html>

<head>
    <title>Ayecka Web Interface</title>
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon" />
    <meta name="viewport" content="width=device-width">
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>-->
开发者ID:gunawanwibisono,项目名称:WebInterface,代码行数:31,代码来源:index.php

示例10: substr

    $_SESSION['device_IP_st'] = $device_IP;
    $_SESSION['read_st'] = "read";
    //    Board Information
    $hardwareVersion = substr(snmp2_get($device_IP, "public", $oid['hardwareVersion']), 9);
    $fpgaVersion = substr(snmp2_get($device_IP, "public", $oid['fpgaVersion']), 9);
    $softwareVersion = substr(snmp2_get($device_IP, "public", $oid['softwareVersion']), 9);
    $serialNumber = substr(snmp2_get($device_IP, "public", $oid['serialNumber']), 9);
    // system info
    include_once 'info_function.php';
    //
    $txPowerStateStatus = substr(snmp2_get($device_IP, "public", $oid['txPowerStateStatus']), 9);
    $txFrequencyStatus = substr(snmp2_get($device_IP, "public", $oid['txFrequencyStatus']), 9) / 1000;
    $modInputBitrateStatus = substr(snmp2_get($device_IP, "public", $oid['modInputBitrateStatus']), 9) / 1000;
    $modOutputBitrateStatus = substr(snmp2_get($device_IP, "public", $oid['modOutputBitrateStatus']), 9) / 1000;
    $modModcodStatus = substr(snmp2_get($device_IP, "public", $oid['modModcodStatus']), 9);
    $modRolloffStatus = substr(snmp2_get($device_IP, "public", $oid['modRolloffStatus']), 9);
}
?>
<!doctype html>

<html>

<head>
    <title>Ayecka Web Interface</title>
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon" />
    <meta name="viewport" content="width=device-width">
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>-->
    <script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script>
    <style type="text/css">
        body {
开发者ID:gunawanwibisono,项目名称:WebInterface,代码行数:31,代码来源:index.php

示例11: get_snmp

 function get_snmp($details)
 {
     $CI =& get_instance();
     if (!isset($details->system_id) or $details->system_id == '') {
         $details->snmp_community = 'public';
         $details->snmp_version = '2c';
         $details->snmp_port = '161';
     } else {
         $encrypted_access_details = $CI->m_system->get_access_details($details->system_id);
         if ($encrypted_access_details == '') {
         }
         $decoded_access_details = $CI->encrypt->decode($encrypted_access_details);
         $decoded_access_details = json_decode($decoded_access_details);
         $details->snmp_community = @$decoded_access_details->snmp_community;
         $details->snmp_version = @$decoded_access_details->snmp_version;
         $details->snmp_port = @$decoded_access_details->snmp_port;
         $details->man_ip_address = @$decoded_access_details->ip_address;
     }
     if (!isset($details->snmp_community) or $details->snmp_community == '') {
         $details->snmp_community = 'public';
     }
     if (!isset($details->snmp_version) or $details->snmp_version == '') {
         $details->snmp_version = '';
     }
     if (!isset($details->snmp_port) or $details->snmp_port == '') {
         $details->snmp_port = '161';
     }
     # we may only have been given a system_id
     # but if the access_details were completed, that may be enough
     # if they weren't, we would at least need a hostname ot ip address
     if (!isset($details->man_ip_address) and !isset($details->hostname)) {
         return;
     }
     $module = new stdclass();
     if ((!isset($details->hostname) or $details->hostname == '') and (isset($details->man_ip_address) and $details->man_ip_address != '' and $details->man_ip_address != '000.000.000.000' and $details->man_ip_address != '0.0.0.0')) {
         $details->hostname = gethostbyaddr(ip_address_from_db($details->man_ip_address));
     }
     if ((!isset($details->man_ip_address) or $details->man_ip_address == '' or $details->man_ip_address == '0.0.0.0' or $details->man_ip_address == '000.000.000.000') and (isset($details->hostname) and $details->hostname != '')) {
         $details->man_ip_address = gethostbyname($details->hostname);
     }
     if (filter_var($details->hostname, FILTER_VALIDATE_IP)) {
         # we did not get a valid hostname back :-(
     } else {
         # we have a name of some sort
         if (strpos($details->hostname, ".") !== FALSE) {
             # fqdn - explode it
             if (!isset($details->fqdn) or $details->fqdn == '') {
                 $details->fqdn = $details->hostname;
             }
             $i = explode(".", $details->hostname);
             $details->hostname = $i[0];
             if (!isset($details->domain) or $details->domain == '') {
                 unset($i[0]);
                 $details->domain = implode(".", $i);
             }
         } else {
             # it's just a name
         }
     }
     $timeout = '300000';
     $retries = '2';
     if (!extension_loaded('snmp')) {
         return $details;
     }
     # test for SNMP version
     # to do - test for v3
     if ($details->snmp_version == '') {
         if ($test_v1 = @snmpget($details->man_ip_address, $details->snmp_community, "1.3.6.1.2.1.1.5.0", $timeout)) {
             # ok, we have v1
             $details->snmp_version = '1';
         }
         if ($test_v2 = @snmp2_get($details->man_ip_address, $details->snmp_community, "1.3.6.1.2.1.1.5.0", $timeout)) {
             # ok, we have v2
             $details->snmp_version = '2c';
         }
     }
     if ($details->snmp_version == '2c') {
         snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
         // test for connectivity
         $test_connect = @snmp2_get($details->man_ip_address, $details->snmp_community, "1.3.6.1.2.1.1.5.0", $timeout, $retries);
         if ($test_connect) {
             // printer duplex
             $details->printer_duplex = '';
             $i = @snmp2_walk($details->man_ip_address, $details->snmp_community, "1.3.6.1.2.1.43.13.4.1.10.1");
             if (count($i) > 0) {
                 $details->printer_duplex = 'False';
                 for ($k = 0; $k < count($i); $k++) {
                     if (mb_strpos($i[$k], "Duplex") !== FALSE) {
                         $details->printer_duplex = 'True';
                     }
                 }
             }
             // sysObjectID
             #$i = str_replace("STRING: ", "", snmp2_get($details->man_ip_address, $details->snmp_community, "1.3.6.1.2.1.1.1.0" ));
             $details->snmp_oid = str_replace("OID: .", "", snmp2_get($details->man_ip_address, $details->snmp_community, "1.3.6.1.2.1.1.2.0"));
             if (strtolower($details->snmp_oid) == 'no such object available on this agent at this oid') {
                 $details->snmp_oid = '';
             }
             if ($details->snmp_oid > '') {
                 $oid = get_oid($details->snmp_oid);
//.........这里部分代码省略.........
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:101,代码来源:snmp_helper.php

示例12: substr

    $rxChannelOpMode = substr(snmp2_get($device_IP, "public", $oid['rxChannelOpMode']), 9);
    $rxSwitchMode = substr(snmp2_get($device_IP, "public", $oid['rxSwitchMode']), 9);
    $rxSwitchPeriod = substr(snmp2_get($device_IP, "public", $oid['rxSwitchPeriod']), 9);
    $rxActive = substr(snmp2_get($device_IP, "public", $oid['rxActive']), 9);
}
//    Write
if (isset($_POST['write']) and $read == "read") {
    snmp2_set($device_IP, "private", $oid['rxChannelOpMode'], $type['rxChannelOpMode'], $_POST['rxChannelOpMode']);
    snmp2_set($device_IP, "private", $oid['rxSwitchMode'], $type['rxSwitchMode'], $_POST['rxSwitchMode']);
    snmp2_set($device_IP, "private", $oid['rxSwitchPeriod'], $type['rxSwitchPeriod'], $_POST['rxSwitchPeriod']);
    snmp2_set($device_IP, "private", $oid['rxActive'], $type['rxActive'], $_POST['rxActive']);
    // read
    $rxChannelOpMode = substr(snmp2_get($device_IP, "public", $oid['rxChannelOpMode']), 9);
    $rxSwitchMode = substr(snmp2_get($device_IP, "public", $oid['rxSwitchMode']), 9);
    $rxSwitchPeriod = substr(snmp2_get($device_IP, "public", $oid['rxSwitchPeriod']), 9);
    $rxActive = substr(snmp2_get($device_IP, "public", $oid['rxActive']), 9);
}
?>
<!doctype html>

<html>

<head>
    <title>Ayecka Web Interface</title>
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon" />
    <meta name="viewport" content="width=device-width">
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>-->
    <script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script>
    <style type="text/css">
        body {
开发者ID:gunawanwibisono,项目名称:WebInterface,代码行数:31,代码来源:rf_control.php

示例13: snmpget

 function snmpget($oid)
 {
     return snmp2_get($this->hostname, $this->snmpsetup['community'], $oid);
 }
开发者ID:ivladdalvi,项目名称:racktables,代码行数:4,代码来源:snmp.php

示例14: substr

 $total_procs = 0;
 $total_mem = 0;
 $total_vms = 0;
 for (reset($a); $i = key($a); next($a)) {
     //    echo "$i: $a[$i]<br />\n";
     echo "<tr>\n";
     $chave = substr($i, strrpos($i, '.') + 1);
     $vm_nome_tmp = snmp2_get($server, $snmp_community, '.1.3.6.1.4.1.6876.2.1.1.2.' . $chave);
     $vm_nome = str_replace("\"", "", substr($vm_nome_tmp, strrpos($vm_nome_tmp, ':') + 1));
     $vm_kernel_version_tmp = snmp2_get($server, $snmp_community, '.1.3.6.1.4.1.6876.2.1.1.4.' . $chave);
     $vm_kernel_version = str_replace("\"", "", substr($vm_kernel_version_tmp, strrpos($vm_kernel_version_tmp, ':') + 1));
     $vm_memory_total_tmp = snmp2_get($server, $snmp_community, '.1.3.6.1.4.1.6876.2.1.1.5.' . $chave);
     $vm_memory_total = str_replace("\"", "", substr($vm_memory_total_tmp, strrpos($vm_memory_total_tmp, ':') + 1));
     $vm_power_status_tmp = snmp2_get($server, $snmp_community, '.1.3.6.1.4.1.6876.2.1.1.6.' . $chave);
     $vm_power_status = str_replace("\"", "", substr($vm_power_status_tmp, strrpos($vm_power_status_tmp, ':') + 1));
     $vm_proc_total_tmp = snmp2_get($server, $snmp_community, '.1.3.6.1.4.1.6876.2.1.1.9.' . $chave);
     $vm_proc_total = str_replace("\"", "", substr($vm_proc_total_tmp, strrpos($vm_proc_total_tmp, ':') + 1));
     echo "  <td>{$vm_nome}</td>\n                        <td>{$vm_kernel_version}</td>\n                        <td  align=\"center\">{$vm_proc_total}</td>\n                        <td  align=\"center\">{$vm_memory_total}</td>\n                        <td  align=\"center\">";
     if ($vm_power_status == " powered off") {
         echo "<font color=\"red\">{$vm_power_status}</font>";
     } else {
         echo "<font color=\"green\">{$vm_power_status}</font>";
     }
     echo "</td>\n";
     echo "</tr>\n";
     $total_procs = $total_procs + $vm_proc_total;
     $total_mem = $total_mem + $vm_memory_total;
     $total_vms = $total_vms + 1;
 }
 echo "<tr><td align=\"center\"><b>{$total_vms} VMs Instalada(s)</b></td><td></td><td align=\"center\"><b>{$total_procs}</b></td><td align=\"center\"><b>{$total_mem}</b></td><td></td></tr>";
 echo "</table>\n";
开发者ID:davidmello,项目名称:esxi_hosts_list,代码行数:31,代码来源:get_vmware_list.php

示例15: snmp2_set

        snmp2_set($device_IP, "private", $fwRow2['fpgaVersionActive'], "i", "1");
    }
    //UpgradeInfo
    snmp2_set($device_IP, "private", $oid['tftpServerIp'], $type['tftpServerIp'], $_POST['tftpServerIp']);
    snmp2_set($device_IP, "private", $oid['softwareImageFilename'], $type['softwareImageFilename'], $_POST['softwareImageFilename']);
    snmp2_set($device_IP, "private", $oid['fpgaImageFilename'], $type['fpgaImageFilename'], $_POST['fpgaImageFilename']);
    snmp2_set($device_IP, "private", $oid['bootloaderImageFilename'], $type['bootloaderImageFilename'], $_POST['bootloaderImageFilename']);
    // read
    $softwareVersionActive2 = substr(snmp2_get($device_IP, "public", $swRow2['softwareVersionActive']), 9);
    $softwareVersionActive1 = substr(snmp2_get($device_IP, "public", $swRow1['softwareVersionActive']), 9);
    $fpgaVersionActive2 = substr(snmp2_get($device_IP, "public", $fwRow2['fpgaVersionActive']), 9);
    $fpgaVersionActive1 = substr(snmp2_get($device_IP, "public", $fwRow1['fpgaVersionActive']), 9);
    $tftpServerIp = substr(snmp2_get($device_IP, "public", $oid['tftpServerIp']), 11);
    $softwareImageFilename = substr(snmp2_get($device_IP, "public", $oid['softwareImageFilename']), 9);
    $fpgaImageFilename = substr(snmp2_get($device_IP, "public", $oid['fpgaImageFilename']), 9);
    $bootloaderImageFilename = substr(snmp2_get($device_IP, "public", $oid['bootloaderImageFilename']), 9);
}
if (isset($_POST['startSoftwareUpgrade'])) {
    snmp2_set($device_IP, "private", $oid['tftpServerIp'], $type['tftpServerIp'], $_POST['tftpServerIp']);
    snmp2_set($device_IP, "private", $oid['softwareImageFilename'], $type['softwareImageFilename'], $_POST['softwareImageFilename']);
    snmp2_set($device_IP, "private", $oid['startSoftwareUpgrade'], $type['startSoftwareUpgrade'], '1');
    echo '<script type="text/javascript">alert("Please wait 1 minute and read from device again.")</script>';
}
if (isset($_POST['startFpgaUpgrade'])) {
    snmp2_set($device_IP, "private", $oid['tftpServerIp'], $type['tftpServerIp'], $_POST['tftpServerIp']);
    snmp2_set($device_IP, "private", $oid['fpgaImageFilename'], $type['fpgaImageFilename'], $_POST['fpgaImageFilename']);
    snmp2_set($device_IP, "private", $oid['startFpgaUpgrade'], $type['startFpgaUpgrade'], '1');
    echo '<script type="text/javascript">alert("Please wait 1 minute and read from device again.")</script>';
}
if (isset($_POST['startBootloaderDownload'])) {
    snmp2_set($device_IP, "private", $oid['tftpServerIp'], $type['tftpServerIp'], $_POST['tftpServerIp']);
开发者ID:gunawanwibisono,项目名称:WebInterface,代码行数:31,代码来源:images.php


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