Ejemplo n.º 1
0
 public function getMonitor($monitorId, $type)
 {
     $resp = null;
     if ($monitorId && $monitorId > 0) {
         if ($type == 'cpu') {
             $resp = MonitisApi::getCPUMonitor($monitorId);
             $resp = $this->whmcsInfo($resp, $monitorId, 'internal');
         } elseif ($type == 'memory') {
             $resp = MonitisApi::getMemoryInfo($monitorId);
             $resp = $this->whmcsInfo($resp, $monitorId, 'internal');
         } elseif ($type == 'drive') {
             $resp = MonitisApi::getDriveInfo($monitorId);
             $resp = $this->whmcsInfo($resp, $monitorId, 'internal');
         } elseif ($type == 'ping' || $type == 'external') {
             $ping = MonitisApi::getExternalMonitorInfo($monitorId);
             $locs = array();
             $intervals = array();
             for ($i = 0; $i < count($ping['locations']); $i++) {
                 $locs[] = $ping['locations'][$i]['id'];
                 $intervals[] = $ping['locations'][$i]['checkInterval'];
             }
             $ping['locations'] = implode(',', $locs);
             $ping['intervals'] = implode(',', $intervals);
             $ping['id'] = $monitorId;
             $resp = $this->whmcsInfo($ping, $monitorId, 'external');
         }
     }
     return $resp;
 }