mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-15 23:36:59 +00:00
output: fix warn and crit counts on shared networks
The crit/warn_count is tested against used rather than free. It is only for shared networks, the range correctly subtracts count from size to get its free. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
17d68b7e3e
commit
07b4eaa480
4 changed files with 28 additions and 2 deletions
1
THANKS
1
THANKS
|
|
@ -45,3 +45,4 @@ Boris Lytochkin
|
|||
Jeff Bailey
|
||||
José Bollo
|
||||
Sebastián Cramatte
|
||||
Mark Sangster
|
||||
|
|
|
|||
|
|
@ -158,11 +158,11 @@ int shnet_output_helper(struct conf_t *state, struct output_helper_t *oh,
|
|||
oh->status = STATUS_IGNORED;
|
||||
if (state->skip_minsize)
|
||||
return 1;
|
||||
} else if (state->critical < oh->percent && shared_p->used < state->crit_count) {
|
||||
} else if (state->critical < oh->percent && (shared_p->available - shared_p->used) < state->crit_count) {
|
||||
oh->status = STATUS_CRIT;
|
||||
if (state->skip_critical)
|
||||
return 1;
|
||||
} else if (state->warning < oh->percent && shared_p->used < state->warn_count) {
|
||||
} else if (state->warning < oh->percent && (shared_p->available - shared_p->used) < state->warn_count) {
|
||||
oh->status = STATUS_WARN;
|
||||
if (state->skip_warning)
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@ dhcpd-pools -c $top_srcdir/tests/confs/complete -l $top_srcdir/tests/leases/comp
|
|||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
echo '== shared net count alarms ==' >> tests/outputs/$IAM
|
||||
dhcpd-pools -c $top_srcdir/tests/confs/complete -l $top_srcdir/tests/leases/complete \
|
||||
--color=always --format t --crit-count=20 --critical=0 --warning=0 --warn-count=24 \
|
||||
--output=tests/outputs/$IAM-too
|
||||
echo $? >> tests/outputs/$IAM-too
|
||||
cat tests/outputs/$IAM-too >> tests/outputs/$IAM
|
||||
|
||||
rm -f tests/outputs/$IAM-too
|
||||
diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
|
||||
exit $?
|
||||
|
|
|
|||
|
|
@ -14,3 +14,21 @@ Shared nets - crit: 0 warn: 0 ok: 0 ignored: 2; | snet_crit=0 snet_warn=0 snet_o
|
|||
WARNING: dhcpd-pools: Ranges - crit: 0 warn: 0 ok: 2; | range_crit=0 range_warn=0 range_ok=2
|
||||
Shared nets - crit: 0 warn: 2 ok: 0; | snet_crit=0 snet_warn=2 snet_ok=0
|
||||
1
|
||||
== shared net count alarms ==
|
||||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
[1;31mexample1 10.0.0.1 - 10.0.0.20 20 11 55.000 0 11 55.000[0m
|
||||
[1;31mexample1 10.1.0.1 - 10.1.0.20 20 10 50.000 0 10 50.000[0m
|
||||
[1;31mexample2 10.2.0.1 - 10.2.0.20 20 8 40.000 0 8 40.000[0m
|
||||
[1;31mexample2 10.3.0.1 - 10.3.0.20 20 9 45.000 0 9 45.000[0m
|
||||
[1;31mAll networks 10.4.0.1 - 10.4.0.20 20 5 25.000 0 5 25.000[0m
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
[1;31mexample1 40 21 52.500 0 21 52.500[0m
|
||||
[1;33mexample2 40 17 42.500 0 17 42.500[0m
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 100 43 43.000 0 43 43.000
|
||||
0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue