Skip to content
Snippets Groups Projects
Commit bedd10dc authored by Georgi's avatar Georgi
Browse files

Added a method to the MarkController named dbstatus that returns the # of...

Added a method to the MarkController named dbstatus that returns the # of entries of rawdata and evidences in the DB to be displayed on the dashboard. Added a route to the json data retrieved from the database. Will later be updated with specific # of data generated per agent/client/server
parent 7781adb0
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,29 @@ class MarkController extends Controller
"sources" => $sources]);
}
public function dbStatus()
{
$db_status = $this->server()->status();
$summary = ["db.data.count" => $db_status["db.data.count"],
"db.data.size" => $db_status["db.data.size"],
"db.evidence.count" => $db_status["db.evidence.count"],
"db.evidence.size" => $db_status["db.evidence.size"]];
$now = \Carbon\Carbon::now();
$file_name = $now->toISOString() . "_db_status.json";
$headers = array(
"Content-type" => "text/json",
"Content-Disposition" => "attachment; filename=$file_name",
"Pragma" => "no-cache",
"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
"Expires" => "0"
);
$content = json_encode($summary);
return response($content, 200, $headers);
}
public function lastData()
{
return view("app.lastdata", ["data" => $this->server()->findLastData()]);
......
......@@ -31,6 +31,7 @@ Route::prefix('app')
->middleware('auth')
->group(function () {
Route::get('status', 'MarkController@status')->name('status');
Route::get('dbstatus', 'MarkController@dbStatus')->name('dbstatus');
Route::get('status/data', 'MarkController@lastData');
Route::get('status/evidences', 'MarkController@lastEvidences');
Route::get('pause', 'MarkController@pause')->name('pause');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment