<?php $locations = MonitisConf::$locations; $drives = array(); $serverId = $_GET['server_id']; $serverMonitors = new serverMonitors(); $serverInfo = $serverMonitors->getServerInfo($serverId); if (isset($_POST['action'])) { $action = $_POST['action']; $monitorId = isset($_POST['id']) ? (int) $_POST['id'] : 0; $monitorType = isset($_POST['type']) ? $_POST['type'] : ''; switch ($action) { case 'delete': switch ($monitorType) { case 'ping': $resp = MonitisApi::deleteExternal($monitorId); if ($resp['status'] == 'ok') { MonitisApp::addMessage('Uptime monitor successfully removed'); $serverInfo['ping'] = NULL; } else { MonitisApp::addError($resp['error']); } monitisSqlHelper::altQuery('DELETE FROM ' . MONITIS_EXTERNAL_TABLE . ' WHERE monitor_id=' . $monitorId); break; case 'cpu': case 'memory': case 'drive': $monitorTypeCodes = array('cpu' => 7, 'memory' => 3, 'drive' => 2); $resp = MonitisApi::deleteInternal($monitorId, $monitorTypeCodes[$monitorType]); if ($resp['status'] == 'ok') { MonitisApp::addMessage('Server/Device monitor successfully removed');
static function deleteExternalMonitor($monitor_id) { $resp = MonitisApi::deleteExternal($monitor_id); self::unlinkExternalMonitor($monitor_id); return $resp; }