Commit graph

1620 commits

Author SHA1 Message Date
Peter (pir) Radcliffe
2f2b2f1987 GMT expiry display
Change solution to display GMT time in the local display format with
the offset number of hours from GMT to be clear about what timezone
this is if the local display format does not include offset.
2016-11-07 22:42:40 +01:00
Peter (pir) Radcliffe
06059ecd0e Revert "Fix check_http test time output"
This reverts commit 2d9e61a438.
2016-11-07 22:42:40 +01:00
Peter (pir) Radcliffe
2efad48e8c Fix check_http test time output
Tests need to match new output time and timezone.
2016-11-07 22:42:40 +01:00
Peter (pir) Radcliffe
a3a78795b2 Use GMT timezone in SSL certs
SSL certs are required to use times in GMT per
https://www.ietf.org/rfc/rfc5280.txt but the mktime() here assumes the
current timezone.

Fix the time_t conversion to be done assuming GMT with timegm() and
only do it once rather than twice.

Display the expiry date and time with ISO format years and give an
offset from GMT and a timezone to be very clear about exactly what time
is being displayed. Time given is correct and now in the machine’s
timezone.
2016-11-07 22:42:40 +01:00
abrist
7276ce77c7 check_snmp.c - Added IPv6 support
The "-6" optarg now prepends the server_address with "udp6:" for the
snmpget external command as per the net-snmp syntax at:
http://www.net-snmp.org/wiki/index.php/FAQ:Applications_28

Thanks to DrydenK (Roberto Greiner) for the heads up.
2016-11-07 22:13:07 +01:00
Sven Nierlein
aa7ed88c54 check_users: add new test cases
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-07 21:49:40 +01:00
Sven Nierlein
52cd7d7934 check_users: still allow zero thresholds
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-07 21:49:03 +01:00
John C. Frickson
a5983eda69 check_users not correctly detecting thresholds
Fix for issue https://github.com/nagios-plugins/nagios-plugins/issues/81

check_users now uses the standard warning and critical ranges parser and
a standard perdata output routine.
2016-11-07 21:36:25 +01:00
Oliver Skibbe
5663b03717 check_disk - show all disks if state is ok and option error only is used
This fix changes output of check_disk in case of --error-only/-e option
is used and state is ok

 - Old output: DISK OK
 - New output: DISK OK - free space: / 159731 MB (83% inode=61%);
   /dev/shm 2926 MB (100% inode=99%); /boot 58 MB (32% inode=99%);

Resolves: #1420
2016-11-04 11:35:12 +01:00
Sven Nierlein
3a12034805 check_by_ssh: print command output in verbose mode
right now it is not possible to print the command output of ssh. check_by_ssh
only prints the command itself. This patchs adds printing the output too. This
makes it possible to use ssh with verbose logging which helps debuging any
connection, key or other ssh problems.
Note: you must use -E,--skip-stderr=<high number>, otherwise check_by_ssh would
always exit with unknown state.

Example:

  ./check_by_ssh -H localhost -o LogLevel=DEBUG3 -C "sleep 1" -E 999 -v

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-09-17 07:45:08 +02:00
Holger Weiss
e16dc71d5c Merge branch 'pr/1386'
* pr/1386:
  check_dig: expected answer is now incasesensitive
2016-02-22 23:11:01 +01:00
Holger Weiss
0960239981 Let check_http test use HTTP/1.1 2016-02-22 21:59:58 +01:00
Sven Geggus
d44b8d70a4 DNS is case insensitive!
Thus recent Versions of bind will no longer change .IN-ADDR.ARPA to lowercase
as the uppercase version is also valid.

To have check_dns.c consider this fact change strstr to strcasestr
2016-02-22 17:14:27 +01:00
Gerhard Lausser
8727768834 Update check_http.c
If a web page contains a nul character, check_http reads the complete page but --expect does not search beyond this character.
2015-11-04 16:18:37 +01:00
Gerhard Lausser
b59ac4e615 Typo in check_ldap.c usage 2015-11-02 18:14:09 +01:00
Daniel Stirnimann
24eea9fa34 check_dig: expected answer is now incasesensitive
check_dig was casesensitive if an expected answer is given.
  Switching strstr with strcasestr fixes this issue

  While testing i noticed a bug where expected is not an exact match
  New issue for that is opened #1385

  This fix closes #1233
