Exemple #1
0
function Set($ip, $ver, $cm, $oid, $f, $v, $t = 1000000, $r = 2)
{
    global $debug, $comms;
    if ($ver == 3 and $comms[$cm]['pprot']) {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpset -v3 -c{$cm} " . $comms[$cm]['aprot'] . "/" . $comms[$cm]['pprot'] . " {$ip} {$oid} {$f} {$v} ({$t} usec * {$r})</div>";
        }
        return snmp3_set($ip, $cm, 'authPriv', $comms[$cm]['aprot'], $comms[$cm]['apass'], $comms[$cm]['pprot'], $comms[$cm]['ppass'], ".{$oid}", $f, $v, $t);
    } elseif ($ver == 3 and $comms[$cm]['aprot']) {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpset -v3 -c{$cm} " . $comms[$cm]['aprot'] . " {$ip} {$oid} {$f} {$v} ({$t} usec * {$r})</div>";
        }
        return snmp3_set($ip, $cm, 'authNoPriv', $comms[$cm]['aprot'], $comms[$cm]['apass'], 'DES', '', ".{$oid}", $f, $v, $t);
    } elseif ($ver == 2) {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpset -v2c -c{$cm} {$ip} {$oid} {$f} {$v} ({$t} usec * {$r})</div>";
        }
        return snmp2_set($ip, $cm, ".{$oid}", $f, $v, $t);
    } elseif ($ver == 0) {
        if ($debug) {
            echo "<div class=\"textpad noti \">Skipping Non-SNMP Device</div>";
        }
        return 0;
    } else {
        if ($debug) {
            echo "<div class=\"textpad noti \">snmpset -v1 -c{$cm} {$ip} {$oid} {$f} {$v} ({$t} usec * {$r})</div>";
        }
        return snmpset($ip, $cm, ".{$oid}", $f, $v, $t);
    }
}
    $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';
    //  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);
}
//    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">
Exemple #3
0
    $txPowerState = substr(snmp2_get($device_IP, "public", $oid['txPowerState']), 9);
    $txPowerStateInitial = substr(snmp2_get($device_IP, "public", $oid['txPowerStateInitial']), 9);
}
//write
if (isset($_POST['write']) and $read == "read") {
    snmp2_set($device_IP, "private", $oid['txFrequency'], $type['txFrequency'], $_POST['txFrequency'] * 1000);
    snmp2_set($device_IP, "private", $oid['txPowerLevel'], $type['txPowerLevel'], $_POST['txPowerLevel'] * 10);
    if ($_POST['txPowerState'] == "1") {
        snmp2_set($device_IP, "private", $oid['txPowerState'], $type['txPowerState'], "1");
    } else {
        snmp2_set($device_IP, "private", $oid['txPowerState'], $type['txPowerState'], "0");
    }
    if ($_POST['txPowerStateInitial'] == "1") {
        snmp2_set($device_IP, "private", $oid['txPowerStateInitial'], $type['txPowerStateInitial'], "1");
    } else {
        snmp2_set($device_IP, "private", $oid['txPowerStateInitial'], $type['txPowerStateInitial'], "0");
    }
    //read
    $txFrequency = substr(snmp2_get($device_IP, "public", $oid['txFrequency']), 9) / 1000;
    $txPowerLevel = substr(snmp2_get($device_IP, "public", $oid['txPowerLevel']), 9) / 10;
    $txPowerState = substr(snmp2_get($device_IP, "public", $oid['txPowerState']), 9);
    $txPowerStateInitial = substr(snmp2_get($device_IP, "public", $oid['txPowerStateInitial']), 9);
}
?>
<!doctype html>

<html>

