AOLserver Telemetry

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 "" } errMsg] { ## Catch commands that don't exist. ns_puts "" continue } } %>
$item: $itemval  
$item:n/a

Memory Cache

<% foreach item [lsort [ns_cache_names]] { ns_puts "" ns_puts "" } %>
name stats
$item[ns_cache_stats $item] 

NSV arrays

<% foreach key [lsort [nsv_names]] { ns_puts "\n" } %>
name entries bytes
$key[nsv_array size $key][string bytelength [nsv_array get $key]]

Thread Locks

<% foreach item [lsort [ns_info locks]] { ns_puts "" ns_puts "" for { set i 1 } { $i < [llength $item] } { incr i } { ns_puts "" } ns_puts "" } %>
name owner id nlock nbusy
[lindex $item 0]  [lindex $item $i]

Running Threads

<% foreach item [lsort [ns_info threads]] { ns_puts "" for { set i 0 } { $i < 7 } { incr i } { ns_puts "" } ns_puts "" } %>
name parent tid flags ctime proc arg
"
	if { $i != 4 } {
	    ns_puts "[lindex $item $i]"
	} else {
	    ns_puts "[ns_httptime [lindex $item $i]]"
	}
	ns_puts "

Scheduled Procedures

<% foreach item [lsort [ns_info scheduled]] { ns_puts "" ## proc, id, flags, interval ns_puts "" for { set i 0 } { $i < 3 } { incr i } { ns_puts "" } ## times: nextqueue, lastqueue, laststart, lastend ns_puts "" ## arg ns_puts "" ns_puts "" } %>
proc id flags interval nextqueue
lastqueue
laststart
lastend
arg
[lindex $item 7] [lindex $item $i] 
"
    for { set i 3 } { $i < 7 } { incr i } {
	ns_puts "[ns_httptime [lindex $item $i]]"
    }
    ns_puts "
[lindex $item 8] 

Connections (web clients)

<% foreach item { connections waiting queued keepalive } { ns_puts "" ns_puts "" } %>
$item: [ns_server $item]

Callbacks -- Events

<% foreach item [lsort [ns_info callbacks]] { ns_puts "" for { set i 0 } { $i < 3 } { incr i } { ns_puts "" } ns_puts "" } %>
event name arg
[lindex $item $i] 

Callbacks -- Sockets (sockcallbacks)

<% foreach item [lsort [ns_info sockcallbacks]] { ns_puts "" for { set i 0 } { $i < 4 } { incr i } { ns_puts "" } ns_puts "" } %>
sock id when proc arg
[lindex $item $i]

URL Stats

<% foreach item [lsort [ns_server urlstats]] { set N [lindex [lindex $item 1] 0] ns_puts "" ns_puts "" ns_puts "" foreach {sec usec} [lrange [lindex $item 1] 1 7] { ns_puts "" } ns_puts "" } %>
url hits wait (sec) open (sec) closed (sec)
[lindex $item 0]  $N[format "%6f" [expr {($sec + ($usec * .000001))/$N}]]

Tcl Information -- Tcl Core

<% ## Tcl library information. foreach item { tclversion patchlevel level nameofexecutable sharedlibextension library} { ns_puts "" ns_puts "" } %>
$item:[info $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]"
}
%>

util_memoize cache info

<% if {0} { foreach name [ns_cache names util_memoize] { ns_puts "$name size = [ns_cache get util_memoize $name]
" } } %> <% ns_puts [info commands] %>