Beispiel #1
0
             $pubKey = MonitisApi::monitorPublicKey(array('moduleType' => 'drive', 'monitorId' => $monitorId));
             $values = array('server_id' => $serverInfo['id'], "available" => MonitisConf::$settings['drive']['available'], 'agent_id' => $agentId, 'monitor_id' => (int) $_POST['id'], 'monitor_type' => 'drive', 'client_id' => MONITIS_CLIENT_ID, "publickey" => $pubKey);
             insert_query('mod_monitis_int_monitors', $values);
             MonitisApp::addMessage('Drive Monitor successfully updated');
             for ($i = 0; $i < count($serverInfo['agent']['drive']); $i++) {
                 if (isset($serverInfo['agent']['drive'][$i]['letter']) && $serverInfo['agent']['drive'][$i]['letter'] === $driveLetter) {
                     $serverInfo['agent']['drive'][$i] = $serverMonitors->getMonitor($monitorId, 'drive');
                 }
             }
         } else {
             MonitisApp::addError($resp['error']);
         }
     }
 } else {
     $params = array('agentkey' => $agentKey, 'driveLetter' => $driveLetter, 'freeLimit' => $freeLimit, 'name' => 'drive_' . $driveLetter . '@' . $serverInfo['hostname'], 'tag' => $serverInfo['hostname'] . '_whmcs');
     $resp = MonitisApi::addDriveMonitor($params);
     if ($resp) {
         if ($resp['status'] == 'ok') {
             $newID = $resp['data']['testId'];
             $pubKey = MonitisApi::monitorPublicKey(array('moduleType' => 'drive', 'monitorId' => $newID));
             $values = array('server_id' => $serverInfo['id'], 'available' => MonitisConf::$settings['drive']['available'], 'agent_id' => $agentId, 'monitor_id' => $newID, 'monitor_type' => 'drive', 'client_id' => MONITIS_CLIENT_ID, 'publickey' => $pubKey);
             insert_query('mod_monitis_int_monitors', $values);
             MonitisApp::addMessage('Drive Monitor successfully added');
             for ($i = 0; $i < count($serverInfo['agent']['drive']); $i++) {
                 if (isset($serverInfo['agent']['drive'][$i]['driveLetter']) && $serverInfo['agent']['drive'][$i]['driveLetter'] === $driveLetter) {
                     $serverInfo['agent']['drive'][$i] = $serverMonitors->getMonitor($resp['data']['testId'], 'drive');
                 }
             }
         } else {
             MonitisApp::addError($resp['error']);
         }