Show node status with Hub Stats

This commit is contained in:
Deon George 2024-05-26 21:50:13 +10:00
parent b6639c7bfc
commit fe18968c57

View File

@ -76,9 +76,27 @@ class HubStats extends Dynamic
$output .= "| FTN | ECHO | NET |FILES| LAST SESSION | MODE |AUTOHLD|\r\n";
$output .= "+--------------+------+-----+-----+------------------+-------+-------+\r\n";
$havedown = FALSE;
$havehold = FALSE;
foreach($r->get() as $o) {
if ($o->uncollected_echomail > 10000)
$o->uncollected_echomail = 9999;
if ($o->uncollected_netmail > 10000)
$o->uncollected_netmail = 9999;
if ($o->uncollected_files > 10000)
$o->uncollected_files = 9999;
if ((! $havedown) && $o->is_down)
$havedown = TRUE;
if ((! $havehold) && $o->is_hold)
$havehold = TRUE;
$output .= sprintf($header,
$o->ftn4d,
sprintf('%s %s',$o->ftn4d,$o->is_down ? 'd' : ($o->is_hold ? 'h' : ' ')),
$o->uncollected_echomail ?? 0,
$o->uncollected_netmail ?? 0,
$o->uncollected_files ?? 0,
@ -89,6 +107,14 @@ class HubStats extends Dynamic
$output .= "+--------------+------+-----+-----+------------------+-------+-------+\r\n";
$output .= "\r\n";
if ($havehold)
$output .= "(h) Node is on HOLD status.\r\n";
if ($havedown)
$output .= "(d) Node is on DOWN status.\r\n";
return $output;
}