Improvements to finding idle nodes, last_session actually only shows the last time the remote polled us
This commit is contained in:
parent
832b496b0b
commit
4501443a43
@ -100,7 +100,7 @@ class HubStats extends Dynamic
|
|||||||
$o->uncollected_echomail ?? 0,
|
$o->uncollected_echomail ?? 0,
|
||||||
$o->uncollected_netmail ?? 0,
|
$o->uncollected_netmail ?? 0,
|
||||||
$o->uncollected_files ?? 0,
|
$o->uncollected_files ?? 0,
|
||||||
$o->system->last_session?->format('Y-m-d H:i'),
|
$o->system->last_seen?->format('Y-m-d H:i') ?: '-',
|
||||||
is_null($o->system->pollmode) ? 'HOLD' : ($o->system->pollmode ? 'CRASH' : 'DAILY'),
|
is_null($o->system->pollmode) ? 'HOLD' : ($o->system->pollmode ? 'CRASH' : 'DAILY'),
|
||||||
$o->system->autohold ? 'YES' : 'NO');
|
$o->system->autohold ? 'YES' : 'NO');
|
||||||
}
|
}
|
||||||
|
@ -733,6 +733,7 @@ final class Binkp extends BaseProtocol
|
|||||||
Log::info(sprintf('%s:- Got AKA [%s]',self::LOGKEY,$rem_aka));
|
Log::info(sprintf('%s:- Got AKA [%s]',self::LOGKEY,$rem_aka));
|
||||||
|
|
||||||
// We'll update this address status
|
// We'll update this address status
|
||||||
|
// @todo this shouldnt be here, since we havent authenticated the node
|
||||||
$o->validated = TRUE;
|
$o->validated = TRUE;
|
||||||
$o->role &= ~(Address::NODE_HOLD|Address::NODE_DOWN);
|
$o->role &= ~(Address::NODE_HOLD|Address::NODE_DOWN);
|
||||||
$o->save();
|
$o->save();
|
||||||
@ -1278,9 +1279,13 @@ final class Binkp extends BaseProtocol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->optionGet(self::O_PWD))
|
if ($this->optionGet(self::O_PWD)) {
|
||||||
Log::info(sprintf('%s:- SECURE',self::LOGKEY));
|
Log::info(sprintf('%s:- SECURE',self::LOGKEY));
|
||||||
|
|
||||||
|
// @todo Since we have connected, if the node was marked down/hold reset that
|
||||||
|
// Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||||
|
}
|
||||||
|
|
||||||
return $this->binkp_hsdone();
|
return $this->binkp_hsdone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1376,6 +1381,9 @@ final class Binkp extends BaseProtocol
|
|||||||
if ($this->node->aka_authed) {
|
if ($this->node->aka_authed) {
|
||||||
$this->msgs(self::BPM_OK,sprintf('%ssecure',$have_pwd ? '' : 'non-'));
|
$this->msgs(self::BPM_OK,sprintf('%ssecure',$have_pwd ? '' : 'non-'));
|
||||||
|
|
||||||
|
// @todo Since we have connected, if the node was marked down/hold reset that
|
||||||
|
// Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->msgs(self::OK,'non-secure');
|
$this->msgs(self::OK,'non-secure');
|
||||||
}
|
}
|
||||||
|
@ -1061,6 +1061,9 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
|||||||
return (self::S_REDIAL|self::S_ADDTRY);
|
return (self::S_REDIAL|self::S_ADDTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @todo Since we have connected, if the node was marked down/hold reset that
|
||||||
|
// Notification::route('netmail',$ao->system->uncommon()->first()->withoutRelations())->notify(new NodeMarkedDownNetmail($ao->withoutRelations()));
|
||||||
|
|
||||||
// @todo Lock Node AKAs
|
// @todo Lock Node AKAs
|
||||||
|
|
||||||
Log::info(sprintf('%s:- We have [%lu%s] mail, [%lu%s] files',self::LOGKEY,$this->send->mail_size,'b',$this->send->files_size,'b'));
|
Log::info(sprintf('%s:- We have [%lu%s] mail, [%lu%s] files',self::LOGKEY,$this->send->mail_size,'b',$this->send->files_size,'b'));
|
||||||
|
@ -51,7 +51,7 @@ class AddressIdle implements ShouldQueue
|
|||||||
// Delist DOWN nodes
|
// Delist DOWN nodes
|
||||||
foreach ($this->old($this->do,config('fido.idle.delist'),Address::NODE_DOWN,$this->ao) as $ao) {
|
foreach ($this->old($this->do,config('fido.idle.delist'),Address::NODE_DOWN,$this->ao) as $ao) {
|
||||||
// Only delist system that has been marked down
|
// Only delist system that has been marked down
|
||||||
// Only mark delist them if its been 14 days since they were marked DOWN
|
// Only delist them if its been 14 days since they were marked DOWN
|
||||||
if ((! $ao->is_down) || ($ao->updated_at->greaterThan(Carbon::now()->subWeeks(2))))
|
if ((! $ao->is_down) || ($ao->updated_at->greaterThan(Carbon::now()->subWeeks(2))))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -106,6 +106,11 @@ class AddressIdle implements ShouldQueue
|
|||||||
|
|
||||||
// Mark nodes DOWN
|
// Mark nodes DOWN
|
||||||
foreach ($this->old($this->do,config('fido.idle.down'),Address::NODE_HOLD,$this->ao) as $ao) {
|
foreach ($this->old($this->do,config('fido.idle.down'),Address::NODE_HOLD,$this->ao) as $ao) {
|
||||||
|
// Only mark down system that has been marked down
|
||||||
|
// Only mark down them if its been 14 days since they were marked HOLD
|
||||||
|
if ((! $ao->is_hold) || ($ao->updated_at->greaterThan(Carbon::now()->subWeeks(2))))
|
||||||
|
continue;
|
||||||
|
|
||||||
Log::info(sprintf('%s:- Marking [%s] as DOWN, not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.down')));
|
Log::info(sprintf('%s:- Marking [%s] as DOWN, not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.down')));
|
||||||
$contact = FALSE;
|
$contact = FALSE;
|
||||||
|
|
||||||
|
@ -60,15 +60,15 @@ class SystemHeartbeat #implements ShouldQueue
|
|||||||
// If we havent polled in heatbeat hours, poll system
|
// If we havent polled in heatbeat hours, poll system
|
||||||
foreach ($l as $oo) {
|
foreach ($l as $oo) {
|
||||||
if (Job::where('queue','poll')->get()->pluck('command.address.id')->search($oo->id) === FALSE) {
|
if (Job::where('queue','poll')->get()->pluck('command.address.id')->search($oo->id) === FALSE) {
|
||||||
if ((! $oo->system->last_session)
|
if ((! $oo->system->last_seen)
|
||||||
|| ($oo->system->hearbeat && ($oo->system->last_session->addHours($oo->system->heartbeat) < Carbon::now()))
|
|| ($oo->system->hearbeat && ($oo->system->last_seen->addHours($oo->system->heartbeat) < Carbon::now()))
|
||||||
|| ((! $oo->system->hearbeat) && ($oo->role_id < Address::NODE_NN) && ($oo->system->last_session->addHours(6) < Carbon::now())))
|
|| ((! $oo->system->hearbeat) && ($oo->role_id < Address::NODE_NN) && ($oo->system->last_seen->addHours(6) < Carbon::now())))
|
||||||
{
|
{
|
||||||
Log::info(sprintf('%s:- Polling [%s] (%s) - we havent seen them since [%s], heartbeat [%d]',
|
Log::info(sprintf('%s:- Polling [%s] (%s) - we havent seen them since [%s], heartbeat [%d]',
|
||||||
self::LOGKEY,
|
self::LOGKEY,
|
||||||
$oo->ftn,
|
$oo->ftn,
|
||||||
$oo->system->name,
|
$oo->system->name,
|
||||||
$oo->system->last_session ?: 'Never',
|
$oo->system->last_seen ?: 'Never',
|
||||||
$oo->system->heartbeat,
|
$oo->system->heartbeat,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class SystemHeartbeat #implements ShouldQueue
|
|||||||
Log::debug(sprintf('%s:= Not scheduling poll to [%s], we saw them [%s], heartbeat [%d]',
|
Log::debug(sprintf('%s:= Not scheduling poll to [%s], we saw them [%s], heartbeat [%d]',
|
||||||
self::LOGKEY,
|
self::LOGKEY,
|
||||||
$oo->ftn,
|
$oo->ftn,
|
||||||
$oo->system->last_session,
|
$oo->system->last_seen,
|
||||||
$oo->system->heartbeat
|
$oo->system->heartbeat
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@ -181,6 +182,11 @@ class System extends Model
|
|||||||
return $val ?: Setup::findOrFail(config('app.id'))->msgs_pkt;
|
return $val ?: Setup::findOrFail(config('app.id'))->msgs_pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLastSeenAttribute(): ?Carbon
|
||||||
|
{
|
||||||
|
return $this->logs_recent->first()?->created_at;
|
||||||
|
}
|
||||||
|
|
||||||
/* METHODS */
|
/* METHODS */
|
||||||
|
|
||||||
public function echoareas()
|
public function echoareas()
|
||||||
@ -289,7 +295,7 @@ class System extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return other addresses that are no collected here, but are on the same network as us.
|
* Return other addresses that are not collected here, but are on the same network as us.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Database\Eloquent\Collection
|
* @return \Illuminate\Database\Eloquent\Collection
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
@ -298,6 +304,7 @@ class System extends Model
|
|||||||
{
|
{
|
||||||
$our = our_address();
|
$our = our_address();
|
||||||
|
|
||||||
return $this->akas->filter(fn($item)=>($item->parent() && (! $our->contains($item->parent()))));
|
return $this->akas
|
||||||
|
->filter(fn($item)=>(($x=$item->parent()) && (! $our->contains($x)) && ($our->pluck('zone.domain_id')->contains($item->zone->domain_id))));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -62,7 +62,7 @@ class AbsentNodes extends Echomails
|
|||||||
$msg->addText("The following nodes have been marked HOLD:\r");
|
$msg->addText("The following nodes have been marked HOLD:\r");
|
||||||
|
|
||||||
foreach ($x as $ao)
|
foreach ($x as $ao)
|
||||||
$msg->addText(sprintf('* %s (%s), last seen %d days ago',$ao->ftn4d,$ao->system->name,$ao->system->last_session->diffInDays($now)).($ao->contacted ? '': ' ^')."\r");
|
$msg->addText(sprintf('* %s (%s), last seen %d days ago',$ao->ftn4d,$ao->system->name,$ao->system->last_seen?->diffInDays($now)).($ao->contacted ? '': ' ^')."\r");
|
||||||
|
|
||||||
$msg->addText("\r");
|
$msg->addText("\r");
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ class AbsentNodes extends Echomails
|
|||||||
$msg->addText("The following nodes have been marked DOWN:\r");
|
$msg->addText("The following nodes have been marked DOWN:\r");
|
||||||
|
|
||||||
foreach ($x as $ao)
|
foreach ($x as $ao)
|
||||||
$msg->addText(sprintf('* %s (%s), last seen %d days ago',$ao->ftn4d,$ao->system->name,$ao->system->last_session->diffInDays($now)).($ao->contacted ? '': ' ^')."\r");
|
$msg->addText(sprintf('* %s (%s), last seen %d days ago',$ao->ftn4d,$ao->system->name,$ao->system->last_seen?->diffInDays($now)).($ao->contacted ? '': ' ^')."\r");
|
||||||
|
|
||||||
$msg->addText("\r");
|
$msg->addText("\r");
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ class AbsentNodes extends Echomails
|
|||||||
$msg->addText("The following nodes have been DE-LISTED:\r");
|
$msg->addText("The following nodes have been DE-LISTED:\r");
|
||||||
|
|
||||||
foreach ($x as $ao)
|
foreach ($x as $ao)
|
||||||
$msg->addText(sprintf('* %s (%s), last seen %d days ago',$ao->ftn4d,$ao->system->name,$ao->system->last_session->diffInDays($now)).($ao->contacted ? '': ' ^')."\r");
|
$msg->addText(sprintf('* %s (%s), last seen %d days ago',$ao->ftn4d,$ao->system->name,$ao->system->last_seen?->diffInDays($now)).($ao->contacted ? '': ' ^')."\r");
|
||||||
|
|
||||||
$msg->addText("\r");
|
$msg->addText("\r");
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ class NodeDelisted extends Notification //implements ShouldQueue
|
|||||||
->line(sprintf('Your system has been DE-LISTED, because it hasnt polled **%s** with address %s since **%s** (%d days).',
|
->line(sprintf('Your system has been DE-LISTED, because it hasnt polled **%s** with address %s since **%s** (%d days).',
|
||||||
$x,
|
$x,
|
||||||
$this->ao->ftn4d,
|
$this->ao->ftn4d,
|
||||||
$this->ao->system->last_session->format('Y-m-d'),
|
$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',
|
||||||
$this->ao->system->last_session->diffInDays($now)))
|
$this->ao->system->last_seen?->diffInDays($now)))
|
||||||
->line('')
|
->line('')
|
||||||
->line('If you think this was a mistake, please let me know.')
|
->line('If you think this was a mistake, please let me know.')
|
||||||
->line(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
|
->line(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
|
||||||
|
@ -49,13 +49,13 @@ class NodeMarkedDown extends Notification //implements ShouldQueue
|
|||||||
->line(sprintf('Your system has been marked **DOWN**, because it hasnt polled **%s** with address %s since **%s** (%d days).',
|
->line(sprintf('Your system has been marked **DOWN**, because it hasnt polled **%s** with address %s since **%s** (%d days).',
|
||||||
$this->ao->zone->domain->name,
|
$this->ao->zone->domain->name,
|
||||||
$this->ao->ftn4d,
|
$this->ao->ftn4d,
|
||||||
$this->ao->system->last_session->format('Y-m-d'),
|
$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',
|
||||||
$this->ao->system->last_session->diffInDays($now)))
|
$this->ao->system->last_seen?->diffInDays($now)))
|
||||||
->line('')
|
->line('')
|
||||||
->line('You have (waiting for collection):')
|
->line('You have (waiting for collection):')
|
||||||
->lineIf($this->ao->uncollected_netmail,sprintf('* %s Netmails',number_format($this->ao->uncollected_netmail)))
|
->line(sprintf('* %s Netmails',number_format($this->ao->uncollected_netmail)))
|
||||||
->lineIf($this->ao->uncollected_echomail,sprintf('* %s Echomails',number_format($this->ao->uncollected_echomail)))
|
->line(sprintf('* %s Echomails',number_format($this->ao->uncollected_echomail)))
|
||||||
->lineIf($this->ao->uncollected_files,sprintf('* %s Files',number_format($this->ao->uncollected_files)))
|
->line(sprintf('* %s Files',number_format($this->ao->uncollected_files)))
|
||||||
->line('')
|
->line('')
|
||||||
->line(sprintf('Your system will automatically be **DE-LISTED** if your system hasnt polled to collected your mail/file(s) by **%s**',$now->addDays(7)->format('Y-m-d')))
|
->line(sprintf('Your system will automatically be **DE-LISTED** if your system hasnt polled to collected your mail/file(s) by **%s**',$now->addDays(7)->format('Y-m-d')))
|
||||||
->line('If you think you\'ve received this email by mistake or need help, please let me know.');
|
->line('If you think you\'ve received this email by mistake or need help, please let me know.');
|
||||||
|
@ -49,15 +49,15 @@ class NodeMarkedHold extends Notification //implements ShouldQueue
|
|||||||
->line(sprintf('Your system has been marked **HOLD**, because it hasnt polled **%s** with address %s since **%s** (%d days).',
|
->line(sprintf('Your system has been marked **HOLD**, because it hasnt polled **%s** with address %s since **%s** (%d days).',
|
||||||
$this->ao->zone->domain->name,
|
$this->ao->zone->domain->name,
|
||||||
$this->ao->ftn4d,
|
$this->ao->ftn4d,
|
||||||
$this->ao->system->last_session->format('Y-m-d'),
|
$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',
|
||||||
$this->ao->system->last_session->diffInDays($now)))
|
$this->ao->system->last_seen?->diffInDays($now)))
|
||||||
->line('')
|
->line('')
|
||||||
->line('You have (waiting for collection):')
|
->line('You have (waiting for collection):')
|
||||||
->lineIf($this->ao->uncollected_netmail,sprintf('* %s Netmails',number_format($this->ao->uncollected_netmail)))
|
->line(sprintf('* %s Netmails',number_format($this->ao->uncollected_netmail)))
|
||||||
->lineIf($this->ao->uncollected_echomail,sprintf('* %s Echomails',number_format($this->ao->uncollected_echomail)))
|
->line(sprintf('* %s Echomails',number_format($this->ao->uncollected_echomail)))
|
||||||
->lineIf($this->ao->uncollected_files,sprintf('* %s Files',number_format($this->ao->uncollected_files)))
|
->line(sprintf('* %s Files',number_format($this->ao->uncollected_files)))
|
||||||
->line('')
|
->line('')
|
||||||
->line(sprintf('To clear this status, all you need to do make sure your system polls and collects mail by **%s**',$this->ao->system->last_session->addDays(config('fido.idle.down'))->format('Y-m-d')))
|
->line(sprintf('To clear this status, all you need to do make sure your system polls and collects mail by **%s**',($this->ao->system->last_seen ?: Carbon::now())->addDays(config('fido.idle.down'))->format('Y-m-d')))
|
||||||
->line('If you think you\'ve received this email by mistake or need help, please let me know.');
|
->line('If you think you\'ve received this email by mistake or need help, please let me know.');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,7 +44,7 @@ class NodeDelisted extends Netmails //implements ShouldQueue
|
|||||||
$msg = $this->page(TRUE,'delist');
|
$msg = $this->page(TRUE,'delist');
|
||||||
|
|
||||||
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
||||||
->addText(sprintf("Your system has been marked **DE-LISTED**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
|
->addText(sprintf("Your system has been marked **DE-LISTED**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',$this->ao->system->last_seen?->diffInDays($now)))
|
||||||
->addText("\r")
|
->addText("\r")
|
||||||
->addText("If you think this was a mistake, please let me know.\r\r")
|
->addText("If you think this was a mistake, please let me know.\r\r")
|
||||||
->addText(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
|
->addText(sprintf('If you think about returning to %s, then reach out and we can get you back online pretty quickly.',$x));
|
||||||
|
@ -31,12 +31,11 @@ class NodeMarkedDown extends Netmails //implements ShouldQueue
|
|||||||
public function toNetmail(object $notifiable): Netmail
|
public function toNetmail(object $notifiable): Netmail
|
||||||
{
|
{
|
||||||
$now = Carbon::now();
|
$now = Carbon::now();
|
||||||
|
|
||||||
$o = $this->setupNetmail($notifiable);
|
|
||||||
$ao = $notifiable->routeNotificationFor(static::via);
|
$ao = $notifiable->routeNotificationFor(static::via);
|
||||||
|
|
||||||
Log::info(sprintf('%s:+ Sending a NODE MARKED DOWN NETMAIL for address [%s]',self::LOGKEY,$ao->ftn));
|
Log::info(sprintf('%s:+ Sending a NODE MARKED DOWN NETMAIL for address [%s]',self::LOGKEY,$ao->ftn));
|
||||||
|
|
||||||
|
$o = $this->setupNetmail($notifiable);
|
||||||
$o->subject = sprintf('ACTION REQUIRED: Your system will be delisted on %s',$now->format('Y-m-d'));
|
$o->subject = sprintf('ACTION REQUIRED: Your system will be delisted on %s',$now->format('Y-m-d'));
|
||||||
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
|
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ class NodeMarkedDown extends Netmails //implements ShouldQueue
|
|||||||
$msg = $this->page(TRUE,'down');
|
$msg = $this->page(TRUE,'down');
|
||||||
|
|
||||||
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
||||||
->addText(sprintf("Your system has been marked **DOWN**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
|
->addText(sprintf("Your system has been marked **DOWN**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',$this->ao->system->last_seen?->diffInDays($now)))
|
||||||
->addText("\r")
|
->addText("\r")
|
||||||
->addText("You have (waiting for collection):\r")
|
->addText("You have (waiting for collection):\r")
|
||||||
->addText(sprintf("* %s Netmails\r",number_format($this->ao->uncollected_netmail)))
|
->addText(sprintf("* %s Netmails\r",number_format($this->ao->uncollected_netmail)))
|
||||||
|
@ -44,14 +44,14 @@ class NodeMarkedHold extends Netmails //implements ShouldQueue
|
|||||||
$msg = $this->page(TRUE,'hold');
|
$msg = $this->page(TRUE,'hold');
|
||||||
|
|
||||||
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
||||||
->addText(sprintf("Your system has been marked **HOLD**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_session->format('Y-m-d'),$this->ao->system->last_session->diffInDays($now)))
|
->addText(sprintf("Your system has been marked **HOLD**, because it hasnt polled **%s** with address %s since **%s** (%d days).\r",$this->ao->zone->domain->name,$this->ao->ftn4d,$this->ao->system->last_seen?->format('Y-m-d') ?: 'Not seen',$this->ao->system->last_seen?->diffInDays($now)))
|
||||||
->addText("\r")
|
->addText("\r")
|
||||||
->addText("You have (waiting for collection):\r")
|
->addText("You have (waiting for collection):\r")
|
||||||
->addText(sprintf("* %s Netmails\r",number_format($this->ao->uncollected_netmail)))
|
->addText(sprintf("* %s Netmails\r",number_format($this->ao->uncollected_netmail)))
|
||||||
->addText(sprintf("* %s Echomails\r",number_format($this->ao->uncollected_echomail)))
|
->addText(sprintf("* %s Echomails\r",number_format($this->ao->uncollected_echomail)))
|
||||||
->addText(sprintf("* %s Files\r",number_format($this->ao->uncollected_files)))
|
->addText(sprintf("* %s Files\r",number_format($this->ao->uncollected_files)))
|
||||||
->addText("\r")
|
->addText("\r")
|
||||||
->addText(sprintf("To clear this status, all you need to do make sure your system polls and collects mail by **%s**\r\r",$this->ao->system->last_session->addDays(config('fido.idle.down'))->format('Y-m-d')))
|
->addText(sprintf("To clear this status, all you need to do make sure your system polls and collects mail by **%s**\r\r",($this->ao->system->last_seen ?: Carbon::now())->addDays(config('fido.idle.down'))->format('Y-m-d')))
|
||||||
->addText("If you think you've received this netmail by mistake or need help, please let me know.\r");
|
->addText("If you think you've received this netmail by mistake or need help, please let me know.\r");
|
||||||
|
|
||||||
$o->msg = $msg->render();
|
$o->msg = $msg->render();
|
||||||
|
55
app/Notifications/Netmails/NodeStatusCleared.php
Normal file
55
app/Notifications/Netmails/NodeStatusCleared.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications\Netmails;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
use App\Classes\FTN\Message;
|
||||||
|
use App\Notifications\Netmails;
|
||||||
|
use App\Models\{Address,Netmail};
|
||||||
|
use App\Traits\PageTemplate;
|
||||||
|
|
||||||
|
class NodeStatusCleared extends Netmails //implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Queueable,PageTemplate;
|
||||||
|
|
||||||
|
private const LOGKEY = 'NNM';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*/
|
||||||
|
public function __construct(private Address $ao)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*/
|
||||||
|
public function toNetmail(object $notifiable): Netmail
|
||||||
|
{
|
||||||
|
$ao = $notifiable->routeNotificationFor(static::via);
|
||||||
|
|
||||||
|
Log::info(sprintf('%s:+ Sending a NODE DOWN|HOLD STATUS CLEARED NETMAIL for address [%s]',self::LOGKEY,$ao->ftn));
|
||||||
|
|
||||||
|
$o = $this->setupNetmail($notifiable);
|
||||||
|
$o->subject = 'Your HOLD or DOWN status has been cleared';
|
||||||
|
$o->flags = (Message::FLAG_LOCAL|Message::FLAG_PRIVATE|Message::FLAG_CRASH);
|
||||||
|
|
||||||
|
// Message
|
||||||
|
$msg = $this->page(TRUE,'reset');
|
||||||
|
|
||||||
|
$msg->addText(sprintf("Hi %s,\r\r",$this->ao->system->sysop))
|
||||||
|
->addText(sprintf("Good news! Your system's HOLD or DOWN status has been **cleared** for address %s, as you recently polled the hub.\r",$this->ao->ftn4d))
|
||||||
|
->addText("\r")
|
||||||
|
->addText("If you think you've received this netmail by mistake or need help, please let me know.\r");
|
||||||
|
|
||||||
|
$o->msg = $msg->render();
|
||||||
|
$o->set_tagline = 'All good to go now';
|
||||||
|
|
||||||
|
$o->save();
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
@use(App\Models\Domain)
|
||||||
|
|
||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
@ -20,7 +22,7 @@
|
|||||||
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
|
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
|
||||||
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
|
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
|
||||||
<option value=""> </option>
|
<option value=""> </option>
|
||||||
@foreach (\App\Models\Domain::active()->orderBy('name')->cursor() as $oo)
|
@foreach (Domain::active()->orderBy('name')->cursor() as $oo)
|
||||||
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
|
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
@ -180,7 +182,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->is_hosted)<sup>{{ $ao->is_default ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
|
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->is_hosted)<sup>{{ $ao->is_default ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
|
||||||
<td>{{ $ao->ftn_3d }}</td>
|
<td>{{ $ao->ftn_3d }}</td>
|
||||||
<td>{{ $ao->system->last_session ? $ao->system->last_session->format('Y-m-d H:i') : '-' }}</td>
|
<td>{{ $ao->system->last_seen?->format('Y-m-d H:i') ?: '-' }}</td>
|
||||||
<td>{{ ($x=$o->waiting($ao))->count() ? $x->first()->datetime->format('Y-m-d H:i') : '-' }}</td>
|
<td>{{ ($x=$o->waiting($ao))->count() ? $x->first()->datetime->format('Y-m-d H:i') : '-' }}</td>
|
||||||
<td class="text-end">{{ number_format($x->count()) }}</td>
|
<td class="text-end">{{ number_format($x->count()) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
@use(App\Models\SystemLog)
|
||||||
|
@use(Carbon\Carbon)
|
||||||
|
|
||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
Stats
|
Stats
|
||||||
@ -119,7 +122,7 @@
|
|||||||
<div class="card-header p-2">
|
<div class="card-header p-2">
|
||||||
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-pc-display"></i> Systems
|
<span class="card-title w-100 text-dark" style="font-size: 125%;"><i class="bi bi-pc-display"></i> Systems
|
||||||
<button type="button" class="btn float-end me-0" style="background-color: black; color: white;">
|
<button type="button" class="btn float-end me-0" style="background-color: black; color: white;">
|
||||||
{{ number_format(\App\Models\System::where('last_session','>=',\Carbon\Carbon::now()->subWeek()->startOfDay())->count()) }}
|
{{ number_format(SystemLog::distinct('system_id')->where('created_at','>=',Carbon::now()->subWeek()->startOfDay())->count()) }}
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -188,7 +191,7 @@
|
|||||||
<td class="text-end">{{ number_format($o->uncollected_echomail ?? 0) }}</td>
|
<td class="text-end">{{ number_format($o->uncollected_echomail ?? 0) }}</td>
|
||||||
<td class="text-end">{{ number_format($o->uncollected_netmail ?? 0) }}</td>
|
<td class="text-end">{{ number_format($o->uncollected_netmail ?? 0) }}</td>
|
||||||
<td class="text-end">{{ number_format($o->uncollected_files ?? 0) }}</td>
|
<td class="text-end">{{ number_format($o->uncollected_files ?? 0) }}</td>
|
||||||
<td>{{ $o->system->last_session?->format('Y-m-d H:i') }}</td>
|
<td>{{ $o->system->last_seen?->format('Y-m-d H:i') }}</td>
|
||||||
<td>{{ is_null($o->system->pollmode) ? 'HOLD' : ($o->system->pollmode ? 'CRASH' : 'DAILY') }}</td>
|
<td>{{ is_null($o->system->pollmode) ? 'HOLD' : ($o->system->pollmode ? 'CRASH' : 'DAILY') }}</td>
|
||||||
<td>{{ $o->system->autohold ? 'YES' : 'NO' }}</td>
|
<td>{{ $o->system->autohold ? 'YES' : 'NO' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
@use(App\Models\SystemZone)
|
||||||
|
|
||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
Systems
|
Systems
|
||||||
@ -28,7 +30,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (\App\Models\SystemZone::select('*')->with(['system.addresses.zone.domain','zone.domain'])->get() as $oo)
|
@foreach (SystemZone::select('*')->with(['system.addresses.zone.domain','zone.domain','system.logs_recent'])->get() as $oo)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $oo->zone->domain->name }}</td>
|
<td>{{ $oo->zone->domain->name }}</td>
|
||||||
<td>
|
<td>
|
||||||
@ -40,7 +42,7 @@
|
|||||||
<td>{{ $oo->system->name }}</td>
|
<td>{{ $oo->system->name }}</td>
|
||||||
<td>{{ $oo->system->sysop }}</td>
|
<td>{{ $oo->system->sysop }}</td>
|
||||||
<td>{{ $oo->system->location }}</td>
|
<td>{{ $oo->system->location }}</td>
|
||||||
<td>{{ $oo->system->last_session ? $oo->system->last_session->format('Y-m-d H:i') : '-' }}</td>
|
<td>{{ $oo->system->last_seen?->format('Y-m-d H:i') ?: '-' }}</td>
|
||||||
<td>{{ $oo->system->akas->where('zone_id',$oo->zone_id)->pluck('ftn4d')->join(', ') }}</td>
|
<td>{{ $oo->system->akas->where('zone_id',$oo->zone_id)->pluck('ftn4d')->join(', ') }}</td>
|
||||||
<td>{{ $oo->system->zt_id }}</td>
|
<td>{{ $oo->system->zt_id }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user