Html template for network ups tools upsstats
This file is used by upsstats.cgi(8) to generate status pages. Certain commands are recognized, and will be replaced with various status elements on the fly.
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 @ to prevent it from being treated as a start character.
Some commands begin blocks - sections of the template that will be included, excluded, or repeated depending on certain parameters.
Starts a block that will be repeated for each MONITOR directive in the hosts.conf(5). This is how you can generate pages that monitor all of your systems simultaneously.
Ends a FOREACHUPS block.
Starts a block that will only be printed if the variable var is supported by the current UPS. This is generally used to suppress "not supported" messages by avoiding the label and variable call entirely.
@IFEQ var value@
Starts a block if the value returned from the variable var matches value.
@IFBETWEEN varlow varhigh varvalue@
Starts a block if the value returned by the variable varvalue is between the values returned by the variables varlow and varhigh.
If the previous IF-command did not match, perform this instead.
Ends an IF/ELSE-block.
Even though the parser is pretty limited, it\(cqs 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 [email protected] @IFSUPP [email protected] This UPS knows both ambient temperature and humidity. @[email protected] @IFSUPP [email protected] This UPS only knows ambient humidity. @[email protected] @IFSUPP [email protected] This UPS only knows ambient temperature. @[email protected] This UPS knows nothing, how annoying. @[email protected]
Insert the ambient temperature in the current temperature scale.
Insert the current date and time. The format string is passed to strftime, so almost anything is possible. See strftime(3) for possible values.
Insert the entity for degrees (\(de) and either C or F depending on the current temperature scale.
Insert the designation of the host being monitored, like [email protected]
Insert the hout\(cqs description from hosts.conf(5).
Insert a link to upsstats.cgi with the "host" variable set to the current UPS. This is only useful within a FOREACHUPS block.
@IMG varname @
Insert an IMG SRC to upsimage.cgi(8) for one of these status variables:
Battery charge - a percentage
The charge on the battery in volts
Incoming utility frequency (Hz)
Incoming utility voltage
Incoming voltage, L1-L2 (3phase)
Incoming voltage, L2-L3 (3phase)
Incoming voltage, L3-L1 (3phase)
Outgoing utility frequency (Hz)
Outgoing voltage (from the UPS)
Outgoing voltage, L1-L2 (3phase)
Outgoing voltage, L2-L3 (3phase)
Outgoing voltage, L3-L1 (3phase)
UPS load, L1 (3phase)
UPS load, L2 (3phase)
UPS load, L3 (3phase)
UPS load - percentage
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. Possible color names are:
scale number color
summary color (number at the bottom)
major scale color for the normal ("ok") zone
minor scale color for the normal ("ok") zone
major scale color for the neutral zone
minor scale color for the neutral zone
major scale color for the warning zone
minor scale color for the warning zone
the color of the bar in the middle
All colors are hex triplets - 0xff0000 is red, 0x00ff00 is green, and 0x0000ff is blue.
@IMG [email protected] @IMG battery.charge back_col=0xff00ff [email protected] @IMG input.voltage [email protected]
Insert the META header magic for refreshing the page if that variable has been set by the browser. This needs to be in the HEAD section of the page.
Expand the abbreviations in the ups.status variable - OL becomes "On line", OB becomes "On battery", and so on.
Insert red, green, or yellow color triplets depending on the severity of the current UPS status. Normal operations are green, warnings like voltage trim/boost or "off" are yellow, and other events like being on battery or having a low battery are red.
Insert the current value of the status variable varname on the host being monitored, or "Not supported".
Inserts the current runtime, in hh:mm:ss format.
Use the Celsius scale for temperature data (default).
Use the Fahrenheit scale for temperature data.
Insert the UPS temperature in the current scale.
Insert the battery temperature in the current scale.
Obsoleted. Use IFBETWEEN instead (see example in upsstats.html).
Insert the version number of the software.
upsstats.cgi(8) will also open a file called upsstats-single.html if you call it with "host=" set in the URL. That file uses the same rules and techniques documented here.