| UPSSTATS.HTML(5) | NUT Manual | UPSSTATS.HTML(5) |
NAME
upsstats.html - HTML template for web-based Network UPS Tools upsstats
DESCRIPTION
This file, and a similarly structured upsstats-single.html for certain use-cases, are used by upsstats.cgi(8) to generate NUT CGI status pages. Certain commands are recognized, and will be replaced with various status elements on the fly.
As a bit of a safety check, the file must start with @NUT_UPSSTATS_TEMPLATE@ command.
For details about configuring some popular web servers to run NUT CGI programs, please see the upsset.conf(5) page.
Note
This template file should be placed in the NUT configuration location. If you use a dedicated copy of that directory or one not discovered by the binaries relocated into your web server’s cgi-bin locations (such as with NUT for Windows builds, defaulting to seek in locations relative to each binary), consider exporting the NUT_CONFPATH environment variable from the web server.
Note
On platforms with required program file name extensions, like Windows, you may have to use e.g. a *.cgi.exe extension for the programs in HTML template files (UPSSTATSPATH, UPSIMAGEPATH).
FORMATTING
Commands can be placed anywhere on a line, but must start and end with @.
Any extra characters before or after the commands will be passed through unchanged.
It is allowed to use more than one command on a single line, as long as each command has its own start and end character.
If you need to use the @ sign, use HTML entity @ to prevent it from being treated as a start character.
BLOCK CONTROL
Some commands begin blocks — sections of the template that will be included, excluded, or repeated depending on certain parameters.
BLOCK CONTROL - ITERATION
@FOREACHUPS@
@ENDFOR@
BLOCK CONTROL - MATCHING SPECIFIC CASES
@IFSUPP var@*
@IFEQ var value@
Note
You can use @IFEQ upsstats.use_celsius (0|1)@ to check for the current setting of @TEMPC@ or @TEMPF@ toggle.
@IFBETWEEN varlow varhigh varvalue@
@ELSE@
@ENDIF@
BLOCK CONTROL - ADVANCED EXPRESSIONS
Even though the parser is pretty limited, it’s still possible to create rather advanced expressions. The key to this is the fact that multiple block control commands are AND:ed. This is illustrated with an example (more examples are available in upsstats.html).
@IFSUPP ambient.humidity@ @IFSUPP ambient.temperature@ This UPS knows both ambient temperature and humidity. @ELSE@ @IFSUPP ambient.humidity@ This UPS only knows ambient humidity. @ELSE@ @IFSUPP ambient.temperature@ This UPS only knows ambient temperature. @ELSE@ This UPS knows nothing, how annoying. @ENDIF@
OTHER COMMANDS
@NUT_UPSSTATS_TEMPLATE [args]@
Currently the command and its arguments are otherwise ignored; templates shipped with NUT use the argument values "default" and "single" effectively as a comment for debugging/troubleshooting.
@UPSSTATSPATH filename@
May have to include the platform-specific program file name extension, like @UPSSTATSPATH upsstats.cgi.exe@
@UPSIMAGEPATH filename@
May have to include the platform-specific program file name extension, like @UPSIMAGEPATH upsimage.cgi.exe@
@AMBTEMP@
@DATE format@
@DEGREES@
@HOST@
@HOSTDESC@
@HOSTLINK@
@TREELINK [Link text]@
@TREELINK_JSON [Link text]@
@IMG varname @
battery.charge
battery.voltage
input.frequency
input.voltage
input.L1-L2.voltage
input.L2-L3.voltage
input.L3-L1.voltage
output.frequency
output.voltage
output.L1-L2.voltage
output.L2-L3.voltage
output.L3-L1.voltage
output.L1.power.percent
output.L2.power.percent
output.L3.power.percent
ups.load
ups.temperature
extra is where you can put additional definitions. Right now the valid definitions are colors for various parts of the bars drawn by upsimage.cgi(8). Possible color names are:
back_col
scale_num_col
summary_col
ok_zone_maj_col
ok_zone_min_col
neutral_zone_maj_col
neutral_zone_min_col
warn_zone_maj_col
warn_zone_min_col
bar_col
All colors are hex triplets — e.g. 0xff0000 is red, 0x00ff00 is green, and 0x0000ff is blue.
Examples:
@IMG battery.charge@ @IMG battery.charge back_col=0xff00ff bar_col=0xaabbcc@ @IMG input.voltage ok_zone_maj_col=0x123456@
@REFRESH@
@STATUS separator@, @STATUS@
@STATUSCOLOR@
@VAR varname@
@RUNTIME@
@TEMPC@
@TEMPF@
@UPSTEMP@
@BATTTEMP@
@UTILITYCOLOR@
@VERSION@
OTHER TEMPLATES
upsstats.cgi(8) will also open a file called upsstats-single.html if you call it with host= set in the query URL. That file uses the same rules and techniques as documented here.
SEE ALSO
upsstats.cgi(8), upsimage.cgi(8)
Internet resources:
The NUT (Network UPS Tools) home page: https://www.networkupstools.org/historic/v2.8.5/
| 04/07/2026 | Network UPS Tools 2.8.5 |