%
## Nasty-cheap authenticator.
if {[ns_conn authuser] != "nsadmin" || [ns_conn authpassword] != "x"} {
ns_returnunauthorized
ns_adp_break
}
## Expires: now
ns_set update [ns_conn outputheaders] "Expires" "now"
%>
AOLserver Telemetry
<%
## For Tcl procs: display proc body and immediately return.
if { [ns_queryget "tclproc"] != "" } {
set tclproc [ns_queryget tclproc]
set procbody [info body $tclproc]
ns_puts "
Tcl Proc: $tclproc
$tclproc [info args $tclproc]
"
ns_adp_return
}
%>
AOLserver Telemetry
$Header: /cvsroot/aolserver/aolserver/tests/nstelemetry.adp,v 1.1 2000/10/09 20:29:54 kriston Exp $
This is nstelemetry running at <%=[ns_conn url]%> on
<%=[ns_conn server]%> at <%=[ns_httptime [ns_time]]%>.
For easier reading of these data your browser should support
Style Sheets at least as well as
Netscape 4.x does -- MSIE 5.5
users will see inconsistencies.
Server Information
<%
## Server information.
## Things that don't go here: threads, callbacks, scheduled, sockcallbacks
foreach item {
server hostname address
pid uptime boottime
home config log pageroot tcllib
nsd argv0 name version label builddate platform
} {
## Note the catch so this works on all AOLserver revisions.
if [catch {
set itemval [ns_info $item]
if [regexp {boottime} $item] {
set itemval "[ns_httptime $itemval]"
}
ns_puts "
| $item: |
$itemval |
"
} errMsg] {
## Catch commands that don't exist.
ns_puts "
| $item: | n/a |
"
continue
}
}
%>
Memory Cache
| name |
stats |
<%
foreach item [lsort [ns_cache_names]] {
ns_puts "| $item | "
ns_puts "[ns_cache_stats $item] |
"
}
%>
Thread Locks
| name |
owner |
id |
nlock |
nbusy |
<%
foreach item [lsort [ns_info locks]] {
ns_puts ""
ns_puts "| [lindex $item 0] | "
for { set i 1 } { $i < [llength $item] } { incr i } {
ns_puts " [lindex $item $i] | "
}
ns_puts "
"
}
%>
Running Threads
| name |
parent |
tid |
flags |
ctime |
proc |
arg |
<%
foreach item [lsort [ns_info threads]] {
ns_puts ""
for { set i 0 } { $i < 7 } { incr i } {
ns_puts ""
if { $i != 4 } {
ns_puts "[lindex $item $i]"
} else {
ns_puts "[ns_httptime [lindex $item $i]]"
}
ns_puts " | "
}
ns_puts "
"
}
%>
Scheduled Procedures
| proc |
id |
flags |
interval |
nextqueue lastqueue laststart lastend
|
arg |
<%
foreach item [lsort [ns_info scheduled]] {
ns_puts ""
## proc, id, flags, interval
ns_puts "| [lindex $item 7] | "
for { set i 0 } { $i < 3 } { incr i } {
ns_puts "[lindex $item $i] | "
}
## times: nextqueue, lastqueue, laststart, lastend
ns_puts ""
for { set i 3 } { $i < 7 } { incr i } {
ns_puts "[ns_httptime [lindex $item $i]]"
}
ns_puts " | "
## arg
ns_puts "[lindex $item 8] | "
ns_puts "
"
}
%>
Connections (web clients)
<%
foreach item {
connections waiting queued keepalive
} {
ns_puts "| $item: | "
ns_puts " [ns_server $item] |
"
}
%>
Callbacks -- Events
| event |
name |
arg |
<%
foreach item [lsort [ns_info callbacks]] {
ns_puts ""
for { set i 0 } { $i < 3 } { incr i } {
ns_puts "| [lindex $item $i] | "
}
ns_puts "
"
}
%>
Callbacks -- Sockets (sockcallbacks)
| sock id |
when |
proc |
arg |
<%
foreach item [lsort [ns_info sockcallbacks]] {
ns_puts ""
for { set i 0 } { $i < 4 } { incr i } {
ns_puts "| [lindex $item $i] | "
}
ns_puts "
"
}
%>
URL Stats
| url |
hits |
wait (sec) |
open (sec) |
closed (sec) |
<%
foreach item [lsort [ns_server urlstats]] {
ns_puts ""
ns_puts "| [lindex $item 0] | "
ns_puts " [lindex [lindex $item 1] 0] | "
for { set i 2 } { $i < 8 } { incr i; incr i} {
if { [set thistime [lindex [lindex $item 1] $i]] != "" } {
ns_puts "
[format "%.6f" [expr $thistime * .000001]] | "
} else {
ns_puts " | "
}
}
ns_puts "
"
}
%>
Script and Server Errors
Coming soon: Reports of 400- and 500-series errors.
Configuration
Coming soon: Dump of parsed configuration data.
Tcl Information -- Tcl Core
<%
## Tcl library information.
foreach item {
tclversion patchlevel level
nameofexecutable sharedlibextension library} {
ns_puts "| $item: | "
ns_puts "[info $item] |
"
}
%>
Tcl Information -- Procs (Tcl language)
<%
foreach item [lsort [info procs]] {
ns_puts "$item "
}
%>
Tcl Information -- Commands (C and Tcl language)
<%
foreach item [lsort [info commands]] {
ns_puts "${item} "
}
%>
HTTP Headers
<%
for { set i 0 } { $i < [ns_set size [ns_conn headers]] } { incr i } {
ns_puts "[ns_set key [ns_conn headers] $i]: [ns_set \
value [ns_conn headers] $i]"
}
%>
<%
if [regexp {STDOUT} [ns_info log]] {
ns_puts "Log is on stdout and cannot be viewed from here."
ns_puts "