<head>
    <title>Ayecka Web Interface</title>
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon" />
//write
if (isset($_POST['write']) and $read == "read") {
    snmp2_set($device_IP, "private", $oid['egrDstEthAddress'], $type['egrDstEthAddress'], $_POST['egrDstEthAddress']);
    snmp2_set($device_IP, "private", $oid['egrSrcEthAddress'], $type['egrSrcEthAddress'], $_POST['egrSrcEthAddress']);
    snmp2_set($device_IP, "private", $oid['egrVlanSupport'], $type['egrVlanSupport'], $_POST['egrVlanSupport']);
    snmp2_set($device_IP, "private", $oid['egrVlanPcp'], $type['egrVlanPcp'], $_POST['egrVlanPcp']);
    snmp2_set($device_IP, "private", $oid['egrVlanVid'], $type['egrVlanVid'], $_POST['egrVlanVid']);
    snmp2_set($device_IP, "private", $oid['egrDscp'], $type['egrDscp'], $_POST['egrDscp']);
    snmp2_set($device_IP, "private", $oid['egrSrcIpAddress'], $type['egrSrcIpAddress'], $_POST['egrSrcIpAddress']);
    snmp2_set($device_IP, "private", $oid['egrDstIpAddress'], $type['egrDstIpAddress'], $_POST['egrDstIpAddress']);
    snmp2_set($device_IP, "private", $oid['egrDstUdpPort'], $type['egrDstUdpPort'], $_POST['egrDstUdpPort']);
    snmp2_set($device_IP, "private", $oid['egrTsoipNumber'], $type['egrTsoipNumber'], $_POST['egrTsoipNumber']);
    snmp2_set($device_IP, "private", $oid['egrTsoipTimeoutAwarenessEnable'], $type['egrTsoipTimeoutAwarenessEnable'], $_POST['egrTsoipTimeoutAwarenessEnable']);
    snmp2_set($device_IP, "private", $oid['egrTsoipMaxTimeout'], $type['egrTsoipMaxTimeout'], $_POST['egrTsoipMaxTimeout']);
    snmp2_set($device_IP, "private", $oid['egrModOutputEnabled'], $type['egrModOutputEnabled'], $_POST['egrModOutputEnabled']);
    snmp2_set($device_IP, "private", $oid['egrNetOutputEnabled'], $type['egrNetOutputEnabled'], $_POST['egrNetOutputEnabled']);
    //read
    $egrDstEthAddress = substr(snmp2_get($device_IP, "public", $oid['egrDstEthAddress']), 11);
    $egrSrcEthAddress = substr(snmp2_get($device_IP, "public", $oid['egrSrcEthAddress']), 11);
    $egrVlanSupport = substr(snmp2_get($device_IP, "public", $oid['egrVlanSupport']), 9);
    $egrVlanPcp = substr(snmp2_get($device_IP, "public", $oid['egrVlanPcp']), 9);
    $egrVlanVid = substr(snmp2_get($device_IP, "public", $oid['egrVlanVid']), 9);
    $egrDscp = substr(snmp2_get($device_IP, "public", $oid['egrDscp']), 9);
    $egrSrcIpAddress = substr(snmp2_get($device_IP, "public", $oid['egrSrcIpAddress']), 11);
    $egrDstIpAddress = substr(snmp2_get($device_IP, "public", $oid['egrDstIpAddress']), 11);
    $egrDstUdpPort = substr(snmp2_get($device_IP, "public", $oid['egrDstUdpPort']), 9);
    $egrTsoipNumber = substr(snmp2_get($device_IP, "public", $oid['egrTsoipNumber']), 9);
    $egrTsoipTimeoutAwarenessEnable = substr(snmp2_get($device_IP, "public", $oid['egrTsoipTimeoutAwarenessEnable']), 9);
    $egrTsoipMaxTimeout = substr(snmp2_get($device_IP, "public", $oid['egrTsoipMaxTimeout']), 9);
    $egrModOutputEnabled = substr(snmp2_get($device_IP, "public", $oid['egrModOutputEnabled']), 9);
    $egrNetOutputEnabled = substr(snmp2_get($device_IP, "public", $oid['egrNetOutputEnabled']), 9);
Exemple #5
0
        snmp2_set($device_IP, "private", $oid['profileName4'], $type['profileName4'], $_POST['profileName2']);
        snmp2_set($device_IP, "private", $oid['frequency4'], $type['frequency4'], $_POST['frequency2'] * 1000);
        snmp2_set($device_IP, "private", $oid['acquisitionBandwidth4'], $type['acquisitionBandwidth4'], $_POST['acquisitionBandwidth2'] * 1000);
        snmp2_set($device_IP, "private", $oid['symbolRate4'], $type['symbolRate4'], $_POST['symbolRate2'] * 1000);
        snmp2_set($device_IP, "private", $oid['goldCode4'], $type['goldCode4'], $_POST['goldCode2']);
        snmp2_set($device_IP, "private", $oid['isi4'], $type['isi4'], $_POST['isi2']);
        snmp2_set($device_IP, "private", $oid['lnbPower4'], $type['lnbPower4'], $_POST['lnbPower2']);
        if ($_POST['signal22KHz2'] == "1") {
            snmp2_set($device_IP, "private", $oid['signal22KHz4'], $type['signal22KHz4'], $_POST['signal22KHz2']);
        } else {
            snmp2_set($device_IP, "private", $oid['signal22KHz4'], $type['signal22KHz4'], "0");
        }
        if ($_POST['compensation2'] == "1") {
            snmp2_set($device_IP, "private", $oid['compensation4'], $type['compensation4'], $_POST['compensation2']);
        } else {
            snmp2_set($device_IP, "private", $oid['compensation4'], $type['compensation4'], "0");
        }
        rf2_conf1_read();
        rf2_conf2_read();
    }
}
?>

