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>
Add error condition checks. Add lease file binding states. Check all
output formats. Check leases file that is in mad order, cse all sorting
methods when checking this. Use json output to check status classfications.
Add cidr range checks. Add conf include and comment parsing input checks.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Base level printing; localstime, number of ranges and shared networks,
project version, and file paths and time stamps.
Also print error and stop template processing when unknown tag is
encountered.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This way memory is allocated only for items that are in use, and walking
through shared network items is also more straightforward.
As an unfortunate side effect in --perfdata output shared networks are no
longer printed in reverse order. This should be a cosmetic issue.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This also fixes backup state counts that were added to shared networks
twice, making the numbers to be much greater than they really where.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Off by one that is caused by must_next_range() advancing pointer, and moving
over the first range. Fix by setting indexes one step backwards, that is
not excellent but better than copying skip_ok stuff to must_enter().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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>
There is too much repetative confusing maths near printouts. Move that
stuff to a function.
This change also fixes --snet-alarms option counting issue in range that
were not part of any shared network were ignored.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This makes 'range6 123::/45' style cidr notation to be understood as address
range. Earlier ranges that used cidr failed to parse completely.
Reported-by: Jeff Bailey <jeffrey.bailey@bt.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Options -p or --perfdata (in alarming mode) now enable the output of
additional performance data, i.e. used, touched and backup addresses per
subnet.
Signed-off-by: Manuel Hachtkemper <hacman@math.uni-bonn.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
For some unknown reason mac osx does not change NAN to negative in printout
when asking to do so. To get rid of false positive test results change the
sign of NAN to positive, that may break something for someone if there are
people expecting -NAN when devision with zero happens. But that sort of
breakage is pretty unlikely because it requires broken dhcpd.conf.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
I should consider writing tests before features. Sadly recently added new
options did not even work. Oh well, at least I did not release them before
noticing this.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
For some reason missing information has been overlooked for years.
Perhaps there is aren't that many users who are interested of the touched
addresses.
Proposed-by: Aaron Paetznick <aaronp@critd.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This tests ensures the problem fixed by Wolfgang Steudel cannot reoccur.
See the reference commit for details.
Reference: 5519763ba9
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The added test demonstrates the issue. If a did not end with whitespace
it was skipped.
Reported-by: Fredrik Lysén <fredrik.lysen@uadm.uu.se>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
For reasons see excellent paper 'Recursive Make Considered Harmful' by
Peter Miller.
References: http://miller.emu.id.au/pmiller/books/rmch/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The commit b858a4778b changed a little bit
to which category various binding states fall into. That has to be
reflected in expected test results.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Without this patch autoreconf, when done with release tarball, fails like
this:
$ autoreconf -f -i
sh: 1: build-aux/git-version-gen: not found
configure.ac:12: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.11/init.m4:26: AM_INIT_AUTOMAKE is expanded from...
configure.ac:12: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: /usr/bin/autom4te failed with exit status: 1
autoreconf: aclocal failed with exit status: 1
Further down the road tests start to fail after autoreconf.
make[4]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian/tests'
make[3]: *** No rule to make target `../tests/test.sh', needed by `check-local'. Stop.
make[3]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian/tests'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian'
Which is a symptom of not having test.sh in distribution.
Reported-by: Helmut Grohne <h.grohne@cygnusnetworks.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Gilles reported the full-json is currently broken, which the new check
demonstrates. Luckily the issue occurs only when active leases details
are being queried, leaving the count to be correct. That said bug is a
bug, and that should be corrected.
Reported-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The counting of total maximum address space seems to be broken at the
moment, and the check is expected to fail until a counting fix is
available.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>