Commit graph

31 commits

Author SHA1 Message Date
Sami Kerola
e079cc16e0
output: include earlier missing data to json output
This commit adds all the data that is in text output to json output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-06 21:39:15 +00:00
Sami Kerola
344ed2900d
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>
2017-11-06 21:31:57 +00:00
Sami Kerola
48962004b8
output: add output helper functions
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>
2017-11-05 16:21:20 +00:00
Sami Kerola
bb0fa9adae
getdata: add cidr range support
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>
2017-09-17 00:03:06 +01:00
Manuel Hachtkemper
32e2d399a0
alarming: add additional performance data
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>
2016-03-31 22:34:27 +01:00
Sami Kerola
c305e2f82c
tests: add range definition flip test
This test ensure 10b06d88f0 will not get
regression in future.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-02-18 23:05:24 +00:00
Sami Kerola
ace697b472
fix out of tree build tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-12-06 17:44:30 +00:00
Sami Kerola
1a7d982495
change NAN markup to make tests work on mac
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>
2015-12-06 11:46:07 +00:00
Sami Kerola
01aa13cf43
test all sorting options
Not perfect test, but atleast something.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-12-05 19:51:53 +00:00
Sami Kerola
da4b7a783a
add --warn-count and --crit-count test, and fix related bug
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>
2015-12-05 19:38:08 +00:00
Sami Kerola
c4e5ef6198 add xml format check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-05-02 18:51:39 +01:00
Sami Kerola
0d6c61d437 add touched addresses counts to xml and json reports
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>
2015-05-02 18:48:52 +01:00
Sami Kerola
0705b0c17f tests: add regression test to avoid shared-net off by one alarming issue
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>
2014-11-14 20:13:08 +00:00
Sami Kerola
f3e282f122 output: make nagios output have performance data
Just in case someone wants to graph what is going on.

Reference: http://nagios.sourceforge.net/docs/3_0/pluginapi.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-24 21:34:35 +00:00
Sami Kerola
ca0b1c3262 tests: fix testing error
The commit 7fc354827a introduced an symlink
that end up to update simple test causing it to break.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-11-17 18:39:47 +00:00
Sami Kerola
7fc354827a getdata: fix consecutive range definition regression
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>
2013-11-08 20:30:28 +00:00
Sami Kerola
57ddd4f785 tests: test small network alarm ignoring
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-12 19:32:27 +01:00
Sami Kerola
978ddeddeb tests: fix tests to use the new OK printing limit
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-11 20:37:55 +01:00
Sami Kerola
c0e7b50bd3 tests: add alarming tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-10 22:42:25 +01:00
Sami Kerola
30238e9d1c build-sys: use non-recursive build
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>
2013-04-24 22:46:04 +01:00
Sami Kerola
ab535d8ab1 tests: add a test for one ip range
A regression test for commit ffffbc9 fix.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-22 23:16:18 +01:00
Sami Kerola
1a7649beb3 tests: check how command works with invalid input
Lack of this check resulted to bug that was shipped to users, which was
fixed in commit 805d353.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-21 14:37:34 +01:00
Sami Kerola
3e677d8a24 tests: binding states commit needs to be reflected in expected results
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>
2013-04-09 21:04:24 +01:00
Sami Kerola
5ee1aca2b9 build-sys: add git-version-gen and test.sh to release package
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>
2013-04-09 21:04:19 +01:00
Sami Kerola
8e2da89c88 tests: add complete check including multiple ranges and shared networks
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-16 12:56:22 +00:00
Sami Kerola
e50d0a7d38 tests: fix make distcheck
It is best to make dhcpd-pools used from PATH, which makes out of tree
build check to work.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 20:28:26 +00:00
Sami Kerola
632e97834b build-sys: update .gitignore files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 17:30:01 +00:00
Cheer Xiao
ff7ca8c419 tests: update expected/v6
The range size in the old file was also incorrect.
2013-01-08 23:00:57 +08:00
Sami Kerola
d8aae53968 tests: add json tests, and make fail output loud
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>
2012-12-07 20:25:21 +00:00
Sami Kerola
a2fa69a403 tests: add v6 check
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>
2012-12-02 21:33:07 +00:00
Sami Kerola
71bcee14e9 tests: add basic tests
The tests can be ran using 'make check'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-29 21:02:40 +00:00