<!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">
Exemple #6
0
 protected function snmpset($oid, $value, $type = null, $version = null, $community = null)
 {
     if (!$version) {
         $version = $this->getAgentVersion();
     }
     if (!$community) {
         $community = $this->writeCommunity;
     }
     if (!$type) {
         list($oldValue, $oid, $type) = reset($this->getParsed($oid));
     }
     if (!($typeCode = $this->getTypeCode($type))) {
         $this->setError(self::ERROR_UNKNOWN_TYPE);
         return false;
     }
     switch ($version) {
         case 1:
             return @snmpset($this->host, $community, $oid, $typeCode, $value, $this->timeout * 1000000, $this->retries);
         case 2:
             return @snmp2_set($this->host, $community, $oid, $typeCode, $value, $this->timeout * 1000000, $this->retries);
         case 3:
             extract($this->version3);
             return @snmp3_set($this->host, $secName, $secLevel, $authProtocol, $authPassphrase, $privProtocol, $privPassphrase, $oid, $typeCode, $value, $this->timeout * 1000000, $this->retries);
         default:
             return false;
     }
 }
Exemple #7
0
    $_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';
    //
    $bucPowerState = substr(snmp2_get($device_IP, "public", $oid['bucPowerState']), 9);
    $buc10MHzOutput = substr(snmp2_get($device_IP, "public", $oid['buc10MHzOutput']), 9);
}
//write
if (isset($_POST['write']) and $read == "read") {
    snmp2_set($device_IP, "private", $oid['bucPowerState'], $type['bucPowerState'], $_POST['bucPowerState']);
    snmp2_set($device_IP, "private", $oid['buc10MHzOutput'], $type['buc10MHzOutput'], $_POST['buc10MHzOutput']);
    //Read
    $bucPowerState = substr(snmp2_get($device_IP, "public", $oid['bucPowerState']), 9);
    $buc10MHzOutput = substr(snmp2_get($device_IP, "public", $oid['buc10MHzOutput']), 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>-->
    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']);
    snmp2_set($device_IP, "private", $oid['bootloaderImageFilename'], $type['bootloaderImageFilename'], $_POST['bootloaderImageFilename']);
    snmp2_set($device_IP, "private", $oid['startBootloaderDownload'], $type['startBootloaderDownload'], '1');
    echo '<script type="text/javascript">alert("Please wait 1 minute and read from device again.")</script>';
}
if (isset($_POST['startBootloaderUpgrade'])) {
    snmp2_set($device_IP, "private", $oid['startBootloaderUpgrade'], $type['startBootloaderUpgrade'], '1');
    echo '<script type="text/javascript">alert("Please wait 1 minute and read from device again.")</script>';
}
?>

<!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>
Exemple #9
0
 /**
  * Change SNMP value
  * The "type" parameter must be one of the following, depending on the type of variable to set on the SNMP host:
  * i    INTEGER
  * u    unsigned INTEGER
  * t    TIMETICKS
  * a    IPADDRESS
  * o    OBJID
  * s    STRING
  * x    HEX STRING
  * d    DECIMAL STRING
  * n    NULLOBJ
  * b    BITS 
  * @param Host $host
  * @param string $object_id
  * @param string $type
  * @param mixed $value
  * @return bool
  * @throws Exception
  */
 public static function set($host, $object_id, $type, $value)
 {
     snmp_set_oid_output_format(self::$oid_format);
     $snmp = $host->snmpTemplate;
     if (is_null($type)) {
         throw new Exception('type not set');
     }
     if ($snmp instanceof SnmpTemplate) {
         switch ($snmp->version) {
             case "1":
                 $result = snmpset($host->ip, $snmp->community, $object_id, $type, $value, $snmp->timeout, $snmp->retries);
                 break;
             case "2":
             case "2c":
                 $result = snmp2_set($host->ip, $snmp->community, $object_id, $type, $value, $snmp->timeout, $snmp->retries);
                 break;
             case "3":
                 $result = snmp3_set($host->ip, $snmp->security_name, $snmp->security_level, $snmp->auth_protocol, $snmp->auth_passphrase, $snmp->priv_protocol, $snmp->priv_passphrase, $object_id, $type, $value, $snmp->timeout, $snmp->retries);
                 break;
             default:
                 throw new Exception('SNMP Template not implemented yet');
         }
     }
     return $result;
 }
        //if need to add 0
        $hex2 = strlen($hex2) < 2 ? "0" . $hex2 : $hex2;
        $hex3 = strlen($hex3) < 2 ? "0" . $hex3 : $hex3;
        $egrAsiDstEthAddress = "01 00 5E " . $hex1 . " " . $hex2 . " " . $hex3;
        snmp2_set($device_IP, "private", $oid['egrAsiDstEthAddress'], "x", $egrAsiDstEthAddress);
    } else {
        snmp2_set($device_IP, "private", $oid['egrAsiDstEthAddress'], "x", $_POST['egrAsiDstEthAddress']);
    }
    snmp2_set($device_IP, "private", $oid['egrAsiDstUdpPort'], $type['egrAsiDstUdpPort'], $_POST['egrAsiDstUdpPort']);
    snmp2_set($device_IP, "private", $oid['egrAsiDscp'], $type['egrAsiDscp'], $_POST['egrAsiDscp']);
    snmp2_set($device_IP, "private", $oid['egrAsiSrcIpAddress'], $type['egrAsiSrcIpAddress'], $_POST['egrAsiSrcIpAddress']);
    snmp2_set($device_IP, "private", $oid['egrAsiSrcEthAddress'], $type['egrAsiSrcEthAddress'], $_POST['egrAsiSrcEthAddress']);
    snmp2_set($device_IP, "private", $oid['egrAsiSrcUdpPort'], $type['egrAsiSrcUdpPort'], $_POST['egrAsiSrcUdpPort']);
    snmp2_set($device_IP, "private", $oid['egrAsiTSoIPContainerSize'], $type['egrAsiTSoIPContainerSize'], $_POST['egrAsiTSoIPContainerSize']);
    snmp2_set($device_IP, "private", $oid['egrAsiPcrAwareness'], $type['egrAsiPcrAwareness'], $_POST['egrAsiPcrAwareness']);
    snmp2_set($device_IP, "private", $oid['egrAsiMaxTimeout'], $type['egrAsiMaxTimeout'], $_POST['egrAsiMaxTimeout']);
    asi_read();
}
?>