2015-10-15 10:59:32 +02:00
Holger Weiss
11c5796d0a Revert "Don't let check_disk hang on hanging file systems"
This reverts commit 6986aa1d0a.  That
commit leads to issues on non-Linux systems, and it seems to not
(always) work as expected on Linux, either.

Conflicts:
	plugins/Makefile.am
	plugins/check_disk.c

Closes #1377 and closes #1329.
2015-10-12 11:07:02 +02:00
Holger Weiss
37928b52a5 Merge branch 'maint'
* maint:
  sslutils: Remove superfluous parenthesis for sslv3 function too
  sslutils: remove superfluous parenthesis
  check_snmp: modified tests
  check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided by utils.h), already used by help description, see issue #1318
  install snmpd on travis tests
  enable libtab on travis builds
  add perl snmp to travis dependencies
  NEWS: Mention check_ups performance data fix
  Fix incorrect performance data thresholds
  check_dhcp: Fix option parsing
  Fixes segfaults when running via monitoring worker (off-by-one)
  travis: fix http test host
  sslutils: Check if OpenSSL supports SSLv3.

Conflicts:
	NEWS
	plugins/sslutils.c
2015-10-08 12:52:10 +02:00
Oliver Skibbe
6b8c0bdf11 check_smtp: extended support for expect option
expect option (-e) supported only first response, so checking for
  any other response like 250-xxx would never match. This fix stores
  return of relevant buffer

  closes #1381
2015-10-08 11:09:25 +02:00
Oliver Skibbe
b6de2341f8 check_smtp.c: modified SSL check for use with -e
- currently STARTTLS check does not work with -e if there's text
    like '220 hostname ESMTP*'. This is caused by SMTP answer from
    host. Postfix answer: 220 2.0.0 Ready to start TLS, Exchange
    2010: 220 2.0.0 SMTP server ready. This fix checks against 220

    closes #1093
2015-10-08 09:04:29 +02:00
Oliver Skibbe
d9d82309e2 * check_http: added timeout to perfdata as max val 2015-10-07 09:14:28 +02:00
Holger Weiss
dfe66c01c0 check_smtp: Let "-D" option imply "-S" 2015-10-06 23:28:24 +02:00
Holger Weiss
b317aaf32a check_smtp: QUIT SMTP connection when "-D" is used
Don't forget to issue an SMTP QUIT command when the -D/--certificate
option is specified.  This avoids undesired MTA log messages.
2015-10-06 23:21:17 +02:00
Holger Weiss
5029714a9d Merge branch 'pr/1373'
* pr/1373:
  check_http: Allow for requesting TLSv1.1/TLSv1.2
2015-10-06 12:57:29 +02:00
Holger Weiss
f43083c6a9 check_http: Allow for requesting TLSv1.1/TLSv1.2
check_http's -S/--ssl option now allows for requesting the TLSv1.1 and
TLSv1.2 protocols.  Apart from that, a '+' suffix can be appended in
oder to also accept newer protocols than the specified version.

Closes #1338, and closes #1354, and closes #1359.
2015-10-04 23:28:35 +02:00
Sven Nierlein
edca257e20 use unknown exit code for help/version in plugins
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Jan Wagner
8e661a3bd6 sslutils: Remove superfluous parenthesis for sslv3 function too 2015-10-04 15:16:15 +02:00
Sebastian Herbszt
0a406d8dce sslutils: remove superfluous parenthesis
Remove superfluous parenthesis.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2015-10-04 15:09:36 +02:00
Oliver Skibbe
2d677b19ed check_snmp: modified tests
(Closes #1325)
2015-10-04 13:40:04 +02:00
Oliver Skibbe
6ba26122f4 check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided by utils.h), already used by help description, see issue #1318 2015-10-04 13:20:32 +02:00
Laurent Licour
1861e6a2d9 plugins/check_http.c - fix regression introduced in commit 388ea928 (Host header) 2015-10-02 21:12:58 +02:00
LAURENT LICOUR
44ba1f7064 plugins/check_http.c - fix Host header if explicitly set with -k 2015-10-02 21:12:58 +02:00
Sven Nierlein
0be10c669e Merge pull request #1257 from gcoxmoz/master
check_tcp: Fixing to return desired exit code
2015-10-02 19:54:31 +02:00
Sven Nierlein
9c32acf5bb fix tests for certificates expire date with seconds 2015-10-02 16:27:12 +02:00
Sven Nierlein
13d9c31b17 Merge pull request #1315 from waja/utils_remove_unused_variable
utils: remove unused variable
2015-10-02 16:01:24 +02:00
Sven Nierlein
7811f31018 Merge pull request #1349 from waja/check_http_ssl_via_proxy
check_http: Adding support for checking SSL-Websites through Proxies
2015-10-02 16:00:09 +02:00
Sven Nierlein
1784b0ac0c add faketime based tests for check_http 2015-10-02 15:56:19 +02:00
Sven Nierlein
9eeb3e170f fix typo from #1336
if exactly one hour before the expire date, we would mixup
minutes and hours.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-02 15:56:19 +02:00
Matthias Hähnel
e1ed1d805e Update sslutils.c
Fixed Output if the expiration time is below one hour and code cleanup
2015-10-02 15:56:18 +02:00
Matthias Hähnel
2ce2296842 Update sslutils.c
optimize output if certificate expires in less then 24h
thx to axel.schmalowsky@sixt.com for this patch
2015-10-02 15:56:18 +02:00
Louis Sautier
0b80412264 Fix incorrect performance data thresholds
Closes #1330
2015-10-02 13:13:35 +02:00
Jan Wagner
96932fd7b7 check_snmp: small improvement by anonymous submission
- response should not start with the delimiter
- OID response value taken into account

