foreach p {/bin/lsof /usr/bin/lsof} { if {[file executable $p]} break } set of [split [exec -ignorestderr -- $p -n -P +p [pid] 2>/dev/null] \n] set IPv4 [lmap line $of {if {![string match *IPv4* $line]} continue;set line}] set logfile [ns_config ns/server/[ns_info server]/httpclient logfile] try { set ns_http_errors [split [exec -ignorestderr -- fgrep -v " ok" $logfile] \n] } on error errorMsg { set ns_http_errors "" } if {[llength $IPv4] > 1000} { set IPv4 [lrange $IPv4 0 999] } ns_return 200 text/plain [subst { [ns_info config] uptime [format %.2f [expr {[ns_info uptime]/(60*60.0)}]]h ns_http running [ns_http stats] Open Files [llength $of] IPv4 sockets [llength $IPv4] ns_http requests: [exec wc -l $logfile] errors [llength $ns_http_errors] Keep-alives: \t[join [ns_http keepalives] \n\t] ns_http errors: \t[join $ns_http_errors \n\t] IPv4 sockets (max 1000): \t[join $IPv4 \n\t] }]