<!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>
<?php

require_once dirname(__FILE__) . '/snmp_include.inc';
//EXPECTF format is quickprint OFF
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Check error handing\n";
echo "Nonexisting OID\n";
$z = snmp2_set($hostname, $communityWrite, '.1.3.6.777.888.999.444.0', 's', 'bbb', $timeout, $retries);
var_dump($z);
echo "Bogus OID\n";
$z = snmp2_set($hostname, $communityWrite, '.1.3.6...777.888.999.444.0', 's', 'bbb', $timeout, $retries);
var_dump($z);
echo "Checking working\n";
$oid1 = '.1.3.6.1.2.1.1.4.0';
$oldvalue1 = snmpget($hostname, $communityWrite, $oid1, $timeout, $retries);
$newvalue1 = $oldvalue1 . '0';
echo "Single OID\n";
$z = snmp2_set($hostname, $communityWrite, $oid1, 's', $newvalue1, $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $newvalue1);
$z = snmp2_set($hostname, $communityWrite, $oid1, 's', $oldvalue1, $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
echo "Multiple OID, single type in array, multiple value\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1, $oid2), array('s'), array($newvalue1, $newvalue2), $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
echo "Multiple OID & type, singe value in array\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1, $oid2), array('s', 's'), array($newvalue1), $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
echo "Multiple OID, 1st bogus, single type, multiple value\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1 . '44.55.66.77', $oid2), 's', array($newvalue1, $newvalue2), $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
echo "Multiple OID, 2nd bogus, single type, multiple value\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1, $oid2 . '44.55.66.77'), 's', array($newvalue1, $newvalue2), $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
echo "Multiple OID, single multiple type (1st bogus), multiple value\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1, $oid2), array('q', 's'), array($newvalue1, $newvalue2), $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
echo "Multiple OID, single multiple type (2nd bogus), multiple value\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1, $oid2), array('s', 'w'), array($newvalue1, $newvalue2), $timeout, $retries);
var_dump($z);
var_dump(snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1);
var_dump(snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2);
Exemple #13
0
    //
    $vrrpEnabled = substr(snmp2_get($device_IP, "public", $oid['vrrpEnabled']), 9);
    $vrrpIpAddress = substr(snmp2_get($device_IP, "public", $oid['vrrpIpAddress']), 11);
    $vrrpIpNetmask = substr(snmp2_get($device_IP, "public", $oid['vrrpIpNetmask']), 11);
    $vrrpVrid = substr(snmp2_get($device_IP, "public", $oid['vrrpVrid']), 9);
    $vrrpPriority = substr(snmp2_get($device_IP, "public", $oid['vrrpPriority']), 9);
    $vrrpAdvInterval = substr(snmp2_get($device_IP, "public", $oid['vrrpAdvInterval']), 9);
}
//    Write
if (isset($_POST['write']) and $read == "read") {
    snmp2_set($device_IP, "private", $oid['vrrpEnabled'], $type['vrrpEnabled'], $_POST['vrrpEnabled']);
    snmp2_set($device_IP, "private", $oid['vrrpIpAddress'], $type['vrrpIpAddress'], $_POST['vrrpIpAddress']);
    snmp2_set($device_IP, "private", $oid['vrrpIpNetmask'], $type['vrrpIpNetmask'], $_POST['vrrpIpNetmask']);
    snmp2_set($device_IP, "private", $oid['vrrpVrid'], $type['vrrpVrid'], $_POST['vrrpVrid']);
    snmp2_set($device_IP, "private", $oid['vrrpPriority'], $type['vrrpPriority'], $_POST['vrrpPriority']);
    snmp2_set($device_IP, "private", $oid['vrrpAdvInterval'], $type['vrrpAdvInterval'], $_POST['vrrpAdvInterval']);
    //read
    $vrrpEnabled = substr(snmp2_get($device_IP, "public", $oid['vrrpEnabled']), 9);
    $vrrpIpAddress = substr(snmp2_get($device_IP, "public", $oid['vrrpIpAddress']), 11);
    $vrrpIpNetmask = substr(snmp2_get($device_IP, "public", $oid['vrrpIpNetmask']), 11);
    $vrrpVrid = substr(snmp2_get($device_IP, "public", $oid['vrrpVrid']), 9);
    $vrrpPriority = substr(snmp2_get($device_IP, "public", $oid['vrrpPriority']), 9);
    $vrrpAdvInterval = substr(snmp2_get($device_IP, "public", $oid['vrrpAdvInterval']), 9);
}
?>

