{serverload}

Description

serverload prints the host machine current system load average - the one-minute figure the operating system reports (the same number shown as the first value by the Unix uptime and top tools). It is roughly how many processes were running or waiting to run on the CPU, averaged over the last minute, so a value near the number of CPU cores means the machine is busy but keeping up, and a much larger value means it is overloaded. The command takes no parameters and reads nothing from the database; it just asks the server for that single number and returns it as text. The result is never cached and is recomputed on every request, so it changes from one page render to the next and differs from server to server. On a platform that does not report a load average it returns 0. Use it only for diagnostics or an admin status page, never as the value of a test, because it is non-deterministic by nature.

Examples

virtual{serverload}
Expected(a number such as 0.42 - the live 1-minute load; differs every render and per server)
Actual0.69
Prints the host one-minute system load average as a plain number. The value is live and changes on every render, so this is a virtual (illustrative) example, not an asserted test.
virtualServer load: {serverload}
Expected(Server load: 0.42 - with the live number filled in)
ActualServer load: 0.69
serverload drops straight into surrounding text - useful on an admin status or health page.
virtual{math:{serverload}:1}
Expected(0.4 - the live load rounded to one decimal)
Actual0.7
The raw value can carry many decimals. Wrap it in math with a decimals argument of 1 to show a tidy one-decimal figure.
virtual{math:{serverload}/4*100:0}%
Expected(11% - the live load divided by 4 cores, as a whole-number percent)
Actual17%
Divide by the core count (4 here) and scale to a percentage to gauge how saturated the CPUs are. A result near 100 percent means the machine is fully loaded.
virtual{if:{serverload}:gt:2:HIGH:OK}
Expected(OK when the live load is at or below 2, HIGH when it is above 2)
ActualOK
Feed the load into if with the gt operator to branch on a threshold: print HIGH when the one-minute load is above 2, otherwise OK.