nginx module for displaying sysinfo as JSON
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Dockerfile
LICENSE
Makefile
README.md
config
nginx.conf
nginx.dynamic.conf
ngx_http_system_info_module.c
test.sh

README.md

ngx-system-info

Nginx module for displaying sysinfo as JSON (Linux only).

Installation

Firstly clone this repo somewhere.

Download Nginx source:

$ wget https://nginx.org/download/nginx-VERSION.tar.gz
$ tar -xzf nginx-VERSION.tar.gz
$ cd nginx-VERSION

Build as static module:

$ ./configure --add-module=/path/to/ngx-system-info
$ make
$ sudo make install

Build as a dynamic module:

Compiles with at least the following versions of Nginx:

  • 1.6.3
  • 1.8.1
  • 1.10.3
  • 1.12.2
  • 1.14.0

Usage

Specify a location in your Nginx configuration to display the data, which will be output as JSON (application/json):

location /system_info {
  system_info;
}

Example output:

{
  "uptime": 3618,
  "totalram": 8223174656,
  "freeram": 3047157760,
  "loadavg": [
     1.29,  0.84,  0.81
  ],
  "sharedram": 166408192,
  "bufferram": 102264832,
  "totalswap": 8438935552,
  "freeswap": 8438935552,
  "procs": 857
}

Testing

There's an included Dockerfile that will build this module against various versions of Nginx and do a simple curl test against an endpoint.

$ make test