<!doctype html>

<html>

<head>
    if ($_POST['lanDhcpClient'] == "1") {
        //selected
        snmp2_set($device_IP, "private", $oid['lanDhcpClient'], $type['lanDhcpClient'], '1');
    } else {
        //not selected
        snmp2_set($device_IP, "private", $oid['lanDhcpClient'], $type['lanDhcpClient'], '0');
    }
    snmp2_set($device_IP, "private", $oid['lanIpAddress'], $type['lanIpAddress'], $_POST['lanIpAddress']);
    snmp2_set($device_IP, "private", $oid['lanSubnetMask'], $type['lanSubnetMask'], $_POST['lanSubnetMask']);
    snmp2_set($device_IP, "private", $oid['routerIpAddress'], $type['routerIpAddress'], $_POST['routerIpAddress']);
    if ($_POST['lanMulticastMode'] == "0") {
        //selected
        snmp2_set($device_IP, "private", $oid['lanMulticastMode'], $type['lanMulticastMode'], '0');
    } else {
        //not selected
        snmp2_set($device_IP, "private", $oid['lanMulticastMode'], $type['lanMulticastMode'], '1');
    }
    //read
    $lanIpAddress = substr(snmp2_get($device_IP, "public", $oid['lanIpAddress']), 11);
    $lanSubnetMask = substr(snmp2_get($device_IP, "public", $oid['lanSubnetMask']), 11);
    $lanMacAddress = substr(snmp2_get($device_IP, "public", $oid['lanMacAddress']), 11);
    $lanMulticastMode = substr(snmp2_get($device_IP, "public", $oid['lanMulticastMode']), 9);
    $routerIpAddress = substr(snmp2_get($device_IP, "public", $oid['routerIpAddress']), 11);
    $lanDhcpClient = substr(snmp2_get($device_IP, "public", $oid['lanDhcpClient']), 9);
}
?>

