SLANT-CGI(8) System Manager's Manual SLANT-CGI(8)

slant-cgi
CGI program returning slant data

slant-cgi

The slant-cgi utility produces system statistics as recorded by slant-collectd(8). It interfaces with the database by default in /var/www/data/slant.db.
The CGI program accepts HTTP GET requests for the /index.json resource, which has the aliases /index, /, or the empty request. Other resources return an HTTP code 404. Non-GET request return an HTTP code 405. Other (non-200) codes are possible and follow standard definitions.
On success, slant-cgi returns an HTTP code 200 and a valid JSON document.
The document consists of the following. In this description, integers (int) are serialised from 64-bit signed numbers. Real-valued numbers (real) are serialised from double-precision numbers.
{ version: "x.y.z", 
   system: { system }, 
     qmin: [ records... ], 
      min: [ records... ], 
     hour: [ records... ], 
      day: [ records... ], 
     week: [ records... ], 
     year: [ records... ] 
}
The version is the software suite version. This is informational. The system, pair consists of system information:
{ boottime: int }
For the time being it consists only of boottime, the UNIX epoch value for when the system was last booted.
The last six are the possibly-empty sets of records accumulated over a given interval of time in quarter-minute quanta. So each qmin record consists of exactly one entry; each min record consists of at least one and at most four entries, one for each quarter-minute; each hour has at most 240, etc.
There are finite records (except for yearly ones) bound to a circular buffer per interval. When a record is filled, such as with four quarter-minute entries into a minute record, the next entry creates a new record with one entry while the oldest is discarded.
The circular buffer is large enough for a reasonable glimpse into the past, with emphasis placed on recent data: 40 quarter-minute records (10 minutes), 300 minute records (5 hours), 96 hourly (5 days), 28 daily (4 weeks), 104 weekly (two years), endless yearly entries.
Each record consists of the following:
{    ctime: int, 
   entries: int, 
       cpu: real, 
       mem: real, 
     netrx: int, 
     nettx: int, 
  discread: int, 
 discwrite: int, 
    nprocs: real, 
    nfiles: real, 
  interval: int, 
        id: int 
}
The fields are defined as follows:
a UNIX epoch of when the record was started (first entry)
the number of entries, so front-end displays will need to average all data by this number
average processor utilisation over all processing unit
active memory over all available memory
bytes received per second over all interfaces
bytes transmitted per second over all interfaces
bytes read per second over all configured devices
bytes written per second over all configured devices
number of running processes over all possible processes
number of open files over all possible open files
the type of interval starting with zero for quarter-minute, one fo minute, etc.
a unique record identifier

slant(1), slant-collectd(8)
October 13, 2018 OpenBSD 6.4