diff options
author | ivan <ivan> | 2000-12-03 20:25:20 +0000 |
---|---|---|
committer | ivan <ivan> | 2000-12-03 20:25:20 +0000 |
commit | b90f8cdac9371c219a72dda16f8deecc7c44fc28 (patch) | |
tree | 566f55939a488f29e5a79821aef6102669afe721 /htdocs/browse | |
parent | 3a95cc316da367ffd248ba29ac594f3efbc9db61 (diff) |
session monitor updates
Diffstat (limited to 'htdocs/browse')
-rwxr-xr-x | htdocs/browse/nas.cgi | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/htdocs/browse/nas.cgi b/htdocs/browse/nas.cgi index 2aafbc1fd..a65235b1e 100755 --- a/htdocs/browse/nas.cgi +++ b/htdocs/browse/nas.cgi @@ -33,10 +33,29 @@ foreach my $nas ( sort { $a->nasnum <=> $b->nasnum } qsearch( 'nas', {} ) ) { ; foreach my $port ( sort { $a->nasport <=> $b->nasport || $a->portnum <=> $b->portnum - } qsearch( 'port' ) ) { + } qsearch( 'port', { 'nasnum' => $nas->nasnum } ) ) { + my $session = $port->session; + my($user, $since, $pretty_since, $duration); + if ( ! $session ) { + $user = "(empty)"; + $since = 0; + $pretty_since = "(never)"; + $duration = ''; + } elsif ( $session->logout ) { + $user = "(empty)"; + $since = $session->logout; + } else { + my $svc_acct = $session->svc_acct; + $user = "<A HREF=\"$p/view/svc_acct.cgi?". $svc_acct->svcnum. "\">". + $svc_acct->username. "</A>"; + $since = $session->login; + } + $pretty_since = time2str("%c", $since) if $since; + $duration = pretty_interval( $now - $since ). " ago" + unless defined($duration); print "<TR><TD>". $port->nasport. "</TD><TD>". $port->portnum. "</TD><TD>". - $port->ip. "</TD><TD>". 'user'. "</TD><TD>". 'since'. "</TD><TD>". - 'duration'. "</TD></TR>" + $port->ip. "</TD><TD>$user</TD><TD>$pretty_since". + "</TD><TD>$duration</TD></TR>" ; } print "</TABLE><BR>"; |