<!doctype html>

<html>
    //ARP
    snmp2_set($device_IP, "private", $oid['routerArpMode'], $type['routerArpMode'], $_POST['routerArpMode']);
    snmp2_set($device_IP, "private", $oid['routerArpPeriod'], $type['routerArpPeriod'], $_POST['routerArpPeriod'] * 1000);
    snmp2_set($device_IP, "private", $oid['routerArpTimeout'], $type['routerArpTimeout'], $_POST['routerArpTimeout'] * 1000);
    snmp2_set($device_IP, "private", $oid['arpTableIpAddress'], $type['arpTableIpAddress'], $_POST['arpTableIpAddress']);
    snmp2_set($device_IP, "private", $oid['arpTableIpNetmask'], $type['arpTableIpNetmask'], $_POST['arpTableIpNetmask']);
    snmp2_set($device_IP, "private", $oid['routerMacAddress'], $type['routerMacAddress'], $_POST['routerMacAddress']);
    //read
    $routerArpMode = substr(snmp2_get($device_IP, "public", $oid['routerArpMode']), 9);
    $routerArpPeriod = substr(snmp2_get($device_IP, "public", $oid['routerArpPeriod']), 9) / 1000;
    $routerArpTimeout = substr(snmp2_get($device_IP, "public", $oid['routerArpTimeout']), 9) / 1000;
    $arpTableIpAddress = substr(snmp2_get($device_IP, "public", $oid['arpTableIpAddress']), 11);
    $arpTableIpNetmask = substr(snmp2_get($device_IP, "public", $oid['arpTableIpNetmask']), 11);
    $routerMacAddress = substr(snmp2_get($device_IP, "public", $oid['routerMacAddress']), 11);
    //AIR
    snmp2_set($device_IP, "private", $oid['airIpAddress'], $type['airIpAddress'], $_POST['airIpAddress']);
    //read
    $airIpAddress = substr(snmp2_get($device_IP, "public", $oid['airIpAddress']), 11);
}
?>

