Absolute thresholds for checks (e.g. “bytes used”) are much easier to write and understand if written as kB, MB, MiB or GB instead of long byte-numbers.
--warning=1000000B
can be written as --warning=1MB
--critical=2048B
can be written as --critical=2kiB
SI-prefix[B]
(The B for Bytes is optional if no SI-factor is used. So 100B
can be written as 100
as well.)
SI-Prefixes are general purpose multiplicators used in the International System of Units (SI). They are also called factor or multiplicator sometimes.
Our plugins offer all increments from Kilo to Peta in both decimal and binary format:
# Decimal
KB = 1000
MB = 1000 * KB
GB = 1000 * MB
TB = 1000 * GB
PB = 1000 * TB
# Binary
KiB = 1024
MiB = 1024 * KiB
GiB = 1024 * MiB
TiB = 1024 * GiB
PiB = 1024 * TiB
The library is not case-sensitive. Therfore 1mb
or 1Mb
are always 1 million bytes and not bits as one may assume.
For more information on the implementation please read the libraries docs at https://pkg.go.dev/github.com/docker/go-units.
The values in the check’s output (message) are automatically formated and prefixed with the best-fitting SI-factor.