NaviServer Built-in Commands – 5.1.0
ns_info - Return information about various aspects of the running NaviServer
This command provides information about the current state of the running NaviServer.
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.
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.
Returns file path to executable binary
Returns the name of the bin directory. The name is specified by the "bindir" parameter in the "ns/parameters" section, and defaults to "bin". The value is used for loading binary libraries for executables like the nsproxy worker.
Returns the time in epoch seconds since the current server was started
Returns returns information about compiler, assertions and Tcl version in form of a dict, containing the keys compiler, assertions, system_malloc, with_deprecated, and tcl.
% ns_info buildinfo
compiler {clang 16.0.0 (clang-1600.0.26.4)} assertions 0 system_malloc 1 with_deprecated 0 tcl 9.0.1
Returns the date and time at which the current server was compiled, e.g.: "Jul 20 2004 at 14:57:20"
Returns all registered startup/exit/shutdown callbacks
Returns the absolute path to the configuration file used to start the server
Returns the current working directory of the server
Returns the value of gethostname(), or "localhost" if that fails
Returns information if the binary was compiled with IPv6 support.
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.
Returns the name of the system log file. The name is specified by the systemlog parameter in the ns/parameters section.
Returns the name of the log directory. The name is specified by the "logdir" parameter in the "ns/parameters" section, and defaults to "logs".
Returns the major version number.
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 meminfo
reload /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 version {gperftools 2.7} stats {------------------------------------------------
MALLOC: 1015860976 ( 968.8 MiB) Bytes in use by application
MALLOC: + 113090560 ( 107.9 MiB) Bytes in page heap freelist
MALLOC: + 123400496 ( 117.7 MiB) Bytes in central cache freelist
MALLOC: + 4785408 ( 4.6 MiB) Bytes in transfer cache freelist
MALLOC: + 29514464 ( 28.1 MiB) Bytes in thread cache freelists
MALLOC: + 7602176 ( 7.2 MiB) Bytes in malloc metadata
MALLOC: ------------
MALLOC: = 1294254080 ( 1234.3 MiB) Actual memory used (physical + swap)
MALLOC: + 1335296 ( 1.3 MiB) Bytes released to OS (aka unmapped)
MALLOC: ------------
MALLOC: = 1295589376 ( 1235.6 MiB) Virtual address space used
Returns the minor version number.
Returns the current MIME type mappings.
Returns the name of the server implementation, i.e. "NaviServer".
Returns absolute path and name of the nsd binary, which is currently executed.
Returns the full version number of the server (including patch level).
Returns the process id of the running nsd process.
Returns usage info from the memory pools (returned by Tcl_GetMemoryInfo() if configured).
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
Returns the name of the current virtual server.
Returns the names of all virtual servers in the current nsd process.
Returns 1 if shutdown is pending, 0 otherwise.
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:
% ns_info sockcallbacks
{11 {read exit} nscp {127.0.0.1 9999} 0}
Return information about SSL/OpenSSL support in the current NaviServer build.
Without options, this command returns a boolean value indicating whether NaviServer was compiled with OpenSSL support.
When the option -details is specified, the command returns a Tcl dictionary providing detailed information about the OpenSSL configuration at compile time and runtime.
The returned dictionary contains the following keys:
enabled - boolean indicating whether OpenSSL support is enabled
headersVersion - OpenSSL version string used at compile time
headersVersionNumber - numeric OpenSSL version used at compile time
runtimeVersion - OpenSSL version string of the loaded library
runtimeVersionNumber - numeric OpenSSL version of the loaded library
major, minor, patch - decoded runtime version components
capabilities - list of available cryptographic capability groups
keytypes - list of supported key types
digests - list of available message digest algorithms
The value of capabilities is a list of symbolic names describing available functionality exposed via ns_crypto, such as digest, cipher, hmac, signature, agreement, and kem. Depending on the OpenSSL version, additional capabilities such as scrypt and argon2 may be present.
The value of keytypes is a list of supported key types or algorithm families, such as rsa, ec, ed25519, ed448, x25519, x448, sm2, ml-kem, ml-dsa, and okp. The synthetic type okp denotes support for Octet Key Pair algorithms (e.g., Ed25519, Ed448, X25519, X448) as used by ns_crypto::key import.
The value of digests is a list of available message digest algorithms as provided by OpenSSL (restricted to plain message digest usage). Typical entries include algorithms such as sha2-256, sha3-256, blake2b-512, sm3, and others, depending on the configured providers and OpenSSL version.
The reported capabilities and key types depend on the OpenSSL version, configured providers, and compile-time options.
% ns_info ssl
1
% ns_info ssl -details
# result dict reformatted for easier reading:
enabled 1
headersVersion {OpenSSL 4.1.0-dev}
runtimeVersion {OpenSSL 4.1.0-dev}
capabilities {digest cipher hmac signature agreement kem}
keytypes {rsa ec ed25519 ed448 x25519 x448 sm2 ml-kem ml-dsa okp}
digests {sha2-256 sha3-256 blake2b-512 ...}
Returns 1 if the server is fully started, 0 otherwise.
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).
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}
Returns the number of seconds since the nsd process started.
Returns the version number of the server (major and minor version number combined with a dot).