NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_info(n) 5.0.0a naviserver "NaviServer Built-in Commands"

Name

ns_info - Return information about various aspects of the running NaviServer

Table Of Contents

Synopsis

Description

This command provides information about the current state of the running NaviServer.

COMMANDS

ns_info option ?arg arg ...?
ns_info address

Returns the primary IP address of the hostname of this machine, or the unspecified IP address (for IPv4 "0.0.0.0", for IPv6 "::") if unable to determine.

ns_info argv

Returns the argument vector from the invocation of nsd (excluding the first argument) in form of a list. This is similar to Tcl's $argv, but global variables in the top level namespace are cleaned up after every request.

ns_info argv0

Returns file path to executable binary

ns_info boottime

Returns the time in epoch seconds since the current server was started

ns_info buildinfo

Returns returns information about compiler, assertions and Tcl version in form of a dict, e.g., "compiler {clang 16.0.0 (clang-1600.0.26.4)} assertions 0 system_malloc 1 tcl 9.0.1"

ns_info builddate

Returns the date and time at which the current server was compiled, e.g.: "Jul 20 2004 at 14:57:20"

ns_info callbacks

Returns all registered startup/exit/shutdown callbacks

ns_info config

Returns the absolute path to the configuration file used to start the server

ns_info home

Returns the current working directory of the server

ns_info hostname

Returns the value of gethostname(), or "localhost" if that fails

ns_info ipv6

Returns information if the binary was compiled with IPv6 support.

ns_info locks

Lists lock information from mutexes and rwlocks with their statistics. The result is returned as a list with the following elements. For each lock, the following information is returned: name, {}, unique id, number of locks, number of busy locks, total wait time, max wait time, total lock time, number of read locks, number of write locks. Not all information is available for all types of locks.

ns_info log

Returns the name of the error log file. The name is specified by the "serverlog" parameter in the "ns/parameters" section.

ns_info major

Returns the major version number.

ns_info meminfo ?-release?

Returns memory statistics from tcmalloc when available, i.e., when libtcmalloc (from Google perfools) is used and preloaded (we might add support for other alternative malloc libraries in the future). Otherwise the call is a no-op.

When the option ?-release? is used, the releasable memory is released (also libtcmalloc only).

ns_info minor

Returns the minor version number.

ns_info mimetypes

Returns the current MIME type mappings.

ns_info name

Returns the name of the server implementation, i.e. "NaviServer".

ns_info nsd

Returns absolute path and name of the nsd binary, which is currently executed.

ns_info patchlevel

Returns the full version number of the server (including patch level).

ns_info pid

Returns the process id of the running nsd process.

ns_info pools

Returns usage info from the memory pools (returned by Tcl_GetMemoryInfo() if configured).

ns_info scheduled

Returns the list of the scheduled procedures in the current process (all virtual servers). Each list element is itself a 9-element list of {id, flags, interval, nextqueue, lastqueue, laststart, lastend, procname, arg}:

  • id - unique id returned by the scheduling command

  • flags - Bitmap of one or more of:

    • 1 -- NS_SCHED_THREAD

    • 2 -- NS_SCHED_ONCE

    • 4 -- NS_SCHED_DAILY

    • 8 -- NS_SCHED_WEEKLY

    • 16 - NS_SCHED_PAUSED

    • 32 - NS_SCHED_RUNNING

  • interval - interval specification (i.e. seconds from midnight for daily schedule)

  • nextqueue - Next time to queue for run

  • lastqueue - Last time queued for run

  • laststart - Last time run started

  • lastend - Last time run finished

  • procname - for tasks scheduled with ns_schedule_proc this will be ns:tclschedproc and arg will be the actual scheduled Tcl script.

  • arg - client data

ns_info server

Returns the name of the current virtual server.

ns_info servers

Returns the names of all virtual servers in the current nsd process.

ns_info shutdownpending

Returns 1 if shutdown is pending, 0 otherwise.

ns_info sockcallbacks

Returns returns a list of all socket callbacks such as the socket listening callback for the nscp module. Each list element is itself a 4-element list like this:

 {11 {read exit} nscp {127.0.0.1 9999} 0}
ns_info ssl

Returns information if the binary was compiled with OpenSSL support.

ns_info started

Returns 1 if the server is fully started, 0 otherwise.

ns_info tag

Returns the most detailed revision info, which might be shipped with the tar file or obtained from the source code management system (git or mercurial).

ns_info threads

Returns a list of all threads in the current process (all virtual servers). Each list element is itself a 7-element list of {name, parent, id, flag, ctime, procname, arg}:

  • name - current name of the thread

  • parent - parent thread name

  • id - id of the thread

  • flag - 1 if this is a detached thread, 0 otherwise

  • ctime - Thread creation time

  • procname - for conn threads this will be ns:connthread

  • arg - client data - for a running conn thread arg will be a 7-element list in the format returned by ns_server all - {conn id, peeraddr, state, method, url, running time, bytes sent}, where state is either "running" or "queued": {cns25 127.0.0.1 running POST /ds/shell 0.5158 0}

ns_info uptime

Returns the number of seconds since the nsd process started.

ns_info version

Returns the version number of the server (major and minor version number combined with a dot).

Keywords

global built-in, introspection