<!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>-->
        $statusName = "status" . $i;
        $multicastName = "multicast" . $i;
        $pid = $_POST[$pidName];
        $status = $_POST[$statusName];
        $multicast = $_POST[$multicastName];
        $selectTable = $_POST['selectTable'];
        //        snmp2_set($device_IP,"private",oid,type,value);
        $c = 2;
        $oid = "1.3.6.1.4.1.27928.101.1." . $selectTable . ".4.3.1." . $c . ".{$i}";
        snmp2_set($device_IP, "private", $oid, "i", $pid);
        $c = 8;
        $oid = "1.3.6.1.4.1.27928.101.1." . $selectTable . ".4.3.1." . $c . ".{$i}";
        snmp2_set($device_IP, "private", $oid, "i", $status);
        $c = 10;
        $oid = "1.3.6.1.4.1.27928.101.1." . $selectTable . ".4.3.1." . $c . ".{$i}";
        snmp2_set($device_IP, "private", $oid, "i", $multicast);
    }
}
?>
<!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">
    $snmpWriteCommunity = substr(snmp2_get($device_IP, "public", $oid['snmpWriteCommunity']), 9);
    $snmpReadCommunity = substr(snmp2_get($device_IP, "public", $oid['snmpReadCommunity']), 9);
    $ntpServerIpAddress = substr(snmp2_get($device_IP, "public", $oid['ntpServerIpAddress']), 11);
    $snmpTrapServerIpAddress = substr(snmp2_get($device_IP, "public", $oid['snmpTrapServerIpAddress']), 11);
    //telnet
    $username = substr(snmp2_get($device_IP, "public", $oid['username']), 9);
    $telnetTimeout = substr(snmp2_get($device_IP, "public", $oid['telnetTimeout']), 9);
}
//Reset
if (isset($_POST['coldReset'])) {
    echo '<script type="text/javascript">alert("Please wait 1 minute and read from device again.")</script>';
    snmp2_set($device_IP, "private", $oid['coldReset'], $type['coldReset'], "1");
}
if (isset($_POST['warmReset'])) {
    echo '<script type="text/javascript">alert("Please wait 1 minute and read from device again.")</script>';
    snmp2_set($device_IP, "private", $oid['warmReset'], $type['warmReset'], '1');
}
?>
<!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 {
    } else {
        //not selected
        snmp2_set($device_IP, "private", $oid['lanMulticastMode'], $type['lanMulticastMode'], '1');
    }
    //read
    $lanIpAddress = substr(snmp2_get($device_IP, "public", $oid['lanIpAddress']), 11);
    $lanSubnetMask = substr(snmp2_get($device_IP, "public", $oid['lanSubnetMask']), 11);
    $lanMacAddress = substr(snmp2_get($device_IP, "public", $oid['lanMacAddress']), 11);
    $lanMulticastMode = substr(snmp2_get($device_IP, "public", $oid['lanMulticastMode']), 9);
    $routerIpAddress = substr(snmp2_get($device_IP, "public", $oid['routerIpAddress']), 11);
    $lanDhcpClient = substr(snmp2_get($device_IP, "public", $oid['lanDhcpClient']), 9);
    //ARP
    snmp2_set($device_IP, "private", $oid['routerArpMode'], $type['routerArpMode'], $_POST['routerArpMode']);
    snmp2_set($device_IP, "private", $oid['routerArpPeriod'], $type['routerArpPeriod'], $_POST['routerArpPeriod'] * 1000);
    snmp2_set($device_IP, "private", $oid['routerArpTimeout'], $type['routerArpTimeout'], $_POST['routerArpTimeout'] * 1000);
    snmp2_set($device_IP, "private", $oid['routerMacAddress'], $type['routerMacAddress'], $_POST['routerMacAddress']);
    //read
    $routerArpMode = substr(snmp2_get($device_IP, "public", $oid['routerArpMode']), 9);
    $routerArpPeriod = substr(snmp2_get($device_IP, "public", $oid['routerArpPeriod']), 9) / 1000;
    $routerArpTimeout = substr(snmp2_get($device_IP, "public", $oid['routerArpTimeout']), 9) / 1000;
    $routerMacAddress = substr(snmp2_get($device_IP, "public", $oid['routerMacAddress']), 11);
}
?>

<!doctype html>

<html>

<head>
    <title>Ayecka Web Interface</title>
    <link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon" />