Closes issue #1029
Closes push request #1173
2015-10-02 12:57:25 +02:00
Sven Nierlein
5818a3f24d Merge pull request #1343 from awiddersheim/ipv6/check_fping
check_fping: autodetect ipv6 addresses
2015-10-02 10:40:05 +02:00
Sven Nierlein
1c0ec88152 travis: fix http test host
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-02 10:30:01 +02:00
Michael Melcher
342dd1b97f check_http: Adding support for checking SSL-Websites through Proxies
Ported the fix from Frank4dd to the latest git version. See also http://nagios.frank4dd.com/howto/monitor-ssl-web
sites-through-proxy.htm
2015-10-01 17:20:01 +02:00
Sven Nierlein
d73c57aa06 travis: fix http test host
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-01 17:05:47 +02:00
Jérémie Courrèges-Anglas
4e786f83de sslutils: Check if OpenSSL supports SSLv3. 2015-08-26 11:36:03 +02:00
Andrew Widdersheim
6a682b379f Allow check_fping to autodetect ipv6 addresses
Stole the logic in check_ping that allows it to autodetect whether an
address is ipv6 or not. Now the user does not have to specify -6 when
using check_fping with ipv6 addresses.
2015-08-13 10:21:01 -04:00
Sven Nierlein
82e28411c8 check_ldap: fix number of skipable tests
Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2015-04-23 09:51:26 +02:00
Sven Nierlein
169fbdae7e check_ldap: fix entries threshold check
fix typo in threshold check. instead of setting the state always
to warning, use the result from the thresholds entry check.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-04-22 12:51:29 +02:00
Sven Nierlein
d309b1d2e9 add check_ldap test
install openldap on travis and grep base dn from slapcat.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-04-22 12:51:29 +02:00
Gerhard Lausser
003103c09d add counting of entries to check_ldap 2015-04-21 19:11:57 +02:00
Gerhard Lausser
81be2afd95 add sperfdata function which can handle threshold ranges 2015-04-21 19:11:56 +02:00
Andrew Widdersheim
500f8aec81 Readability fix 2015-04-13 14:16:34 +02:00
Sven Nierlein
75d884ed1e fix snmp test for included threshold
since 6623a1 check_snmp prints the thresholds along the performance data.
This adjust our test cases accordingly.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2015-04-12 14:29:05 +02:00
Sebastian Herbszt
4383f39cd5 utils: remove unused variable
Remove unused variable.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-27 15:30:18 +01:00
Sebastian Herbszt
2daf38b0aa check_ntp_time: remove unused variables
Remove unused variables.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-27 15:28:12 +01:00
Sebastian Herbszt
fec3e01f89 check_ntp: remove unused variables
Remove unused variables.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-27 15:22:15 +01:00
Sebastian Herbszt
81b33d4514 check_disk: remove unused variables
Remove unused variables.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-27 15:20:57 +01:00
Sebastian Herbszt
0608d3f16a negate: remove unused variables
Remove unused variables.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-15 19:42:33 +01:00
Sebastian Herbszt
193ea6b5d7 check_dns: remove dead code
Remove code dead since commit 4efa917.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-15 17:44:13 +01:00
Holger Weiss
04e0a182ae Merge branch 'handle-hanging-nfs'
* handle-hanging-nfs:
  NEWS: Mention check_disk enhancement
  Cosmetic change: s/THRLIBS/THREADLIBS/
  configure.ac: Don't let pthread check depend on OS
  check_disk: Seperate declarations from code
  check_disk: Remove unused status variable
  check_disk: Fix pthread start routine type
  Don't let check_disk hang on hanging file systems
