示例#1
0
 public function setSNMPValue($oid, $type, $value)
 {
     return PNMSnmp::set($this, $oid, $type, $value);
 }
示例#2
0
 /**
  * change SNMP value of Host
  */
 public function actionSetSNMP()
 {
     try {
         $name = $_POST['name'];
         switch ($_POST['key']) {
             case "ifAlias":
                 $type = 's';
                 break;
             default:
                 $type = 'i';
         }
         $model = $this->loadModelByName($name);
         if ($model) {
             $key = PNMSnmp::getOid($_POST['key']);
             $index = (int) $_POST['index'];
             $value = $_POST['value'];
             $oid = $key . '.' . $index;
             $result = $model->setSNMPValue($oid, $type, $value);
         }
         $this->layout = '//layouts/json';
         $this->render('jsonSetStatus', array('result' => $result));
     } catch (Exception $exc) {
         $this->render('jsonError', array('error' => "actionSetSNMP error:" . $exc->getMessage()));
     }
 }