Exemple #19
0
 /**
  * Executes native SNMP set interface
  * 
  * @param string $ip
  * @param string $community
  * @param array  $data
  * @return string
  */
 protected function snmpSetNative($ip, $community, $data)
 {
     $result = '';
     if (!empty($data)) {
         if (is_array($data)) {
             foreach ($data as $io => $each) {
                 if (isset($each['oid']) and (isset($each['type']) and isset($each['value']))) {
                     @($pushResult = snmp2_set($ip, $community, $each['oid'], $each['type'], $each['value'], $this->timeoutNative, $this->retriesNative));
                     if ($pushResult) {
                         $result .= trim($this->snmpWalkNative($ip, $community, $each['oid'], false)) . "\n";
                     }
                 } else {
                     throw new Exception(self::EX_WRONG_DATA);
                 }
             }
         } else {
             throw new Exception(self::EX_WRONG_DATA);
         }
     }
     return $result;
 }
Exemple #20
0
 function snmpset($oid, $type, $value)
 {
     return snmp2_set($this->hostname, $this->snmpsetup['community'], $oid, $type, $value);
 }
    $modPowerState = substr(snmp2_get($device_IP, "public", $oid['modPowerState']), 9);
    $modSpectrumInversion = substr(snmp2_get($device_IP, "public", $oid['modSpectrumInversion']), 9);
    $modCarrierAtOutput = substr(snmp2_get($device_IP, "public", $oid['modCarrierAtOutput']), 9);
}
//write
if (isset($_POST['write']) and $read == "read") {
    snmp2_set($device_IP, "private", $oid['modSymbolRate'], $type['modSymbolRate'], $_POST['modSymbolRate']);
    snmp2_set($device_IP, "private", $oid['modModcod'], $type['modModcod'], $_POST['modModcod']);
    snmp2_set($device_IP, "private", $oid['modPilots'], $type['modPilots'], $_POST['modPilots']);
    snmp2_set($device_IP, "private", $oid['modFrameType'], $type['modFrameType'], $_POST['modFrameType']);
    snmp2_set($device_IP, "private", $oid['modRollOff'], $type['modRollOff'], $_POST['modRollOff']);
    snmp2_set($device_IP, "private", $oid['modDvbs2Profile'], $type['modDvbs2Profile'], $_POST['modDvbs2Profile']);
    snmp2_set($device_IP, "private", $oid['modScramblerSeed'], $type['modScramblerSeed'], $_POST['modScramblerSeed']);
    snmp2_set($device_IP, "private", $oid['modPowerState'], $type['modPowerState'], $_POST['modPowerState']);
    snmp2_set($device_IP, "private", $oid['modSpectrumInversion'], $type['modSpectrumInversion'], $_POST['modSpectrumInversion']);
    snmp2_set($device_IP, "private", $oid['modCarrierAtOutput'], $type['modCarrierAtOutput'], $_POST['modCarrierAtOutput']);
    //Read
    $modSymbolRate = substr(snmp2_get($device_IP, "public", $oid['modSymbolRate']), 9);
    $modModcod = substr(snmp2_get($device_IP, "public", $oid['modModcod']), 9);
    $modPilots = substr(snmp2_get($device_IP, "public", $oid['modPilots']), 9);
    $modFrameType = substr(snmp2_get($device_IP, "public", $oid['modFrameType']), 9);
    $modRollOff = substr(snmp2_get($device_IP, "public", $oid['modRollOff']), 9);
    $modDvbs2Profile = substr(snmp2_get($device_IP, "public", $oid['modDvbs2Profile']), 9);
    $modScramblerSeed = substr(snmp2_get($device_IP, "public", $oid['modScramblerSeed']), 9);
    $modPowerState = substr(snmp2_get($device_IP, "public", $oid['modPowerState']), 9);
    $modSpectrumInversion = substr(snmp2_get($device_IP, "public", $oid['modSpectrumInversion']), 9);
    $modCarrierAtOutput = substr(snmp2_get($device_IP, "public", $oid['modCarrierAtOutput']), 9);
}
?>

<!doctype html>