2014-12-02 13:22:17 +01:00
Holger Weiss
cf3d149652 Cosmetic change: s/THRLIBS/THREADLIBS/
Use a more intuitive variable name.
2014-12-02 12:37:59 +01:00
Holger Weiss
ff542df44c Merge branch 'maint'
* maint:
  NEWS: Modify list of changes for 2.1.1 release
  Prepare release
  THANKS.in: Add new authors
  NEWS: Updating all the fixes
  check_tcp: fix help description regarding escape option
  check_ntp: Nul-terminate jitter data
  Revert "plugins/check_ntp.c - Verify struct from response"
  check_real: fix null termination
  check_ntp: fix null termination
  check_apt: fix memset

Conflicts:
	NEWS
2014-12-02 10:54:55 +01:00
Sebastian Herbszt
22dfca20fd check_tcp: fix help description regarding escape option
The help description should print '\\' for backslash not just '\'.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-12-01 01:08:58 +01:00
Holger Weiss
99b3bfe488 check_ntp: Nul-terminate jitter data
Make sure the jitter response is nul-terminated before parsing the data
using string functions.
2014-12-01 01:07:53 +01:00
Holger Weiss
5871123e0a Revert "plugins/check_ntp.c - Verify struct from response"
This reverts commit a04df3e1b6.  The "fix"
was bogus in many ways and broke jitter checking.

Conflicts:
	plugins/check_ntp.c
2014-11-30 23:39:59 +01:00
Holger Weiss
0d14645cb0 check_disk: Seperate declarations from code 2014-11-30 11:33:20 +01:00
Holger Weiss
c0e6a6935b check_disk: Remove unused status variable
We didn't actually use the exit status provided by pthread_join(3) for
anything.
2014-11-30 11:30:36 +01:00
Holger Weiss
66f43f9934 check_disk: Fix pthread start routine type
The function pointer passed as third argument to pthread_create(3) must
be of type void *(*)(void *).
2014-11-28 23:55:03 +01:00
Gerhard Lausser
6986aa1d0a Don't let check_disk hang on hanging file systems 2014-11-28 22:08:08 +01:00
Andrew Berglund
94c1a4a433 Added missing CR in DESCRIBE request. 2014-11-28 16:24:33 +01:00
Sven Nierlein
a7d7992777 check_ssh: change warning to critical for protocal/version errors
It makes more sense to exit critical if a explicit version/protocol is requested. This
would also be more consistent with other plugins. Other string matching plugins like
check_snmp or check_http exit critical if the result does not match.

Signed-off-by: Sven Nierlein <sven@nierlein.de>

Closes #1268
2014-11-28 14:35:03 +01:00
Andy Brist
c59ee0036f Added perfdata to check_nt. New -l options - seconds|minutes|hours|days. 2014-11-28 13:22:20 +01:00
Johannes Engel
7a33e28e4e Introduce support for SNMPv3 context in check_snmp
snmpget already supports using SNMPv3 contexts using the option "-n".
Thus all we need to do is introduce a new argument to check_snmp and
pass the argument on to snmpget using snmpget's option "-n".
Since "-n" is already in use for check_snmp for a different purpose,
we use "-N" instead.
2014-11-28 13:05:16 +01:00
Andreas Seemueller
6623a1c787 check_snmp: Add thresholds to performance data 2014-11-28 12:56:07 +01:00
Sebastian Herbszt
30f0eeed57 check_real: fix null termination
Fix null termination introduced by commit b61f51a ("plugins/check_real.c - recv string null terminate").

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-11-27 00:51:46 +01:00
Sebastian Herbszt
a4a1b37be0 check_ntp: fix null termination
Fix null termination introduced by commit a04df3e ("plugins/check_ntp.c - Verify struct from response").

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-11-27 00:03:32 +01:00
Sebastian Herbszt
b7fc2eb15a check_apt: fix memset
Fix memset introduced by commit 9ce7369 ("plugins/check_apt.c - Print uninitialized ereg").

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2014-11-26 23:57:25 +01:00
Adrian Murphy
51604a1019 Fix perfdata to comply with perfdata UOM definition 2014-11-03 13:54:54 +01:00
Jan Wagner
40c870ed3a Improving output when swap space has zero size 2014-10-19 23:24:12 +02:00
Davide Madrisan
bd56c4a2d0 check_swap - fix comment
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
2014-10-19 14:54:57 +02:00
Jan Wagner
93071168df Merge branch 'maint'
Conflicts:
	NEWS
	THANKS.in
