Log systems polling
This commit is contained in:
parent
d5d4a0d781
commit
170f5c87ed
app
database/migrations
resources/views/system
@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log;
|
|||||||
use App\Classes\File\{Receive,Send};
|
use App\Classes\File\{Receive,Send};
|
||||||
use App\Classes\Sock\SocketClient;
|
use App\Classes\Sock\SocketClient;
|
||||||
use App\Classes\Sock\SocketException;
|
use App\Classes\Sock\SocketException;
|
||||||
use App\Models\{Address,Setup,System};
|
use App\Models\{Address,Setup,System,SystemLog};
|
||||||
|
|
||||||
abstract class Protocol
|
abstract class Protocol
|
||||||
{
|
{
|
||||||
@ -324,10 +324,19 @@ abstract class Protocol
|
|||||||
foreach ($this->node->aka_other as $aka) {
|
foreach ($this->node->aka_other as $aka) {
|
||||||
Address::findFTN($aka,TRUE,$so);
|
Address::findFTN($aka,TRUE,$so);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// @todo Log to history log in the DB.
|
// Log session in DB
|
||||||
//if ($this->node->start_time && $this->setup->cfg('CFG_HISTORY')) {}
|
$slo = new SystemLog;
|
||||||
|
$slo->items_sent = $this->send->total_sent;
|
||||||
|
$slo->items_sent_size = $this->send->total_sent_bytes;
|
||||||
|
$slo->items_recv = $this->recv->total_recv;
|
||||||
|
$slo->items_recv_size = $this->recv->total_recv_bytes;
|
||||||
|
$slo->sessiontype = $type;
|
||||||
|
$slo->sessiontime = $this->node->session_time;
|
||||||
|
$slo->result = ($rc & self::S_MASK);
|
||||||
|
|
||||||
|
$so->logs()->save($slo);
|
||||||
|
}
|
||||||
|
|
||||||
// @todo Optional after session execution event
|
// @todo Optional after session execution event
|
||||||
// if ($this->node->start_time && $this->setup->cfg('CFG_AFTERSESSION')) {}
|
// if ($this->node->start_time && $this->setup->cfg('CFG_AFTERSESSION')) {}
|
||||||
|
@ -39,6 +39,11 @@ class System extends Model
|
|||||||
->FTNorder();
|
->FTNorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(SystemLog::class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session Passwords for system
|
* Session Passwords for system
|
||||||
*
|
*
|
||||||
|
15
app/Models/SystemLog.php
Normal file
15
app/Models/SystemLog.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SystemLog extends Model
|
||||||
|
{
|
||||||
|
/* RELATIONS */
|
||||||
|
|
||||||
|
public function system()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(System::class);
|
||||||
|
}
|
||||||
|
}
|
44
database/migrations/2022_11_26_042014_sessionlog.php
Normal file
44
database/migrations/2022_11_26_042014_sessionlog.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('system_logs', function(Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->bigInteger('system_id');
|
||||||
|
$table->foreign('system_id')->references('id')->on('systems');
|
||||||
|
|
||||||
|
$table->integer('items_sent')->nullable();
|
||||||
|
$table->integer('items_sent_size')->nullable();
|
||||||
|
$table->integer('items_recv')->nullable();
|
||||||
|
$table->integer('items_recv_size')->nullable();
|
||||||
|
|
||||||
|
$table->integer('sessiontime');
|
||||||
|
$table->integer('sessiontype');
|
||||||
|
|
||||||
|
$table->integer('result');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('system_logs');
|
||||||
|
}
|
||||||
|
};
|
@ -31,6 +31,10 @@
|
|||||||
<th>Mailer</th>
|
<th>Mailer</th>
|
||||||
<td>{{ $o->access_mailer }}</td>
|
<td>{{ $o->access_mailer }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Last Seen</th>
|
||||||
|
<td>{{ $o->logs->last()->created_at }}</td>
|
||||||
|
</tr>
|
||||||
@if($o->phone)
|
@if($o->phone)
|
||||||
<tr>
|
<tr>
|
||||||
<th>Phone</th>
|
<th>Phone</th>
|
||||||
|
Loading…
Reference in New Issue
Block a user