output: add color support to text output

When --warning or --critical thresholds are defined with text output lines
that exceed threshold will be either yellow (warning) or red (critical).

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-05 17:07:16 +00:00
parent 48962004b8
commit 344ed2900d
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
8 changed files with 128 additions and 28 deletions

View file

@ -10,6 +10,7 @@ dhcpd-pools \- ISC dhcpd pools usage analysis
.OP \-\-format tHcxXjJ
.OP \-\-output file
.OP \-\-limit nr
.OP \-\-color when
.OP \-\-warning percent
.OP \-\-critical percent
.OP \-\-warn\-count number
@ -140,6 +141,24 @@ alarming context. When the alarming is in use, and total is not wanted
to be seen then in the case of alarming returning success nothing is
printed.
.TP
\fB\-\-color\fR=\fIwhen\fR
Use yellow for warning, red for critical, green for suppressed by \-\-minsize
and blue when \-\-snet\-alarms is the cause of supression. The
.I when
string can be
.BR always ,
.BR never ,
or
.BR auto .
Default is auto, that uses colors when command is running in interactive
terminal. With use of
.B \-\-warning
or
.B \-\-critical
coloring thresholds can be changed, but one must also use
.B \-\-format=text
to avoid turning on alarting mode.
.TP
\fB\-\-warning\fR=\fIpercent\fR
Turn on alarm output format, and specify percentage number which will
cause an alarm. If either a range or shared network will exceed