2014-10-06 10:25:31 +02:00
Holger Weiss
013ca2c508 Fix check_jabber to work with Openfire servers
The plugin expected:

	<?xml version='1.0'?>

But Openfire sends:

	<?xml version='1.0' encoding='UTF-8'?>
2014-09-16 12:28:51 +02:00
Sven Nierlein
57fb03cea5 check_by_ssh: added --hostname support
just like the guidelines and the help already suggests.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-08-06 15:51:18 +02:00
Sven Nierlein
a5b6d94fc6 tests: skip extented snmp tests if snmpd has no perl support
solaris snmpd has no perl support by default, so this test will fail.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-07-31 21:07:18 +02:00
Sven Nierlein
8e8d2d4243 tests: negate test fails when not run from plugins folder
Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-07-31 14:56:16 +02:00
Sven Nierlein
559d11b1fb tests: get current directory the perl way
instead of hoping to have it in the environment. This at
least broke tests on solaris.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-07-31 13:47:19 +02:00
Sven Nierlein
18a9562dae check_dns: unified check output
this also allows us to make tests against "critical" in the output.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-07-31 12:13:52 +02:00
Sven Nierlein
df08974bf0 check_ntp_peer: do not use uninitialized results for max state
s/t/jresult are not initialized if there is no corresponding threshold
supplied. So we shouldn't use them for calculating our result.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-07-31 11:28:30 +02:00
Jan Wagner
8775edcb10 Merge pull request #1164 from waja/github981 2014-07-30 23:33:57 +02:00
Jan Wagner
b7ce241ba6 check_dns: Use strchr instead of index 2014-07-30 23:30:59 +02:00
Jan Wagner
fe066559f2 Merge pull request #1182 from waja/github984 2014-07-30 21:36:19 +02:00
Alexander Wittig
8d50765653 check_dig: takes into account the -4 and -6 switch
Fix automatic DNS server name detection to honor -4 and -6 switches
(default to 127.0.0.1 or ::1 respectively, i.e. if -6 is given ::1
is used instead of 127.0.0.1)
2014-07-30 15:25:20 +02:00
Alexander Wittig
8c623b1a43 check_dig: Fix to work with dig and drill tool
FreeBSD starting with version 10 is shipped with ldns instead of bind as
resolver. Consequently the dig tool in base is replaced by drill. While dig can
still be installed as a third party application, it would be nice to make do
with the tools available in the system already.
This patch rearranges the command line used to invoke dig slightly so that it
can be used with both dig and drill (tested with dig 9.8.3-P1 and 9.9.4 as well
as drill 1.6.16). It would be really neat if the configure script could be
changed to automatically pick up drill when dig is not available (or the other
way around), but my autotools-foo is not good enough for that.
This part of the patch is an extended version of the locally maintained patch
currently deployed in the FreeBSD ports tree by Dmitry Sivachenko.
2014-07-30 15:22:33 +02:00
Jan Wagner
d0da78ced1 check_dns: returns incorrect state when specifying server
This patch verifies if the response is returned by the dns server we
are trying to check
---
Closes #981
Closes #982
Closes #1164
2014-07-30 13:16:37 +02:00
Sven Nierlein
2acf9a63d3 check_dns: added test for nonresponsive dns server (#982)
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-07-30 11:49:50 +02:00
Greg Cox
4273dd06ff Merge remote-tracking branch 'upstream/master'
Conflicts:
	plugins/netutils.c
2014-07-29 18:52:12 -04:00
Jan Wagner
cbb507c89f check_disk: show troubled partition in verbose mode
I'm submitting a small patch to check_disk that will show which partitions are
actually causing the error state. This helps the human operator to quickly
identify the exact issue. I made it so a single -v flag is required so it
doesn't harm legacy code that may be parsing the original style of output.

Thanks to Jason Benguerel.
---
Closes #984
Closes #1182
2014-07-29 22:06:25 +02:00
abrist
6f3d5825b2 check_ntp_time.c - Cleaned up usage and added a note
Closes #907
Closes #1184
2014-07-29 14:24:21 +02:00