예제 #1
0
 /**
  * Loads the ticket creation page.
  * 
  * @param unsigned integer $id
  * @return string
  */
 public function create($id)
 {
     $server_check_result = ServerCheckResult::find($id);
     $server = Server::find($server_check_result->server->id);
     $service = $server->service();
     $client = $service->client;
     return view('ticket.create', ['client' => $client, 'service' => $service, 'server' => $server, 'server_check_result' => $server_check_result, 'ticket_categories' => TicketCategory::lists('name', 'id'), 'ticket_priorities' => TicketPriority::lists('name', 'id'), 'ticket_priority' => $server_check_result->checkResult->alert->id === 'R' ? 2 : 3, 'ticket_types' => TicketType::lists('name', 'id'), 'reference' => $server->id . $server_check_result->check_result_id . date('YmdHis', strtotime($server_check_result->raised_at))]);
 }
예제 #2
0
 /**
  * Loads the server status page.
  * 
  * @param unsigned integer $id
  * @return string
  */
 public function server($id = NULL)
 {
     if (is_null($id)) {
         return redirect('status');
     }
     $server = Server::find($id);
     $service = $server->service();
     $client = $service->client;
     $checks = $server->latestServerCheckResults();
     $check_categories = CheckCategory::all();
     return view('status.server', compact('client', 'service', 'server', 'checks', 'check_categories'));
 }
예제 #3
0
 /**
  * Load the main report page.
  * 
  * @return string
  */
 public function index()
 {
     $fields = $this->_captureReportFields();
     $report_levels = ReportLevel::orderBy('id')->lists('name', 'id')->all();
     $report_types = ReportType::orderBy('id')->lists('name', 'id')->all();
     switch ($fields['report_level_id']) {
         case ReportLevel::SERVER_LEVEL:
             $items = Server::orderBy('name')->lists('name', 'id')->all();
             break;
         case ReportLevel::SITE_LEVEL:
             $items = Site::orderBy('name')->lists('name', 'id')->all();
             break;
         case ReportLevel::SERVICE_LEVEL:
             $items = Service::orderBy('name')->lists('name', 'id')->all();
             break;
         case ReportLevel::CLIENT_LEVEL:
         default:
             $items = Client::orderBy('name')->lists('name', 'id')->all();
             break;
     }
     return view('report.form', compact('fields', 'report_levels', 'report_types', 'items'));
 }
예제 #4
0
 /**
  * Randomly creates server check results for test purposes.
  * 
  * @param type $healthchecks
  * @return void
  */
 public function run($healthchecks = 1000)
 {
     ServerCheckResult::truncate();
     $faker = \Faker\Factory::create();
     $servers = Server::lists('id')->all();
     $check_results = CheckResult::lists('id')->all();
     for ($i = 0; $i < $healthchecks; $i++) {
         $check_result = $faker->randomElement($check_results);
         $date = date("H-m-d H:i:s");
         DB::unprepared("CALL sp_new_server_check_result('" . "{$faker->randomElement($servers)}', " . "'{$check_result}', " . "'{$date}')");
         sleep(1);
     }
 }